"Linux Gazette...making Linux just a little more fun!"


The Answer Guy


By James T. Dennis, answerguy@ssc.com
Starshine Technical Services, http://www.starshine.org/


(?)Supressing cc: lines in Emacs' Mail replies

From Ning on 23 Sep 1998

Hi Jim,

I found your email address from the Linux Gazette web site. Hope it's ok to ask you a question. I use emacs to read and reply email. Could you please tell how to set up the .emacs file such that the CC line(s) is automatically removed when replying an email?

Many thanks,
Ning

That would depend on which mail reader you're using under 'emacs'.
I use mh-e -- the emacs front end to the Rand MH mail handling system. When I hit "r" for "reply" it asks "Reply to whom:" (my choices are "all" or <enter>/(none))
If I choose "all" or "cc" than mh-e will add the cc: lines to my headers. Otherwise, if I just hit enter it will only include the address(es) listed on the From: line.
If you use RMAIL or VM or Gnus you answer will be different. There are several mail readers for emacs --- and you'll want to read the help and 'info' pages for the one you're using to find out how to customize it. Sometimes you have to resort to reading the elisp sources, particularly the comments in order to under an emacs package. This is particularly handy if you intend to do any customizations of you're own .emacs configuration file, since that is also written in elisp.
In VM and Gnus you can use "r" to reply ("R" to reply with the original quoted) and "f"/"F" to "follow" (do a "wide reply"). Even if you pick the lower case options you can yank in (quote) the original message. The capitalized forms just save you an extra couple of keystrokes. Gnus can be used as a mail reader as well as a newsreader --- and allows you to see your mail folders in the same sort of "threaded" mode as you might be used to from newsreaders.
Gnus will allow you to view mail and news that are stored in just about any format. I use it to view some of my MH folders (particularly on the rare occasions when I can get into the Linux Kernel mailing list digests.
VM allows you to "view" your standard "mbox" mail folders --- which the the same sorts as you'd get from using /usr/ucb/mail (mailx), 'elm' and/or 'pine'
RMAIL is the oldest and least featureful of the emacs mailreaders. It stores your messages in a single folder in the "Babyl" format. I've never used it and the info pages don't reveal any obvious difference between replying to "just the sender" and to the whole group of recipients (what 'elm' users think of as "r" vs "group" or "g" replies).
The reason I use MH folders is because it allows me to use glimpseindex and get meaninful results when I search for multiple keywords in proximity to one another. For instance, earlier this evening I wanted to find any copy of the "comp.unix.admin" FAQ that I might have mailed myself. Using the command glimpse "admin;faq" I was able to zero in on the specific item in my "ref" (reference) folder in one shot. (I let the command run for a couple of minutes in the background and continued by writing --- so I don't know how long the search took).
When I used 'elm' a search like that wouldn't have helped much --- after finding the right folder I'd still have to find the message and cut and paste that portion of the file out to what I was working on.
Another feature that's important to me is that I can have multiple drafts in progress. I have a whole folder for drafts, and once a draft is started it doesn't get "lost" just because I have to set it aside and handle more pressing issues, or go look up something.
Naturally you can use Supercite or other "citation/quoting" packages with any of the emacs mailreaders to manage exactly how your attributions look to them. I've tried Supercite and don't much like it. There are also a couple of emacs PGP interfaces that are designed to link to your news and mailreaders, and the "tools for MIME" (tm). to help compose, view, and extract those pesky MIME attachments. Of course you also have 'ispell' available within a keystroke or two. (I have mine bound to [F3],$ to check the word at point and [F3],% to check the whole buffer --- however this is usually not terribly handy for my writing since I tend to have so many abbreviations, filenames, and non-words in my work).
One nice think using a mailreader under emacs is I also have easy access to the emacs "calendar" ([F3],C in my configuration). From there I can add an entry to my "diary" using "i,d" which I can check (using [F3],D in my case).
So, I get mail inviting me to lunch on the tenth of next month and I hit a couple of keystrokes (usually [F9] to switch to the message buffer, a couple of 'vi' keystrokes to "Yank" the message or a couple paragraphs into a kill buffer, [F3],C to bring up the calendar, a couple of keystrokes to navigate to the 9th of next month, "id" to "insert a date/diary entry" and "p" (another 'vi' key) to paste that note into place).
Now I just try to remember to check my diary folder at least a couple times a day. I usually put two entries in for each date. One is a one-liner that says: "tomorrow" and the other gives the time and details. It might refer me to the "todo" folder, where I'll find the original message.
Similarly I use my mh/aliases folder (e-mail address book) as a telephone and postal address book as well. I do this just using comments (start comment lines with a semicolon --- just as you might in a sendmail /etc/aliases file).
Before I give people the impression that I'm some sort of emacs fanatic I should point to that I detest the default emacs keybindings (which I think were devised by sado-masochists on bad drugs). I use 'viper' mode as the default for most buffers, and I have fairly long list of custom bindings to save my sanity for the things that old 'vi' was just never meant to do (like splitting the screen between two buffers and launching "shell-prompt" buffers and other editor "packages" like "dired" (file/directory management buffers).
I rarely use "dired" (I prefer 'mc' --- midnight commander) and almost never use "gnuscape gnavigator" --- WM Perry's w3 mode. It's an impressive bit of work --- but I like lynx for text mode --- and Netscape's Navigator is better if I have to go into X anyway.
There are a number of "helper" modes that seem to be more of a hinderance than a help to me (like the AucTeX, LaTeX, TeX, and html-helper modes). They all seem to take a radically different approach to structured text editing than I'm willing to embrace. Also I don't like emacs' abbreviations mode -- since I like to have abbreviations that including punctuation and it considers all of those to be word boundaries and won't let me use them easily. (The old 'vi' abbreviations feature was very unassuming --- you gave it a list of characters to watch for and a list to expand those into --- it just did).
I'm told that most of the things I do in emacs are now possible in 'vim' --- and I use 'vim' frequently to do quick edits. I don't use 'emacs' (actually xemacs) as 'root' -- so all configuration and /etc/ files are maintained in whatever version of 'vi' happens to be lying around. That's almost always 'vim' these days. However, I don't know any of the 'vim' improvements --- they aren't "portable" to other vi's or to emacs, so they'd be a loss to invest any time in learning, at this point. I use xemacs because it supports a mixture of "applications" and utilities (modes and packages in its own terminology) that I can use from any old text mode login.
As an "OS within an OS" xemacs is a bit of a pain. Installing a new package, like the 'calc' scientific calculator mode (think HP 48 calculators with all sorts of algebraic expression processing analsysis and features to export to GNUplot), and BBDB (the "big brother database" --- a sort of "Rolodex" (tm) utility, is difficult. It's easy if you just want to wedge it into the same directories with the other elisp code --- but I like to put new packages that I install into /usr/local or /usr/local/opt (which is symlinked from /opt) --- so I can tell what I put there from what my distribution installed. That takes extra work.
Anyway -- I'll finish my rant by appending my latest .emacs file. Actually my .emacs only reads:
(load (expand-file-name "~/.elisp/init.el"))
... and my ~/.elisp/init.el is where all the action is:
;; Jim Dennis' .elisp/init.el file
(setq inhibit-startup-message 't )
(setq load-path (cons (expand-file-name "~/.elisp") load-path ))
(column-number-mode 1)
(line-number-mode 1)
(setq display-time-day-and-date 't)
(display-time)
(setq version-control 't)
(indented-text-mode)
(setq fill-column-default 72)
(setq fill-column 72)
(setq fill-prefix "  ")
(auto-fill-mode)
(setq viper-mode t)
(require 'viper)

;; Custom Functions:

(defun insert-output-from-shell-command (commandstr)
"Insert output from a shell command at point"
(interactive "*sInsert From Command:")
(shell-command commandstr 1))

(defvar my-mh-folder-keys-done nil 

"Non-`nil' when one-time mh-e settings made.")

(defun my-mh-folder-keys ()
"Hook to add my bindings to mh-Folder Mode."
(if (not my-mh-folder-keys-done) ; only need to bind the keys once 
(progn 
(define-key mh-folder-mode-map "a" 'visit-mh-aliases)
(define-key mh-folder-mode-map "b" 'mh-redistribute)
(define-key mh-folder-mode-map "T" (mh-put-msg-in-seq nil "t"))
(define-key mh-folder-mode-map "j" 'mh-next-undeleted-msg)
(define-key mh-folder-mode-map "k" 'mh-previous-undeleted-msg)
(setq my-mh-folder-keys-done 1) 
)))

(defun my-mh-letter-keys ()
"Hook to add my bindings to mh-Letter Mode."
(progn 
(define-key mh-letter-mode-map '[f4] 'mh-yank-cur-msg)
(define-key mh-letter-mode-map '[f5] 'mh-insert-signature)
(define-key mh-letter-mode-map '[f10] 'mh-send-letter)
(setq fill-column 68)
(setq fill-prefix "	")
(auto-fill-mode)
))

(add-hook 'mh-folder-mode-hook 'my-mh-folder-keys)
(add-hook 'mh-letter-mode-hook 'my-mh-letter-keys)    

( defun paragraph-fill-justify-forward ()
"Fill and justify paragraph at point and move forward"
(interactive "*")
(fill-paragraph ())
(forward-paragraph))

( defun save-and-kill ()
"Save and kill current buffer"
(interactive)
(save-buffer)
(kill-buffer (current-buffer)))

;; Some stuff for mh-e:
(setq mh-progs "/usr/bin/mh/")
(setq mh-lib "/usr/lib/mh")

;; Something for Gnus (to save outgoing stuff)
(setq gnus-select-method '(nntp "news"))
;; (setq gnus-secondary-select-methods '(nnmh "~/mh"))
;; (setq message-default-headers "Fcc: ~/mh/gnus.mbox\n")
;; (setq message-default-mail-headers "Fcc: ~/mh/gnus.mbox\n")
;; (setq message-default-news-headers "Fcc: ~/mh/gnus.mbox\n")
;; (setq gnus-author-copy "|/usr/lib/mh/rcvstore +gnus.out")

(defun my-gnus-summary-keys()
"Hook to add my bindings to Gnus Summary Mode."
(progn 

(define-key gnus-summary-mode-map  '[f4] 

(progn (gnus-summary-tick-article)(gnus-cache-enter-article))

)))

;; Start gnuserv -- so gnuattach, gnudoit, and gnuclient will work:
;; (server-start)
(gnuserv-start)

;; Quick access to my aliases file from my mh-e folder view

( defun visit-mh-aliases ()
"Visit my MH aliases file"
(interactive "")
(switch-to-buffer (find-file-noselect "~/mh/aliases")))

;; For Tools for MIME: MH version 
(load-library "tm-mh-e")

;; For Supercite
;;(autoload 'sc-cite-original     "supercite" "Supercite 3.1" t)
;;(autoload 'sc-submit-bug-report "supercite" "Supercite 3.1" t)
;;(add-hook 'mail-citation-hook 'sc-cite-original)

;; For XEmacs color/terminal support:

(when (eq (device-class) 'color)
(set-face-background 'default      "black")     ; frame background
(set-face-foreground 'default      "cyan")      ; normal text
(set-face-background 'zmacs-region "cyan")        ; When selecting w/mouse
(set-face-foreground 'zmacs-region "blue")
(set-face-font       'default      "*courier-bold-r*120-100-100*")
(set-face-background 'highlight    "blue")       ; ie when selecting buffers
(set-face-foreground 'highlight    "green")
(set-face-background 'modeline     "blue")       ; Line at bottom of buffer
(set-face-foreground 'modeline     "white")
(set-face-font       'modeline     "*bold-r-normal*140-100-100*")
(set-face-background 'isearch      "cyan")     ; When highlighting while
(set-face-foreground 'isearch      "black")
(setq x-pointer-foreground-color   "black")      ; Adds to bg color,

(setq x-pointer-background-color   "blue")       ; This is color you really 

)

(defun my-quick-buffer-switch ()
"Quick Switch to previous buffer"
(interactive "")
(switch-to-other-buffer 1))

(custom-set-faces)
(setq minibuffer-max-depth nil)

(custom-set-variables
'(user-mail-address "jimd@starshine.org" t)
'(query-user-mail-address nil)
)

;; ... and I'll learn to make real use of abbreviations -- eventually
(abbrev-mode 1 )
(setq abbrev-file-name (expand-file-name "~/.elisp/abbreviations"))
(quietly-read-abbrev-file)

;; My personal key binding for non-vi'ish stuff:
(global-set-key '[f3 ?0] 'delete-window)
(global-set-key '[f3 ?1] 'delete-other-windows)
(global-set-key '[f3 ?2] 'split-window-vertically)
(global-set-key '[f3 ?4] 'split-window-horizontally)
(global-set-key '[f3 ?!] 'insert-output-from-shell-command)
(global-set-key '[f3 ?$] 'ispell-word)
(global-set-key '[f3 ?%] 'ispell-buffer)
(global-set-key '[f3 ?b] 'switch-to-buffer)
(global-set-key '[f3 ?B] 'buffer-menu)
(global-set-key '[f3 ?c] 'shell)
(global-set-key '[f3 ?C] 'calendar)
(global-set-key '[f3 ?d] 'dired)
(global-set-key '[f3 ?D] 'diary)
(global-set-key '[f3 ?f] 'find-file)
(global-set-key '[f3 ?F] 'find-file-at-point)
(global-set-key '[f3 ?m] 'mh-rmail)
(global-set-key '[f3 ?n] 'gnus-no-server)
(global-set-key '[f3 ?k] 'kill-buffer)
(global-set-key '[f3 ?r] 'insert-file)
(global-set-key '[f3 ?o] 'other-window)
(global-set-key '[f3 ?s] 'save-buffer)
(global-set-key '[f3 ?S] 'save-some-buffers)
(global-set-key '[f3 ?w] 'w3-follow-url-at-point)
(global-set-key '[f3 ?x] 'execute-extended-command)
(global-set-key '[f3 f1] 'manual-entry)
(global-set-key '[f3 f7] 'auto-fill-mode)
(global-set-key '[f3 space] 'set-mark-command)
(global-set-key '[f7] (quote paragraph-fill-justify-forward))
(global-set-key '[f8] (quote my-quick-buffer-switch))
(global-set-key '[f9] (quote other-window))
(global-set-key '[f10] (quote save-and-kill))
(global-set-key '[f11] (quote kill-this-buffer))
(global-set-key '[f12] (keyboard-quit))
;; end: JimD's .elisp/init.el 
There is undoubtedly some cruft in there that will make real emacs/elisp gurus gnash their teeth in disgust. I don't pretend to know anything about lisp programming (other than that it has an inordinate propensity for parentheses). I mostly use two key, unshifted, key sequences that are prefixed with [F3] so that I rarely have to use the 'viper' mode's [Ctrl]+z (switch to emacs mode) or the viper command mode "\" command (escape next keystroke to emacs mode).
There are more things I'll do eventually. That's one of the reasons I adopted Linux and xemacs in the first place --- the tools have enough depth that I can always learn more about them. They don't limit me.


Copyright © 1998, James T. Dennis
Published in Linux Gazette Issue 33 October 1998


[ Answer Guy Index ] floppy autocad scsi samba_pdc virthost
emacs_cc ipmasq tty shuffle connect
hostavail desqview catch22 thanks2 typo


[ Table Of Contents ] [ Front Page ] [ Previous Section ] [ Next Section ]