Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Re: Resolving user names on local system
       [not found] <v6bof37swwd.fsf@ccc8.WPI.EDU>
@ 2003-04-15 21:37 ` Lars Magne Ingebrigtsen
       [not found]   ` <uu3ckjig94.fsf@xpc21.ast.cam.ac.uk>
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-04-15 21:37 UTC (permalink / raw)


pcooper@wpi.edu (Pete Cooper Jr.) writes:

> Just typing the username sends it & gets it to the right place, but
> it doesn't expand to the user's full name & email address.

That sounds like useful functionality.  I guess it looks in the
/etc/passwd file and uses the same address as you've set for
yourself?  Or the system name?

If somebody were to implement this, I think it would make a nice
add-on package for the Emacs mailers.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]     ` <m33ckjv3ak.fsf@quimbies.gnus.org>
@ 2003-04-16 12:43       ` William F Hammond
       [not found]       ` <v6bsmsjktte.fsf@ccc3.WPI.EDU>
  1 sibling, 0 replies; 10+ messages in thread
From: William F Hammond @ 2003-04-16 12:43 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Glenn Morris <gmorris+news@ast.cam.ac.uk> writes:
> 
> > Something like this?
> >
> > http://groups.google.com/groups?selm=wziog9667l3.fsf%40mail.dotcom.fr
> 
> Yes, something like that, because...
> 
> > That use niscat/ypcat rather than /etc/passwd.

Shouldn't /etc/passwd be checked first?  But then if smtpmail-send-it
is wired, it's not quite clear what should be done for a recipient
found in /etc/passwd.

> ... not too many people use NIS these days, I think.

Perhaps look for the passwd database in LDAP instead.

                                    -- Bill


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]         ` <874r4yk70e.fsf@jautero.no-ip.org>
@ 2003-04-16 13:44           ` Kai Großjohann
       [not found]             ` <871y02k078.fsf@jautero.no-ip.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-04-16 13:44 UTC (permalink / raw)


Juha Autero <Juha.Autero@iki.fi> writes:

> I think getpwnam(3) would be the right way to do that. Quick search
> didn't reveal equivalent elisp function, though. Which is pretty silly
> considering that Emacs uses getpwnam(3) to resolve "~username" type
> paths and therefore contains implementation of getpwnam for win32.

What about the function user-full-name?  Is this what you're looking
for or is it lacking somehow?
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]             ` <871y02k078.fsf@jautero.no-ip.org>
@ 2003-04-16 21:40               ` Lars Magne Ingebrigtsen
       [not found]                 ` <v6b8yua6miz.fsf@ccc10.WPI.EDU>
  0 siblings, 1 reply; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-04-16 21:40 UTC (permalink / raw)


Juha Autero <Juha.Autero@iki.fi> writes:

>> What about the function user-full-name?  Is this what you're looking
>> for or is it lacking somehow?
>
> I said it was a quick look. That function didn't have get or pw in
> it. ;) And it doesn't return complete passwd struct (not even complete
> comment field), but that probably doesn't matter in this case.

I didn't know that `user-full-name' took a parameter, either.  :-)

Then this should be really easy to implement.

But looking at the Message code, I think that's probably not the
right place to implement this.  Message uses mailabbrev.el, and it
should be expanded to allow, er, expansion based on `user-full-name',
I think.

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]                 ` <v6b8yua6miz.fsf@ccc10.WPI.EDU>
@ 2003-04-19  3:30                   ` Pete Cooper Jr.
       [not found]                     ` <843ckddxct.fsf@lucy.is.informatik.uni-duisburg.de>
  0 siblings, 1 reply; 10+ messages in thread
From: Pete Cooper Jr. @ 2003-04-19  3:30 UTC (permalink / raw)


Well, I don't know if anyone out there besides me actually cares, as
there hasn't been any discussion on this thread in the past couple
days, but I've updated my local-username-expansion code to address
a little of the quick-and-dirty-ness of my last try (the domain name,
in particular).

I have the following code in my .gnus to expand local usernames to
include the full name and domain when composing a message.

I'd like feedback on it (which probably wasn't clear in my last
post). Is this a reasonable way to go about doing what I'm trying to
do? Adding something to the pre-abbrev-expand-hook when I'm not really
doing anything with abbrevs in it seems a bit kludgy... Is there a
better way to go about this? Should I be naming things differently?
I'm really quite new at emacs-lisp.

