From: Michael Brand <michael.ch.brand@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Link "bracket-types"
Date: Sat, 12 May 2018 10:12:13 +0200 [thread overview]
Message-ID: <CALn3zohEW80jXUQVdpnK+d4RhoxegYuLJKhco1ohFBk+-qSs=A@mail.gmail.com> (raw)
In-Reply-To: <8736yynuqo.fsf@nicolasgoaziou.fr>
[-- Attachment #1: Type: text/plain, Size: 327 bytes --]
Hi Nicolas
Thank you for the patch. I changed it (attached) to something that
preserves org-toggle-link-display and allows more different configs
for more different usages, please see the docstring of
org-link-brackets. I tried it out with org-toggle-link-display and for
org-link-brackets '(0 0), '(1 1) and '(0 2).
Michael
[-- Attachment #2: org-link-brackets.diff --]
[-- Type: application/octet-stream, Size: 2064 bytes --]
diff --git a/lisp/org.el b/lisp/org.el
index 2cfe466..261d5ed 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1897,6 +1897,28 @@ You can interactively set the value of this variable by calling
:group 'org-link
:type 'boolean)
+(defcustom org-link-brackets '(0 0)
+ "Number of bracket pairs shown while `org-descriptive-links' is t.
+
+The first element is for descriptive links and can be 0 or 1. The
+second element is for non-descriptive links and can be 0, 1 or 2.
+
+Value examples:
+
+'(1 1) can be useful for a better navigation and editing
+experience at the beginning and end of a link.
+
+'(0 2) can be useful to get the same table alignment and
+paragraph filling for non-descriptive links as in Org also in
+non-Org tools. For descriptive links this is not possible,
+therefore in this example the default 0."
+
+ ;; TODO: Type and value check for customization.
+ ;; TODO: Just a list was simple for a first step but is possibly not
+ ;; state of the art for such a config.
+
+ :group 'org-link)
+
(defcustom org-link-file-path-type 'adaptive
"How the path name in file links should be stored.
Valid values are:
@@ -5914,8 +5936,19 @@ This includes angle, plain, and bracket links."
,(or (org-link-get-parameter type :display)
'org-link))
properties))
- (visible-start (or (match-beginning 4) (match-beginning 2)))
- (visible-end (or (match-end 4) (match-end 2))))
+ (visible-start
+ (or
+ ;; For descriptive links.
+ (match-beginning
+ (if (zerop (car org-link-brackets)) 4 3))
+ ;; For non-descriptive links.
+ (- (match-beginning 2) (cadr org-link-brackets))))
+ (visible-end
+ (or
+ ;; For descriptive links.
+ (match-end (if (zerop (car org-link-brackets)) 4 3))
+ ;; For non-descriptive links.
+ (+ (match-end 2) (cadr org-link-brackets)))))
(add-text-properties start visible-start hidden)
(add-text-properties visible-start visible-end properties)
(add-text-properties visible-end end hidden)
next prev parent reply other threads:[~2018-05-12 8:12 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 6:08 Link "bracket-types" Michael Brand
2018-05-10 8:14 ` Nicolas Goaziou
2018-05-10 8:32 ` Eric S Fraga
2018-05-11 12:34 ` Nicolas Goaziou
2018-05-11 13:20 ` Eric S Fraga
2018-05-10 9:41 ` Michael Brand
2018-05-10 12:44 ` Nicolas Goaziou
2018-05-10 13:23 ` Michael Brand
2018-05-10 13:33 ` Nicolas Goaziou
2018-05-10 14:29 ` Michael Brand
2018-05-10 16:27 ` Nicolas Goaziou
2018-05-10 19:58 ` Samuel Wales
2018-05-12 23:35 ` Samuel Wales
2018-05-13 11:10 ` Eric S Fraga
2018-05-10 19:59 ` Michael Brand
2018-05-11 0:22 ` Nicolas Goaziou
2018-05-11 13:10 ` Nicolas Goaziou
2018-05-11 13:55 ` Michael Brand
2018-05-11 14:15 ` Nicolas Goaziou
2018-05-12 8:12 ` Michael Brand [this message]
2018-05-17 16:17 ` Michael Brand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALn3zohEW80jXUQVdpnK+d4RhoxegYuLJKhco1ohFBk+-qSs=A@mail.gmail.com' \
--to=michael.ch.brand@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.