diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 56e290eb7..850a063dd 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2008-09-20 James TD Smith + * org.el (org-get-refile-targets): Replace links with their + descriptions + (org-imenu-get-tree): Replace links with their descriptions. + * org-remember.el (org-remember-apply-template): Add a new expansion for adding properties to remember items. diff --git a/lisp/org-compat.el b/lisp/org-compat.el index b4d2660aa..b293e5b1d 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -30,6 +30,8 @@ ;;; Code: +(require 'org-macs) + (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself (defconst org-format-transports-properties-p (let ((x "a")) diff --git a/lisp/org.el b/lisp/org.el index b1f6829ae..d066a298a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7866,7 +7866,7 @@ on the system \"/user@host:\"." (while (re-search-forward descre nil t) (goto-char (point-at-bol)) (when (looking-at org-complex-heading-regexp) - (setq txt (match-string 4) + (setq txt (org-link-display-format (match-string 4)) re (concat "^" (regexp-quote (buffer-substring (match-beginning 1) (match-end 4))))) @@ -9037,6 +9037,7 @@ This is done in the same way as adding a state change note." (interactive) (org-add-log-setup 'note nil 'findpos nil)) +(defvar org-property-end-re) (defun org-add-log-setup (&optional purpose state findpos how &optional extra) "Set up the post command hook to take a note. If this is about to TODO state change, the new state is expected in STATE. @@ -14676,7 +14677,8 @@ Show the heading too, if it is currently invisible." (setq level (org-reduced-level (funcall outline-level))) (when (<= level n) (looking-at org-complex-heading-regexp) - (setq head (org-match-string-no-properties 4) + (setq head (org-link-display-format + (org-match-string-no-properties 4)) m (org-imenu-new-marker)) (org-add-props head nil 'org-imenu-marker m 'org-imenu t) (if (>= level last-level) @@ -14693,6 +14695,17 @@ Show the heading too, if it is currently invisible." (if (eq major-mode 'org-mode) (org-show-context 'org-goto)))))) +(defun org-link-display-format (link) + "Replace a link with either the description, or the link target +if no description is present" + (save-match-data + (if (string-match org-bracket-link-analytic-regexp link) + (replace-match (or (match-string 5 link) + (concat (match-string 1 link) + (match-string 3 link))) + nil nil link) + link))) + ;; Speedbar support (defvar org-speedbar-restriction-lock-overlay (org-make-overlay 1 1)