VM

supercite with vm 7.19 and "lastname, first" citation problem

Asked by l8gravely

Hi all,

I know (or suspect) that this isn't really a VM issue, but since the Supercite mailing list is dead... I figured I'd ask here.

I'm still running VM 8.1.1 (also tested with 7.19) on Emacs 22 (and Emacs 21), along with supercite 3.1 and I've run into a problem citing when users have their name in the format of:

   "Last, First (Something)" <email address hidden>

The yanked email gets correctly cited, but it brings along the trailing comma, so email looks like:

     Last,> start of message
     Last,> more lines

and when I goto fill the paragraph, supercite bombs out and just does a crappy job. My elisp-fu is *very* weak, so I'm not sure how I'd fix this issue to strip the comma ou by default.

I've got the following in my .emacs file, which is probably ancient legacy supercite stuff, but it's worked for years and years.

(add-hook 'mail-yank-hooks 'sc-cite-original)
        sc-citation-delimeter ">"
; sc-name-filter-alist (cons '("^\"$" . 0) sc-name-filter-alist)
        sc-header-nuke-list
        '("via" "origin" "status" "received" "remailed" "cc"
   "sender" "replied" "organization" "keywords"
   "distribution" "xref" "references" "expires"
   "approved" "summary" "precedence" "subject"
   "newsgroup[s]?"
   "\\(followup\\|apparently\\|errors\\|\\(\\(in-\\)?reply\\)?-\\)?to"
   "x-[a-z0-9-]+"
   "[a-z-]*message-id"
   "\\(summary-\\)?line[s]"
   "\\(\\(return\\|reply\\)-\\)?path"
   "\\(posted-\\)?date"
   "\\(mail-\\)?from"
   "content"
   "\\mime-.*"
   "content-type"
   "content-length")
        )))

(setq sc-attribs-postselect-hook
      '(lambda()
  (if (string-match "'s$" attribution)
      (setq attribution
     (substring attribution 0 (- (length attribution) 2))
     citation (sc-make-citation attribution))
    )
  (if (string-match "^\"" attribution)
      (setq attribution
     (substring attribution 1 (length attribution))
     citation (sc-make-citation attribution))
    )
  ))

Thanks for any help you can give me.

John

Question information

Language:
English Edit question
Status:
Solved
For:
VM Edit question
Assignee:
No assignee Edit question
Solved by:
Arik
Solved:
Last query:
Last reply:
Revision history for this message
Uday Reddy (reddyuday) said :
#1

I myself don't have any experience with supercite. Some of our other
VM maintainers might.

If you don't hear from anybody, your better bet is to post it to the
gnu.emacs.vm.info newsgroup, with a copy to gnu.emacs.help. You can
use Google Groups web interface if you don't have access to usenet
newsgroups.

Cheers,
Uday Reddy

Revision history for this message
Best Arik (akwm) said :
#2

I also don't have any experience with supercite, but I think I may have found the culprit (though I did not test this, but calling the function directly yields the expected results). Try applying this patch to supercite.el

--- supercite.el 2010-10-21 12:31:23.000000000 -0400
+++ supercite.el 2010-10-21 12:31:23.000000000 -0400
@@ -1,4 +1,8 @@
- (if (string-match "\\([ \t]*\\)\\([^ \t._]+\\)\\([ \t]*\\)" namestring)
- (cons (match-string 2 namestring)
- (sc-attribs-chop-namestring (substring namestring (match-end 3))))))
+ (if (string-match "\\([ \t]*\\)\\([^ \t._]+\\),\\([ \t]*\\)" namestring)
+ (let ((lastname (match-string 2 namestring)))
+ (append (sc-attribs-chop-namestring (substring namestring (match-beginning 3)))
+ (list lastname)))
+ (if (string-match "\\([ \t]*\\)\\([^ \t._]+\\)\\([ \t]*\\)" namestring)
+ (cons (match-string 2 namestring)
+ (sc-attribs-chop-namestring (substring namestring (match-end 3)))))))

Normal string:

~ $ (setq name "John X Doe")
John X Doe
~ $ (sc-attribs-chop-namestring name)
("John" "X" "Doe")

last first string:

~ $ (setq name "Doe, John X")
Doe, John X
~ $ (sc-attribs-chop-namestring name)
("John" "X" "Doe")
~ $

Thanks,
~Arik

Revision history for this message
l8gravely (john-stoffel) said :
#3

Hi Arik,

My apologies for not getting back to you sooner on this, but this patch (with some minor edits) solves my problem for now.

The next question is how to get this included into the standard supercite.el setup. Or at least tested more thoroughly.

Again, thanks, your update makes perfect sense to this elisp illiterate hacker.

John

Revision history for this message
l8gravely (john-stoffel) said :
#4

Thanks Arik, that solved my question.