emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
@ 2017-04-20 13:53 Joe Corneli
  2017-04-20 19:35 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Corneli @ 2017-04-20 13:53 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I've noticed a problem with the link system.

Reproduction steps.

1. Find any text in a file, surrounded by parentheses (like this).

2. org-capture the region in parentheses to come up with, e.g.,

** TODO This is a problem
   (like this)
   [[file:~/test.tex::(like%20this)]]

3. Now try to follow the file:... link with org-open-at-point.

This triggers an error, with a backtrace as follows (between ~~~'s).

If you remove the leading parenthesis so that the link looks like this instead:

     [[file:~/test.tex::like%20this)]]

you can then jump to the captured text in the file, as expected.

~~~
Debugger entered--Lisp error: (error "No match for coderef: like this")
  signal(error ("No match for coderef: like this"))
  error("No match for coderef: like this")
  (condition-case err (org-link-search search) (error (funcall save-position-maybe) (error (nth 1 err))))
  (cond (line (org-goto-line line) (if (derived-mode-p (quote org-mode)) (progn (org-reveal)))) (search (condition-case err (org-link-search search) (error (funcall save-position-maybe) (error (nth 1 err))))))
  (cond ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) (while (string-match "['\"]%s['\"]" cmd) (setq cmd (replace-match "%s" t t cmd))) (setq cmd (replace-regexp-in-string "%s" (shell-quote-argument (convert-standard-filename file)) cmd nil t)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let ((match-index 1) (number-of-groups ...)) (set-match-data link-match-data) (while (<= match-index number-of-groups) (let ... ...) (setq match-index ...)))) (set-match-data save-match-data-internal (quote evaporate)))) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (message "Running %s...done" cmd) (start-process-shell-command cmd nil cmd) (and (boundp (quote org-wait)) (numberp org-wait) (sit-for org-wait))) (set-window-configuration wconfig)))) ((or (stringp cmd) (eq cmd (quote emacs))) (funcall (cdr (assq (quote file) org-link-frame-setup)) file) (widen) (cond (line (org-goto-line line) (if (derived-mode-p (quote org-mode)) (progn (org-reveal)))) (search (condition-case err (org-link-search search) (error (funcall save-position-maybe) (error (nth 1 err))))))) ((functionp cmd) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (set-match-data link-match-data) (condition-case nil (funcall cmd file link) ((debug wrong-number-of-arguments wrong-type-argument invalid-function) (user-error "Please see Org News for version 9.0 about `org-file-apps'--Lisp error: %S" cmd)))) (set-match-data save-match-data-internal (quote evaporate))))) ((consp cmd) (user-error "Please see Org News for version 9.0 about `org-file-apps'--Error: Deprecated usage of %S" cmd)) (t (funcall (cdr (assq (quote file) org-link-frame-setup)) file)))
  (let* ((file (if (equal path "") buffer-file-name (substitute-in-file-name (expand-file-name path)))) (file-apps (append org-file-apps (org-default-apps))) (apps (cl-remove-if (quote org-file-apps-entry-match-against-dlink-p) file-apps)) (apps-dlink (cl-remove-if-not (quote org-file-apps-entry-match-against-dlink-p) file-apps)) (remp (and (assq (quote remote) apps) (org-file-remote-p file))) (dirp (if remp nil (file-directory-p file))) (file (if (and dirp org-open-directory-means-index-dot-org) (concat (file-name-as-directory file) "index.org") file)) (a-m-a-p (assq (quote auto-mode) apps)) (dfile (downcase file)) (link (cond (line (concat file "::" (number-to-string line))) (search (concat file "::" search)) (t file))) (dlink (downcase link)) (ext (and (string-match "\\`.*?\\.\\([a-zA-Z0-9]+\\(\\.gz\\)?\\)\\'" dfile) (match-string 1 dfile))) (save-position-maybe (let ((old-buffer (current-buffer)) (old-pos (point)) (old-mode major-mode)) (function (lambda nil (and (derived-mode-p ...) (eq old-mode ...) (or ... ...) (org-mark-ring-push old-pos old-buffer)))))) cmd link-match-data) (cond ((member in-emacs (quote ((16) system))) (setq cmd (cdr (assq (quote system) apps)))) (in-emacs (setq cmd (quote emacs))) (t (setq cmd (or (and remp (cdr (assq ... apps))) (and dirp (cdr (assq ... apps))) (let ((match ...)) (if match (progn ... match) (progn ... nil))) (assoc-default dfile (org-apps-regexp-alist apps a-m-a-p) (quote string-match)) (cdr (assoc ext apps)) (cdr (assq t apps)))))) (if (eq cmd (quote system)) (progn (setq cmd (cdr (assq (quote system) apps))))) (if (eq cmd (quote default)) (progn (setq cmd (cdr (assoc t apps))))) (if (eq cmd (quote mailcap)) (progn (require (quote mailcap)) (mailcap-parse-mailcaps) (let* ((mime-type (mailcap-extension-to-mime (or ext ""))) (command (mailcap-mime-info mime-type))) (if (stringp command) (setq cmd command) (setq cmd (quote emacs)))))) (if (and (not (eq cmd (quote emacs))) (not (file-exists-p file)) (not org-open-non-existing-files)) (progn (user-error "No such file: %s" file))) (cond ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) (while (string-match "['\"]%s['\"]" cmd) (setq cmd (replace-match "%s" t t cmd))) (setq cmd (replace-regexp-in-string "%s" (shell-quote-argument (convert-standard-filename file)) cmd nil t)) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (let (... ...) (set-match-data link-match-data) (while ... ... ...))) (set-match-data save-match-data-internal (quote evaporate)))) (let ((wconfig (current-window-configuration))) (unwind-protect (progn (message "Running %s...done" cmd) (start-process-shell-command cmd nil cmd) (and (boundp ...) (numberp org-wait) (sit-for org-wait))) (set-window-configuration wconfig)))) ((or (stringp cmd) (eq cmd (quote emacs))) (funcall (cdr (assq (quote file) org-link-frame-setup)) file) (widen) (cond (line (org-goto-line line) (if (derived-mode-p (quote org-mode)) (progn (org-reveal)))) (search (condition-case err (org-link-search search) (error (funcall save-position-maybe) (error ...)))))) ((functionp cmd) (let ((save-match-data-internal (match-data))) (unwind-protect (progn (set-match-data link-match-data) (condition-case nil (funcall cmd file link) (... ...))) (set-match-data save-match-data-internal (quote evaporate))))) ((consp cmd) (user-error "Please see Org News for version 9.0 about `org-file-apps'--Error: Deprecated usage of %S" cmd)) (t (funcall (cdr (assq (quote file) org-link-frame-setup)) file))) (funcall save-position-maybe))
  org-open-file("~/test.tex" nil nil "(like this)")
  apply(org-open-file "~/test.tex" nil (nil "(like this)"))
  (if dedicated-function (funcall dedicated-function (concat path (and option (concat "::" option)))) (apply (function org-open-file) path (cond (arg) ((equal app "emacs") (quote emacs)) ((equal app "sys") (quote system))) (cond ((not option) nil) ((string-match-p "\\`[0-9]+\\'" option) (list (string-to-number option))) (t (list nil (org-link-unescape option))))))
  (let* ((option (org-element-property :search-option context)) (app (org-element-property :application context)) (dedicated-function (org-link-get-parameter (if app (concat type "+" app) type) :follow))) (if dedicated-function (funcall dedicated-function (concat path (and option (concat "::" option)))) (apply (function org-open-file) path (cond (arg) ((equal app "emacs") (quote emacs)) ((equal app "sys") (quote system))) (cond ((not option) nil) ((string-match-p "\\`[0-9]+\\'" option) (list (string-to-number option))) (t (list nil (org-link-unescape option)))))))
  (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (let* ((option (org-element-property :search-option context)) (app (org-element-property :application context)) (dedicated-function (org-link-get-parameter (if app (concat type "+" app) type) :follow))) (if dedicated-function (funcall dedicated-function (concat path (and option (concat "::" option)))) (apply (function org-open-file) path (cond (arg) ((equal app "emacs") (quote emacs)) ((equal app "sys") (quote system))) (cond ((not option) nil) ((string-match-p "\\`[0-9]+\\'" option) (list (string-to-number option))) (t (list nil (org-link-unescape option))))))))
  (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (let* ((option (org-element-property :search-option context)) (app (org-element-property :application context)) (dedicated-function (org-link-get-parameter (if app ... type) :follow))) (if dedicated-function (funcall dedicated-function (concat path (and option ...))) (apply (function org-open-file) path (cond (arg) (... ...) (... ...)) (cond (... nil) (... ...) (t ...))))))) ((functionp (org-link-get-parameter type :follow)) (funcall (org-link-get-parameter type :follow) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (if (run-hook-with-args-until-success (quote org-open-link-functions) path) nil (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer)))) (let ((destination (save-excursion (save-restriction ... ... ...)))) (if (and (<= (point-min) destination) (>= (point-max) destination)) nil (widen)) (goto-char destination)))) (t (browse-url-at-point)))
  (save-current-buffer (set-buffer (or reference-buffer (current-buffer))) (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (let* ((option (org-element-property :search-option context)) (app (org-element-property :application context)) (dedicated-function (org-link-get-parameter ... :follow))) (if dedicated-function (funcall dedicated-function (concat path ...)) (apply (function org-open-file) path (cond ... ... ...) (cond ... ... ...)))))) ((functionp (org-link-get-parameter type :follow)) (funcall (org-link-get-parameter type :follow) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (if (run-hook-with-args-until-success (quote org-open-link-functions) path) nil (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer)))) (let ((destination (save-excursion ...))) (if (and (<= ... destination) (>= ... destination)) nil (widen)) (goto-char destination)))) (t (browse-url-at-point))))
  (let ((type (org-element-property :type context)) (path (org-link-unescape (org-element-property :path context)))) (save-current-buffer (set-buffer (or reference-buffer (current-buffer))) (cond ((equal type "file") (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (let* ((option ...) (app ...) (dedicated-function ...)) (if dedicated-function (funcall dedicated-function ...) (apply ... path ... ...))))) ((functionp (org-link-get-parameter type :follow)) (funcall (org-link-get-parameter type :follow) path)) ((member type (quote ("coderef" "custom-id" "fuzzy" "radio"))) (if (run-hook-with-args-until-success (quote org-open-link-functions) path) nil (if (not arg) (org-mark-ring-push) (switch-to-buffer-other-window (org-get-buffer-for-internal-link ...))) (let ((destination ...)) (if (and ... ...) nil (widen)) (goto-char destination)))) (t (browse-url-at-point)))))
  (cond ((not context) (user-error "No link found")) ((memq type (quote (comment comment-block keyword node-property))) (call-interactively (function org-open-at-point-global))) ((and (memq type (quote (headline inlinetask))) (let ((case-fold-search nil)) (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not (match-beginning 5)) (< (point) (match-beginning 5))))) (let* ((data (org-offer-links-in-entry (current-buffer) (point) arg)) (links (car data)) (links-end (cdr data))) (if links (let ((--dolist-tail-- (if ... ... links))) (while --dolist-tail-- (let (...) (search-forward link nil links-end) (goto-char ...) (org-open-at-point) (setq --dolist-tail-- ...)))) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((and (eq type (quote clock)) value (>= (point) (org-element-property :begin value)) (<= (point) (org-element-property :end value))) (org-follow-timestamp-link)) ((>= (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " 	") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (let ((case-fold-search nil)) (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= (point) (match-beginning 5))))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-link-unescape (org-element-property :path context)))) (save-current-buffer (set-buffer (or reference-buffer (current-buffer))) (cond ((equal type "file") (if (string-match "[*?{]" ...) (dired path) (let* ... ...))) ((functionp (org-link-get-parameter type :follow)) (funcall (org-link-get-parameter type :follow) path)) ((member type (quote ...)) (if (run-hook-with-args-until-success ... path) nil (if ... ... ...) (let ... ... ...))) (t (browse-url-at-point)))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " 	") (let ((begin ...)) (if begin (< ... begin) (= ... ...)))))) (org-footnote-action)) (t (user-error "No link found")))
  (let* ((context (org-element-lineage (org-element-context) (quote (clock comment comment-block footnote-definition footnote-reference headline inlinetask keyword link node-property timestamp)) t)) (type (org-element-type context)) (value (org-element-property :value context))) (cond ((not context) (user-error "No link found")) ((memq type (quote (comment comment-block keyword node-property))) (call-interactively (function org-open-at-point-global))) ((and (memq type (quote (headline inlinetask))) (let ((case-fold-search nil)) (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not (match-beginning 5)) (< (point) (match-beginning 5))))) (let* ((data (org-offer-links-in-entry (current-buffer) (point) arg)) (links (car data)) (links-end (cdr data))) (if links (let ((--dolist-tail-- ...)) (while --dolist-tail-- (let ... ... ... ... ...))) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((and (eq type (quote clock)) value (>= (point) (org-element-property :begin value)) (<= (point) (org-element-property :end value))) (org-follow-timestamp-link)) ((>= (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " 	") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (let ((case-fold-search nil)) (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= (point) (match-beginning 5))))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-link-unescape (org-element-property :path context)))) (save-current-buffer (set-buffer (or reference-buffer (current-buffer))) (cond ((equal type "file") (if ... ... ...)) ((functionp ...) (funcall ... path)) ((member type ...) (if ... nil ... ...)) (t (browse-url-at-point)))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " 	") (let (...) (if begin ... ...))))) (org-footnote-action)) (t (user-error "No link found"))))
  (if (run-hook-with-args-until-success (quote org-open-at-point-functions)) nil (let* ((context (org-element-lineage (org-element-context) (quote (clock comment comment-block footnote-definition footnote-reference headline inlinetask keyword link node-property timestamp)) t)) (type (org-element-type context)) (value (org-element-property :value context))) (cond ((not context) (user-error "No link found")) ((memq type (quote (comment comment-block keyword node-property))) (call-interactively (function org-open-at-point-global))) ((and (memq type (quote (headline inlinetask))) (let ((case-fold-search nil)) (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (or (not ...) (< ... ...)))) (let* ((data (org-offer-links-in-entry ... ... arg)) (links (car data)) (links-end (cdr data))) (if links (let (...) (while --dolist-tail-- ...)) (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((and (eq type (quote clock)) value (>= (point) (org-element-property :begin value)) (<= (point) (org-element-property :end value))) (org-follow-timestamp-link)) ((>= (point) (save-excursion (goto-char (org-element-property :end context)) (skip-chars-backward " 	") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote (headline inlinetask))) (let ((case-fold-search nil)) (save-excursion (beginning-of-line) (looking-at org-complex-heading-regexp)) (and (match-beginning 5) (>= ... ...)))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type (org-element-property :type context)) (path (org-link-unescape ...))) (save-current-buffer (set-buffer (or reference-buffer ...)) (cond (... ...) (... ...) (... ...) (t ...))))) ((or (eq type (quote footnote-reference)) (and (eq type (quote footnote-definition)) (save-excursion (skip-chars-forward " 	") (let ... ...)))) (org-footnote-action)) (t (user-error "No link found")))))
  (if (call-interactively (quote org-babel-open-src-block-result)) nil (org-load-modules-maybe) (setq org-window-config-before-follow-link (current-window-configuration)) (org-remove-occur-highlights nil nil t) (if (run-hook-with-args-until-success (quote org-open-at-point-functions)) nil (let* ((context (org-element-lineage (org-element-context) (quote (clock comment comment-block footnote-definition footnote-reference headline inlinetask keyword link node-property timestamp)) t)) (type (org-element-type context)) (value (org-element-property :value context))) (cond ((not context) (user-error "No link found")) ((memq type (quote (comment comment-block keyword node-property))) (call-interactively (function org-open-at-point-global))) ((and (memq type (quote ...)) (let (...) (save-excursion ... ...) (or ... ...))) (let* ((data ...) (links ...) (links-end ...)) (if links (let ... ...) (require ...) (org-attach-reveal ...)))) ((and (eq type (quote clock)) value (>= (point) (org-element-property :begin value)) (<= (point) (org-element-property :end value))) (org-follow-timestamp-link)) ((>= (point) (save-excursion (goto-char ...) (skip-chars-backward " 	") (point))) (user-error "No link found")) ((eq type (quote timestamp)) (org-follow-timestamp-link)) ((and (memq type (quote ...)) (let (...) (save-excursion ... ...) (and ... ...))) (org-tags-view arg (substring (match-string 5) 0 -1))) ((eq type (quote link)) (let ((type ...) (path ...)) (save-current-buffer (set-buffer ...) (cond ... ... ... ...)))) ((or (eq type (quote footnote-reference)) (and (eq type ...) (save-excursion ... ...))) (org-footnote-action)) (t (user-error "No link found"))))) (run-hook-with-args (quote org-follow-link-hook)))
  org-open-at-point(nil)
  funcall-interactively(org-open-at-point nil)
  call-interactively(org-open-at-point nil nil)
  command-execute(org-open-at-point)
~~~

Details of my system:

Emacs  : GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.13)
 of 2016-08-15
Package: Org mode version 9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)

