Gnus development mailing list
 help / color / mirror / Atom feed
* Re: Keymap in message mode?
  1996-11-25 15:43 Keymap in message mode? Jens Lautenbacher
@ 1996-11-25 14:30 ` Kai Grossjohann
  1996-11-25 18:18   ` Jens Lautenbacher
  0 siblings, 1 reply; 4+ messages in thread
From: Kai Grossjohann @ 1996-11-25 14:30 UTC (permalink / raw)
  Cc: ding

>>>>> Jens Lautenbacher writes:

  Jens> Sometime ago, if I remember correctly, someone posted a piece
  Jens> of code which changed the behaviour of the M-Tab in the header
  Jens> of a message according to the current headerline(so one could
  Jens> bind it in the to line to bbdb-complete-foo-bar and in the
  Jens> newsgroup line it would do a complete over the newsgroups.)

That may have been me.  Used TAB tho, rather than M-TAB.

kai
-- 
I wonder why nobody don't like me,
or is it de fact dat I'm ugly? -- Harry Belafonte

;; message-x.el -- customizable completion in message headers
;; Kai Grossjohann <grossjohann@ls6.informatik.uni-dortmund.de>
;;  9 Aug 96

(require 'message)

(defvar message-x-body-function 'indent-relative
  "message-x-tab executes this if point is in the body of a message.")

(defvar message-x-completion-alist
  '(("to" . bbdb-complete-name)
    ("cc" . bbdb-complete-name)
    ("newsgroups" . message-expand-group))
  "Table telling which completion function message-x-tab should invoke.
Lookup in the table is done with `equal' comparison of the header.")

(defun message-x-in-header-p ()
  "Returns t iff point is in the header section."
  (save-excursion
    (let ((p (point)))
      (beginning-of-buffer)
      (and (re-search-forward (concat "^"
				      (regexp-quote mail-header-separator)
				      "$"))
	   (progn (beginning-of-line) t)
	   (< p (point))))))
	  

(defun message-x-which-header ()
  "Returns the header we're currently in.  Returns nil if not in a header.
Example: returns \"to\" if we're in the \"to\" header right now."
  (and (message-x-in-header-p)
       (save-excursion
	 (beginning-of-line)
	 (while (looking-at "^[ \t]+") (forward-line -1))
	 (looking-at "\\([^:]+\\):")
	 (downcase (buffer-substring-no-properties (match-beginning 1)
						   (match-end 1))))))

(defun message-x-tab ()
  "Does completion based on header currently in or executes a default
function in the body."
  (interactive)
  (let ((header (assoc (message-x-which-header)
		       message-x-completion-alist)))
    (funcall
     (if header (cdr header) message-x-body-function))))

(define-key message-mode-map "\t" 'message-x-tab)

(provide 'message-x)
;; message-x ends here


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Keymap in message mode?
@ 1996-11-25 15:43 Jens Lautenbacher
  1996-11-25 14:30 ` Kai Grossjohann
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Lautenbacher @ 1996-11-25 15:43 UTC (permalink / raw)



Sometime ago, if I remember correctly, someone posted a piece of code
which changed the behaviour of the M-Tab in the header of a message
according to the current headerline(so one could bind it in the to
line to bbdb-complete-foo-bar and in the newsgroup line it would do a
complete over the newsgroups.)

Does anybody know who wrote this piece of code and/or where I can get
it?

Thanks,
	Jens 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Keymap in message mode?
  1996-11-25 14:30 ` Kai Grossjohann
@ 1996-11-25 18:18   ` Jens Lautenbacher
  1996-11-26 16:21     ` Edward J. Sabol
  0 siblings, 1 reply; 4+ messages in thread
From: Jens Lautenbacher @ 1996-11-25 18:18 UTC (permalink / raw)



Why is this not part of gnus? I think this is a *very* nice
feature. Maybe you could add customization support to it?  Then Lars
could use a default value which mimics the current default value and
it would still be very easy to change it if one uses bbdb.

	Jens


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Keymap in message mode?
  1996-11-25 18:18   ` Jens Lautenbacher
@ 1996-11-26 16:21     ` Edward J. Sabol
  0 siblings, 0 replies; 4+ messages in thread
From: Edward J. Sabol @ 1996-11-26 16:21 UTC (permalink / raw)


Excerpts from mail: (25-Nov-96) Re: Keymap in message mode? by Jens Lautenbacher
> Why is this not part of gnus? I think this is a *very* nice feature.
> Maybe you could add customization support to it? Then Lars could use a
> default value which mimics the current default value and it would still
> be very easy to change it if one uses bbdb.

I agree. I think it should be part of message.el as well. I use this package
constantly and can't imagine using message-mode without it! Thanks, Kai!

Later,
Ed


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-11-26 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-25 15:43 Keymap in message mode? Jens Lautenbacher
1996-11-25 14:30 ` Kai Grossjohann
1996-11-25 18:18   ` Jens Lautenbacher
1996-11-26 16:21     ` Edward J. Sabol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).