[Users] External editor?
Ian Zimmerman
itz at buug.org
Mon Nov 10 20:29:59 CET 2014
On Mon, 10 Nov 2014 12:53:47 -0500,
Barry Warsaw <barry at python.org> wrote:
Barry> Here's my dumb way of setting this up in emacs. I've had this
Barry> chunk of code for years, so there are probably better ways of
Barry> doing it, but it WFM.
> (defun baw-os-path-split (filename)
> "Convert a file name into a list of its path components."
> (let ((path filename)
> last dir parts)
> (while path
> (setq last (file-name-nondirectory path)
> dir (file-name-directory path))
> ;; Remove any trailing slash.
> (if dir
> (setq path (substring (file-name-directory path) 0 -1))
> (setq path dir))
> (push last parts))
> parts))
> (defun baw-server-visit-hook ()
> (let* ((filename (buffer-file-name))
> (parts (and filename (reverse (baw-os-path-split filename))))
> firstpart)
> (when parts
> (setq firstpart (pop parts))
> (when (and (>= (length firstpart) 6)
> (string-equal (substring firstpart 0 6) "tmpmsg")
> (string-equal (pop parts) "tmp")
> (string-equal (pop parts) ".claws-mail"))
> ;; Claws mail temporary buffers should be mail buffers for syntax
> ;; highlighting. I may want to turn off whitespace mode and other
> ;; syntax highlighting, but I'm not sure yet.
> (mail-mode))
> )))
> (add-hook 'server-visit-hook 'baw-server-visit-hook)
That's a very nice way too, yes. But then it works _only_ if you're
connecting to a daemon emacs. My "editor" is actually a script that
execs emacsclient if the daemon is up, and full emacs otherwise.
--
Please *no* private copies of mailing list or newsgroup messages.
Local Variables:
mode:claws-external
End:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20141110/b87b50ad/attachment.sig>
More information about the Users
mailing list