current state:
==============
(setq
 org-tree-slide-mode-hook '(toggle-org-cloaking)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
                      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
                          org-babel-speed-command-activate)
 org-agenda-diary-file "~/postdoc.git/org/work.org"
 org-occur-hook '(org-first-headline-recenter)
 org-use-fast-todo-selection 'prefix
 org-clock-in-prepare-hook '((lambda nil
                              (if (not pomodoro-is-active)
                               (let
                                ((minutes
                                  (read-number "Start timer: "
                                   90)
                                  )
                                 )
                                (when org-timer-current-timer
                                 (org-timer-stop))
                                (org-timer-set-timer minutes)
                                (pomodoro-mode))
                               )
                              )
                             )
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-log-done 'note
 org-latex-format-inlinetask-function 'org-latex-format-inlinetask-default-function
 org-confirm-shell-link-function 'yes-or-no-p
 org-image-actual-width nil
 org-finalize-agenda-hook '(remove-todo-and-cookies
                            place-agenda-tags)
 org-ascii-format-inlinetask-function 'org-ascii-format-inlinetask-default
 org-latex-pdf-process '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f  %f")
 org-agenda-prefix-format '((agenda . " %i %-10:c%?-12t% s")
                            (timeline . "  % s")
                            (todo . " %i %-12:c")
                            (tags . " %i %-12:c")
                            (search . " %i %-12:c"))
 org-agenda-custom-commands '(("a" agenda ""
                               ((org-agenda-include-diary t)
                                (org-agenda-remove-tags t))
                               )
                              )
 org-latex-format-headline-function 'org-latex-format-headline-default-function
 org-default-notes-file "~/postdoc.git/org/blotter.org"
 org-todo-keyword-faces '(("META" :foreground "darkgreen"
                           :background "snow" :box
                           (:line-width -1))
                          ("NOTE" :foreground "lightgreen"
                           :weight bold)
                          ("LOW" :foreground "#cb4b16"
                           :background "snow" :weight bold :box
                           (:line-width -1))
                          ("MED" :foreground "goldenrod"
                           :background "cornsilk" :weight bold
                           :box (:line-width -1))
                          ("HIGH" :foreground "darkgreen"
                           :background "honeydew" :weight bold
                           :box (:line-width -1))
                          ("NICE" :foreground "blue"
                           :background "honeydew" :weight bold
                           :box (:line-width -1))
                          ("MUST" :foreground "purple"
                           :background "honeydew" :weight bold
                           :box (:line-width -1))
                          ("TODO" :foreground "black"
                           :background "snow" :weight bold :box
                           (:line-width -1))
                          ("DONE" . org-done)
                          ("WONTFIX" . org-done)
                          ("ONICE" . org-done)
                          ("QUESTION" . org-done))
 org-capture-templates '(("c" "Comment" entry
                          (file+headline
                           "~/postdoc.git/org/blotter.org"
                           "Comments")
                          "* COMMENT %?\n  %i\n  %a\n:PROPERTIES:\n:captured: %U\n:END:")
                         ("q" "Question" entry
                          (file+headline
                           "~/postdoc.git/org/blotter.org"
                           "Questions")
                          "* QUESTION %?\n  %i\n  %a\n:PROPERTIES:\n:captured: %U\n:END:")
                         ("t" "Todo" entry
                          (file+headline
                           "~/postdoc.git/org/blotter.org"
                           "Tasks")
                          "* TODO %?\n  %i\n  %a")
                         ("n" "Note" entry
                          (file+headline
                           "~/postdoc.git/org/blotter.org"
                           "Notes")
                          "* NOTE %?\n  %i\n  %a")
                         ("c" "calfw2org" entry (file nil)
                          "* %?\n %(cfw:org-capture-day)")
                         )
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _ CONTENTS)"]
 org-odt-format-headline-function 'org-odt-format-headline-default-function
 org-from-is-user-regexp "\\<Joe\\>"
 org-html-postamble t
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
                     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '((lambda nil
                  (font-lock-add-keywords nil
                   (quote
                    (("^\\s-*?\\(-\\{1\\}\\|[0-9]+\\.\\)\\s-" 1
                      font-lock-warning-face t)
                     )
                    )
                   )
                  (font-lock-add-keywords nil
                   (quote
                    (("^\\(-\\{5,\\}\\)" 1 font-lock-type-face
                      t)
                     )
                    )
                   )
                  )
                 (closure
                  (org-inlinetask-min-level
                   buffer-face-mode-face org-mode-map
                   org-tbl-menu org-org-menu org-struct-menu
                   org-entities org-last-state
                   org-id-track-globally org-clock-start-time
                   texmathp-why remember-data-file
                   org-agenda-tags-todo-honor-ignore-options
                   iswitchb-temp-buflist
                   calc-embedded-open-mode
                   calc-embedded-open-formula
                   calc-embedded-close-formula
                   align-mode-rules-list org-emphasis-alist
                   org-emphasis-regexp-components
                   org-export-registered-backends org-modules
                   org-babel-load-languages t)
                  nil
                  (add-hook (quote change-major-mode-hook)
                   (quote org-show-block-all) (quote append)
                   (quote local))
                  )
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook
                    org-babel-show-result-all append local]
                   5]
                 org-babel-result-hide-spec
                 org-babel-hide-all-hashes)
 org-refile-targets '((org-agenda-files :maxlevel . 1)
                      ("~/postdoc.git/org/alt/backlog.org"
                       :maxlevel . 1)
                      )
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-make-link-description-function 'rewrite-link
 org-agenda-sorting-strategy '((agenda todo-state-down tag-up
                                category-keep priority-down)
                               (todo todo-state-down tag-up
                                priority-down category-keep)
                               (tags priority-down
                                category-keep)
                               (search category-keep))
 org-ascii-format-drawer-function #[771 ".\207" [] 4 "\n\n(fn NAME CONTENTS WIDTH)"]
 org-odt-format-inlinetask-function 'org-odt-format-inlinetask-default-function
 org-ctrl-c-ctrl-c-hook '(org-babel-hash-at-point
                          org-babel-execute-safely-maybe)
 org-timer-done-hook '((lambda nil (message "Timer done!")
                        (when pomodoro-is-active
                         (save-excursion
                          (set-buffer
                           (get-file-buffer
                            org-agenda-diary-file)
                           )
                          (pomodoro-mode -1))
                         (message "Pomodoro done!")
                         (notifications-notify :title
                          "time over" :body
                          "record comments and take a break")
                         (start-process-shell-command "cvlc"
                          nil
                          (concat
                           "cvlc --play-and-exit --no-video "
                           timer-done-sound-file)
                          )
                         (org-clock-out))
                        )
                       )
 org-cycle-hook '(org-cycle-hide-archived-subtrees
                  org-cycle-hide-drawers
                  org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
 org-agenda-hide-tags-regexp "write"
 org-archive-location "~/postdoc.git/org/work.org::datetree/"
 org-agenda-use-time-grid nil
 org-agenda-finalize-hook '(remove-todo-and-cookies
                            place-agenda-tags)
 org-export-before-processing-hook '((lambda (x)
                                      (setq
                                       org-html-postamble-format
                                       (list
                                        
                                                                  (list
                                                                   
                                                                   
                                                                        "en"
                                                                   
                                                                   
                                                                        (concat
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                              
                                                                                   "<p class=\"author\">Author: %a</p>\n<p class=\"date\">Created: %d</p>\n<p class=\"date\">Revised: "
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                              
                                                                                   (format-time-string "%B %-d, %Y")
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                         
                                                                              
                                                                                   "</p>\n<p class=\"validation\">%v</p>")
                                                                   
                                                                   
                                                                        )
                                        
                                                                  )
                                       )
                                      )
                                     )
 org-todo-keywords '((sequence "META(M)" "NOTE(n)" "NICE(i)"
                      "LOW(l)" "MED(m)" "HIGH(h)" "MUST(u)"
                      "TODO(t)" "|" "DONE(d)" "WONTFIX(w)"
                      "ONICE(o)" "QUESTION(q)")
                     )
 org-timer-default-timer 90
 org-export-allow-bind-keywords t
 org-babel-tangle-lang-exts '(("clojure" . "clj")
                              ("emacs-lisp" . "el")
                              ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME CONTENTS)"]
 org-html-format-headline-function 'org-html-format-headline-default-function
 org-link-parameters '(("id" :follow org-id-open)
                       ("rmail" :follow org-rmail-open :store
                        org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store
                        org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store
                        org-irc-store-link)
                       ("info" :follow org-info-open :export
                        org-info-export :store
                        org-info-store-link)
                       ("gnus" :follow org-gnus-open :store
                        org-gnus-store-link)
                       ("docview" :follow org-docview-open
                        :export org-docview-export :store
                        org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store
                        org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export
                        org-bbdb-export :complete
                        org-bbdb-complete-link :store
                        org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link)
                       ("cite" :follow org-bibtex-goto-citation
                        :export nil)
                       ("mu4e" :follow org-mu4e-open :export
                        nil)
                       ("file+sys") ("file+emacs")
                       ("doi" :follow org--open-doi-link)
                       ("elisp" :follow org--open-elisp-link)
                       ("file" :complete org-file-complete-link)
                       ("ftp" :follow
                        (lambda (path)
                         (browse-url (concat "ftp:" path)))
                        )
                       ("help" :follow org--open-help-link)
                       ("http" :follow
                        (lambda (path)
                         (browse-url (concat "http:" path)))
                        )
                       ("https" :follow
                        (lambda (path)
                         (browse-url (concat "https:" path)))
                        )
                       ("mailto" :follow
                        (lambda (path)
                         (browse-url (concat "mailto:" path)))
                        )
                       ("news" :follow
                        (lambda (path)
                         (browse-url (concat "news:" path)))
                        )
                       ("shell" :follow org--open-shell-link))
 org-structure-template-alist '(("s"
                                 "#+BEGIN_SRC ?\n\n#+END_SRC")
                                ("e"
                                 "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE")
                                ("q"
                                 "#+BEGIN_QUOTE\n?\n#+END_QUOTE")
                                ("v"
                                 "#+BEGIN_VERSE\n?\n#+END_VERSE")
                                ("V"
                                 "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM")
                                ("c"
                                 "#+BEGIN_CENTER\n?\n#+END_CENTER")
                                ("l"
                                 "#+BEGIN_LaTeX\n?\n#+END_LaTeX")
                                ("L" "#+LaTeX: ")
                                ("h"
                                 "#+BEGIN_HTML\n?\n#+END_HTML")
                                ("H" "#+HTML: ")
                                ("a"
                                 "#+BEGIN_ASCII\n?\n#+END_ASCII")
                                ("A" "#+ASCII: ")
                                ("i" "#+INDEX: ?")
                                ("I" "#+INCLUDE: %file ?")
                                ("x"
                                 "#+BEGIN_COMMENT\n?\n#+END_COMMENT")
                                )
 org-babel-load-languages '((clojure . t) (emacs-lisp . t))
 org-clock-sound t
 org-cycle-global-at-bob t
 org-tree-slide-slide-in-effect nil
 org-agenda-include-deadlines nil
 org-html-format-inlinetask-function 'org-html-format-inlinetask-default-function
 org-agenda-mode-hook '(hide-notes)
 org-agenda-files '("~/postdoc.git/org/")
 org-clock-out-hook '((lambda nil
                       (when (timerp org-timer-countdown-timer)
                        (save-excursion
                         (set-buffer
                          (get-file-buffer
                           org-agenda-diary-file)
                          )
                         (pomodoro-mode -1))
                        (cancel-timer org-timer-countdown-timer)
                        )
                       (let
                        ((comments (read-string "Comments: ")))
                        (save-excursion
                         (org-set-property "SUMMARY" comments))
                        )
                       (let
                        ((minutes
                          (read-number "Take a break: " 5))
                         )
                        (when (> minutes 0) (org-agenda-list)
                         (org-agenda-diary-entry-in-org-file-programmatically
                          (concat
                           
                                                                               (int-to-string minutes)
                           
                                                                               " minute break "
                           
                                                                               (substring
                                                                                
                                                                                
                                                                                
                                                                                                 (current-time-string)
                                                                                
                                                                                
                                                                                
                                                                                                 11 16)
                           
                                                                               )
                          )
                         (org-agenda-list)
                         (search-forward "break")
                         (goto-char (line-beginning-position))
                         (org-timer-set-timer minutes))
                        )
                       )
                      org-clock-remove-empty-clock-drawer)
 )

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-04-20 13:53 Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)] Joe Corneli
@ 2017-04-20 19:35 ` Nicolas Goaziou
  2017-04-20 21:46   ` Joe Corneli
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-04-20 19:35 UTC (permalink / raw)
  To: Joe Corneli; +Cc: emacs-orgmode

