0

Update: I have fixed it, seem like we need stranform-square-bracket-function to due with "p" protocal

(use-package org
  :hook
  (org-mode . turn-on-visual-line-mode)
  :config
  (setq org-directory "~/org/capture/")
  ;; Capture templates for links to pages having [ and ]
  ;; characters in their page titles - notably ArXiv
  ;; From https://github.com/sprig/org-capture-extension
  (require 'org-protocol)
  (defun transform-square-brackets-to-round-ones(string-to-transform)
    "Transforms [ into ( and ] into ), other chars left unchanged."
    (concat 
     (mapcar #'(lambda (c) (if (equal c ?[) ?\( (if (equal c ?]) ?\) c))) string-to-transform)))
  (setq org-capture-templates `(
                                ("p" "Protocol" entry (file+headline ,(concat org-directory "notes_" (shell-command-to-string "date +%F__%H-%M-%S_%Z")) "Inbox")
                                               "* %^{Title_and_tag}\nSource: [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?") 
                                ("L" "Protocol Link" entry (file+headline ,(concat org-directory "notes_" (shell-command-to-string "date +%F__%H-%M-%S_%Z")) "Inbox")
                                 "* %^{Title_and_tag}\n [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n")
                                )))

Above is working org config of myself. Thank everyone

Old

This question with the similar content can be found in 2018 but until now there is no solution. It is not the error because (debug on error) not show anything. It simply not work. And some time it work! I dont know why it suddenly work,and after i restart emacs it not work again!, there is just something wrong when firefox or emacs update. I am not professional on emacslisp so I cannot debug. The author of this extension don't update it after 1 year https://github.com/sprig/org-capture-extension.

;; Add org-protocol for org-capture

(unless (server-running-p)
  (server-start));;for emacs client
(require 'org-protocol)
(setq org-modules (quote (org-protocol)))
;; org-capture templates
(require 'org-capture)
(use-package org-protocol
  :demand
  :config
  (setq org-capture-templates `(
                                ("p" "Protocol" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
                                 "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n*** Tag is %^{Tag}%?")
                                ("L" "Protocol Link" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
                                 "* %? [[%:link][%:description]] \nCaptured On: %U" :prepend t)
                                )))
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.