Gnus development mailing list
 help / color / mirror / Atom feed
* DWIM fix to message.el (TAB handling)
@ 1997-02-25 20:32 Christopher Davis
  1997-02-25 21:26 ` Justin Sheehy
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Christopher Davis @ 1997-02-25 20:32 UTC (permalink / raw)


The following will allow "tab" in a message-mode header to expand mail
aliases as well as completing newsgroup names.  This makes message-mode
more integrated between mail and news.

(I don't use BBDB, so if someone wants to contribute a BBDB-completion
routine for this, feel free. :-)

I think this is the Right Thing To Do with TAB in recipient headers and
should go in 5.4.16.

--- message.el~	Wed Feb 19 22:19:54 1997
+++ message.el	Tue Feb 25 15:27:07 1997
@@ -3344,13 +3344,19 @@
   "Regexp that match headers that lists groups.")
 
 (defun message-tab ()
-  "Expand group names in Newsgroups and Followup-To headers.
+  "Expand group names or mail aliases in appropriate headers.
+Will complete group names in Newsgroups and Followup-To headers,
+or mail aliases in recipient headers.
 Do a `tab-to-tab-stop' if not in those headers."
   (interactive)
-  (if (let ((mail-abbrev-mode-regexp message-newgroups-header-regexp))
+  (cond
+   ((let ((mail-abbrev-mode-regexp message-newgroups-header-regexp))
 	(mail-abbrev-in-expansion-header-p))
-      (message-expand-group)
-    (tab-to-tab-stop)))
+    (message-expand-group))
+   ((mail-abbrev-in-expansion-header-p)
+    (expand-abbrev))
+   (t
+    (tab-to-tab-stop))))
 
 (defvar gnus-active-hashtb)
 (defun message-expand-group ()


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-25 20:32 DWIM fix to message.el (TAB handling) Christopher Davis
@ 1997-02-25 21:26 ` Justin Sheehy
  1997-02-25 21:47 ` Edward J. Sabol
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Justin Sheehy @ 1997-02-25 21:26 UTC (permalink / raw)


Christopher Davis <ckd@loiosh.kei.com> writes:

> (I don't use BBDB, so if someone wants to contribute a BBDB-completion
> routine for this, feel free. :-)

message-x.el already does tab completion for BBDB.

-Justin


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-25 20:32 DWIM fix to message.el (TAB handling) Christopher Davis
  1997-02-25 21:26 ` Justin Sheehy
@ 1997-02-25 21:47 ` Edward J. Sabol
  1997-02-26 10:33 ` Kai Grossjohann
  1997-02-28 23:46 ` Lars Magne Ingebrigtsen
  3 siblings, 0 replies; 15+ messages in thread
From: Edward J. Sabol @ 1997-02-25 21:47 UTC (permalink / raw)


Excerpts from mail: (25-Feb-97) DWIM fix to message.el (TAB handling) by Christopher Davis
> The following will allow "tab" in a message-mode header to
> expand mail aliases as well as completing newsgroup names. This
> makes message-mode more integrated between mail and news.

As much as I agree with the sentiment behind this, I much prefer Kai's
message-x.el package which does basically the same thing, but in a more
generic, user-configurable fashion. (See the Ding mailing list archive circa
09 Aug 1996.)

> (I don't use BBDB, so if someone wants to contribute a
> BBDB-completion routine for this, feel free. :-)

Kai's message-x.el already does this. And it's trivial to add additional tab
handlers for other headers.

> I think this is the Right Thing To Do with TAB in recipient
> headers and should go in 5.4.16.

Let's roll Kai's stuff into message.el instead.

Later,
Ed


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-25 20:32 DWIM fix to message.el (TAB handling) Christopher Davis
  1997-02-25 21:26 ` Justin Sheehy
  1997-02-25 21:47 ` Edward J. Sabol
@ 1997-02-26 10:33 ` Kai Grossjohann
  1997-02-26 15:00   ` Christopher Davis
  1997-03-06 15:44   ` Christopher Davis
  1997-02-28 23:46 ` Lars Magne Ingebrigtsen
  3 siblings, 2 replies; 15+ messages in thread
From: Kai Grossjohann @ 1997-02-26 10:33 UTC (permalink / raw)
  Cc: ding

>>>>> Christopher Davis writes:

  ckd> The following will allow "tab" in a message-mode header to
  ckd> expand mail aliases as well as completing newsgroup names.
  ckd> This makes message-mode more integrated between mail and news.

Several people mentioned message-x.el, by yours truly.  As it is
rather short, I thought I'd just repost it.  I just *love* group name
completion in the Gcc header :-)

I'm always interested in additional stuff to add to
message-x-completion-alist.

kai
-- 
~/.signature

