diff options
Diffstat (limited to 'lisp/erc')
-rw-r--r-- | lisp/erc/erc-ring.el | 18 | ||||
-rw-r--r-- | lisp/erc/erc.el | 19 |
2 files changed, 20 insertions, 17 deletions
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el index 71a9f8ef3da..028ab1eead8 100644 --- a/lisp/erc/erc-ring.el +++ b/lisp/erc/erc-ring.el @@ -69,10 +69,13 @@ Call this function when setting up the mode." (setq erc-input-ring (make-ring comint-input-ring-size))) (setq erc-input-ring-index nil)) -(defun erc-add-to-input-ring (state) - "Add string S to the input ring and reset history position." +(defun erc-add-to-input-ring (state-or-string) + "Add STATE-OR-STRING to input ring and reset history position. +STATE-OR-STRING should be a string or an erc-input object." (unless erc-input-ring (erc-input-ring-setup)) - (ring-insert erc-input-ring (erc-input-string state)) + (ring-insert erc-input-ring (if (erc-input-p state-or-string) + (erc-input-string state-or-string) + state-or-string)) ; string (setq erc-input-ring-index nil)) (defun erc-clear-input-ring () @@ -101,11 +104,10 @@ containing a password." ;; area, push it on the history ring before moving back through ;; the input history, so it will be there when we return to the ;; front. - (if (null erc-input-ring-index) - (when (> (point-max) erc-input-marker) - (erc-add-to-input-ring (buffer-substring erc-input-marker - (point-max))) - (setq erc-input-ring-index 0))) + (when (and (null erc-input-ring-index) + (> (point-max) erc-input-marker)) + (erc-add-to-input-ring (erc-user-input)) + (setq erc-input-ring-index 0)) (setq erc-input-ring-index (if erc-input-ring-index (ring-plus1 erc-input-ring-index diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index dd7f50fb381..7ee409b7351 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -2136,19 +2136,20 @@ If no buffer matches, return nil." (erc-current-nick-p nick))))) (defcustom erc-before-connect nil - "Hook called before connecting to a server. -This hook gets executed before `erc' actually invokes `erc-mode' -with your input data. The functions in here get called with three -parameters, SERVER, PORT and NICK." + "Functions called before connecting to a server. +The functions in this variable gets executed before `erc' +actually invokes `erc-mode' with your input data. The functions +in here get called with three parameters, SERVER, PORT and NICK." :group 'erc-hooks - :type 'hook) + :type '(repeat function)) (defcustom erc-after-connect nil - "Hook called after connecting to a server. -This hook gets executed when an end of MOTD has been received. All -functions in here get called with the parameters SERVER and NICK." + "Functions called after connecting to a server. +This functions in this variable gets executed when an end of MOTD +has been received. All functions in here get called with the +parameters SERVER and NICK." :group 'erc-hooks - :type 'hook) + :type '(repeat function)) ;;;###autoload (defun erc-select-read-args () |