Thanks in advance for any feedback.

; Expands local usernames to include the full name and domain when
; composing messages to them.
(add-hook 'message-mode-hook 'localsystem-names-abbrevs-setup)
(defun localsystem-names-abbrevs-setup ()
  (add-hook 'pre-abbrev-expand-hook 'localsystem-names-autoexpand t t))
(defun localsystem-names-autoexpand ()
  (if (mail-abbrev-in-expansion-header-p)
      (localsystem-names-expand)))
(defun localsystem-names-expand ()
  "Expands the login name before point to include the full name and domain."
  (interactive)
  (let* ((end (point))
	 (beginning (save-excursion
		      (backward-word 1)
		      (point)))
	 (username (buffer-substring beginning end))
	 (fullname (user-full-name username)))
    (if fullname
	(progn
	  (delete-region beginning end)
	  (insert (concat "\""
			  fullname
			  "\" <"
			  username
			  "@"
			  gnus-local-domain
			  ">"))))))

-- 
Peter C.
Keyboard not found. Press F1 to continue.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]                       ` <v6bwuhor329.fsf@ccc3.WPI.EDU>
@ 2003-04-21 11:22                         ` Kai Großjohann
       [not found]                           ` <84ptngf61x.fsf@lucy.is.informatik.uni-duisburg.de>
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-04-21 11:22 UTC (permalink / raw)


pcooper@wpi.edu (Pete Cooper Jr.) writes:

> kai.grossjohann@gmx.net (Kai Großjohann) writes:
> [snip agreeing with my code]
>> >     (if fullname
>> > 	(progn
>> > 	  (delete-region beginning end)
>> > 	  (insert (concat "\""
>> > 			  fullname
>> > 			  "\" <"
>> > 			  username
>> > 			  "@"
>> > 			  gnus-local-domain
>> > 			  ">"))))))
>> 
>> But this part looks a little bit simplistic.
>
> Completely agreed. I wanted something that worked for now, figuring
> someone else would know the Right Way to do it.

OK.

> Well, i can't find a message-completion-alist variable, but
> message-tab might be the right place for it... Or at least, hooking
> into a particular keystroke or on leaving the field or something. Like
> I mentioned before, hooking into the abbrev system when not doing
> anything with abbrevs seems a bit kludgey.

Ah, message-completion-alist is new in Oort and you're using Gnus
5.9.  Do you want to download the most recent sources from CVS and
play with them?

> I don't know if I'm ready to start futzing with the actual gnus code
> yet, though... For one thing I'm not an admin, so I'd need to copy
> some (or all) of the gnus code to my directory to start playing with
> it... And I don't know if I've got the quota to spare for that :)
> (although I probably could manage it).

Info: my Gnus working directory is 29 MB, and that includes the
source code as well as the *.elc files (and the documentation).

It would be really cool if you could provide a patch.  The only thing
is that if your patch is >10 lines, then you'll need to sign a
copyright assignment for inclusion into Gnus (and thus, Emacs).  Are
you willing to sign such a copyright assignment?

(There are various flavors: assign a particular change, assign a
particular change and all future changes, for Emacs or for Gnus or
for all GNU programs.)

>> * The function localsystem-names-expand is very short -- is it
>> really necessary?
>
> Well, localsystem-names-expand is the longest function there... I put
> the expansion separate because I wanted to be able to run it
> separately from the automatic hook while testing, and because I
> thought that it might come in useful somewhere if you want to expand a
> username in some arbitrary place.

OK.  Didn't think of that.  Yes, expanding a user name in an
arbitrary place is a good idea.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]                             ` <v6bsmsc3w8w.fsf@ccc7.WPI.EDU>
@ 2003-04-21 13:03                               ` Kai Großjohann
       [not found]                                 ` <v6bwuhnhgvs.fsf@ccc9.WPI.EDU>
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-04-21 13:03 UTC (permalink / raw)


pcooper@wpi.edu (Pete Cooper Jr.) writes:

