[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Patch: option to not hide brackets in org links
From: |
Paul Sexton |
Subject: |
Re: [O] Patch: option to not hide brackets in org links |
Date: |
Sun, 13 May 2012 23:43:22 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
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)
"address@hidden"))
(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)))