* rcirc changes
@ 2006-02-09 12:07 Miles Bader
2006-02-11 17:54 ` Ryan Yeske
2006-02-15 5:58 ` Ryan Yeske
0 siblings, 2 replies; 18+ messages in thread
From: Miles Bader @ 2006-02-09 12:07 UTC (permalink / raw)
Cc: emacs-devel
Hi,
I didn't like the format rcirc used to show conversations, so I wrote a
bit of code to allow more customizability; what do you think of the
following patch?
Two basic changes:
(1) add `rcirc-nick-abbrevs' to allow nicknames for nicknames when
printing :-) -- mainly so I could change how it printed _my_ name,
which takes up too much space on the screen, but doesn't seem able
to be changed using existing mechanisms (I can change other users'
nicknames in bitlbee though).
(2) Rewrite `rcirc-format-response-string' to use a more flexible
formatting system controlled by the variable `rcirc-response-formats'
(and change the way `rcirc-print' finds the fill prefix so that it
works when non-standard formats are used).
Thanks,
-Miles
M lisp/net/rcirc.el
M lisp/ChangeLog
* modified files
--- orig/lisp/ChangeLog
+++ mod/lisp/ChangeLog
@@ -1,3 +1,16 @@
+2006-02-09 Miles Bader <miles@gnu.org>
+
+ * net/rcirc.el (rcirc-nick-abbrevs, rcirc-response-formats):
+ New variables.
+ (rcirc-abbrev-nick): New function.
+ (rcirc-format-response-string): Rewrite to use the formats in
+ `rcirc-response-formats' and expand escape sequences therein.
+ A text-property `rcirc-text' is added over the actual response
+ text to make easy to find inside the returned string.
+ (rcirc-print): When filling, just look for the `rcirc-text'
+ text-property to find the appropriate fill prefix, instead of
+ using hardwired patterns.
+
2006-02-07 Mathias Dahl <brakjoller@hotmail.com>
* dired.el (dired-mode-map): Add more bindings for tumme.
--- orig/lisp/net/rcirc.el
+++ mod/lisp/net/rcirc.el
@@ -187,6 +187,11 @@
:type '(repeat string)
:group 'rcirc)
+(defcustom rcirc-nick-abbrevs nil
+ "List of short replacements for printing nicks."
+ :type '(alist :key-type string :value-type string)
+ :group 'rcirc)
+
(defvar rcirc-ignore-list-automatic ()
"List of ignored nicks added to `rcirc-ignore-list' because of renaming.
When an ignored person renames, their nick is added to both lists.
@@ -470,6 +475,11 @@
(with-rcirc-process-buffer process
rcirc-nick))
+(defun rcirc-abbrev-nick (nick)
+ "If NICK has an entry in `rcirc-nick-abbrevs', return its abbreviation,
+otherwise return NICK."
+ (or (cdr (assoc nick rcirc-nick-abbrevs)) nick))
+
(defvar rcirc-max-message-length 450
"Messages longer than this value will be split.")
@@ -879,46 +889,111 @@
buffer
(process-buffer process))))
+(defcustom rcirc-response-formats
+ '(("PRIVMSG" . "%T<%n> %m")
+ ("NOTICE" . "%T-%n- %m")
+ ("ACTION" . "%T[%n] %m")
+ ("COMMAND" . "%T%m")
+ ("ERROR" . "%T%fw!!! %m")
+ (t . "%T%fp*** %fs%n %r %m"))
+ "An alist of formats used for printing responses.
+The format is looked up using the response-type as a key;
+if no match is found, the default entry (with a key of `t') is used.
+
+The entry's value part should be a string, which is inserted with
+the of the following escape sequences replaced by the described values:
+
+ %m The message text
+ %n The sender's nick (with face `rcirc-my-nick' or `rcirc-other-nick')
+ %r The response-type
+ %T The timestamp (with face `rcirc-timestamp')
+ %t The target
+ %fw Following text uses the face `font-lock-warning-face'
+ %fp Following text uses the face `rcirc-server-prefix'
+ %fs Following text uses the face `rcirc-server'
+ %f[FACE] Following text uses the face FACE
+ %f- Following text uses the default face
+ %% A literal `%' character
+"
+ :type '(alist :key-type (choice (string :tag "Type")
+ (const :tag "Default" t))
+ :value-type string)
+ :group 'rcirc)
+
(defun rcirc-format-response-string (process sender response target text)
- (concat (rcirc-facify (format-time-string rcirc-time-format (current-time))
- 'rcirc-timestamp)
- (cond ((or (string= response "PRIVMSG")
- (string= response "NOTICE")
- (string= response "ACTION"))
- (let (first middle end)
- (cond ((string= response "PRIVMSG")
- (setq first "<" middle "> "))
- ((string= response "NOTICE")
- (when sender
- (setq first "-" middle "- ")))
- (t
- (setq first "[" middle " " end "]")))
- (concat first
- (rcirc-facify (rcirc-user-nick sender)
- (if (string= sender
- (rcirc-nick process))
- 'rcirc-my-nick
- 'rcirc-other-nick))
- middle
- (rcirc-mangle-text process text)
- end)))
- ((string= response "COMMAND")
- text)
- ((string= response "ERROR")
- (propertize (concat "!!! " text)
- 'face 'font-lock-warning-face))
- (t
- (rcirc-mangle-text
- process
- (concat (rcirc-facify "*** " 'rcirc-server-prefix)
- (rcirc-facify
- (concat
- (when (not (string= sender (rcirc-server process)))
- (concat (rcirc-user-nick sender) " "))
- (when (zerop (string-to-number response))
- (concat response " "))
- text)
- 'rcirc-server)))))))
+ "Return a nicely-formatted response string, incorporating TEXT
+(and perhaps other arguments). The specific formatting used
+is found by looking up RESPONSE in `rcirc-response-formats'."
+ (let ((chunks
+ (split-string (or (cdr (assoc response rcirc-response-formats))
+ (cdr (assq t rcirc-response-formats)))
+ "%"))
+ (result "")
+ (face nil)
+ key face-key repl)
+ (when (equal (car chunks) "")
+ (pop chunks))
+ (dolist (chunk chunks)
+ (if (equal chunk "")
+ (setq key ?%)
+ (setq key (aref chunk 0))
+ (setq chunk (substring chunk 1)))
+ (setq repl
+ (cond ((eq key ?%)
+ ;; %% -- literal % character
+ "%")
+ ((eq key ?n)
+ ;; %n -- nick
+ (rcirc-facify (rcirc-abbrev-nick (rcirc-user-nick sender))
+ (if (string= sender (rcirc-nick process))
+ 'rcirc-my-nick
+ 'rcirc-other-nick)))
+ ((eq key ?T)
+ ;; %T -- timestamp
+ (rcirc-facify
+ (format-time-string rcirc-time-format (current-time))
+ 'rcirc-timestamp))
+ ((eq key ?m)
+ ;; %m -- message text
+ ;; We add the text property `rcirc-text' to identify this
+ ;; as the body text.
+ (propertize
+ (rcirc-mangle-text process (rcirc-facify text face))
+ 'rcirc-text text))
+ ((eq key ?t)
+ ;; %t -- target
+ (rcirc-facify (or rcirc-target "") face))
+ ((eq key ?r)
+ ;; %r -- response
+ (rcirc-facify response face))
+ ((eq key ?f)
+ ;; %f -- change face
+ (setq face-key (aref chunk 0))
+ (cond ((eq face-key ?w)
+ ;; %fw -- warning face
+ (setq face 'font-lock-warning-face))
+ ((eq face-key ?p)
+ ;; %fp -- server-prefix face
+ (setq face 'rcirc-server-prefix))
+ ((eq face-key ?s)
+ ;; %fs -- warning face
+ (setq face 'rcirc-server))
+ ((eq face-key ?-)
+ ;; %fs -- warning face
+ (setq face nil))
+ ((and (eq face-key ?\[)
+ (string-match "^[[]\\([^]]*\\)[]]" chunk)
+ (facep (match-string 1 chunk)))
+ ;; %f[...] -- named face
+ (setq face (intern (match-string 1 chunk)))
+ (setq chunk (substring chunk (match-end 1)))))
+ (setq chunk (substring chunk 1))
+ "")
+ (t
+ ;; just insert the key literally
+ (rcirc-facify (substring chunk 0 1) face))))
+ (setq result (concat result repl (rcirc-facify chunk face))))
+ result))
(defvar rcirc-activity-type nil)
(make-variable-buffer-local 'rcirc-activity-type)
@@ -960,38 +1035,31 @@
(goto-char rcirc-prompt-start-marker)
(set-marker-insertion-type rcirc-prompt-start-marker t)
(set-marker-insertion-type rcirc-prompt-end-marker t)
- (insert
- (rcirc-format-response-string process sender response target text)
- (propertize "\n" 'hard t))
- (set-marker-insertion-type rcirc-prompt-start-marker nil)
- (set-marker-insertion-type rcirc-prompt-end-marker nil)
-
- ;; fill the text we just inserted, maybe
- (when (and rcirc-fill-flag
- (not (string= response "372"))) ;/motd
- (let ((fill-prefix
- (or rcirc-fill-prefix
- (make-string
- (+ (if rcirc-time-format
- (length (format-time-string
- rcirc-time-format))
- 0)
- (cond ((or (string= response "PRIVMSG")
- (string= response "NOTICE"))
- (+ (length (rcirc-user-nick sender))
- 2)) ; <>
- ((string= response "ACTION")
- (+ (length (rcirc-user-nick sender))
- 1)) ; [
- (t 3)) ; ***
- 1)
- ?\s)))
- (fill-column (cond ((eq rcirc-fill-column 'frame-width)
- (1- (frame-width)))
- (rcirc-fill-column
- rcirc-fill-column)
- (t fill-column))))
- (fill-region fill-start rcirc-prompt-start-marker 'left t)))
+
+ (let ((fmted-text
+ (rcirc-format-response-string process sender response target
+ text)))
+
+ (insert fmted-text (propertize "\n" 'hard t))
+ (set-marker-insertion-type rcirc-prompt-start-marker nil)
+ (set-marker-insertion-type rcirc-prompt-end-marker nil)
+
+ ;; fill the text we just inserted, maybe
+ (when (and rcirc-fill-flag
+ (not (string= response "372"))) ;/motd
+ (let ((fill-prefix
+ (or rcirc-fill-prefix
+ (make-string
+ (or (next-single-property-change 0 'rcirc-text
+ fmted-text)
+ 8)
+ ?\s)))
+ (fill-column (cond ((eq rcirc-fill-column 'frame-width)
+ (1- (frame-width)))
+ (rcirc-fill-column
+ rcirc-fill-column)
+ (t fill-column))))
+ (fill-region fill-start rcirc-prompt-start-marker 'left t))))
;; set inserted text to be read-only
(when rcirc-read-only-flag
--
Quidquid latine dictum sit, altum viditur.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-09 12:07 rcirc changes Miles Bader
@ 2006-02-11 17:54 ` Ryan Yeske
2006-02-12 1:03 ` Miles Bader
2006-02-15 5:58 ` Ryan Yeske
1 sibling, 1 reply; 18+ messages in thread
From: Ryan Yeske @ 2006-02-11 17:54 UTC (permalink / raw)
Cc: emacs-devel
I didn't like the format rcirc used to show conversations, so I wrote a
bit of code to allow more customizability; what do you think of the
following patch?
I like it.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-09 12:07 rcirc changes Miles Bader
2006-02-11 17:54 ` Ryan Yeske
@ 2006-02-15 5:58 ` Ryan Yeske
2006-02-16 4:40 ` Richard M. Stallman
2006-02-16 5:07 ` Miles Bader
1 sibling, 2 replies; 18+ messages in thread
From: Ryan Yeske @ 2006-02-15 5:58 UTC (permalink / raw)
Cc: emacs-devel
I didn't like the format rcirc used to show conversations, so I wrote a
bit of code to allow more customizability; what do you think of the
following patch?
Two basic changes:
(1) add `rcirc-nick-abbrevs' to allow nicknames for nicknames when
printing :-) -- mainly so I could change how it printed _my_ name,
which takes up too much space on the screen, but doesn't seem able
to be changed using existing mechanisms (I can change other users'
nicknames in bitlbee though).
After running with your installed changes, I realize I don't really
like this particular feature (earlier I said "I like it" after only
reading the patch, not running it, sorry). It breaks nick-completion
(you still complete the underlying nicks, not abbrev) and it doesn't
deal with nick changes which are abbreviated. It seems like this is
adding a feature to solve a local problem... if your own nick is too
long, then you can just change it, can't you?
I suggest we remove this feature.
(2) Rewrite `rcirc-format-response-string' to use a more flexible
formatting system controlled by the variable `rcirc-response-formats'
(and change the way `rcirc-print' finds the fill prefix so that it
works when non-standard formats are used).
This I still like, it easily allows users to customize messages in a
straightforward way. I do have some improvements which I will post to
the list shortly.
Ryan
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-15 5:58 ` Ryan Yeske
@ 2006-02-16 4:40 ` Richard M. Stallman
2006-02-16 5:07 ` Miles Bader
1 sibling, 0 replies; 18+ messages in thread
From: Richard M. Stallman @ 2006-02-16 4:40 UTC (permalink / raw)
Cc: emacs-devel, miles
I suggest we remove this feature.
You are the expert on rcirc; if you feel this should be removed,
then please do so.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-15 5:58 ` Ryan Yeske
2006-02-16 4:40 ` Richard M. Stallman
@ 2006-02-16 5:07 ` Miles Bader
2006-02-16 16:30 ` Ryan Yeske
1 sibling, 1 reply; 18+ messages in thread
From: Miles Bader @ 2006-02-16 5:07 UTC (permalink / raw)
Cc: emacs-devel
On 2/15/06, Ryan Yeske <rcyeske@gmail.com> wrote:
> After running with your installed changes, I realize I don't really
> like this particular feature (earlier I said "I like it" after only
> reading the patch, not running it, sorry). It breaks nick-completion
> (you still complete the underlying nicks, not abbrev) and it doesn't
> deal with nick changes which are abbreviated. It seems like this is
> adding a feature to solve a local problem... if your own nick is too
> long, then you can just change it, can't you?
That's the whole point, it changes the _presentation_ in a particular
context, not the nick itself. In one particular context -- the nicks
inserted into the log with each message -- they are used so incredibly
often, that otherwise acceptable nicks can become very annoying. In
that sense, it doesn't break completion or whatever, because what are
inserted into the log when this feature is used are _not nicks_, they
are abbreviations for nicks. [I've actually used this to map
different nicks (the same person on different IM servers) to the same
name when inserted into the log.]
As for whether I can "just change my nick", no I don't seem to be able
to without actually changing my global IM name, and that is not
something to be done lightly (i.e., I won't). Most IM clients seem to
have this sort of "local name" feature (which changes the printed form
of the name, but not the name used in more formal contexts) for
exactly the same reason. Ihe IM translator I use with rcirc, Bitlbee,
has a local rename feature, but (1) it doesn't seem to work on _my_
name, and (2) it apparently can't handle ambiguous names.
Anyway, if you take it out, I'm going to have to add it back in my
local copy, and patches like that are a pain to maintain, so I'd
really rather you didn't; if you can think of some better method that
will accomplish what I want, that would be great, of course...
One possibility would be to make the "abbreviated" form have it's own
format letter in rcirc-format-response-string; for instance, %n would
print the real nick, and %a would print the abbreviated nick; this
would at least allow a bit more control.
-Miles
--
Do not taunt Happy Fun Ball.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-16 5:07 ` Miles Bader
@ 2006-02-16 16:30 ` Ryan Yeske
2006-02-16 20:56 ` Miles Bader
0 siblings, 1 reply; 18+ messages in thread
From: Ryan Yeske @ 2006-02-16 16:30 UTC (permalink / raw)
Cc: emacs-devel
Date: Thu, 16 Feb 2006 14:07:00 +0900
From: Miles Bader <miles@gnu.org>
Sender: snogglethorpe@gmail.com
Cc: emacs-devel@gnu.org
Content-Disposition: inline
On 2/15/06, Ryan Yeske <rcyeske@gmail.com> wrote:
> After running with your installed changes, I realize I don't really
> like this particular feature (earlier I said "I like it" after only
> reading the patch, not running it, sorry). It breaks nick-completion
> (you still complete the underlying nicks, not abbrev) and it doesn't
> deal with nick changes which are abbreviated. It seems like this is
> adding a feature to solve a local problem... if your own nick is too
> long, then you can just change it, can't you?
That's the whole point, it changes the _presentation_ in a particular
context, not the nick itself. In one particular context -- the nicks
inserted into the log with each message -- they are used so incredibly
often, that otherwise acceptable nicks can become very annoying. In
that sense, it doesn't break completion or whatever, because what are
inserted into the log when this feature is used are _not nicks_, they
are abbreviations for nicks. [I've actually used this to map
different nicks (the same person on different IM servers) to the same
name when inserted into the log.]
I'm not sure I totally understand. But what I mean by breaking
completion is that I may see something like:
<miles> hello
when really your nick is snogglethorpe; I have just aliased it to
miles. If I then cycle through nicks to reply to you, I find that
miles isn't in the list. Maybe I should know this, since I know that
miles is an abbrev, but now the tab completion of nicks is pretty much
broken. If I reply to you on a busy channel as miles, it won't make
any sense to anyone but me.
As for whether I can "just change my nick", no I don't seem to be able
to without actually changing my global IM name, and that is not
something to be done lightly (i.e., I won't). Most IM clients seem to
have this sort of "local name" feature (which changes the printed form
of the name, but not the name used in more formal contexts) for
exactly the same reason. Ihe IM translator I use with rcirc, Bitlbee,
has a local rename feature, but (1) it doesn't seem to work on _my_
name, and (2) it apparently can't handle ambiguous names.
That's true, you cant mess with your own nick on bitlbee once you have
registered it.
What about not showing your own nick at all? Just a copy of the
prompt and the text you submitted as it is?
<miles> hello
> hi there
Anyway, if you take it out, I'm going to have to add it back in my
local copy, and patches like that are a pain to maintain, so I'd
really rather you didn't; if you can think of some better method that
will accomplish what I want, that would be great, of course...
One possibility would be to make the "abbreviated" form have it's own
format letter in rcirc-format-response-string; for instance, %n would
print the real nick, and %a would print the abbreviated nick; this
would at least allow a bit more control.
I don't see how that really helps. For the nick abbrev stuff to
actually do what you want, you would always want to see the
abbreviated form, wouldn't you?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-16 16:30 ` Ryan Yeske
@ 2006-02-16 20:56 ` Miles Bader
2006-02-17 12:56 ` Björn Lindström
2006-02-18 17:36 ` Alex Schroeder
0 siblings, 2 replies; 18+ messages in thread
From: Miles Bader @ 2006-02-16 20:56 UTC (permalink / raw)
Cc: emacs-devel
On 2/17/06, Ryan Yeske <rcyeske@gmail.com> wrote:
> I'm not sure I totally understand. But what I mean by breaking
> completion is that I may see something like:
>
> <miles> hello
>
> when really your nick is snogglethorpe; I have just aliased it to
> miles. If I then cycle through nicks to reply to you, I find that
> miles isn't in the list.
I obviously use rcirc diffently than you (maybe because I'm using it
with bitlbee) -- I have a separate buffer for each conversation, so I
never type anything like "NICK: ..." -- I just type "...". So I never
use any sort of completion. In this context, I just don't care about
anything except the appearance, and the simple code I added works
great.
For completion to work properly, presumably it would have to add the
abbrevs to the completion set and do the reverse mapping at some
point; is this something fundamentally hard, or is it just a matter of
coding?
> What about not showing your own nick at all? Just a copy of the
> prompt and the text you submitted as it is?
Well I rather _want_ to show at least some short indicator for myself,
as it makes logs easier to read (anyway, how would you do that?).
Thanks,
-Miles
--
Do not taunt Happy Fun Ball.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-16 20:56 ` Miles Bader
@ 2006-02-17 12:56 ` Björn Lindström
2006-02-18 6:38 ` Miles Bader
2006-02-18 17:36 ` Alex Schroeder
1 sibling, 1 reply; 18+ messages in thread
From: Björn Lindström @ 2006-02-17 12:56 UTC (permalink / raw)
Miles Bader <miles@gnu.org>:
> I obviously use rcirc diffently than you (maybe because I'm using it
> with bitlbee) -- I have a separate buffer for each conversation, so
> I never type anything like "NICK: ..." -- I just type "...". So I
> never use any sort of completion. In this context, I just don't
> care about anything except the appearance, and the simple code I
> added works great.
Well, both me and Ryan use rcirc with BitlBee, too, and I don't see
how this would be particularly useful for that. On BitlBee you
actually control all the nicks yourself, after all.
In any case, I use and like rcirc because it is the "default, simple
IRC client". To add a bunch of features for corner cases like this
would necessarily break that.
So, I think it would be much more appropriate to add this feature to
ERC, if at all.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-17 12:56 ` Björn Lindström
@ 2006-02-18 6:38 ` Miles Bader
2006-02-18 22:18 ` David Kastrup
0 siblings, 1 reply; 18+ messages in thread
From: Miles Bader @ 2006-02-18 6:38 UTC (permalink / raw)
On 2/17/06, Björn Lindström <bkhl@member.fsf.org> wrote:
> So, I think it would be much more appropriate to add this feature to
> ERC, if at all.
The whole reason _I'm_ using rcirc is because erc seemed like massive
confusing overkill... :-) I certainly don't want to start using erc
just because rcirc is missing some minor feature !
-miles
--
Do not taunt Happy Fun Ball.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-18 6:38 ` Miles Bader
@ 2006-02-18 22:18 ` David Kastrup
2006-02-19 0:44 ` Miles Bader
0 siblings, 1 reply; 18+ messages in thread
From: David Kastrup @ 2006-02-18 22:18 UTC (permalink / raw)
Cc: emacs-devel
"Miles Bader" <miles@gnu.org> writes:
> On 2/17/06, Björn Lindström <bkhl@member.fsf.org> wrote:
>> So, I think it would be much more appropriate to add this feature to
>> ERC, if at all.
>
> The whole reason _I'm_ using rcirc is because erc seemed like massive
> confusing overkill... :-) I certainly don't want to start using erc
> just because rcirc is missing some minor feature !
If all favorite minor features are present, massive overkill is hard
to avoid...
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-18 22:18 ` David Kastrup
@ 2006-02-19 0:44 ` Miles Bader
0 siblings, 0 replies; 18+ messages in thread
From: Miles Bader @ 2006-02-19 0:44 UTC (permalink / raw)
Cc: emacs-devel
On 2/19/06, David Kastrup <dak@gnu.org> wrote:
> > The whole reason _I'm_ using rcirc is because erc seemed like massive
> > confusing overkill... :-) I certainly don't want to start using erc
> > just because rcirc is missing some minor feature !
>
> If all favorite minor features are present, massive overkill is hard
> to avoid...
I don't think that's a given. What's important is that there be
strong guidance to keep the feature-set coherent and easy to use.
-Miles
--
Do not taunt Happy Fun Ball.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-02-16 20:56 ` Miles Bader
2006-02-17 12:56 ` Björn Lindström
@ 2006-02-18 17:36 ` Alex Schroeder
1 sibling, 0 replies; 18+ messages in thread
From: Alex Schroeder @ 2006-02-18 17:36 UTC (permalink / raw)
Miles Bader <miles@gnu.org> writes:
> I obviously use rcirc diffently than you (maybe because I'm using it
> with bitlbee) -- I have a separate buffer for each conversation, so I
> never type anything like "NICK: ..." -- I just type "...". So I never
> use any sort of completion. In this context, I just don't care about
> anything except the appearance, and the simple code I added works
> great.
If you only need nick abbreviations for bitlbee, you can rename nicks
in bitlbee.
--
http://www.emacswiki.org/alex/
^ permalink raw reply [flat|nested] 18+ messages in thread
* rcirc changes
@ 2006-02-15 6:28 Ryan Yeske
0 siblings, 0 replies; 18+ messages in thread
From: Ryan Yeske @ 2006-02-15 6:28 UTC (permalink / raw)
Some more misc bugfixes.
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.9118
diff -c -r1.9118 ChangeLog
*** ChangeLog 12 Feb 2006 00:29:59 -0000 1.9118
--- ChangeLog 15 Feb 2006 06:20:04 -0000
***************
*** 1,3 ****
--- 1,22 ----
+ 2006-02-14 Ryan Yeske <rcyeske@gmail.com>
+
+ * net/rcirc.el (rcirc-connect): Make all arguments optional, and
+ default to global variable values for unsupplied args.
+ (rcirc-get-buffer-create): Fix bug with setting the target.
+ (rcirc-any-buffer): Rename from rcirc-get-any-buffer, and include
+ test for rcirc-always-use-server-buffer-flag here.
+ (rcirc-response-formats): Add %N, which is a facified nick. %n
+ uses the default face. Change the ACTION format string. If the
+ "nick" is the server, don't print anything for that field.
+ Comment fixes.
+ (rcirc-target-buffer): Don't test
+ rcirc-always-use-server-buffer-flag here.
+ (rcirc-print): Squeeze extra spaces out of the text before
+ message.
+ (rcirc-put-nick-channel): Strip potential "@" char from nick
+ before adding them to nick table.
+ (rcirc-url-regexp): Improve to match address like "foo.com".
+
2006-02-12 Mathias Dahl <mathias.dahl@gmail.com>
* tumme.el (tumme-write-tag): Fix small bug (file name did not
Index: net/rcirc.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/rcirc.el,v
retrieving revision 1.14
diff -c -r1.14 rcirc.el
*** net/rcirc.el 11 Feb 2006 21:42:23 -0000 1.14
--- net/rcirc.el 15 Feb 2006 06:20:07 -0000
***************
*** 49,55 ****
(defgroup rcirc nil
"Simple IRC client."
:version "22.1"
! :prefix "rcirc"
:group 'applications)
(defcustom rcirc-server "irc.freenode.net"
--- 49,55 ----
(defgroup rcirc nil
"Simple IRC client."
:version "22.1"
! :prefix "rcirc-"
:group 'applications)
(defcustom rcirc-server "irc.freenode.net"
***************
*** 295,310 ****
(defvar rcirc-topic nil)
(defvar rcirc-keepalive-timer nil)
(defvar rcirc-last-server-message-time nil)
! (defun rcirc-connect (server port nick user-name full-name startup-channels)
(add-hook 'window-configuration-change-hook
'rcirc-window-configuration-change)
(save-excursion
(message "Connecting to %s..." server)
(let* ((inhibit-eol-conversion)
! (port-number (if (stringp port)
! (string-to-number port)
! port))
(process (open-network-stream server nil server port-number)))
;; set up process
(set-process-coding-system process 'raw-text 'raw-text)
--- 295,317 ----
(defvar rcirc-topic nil)
(defvar rcirc-keepalive-timer nil)
(defvar rcirc-last-server-message-time nil)
! (defun rcirc-connect (&optional server port nick user-name full-name startup-channels)
(add-hook 'window-configuration-change-hook
'rcirc-window-configuration-change)
(save-excursion
(message "Connecting to %s..." server)
(let* ((inhibit-eol-conversion)
! (port-number (if port
! (if (stringp port)
! (string-to-number port)
! port)
! rcirc-port))
! (server (or server rcirc-server))
! (nick (or nick rcirc-nick))
! (user-name (or user-name rcirc-user-name))
! (full-name (or full-name rcirc-user-full-name))
! (startup-channels (or startup-channels (rcirc-startup-channels server)))
(process (open-network-stream server nil server port-number)))
;; set up process
(set-process-coding-system process 'raw-text 'raw-text)
***************
*** 758,766 ****
Create the buffer if it doesn't exist."
(let ((buffer (rcirc-get-buffer process target)))
(if buffer
! (progn
(when (not rcirc-target)
! (setq rcirc-target target))
buffer)
;; create the buffer
(with-rcirc-process-buffer process
--- 765,773 ----
Create the buffer if it doesn't exist."
(let ((buffer (rcirc-get-buffer process target)))
(if buffer
! (with-current-buffer buffer
(when (not rcirc-target)
! (setq rcirc-target target))
buffer)
;; create the buffer
(with-rcirc-process-buffer process
***************
*** 896,915 ****
(kill-buffer (current-buffer))
(set-window-configuration rcirc-window-configuration))
! (defun rcirc-get-any-buffer (process)
"Return a buffer for PROCESS, either the one selected or the process buffer."
! (let ((buffer (window-buffer (selected-window))))
! (if (and buffer
! (with-current-buffer buffer
! (and (eq major-mode 'rcirc-mode)
! (eq rcirc-process process))))
! buffer
! (process-buffer process))))
(defcustom rcirc-response-formats
! '(("PRIVMSG" . "%T<%n> %m")
! ("NOTICE" . "%T-%n- %m")
! ("ACTION" . "%T[%n] %m")
("COMMAND" . "%T%m")
("ERROR" . "%T%fw!!! %m")
(t . "%T%fp*** %fs%n %r %m"))
--- 903,924 ----
(kill-buffer (current-buffer))
(set-window-configuration rcirc-window-configuration))
! (defun rcirc-any-buffer (process)
"Return a buffer for PROCESS, either the one selected or the process buffer."
! (if rcirc-always-use-server-buffer-flag
! (process-buffer process)
! (let ((buffer (window-buffer (selected-window))))
! (if (and buffer
! (with-current-buffer buffer
! (and (eq major-mode 'rcirc-mode)
! (eq rcirc-process process))))
! buffer
! (process-buffer process)))))
(defcustom rcirc-response-formats
! '(("PRIVMSG" . "%T<%N> %m")
! ("NOTICE" . "%T-%N- %m")
! ("ACTION" . "%T[%N %m]")
("COMMAND" . "%T%m")
("ERROR" . "%T%fw!!! %m")
(t . "%T%fp*** %fs%n %r %m"))
***************
*** 921,927 ****
the of the following escape sequences replaced by the described values:
%m The message text
! %n The sender's nick (with face `rcirc-my-nick' or `rcirc-other-nick')
%r The response-type
%T The timestamp (with face `rcirc-timestamp')
%t The target
--- 930,937 ----
the of the following escape sequences replaced by the described values:
%m The message text
! %n The sender's nick
! %N The sender's nick (with face `rcirc-my-nick' or `rcirc-other-nick')
%r The response-type
%T The timestamp (with face `rcirc-timestamp')
%t The target
***************
*** 957,1014 ****
(setq chunk (substring chunk 1)))
(setq repl
(cond ((eq key ?%)
! ;; %% -- literal % character ;
"%")
! ((eq key ?n)
! ;; %n -- nick ;
! (rcirc-facify (concat (rcirc-abbrev-nick sender)
! (and target (concat "," target)))
! (if (string= sender (rcirc-nick process))
! 'rcirc-my-nick
! 'rcirc-other-nick)))
((eq key ?T)
! ;; %T -- timestamp ;
(rcirc-facify
(format-time-string rcirc-time-format (current-time))
'rcirc-timestamp))
((eq key ?m)
! ;; %m -- message text ;
;; We add the text property `rcirc-text' to identify this ;
! ;; as the body text. ;
(propertize
(rcirc-mangle-text process (rcirc-facify text face))
'rcirc-text text))
((eq key ?t)
! ;; %t -- target ;
(rcirc-facify (or rcirc-target "") face))
((eq key ?r)
! ;; %r -- response ;
(rcirc-facify response face))
((eq key ?f)
! ;; %f -- change face ;
(setq face-key (aref chunk 0))
(cond ((eq face-key ?w)
! ;; %fw -- warning face ;
(setq face 'font-lock-warning-face))
((eq face-key ?p)
! ;; %fp -- server-prefix face ;
(setq face 'rcirc-server-prefix))
((eq face-key ?s)
! ;; %fs -- warning face ;
(setq face 'rcirc-server))
((eq face-key ?-)
! ;; %fs -- warning face ;
(setq face nil))
((and (eq face-key ?\[)
(string-match "^[[]\\([^]]*\\)[]]" chunk)
(facep (match-string 1 chunk)))
! ;; %f[...] -- named face ;
(setq face (intern (match-string 1 chunk)))
(setq chunk (substring chunk (match-end 1)))))
(setq chunk (substring chunk 1))
"")
(t
! ;; just insert the key literally ;
(rcirc-facify (substring chunk 0 1) face))))
(setq result (concat result repl (rcirc-facify chunk face))))
result))
--- 967,1031 ----
(setq chunk (substring chunk 1)))
(setq repl
(cond ((eq key ?%)
! ;; %% -- literal % character
"%")
! ((or (eq key ?n) (eq key ?N))
! ;; %n/%N -- nick
! (let ((nick (concat (if (string= (with-rcirc-process-buffer
! process rcirc-server)
! sender)
! ""
! (rcirc-abbrev-nick sender))
! (and target (concat "," target)))))
! (rcirc-facify nick
! (if (eq key ?n)
! face
! (if (string= sender (rcirc-nick process))
! 'rcirc-my-nick
! 'rcirc-other-nick)))))
((eq key ?T)
! ;; %T -- timestamp
(rcirc-facify
(format-time-string rcirc-time-format (current-time))
'rcirc-timestamp))
((eq key ?m)
! ;; %m -- message text
;; We add the text property `rcirc-text' to identify this ;
! ;; as the body text.
(propertize
(rcirc-mangle-text process (rcirc-facify text face))
'rcirc-text text))
((eq key ?t)
! ;; %t -- target
(rcirc-facify (or rcirc-target "") face))
((eq key ?r)
! ;; %r -- response
(rcirc-facify response face))
((eq key ?f)
! ;; %f -- change face
(setq face-key (aref chunk 0))
(cond ((eq face-key ?w)
! ;; %fw -- warning face
(setq face 'font-lock-warning-face))
((eq face-key ?p)
! ;; %fp -- server-prefix face
(setq face 'rcirc-server-prefix))
((eq face-key ?s)
! ;; %fs -- server face
(setq face 'rcirc-server))
((eq face-key ?-)
! ;; %f- -- default face
(setq face nil))
((and (eq face-key ?\[)
(string-match "^[[]\\([^]]*\\)[]]" chunk)
(facep (match-string 1 chunk)))
! ;; %f[...] -- named face
(setq face (intern (match-string 1 chunk)))
(setq chunk (substring chunk (match-end 1)))))
(setq chunk (substring chunk 1))
"")
(t
! ;; just insert the key literally
(rcirc-facify (substring chunk 0 1) face))))
(setq result (concat result repl (rcirc-facify chunk face))))
result))
***************
*** 1018,1026 ****
(assert (not (bufferp target)))
(with-rcirc-process-buffer process
(cond ((not target)
! (if rcirc-always-use-server-buffer-flag
! (process-buffer process)
! (rcirc-get-any-buffer process)))
((not (rcirc-channel-p target))
;; message from another user
(if (string= response "PRIVMSG")
--- 1035,1041 ----
(assert (not (bufferp target)))
(with-rcirc-process-buffer process
(cond ((not target)
! (rcirc-any-buffer process))
((not (rcirc-channel-p target))
;; message from another user
(if (string= response "PRIVMSG")
***************
*** 1029,1035 ****
sender))
(rcirc-get-buffer process target t)))
((or (rcirc-get-buffer process target)
! (rcirc-get-any-buffer process))))))
(defvar rcirc-activity-type nil)
(make-variable-buffer-local 'rcirc-activity-type)
--- 1044,1050 ----
sender))
(rcirc-get-buffer process target t)))
((or (rcirc-get-buffer process target)
! (rcirc-any-buffer process))))))
(defvar rcirc-activity-type nil)
(make-variable-buffer-local 'rcirc-activity-type)
***************
*** 1072,1093 ****
(set-marker-insertion-type rcirc-prompt-start-marker nil)
(set-marker-insertion-type rcirc-prompt-end-marker nil)
! ;; fill the text we just inserted, maybe
! (when (and rcirc-fill-flag
! (not (string= response "372"))) ;/motd
! (let ((fill-prefix
! (or rcirc-fill-prefix
! (make-string
! (or (next-single-property-change 0 'rcirc-text
! fmted-text)
! 8)
! ?\s)))
! (fill-column (cond ((eq rcirc-fill-column 'frame-width)
! (1- (frame-width)))
! (rcirc-fill-column
! rcirc-fill-column)
! (t fill-column))))
! (fill-region fill-start rcirc-prompt-start-marker 'left t))))
;; set inserted text to be read-only
(when rcirc-read-only-flag
--- 1087,1112 ----
(set-marker-insertion-type rcirc-prompt-start-marker nil)
(set-marker-insertion-type rcirc-prompt-end-marker nil)
! (let ((text-start (make-marker)))
! (set-marker text-start
! (or (next-single-property-change fill-start
! 'rcirc-text)
! (point-max)))
! ;; squeeze spaces out of text before rcirc-text
! (fill-region fill-start (1- text-start))
!
! ;; fill the text we just inserted, maybe
! (when (and rcirc-fill-flag
! (not (string= response "372"))) ;/motd
! (let ((fill-prefix
! (or rcirc-fill-prefix
! (make-string (- text-start fill-start) ?\s)))
! (fill-column (cond ((eq rcirc-fill-column 'frame-width)
! (1- (frame-width)))
! (rcirc-fill-column
! rcirc-fill-column)
! (t fill-column))))
! (fill-region fill-start rcirc-prompt-start-marker 'left t)))))
;; set inserted text to be read-only
(when rcirc-read-only-flag
***************
*** 1178,1191 ****
(defun rcirc-put-nick-channel (process nick channel)
"Add CHANNEL to list associated with NICK."
! (with-rcirc-process-buffer process
! (let* ((chans (gethash nick rcirc-nick-table))
! (record (assoc-string channel chans t)))
! (if record
! (setcdr record (current-time))
! (puthash nick (cons (cons channel (current-time))
! chans)
! rcirc-nick-table)))))
(defun rcirc-nick-remove (process nick)
"Remove NICK from table."
--- 1197,1211 ----
(defun rcirc-put-nick-channel (process nick channel)
"Add CHANNEL to list associated with NICK."
! (let ((nick (rcirc-user-nick nick)))
! (with-rcirc-process-buffer process
! (let* ((chans (gethash nick rcirc-nick-table))
! (record (assoc-string channel chans t)))
! (if record
! (setcdr record (current-time))
! (puthash nick (cons (cons channel (current-time))
! chans)
! rcirc-nick-table))))))
(defun rcirc-nick-remove (process nick)
"Remove NICK from table."
***************
*** 1616,1630 ****
(propertize (or string "") 'face face 'rear-nonsticky t))
(defvar rcirc-url-regexp
! (rx word-boundary
! (or "www."
! (and (or "http" "https" "ftp" "file" "gopher" "news" "telnet" "wais"
! "mailto")
! "://"
! (1+ (char "a-zA-Z0-9_."))
! (optional ":" (1+ (char "0-9")))))
! (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]"))
! (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]"))
"Regexp matching URLs. Set to nil to disable URL features in rcirc.")
(defun rcirc-browse-url (&optional arg)
--- 1636,1656 ----
(propertize (or string "") 'face face 'rear-nonsticky t))
(defvar rcirc-url-regexp
! (rx-to-string
! `(and word-boundary
! (or "www."
! (and (or "http" "https" "ftp" "file" "gopher" "news" "telnet"
! "wais" "mailto")
! "://"
! (1+ (char "-a-zA-Z0-9_."))
! (optional ":" (1+ (char "0-9"))))
! (and (1+ (char "-a-zA-Z0-9_."))
! (or ".com" ".net" ".org")
! word-boundary))
! (optional
! (and "/"
! (1+ (char "-a-zA-Z0-9_=!?#$\@~`%&*+|\\/:;.,{}[]"))
! (char "-a-zA-Z0-9_=#$\@~`%&*+|\\/:;{}[]")))))
"Regexp matching URLs. Set to nil to disable URL features in rcirc.")
(defun rcirc-browse-url (&optional arg)
^ permalink raw reply [flat|nested] 18+ messages in thread
* rcirc changes
@ 2006-09-12 15:27 Richard Stallman
2006-09-12 16:51 ` Chong Yidong
0 siblings, 1 reply; 18+ messages in thread
From: Richard Stallman @ 2006-09-12 15:27 UTC (permalink / raw)
We're waiting for Ryan Yeske's changes about scrolling to
be installed in rcirc.el. Would someone please install them?
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-09-12 15:27 Richard Stallman
@ 2006-09-12 16:51 ` Chong Yidong
2006-09-12 21:50 ` Ryan Yeske
0 siblings, 1 reply; 18+ messages in thread
From: Chong Yidong @ 2006-09-12 16:51 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> We're waiting for Ryan Yeske's changes about scrolling to
> be installed in rcirc.el. Would someone please install them?
Done. (I updated FOR-RELEASE too).
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-09-12 16:51 ` Chong Yidong
@ 2006-09-12 21:50 ` Ryan Yeske
2006-09-12 22:08 ` Chong Yidong
0 siblings, 1 reply; 18+ messages in thread
From: Ryan Yeske @ 2006-09-12 21:50 UTC (permalink / raw)
Cc: emacs-devel
Chong Yidong <cyd@stupidchicken.com> writes:
> Richard Stallman <rms@gnu.org> writes:
>
>> We're waiting for Ryan Yeske's changes about scrolling to
>> be installed in rcirc.el. Would someone please install them?
>
> Done. (I updated FOR-RELEASE too).
Thanks for installing this. I since found a problem with how the
computation was done, it is not correct when there are continuations
of long-lines.
Here is a fix.
*** rcirc.el 12 Sep 2006 12:04:44 -0700 1.28
--- rcirc.el 12 Sep 2006 14:46:20 -0700
***************
*** 1260,1270 ****
(with-current-buffer (window-buffer w)
(when (eq major-mode 'rcirc-mode)
(with-selected-window w
! (when (<= (- (window-height)
! (- (line-number-at-pos
! (window-point))
! (line-number-at-pos
! (window-start)))
1)
0)
(recenter -1)))))))
--- 1260,1269 ----
(with-current-buffer (window-buffer w)
(when (eq major-mode 'rcirc-mode)
(with-selected-window w
! (when (<= (- (window-height)
! (count-screen-lines
! (window-point)
! (window-start))
1)
0)
(recenter -1)))))))
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: rcirc changes
2006-09-12 21:50 ` Ryan Yeske
@ 2006-09-12 22:08 ` Chong Yidong
0 siblings, 0 replies; 18+ messages in thread
From: Chong Yidong @ 2006-09-12 22:08 UTC (permalink / raw)
Cc: emacs-devel
Ryan Yeske <rcyeske@gmail.com> writes:
> Chong Yidong <cyd@stupidchicken.com> writes:
>
>> Richard Stallman <rms@gnu.org> writes:
>>
>>> We're waiting for Ryan Yeske's changes about scrolling to
>>> be installed in rcirc.el. Would someone please install them?
>>
>> Done. (I updated FOR-RELEASE too).
>
> Thanks for installing this. I since found a problem with how the
> computation was done, it is not correct when there are continuations
> of long-lines.
Thanks. I checked this in too.
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2006-09-12 22:08 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-09 12:07 rcirc changes Miles Bader
2006-02-11 17:54 ` Ryan Yeske
2006-02-12 1:03 ` Miles Bader
2006-02-15 5:58 ` Ryan Yeske
2006-02-16 4:40 ` Richard M. Stallman
2006-02-16 5:07 ` Miles Bader
2006-02-16 16:30 ` Ryan Yeske
2006-02-16 20:56 ` Miles Bader
2006-02-17 12:56 ` Björn Lindström
2006-02-18 6:38 ` Miles Bader
2006-02-18 22:18 ` David Kastrup
2006-02-19 0:44 ` Miles Bader
2006-02-18 17:36 ` Alex Schroeder
-- strict thread matches above, loose matches on Subject: below --
2006-02-15 6:28 Ryan Yeske
2006-09-12 15:27 Richard Stallman
2006-09-12 16:51 ` Chong Yidong
2006-09-12 21:50 ` Ryan Yeske
2006-09-12 22:08 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.