diff options
author | Bastien Guerry <bzg@altern.org> | 2011-08-17 15:01:54 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-08-17 15:01:54 +0200 |
commit | 4774b1b026a2b0b90884d687d83a267521cc4078 (patch) | |
tree | 6dcca3002edc92a3aa10a5f08982c6c089dd2fc3 | |
parent | 58f1dbccf8e89368290ae0f916845c710f2116d0 (diff) | |
download | org-mode-4774b1b026a2b0b90884d687d83a267521cc4078.tar.gz |
org.el: Allow to customize the way links are displayed.
(org-link-display-descriptive): New option to customize the
default display of links, either literal or descriptive.
(org-toggle-link-display): New command to toggle link display.
(org-org-menu): Use the new toggle function for links.
Thanks to Reiner Steib for suggesting this.
-rw-r--r-- | lisp/org.el | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/lisp/org.el b/lisp/org.el index 46e7d61..17cd54e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1326,6 +1326,18 @@ description to use." :group 'org-link :type 'function) +(defcustom org-link-display-descriptive t + "Non-nil means Org will display descriptive links. +E.g. [[http://orgmode.org][Org website]] will be displayed as +\"Org Website\", hiding the link itself and just displaying its +description. When set to `nil', Org will display the full links +literally. + +You can interactively set the value of this variable using the +`org-toggle-link-display'." + :group 'org-link + :type 'boolean) + (defgroup org-link-store nil "Options concerning storing links in Org-mode." :tag "Org Store Link" @@ -18425,14 +18437,14 @@ See the individual commands for more information." ["Previous link" org-previous-link t] "--" ["Descriptive Links" - (progn (add-to-invisibility-spec '(org-link)) (org-restart-font-lock)) + org-toggle-link-display :style radio - :selected (member '(org-link) buffer-invisibility-spec)] + :selected org-link-display-descriptive + ] ["Literal Links" - (progn - (org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock)) + org-toggle-link-display :style radio - :selected (not (member '(org-link) buffer-invisibility-spec))]) + :selected (not org-link-display-descriptive)]) "--" ("TODO Lists" ["TODO/DONE/-" org-todo t] @@ -20489,6 +20501,17 @@ if no description is present" nil t link) link))) +(defun org-toggle-link-display () + "Toggle the literal or descriptive display of links." + (interactive) + (if org-link-display-descriptive + (progn (org-remove-from-invisibility-spec '(org-link)) + (org-restart-font-lock) + (setq org-link-display-descriptive nil)) + (progn (add-to-invisibility-spec '(org-link)) + (org-restart-font-lock) + (setq org-link-display-descriptive t)))) + ;; Speedbar support (defvar org-speedbar-restriction-lock-overlay (make-overlay 1 1) |