Gnus development mailing list
 help / color / mirror / Atom feed
From: Philipp Haselwarter <philipp.haselwarter@gmx.de>
To: Yagnesh Raghava Yakkala <yagnesh@live.com>
Cc: ding@gnus.org
Subject: Re: Customize citation character
Date: Thu, 19 Jan 2012 20:24:41 +0100	[thread overview]
Message-ID: <87fwfbmr5y.fsf@nzebook.haselwarter.org> (raw)
In-Reply-To: <8739bcri5p.fsf@live.com> (Yagnesh Raghava Yakkala's message of "Thu, 19 Jan 2012 03:15:46 +0900")

Thanks for all the input, here's what I've come up with so far:

--8<---------------cut here---------------start------------->8---
(defcustom my-citation-look '("" "│" "")
  "(prefix citation-string suffix)" :group 'my)

(defun my-citation-style nil
  (let ((inhibit-read-only t)
        (alist gnus-cite-face-list)
        cflist face gnus-cite-prefix-alist)
    (save-excursion
      (gnus-narrow-to-body)
      (gnus-cite-parse)
      (dolist (prefix gnus-cite-prefix-alist) ;(reverse
        (setq cflist (append cflist (list (car alist)))
              alist (cdr alist))
        (let* ((current-cflist cflist)
               (depth (length cflist))
               (len (length (car prefix)))
               (look
                (concat
                 (car my-citation-look)
                 (mapconcat
                  (lambda (s) (propertize s 'face (pop current-cflist)))
                  (make-vector depth (cadr my-citation-look)) "")
                         (caddr my-citation-look))))
          (dolist (line (cdr prefix))
            (goto-char (point-min)) (forward-line (1- line))
            (put-text-property (point) (+ (point) len) 'display look)))))
    (widen)))
--8<---------------cut here---------------end--------------->8---

I'm quite satisfied with the results, although the usage of
`gnus-cite-prefix-alist' could probably be better: Sometimes it becomes
a little overzealous, for example in gmane.emacs.orgmode:51261 (OT:
better way to link articles?).

Someone with a better understanding of gnus internals could probably
figure out how to fix this.

-- 
Philipp Haselwarter



  reply	other threads:[~2012-01-19 19:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-18  2:42 Philipp Haselwarter
2012-01-18  3:57 ` Katsumi Yamaoka
2012-01-18  7:31   ` Reiner Steib
2012-01-18 17:58     ` Yagnesh Raghava Yakkala
2012-01-18 18:15       ` Yagnesh Raghava Yakkala
2012-01-19 19:24         ` Philipp Haselwarter [this message]
2012-01-19 21:13           ` Yagnesh Raghava Yakkala
2012-01-18  6:17 ` Martin
2012-01-18  8:48 ` Eric S Fraga
2012-01-18 10:06   ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fwfbmr5y.fsf@nzebook.haselwarter.org \
    --to=philipp.haselwarter@gmx.de \
    --cc=ding@gnus.org \
    --cc=yagnesh@live.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).