Gnus development mailing list
 help / color / mirror / Atom feed
* editing the gcc header
@ 1996-05-02 18:48 Kai Grossjohann
  1996-05-02 20:07 ` Jack Vinson
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Grossjohann @ 1996-05-02 18:48 UTC (permalink / raw)



Hi there,

how do you like the following li'l piece of ELisp?  I'm rather sure
this is horrible code, but maybe it's not too difficult to do it
right?

Methinks this could be useful together with adding a Gcc header by
default.

regards,
kai
-- 
Gleep!

;;;;;;;;;;;;;;;;;;;;;;;;;;; -*- Mode: Emacs-Lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;
;; message-x.el -- 
;; ITIID           : $ITI$ $Header $__Header$
;; Author          : Kai Grossjohann
;; Created On      : Thu May  2 20:24:15 1996
;; Last Modified By: Kai Grossjohann
;; Last Modified On: Thu May  2 20:46:35 1996
;; Update Count    : 4
;; Status          : Unknown, Use with caution!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(require 'message)

(defun message-edit-gcc ()
  (interactive)
  (let (val)
    (save-excursion
      (save-restriction
        (nnheader-narrow-to-headers)
        (beginning-of-buffer)
        (re-search-forward "^gcc: ")
        (setq val (completing-read
                   "Gcc: " gnus-newsrc-alist
                   (function (lambda (x)
                               (string-match "^nn[a-z]+:" (car x))))
                   t (nnheader-header-value) gnus-group-history))
        (kill-line nil)
        (insert val)))))

(define-key message-mode-map "\C-c\C-e" 'message-edit-gcc)

(provide 'message-x)


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

* Re: editing the gcc header
  1996-05-02 18:48 editing the gcc header Kai Grossjohann
@ 1996-05-02 20:07 ` Jack Vinson
  1996-05-03  7:54   ` Kai Grossjohann
  0 siblings, 1 reply; 3+ messages in thread
From: Jack Vinson @ 1996-05-02 20:07 UTC (permalink / raw)



Even better.  I'd like a key combo to remove the Gcc header completely.
There should also be something like C-c C-f C-g to goto the Gcc header
instead of doing what Kai just suggested.

-- 
Jack Vinson                       jvinson@cheux.ecs.umass.edu
"I Spit on Your Grave"            -- double feature at the drive-in as seen
"I Thumb Through Your Magazines"     from the Qwik-E mart


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

* Re: editing the gcc header
  1996-05-02 20:07 ` Jack Vinson
@ 1996-05-03  7:54   ` Kai Grossjohann
  0 siblings, 0 replies; 3+ messages in thread
From: Kai Grossjohann @ 1996-05-03  7:54 UTC (permalink / raw)
  Cc: ding

>>>>> On 02 May 1996 16:07:34 -0400, Jack Vinson
>>>>> <jvinson@cheux.ecs.umass.edu> said:

  Jack> Even better.  I'd like a key combo to remove the Gcc header
  Jack> completely.

I have the following in my .emacs file:

,-----
| (defun message-toggle-gcc ()
|   (interactive)
|   (save-excursion
|     (save-restriction
|       ;; I didn't know about nnheader-narrow-to-headers
|       ;; when I wrote this :-(
|       (let ((pmin (progn (beginning-of-buffer) (point)))
|             (pmax (progn
|                     (beginning-of-buffer)
|                     (re-search-forward (concat "^" mail-header-separator
|                                                "$"))
|                     (beginning-of-line)
|                     (point))))
|         (beginning-of-buffer)
|         (narrow-to-region pmin pmax)
|         (if (re-search-forward "^gcc: .*" nil t)
|             (progn
|               (beginning-of-line)
|               (kill-line 1))
|           (goto-char pmax)
|           (insert (concat "Gcc: "
|                           (kai-gnus-outgoing-message-group)
|                           "\n")))))))
`-----

(This is bound to C-c C-f C-g.)

Here, kai-gnus-outgoing-message-group is a function that calculates
the `right' group name based on the group I'm in:

,-----
| (defun kai-gnus-outgoing-message-group ()
|   (cond ((and gnus-newsgroup-name
|               (stringp gnus-newsgroup-name)
|               (string-match "^nnml" gnus-newsgroup-name))
|          gnus-newsgroup-name)
|         (t "nnml:mail.misc")))
`-----

  Jack> There should also be something like C-c C-f C-g to goto the
  Jack> Gcc header instead of doing what Kai just suggested.

I wanted to have completion for group names, and M-TAB was already
taken by bbdb-complete-name.  I didn't know how to write a function to
be bound to M-TAB that does completion for group names in a Gcc header
and bbdb-complete-name in To/Cc/Bcc headers.  I'll be happy about any
ideas you might have.

regards,
kai
-- 
Gleep!


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

end of thread, other threads:[~1996-05-03  7:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-05-02 18:48 editing the gcc header Kai Grossjohann
1996-05-02 20:07 ` Jack Vinson
1996-05-03  7:54   ` Kai Grossjohann

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).