Gnus development mailing list
 help / color / mirror / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org
Subject: Re: gnus-registry flags API
Date: Thu, 06 Mar 2008 15:50:23 -0600	[thread overview]
Message-ID: <86ejan1q00.fsf@jumptrading.com> (raw)
In-Reply-To: <863ar5807t.fsf@lifelogs.com>

On Wed, 05 Mar 2008 13:00:54 -0600 Ted Zlatanov <tzz@lifelogs.com> wrote: 

TZ> On Tue, 04 Mar 2008 16:43:46 -0600 Ted Zlatanov <tzz@lifelogs.com> wrote: 
TZ> I couldn't figure out the text properties, or how to update the summary
TZ> line as soon as a flag is set.  For now I've comitted a function
TZ> gnus-registry-user-format-function-M that shows the flags (unsorted, in
TZ> the order they were set).  But the user has to exit the group and
TZ> re-enter it to see the new flags.  I'll take a look again but if someone
TZ> knows how to do it, please let me know to save me all the work.

TZ> I still haven't done text properties, but the rest is working now.  See
TZ> gnus-registry-user-format-function-M and gnus-registry-install-shortcuts
TZ> for the details.

I played with the text properties, but they just don't look very nice.
The image needs to be aligned exactly with the character size or the
line is skewed, and I didn't want to spend the time getting that perfect
alignment.  Here's an example user formatting function which inserts an
image (as Reiner showed me) at the insertion point, in case someone
wants to play with it further.

(defun gnus-registry-user-format-function-propertized-M (headers)
  (let* ((id (mail-header-message-id headers))
	 (marks (when id (gnus-registry-fetch-extra-marks id))))
    (with-temp-buffer
      (dolist (mark marks)
	(let* ((info (cdr-safe (assoc mark gnus-registry-marks)))
	       (c (plist-get info :char))
	       (i (plist-get info :image)))
	  (when c
	    (insert c)
	    (when i
	      (add-text-properties (1- (point)) (point)
				   (list 'display gnus-mode-line-image-cache
					 'help-echo "To do")
				   (current-buffer))))))
      (buffer-string))))

Users can just use a Unicode character until someone provides a better
user formatting function.  Here's my Greek letter setup (omega for
"work" is a stretch, but I didn't want to overthink this :)

(setq gnus-registry-marks  
      '((Important
     :char ?ι)
    (Work
     :char ?ω)
    (Personal
     :char ?π)
    (To-Do
     :char ?τ)
    (Later
     :char ?λ)))

Note :image is not specified as it is in the default specification of
the variable.  It's not used, and none of the current functionality
needs it, so it can be safely omitted.

Ted



      reply	other threads:[~2008-03-06 21:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-25 16:26 Ted Zlatanov
2007-09-25 19:58 ` Bastien
2007-09-25 23:40 ` Leo
2007-12-19  1:22 ` Ted Zlatanov
2008-01-03 17:10   ` Reiner Steib
2008-01-03 17:55     ` Ted Zlatanov
2008-01-04 17:43       ` Reiner Steib
2008-01-15 21:56         ` Ted Zlatanov
2008-01-16 21:52           ` Ted Zlatanov
2008-02-06 17:17             ` Ted Zlatanov
2008-02-16 20:26               ` Reiner Steib
2008-02-28 15:12                 ` Ted Zlatanov
2008-02-28 20:04                   ` Reiner Steib
2008-02-29 23:19                     ` Ted Zlatanov
2008-03-04 22:43                     ` Ted Zlatanov
2008-03-05 19:00                       ` Ted Zlatanov
2008-03-06 21:50                         ` Ted Zlatanov [this message]

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=86ejan1q00.fsf@jumptrading.com \
    --to=tzz@lifelogs.com \
    --cc=ding@gnus.org \
    /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).