Hello everybody, Org-mode version 7.8.11 (c8acf8d6957 @ GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601) of 2012-06-10 on MARVIN
while killing/yanking text from text files to my org file I found this limitation: I cannot create a link to a headline whose text contains a tab. Editing a file in Org will prevent to insert table in headlines: (and this is a good thing): * this is a tab, press tab * I get the Message: EMPTY ENTRY this is text I press tab (the text got aligned) ------------------------ let's import a different text file ----- this is file a.txt this is a tab tab! (from 13 to 16) -------------------------------------------------------- copy last line, then transform that line in headline: ** this is a tab tab! (from 16 to 24) I transformed the line in a 2nd level headline with C-* then I try to create a link to the 2nd level headline C-l :Messagge: Stored: this is a tab tab! (from 13 to 16) Now tab is from 32 to 40, ok Then I save the link C-c C-l in the message line I have the link to the headline without tabs, but only with spaces: file:~/test.org::*this is a tab tab! (from 13 to 16) However tab is kept in the description part of the link: [[*this%20is%20a%20tab%20tab!%20(from%2013%20to%2016)][this is a tab tab! (from 13 to 16)]] Obviously this link does not refer to the headline If I click on it, since org-link-search-must-match-exact-headline 'query-to-create Message is: "No match - create this as a new heading? " If I customize this variable useing fuzzy search, ("Its value is nil") the message is: if: No match Please, see the backtrace below. ** Substituting tab with %20 does NOT work as it is now [[*this%20is%20a%20tab%20tab!%20(from%2013%20to%2016)][this is a tab tab! (from 13 to 16)]] ** Substituting tab with does NOT work [[*this is a tab tab! (from 13 to 16)][this is a tab tab! (from 13 to 16)]] ** Substituting tab with %09 does NOT work %09 should be the URL Encode for tab [fn::http://www.tutorialspoint.com/html/html_url_encoding.htm] [[*this%20is%20a%20tab%09tab!%20(from%2013%20to%2016)][this is a tab tab! (from 13 to 16)]] ** So I know there's not tab in HTML [fn::http://htmltab.kb-creative.net/] What is the best approach? - a note in the documentation describing the limitation - a patch to enable tabs in links (since it is a corner case I will not prod for it) - a note suggesting to use :ID: property as the link is active if it has a :ID: (see below) ** this is a tab tab! (from 16 to 24) with wizard-of-ID :PROPERTIES: :ID: wizard_of_id :END: ** link to wizard of id [[*this%20is%20a%20tab%20tab!%20(from%2016%20to%2024)%20with%20wizard-of-ID][this is a tab tab! (from 16 to 24) with wizard-of-ID]] cheers, Giovanni ---------------------------------------------- Backtrace --------------------------------- signal(error ("No match")) error("No match") (if (or (and (org-search-not-self 1 re0 nil t) (setq type (quote dedicated))) (org-search-not-self 1 re1 nil t) (org-search-not-self 1 re2 nil t) (org-search-not-self 1 re2a nil t) (org-search-not-self 1 re3 nil t) (org-search-not-self 1 re4 nil t) (org-search-not-self 1 re5 nil t)) (goto-char (match-beginning 1)) (goto-char pos) (error "No match")) (cond ((eq type (quote org-occur)) (org-occur reall)) ((eq type (quote occur)) (org-do-occur (downcase reall) (quote cleanup))) (t (goto-char (point-min)) (setq type (quote fuzzy)) (if (or (and (org-search-not-self 1 re0 nil t) (setq type (quote dedicated))) (org-search-not-self 1 re1 nil t) (org-search-not-self 1 re2 nil t) (org-search-not-self 1 re2a nil t) (org-search-not-self 1 re3 nil t) (org-search-not-self 1 re4 nil t) (org-search-not-self 1 re5 nil t)) (goto-char (match-beginning 1)) (goto-char pos) (error "No match")))) (cond ((run-hook-with-args-until-success (quote org-execute-file-search-functions) s)) ((and (equal (string-to-char s0) 35) (> (length s0) 1) (save-excursion (goto-char (point-min)) (and (re-search-forward (concat "^[ ]*:CUSTOM_ID:[ ]+" (regexp-quote ...) "[ ]*$") nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos) (org-back-to-heading t))) ((save-excursion (goto-char (point-min)) (and (re-search-forward (concat "<<" (regexp-quote s0) ">>") nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos)) ((save-excursion (goto-char (point-min)) (and (re-search-forward (format "^[ ]*#\\+TARGET: %s" (regexp-quote s0)) nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos)) ((save-excursion (goto-char (point-min)) (and (re-search-forward (format "^[ ]*#\\+NAME: %s" (regexp-quote s0)) nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos)) ((and (string-match "^(\\(.*\\))$" s0) (save-excursion (goto-char (point-min)) (and (re-search-forward (concat "[^[]" (regexp-quote ...)) nil t) (setq type (quote dedicated) pos (1+ (match-beginning 0)))))) (goto-char pos)) ((string-match "^/\\(.*\\)/$" s) (cond ((derived-mode-p (quote org-mode)) (org-occur (match-string 1 s))) (t (org-do-occur (match-string 1 s))))) ((and (derived-mode-p (quote org-mode)) org-link-search-must-match-exact-headline) (and (equal (string-to-char s) 42) (setq s (substring s 1))) (goto-char (point-min)) (cond ((let (case-fold-search) (re-search-forward (format org-complex-heading-regexp-format (regexp-quote s)) nil t)) (setq type (quote dedicated)) (goto-char (match-beginning 0))) ((and (not org-link-search-inhibit-query) (eq org-link-search-must-match-exact-headline (quote query-to-create)) (y-or-n-p "No match - create this as a new heading? ")) (goto-char (point-max)) (or (bolp) (newline)) (insert "* " s "\n") (beginning-of-line 0)) (t (goto-char pos) (error "No match")))) (t (when (equal (string-to-char s) 42) (setq pre "^\\*+[ ]+\\(?:\\sw+\\)?[ ]*" post (org-re "[ ]*\\(?:[ ]+:[[:alnum:]_@#%:+]:[ ]*\\)?$") s (substring s 1))) (remove-text-properties 0 (length s) (quote (face nil mouse-face nil keymap nil fontified nil)) s) (setq words (org-split-string s "[ \n ]+") re0 (concat "\\(<<" (regexp-quote s0) ">>\\)") re2 (concat markers "\\(" (mapconcat (quote downcase) words "[ ]+") "\\)" markers) re2a_ (concat "\\(" (mapconcat (quote downcase) words "[ \n]+") "\\)[ \n]") re2a (concat "[ \n]" re2a_) re4_ (concat "\\(" (mapconcat (quote downcase) words "[^a-zA-Z_ \n]+") "\\)[^a-zA-Z_]") re4 (concat "[^a-zA-Z_]" re4_) re1 (concat pre re2 post) re3 (concat pre (if pre re4_ re4) post) re5 (concat pre ".*" re4) re2 (concat pre re2) re2a (concat pre (if pre re2a_ re2a)) re4 (concat pre (if pre re4_ re4)) reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" re5 "\\)")) (cond ((eq type (quote org-occur)) (org-occur reall)) ((eq type (quote occur)) (org-do-occur (downcase reall) (quote cleanup))) (t (goto-char (point-min)) (setq type (quote fuzzy)) (if (or (and (org-search-not-self 1 re0 nil t) (setq type ...)) (org-search-not-self 1 re1 nil t) (org-search-not-self 1 re2 nil t) (org-search-not-self 1 re2a nil t) (org-search-not-self 1 re3 nil t) (org-search-not-self 1 re4 nil t) (org-search-not-self 1 re5 nil t)) (goto-char (match-beginning 1)) (goto-char pos) (error "No match")))))) (let ((case-fold-search t) (s0 (mapconcat (quote identity) (org-split-string s "[ \n]+") " ")) (markers (concat "\\(?:" (mapconcat (lambda (x) (regexp-quote (car x))) (append (quote (... ... ... ...)) org-emphasis-alist) "\\|") "\\)")) (pos (point)) (pre nil) (post nil) words re0 re1 re2 re3 re4_ re4 re5 re2a re2a_ reall) (cond ((run-hook-with-args-until-success (quote org-execute-file-search-functions) s)) ((and (equal (string-to-char s0) 35) (> (length s0) 1) (save-excursion (goto-char (point-min)) (and (re-search-forward (concat "^[ ]*:CUSTOM_ID:[ ]+" ... "[ ]*$") nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos) (org-back-to-heading t))) ((save-excursion (goto-char (point-min)) (and (re-search-forward (concat "<<" (regexp-quote s0) ">>") nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos)) ((save-excursion (goto-char (point-min)) (and (re-search-forward (format "^[ ]*#\\+TARGET: %s" (regexp-quote s0)) nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos)) ((save-excursion (goto-char (point-min)) (and (re-search-forward (format "^[ ]*#\\+NAME: %s" (regexp-quote s0)) nil t) (setq type (quote dedicated) pos (match-beginning 0)))) (goto-char pos)) ((and (string-match "^(\\(.*\\))$" s0) (save-excursion (goto-char (point-min)) (and (re-search-forward (concat "[^[]" ...) nil t) (setq type (quote dedicated) pos (1+ ...))))) (goto-char pos)) ((string-match "^/\\(.*\\)/$" s) (cond ((derived-mode-p (quote org-mode)) (org-occur (match-string 1 s))) (t (org-do-occur (match-string 1 s))))) ((and (derived-mode-p (quote org-mode)) org-link-search-must-match-exact-headline) (and (equal (string-to-char s) 42) (setq s (substring s 1))) (goto-char (point-min)) (cond ((let (case-fold-search) (re-search-forward (format org-complex-heading-regexp-format ...) nil t)) (setq type (quote dedicated)) (goto-char (match-beginning 0))) ((and (not org-link-search-inhibit-query) (eq org-link-search-must-match-exact-headline (quote query-to-create)) (y-or-n-p "No match - create this as a new heading? ")) (goto-char (point-max)) (or (bolp) (newline)) (insert "* " s "\n") (beginning-of-line 0)) (t (goto-char pos) (error "No match")))) (t (when (equal (string-to-char s) 42) (setq pre "^\\*+[ ]+\\(?:\\sw+\\)?[ ]*" post (org-re "[ ]*\\(?:[ ]+:[[:alnum:]_@#%:+]:[ ]*\\)?$") s (substring s 1))) (remove-text-properties 0 (length s) (quote (face nil mouse-face nil keymap nil fontified nil)) s) (setq words (org-split-string s "[ \n ]+") re0 (concat "\\(<<" (regexp-quote s0) ">>\\)") re2 (concat markers "\\(" (mapconcat (quote downcase) words "[ ]+") "\\)" markers) re2a_ (concat "\\(" (mapconcat (quote downcase) words "[ \n]+") "\\)[ \n]") re2a (concat "[ \n]" re2a_) re4_ (concat "\\(" (mapconcat (quote downcase) words "[^a-zA-Z_ \n]+") "\\)[^a-zA-Z_]") re4 (concat "[^a-zA-Z_]" re4_) re1 (concat pre re2 post) re3 (concat pre (if pre re4_ re4) post) re5 (concat pre ".*" re4) re2 (concat pre re2) re2a (concat pre (if pre re2a_ re2a)) re4 (concat pre (if pre re4_ re4)) reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" re5 "\\)")) (cond ((eq type (quote org-occur)) (org-occur reall)) ((eq type (quote occur)) (org-do-occur (downcase reall) (quote cleanup))) (t (goto-char (point-min)) (setq type (quote fuzzy)) (if (or (and ... ...) (org-search-not-self 1 re1 nil t) (org-search-not-self 1 re2 nil t) (org-search-not-self 1 re2a nil t) (org-search-not-self 1 re3 nil t) (org-search-not-self 1 re4 nil t) (org-search-not-self 1 re5 nil t)) (goto-char (match-beginning 1)) (goto-char pos) (error "No match")))))) (and (derived-mode-p (quote org-mode)) (not stealth) (org-show-context (quote link-search))) type) org-link-search(#("*this is a tab tab! (from 13 to 16)" 0 35 (org-attr nil)) nil 1243) eval((org-link-search #("*this is a tab tab! (from 13 to 16)" 0 35 (org-attr nil)) nil 1243)) (progn (widen) (eval cmd)) (condition-case nil (let ((org-link-search-inhibit-query t)) (eval cmd)) (error (progn (widen) (eval cmd)))) (let ((cmd (\` (org-link-search (\, path) (\, (cond (... ...) (... ...) (t nil))) (\, pos))))) (condition-case nil (let ((org-link-search-inhibit-query t)) (eval cmd)) (error (progn (widen) (eval cmd))))) (cond ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) args1 (address path) (subject "") a) (if (string-match "\\(.*\\)::\\(.*\\)" path) (setq address (match-string 1 path) subject (org-link-escape (match-string 2 path)))) (while args (cond ((not (stringp ...)) (push (pop args) args1)) (t (setq a (pop args)) (if (string-match "%a" a) (setq a ...)) (if (string-match "%s" a) (setq a ...)) (push a args1)))) (apply cmd (nreverse args1)))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (concat type ":" (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((string= type "doi") (browse-url (concat org-doi-server-url (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((member type (quote ("message"))) (browse-url (concat type ":" path))) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur (concat "\\[" (regexp-quote path) "\\]"))) ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line (string-to-number (match-string 1 path)) path (substring path 0 (match-beginning 0))) (if (string-match "::\\(.+\\)\\'" path) (setq search (match-string 1 path) path (substring path 0 (match-beginning 0))))) (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (org-open-file path arg line search))) ((string= type "shell") (let ((cmd path)) (if (or (and (not (string= org-confirm-shell-link-not-regexp "")) (string-match org-confirm-shell-link-not-regexp cmd)) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function (format "Execute \"%s\" in shell? " (org-add-props cmd nil ... ...)))) (progn (message "Executing %s" cmd) (shell-command cmd)) (error "Abort")))) ((string= type "elisp") (let ((cmd path)) (if (or (and (not (string= org-confirm-elisp-link-not-regexp "")) (string-match org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " (org-add-props cmd nil ... ...)))) (message "%s => %s" cmd (if (equal (string-to-char cmd) 40) (eval (read cmd)) (call-interactively (read cmd)))) (error "Abort")))) ((and (string= type "thisfile") (run-hook-with-args-until-success (quote org-open-link-functions) path))) ((string= type "thisfile") (if arg (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer))) (org-mark-ring-push)) (let ((cmd (\` (org-link-search (\, path) (\, ...) (\, pos))))) (condition-case nil (let ((org-link-search-inhibit-query t)) (eval cmd)) (error (progn (widen) (eval cmd)))))) (t (browse-url-at-point))) (save-current-buffer (set-buffer (or reference-buffer (current-buffer))) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let ((tmp (funcall org-link-translation-function type path))) (setq type (car tmp) path (cdr tmp)))) (cond ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) args1 (address path) (subject "") a) (if (string-match "\\(.*\\)::\\(.*\\)" path) (setq address (match-string 1 path) subject (org-link-escape (match-string 2 path)))) (while args (cond ((not ...) (push ... args1)) (t (setq a ...) (if ... ...) (if ... ...) (push a args1)))) (apply cmd (nreverse args1)))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (concat type ":" (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((string= type "doi") (browse-url (concat org-doi-server-url (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((member type (quote ("message"))) (browse-url (concat type ":" path))) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur (concat "\\[" (regexp-quote path) "\\]"))) ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line (string-to-number (match-string 1 path)) path (substring path 0 (match-beginning 0))) (if (string-match "::\\(.+\\)\\'" path) (setq search (match-string 1 path) path (substring path 0 (match-beginning 0))))) (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (org-open-file path arg line search))) ((string= type "shell") (let ((cmd path)) (if (or (and (not ...) (string-match org-confirm-shell-link-not-regexp cmd)) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function (format "Execute \"%s\" in shell? " ...))) (progn (message "Executing %s" cmd) (shell-command cmd)) (error "Abort")))) ((string= type "elisp") (let ((cmd path)) (if (or (and (not ...) (string-match org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " ...))) (message "%s => %s" cmd (if (equal ... 40) (eval ...) (call-interactively ...))) (error "Abort")))) ((and (string= type "thisfile") (run-hook-with-args-until-success (quote org-open-link-functions) path))) ((string= type "thisfile") (if arg (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer))) (org-mark-ring-push)) (let ((cmd (\` (org-link-search ... ... ...)))) (condition-case nil (let ((org-link-search-inhibit-query t)) (eval cmd)) (error (progn (widen) (eval cmd)))))) (t (browse-url-at-point)))) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let ((tmp (funcall org-link-translation-function type path))) (setq type (car tmp) path (cdr tmp)))) (cond ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) args1 (address path) (subject "") a) (if (string-match "\\(.*\\)::\\(.*\\)" path) (setq address (match-string 1 path) subject (org-link-escape (match-string 2 path)))) (while args (cond ((not ...) (push ... args1)) (t (setq a ...) (if ... ...) (if ... ...) (push a args1)))) (apply cmd (nreverse args1)))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (concat type ":" (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((string= type "doi") (browse-url (concat org-doi-server-url (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((member type (quote ("message"))) (browse-url (concat type ":" path))) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur (concat "\\[" (regexp-quote path) "\\]"))) ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line (string-to-number (match-string 1 path)) path (substring path 0 (match-beginning 0))) (if (string-match "::\\(.+\\)\\'" path) (setq search (match-string 1 path) path (substring path 0 (match-beginning 0))))) (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (org-open-file path arg line search))) ((string= type "shell") (let ((cmd path)) (if (or (and (not ...) (string-match org-confirm-shell-link-not-regexp cmd)) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function (format "Execute \"%s\" in shell? " ...))) (progn (message "Executing %s" cmd) (shell-command cmd)) (error "Abort")))) ((string= type "elisp") (let ((cmd path)) (if (or (and (not ...) (string-match org-confirm-elisp-link-not-regexp cmd)) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function (format "Execute \"%s\" as elisp? " ...))) (message "%s => %s" cmd (if (equal ... 40) (eval ...) (call-interactively ...))) (error "Abort")))) ((and (string= type "thisfile") (run-hook-with-args-until-success (quote org-open-link-functions) path))) ((string= type "thisfile") (if arg (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer))) (org-mark-ring-push)) (let ((cmd (\` (org-link-search ... ... ...)))) (condition-case nil (let ((org-link-search-inhibit-query t)) (eval cmd)) (error (progn (widen) (eval cmd)))))) (t (browse-url-at-point)))) (let (type path link line search (pos (point))) (catch (quote match) (save-excursion (skip-chars-forward "^]\n ") (when (org-in-regexp org-bracket-link-regexp 1) (setq link (org-extract-attributes (org-link-unescape (org-match-string-no-properties 1)))) (while (string-match " *\n *" link) (setq link (replace-match " " t t link))) (setq link (org-link-expand-abbrev link)) (cond ((or (file-name-absolute-p link) (string-match "^\\.\\.?/" link)) (setq type "file" path link)) ((string-match org-link-re-with-space3 link) (setq type (match-string 1 link) path (match-string 2 link))) (t (setq type "thisfile" path link))) (throw (quote match) t))) (when (get-text-property (point) (quote org-linked-text)) (setq type "thisfile" pos (if (get-text-property (1+ (point)) (quote org-linked-text)) (1+ (point)) (point)) path (buffer-substring (or (previous-single-property-change pos (quote org-linked-text)) (point-min)) (or (next-single-property-change pos (quote org-linked-text)) (point-max)))) (throw (quote match) t)) (save-excursion (when (or (org-in-regexp org-angle-link-re) (org-in-regexp org-plain-link-re)) (setq type (match-string 1) path (org-link-unescape (match-string 2))) (throw (quote match) t))) (save-excursion (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ ]*$")) (setq type "tags" path (match-string 1)) (while (string-match ":" path) (setq path (replace-match "+" t t path))) (throw (quote match) t))) (when (org-in-regexp "<\\([^><\n]+\\)>") (setq type "tree-match" path (match-string 1)) (throw (quote match) t))) (unless path (error "No link found")) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let ((tmp (funcall org-link-translation-function type path))) (setq type (car tmp) path (cdr tmp)))) (cond ((assoc type org-link-protocols) (funcall (nth 1 (assoc type org-link-protocols)) path)) ((equal type "mailto") (let ((cmd (car org-link-mailto-program)) (args (cdr org-link-mailto-program)) args1 (address path) (subject "") a) (if (string-match "\\(.*\\)::\\(.*\\)" path) (setq address (match-string 1 path) subject (org-link-escape ...))) (while args (cond (... ...) (t ... ... ... ...))) (apply cmd (nreverse args1)))) ((member type (quote ("http" "https" "ftp" "news"))) (browse-url (concat type ":" (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((string= type "doi") (browse-url (concat org-doi-server-url (if (org-string-match-p "[[:nonascii:] ]" path) (org-link-escape path org-link-escape-chars-browser) path)))) ((member type (quote ("message"))) (browse-url (concat type ":" path))) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur (concat "\\[" (regexp-quote path) "\\]"))) ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line (string-to-number (match-string 1 path)) path (substring path 0 (match-beginning 0))) (if (string-match "::\\(.+\\)\\'" path) (setq search (match-string 1 path) path (substring path 0 ...)))) (if (string-match "[*?{]" (file-name-nondirectory path)) (dired path) (org-open-file path arg line search))) ((string= type "shell") (let ((cmd path)) (if (or (and ... ...) (not org-confirm-shell-link-function) (funcall org-confirm-shell-link-function ...)) (progn (message "Executing %s" cmd) (shell-command cmd)) (error "Abort")))) ((string= type "elisp") (let ((cmd path)) (if (or (and ... ...) (not org-confirm-elisp-link-function) (funcall org-confirm-elisp-link-function ...)) (message "%s => %s" cmd (if ... ... ...)) (error "Abort")))) ((and (string= type "thisfile") (run-hook-with-args-until-success (quote org-open-link-functions) path))) ((string= type "thisfile") (if arg (switch-to-buffer-other-window (org-get-buffer-for-internal-link (current-buffer))) (org-mark-ring-push)) (let ((cmd (\` ...))) (condition-case nil (let (...) (eval cmd)) (error (progn ... ...))))) (t (browse-url-at-point))))) (cond ((and (org-at-heading-p) (not (org-at-timestamp-p t)) (not (org-in-regexp (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-angle-link-re "\\|" "[ ]:[^ \n]+:[ ]*$"))) (not (get-text-property (point) (quote org-linked-text)))) (or (org-offer-links-in-entry arg) (progn (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((run-hook-with-args-until-success (quote org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (not (org-in-regexp org-bracket-link-regexp))) (org-footnote-action)) (t (let (type path link line search (pos (point))) (catch (quote match) (save-excursion (skip-chars-forward "^]\n ") (when (org-in-regexp org-bracket-link-regexp 1) (setq link (org-extract-attributes ...)) (while (string-match " *\n *" link) (setq link ...)) (setq link (org-link-expand-abbrev link)) (cond (... ...) (... ...) (t ...)) (throw (quote match) t))) (when (get-text-property (point) (quote org-linked-text)) (setq type "thisfile" pos (if (get-text-property ... ...) (1+ ...) (point)) path (buffer-substring (or ... ...) (or ... ...))) (throw (quote match) t)) (save-excursion (when (or (org-in-regexp org-angle-link-re) (org-in-regexp org-plain-link-re)) (setq type (match-string 1) path (org-link-unescape ...)) (throw (quote match) t))) (save-excursion (when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ ]*$")) (setq type "tags" path (match-string 1)) (while (string-match ":" path) (setq path ...)) (throw (quote match) t))) (when (org-in-regexp "<\\([^><\n]+\\)>") (setq type "tree-match" path (match-string 1)) (throw (quote match) t))) (unless path (error "No link found")) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let ((tmp ...)) (setq type (car tmp) path (cdr tmp)))) (cond ((assoc type org-link-protocols) (funcall (nth 1 ...) path)) ((equal type "mailto") (let (... ... args1 ... ... a) (if ... ...) (while args ...) (apply cmd ...))) ((member type (quote ...)) (browse-url (concat type ":" ...))) ((string= type "doi") (browse-url (concat org-doi-server-url ...))) ((member type (quote ...)) (browse-url (concat type ":" path))) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur (concat "\\[" ... "\\]"))) ((string= type "file") (if (string-match "::\\([0-9]+\\)\\'" path) (setq line ... path ...) (if ... ...)) (if (string-match "[*?{]" ...) (dired path) (org-open-file path arg line search))) ((string= type "shell") (let (...) (if ... ... ...))) ((string= type "elisp") (let (...) (if ... ... ...))) ((and (string= type "thisfile") (run-hook-with-args-until-success ... path))) ((string= type "thisfile") (if arg (switch-to-buffer-other-window ...) (org-mark-ring-push)) (let (...) (condition-case nil ... ...))) (t (browse-url-at-point))))))) (if (call-interactively (function org-babel-open-src-block-result)) nil (org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq org-window-config-before-follow-link (current-window-configuration)) (org-remove-occur-highlights nil nil t) (cond ((and (org-at-heading-p) (not (org-at-timestamp-p t)) (not (org-in-regexp (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-angle-link-re "\\|" "[ ]:[^ \n]+:[ ]*$"))) (not (get-text-property (point) (quote org-linked-text)))) (or (org-offer-links-in-entry arg) (progn (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((run-hook-with-args-until-success (quote org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (not (org-in-regexp org-bracket-link-regexp))) (org-footnote-action)) (t (let (type path link line search (pos (point))) (catch (quote match) (save-excursion (skip-chars-forward "^]\n ") (when (org-in-regexp org-bracket-link-regexp 1) (setq link ...) (while ... ...) (setq link ...) (cond ... ... ...) (throw ... t))) (when (get-text-property (point) (quote org-linked-text)) (setq type "thisfile" pos (if ... ... ...) path (buffer-substring ... ...)) (throw (quote match) t)) (save-excursion (when (or ... ...) (setq type ... path ...) (throw ... t))) (save-excursion (when (org-in-regexp ...) (setq type "tags" path ...) (while ... ...) (throw ... t))) (when (org-in-regexp "<\\([^><\n]+\\)>") (setq type "tree-match" path (match-string 1)) (throw (quote match) t))) (unless path (error "No link found")) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let (...) (setq type ... path ...))) (cond ((assoc type org-link-protocols) (funcall ... path)) ((equal type "mailto") (let ... ... ... ...)) ((member type ...) (browse-url ...)) ((string= type "doi") (browse-url ...)) ((member type ...) (browse-url ...)) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur ...)) ((string= type "file") (if ... ... ...) (if ... ... ...)) ((string= type "shell") (let ... ...)) ((string= type "elisp") (let ... ...)) ((and ... ...)) ((string= type "thisfile") (if arg ... ...) (let ... ...)) (t (browse-url-at-point))))))) (move-marker org-open-link-marker nil) (run-hook-with-args (quote org-follow-link-hook))) (unless (call-interactively (function org-babel-open-src-block-result)) (org-load-modules-maybe) (move-marker org-open-link-marker (point)) (setq org-window-config-before-follow-link (current-window-configuration)) (org-remove-occur-highlights nil nil t) (cond ((and (org-at-heading-p) (not (org-at-timestamp-p t)) (not (org-in-regexp (concat org-plain-link-re "\\|" org-bracket-link-regexp "\\|" org-angle-link-re "\\|" "[ ]:[^ \n]+:[ ]*$"))) (not (get-text-property (point) (quote org-linked-text)))) (or (org-offer-links-in-entry arg) (progn (require (quote org-attach)) (org-attach-reveal (quote if-exists))))) ((run-hook-with-args-until-success (quote org-open-at-point-functions))) ((org-at-timestamp-p t) (org-follow-timestamp-link)) ((and (or (org-footnote-at-reference-p) (org-footnote-at-definition-p)) (not (org-in-regexp org-bracket-link-regexp))) (org-footnote-action)) (t (let (type path link line search (pos (point))) (catch (quote match) (save-excursion (skip-chars-forward "^]\n ") (when (org-in-regexp org-bracket-link-regexp 1) (setq link ...) (while ... ...) (setq link ...) (cond ... ... ...) (throw ... t))) (when (get-text-property (point) (quote org-linked-text)) (setq type "thisfile" pos (if ... ... ...) path (buffer-substring ... ...)) (throw (quote match) t)) (save-excursion (when (or ... ...) (setq type ... path ...) (throw ... t))) (save-excursion (when (org-in-regexp ...) (setq type "tags" path ...) (while ... ...) (throw ... t))) (when (org-in-regexp "<\\([^><\n]+\\)>") (setq type "tree-match" path (match-string 1)) (throw (quote match) t))) (unless path (error "No link found")) (with-current-buffer (or reference-buffer (current-buffer)) (if (string-match " +\\'" path) (setq path (replace-match "" t t path))) (if (and org-link-translation-function (fboundp org-link-translation-function)) (let (...) (setq type ... path ...))) (cond ((assoc type org-link-protocols) (funcall ... path)) ((equal type "mailto") (let ... ... ... ...)) ((member type ...) (browse-url ...)) ((string= type "doi") (browse-url ...)) ((member type ...) (browse-url ...)) ((string= type "tags") (org-tags-view arg path)) ((string= type "tree-match") (org-occur ...)) ((string= type "file") (if ... ... ...) (if ... ... ...)) ((string= type "shell") (let ... ...)) ((string= type "elisp") (let ... ...)) ((and ... ...)) ((string= type "thisfile") (if arg ... ...) (let ... ...)) (t (browse-url-at-point))))))) (move-marker org-open-link-marker nil) (run-hook-with-args (quote org-follow-link-hook))) org-open-at-point() org-open-at-mouse((mouse-2 (#<window 3 on test.org> 1243 (171 . 50) 5105819 nil 1243 (19 . 3) nil (3 . 2) (8 . 16)))) call-interactively(org-open-at-mouse nil nil)