* [feature request] startup variable for link display @ 2022-08-09 14:50 Fraga, Eric 2022-08-09 15:21 ` Max Nikulin 2023-12-22 12:07 ` [PATCH] " Ihor Radchenko 0 siblings, 2 replies; 10+ messages in thread From: Fraga, Eric @ 2022-08-09 14:50 UTC (permalink / raw) To: Emacs Org mode mailing list Hello all, Assuming I have not missed something, is there a variable I can set on visiting an org buffer/file that ensures that links are displayed fully? Once I've loaded an org file, I can M-x org-toggle-link-display RET. but I would like certain files to start up with links displayed. If not already possible, it would be nice to either set a file local variable or have, say: #+startup: displaylinks as options. thank you, eric -- : Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [feature request] startup variable for link display 2022-08-09 14:50 [feature request] startup variable for link display Fraga, Eric @ 2022-08-09 15:21 ` Max Nikulin 2022-08-09 15:46 ` Fraga, Eric 2023-12-22 12:07 ` [PATCH] " Ihor Radchenko 1 sibling, 1 reply; 10+ messages in thread From: Max Nikulin @ 2022-08-09 15:21 UTC (permalink / raw) To: emacs-orgmode On 09/08/2022 21:50, Fraga, Eric wrote: > > Once I've loaded an org file, I can > > M-x org-toggle-link-display RET. > > but I would like certain files to start up with links displayed. > > If not already possible, it would be nice to either set a file local > variable or have, say: > > #+startup: displaylinks Is it possible to use setter function for the defcustom to make the following work? # Local Variables: # org-link-descriptive: nil # End: Taking into account recent attempt of early setting of local variables some complications may ruin such idea. The setter is hardly an appropriate place for (org-restart-font-lock), but perhaps it may be skipped during loading. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [feature request] startup variable for link display 2022-08-09 15:21 ` Max Nikulin @ 2022-08-09 15:46 ` Fraga, Eric 2022-08-09 16:31 ` Max Nikulin 0 siblings, 1 reply; 10+ messages in thread From: Fraga, Eric @ 2022-08-09 15:46 UTC (permalink / raw) To: Max Nikulin; +Cc: emacs-orgmode@gnu.org Hi Max, On Tuesday, 9 Aug 2022 at 22:21, Max Nikulin wrote: > Is it possible to use setter function for the defcustom to make the > following work? I'm not sure what this means. > # Local Variables: > # org-link-descriptive: nil > # End: Ah, thank you for pointing out the variable. I didn't manage to find it. In any case, I tried this with both nil and t and neither value works (for me). Links are only shown by displaying the descriptive text. Maybe there is another setting that overrides? Thanks again, eric -- : Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50 ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [feature request] startup variable for link display 2022-08-09 15:46 ` Fraga, Eric @ 2022-08-09 16:31 ` Max Nikulin 2022-08-09 17:03 ` Fraga, Eric 0 siblings, 1 reply; 10+ messages in thread From: Max Nikulin @ 2022-08-09 16:31 UTC (permalink / raw) To: emacs-orgmode On 09/08/2022 22:46, Fraga, Eric wrote: > > On Tuesday, 9 Aug 2022 at 22:21, Max Nikulin wrote: >> Is it possible to use setter function for the defcustom to make the >> following work? > > I'm not sure what this means. I had in mind :set attribute of defcustom, see info "(elisp) Variable Definitions" https://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Definitions.html#index-set_002c-defcustom-keyword but I have realized that I am unsure it the function is called for local variables. The original idea was to execute something like code of `org-toggle-link-display'. >> # Local Variables: >> # org-link-descriptive: nil >> # End: > > Ah, thank you for pointing out the variable. I didn't manage to find > it. > > In any case, I tried this with both nil and t and neither value works > (for me). Links are only shown by displaying the descriptive text. > Maybe there is another setting that overrides? If I got it right, Ihor tried to fix it, but he had to revert the change intended to apply local variables earlier Ihor Radchenko to emacs-orgmode… Re: folding problems. Fri, 05 Aug 2022 19:37:10 +0800. https://list.orgmode.org/87k07mora1.fsf@localhost In the particular case of `org-link-descriptive' some code should be executed *after* changing of its value. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [feature request] startup variable for link display 2022-08-09 16:31 ` Max Nikulin @ 2022-08-09 17:03 ` Fraga, Eric 0 siblings, 0 replies; 10+ messages in thread From: Fraga, Eric @ 2022-08-09 17:03 UTC (permalink / raw) To: Max Nikulin; +Cc: emacs-orgmode@gnu.org Hi Max, On Tuesday, 9 Aug 2022 at 23:31, Max Nikulin wrote: > I had in mind :set attribute of defcustom, see info "(elisp) Variable > Definitions" I see. Thank you. > In the particular case of `org-link-descriptive' some code should be > executed *after* changing of its value. Oh, okay, that makes sense. And, yes, the issue of local variables etc. is complex as we found out last week! I can survive with manual invocation of the toggling command. It's usually only one document where I want to do this. Thanks again, eric -- : Eric S Fraga, with org release_9.5.4-720-g4db67d in Emacs 29.0.50 ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] Re: [feature request] startup variable for link display 2022-08-09 14:50 [feature request] startup variable for link display Fraga, Eric 2022-08-09 15:21 ` Max Nikulin @ 2023-12-22 12:07 ` Ihor Radchenko 2023-12-22 16:06 ` Rudolf Adamkovič 2024-01-22 13:03 ` Ihor Radchenko 1 sibling, 2 replies; 10+ messages in thread From: Ihor Radchenko @ 2023-12-22 12:07 UTC (permalink / raw) To: Fraga, Eric; +Cc: Emacs Org mode mailing list [-- Attachment #1: Type: text/plain, Size: 569 bytes --] "Fraga, Eric" <e.fraga@ucl.ac.uk> writes: > Assuming I have not missed something, is there a variable I can set on > visiting an org buffer/file that ensures that links are displayed fully? > > Once I've loaded an org file, I can > > M-x org-toggle-link-display RET. > > but I would like certain files to start up with links displayed. > > If not already possible, it would be nice to either set a file local > variable or have, say: > > #+startup: displaylinks I went with #+startup: showlinks and #+startup: compresslinks See the attached patch. Please test. [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-Allow-per-buffer-setting-of-org-link-descriptive-via.patch --] [-- Type: text/x-patch, Size: 5542 bytes --] From f180be291a81062a5c6344876c172282969d4c66 Mon Sep 17 00:00:00 2001 Message-ID: <f180be291a81062a5c6344876c172282969d4c66.1703246765.git.yantar92@posteo.net> From: Ihor Radchenko <yantar92@posteo.net> Date: Fri, 22 Dec 2023 13:04:04 +0100 Subject: [PATCH] Allow per-buffer setting of org-link-descriptive via #+STARTUP options * lisp/org.el (org-startup-options): Add new startup options to set `org-link-descriptive'. (org-mode): Move #+startup keyword parsing before setting up link visibility. * doc/org-manual.org (Link Format): (Summary of In-Buffer Settings): Document the new startup option. * etc/ORG-NEWS (~org-link-descriptive~ can now be set per-buffer via =#+STARTUP= options): Announce the new feature. Link: https://orgmode.org/list/87bkst1nfl.fsf@ucl.ac.uk --- doc/org-manual.org | 14 +++++++++++++- etc/ORG-NEWS | 8 ++++++++ lisp/org.el | 24 +++++++++++++----------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index cfa59ec37..da9d8c837 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -3172,7 +3172,8 @@ ** Link Format incomplete and the internals are again displayed as plain text. Inserting the missing bracket hides the link internals again. To show the internal structure of all links, use the menu: Org \rarr -Hyperlinks \rarr Literal links. +Hyperlinks \rarr Literal links, customize ~org-link-descriptive~, or use +=showlinks= [[*Summary of In-Buffer Settings][startup option]]. ** Internal Links :PROPERTIES: @@ -20229,6 +20230,17 @@ ** Summary of In-Buffer Settings | =inlineimages= | Show inline images. | | =noinlineimages= | Do not show inline images on startup. | + #+vindex: org-link-descriptive + Bracket links in Org buffers are displayed hiding the link path and + brackets. For example, =[[https://orgmode.org][Org Website]]= is, + by default, displayed as "Org Website", hiding the link itself and + just displaying its description. Alternatively, the links can be + displayed in full. The corresponding variable is + ~org-link-descriptive~. + + | =compresslinks= | Hide path and brackets in links. | + | =showlinks= | Do not hide anything. | + #+vindex: org-log-done #+vindex: org-log-note-clock-out #+vindex: org-log-repeat diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 6c81221c1..9b3f83705 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -362,6 +362,14 @@ The change is breaking when ~org-use-property-inheritance~ is set to ~t~. The =TEST= parameter is better served by Emacs debugging tools. ** New and changed options +*** ~org-link-descriptive~ can now be set per-buffer via =#+STARTUP= options + +In addition to ~org-link-descriptive~ custom option, link display can +now be controlled per-buffer as: + +: #+STARTUP: showlinks +: #+STARTUP: compresslinks + *** New variable ~org-clock-out-removed-last-clock~ The variable is intended to be used by ~org-clock-out-hook~. It is a diff --git a/lisp/org.el b/lisp/org.el index 6e6e075b4..7f7bc3000 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4061,6 +4061,8 @@ (defconst org-startup-options ("align" org-startup-align-all-tables t) ("noalign" org-startup-align-all-tables nil) ("shrink" org-startup-shrink-all-tables t) + ("compresslinks" org-link-descriptive t) + ("showlinks" org-link-descriptive nil) ("inlineimages" org-startup-with-inline-images t) ("noinlineimages" org-startup-with-inline-images nil) ("latexpreview" org-startup-with-latex-preview t) @@ -4847,6 +4849,17 @@ (define-derived-mode org-mode outline-mode "Org" (org-load-modules-maybe) (when org-agenda-file-menu-enabled (org-install-agenda-files-menu)) + (setq-local outline-regexp org-outline-regexp) + (setq-local outline-level 'org-outline-level) + ;; Initialize cache. + (org-element-cache-reset) + (when (and org-element-cache-persistent + org-element-use-cache) + (org-persist-load + `((elisp org-element--cache) (version ,org-element-cache-version)) + (current-buffer) + 'match-hash :read-related t)) + (org-set-regexps-and-options) (when (and org-link-descriptive (eq org-fold-core-style 'overlays)) (add-to-invisibility-spec '(org-link))) @@ -4857,8 +4870,6 @@ (define-derived-mode org-mode outline-mode "Org" (if org-link-descriptive (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible nil) (org-fold-core-set-folding-spec-property (car org-link--link-folding-spec) :visible t)) - (setq-local outline-regexp org-outline-regexp) - (setq-local outline-level 'org-outline-level) (when (and (stringp org-ellipsis) (not (equal "" org-ellipsis))) (unless org-display-table (setq org-display-table (make-display-table))) @@ -4867,15 +4878,6 @@ (define-derived-mode org-mode outline-mode "Org" (vconcat (mapcar (lambda (c) (make-glyph-code c 'org-ellipsis)) org-ellipsis))) (setq buffer-display-table org-display-table)) - ;; Initialize cache. - (org-element-cache-reset) - (when (and org-element-cache-persistent - org-element-use-cache) - (org-persist-load - `((elisp org-element--cache) (version ,org-element-cache-version)) - (current-buffer) - 'match-hash :read-related t)) - (org-set-regexps-and-options) (org-set-font-lock-defaults) (when (and org-tag-faces (not org-tags-special-faces-re)) ;; tag faces set outside customize.... force initialization. -- 2.42.0 [-- Attachment #3: Type: text/plain, Size: 224 bytes --] -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: [feature request] startup variable for link display 2023-12-22 12:07 ` [PATCH] " Ihor Radchenko @ 2023-12-22 16:06 ` Rudolf Adamkovič 2023-12-22 16:14 ` Ihor Radchenko 2024-01-22 13:03 ` Ihor Radchenko 1 sibling, 1 reply; 10+ messages in thread From: Rudolf Adamkovič @ 2023-12-22 16:06 UTC (permalink / raw) To: Ihor Radchenko, Fraga, Eric; +Cc: Emacs Org mode mailing list Ihor Radchenko <yantar92@posteo.net> writes: > #+startup: showlinks > and > #+startup: compresslinks Why not continue with established terminology? #+STARTUP: descriptivelinks #+STARTUP: literallinks Rudy -- "It is no paradox to say that in our most theoretical moods we may be nearest to our most practical applications." --- Alfred North Whitehead, 1861-1947 Rudolf Adamkovič <salutis@me.com> [he/him] Studenohorská 25 84103 Bratislava Slovakia ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: [feature request] startup variable for link display 2023-12-22 16:06 ` Rudolf Adamkovič @ 2023-12-22 16:14 ` Ihor Radchenko 0 siblings, 0 replies; 10+ messages in thread From: Ihor Radchenko @ 2023-12-22 16:14 UTC (permalink / raw) To: Rudolf Adamkovič; +Cc: Fraga, Eric, Emacs Org mode mailing list Rudolf Adamkovič <salutis@me.com> writes: >> #+startup: showlinks >> and >> #+startup: compresslinks > > Why not continue with established terminology? > > #+STARTUP: descriptivelinks > #+STARTUP: literallinks I do not have a strong opinion here. I used "show" following showstars/showeverything/etc and because it is shorter. "hide" did not fit though, which is why I went with "compress". -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: [feature request] startup variable for link display 2023-12-22 12:07 ` [PATCH] " Ihor Radchenko 2023-12-22 16:06 ` Rudolf Adamkovič @ 2024-01-22 13:03 ` Ihor Radchenko 2024-06-20 13:50 ` Rudolf Adamkovič 1 sibling, 1 reply; 10+ messages in thread From: Ihor Radchenko @ 2024-01-22 13:03 UTC (permalink / raw) To: Fraga, Eric; +Cc: Emacs Org mode mailing list Ihor Radchenko <yantar92@posteo.net> writes: > See the attached patch. Applied, onto main; after changing the terms to literallinks/descriptivelinks as suggested. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dd4fd0299 Done. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] Re: [feature request] startup variable for link display 2024-01-22 13:03 ` Ihor Radchenko @ 2024-06-20 13:50 ` Rudolf Adamkovič 0 siblings, 0 replies; 10+ messages in thread From: Rudolf Adamkovič @ 2024-06-20 13:50 UTC (permalink / raw) To: Ihor Radchenko, Fraga, Eric; +Cc: Emacs Org mode mailing list Ihor Radchenko <yantar92@posteo.net> writes: > Applied, onto main; after changing the terms to > literallinks/descriptivelinks as suggested. > https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=dd4fd0299 > Done. Thank you, Ihor! Rudy -- "I do not fear death. I had been dead for billions and billions of years before I was born, and had not suffered the slightest inconvenience from it." --- Mark Twain, paraphrased Rudolf Adamkovič <rudolf@adamkovic.org> [he/him] http://adamkovic.org ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-06-20 13:51 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-08-09 14:50 [feature request] startup variable for link display Fraga, Eric 2022-08-09 15:21 ` Max Nikulin 2022-08-09 15:46 ` Fraga, Eric 2022-08-09 16:31 ` Max Nikulin 2022-08-09 17:03 ` Fraga, Eric 2023-12-22 12:07 ` [PATCH] " Ihor Radchenko 2023-12-22 16:06 ` Rudolf Adamkovič 2023-12-22 16:14 ` Ihor Radchenko 2024-01-22 13:03 ` Ihor Radchenko 2024-06-20 13:50 ` Rudolf Adamkovič
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).