Gnus development mailing list
 help / color / mirror / Atom feed
From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Cc: ding@ifi.uio.no
Subject: Re: September Gnus 0.60 is released
Date: Mon, 1 Apr 1996 18:21:52 +0200	[thread overview]
Message-ID: <199604011621.SAA02507@durin.uio.no> (raw)
In-Reply-To: <w8sohpcdk0k.fsf@aegir.ifi.uio.no>

Lars Magne Ingebrigtsen <larsi@ifi.uio.no> writes:
> Hallvard B Furuseth <h.b.furuseth@usit.uio.no> writes:
> 
>> The reason is that all of UiO (except ifi.uio) has a common user
>> database, but UiO has several sub-domains (for the various departments).
>> The *only* way to learn which sub-domain a user belongs to, is to ask
>> the mail system.
> 
> Right.  The `user-mail-address-hook' thing would avoid having to do
> this each time an Emacs is started.  
> 
> Have you sent off a patch for this to Stallman?

No, I couldn't think of a "clean and obvious way" to do it, so I though
we could trash it out here on ding@ifi first.

Ding'ers, please take a look and see if you can think of a not-too-ugly
interface to this.

Should the hook be called:
* every time (user-mail-address) is called (i.e. a hook to the
  (user-mail-addres) *function*), or
* just the first time user-mail-address is computed (i.e.  a hook to the
  user-mail-addres *variable*)?

Remember:
* Some packages we can't get at, don't call the (user-mail-address)
  function.

* Someone liked a hook like this to compute user-mail-address dependent
  on the current article or whatever.  That's wrong, because the
  article's computed address will linger and be used in other places as
  well (if the function doesn't call (user-mail-adress)).  So maybe we'd
  need another variable for this "local" addresses.  Here is one variant:

	(defvar user-mail-address-function nil
	  "Function which may be used to compute user-mail-address
	either temporarily or permanently.  To compute it permanently,
	it should modify `user-mail-address' and maybe reset itself to nil.")

	(defun user-mail-address ()
	  (or (and user-mail-address-function
		   (funcall user-mail-address-function))
	      (progn
		;; well, we don't really need this hook now
		;; that we have user-mail-address-function
		(run-hooks 'user-mail-address-hooks)
		user-mail-address))))


* We could solve everything by letting the user-mail-address variable
  be a sexp which should be evalled or some such hack -- except this
  wouldn't be backwards compatible.

Herez a repost of the original suggestion, if you deleted my article:

> From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
> Date: Fri, 29 Mar 1996 00:22:50 +0100
> To: abraham@dina.kvl.dk (Per Abrahamsen)
> CC: ding@ifi.uio.no
> Subject: Re: September Gnus 0.60 is released
> Message-Id: <199603282322.AAA23958@durin.uio.no>
> 
> If we (eh... Lars) is cleaning up unnecessary valiables, I think the
> standard `user-mail-address' and `mail-host-address' should suffice.
> 
> user-mail-address's value is "abraham@dina.kvl.dk"
> 
> Documentation:
> *Full mailing address of this user.
> This is initialized based on `mail-host-address',
> after your init file is read, in case it sets `mail-host-address'.

I'd like a user-mail-address-hook which programs (optionally) should run
before they use user-mail-address.  This is because the "official" mail
address (as opposed to some "working" mail address) can be expensive to
compute, so it should only be computed when it's needed, not in
default.el.  user-mail-address would still be set at startup, so that
programs that don't run the hook will still work.

It gets a little hairy because the _system manager_ might provide a hook
in default.el while the _user_ provides his address in .emacs -- and if
so, the user's setting should be used.


Anyway, here is an attempt.  I introduced (user-mail-address) so
programmers won't have to say (progn (run-hooks ...) user-mail-address)
all the time.

(defvar computed-user-mail-address nil
  "The mail address which is originally computed at startup.
This can be used to check whether the user has configured his address.")

(defun user-mail-address ()
  "Call this instead of using the variable `user-mail-address' directly."
  (if (or (null user-mail-address)
	  ;; hmm -- `eq' or `equal'?  Has `eq' any disadvantages here?
	  ;; Otherwise it's preferred, because it lets the user
	  ;; explicitly set the address to the original address in
	  ;; case he likes that better than the computed version
	  ;; (and he doesn't need to know about the hook:-)
	  (eq user-mail-address computed-user-mail-addresss))
      ;; If the address has not been modified since startup, call this hook.
      ;; That way, if the system manager sets the hook in default.el but the
      ;; user sets the address in .emacs, the user's value will take
      ;; precedence.
      (run-hooks 'user-mail-address-hooks))
  user-mail-address)

Or maybe the hook should be responsible for checking that it doesn't
override the user's setting.  (I.e. the hook could check
computed-user-mail-address).  It would normally have to reset itself
after use anyway, so it's not called again.

startup.el would execute
  (or computed-user-mail-address
      (setq computed-user-mail-address (concat (user-login-name) "@"
                                               (or mail-host-address
                                                   (system-name)))))
  (or user-mail-address
      (setq user-mail-address computed-user-mail-address))


To test it before we can patch startup.el, gnus.el can use

  (and (not computed-user-mail-address)
       (equal (setq computed-user-mail-address (concat (user-login-name) "@"
						       (or mail-host-address
							   (system-name))))
	      user-mail-address)
       (setq computed-user-mail-address user-mail-address))


Regards,

Hallvard


  reply	other threads:[~1996-04-01 16:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-03-28  6:25 Lars Magne Ingebrigtsen
1996-03-28 10:49 ` Magnus Hammerin
1996-03-28 11:28   ` Kai Grossjohann
1996-03-28 12:36     ` Magnus Hammerin
1996-03-28 13:16       ` Kai Grossjohann
1996-03-28 14:26         ` Per Abrahamsen
1996-03-28 23:22           ` Hallvard B Furuseth
1996-03-29 16:11             ` Lars Magne Ingebrigtsen
1996-03-29 16:39               ` Hallvard B Furuseth
1996-04-01 15:46                 ` Lars Magne Ingebrigtsen
1996-04-01 16:21                   ` Hallvard B Furuseth [this message]
1996-04-02 20:01                     ` Lars Magne Ingebrigtsen
1996-04-02 20:38                       ` Per Abrahamsen
1996-04-16 20:01                         ` Hallvard B Furuseth
1996-03-29 16:58               ` Scott Blachowicz
1996-03-29 18:12                 ` Russ Allbery
1996-03-29  5:31           ` Lars Magne Ingebrigtsen
1996-03-29  2:04       ` Hallvard B Furuseth
1996-03-29  5:27       ` Lars Magne Ingebrigtsen
1996-03-29  5:26     ` Lars Magne Ingebrigtsen
1996-03-29  9:08       ` Small thinko in .message.el variable initialisation Jan Vroonhof

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=199604011621.SAA02507@durin.uio.no \
    --to=h.b.furuseth@usit.uio.no \
    --cc=ding@ifi.uio.no \
    /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).