> kai.grossjohann@gmx.net (Kai Großjohann) writes:
>
>> It would be really cool if you could provide a patch.  The only
>> thing is that if your patch is >10 lines, then you'll need to sign a
>> copyright assignment for inclusion into Gnus (and thus, Emacs).  Are
>> you willing to sign such a copyright assignment?
>> 
>> (There are various flavors: assign a particular change, assign a
>> particular change and all future changes, for Emacs or for Gnus or
>> for all GNU programs.)
>
> Sure. If someone else wants to use my code, more power to them :)
> I was wondering how the whole submission-to-an-open-source-project
> thing worked.
>
> Would it be covering all changes I submitted directly to them, any
> changes I post publicly, or any changes I make at all (which I don't
> see how that could work, but I'm not that familiar with the specifics
> of the GNU licensing systems)?

Normally, it's enough to just submit your changes and to GPL them, or
whatever.  But Emacs is special: the FSF feels that it is easier to
defend the GPL when the copyright for all of Emacs belongs to one
organization.  So when you include something in Emacs, you have to
assign the copyright to the FSF.

> Why 10 lines, out of curiosity? Just seems like an arbitrarily-picked
> number. Are people allowed to use my code smaller than that without my
> permission? Or is it just that nobody really cares for less than that
> amount?

Maybe it's because something shorter than 10 lines is not considered
a copyrightable entity.  It also helps not to have to deal with the
copyright assignment for every small change.

The number 10 is indeed somewhat arbitrary, and the limit is not
*that* fixed.  (What happens when somebody submits two changes of 6
lines each?)  But I just stick to it to be on the safe side.

>> >> * The function localsystem-names-expand is very short -- is it
>> >> really necessary?
>> >
>> > Well, localsystem-names-expand is the longest function there... I put
>> > the expansion separate because I wanted to be able to run it
>> > separately from the automatic hook while testing, and because I
>> > thought that it might come in useful somewhere if you want to expand a
>> > username in some arbitrary place.
>> 
>> OK.  Didn't think of that.  Yes, expanding a user name in an
>> arbitrary place is a good idea.
>
> And actually might be all I want for now... I recently discovered a
> bug in what I've got now... if I type an @ sign (or a period, or some
> other symbol-in-an-email-address probably) after a username, and that
> username is on my system, then it'll expand the username and then
> insert the character.
> So if I'm trying to write out pcooper@wpi.edu, when I get to the @
> sign I end up with "Pete Cooper Jr." <pcooper@WPI.EDU>@
> Which isn't what I want.

Hm.

