From: Mario L. <ml...@ho...> - 2001-11-26 17:32:22
|
Gergely Nagy <alg...@bo...> writes: > Hello again! > > Attached below is the very latest version of the antifuchs+mhp > patch. The only change between the previous one and this is that I > modified erc-mode to set the initial filename of the buffer using my > customise function. I also changed erc-save-buffer-in-logs to set the > filename too, albeit this might not be necessary. > > Anyway, let the patch speak for itself: > Below are some comments. Any suggestions/ideas. Anyone already fallen int hose pits? > --- erc.el.orig Sat Nov 24 02:24:25 2001 > +++ erc.el Sun Nov 25 00:28:40 2001 > @@ -291,6 +291,21 @@ > :group 'erc > :type 'boolean) > > +(defcustom erc-public-away-p nil > + "Let others know you are back when you are no longer marked away. > +This happens in this form: > +* <nick> is back (gone for <time>) > + > +Many consider it impolite to do so automatically." > + :group 'erc > + :type 'boolean) > + > +(defcustom erc-away-nickname nil > + "The nickname to take when you are marked as being away." > + :group 'erc > + :type '(choice (const nil) > + string)) > + > (defcustom erc-play-sound t > "*Play sound on SOUND ctcp requests (used in ICQ chat)" > :group 'erc > @@ -437,6 +452,31 @@ > :group 'erc > :type 'boolean) > > +(defvar erc-last-saved-position 1 > + "The position in which appears last in the log file for the channel > +buffer") > + > +(make-variable-buffer-local 'erc-last-saved-position) > + > +(defvar erc-log-insert-log-on-open t > + "Insert the log file contentents into the buffer if the log file exists") > + > +(defcustom erc-truncate-buffer-on-save nil > + "Truncate any ERC (channel, query, server) buffer when it is saved. > +When nil, no buffer is ever truncated. Nonetheless, only the relevant > +part of the buffer will be saved.") > + > +(defcustom erc-generate-log-file-name-function 'erc-generate-log-file-name-default hmm, maybe the default function should save the filename in the expanded form, like #name!nick@host:port, because the buffers have short names now, and therefore, logfiles cant be really destinguished from each other in case of multiserver usage? > + "A function name to generate a log filename. The function must take > +four arguments: BUFFER, TARGET, NICK and SERVER. BUFFER is the buffer The code uses five arguments. > +to be saved, TARGET is the name of the channel, or the target of the > +query, NICK is the current nick, and SERVER is the server the buffer > +is on." > + :group 'erc > + :type '(choice (const 'erc-generate-log-file-name-default) > + (const 'erc-generate-log-file-name-old) > + (function))) > + > (defvar erc-grab-buffer-name "*erc-grab*" > "The name of the buffer created by `erc-grab-region'.") > [...] > @@ -2867,6 +2912,14 @@ > :group 'erc > :type 'boolean) > > +(defcustom erc-query-on-unjoined-chan-privmsg t Uggh, I'd really like to find a better name :-). Any suggestions? > + "If non-nil create query buffer on receiving any PRIVMSG at all, > +including PRIVMSGs directed to channels. If you are using an IRC > +bouncer, such as dircproxy, to keep a log of channels when you are > +disconnected, you should set this option to t." See below. > + :group 'erc > + :type 'boolean) > + > (defcustom erc-minibuffer-notice nil > "If non-nil, ERC will print notices in the minibuffer in case the > session buffer isn't visible." > @@ -3170,12 +3223,18 @@ > > (defun erc-auto-query (proc parsed) > "Put this on `erc-server-PRIVMSG-hook'." > - (let ((nick (car (erc-parse-user (aref parsed 1)))) > - (target (aref parsed 2))) > + (let* ((nick (car (erc-parse-user (aref parsed 1)))) > + (target (aref parsed 2)) > + (query (if (not erc-query-on-unjoined-chan-privmsg) > + nick > + (if (string= target (erc-current-nick)) > + nick > + target)))) > (and erc-auto-query > - (string= target (erc-current-nick)) > - (not (erc-get-buffer nick proc)) > - (erc-cmd-query nick)))) > + (or erc-query-on-unjoined-chan-privmsg > + (string= target (erc-current-nick))) > + (not (erc-get-buffer query proc)) > + (erc-cmd-query query)))) I am not sure, but shouldn't we issue a /name #channel, and perhaps /topic #channel somewhere in here? At least from reading that, I think that the info buffers would get screwed in some way? > > ;;; PRIVMSG and NOTICE > [...] > @@ -5181,6 +5248,16 @@ > (buffer-enable-undo)) > (set-buffer ob))) > > +(defun erc-generate-log-file-name-default (buffer target nick server port) > + "Default log filename generator." > + (concat erc-log-channels-directory "/" (buffer-name buffer) ".txt")) See above. The default would mean we can get files like #emacs<4>.txt #channel!nick@server:port.ext should be more convinient? > +(defun erc-generate-log-file-name-old (buffer target nick server port) > + "Old-style (#channel!nick@server.txt) log filename generator" > + (concat erc-log-channels-directory "/" target "!" nick "@" server > + ":" (message (cond ((stringp port) port) > + ((numberp port) > + (number-to-string port)))) ".txt")) > + > (defun erc-save-buffer-in-logs (&optional buffer) > "When the logs are enabled, that is `erc-log-channels' is non-nil > and `erc-log-channels-directory' is a valid directory, appends the [...] Yup! Very cool ideas, thanks for the contributions! I just wanted to check for comments about what I thought while reading the patch before I aplly it. If anyone has an extended version from the above already, go for it and check it in, we can work from there in cvs... -- CYa, Mario <ml...@de...> Homepage(s): http://delysid.org | http://piss.at/ Nature, to be commanded, must be obeyed. -- Francis Bacon |