Gnus development mailing list
 help / color / mirror / Atom feed
From: Bob Newell <bobnewell@bobnewell.net>
To: ding <ding@gnus.org>
Subject: Re: gnus-alias-get-something
Date: Wed, 09 Aug 2023 18:32:30 -1000	[thread overview]
Message-ID: <87msyza55t.jbtx@yqjrpoh.ysrusv.net> (raw)
In-Reply-To: <875y5o0y39.eaeaqgsgh@djtil.aqads.com> (Bob Newell's message of "Wed, 09 Aug 2023 10:17:46 -1000")


Bob Newell <bobnewell@bobnewell.net> writes:

> Aloha everyone,
>
> The docs for gnus-alias-identity-alist seem to indicate that
> an element of the list can be a function that returns a
> string.  I have a need for that in the signature field, which
> gnus-alias.el accesses like this:
>
> (defun gnus-alias-get-sig (ID)
>   "Return the SIGNATURE portion of ID."
>   (gnus-alias-get-something ID 6))
>
> But we also have this:
>
> (defsubst gnus-alias-get-something (ID N)
>   "Return the Nth something from ID."
>   (let ((rv (nth N ID)))
>     (if (and (stringp rv) (= (length rv) 0)) nil rv)))
>
> I tried this on the signature field:
>
> (concat start-lisp-home ".signature")
>
> where start-lisp-home is previously defined as
>
> "~/data/elisp"
>
> and got a symbolp error.
>
> Any insights appreciated.  Probably user error!

To "clarify" further, the following works and does what I
want.

(defun rjn-make-sig-string ()

"Based on 'identity' from gnus-alias-identity-alist, insert a sig
from a file .signatureidentity in the start-lisp-home directory,
as defined globally elsewhere.  If the appropriate .signatureidentity
doesn't exist just use .signature and assume it exists."

	   (let ((try-file (concat start-lisp-home ".signature" identity))) 
                 (if (not (file-exists-p try-file))
		     (setq try-file (concat start-lisp-home ".signature")))
 	         (with-temp-buffer
                     (insert-file-contents try-file)
	             (buffer-string))  ))

(setq gnus-alias-identity-alist
   '( 
      ("aol"
       nil
       "Bob Newell <newell.bob@aol.com>"
       nil
       (("BCC" . "bobnewell@bobnewell.net")) ;; extra headers
       nil
       rjn-make-sig-string
       )
 ... etc.

However this seems like REALLY the long way around for
something maybe not terribly important.  Is there something
better?

Mahalo

-- 
Bob Newell
Honolulu, Hawai`i

- Via GNU/Linux/Emacs/Gnus/BBDB


  reply	other threads:[~2023-08-10  4:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-09 20:17 gnus-alias-get-something Bob Newell
2023-08-10  4:32 ` Bob Newell [this message]
2023-08-10  4:40   ` gnus-alias-get-something Emanuel Berg
2023-08-10  7:26     ` gnus-alias-get-something Bob Newell
2023-08-10  7:31   ` gnus-alias-get-something Björn Bidar
2023-08-10 18:16     ` gnus-alias-get-something Bob Newell

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=87msyza55t.jbtx@yqjrpoh.ysrusv.net \
    --to=bobnewell@bobnewell.net \
    --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).