[OS X Emacs] Aquamacs does not honor fill-mode preference honored by vanilla emacs.

Chris Green greenc at fnal.gov
Thu Sep 26 14:33:35 EDT 2013


Hi,

Short background: I have been hitherto happy with the default of the 
auto-fill minor mode being activated in text mode. In my .emacs 
customization I have had:

  '(text-mode-hook (quote (turn-on-auto-fill text-mode-hook-identify)))

However, I recently installed, "It's All Text!" which is a Firefox 
add-on. This allows one to edit any browser text window in an external 
editor. Then, I decided that buffers opened this way in aquamacs should 
not have auto-fill mode turned on since for (e.g.) wiki editing, line 
breaks are important. After browsing around stack overflow and friends 
and cannibalizing several answers, I came up with the following, taking 
advantage of the path into which the Firefox add-on saves its text 
before opening it in the editor as a file:

(defun maybe-turn-on-auto-fill ()
   "Determine whether to use auto-fill for text mode"
   (when buffer-file-name
     (let ((name buffer-file-name)
           (remote-id (file-remote-p buffer-file-name)))
       ;; Remove backup-suffixes from file name.
       (setq name (file-name-sans-versions name))
       ;; Remove remote file name identification.
       (when (and (stringp remote-id)
                  (string-match-p (regexp-quote remote-id) name))
         (setq name (substring name (match-end 0))))
       (if (string-match "/itsalltext/" name)
           (turn-off-auto-fill); Don't want auto-fill here.
         (turn-on-auto-fill))
       )))

followed by changing the text-mode-hook defined above to:

  '(text-mode-hook (quote (maybe-turn-on-auto-fill text-mode-hook-identify)))

Now, this all works wonderfully in (say) emacs (23.1.1) on linux, or 
homebrew cococa emacs (24.2.1) on OS X 10.8. Aquamacs 2.5 however, 
appears to either ignore or override this hook and set fill mode anyway. 
Could someone please tell me what I'm doing wrong, and how I can get 
Aquamacs to do what I need?

Thanks,
Chris.



More information about the MacOSX-Emacs mailing list