d12frosted / vino

It's your cellar, your dear cantina.
GNU General Public License v3.0
37 stars 2 forks source link

Functionality to copy wine #40

Open d12frosted opened 3 years ago

d12frosted commented 3 years ago

Like it is done in +org-wine.el:

(defun wine/copy-wine ()
  "Create a new wine entry based on wine entry at point."
  (interactive)
  (wine-require-wine-entry)
  (let* ((winery (+org-entry-get "WINERY"))
         (name (+org-entry-get "NAME"))
         (region (+org-entry-get "REGION"))
         (appellation (+org-entry-get "APPELLATION"))
         (grapes (+org-entry-get "GRAPES"))
         (volume (+org-entry-get "VOLUME"))
         (colour (+org-entry-get "COLOUR"))
         (carbonation (+org-entry-get "CARBONATION"))
         (id (+brain-new-child wine-parent (cadr winery))))
    (org-with-point-at (org-id-find id t)
      (+org-entry-set "WINERY" winery)
      (+org-entry-set "NAME" name)
      (+org-entry-set "REGION" region)
      (+org-entry-set "APPELLATION" appellation)
      (+org-entry-set "GRAPES" grapes)
      (+org-entry-set "VOLUME" volume)
      (+org-entry-set "COLOUR" colour)
      (+org-entry-set "CARBONATION" carbonation)
      (+org-prompt-property "YEAR")
      (+org-prompt-number-property "SUGAR")
      (+org-prompt-number-property "ALCOHOL")
      (+org-prompt-property "PRICE")
      (while (wine--add-url (read-string "URL: ")))
      (when (y-or-n-p "Acquire? ")
        (call-interactively #'wine/acquire))
      (save-buffer)
      (wine-refresh-entry)
      (save-buffer))))
d12frosted commented 3 years ago

On the second though, I don't like how it worked in +org-wine.el. I would rather present a list of properties and user may choose what to change. Because the only value that doesn't change with vintage is producer (though maybe I just didn't find such wine yet). Few examples:

So I am leaving this ticket as is, will just lower priority.