From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paul Sexton Subject: Re: Patch: option to not hide brackets in org links Date: Sun, 13 May 2012 23:43:22 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:54627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STiRx-0000Ji-Af for emacs-orgmode@gnu.org; Sun, 13 May 2012 19:43:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1STiRv-0004Qi-Er for emacs-orgmode@gnu.org; Sun, 13 May 2012 19:43:40 -0400 Received: from plane.gmane.org ([80.91.229.3]:38533) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1STiRv-0004QY-7b for emacs-orgmode@gnu.org; Sun, 13 May 2012 19:43:39 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1STiRn-0005n7-UA for emacs-orgmode@gnu.org; Mon, 14 May 2012 01:43:37 +0200 Received: from rp.young.med.auckland.ac.nz ([130.216.140.20]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 May 2012 01:43:31 +0200 Received: from psexton.2a by rp.young.med.auckland.ac.nz with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 May 2012 01:43:31 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Sean O'Halpin 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)))