;; 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)
    ("gcc" . message-expand-group)
    ("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] 15+ messages in thread

* Re: DWIM fix to message.el (TAB handling)
  1997-02-26 10:33 ` Kai Grossjohann
@ 1997-02-26 15:00   ` Christopher Davis
  1997-02-26 16:48     ` Edward J. Sabol
  1997-03-06 15:44   ` Christopher Davis
  1 sibling, 1 reply; 15+ messages in thread
From: Christopher Davis @ 1997-02-26 15:00 UTC (permalink / raw)


KG> == Kai Grossjohann <grossjohann@charly.informatik.uni-dortmund.de>

 KG> I'm always interested in additional stuff to add to
 KG> message-x-completion-alist.

Well, for those of us who don't use BBDB, perhaps something like (untested)

(defun message-x-mail-completion ()
   (interactive)
   (if (fboundp 'bbdb-complete-name)
      (bbdb-complete-name)
     (expand-abbrev)))

and have the default for to/cc/bcc/resent-to/resent-cc/resent-bcc be that.

I agree, though; I'd prefer to see message-x or something like it rolled
into message.el.


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-26 15:00   ` Christopher Davis
@ 1997-02-26 16:48     ` Edward J. Sabol
  1997-02-28 23:47       ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Edward J. Sabol @ 1997-02-26 16:48 UTC (permalink / raw)


Excerpts from mail: (26-Feb-97) Re: DWIM fix to message.el (TAB handling) by Christopher Davis
> I agree, though; I'd prefer to see message-x or something like
> it rolled into message.el.

Great. We all seem to be in agreement. Now, all we have to do is convince
Lars. What sayest thou, O Mighty Maintainer of Gnus?


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-25 20:32 DWIM fix to message.el (TAB handling) Christopher Davis
                   ` (2 preceding siblings ...)
  1997-02-26 10:33 ` Kai Grossjohann
@ 1997-02-28 23:46 ` Lars Magne Ingebrigtsen
  1997-03-01  3:53   ` Christopher Davis
  3 siblings, 1 reply; 15+ messages in thread
From: Lars Magne Ingebrigtsen @ 1997-02-28 23:46 UTC (permalink / raw)


Christopher Davis <ckd@loiosh.kei.com> writes:

> The following will allow "tab" in a message-mode header to expand mail
> aliases as well as completing newsgroup names.  This makes message-mode
> more integrated between mail and news.

Hm...  I just tried "dingTAB" in the Cc header, and it did expand the
alias... 

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@ifi.uio.no * Lars Ingebrigtsen


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-26 16:48     ` Edward J. Sabol
@ 1997-02-28 23:47       ` Lars Magne Ingebrigtsen
  1997-03-03  9:20         ` Robert Bihlmeyer
  0 siblings, 1 reply; 15+ messages in thread
From: Lars Magne Ingebrigtsen @ 1997-02-28 23:47 UTC (permalink / raw)


"Edward J. Sabol" <sabol@alderaan.gsfc.nasa.gov> writes:

> We all seem to be in agreement. Now, all we have to do is convince
> Lars. What sayest thou, O Mighty Maintainer of Gnus?

I speaketh unto the masses and sayeth:  Ok.  In Quassia Gnus.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@ifi.uio.no * Lars Ingebrigtsen


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-28 23:46 ` Lars Magne Ingebrigtsen
@ 1997-03-01  3:53   ` Christopher Davis
  1997-03-05  8:05     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 15+ messages in thread
From: Christopher Davis @ 1997-03-01  3:53 UTC (permalink / raw)


LMI> == Lars Magne Ingebrigtsen <larsi@ifi.uio.no>

 ckd> The following will allow "tab" in a message-mode header to expand
 ckd> mail aliases as well as completing newsgroup names.  This makes
 ckd> message-mode more integrated between mail and news.

 LMI> Hm...  I just tried "dingTAB" in the Cc header, and it did expand the
 LMI> alias... 

As a side effect of inserting a TAB in the buffer, right?

That's not really desirable.  (Either that or the newsgroup completion
should do the same thing ;)


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-28 23:47       ` Lars Magne Ingebrigtsen
@ 1997-03-03  9:20         ` Robert Bihlmeyer
  0 siblings, 0 replies; 15+ messages in thread
From: Robert Bihlmeyer @ 1997-03-03  9:20 UTC (permalink / raw)
  Cc: ding

>>>>> On 01 Mar 1997 00:47:42 +0100
>>>>> Lars Magne Ingebrigtsen <larsi@ifi.uio.no> said:

 Lars> I speaketh unto the masses and sayeth: Ok. In Quassia Gnus.

Thus quoth Quassia.


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

* Re: DWIM fix to message.el (TAB handling)
  1997-03-01  3:53   ` Christopher Davis
@ 1997-03-05  8:05     ` Lars Magne Ingebrigtsen
  1997-03-05 11:40       ` Per Abrahamsen
  1997-03-05 15:22       ` Edward J. Sabol
  0 siblings, 2 replies; 15+ messages in thread
From: Lars Magne Ingebrigtsen @ 1997-03-05  8:05 UTC (permalink / raw)


Christopher Davis <ckd@loiosh.kei.com> writes:

>  LMI> Hm...  I just tried "dingTAB" in the Cc header, and it did expand the
>  LMI> alias... 
> 
> As a side effect of inserting a TAB in the buffer, right?
> 
> That's not really desirable.  (Either that or the newsgroup completion
> should do the same thing ;)

Well -- it doesn't matter whether you have white space at the end of
lines, I think.  

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@ifi.uio.no * Lars Ingebrigtsen


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

* Re: DWIM fix to message.el (TAB handling)
  1997-03-05  8:05     ` Lars Magne Ingebrigtsen
@ 1997-03-05 11:40       ` Per Abrahamsen
  1997-03-05 15:22       ` Edward J. Sabol
  1 sibling, 0 replies; 15+ messages in thread
From: Per Abrahamsen @ 1997-03-05 11:40 UTC (permalink / raw)



Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:

> Well -- it doesn't matter whether you have white space at the end of
> lines, I think.  

Actually, a newsreader supporting Brad Templetons proletext will parse
it as "Display every third character in the line as <blink><font
+7><color hot-pink>, and use the zapf-dingbats font for the remaining
characters."


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

* Re: DWIM fix to message.el (TAB handling)
  1997-03-05  8:05     ` Lars Magne Ingebrigtsen
  1997-03-05 11:40       ` Per Abrahamsen
@ 1997-03-05 15:22       ` Edward J. Sabol
  1 sibling, 0 replies; 15+ messages in thread
From: Edward J. Sabol @ 1997-03-05 15:22 UTC (permalink / raw)


Excerpts from mail: (05-Mar-97) Re: DWIM fix to message.el (TAB handling) by Lars Magne Ingebrigtsen
>
> Hm... I just tried "dingTAB" in the Cc header, and it did expand the
> alias...
>
> Christopher Davis <ckd@loiosh.kei.com> writes:
>
>>  As a side effect of inserting a TAB in the buffer, right?
>> 
>> That's not really desirable. (Either that or the newsgroup completion
>> should do the same thing ;)
>
> Well -- it doesn't matter whether you have white space at the end of
> lines, I think.

It does to us perfectionists. Before I started using Kai's message-x.el, I
was always hitting TAB followed immediately by DEL when expanding mail
abbrevs.


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

* Re: DWIM fix to message.el (TAB handling)
  1997-02-26 10:33 ` Kai Grossjohann
  1997-02-26 15:00   ` Christopher Davis
@ 1997-03-06 15:44   ` Christopher Davis
  1997-03-06 15:56     ` Kai Grossjohann
  1 sibling, 1 reply; 15+ messages in thread
From: Christopher Davis @ 1997-03-06 15:44 UTC (permalink / raw)
  Cc: ding

Here are my minor changes to support non-BBDB completion in message-x.

--- message-x.el~	Thu Mar  6 10:37:45 1997
+++ message-x.el	Thu Mar  6 10:40:55 1997
@@ -1,6 +1,7 @@
 ;; message-x.el -- customizable completion in message headers
 ;; Kai Grossjohann <grossjohann@ls6.informatik.uni-dortmund.de>
 ;;  9 Aug 96
+;; modifications 1997-03-06 Christopher Davis <ckd@kei.com>
 
 (require 'message)
 
@@ -8,12 +9,23 @@
   "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)
+  '(("to" . message-x-complete-name)
+    ("cc" . message-x-complete-name)
+    ("bcc" . message-x-complete-name)
+    ("resent-to" . message-x-complete-name)
+    ("resent-cc" . message-x-complete-name)
+    ("resent-bcc" . message-x-complete-name)
     ("gcc" . message-expand-group)
     ("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-complete-name ()
+  "Does name completion in recipient headers."
+  (interactive)
+  (if (fboundp 'bbdb-complete-name)
+      (bbdb-complete-name)
+    (expand-abbrev)))
 
 (defun message-x-in-header-p ()
   "Returns t iff point is in the header section."


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

* Re: DWIM fix to message.el (TAB handling)
  1997-03-06 15:44   ` Christopher Davis
@ 1997-03-06 15:56     ` Kai Grossjohann
  0 siblings, 0 replies; 15+ messages in thread
From: Kai Grossjohann @ 1997-03-06 15:56 UTC (permalink / raw)
  Cc: Kai Grossjohann, ding

>>>>> Christopher Davis writes:

  ckd> Here are my minor changes to support non-BBDB completion in
  ckd> message-x.

Great!  Incorporated into my local copy.

Thanks a lot,
kai
-- 
because I couldn't think of a good beginning.


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

end of thread, other threads:[~1997-03-06 15:56 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-02-25 20:32 DWIM fix to message.el (TAB handling) Christopher Davis
1997-02-25 21:26 ` Justin Sheehy
1997-02-25 21:47 ` Edward J. Sabol
1997-02-26 10:33 ` Kai Grossjohann
1997-02-26 15:00   ` Christopher Davis
1997-02-26 16:48     ` Edward J. Sabol
1997-02-28 23:47       ` Lars Magne Ingebrigtsen
1997-03-03  9:20         ` Robert Bihlmeyer
1997-03-06 15:44   ` Christopher Davis
1997-03-06 15:56     ` Kai Grossjohann
1997-02-28 23:46 ` Lars Magne Ingebrigtsen
1997-03-01  3:53   ` Christopher Davis
1997-03-05  8:05     ` Lars Magne Ingebrigtsen
1997-03-05 11:40       ` Per Abrahamsen
1997-03-05 15:22       ` 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).