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)))



Reply via email to