>>>> "Matt" == Matt Price
<matt.price(a)utoronto.ca> writes:
Matt> I have mode-hooks callingthese funcitons when either mode is
Matt> loaded. But, while these hooks worked fine in FSF Emacs, I
Matt> can't get them to work in xemacs on initial loading of a
Matt> message buffer (if I switch modes in mid-composition, the
Matt> movement *will* take place!
Try wrapping the functions in code to print a progress message (eg,
`(message "Moving cursor to first line of text")') to find out if the
hook is actually being called.
-- tried this, but seem to be doing a bad job of it (see code)
Show us the relevant code.
OK, so here goes.
In my init.el I have the following (excerpted, of course):
-----------------
;; post.el is in ~/elisp, so
(add-to-list 'load-path (expand-file-name "~/elisp"))
(load "/home/matt/elisp/post")
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)
;; this is the stuff that's not working
;; mail-text and other movements seem not to work under Xemacs
(add-hook 'mail-mode-hook 'mail-text)
(add-hook 'post-mode-hook 'post-goto-body)
;; post-mode documentation suggests putting this in init.el:
;; but I don't notice any effect; sometimes it's commented out,
;; sometimes not
(setq server-temp-file-regexp "mutt-")
(add-hook 'server-switch-hook
(function (lambda()
(cond ((string-match "Post" mode-name)
(post-goto-body))))))
;; associate mutt with postmode
(or (assoc "mutt-" auto-mode-alist)
(setq auto-mode-alist (cons'("mutt-" . post-mode) auto-mode-alist)))
-----------------
in post.el, there's one relevant variable and one function. You can see where
I tried to insert a message in post-goto-body and seem to have failed:
;; You may find the actual version of this mode at
;;
http://astro.utoronto.ca/~reid/mutt/
;; snip ..
(defcustom post-jump-header t
"Specifies wheather post-mode should jump past any headers at the start of
the buffer"
:type 'boolean
:group 'post)
;;; snip..
.
(defun post-goto-body ()
"Go to the beginning of the message body."
(interactive)
(goto-char (point-min))
;; If the message has header, slide downward.
(and header-mode (save-match-data (re-search-forward "^$" nil t))
(next-line 1) (message "Moving cursor to first line of text")))
;; snip...
;; Jump past header if so required.
(cond (post-jump-header
(post-goto-body)))
-----------------------------
As I said inn my earlier post, with this setup xemacs will hop to the
message body if I switch to post-mode in mid-composition, but not when
the buffer initially opens.
I hope this makes things clearer. Please tell me if you need more
info.
thanks,
matt