Hello,

Joe Corneli <holtzermann17@gmail.com> writes:

> I've noticed a problem with the link system.
>
> Reproduction steps.
>
> 1. Find any text in a file, surrounded by parentheses (like this).
>
> 2. org-capture the region in parentheses to come up with, e.g.,
>
> ** TODO This is a problem
>    (like this)
>    [[file:~/test.tex::(like%20this)]]
>
> 3. Now try to follow the file:... link with org-open-at-point.
>
> This triggers an error, with a backtrace as follows (between ~~~'s).
>
> If you remove the leading parenthesis so that the link looks like this instead:
>
>      [[file:~/test.tex::like%20this)]]
>
> you can then jump to the captured text in the file, as expected.
>
> ~~~
> Debugger entered--Lisp error: (error "No match for coderef: like this")

The error message should give you the answer. Links within parenthesis
denote "coderefs". See (info "(org) Literal examples").

[[file:~/test.tex::(like%20this)]] means to refer to a coderef (like
this) in the file "test.tex".

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-04-20 19:35 ` Nicolas Goaziou
@ 2017-04-20 21:46   ` Joe Corneli
  2017-04-20 22:12     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Corneli @ 2017-04-20 21:46 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list

On Thu, Apr 20, 2017 at 8:35 PM, Nicolas Goaziou
> Joe Corneli <holtzermann17@gmail.com> writes:
>> Debugger entered--Lisp error: (error "No match for coderef: like this")
>
> The error message should give you the answer. Links within parenthesis
> denote "coderefs". See (info "(org) Literal examples").
>
> [[file:~/test.tex::(like%20this)]] means to refer to a coderef (like
> this) in the file "test.tex".

