From: Paul Sexton <psexton.2a@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Patch: option to not hide brackets in org links
Date: Sun, 13 May 2012 23:43:22 +0000 (UTC) [thread overview]
Message-ID: <loom.20120514T014018-90@post.gmane.org> (raw)
In-Reply-To: CAOXM+eX2RU+5yGh0Ck6b1uhDCM81O4vSSq=OpM2KWaRUbEjtcw@mail.gmail.com
Sean O'Halpin <sean.ohalpin <at> gmail.com> writes:
> Thanks!
I just noticed that the main function, orgl-enable, sets the buffer's
modification status to true when it runs. This is because altering text
properties is considered a modification of the buffer.
Fixed by wrapping the offending line in a 'with-silent-modifications' macro.
Some older Emacsen may not have this macro -- alternative solutions
are given at:
http://stackoverflow.com/questions/2699857/emacs-how-to-intelligently-handle-
buffer-modified-when-setting-text-properties
(defun orgl-enable ()
"Enable fontification of org-style hyperlinks in the current buffer."
(interactive)
;; The following variable has to be bound to a string, or following links
;; will not work.
;; There is probably a more elegant solution.
(unless org-todo-line-tags-regexp
(set (make-local-variable 'org-todo-line-tags-regexp)
"XYZ_THIS@SHOULD_NEVER~MATCH_ZYX"))
(orgl-do-font-lock 'font-lock-add-keywords)
;; Stop org links from having invisible [[ brackets ]].
(with-silent-modifications
(remove-text-properties (point-min) (point-max) '(invisible nil)))
(font-lock-fontify-buffer)
;; Add special link abbreviations.
(unless org-link-abbrev-alist-local
(make-local-variable 'org-link-abbrev-alist-local))
(dolist (pair (cdr (assoc major-mode *orgl-link-abbrevs*)))
(pushnew pair org-link-abbrev-alist-local)))
next prev parent reply other threads:[~2012-05-13 23:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 21:07 Patch: option to not hide brackets in org links Paul Sexton
2012-05-10 7:31 ` Sean O'Halpin
2012-05-10 8:56 ` Paul Sexton
2012-05-13 1:41 ` Sean O'Halpin
2012-05-13 23:43 ` Paul Sexton [this message]
2012-05-13 23:50 ` Samuel Wales
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=loom.20120514T014018-90@post.gmane.org \
--to=psexton.2a@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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).