From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Marco Wahl <marcowahlsoft@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [RFC] Change visibility for bracket links
Date: Wed, 05 Oct 2016 23:13:49 +0200 [thread overview]
Message-ID: <87h98qmrci.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <8460p6u4jg.fsf@gmail.com> (Marco Wahl's message of "Wed, 05 Oct 2016 18:46:59 +0200")
[-- Attachment #1: Type: text/plain, Size: 297 bytes --]
Marco Wahl <marcowahlsoft@gmail.com> writes:
> I think there is an issue with the coloring when writing text
> immediately to the right of a file link. E.g.
>
> [[file:shot.png]]text
You are right. I didn't check the patch thoroughly. Here is an update,
which should be more robust.
Regards,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Change-bracket-links-visibility.patch --]
[-- Type: text/x-diff, Size: 5912 bytes --]
From 518363a2b794fc21d28987dd59a65c0efa1d9ce4 Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Date: Wed, 5 Oct 2016 17:22:15 +0200
Subject: [PATCH] Change bracket links visibility
* lisp/org.el (org-activate-bracket-links): Leave a pair of brackets
around bracket links so as to facilitate editing them. Small
refactoring.
(org-beginning-of-line):
(org-end-of-line): Remove workaround bug #14346, since the original
report cannot be reproduced.
* testing/lisp/test-org.el (test-org/beginning-of-line): Fix test.
---
lisp/org.el | 66 +++++++++++++++++++++---------------------------
testing/lisp/test-org.el | 4 +--
2 files changed, 31 insertions(+), 39 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 6d5201b..fcc60d3 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6163,7 +6163,6 @@ by a #."
(match-string-no-properties 2 hl))))
(link-start (match-beginning 0))
(link-end (match-end 0))
- (bracketp t)
(help-echo (org-link-get-parameter type :help-echo))
(help (cond
((stringp help-echo)
@@ -6199,44 +6198,43 @@ by a #."
(t
`(:uri ,(format "%s:%s" type path)))))
(activate-func (org-link-get-parameter type :activate-func))
- ;; invisible part
- (ip (list 'invisible (or
- (org-link-get-parameter type :display)
- 'org-link)
- 'face face
- 'keymap keymap
- 'mouse-face mouse-face
- 'font-lock-multiline t
- 'help-echo help
- 'htmlize-link htmlize-link))
- ;; visible part
+ ;; Visible part.
(vp (list 'keymap keymap
'face face
'mouse-face mouse-face
'font-lock-multiline t
'help-echo help
- 'htmlize-link htmlize-link)))
- ;; We need to remove the invisible property here. Table narrowing
- ;; may have made some of this invisible.
+ 'htmlize-link htmlize-link))
+ ;; Invisible part.
+ (ip (append (list 'invisible
+ (or (org-link-get-parameter type :display)
+ 'org-link))
+ vp)))
+ ;; We need to remove the invisible property here. Table
+ ;; narrowing may have made some of this invisible.
(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
(remove-text-properties (match-beginning 0) (match-end 0)
'(invisible nil))
- (if (match-end 3)
+ (if (match-end 2)
(progn
- (add-text-properties (match-beginning 0) (match-beginning 3) ip)
- (org-rear-nonsticky-at (match-beginning 3))
- (add-text-properties (match-beginning 3) (match-end 3) vp)
- (org-rear-nonsticky-at (match-end 3))
- (add-text-properties (match-end 3) (match-end 0) ip)
- (org-rear-nonsticky-at (match-end 0)))
- (add-text-properties (match-beginning 0) (match-beginning 1) ip)
- (org-rear-nonsticky-at (match-beginning 1))
- (add-text-properties (match-beginning 1) (match-end 1) vp)
- (org-rear-nonsticky-at (match-end 1))
- (add-text-properties (match-end 1) (match-end 0) ip)
- (org-rear-nonsticky-at (match-end 0)))
+ (add-text-properties (match-beginning 0) (match-beginning 2) ip)
+ (add-text-properties (match-beginning 2) (match-end 2) vp)
+ (add-text-properties (match-end 2) (match-end 0) ip)
+ ;; Make sure text after the visible closing bracket gets
+ ;; past the whole link.
+ (add-text-properties (match-end 2) (match-end 0)
+ `(rear-nonsticky ,ip))
+ (add-text-properties (match-end 2) (match-end 0)
+ `(front-sticky ,ip)))
+ (add-text-properties (match-beginning 0) (1+ (match-beginning 0)) ip)
+ (add-text-properties (1+ (match-beginning 0)) (1+ (match-end 1)) vp)
+ (add-text-properties (1+ (match-end 1)) (match-end 0) ip)
+ ;; Make sure text after the visible closing bracket gets past
+ ;; the whole link.
+ (add-text-properties (match-end 1) (match-end 0) `(rear-nonsticky ,ip))
+ (add-text-properties (match-end 1) (match-end 0) `(front-sticky ,ip)))
(when activate-func
- (funcall activate-func link-start link-end path bracketp))
+ (funcall activate-func link-start link-end path t))
t)))
(defun org-activate-dates (limit)
@@ -23762,10 +23760,7 @@ beyond the end of the headline."
;; point was already at beginning of line and command is
;; repeated.
(when (and (= (point) pos) (eq last-command this-command))
- (goto-char after-bullet))))))))
- (setq disable-point-adjustment
- (or (not (invisible-p (point)))
- (not (invisible-p (max (point-min) (1- (point))))))))
+ (goto-char after-bullet)))))))))
(defun org-end-of-line (&optional arg)
"Go to the end of the line.
@@ -23802,10 +23797,7 @@ the cursor is already beyond the end of the headline."
;; If element is hidden, `move-end-of-line' would put point
;; after it. Use `end-of-line' to stay on current line.
(call-interactively 'end-of-line))
- (t (call-interactively move-fun))))))
- (setq disable-point-adjustment
- (or (not (invisible-p (point)))
- (not (invisible-p (max (point-min) (1- (point))))))))
+ (t (call-interactively move-fun)))))))
(define-key org-mode-map "\C-a" 'org-beginning-of-line)
(define-key org-mode-map "\C-e" 'org-end-of-line)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 56ccfd6..29d933b 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2491,10 +2491,10 @@ http://article.gmane.org/gmane.emacs.orgmode/21459/"
;; asterisk.
(should
(org-test-with-temp-text "*<point>"
- (let ((org-special-ctrl-a/e t)) (org-beginning-of-line))))
+ (let ((org-special-ctrl-a/e t)) (org-beginning-of-line) t)))
(should
(org-test-with-temp-text "*<point>"
- (let ((org-special-ctrl-a/e nil)) (org-beginning-of-line)))))
+ (let ((org-special-ctrl-a/e nil)) (org-beginning-of-line) t))))
(ert-deftest test-org/end-of-line ()
"Test `org-end-of-line' specifications."
--
2.9.3
next prev parent reply other threads:[~2016-10-05 21:13 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-05 15:40 [RFC] Change visibility for bracket links Nicolas Goaziou
2016-10-05 15:46 ` Rainer M Krug
2016-10-05 16:46 ` Marco Wahl
2016-10-05 21:13 ` Nicolas Goaziou [this message]
2016-10-05 19:21 ` Detlef Steuer
[not found] ` <520C9DD6-7764-4B07-8E7A-FB42CC0CDF8A@dagertech.net>
2016-10-05 21:30 ` David A. Gershman
2016-10-05 22:26 ` Nicolas Goaziou
2016-10-06 0:16 ` David A. Gershman
2016-10-06 0:27 ` Clément Pit--Claudel
2016-10-07 6:13 ` Nicolas Goaziou
2016-10-12 9:27 ` Rasmus
[not found] ` <e78992df838c44419e7893671dbe2adb@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-10-06 7:38 ` Eric S Fraga
2016-10-06 14:53 ` William Denton
2016-10-08 2:38 ` Adam Porter
2016-10-08 3:50 ` Clément Pit--Claudel
2016-10-08 4:00 ` Adam Porter
2016-10-10 14:17 ` Nick Dokos
2016-10-10 14:56 ` Clément Pit--Claudel
2016-10-10 16:28 ` Nick Dokos
2016-10-14 20:00 ` Joost Kremers
2016-10-14 21:24 ` Thomas S. Dye
2016-10-12 7:10 ` Daniele Nicolodi
2016-10-12 10:37 ` Nicolas Goaziou
2016-10-12 10:40 ` Nicolas Goaziou
2016-10-12 17:36 ` Daniele Nicolodi
2016-10-13 12:07 ` Nicolas Goaziou
2016-10-13 12:28 ` Aaron Ecay
2016-10-13 12:35 ` Nicolas Goaziou
2016-10-13 13:20 ` Michael Brand
2016-10-13 18:23 ` Nicolas Goaziou
2016-10-13 17:46 ` Gregor Zattler
2016-10-13 22:05 ` [RFC] " Aaron Ecay
2016-10-13 17:31 ` Daniele Nicolodi
2016-10-13 18:33 ` Nicolas Goaziou
2016-10-13 19:11 ` William Denton
2016-10-12 9:23 ` Rasmus
2016-10-12 10:32 ` Nicolas Goaziou
2016-10-12 11:08 ` Rasmus
2016-10-12 12:21 ` Nicolas Goaziou
2016-10-12 12:47 ` Rasmus
2016-10-13 12:30 ` Nicolas Goaziou
2016-10-20 23:44 ` Clément Pit--Claudel
2016-10-22 1:02 ` Stig Brautaset
2016-10-13 12:19 ` Rasmus
2016-10-13 16:13 ` Nick Dokos
2016-10-13 16:24 ` Rasmus
2016-10-13 16:43 ` Clément Pit--Claudel
2016-10-13 17:18 ` Nick Dokos
2016-10-13 12:19 ` Rasmus
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
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h98qmrci.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
--cc=marcowahlsoft@gmail.com \
/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 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).