In my opinion, capture and/or search should do something different for
text beginning "(" and ending with ")",  when this text is a link
target that is not within a code block.

The docs say:

"In literal examples, Org will interpret strings like ‘(ref:name)’ as labels"

But the text (like this) in my example wasn't inside of a code block,
nor was it presented as (ref:like this).

Joe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-04-20 21:46   ` Joe Corneli
@ 2017-04-20 22:12     ` Nicolas Goaziou
  2017-04-20 23:02       ` Joe Corneli
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2017-04-20 22:12 UTC (permalink / raw)
  To: Joe Corneli; +Cc: Org-mode mailing list

Joe Corneli <holtzermann17@gmail.com> writes:

> In my opinion, capture and/or search should do something different for
> text beginning "(" and ending with ")",  when this text is a link
> target that is not within a code block.

See below.

> The docs say:
>
> "In literal examples, Org will interpret strings like ‘(ref:name)’ as
> labels"
>
> But the text (like this) in my example wasn't inside of a code block,
> nor was it presented as (ref:like this).

There are two syntaxs: the one within the code block, which is (ref:xxx)
by default and can be changed, and the one outside the block, which is
(xxx), and cannot be changed. See the following example from the manual:

     #+BEGIN_SRC emacs-lisp -n -r
     (save-excursion                  (ref:sc)
        (goto-char (point-min)))      (ref:jump)
     #+END_SRC
     In line [[(sc)]] we remember the current position.  [[(jump)][Line (jump)]]
     jumps to point-min.

Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-04-20 22:12     ` Nicolas Goaziou
@ 2017-04-20 23:02       ` Joe Corneli
  2017-04-21  7:04         ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Joe Corneli @ 2017-04-20 23:02 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: Org-mode mailing list

The (xxx) form for a link target, especially one outside of a block,
doesn't seem to have meaning within the document model that Org
understands.  So, yes, this explains *why* I am seeing the error
described above.  But I still think there is a legitimate bug report
here, since the behaviour is not likely to be expected by the user.
Someone in my position has no interest in code refs, I was only trying
to link to a bit of text in the buffer.  Saying "oh but you can't link
to this *one* kind of text" is perhaps a fair move.  On the other
hand, given that "following a link" just means "run a search process",
that search process *could* be smart enough to notice that "no coderef
was found, maybe the user meant to link to some plain text in
parentheses".  Then I wouldn't see an error.

On Thu, Apr 20, 2017 at 11:12 PM, Nicolas Goaziou
<mail@nicolasgoaziou.fr> wrote:
> Joe Corneli <holtzermann17@gmail.com> writes:
>
>> In my opinion, capture and/or search should do something different for
>> text beginning "(" and ending with ")",  when this text is a link
>> target that is not within a code block.
>
> See below.
>
>> The docs say:
>>
>> "In literal examples, Org will interpret strings like ‘(ref:name)’ as
>> labels"
>>
>> But the text (like this) in my example wasn't inside of a code block,
>> nor was it presented as (ref:like this).
>
> There are two syntaxs: the one within the code block, which is (ref:xxx)
> by default and can be changed, and the one outside the block, which is
> (xxx), and cannot be changed. See the following example from the manual:
>
>      #+BEGIN_SRC emacs-lisp -n -r
>      (save-excursion                  (ref:sc)
>         (goto-char (point-min)))      (ref:jump)
>      #+END_SRC
>      In line [[(sc)]] we remember the current position.  [[(jump)][Line (jump)]]
>      jumps to point-min.
>
> Regards,

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)]
  2017-04-20 23:02       ` Joe Corneli
