Package: gnus-bonus-el Version: 28.3-1 Severity: normal Tags: patch When using gnus-pers without a default personality, the prompting doesn't use completing-read which is inconvenient, and it sometimes adds duplicate "From:" lines. The code for the no default, and default cases are a crufty cut and paste job of nearly identical code.
My patch restructures the code slightly to obviate the need for these duplicate sections (which also fixes the problems with the duplicate From: lines), and uses completing-read for the prompting. -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages gnus-bonus-el depends on: ii emacs21 [emacsen] 21.4a+1-5.1 The GNU Emacs editor ii emacs22 [emacsen] 22.1+1-2 The GNU Emacs editor ii gnus 5.11+v0.5.dfsg-3 A versatile news and mail reader f gnus-bonus-el recommends no packages. -- no debconf information
--- /usr/share/emacs/site-lisp/gnus-bonus-el/gnus-pers.el 2007-10-23 20:33:22.000000000 -0400 +++ software/src/gnus-pers.el 2007-10-28 23:45:24.000000000 -0400 @@ -392,9 +392,12 @@ (when tmp-pers (setq personality tmp-pers)))) + (setq personality (or personality + (and (assoc "default" gnus-personalities) "default") + (completing-read "Personality: " gnus-personalities nil 1))) - (if (or personality (assoc "default" gnus-personalities)) - (let* ((values (assoc (or personality "default") gnus-personalities)) + + (let* ((values (assoc personality gnus-personalities)) (foo1 (cdr values)) (fromfoo (car foo1)) (from (cond @@ -437,10 +440,6 @@ ((listp signaturesfoo) (eval signaturesfoo)) ))) - - ; (from (cdr (assoc 'from values))) - ; (extras (cdr (assoc 'extras values))) - ; (signature (cdr (assoc 'signature values)))) (progn (if (and (not personality) (assoc "default" gnus-personalities)) (let ((personality "default")) @@ -535,145 +534,7 @@ (search-forward mail-header-separator) (forward-line 1) (beginning-of-line) - ) - ) - - - - - (let* ( (personality (gnus-personality-prompt)) - (values (assoc personality gnus-personalities)) - ; (from (cdr (assoc 'from values))) - ; (extras (cdr (assoc 'extras values))) - ; (signature (cdr (assoc 'signature values)))) - (foo1 (cdr values)) - (fromfoo (car foo1)) - (from (cond - ((stringp fromfoo) - fromfoo) - ((or (symbolp fromfoo) - (functionp fromfoo)) - (cond ((functionp fromfoo) - (funcall fromfoo)) - ((boundp fromfoo) - (symbol-value fromfoo)))) - ((listp fromfoo) - (eval fromfoo)) )) - (foo (cdr foo1)) - (extrasfoo (car foo)) - (extras (cond - ((stringp extrasfoo) - extrasfoo) - ((or (symbolp extrasfoo) - (functionp extrasfoo)) - (cond ((functionp extrasfoo) - (funcall extrasfoo)) - ((boundp extrasfoo) - (symbol-value extrasfoo)))) - ((listp extrasfoo) - (eval extrasfoo)) - )) - (foo2 (cdr foo)) - (signaturesfoo (car foo2)) - (signature (cond - ((stringp signaturesfoo) - signaturesfoo) - ((or (symbolp signaturesfoo) - (functionp signaturesfoo)) - (cond ((functionp signaturesfoo) - (funcall signaturesfoo)) - ((boundp signaturesfoo) - (symbol-value signaturesfoo)))) - ((listp signaturesfoo) - (eval signaturesfoo)) - ))) - (progn - ; Set up the last-personality in case we change them: - (setq gnus-personality-last-used personality) - ;Let's do From: first. - (if (and from (not (equal from ""))) - (progn - (let ((endpos (search-forward mail-header-separator))) - (goto-char (point-min)) - (if (re-search-forward "From:" endpos t) - (progn - (beginning-of-line) - (let ((beg (point))) - (end-of-line) - (delete-region beg (point)) - ) - (insert (concat - "From: " - from - ) - ) - ) - (progn - (goto-char (point-min)) - (insert (concat - "From: " - from - "\n" - ) - ) - ) - )))) - (if gnus-pers-cc-fix - ; Now we have a problem with Cc when doing a followup. So let's check the Cc field and see if from is there: - (save-excursion - (save-restriction - (message-narrow-to-head) - (let ((case-fold-search t) - (rmail-dont-reply-to-names - (regexp-quote - (cadr (gnus-extract-address-components from)))) - (cc (message-fetch-field "cc"))) - (when (and cc - (string-match rmail-dont-reply-to-names cc)) - (message-remove-header "cc") - (widen) - (unless (string= "" (setq cc (rmail-dont-reply-to cc))) - (message-goto-cc) - (insert cc))) - - ) - ) - ) -) - - ; Now the extra headers - (if (and extras (not (equal extras ""))) - (progn - (goto-char (point-min)) - (search-forward mail-header-separator) - (forward-line -1) - (end-of-line) - (insert (concat - "\n" - extras - ) - ) - - ) - - ) - ; Now the signature - (if (and signature (not (equal signature ""))) - (let ((oldsig message-signature) - (oldsigfile message-signature-file)) - (cond ((file-exists-p signature) - (setq message-signature-file signature)) - (t - (setq message-signature signature))) - (gnus-pers-insert-signature) - (setq message-signature oldsig) - (setq message-signature-file oldsigfile)) - -) - ) - ) - ) ; buttonize from now that we're done (gnus-personality-buttonize-from)