davep / pinboard.el

A pinboard.in client for Emacs.
GNU General Public License v3.0
41 stars 5 forks source link

Org-mode integration #8

Closed khinsen closed 4 years ago

khinsen commented 5 years ago

First of all, thanks for this very useful add-on for Emacs!

I added a small bit of code to make it easier to transfer pins to org-mode documents. It adds support for org-store-link to pinboard-mode buffers. It's probably not worth adding to pinboard.el because it would create a dependency on org-mode, but I'll leave it here for anyone interested:

(defun org-pinboard-store-link ()
  "Store a link taken from a pinboard buffer."
  (when (eq major-mode 'pinboard-mode)
    (pinboard-with-current-pin pin
      (org-store-link-props
       :type "pinboard"
       :link (alist-get 'href pin)
       :description (alist-get 'description pin)))))

(org-link-set-parameters "pinboard"
                           :follow #'browse-url
                           :store #2 org-pinboard-store-link)
davep commented 5 years ago

Thanks! This sounds like a great idea. However, I was just trying it out to see the effect (I'm not a great org-mode user so don't know too much about it) and I'm getting this when I try and evaluate the call to org-link-set-parameters in the above:

Debugger entered--Lisp error: (invalid-read-syntax "#")
  read(#<buffer *scratch*>)
  elisp--preceding-sexp()
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

I'm guessing the issue is the #2 in the above. Am I missing something?

By the way, do you have this in a repo or a gist? If so I'd happily link to it from the README.

davep commented 4 years ago

Playing/guessing here, it seems this does the job:

(org-link-set-parameters
 "pinboard"
 :follow #'browse-url
 :store #'org-pinboard-store-link)

Is that correct? (the #2 was really supposed to be a function quote?).

Playing with it it looks very useful, thanks. (and one more reason why I should really try and find a work to use org-mode more).

khinsen commented 4 years ago

Your guess is right. No idea how that mistake crept in during what should have been a trivial copy-and-paste action!

A gist is a good idea, so here it comes: https://gist.github.com/khinsen/7ed357eed9b27f142e4fa6f5c4ad45dd

Finally, yes, org-mode rocks. The ability to link to just about anything, including e-mail, is a feature that I haven't found in any other tool yet.

davep commented 4 years ago

Thanks for that! Mention added to the README and visible as part of v1.2.