diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7e5db3d32..5cd6219e4 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2010-01-04 Carsten Dominik + * org.el (org-make-link-regexps): Allow regexp-special characters + in link types. + (org-open-file): When in-emacs is `system', also force system + opening, like when the value was `(16)'. + + * org-exp.el + (org-export-preprocess-before-normalizing-links-hook): New hook. + (org-export-preprocess-string): Run the new hook. + + * org.el (org-offer-links-in-entry): Make RET open all links. + * org-html.el (org-export-as-html): Remove any left-over display properties in the html file. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 615819cc7..20c6ce8fe 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -384,6 +384,10 @@ This is run just before backend-specific blocks get selected.") This is run after blockquote/quote/verse/center have been marked with cookies.") +(defvar org-export-preprocess-before-normalizing-links-hook nil + "Hook for preprocessing an export buffer. +This hook is run before links are normalized.") + (defvar org-export-preprocess-before-backend-specifics-hook nil "Hook run before backend-specific functions are called during preprocessing.") @@ -1388,6 +1392,7 @@ on this string to produce the exported version." ;; Normalize links: Convert angle and plain links into bracket links ;; and expand link abbreviations + (run-hooks 'org-export-preprocess-before-normalizing-links-hook) (org-export-normalize-links) ;; Find all internal links. If they have a fuzzy match (i.e. not diff --git a/lisp/org.el b/lisp/org.el index 888366ac6..9ce21cc55 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4401,33 +4401,33 @@ Here is what the match groups contain after a match: This should be called after the variable `org-link-types' has changed." (setq org-link-types-re (concat - "\\`\\(" (mapconcat 'identity org-link-types "\\|") "\\):") + "\\`\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):") org-link-re-with-space (concat - "?") org-link-re-with-space2 (concat - "?") org-link-re-with-space3 (concat - "") org-plain-link-re (concat - "\\<\\(" (mapconcat 'identity org-link-types "\\|") "\\):" + "\\<\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):" (org-re "\\([^ \t\n()<>]+\\(?:([[:word:]0-9]+)\\|\\([^[:punct:] \t\n]\\|/\\)\\)\\)")) ;; "\\([^]\t\n\r<>() ]+[^]\t\n\r<>,.;() ]\\)") org-bracket-link-regexp @@ -4435,7 +4435,7 @@ This should be called after the variable `org-link-types' has changed." org-bracket-link-analytic-regexp (concat "\\[\\[" - "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?" + "\\(\\(" (mapconcat 'regexp-quote org-link-types "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -4443,7 +4443,7 @@ This should be called after the variable `org-link-types' has changed." org-bracket-link-analytic-regexp++ (concat "\\[\\[" - "\\(\\(" (mapconcat 'identity (cons "coderef" org-link-types) "\\|") "\\):\\)?" + "\\(\\(" (mapconcat 'regexp-quote (cons "coderef" org-link-types) "\\|") "\\):\\)?" "\\([^]]+\\)" "\\]" "\\(\\[" "\\([^]]+\\)" "\\]\\)?" @@ -8583,19 +8583,44 @@ there is one, offer it as link number zero." (match-string 1 l)))))) links)) (org-fit-window-to-buffer (get-buffer-window "*Select Link*")) - (message "Select link to open:") + (message "Select link to open, RET to open all:") (setq c (read-char-exclusive)) (and (get-buffer "*Select Link*") (kill-buffer "*Select Link*")))) (when (equal c ?q) (error "Abort")) - (setq nth (- c ?0)) - (if have-zero (setq nth (1+ nth))) - (unless (and (integerp nth) (>= (length links) nth)) - (error "Invalid link selection")) - (setq link (nth (1- nth) links)))) + (if (equal c ?\C-m) + (setq link links) + (setq nth (- c ?0)) + (if have-zero (setq nth (1+ nth))) + (unless (and (integerp nth) (>= (length links) nth)) + (error "Invalid link selection")) + (setq link (list (nth (1- nth) links)))))) (if link - (progn (org-open-link-from-string link in-emacs (current-buffer)) t) + (let ((buf (current-buffer))) + (dolist (l link) + (org-open-link-from-string l in-emacs buf)) + t) nil))) +;; Add special file links that specify the way of opening + +(org-add-link-type "file+sys" 'org-open-file-with-system) +(org-add-link-type "file+emacs" 'org-open-file-with-emacs) +(defun org-open-file-with-system (path) + "Open file at PATH using the system way of opeing it." + (org-open-file path 'system)) +(defun org-open-file-with-emacs (path) + "Open file at PATH in emacs." + (org-open-file path 'emacs)) +(defun org-remove-file-link-modifiers () + "Remove the file link modifiers in `file+sys:' and `file+emacs:' links." + (goto-char (point-min)) + (while (re-search-forward "\\