Mail aliases (`group' and `alias' entries in ~/.mailrc) are handled
like abbrevs.  But they don't have the `@' problem.  Hm.

I guess that hooking into message-tab would solve the problem -- then
users hit TAB.

> It definitely should be hooked into either leaving the field, or the
> keystroke for just completing it in a random place.
>
> Any ideas on what the functions should be named? "localsystem-names"
> was just the first thing to pop into my head, and I didn't know if
> there was a more emacsly/gnusly convention I should be following.

message-expand-local-user seems a reasonable name after integration
of the whole thing into message.el.
-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]                                     ` <v6b1xzvk284.fsf@ccc9.WPI.EDU>
@ 2003-04-22 12:15                                       ` Kai Großjohann
       [not found]                                         ` <v6bbryyog5c.fsf@ccc4.WPI.EDU>
  0 siblings, 1 reply; 10+ messages in thread
From: Kai Großjohann @ 2003-04-22 12:15 UTC (permalink / raw)


pcooper@wpi.edu (Pete Cooper Jr.) writes:

> kai.grossjohann@gmx.net (Kai Großjohann) writes:
>> pcooper@wpi.edu (Pete Cooper Jr.) writes:
>> > That does look better. Here's my code as it stands now. Anyone is free
>> > to use it however they want. Is the keybinding (C-c C-l) I picked
>> > appropriate? I just picked something kinda arbitrary that wasn't being
>> > used (at least, I don't think it was being used). Is this the
>> > appropriate way to add local keybindings?
>> 
>> Keys C-c C-a through C-c C-z are reserved for the major mode, whereas
>> C-c a through C-c z are reserved for the user.
>
> So is that a yes?

Was the key binding intended just for you, personally?  Then it's a
no.  C-c C-l is for the major mode, you could have used C-c l.

If it was intended for the major mode, then C-c C-l would almost have
been good.  But it is taken already in Oort...

-- 
file-error; Data: (Opening input file no such file or directory ~/.signature)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]                                         ` <v6bbryyog5c.fsf@ccc4.WPI.EDU>
@ 2003-04-22 12:56                                           ` Jesper Harder
  0 siblings, 0 replies; 10+ messages in thread
From: Jesper Harder @ 2003-04-22 12:56 UTC (permalink / raw)


pcooper@wpi.edu (Pete Cooper Jr.) writes:

> So, since C-c C-l is taken, what do you suggest? Is there a list of
> Oort's Message-mode keybindings somewhere?

These C-c C-LETTER bindings are currently used in Oort:

C-c C-a		mml-attach-file
C-c C-b		message-goto-body
C-c C-c		message-send-and-exit
C-c C-d		message-dont-send
C-c C-e		message-elide-region
C-c C-f		Prefix Command
C-c C-i		message-goto-signature
C-c C-j		gnus-delay-article
C-c C-k		message-kill-buffer
C-c C-l		message-to-list-only
C-c C-m         Prefix Command
C-c C-n		message-insert-newsgroups
C-c C-o		message-sort-headers
C-c C-q		message-fill-yanked-message
C-c C-r		message-caesar-buffer-body
C-c C-s		message-send
C-c C-t		message-insert-to
C-c C-u		message-insert-or-toggle-importance
C-c C-v		message-delete-not-region
C-c C-w		message-insert-signature
C-c C-y		message-yank-original
C-c C-z		message-kill-to-signature


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Resolving user names on local system
       [not found]                                 ` <v6bwuhnhgvs.fsf@ccc9.WPI.EDU>
       [not found]                                   ` <84r87vpq77.fsf@lucy.is.informatik.uni-duisburg.de>
@ 2003-04-27  2:13                                   ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 10+ messages in thread
From: Lars Magne Ingebrigtsen @ 2003-04-27  2:13 UTC (permalink / raw)


pcooper@wpi.edu (Pete Cooper Jr.) writes:

> That does look better. Here's my code as it stands now. Anyone is free
> to use it however they want. Is the keybinding (C-c C-l) I picked
> appropriate?

As previously noted, most of the `C-c C-whatever' keys are already
taken, so perhaps it would be better to put this on `M-something'...

-- 
(domestic pets only, the antidote for overdose, milk.)
   larsi@gnus.org * Lars Magne Ingebrigtsen


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-04-27  2:13 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <v6bof37swwd.fsf@ccc8.WPI.EDU>
2003-04-15 21:37 ` Resolving user names on local system Lars Magne Ingebrigtsen
     [not found]   ` <uu3ckjig94.fsf@xpc21.ast.cam.ac.uk>
     [not found]     ` <m33ckjv3ak.fsf@quimbies.gnus.org>
2003-04-16 12:43       ` William F Hammond
     [not found]       ` <v6bsmsjktte.fsf@ccc3.WPI.EDU>
     [not found]         ` <874r4yk70e.fsf@jautero.no-ip.org>
2003-04-16 13:44           ` Kai Großjohann
     [not found]             ` <871y02k078.fsf@jautero.no-ip.org>
2003-04-16 21:40               ` Lars Magne Ingebrigtsen
     [not found]                 ` <v6b8yua6miz.fsf@ccc10.WPI.EDU>
2003-04-19  3:30                   ` Pete Cooper Jr.
     [not found]                     ` <843ckddxct.fsf@lucy.is.informatik.uni-duisburg.de>
     [not found]                       ` <v6bwuhor329.fsf@ccc3.WPI.EDU>
2003-04-21 11:22                         ` Kai Großjohann
     [not found]                           ` <84ptngf61x.fsf@lucy.is.informatik.uni-duisburg.de>
     [not found]                             ` <v6bsmsc3w8w.fsf@ccc7.WPI.EDU>
2003-04-21 13:03                               ` Kai Großjohann
     [not found]                                 ` <v6bwuhnhgvs.fsf@ccc9.WPI.EDU>
     [not found]                                   ` <84r87vpq77.fsf@lucy.is.informatik.uni-duisburg.de>
     [not found]                                     ` <v6b1xzvk284.fsf@ccc9.WPI.EDU>
2003-04-22 12:15                                       ` Kai Großjohann
     [not found]                                         ` <v6bbryyog5c.fsf@ccc4.WPI.EDU>
2003-04-22 12:56                                           ` Jesper Harder
2003-04-27  2:13                                   ` Lars Magne Ingebrigtsen

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).