@ 2017-04-21  7:04         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2017-04-21  7:04 UTC (permalink / raw)
  To: Joe Corneli; +Cc: Org-mode mailing list

Hello,

Joe Corneli <holtzermann17@gmail.com> writes:

> The (xxx) form for a link target, especially one outside of a block,
> doesn't seem to have meaning within the document model that Org
> understands.

Of course it does. It belongs to the link syntax. See, for example
`org-link-search' docstring. It could, however, be more visible in the
manual. In particular, it could be emphasized in both (info "(org)
Internal links") and (info "(org) External links"). Patch welcome !

> But I still think there is a legitimate bug report here, since the
> behaviour is not likely to be expected by the user.

Only if the user doesn't know about the syntax, which shouldn't happen
if the manual was great.

> Someone in my position has no interest in code refs, I was only trying
> to link to a bit of text in the buffer. Saying "oh but you can't link
> to this *one* kind of text" is perhaps a fair move. On the other hand,
> given that "following a link" just means "run a search process", that
> search process *could* be smart enough to notice that "no coderef was
> found, maybe the user meant to link to some plain text in
> parentheses". Then I wouldn't see an error.

But then, you wouldn't catch real, but mis-typed, coderef links. At
least, the error tells you something is wrong in the link syntax,
without creating false positives. So, I don't think this would be a net
gain overall.

Note that the same happens if your regular search text starts with an
asterisk. Org will understand you're looking after headlines only, which
may not be what you want. Ditto with the hash sign.

Org has some syntax for links, you need to know about it if you don't
want to get bitten. Hopefully, the manual could help you about it.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-21  7:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20 13:53 Bug: link beginning with parenthesis doesn't work [9.0.5 (release_9.0.5-474-g942b62 @ /home/joe/org-mode/lisp/)] Joe Corneli
2017-04-20 19:35 ` Nicolas Goaziou
2017-04-20 21:46   ` Joe Corneli
2017-04-20 22:12     ` Nicolas Goaziou
2017-04-20 23:02       ` Joe Corneli
2017-04-21  7:04         ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).