|
From: <boj...@dd...> - 2004-10-17 20:06:43
|
Brian Palmer <bp...@re...> writes:
> Index: erc.el
> ===================================================================
> RCS file: /cvsroot/erc/erc/erc.el,v
> retrieving revision 1.702
> diff -r1.702 erc.el
> 157,160c157,167
> < (defcustom erc-send-whitespace-lines nil
> < "If set to non-nil, send lines consisting of only whitespace."
> < :group 'erc
> < :type 'boolean)
> ---
>> (defcustom erc-send-whitespace-lines 'middle
>> "Set whether erc will send user lines that are completely whitespace.
^
This is a variable, not a function.
>> If t, send all whitespace-only lines; if 'middle, only
^
`middle'
>> send non leading/terminal whitespace-only lines. If nil, skip over
>> every whitespace-only line. Lines that are not sent will be warned
>> about, if erc-warn-about-blank-lines is set. "
^
non-nil
> ---
>> (let ((str input)
>> (rv nil))
>> (setq erc-send-this t)
>> (setq erc-insert-this t)
>> (run-hook-with-args 'erc-send-pre-hook input)
This hook will be run in every case. That is not good. Please try to
preserve the old behavior when possible, in particular when dealing
with when/if hooks are run.
>> (let* ((lines (split-string str "\n"))
>> (interpet-commands (= (length lines) 1)))
typo ^
Also, note that split-string behaves differently in different emacsen.
In pre-cvs Emacs this test interprets input of the form "\n+/foo" as a
command, (split-string "\n/foo" "\n") => ("/foo").
And (split-string "" "\n") => nil, meaning that we won't get a warning
message in this case.
>> (loop for (line next-line) on lines for not-first-line = nil then t
>> if (or (not (string-match "\\`[ \t\r\f\n]*\\'" line))
>> (eq t erc-send-whitespace-lines)
>> (and (eq 'middle erc-send-whitespace-lines) not-first-line (not (null next-line))))
Please keep lines short.
>> do (erc-send-single-line line interpet-commands erc-send-this erc-insert-this)
>> (setq rv t)
>> else
>> if erc-warn-about-blank-lines
>> do (message "Blank line - ignoring...")
>> (beep)
>> finally return rv))))
>>
To summarize: If `erc-send-whitespace-lines' is nil and input consists
only of whitespace erc should beep and complain once (not once per
line), and `erc-send-pre-hook' should not be run (the old behavior).
--
Johan Bockgård
|