------------------------------------------------------------ revno: 116959 committer: Daniel Colascione branch nick: trunk timestamp: Wed 2014-04-09 01:16:41 -0700 message: Make cl-indent work better for elisp diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-09 03:37:56 +0000 +++ lisp/ChangeLog 2014-04-09 08:16:41 +0000 @@ -1,3 +1,13 @@ +2014-04-09 Daniel Colascione + + * emacs-lisp/cl-indent.el: Add comment claiming + facility is also good for elisp. + (lisp-indent-find-method): New function. + (common-lisp-indent-function): Recognize cl-loop. + (common-lisp-indent-function-1): Recognize cl constructs; use + `lisp-indent-find-method' instead of `get' directly. + (if): Use else-body style for elisp. + 2014-04-09 Dmitry Gutov * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight more === modified file 'lisp/emacs-lisp/cl-indent.el' --- lisp/emacs-lisp/cl-indent.el 2014-02-10 01:34:22 +0000 +++ lisp/emacs-lisp/cl-indent.el 2014-04-09 08:16:41 +0000 @@ -27,6 +27,8 @@ ;; This package supplies a single entry point, common-lisp-indent-function, ;; which performs indentation in the preferred style for Common Lisp code. +;; It is also a suitable function for indenting Emacs lisp code. +;; ;; To enable it: ;; ;; (setq lisp-indent-function 'common-lisp-indent-function) @@ -154,6 +156,15 @@ (looking-at "\\sw")) (error t))) +(defun lisp-indent-find-method (symbol &optional no-compat) + "Find the lisp indentation function for SYMBOL. +If NO-COMPAT is non-nil, do not retrieve indenters intended for +the standard lisp indent package." + (or (and (derived-mode-p 'emacs-lisp-mode) + (get symbol 'common-lisp-indent-function-for-elisp)) + (get symbol 'common-lisp-indent-function) + (and (not no-compat) + (get symbol 'lisp-indent-function)))) (defun common-lisp-loop-part-indentation (indent-point state) "Compute the indentation of loop form constituents." @@ -245,9 +256,17 @@ * indent the first argument by 4. * arguments after the first should be lists, and there may be any number of them. The first list element has an offset of 2, all the rest - have an offset of 2+1=3." + have an offset of 2+1=3. + +If the current mode is actually `emacs-lisp-mode', look for a +`common-lisp-indent-function-for-elisp' property before looking +at `common-lisp-indent-function' and, if set, use its value +instead." + ;; FIXME: why do we need to special-case loop? (if (save-excursion (goto-char (elt state 1)) - (looking-at "([Ll][Oo][Oo][Pp]")) + (looking-at (if (derived-mode-p 'emacs-lisp-mode) + "(\\(cl-\\)?[Ll][Oo][Oo][Pp]" + "([Ll][Oo][Oo][Pp]"))) (common-lisp-loop-part-indentation indent-point state) (common-lisp-indent-function-1 indent-point state))) @@ -291,18 +310,29 @@ (setq function (downcase (buffer-substring-no-properties tem (point)))) (goto-char tem) + ;; Elisp generally provides CL functionality with a CL + ;; prefix, so if we have a special indenter for the + ;; unprefixed version, prefer it over whatever's defined + ;; for the cl- version. Users can override this + ;; heuristic by defining a + ;; common-lisp-indent-function-for-elisp property on the + ;; cl- version. + (when (and (derived-mode-p 'emacs-lisp-mode) + (not (lisp-indent-find-method + (intern-soft function) t)) + (string-match "^cl-" function) + (setf tem (intern-soft + (substring function (match-end 0)))) + (lisp-indent-find-method tem t)) + (setf function (symbol-name tem))) (setq tem (intern-soft function) - method (get tem 'common-lisp-indent-function)) - (cond ((and (null method) - (string-match ":[^:]+" function)) - ;; The pleblisp package feature - (setq function (substring function - (1+ (match-beginning 0))) - method (get (intern-soft function) - 'common-lisp-indent-function))) - ((and (null method)) - ;; backwards compatibility - (setq method (get tem 'lisp-indent-function))))) + method (lisp-indent-find-method tem)) + ;; The pleblisp package feature + (when (and (null tem) + (string-match ":[^:]+" function)) + (setq function (substring function (1+ (match-beginning 0))) + tem (intern-soft function) + method (lisp-indent-find-method tem)))) (let ((n 0)) ;; How far into the containing form is the current form? (if (< (point) indent-point) @@ -764,7 +794,11 @@ (put (car el) 'common-lisp-indent-function (if (symbolp (cdr el)) (get (cdr el) 'common-lisp-indent-function) - (car (cdr el)))))) + (car (cdr el)))))) + +;; In elisp, the else part of `if' is in an implicit progn, so indent +;; it more. +(put 'if 'common-lisp-indent-function-for-elisp 2) ;(defun foo (x) ------------------------------------------------------------ revno: 116958 [merge] committer: Glenn Morris branch nick: trunk timestamp: Tue 2014-04-08 20:37:56 -0700 message: Merge from emacs-24; up to r116929 diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-09 01:48:07 +0000 +++ lisp/ChangeLog 2014-04-09 03:37:56 +0000 @@ -1,3 +1,13 @@ +2014-04-09 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight more + Module methods. (Bug#17216) + +2014-04-09 Stefan Monnier + + * help.el (describe-bindings): Fix buffer handling (bug#17210). + (describe-bindings-internal): Mark obsolete. + 2014-04-09 Stefan Monnier * subr.el (with-silent-modifications): Don't bind deactivate-mark, === modified file 'lisp/help.el' --- lisp/help.el 2014-04-07 20:54:16 +0000 +++ lisp/help.el 2014-04-09 03:37:56 +0000 @@ -482,8 +482,11 @@ (or buffer (setq buffer (current-buffer))) (help-setup-xref (list #'describe-bindings prefix buffer) (called-interactively-p 'interactive)) - (with-current-buffer buffer - (describe-bindings-internal nil prefix))) + (with-help-window (help-buffer) + ;; Be aware that `describe-buffer-bindings' puts its output into + ;; the current buffer. + (with-current-buffer (help-buffer) + (describe-buffer-bindings buffer prefix)))) ;; This function used to be in keymap.c. (defun describe-bindings-internal (&optional menus prefix) @@ -494,6 +497,7 @@ \(Ordinarily these are omitted from the output.) The optional argument PREFIX, if non-nil, should be a key sequence; then we display only bindings that start with that prefix." + (declare (obsolete describe-buffer-bindings "24.4")) (let ((buf (current-buffer))) (with-help-window (help-buffer) ;; Be aware that `describe-buffer-bindings' puts its output into === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2014-03-27 08:21:15 +0000 +++ lisp/progmodes/ruby-mode.el 2014-04-09 00:14:37 +0000 @@ -2065,6 +2065,10 @@ "include" "module_function" "prepend" + "private_class_method" + "private_constant" + "public_class_method" + "public_constant" "refine" "using") 'symbols)) === modified file 'test/ChangeLog' --- test/ChangeLog 2014-04-07 21:19:31 +0000 +++ test/ChangeLog 2014-04-09 03:37:56 +0000 @@ -1,3 +1,11 @@ +2014-04-09 Glenn Morris + + * automated/python-tests.el (python-triple-quote-pairing): + Enable/disable electric-pair-mode as needed. + + * automated/electric-tests.el (electric-pair-backspace-1): + Replace deleted function. + 2014-04-07 João Távora * automated/python-tests.el (python-triple-quote-pairing): New test. === modified file 'test/automated/electric-tests.el' --- test/automated/electric-tests.el 2014-04-07 20:54:16 +0000 +++ test/automated/electric-tests.el 2014-04-09 03:37:56 +0000 @@ -509,7 +509,7 @@ (with-temp-buffer (insert "()") (goto-char 2) - (electric-pair-backward-delete-char 1) + (electric-pair-delete-pair 1) (should (equal "" (buffer-string)))))) === modified file 'test/automated/python-tests.el' --- test/automated/python-tests.el 2014-04-06 23:23:45 +0000 +++ test/automated/python-tests.el 2014-04-09 01:50:29 +0000 @@ -2722,30 +2722,36 @@ (should (= (point) (point-min))))) (ert-deftest python-triple-quote-pairing () - (python-tests-with-temp-buffer - "\"\"\n" - (goto-char (1- (point-max))) - (let ((last-command-event ?\")) - (call-interactively 'self-insert-command)) - (should (string= (buffer-string) - "\"\"\"\"\"\"\n")) - (should (= (point) 4))) - (python-tests-with-temp-buffer - "\n" - (let ((last-command-event ?\")) - (dotimes (i 3) - (call-interactively 'self-insert-command))) - (should (string= (buffer-string) - "\"\"\"\"\"\"\n")) - (should (= (point) 4))) - (python-tests-with-temp-buffer - "\"\n\"\"\n" - (goto-char (1- (point-max))) - (let ((last-command-event ?\")) - (call-interactively 'self-insert-command)) - (should (= (point) (1- (point-max)))) - (should (string= (buffer-string) - "\"\n\"\"\"\n")))) + (require 'electric) + (let ((epm electric-pair-mode)) + (unwind-protect + (progn + (python-tests-with-temp-buffer + "\"\"\n" + (or epm (electric-pair-mode 1)) + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (string= (buffer-string) + "\"\"\"\"\"\"\n")) + (should (= (point) 4))) + (python-tests-with-temp-buffer + "\n" + (let ((last-command-event ?\")) + (dotimes (i 3) + (call-interactively 'self-insert-command))) + (should (string= (buffer-string) + "\"\"\"\"\"\"\n")) + (should (= (point) 4))) + (python-tests-with-temp-buffer + "\"\n\"\"\n" + (goto-char (1- (point-max))) + (let ((last-command-event ?\")) + (call-interactively 'self-insert-command)) + (should (= (point) (1- (point-max)))) + (should (string= (buffer-string) + "\"\n\"\"\"\n")))) + (or epm (electric-pair-mode -1))))) (provide 'python-tests) ------------------------------------------------------------ revno: 116957 committer: Stefan Monnier branch nick: trunk timestamp: Tue 2014-04-08 21:48:07 -0400 message: * src/insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and region handling (and don't call signal_before_change) if inhibit_modification_hooks is set. (signal_before_change): Don't check inhibit_modification_hooks any more. * lisp/subr.el (with-silent-modifications): Don't bind deactivate-mark, buffer-file-name, and buffer-file-truename any more. diff: === modified file 'etc/NEWS' --- etc/NEWS 2014-04-07 20:54:16 +0000 +++ etc/NEWS 2014-04-09 01:48:07 +0000 @@ -71,6 +71,9 @@ * Incompatible Lisp Changes in Emacs 24.5 +** inhibit-modification-hooks now also inhibits lock-file checks as well as +active region handling. + * Lisp Changes in Emacs 24.5 === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-08 03:32:37 +0000 +++ lisp/ChangeLog 2014-04-09 01:48:07 +0000 @@ -1,3 +1,8 @@ +2014-04-09 Stefan Monnier + + * subr.el (with-silent-modifications): Don't bind deactivate-mark, + buffer-file-name, and buffer-file-truename any more. + 2014-04-08 Leo Liu Use lexical-binding and require cl-lib. === modified file 'lisp/subr.el' --- lisp/subr.el 2014-04-03 00:18:08 +0000 +++ lisp/subr.el 2014-04-09 01:48:07 +0000 @@ -3174,12 +3174,7 @@ `(let* ((,modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) - (inhibit-modification-hooks t) - deactivate-mark - ;; Avoid setting and removing file locks and checking - ;; buffer's uptodate-ness w.r.t the underlying file. - buffer-file-name - buffer-file-truename) + (inhibit-modification-hooks t)) (unwind-protect (progn ,@body) === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-08 12:34:30 +0000 +++ src/ChangeLog 2014-04-09 01:48:07 +0000 @@ -1,3 +1,10 @@ +2014-04-09 Stefan Monnier + + * insdel.c (prepare_to_modify_buffer_1): Cancel lock-file checks and + region handling (and don't call signal_before_change) if + inhibit_modification_hooks is set. + (signal_before_change): Don't check inhibit_modification_hooks any more. + 2014-04-08 Daniel Colascione * alloc.c (sweep_symbols, mark_object): Assert that symbol === modified file 'src/insdel.c' --- src/insdel.c 2014-03-26 15:57:13 +0000 +++ src/insdel.c 2014-04-09 01:48:07 +0000 @@ -1804,6 +1804,9 @@ else base_buffer = current_buffer; + if (inhibit_modification_hooks) + return; + if (!NILP (BVAR (base_buffer, file_truename)) /* Make binding buffer-file-name to nil effective. */ && !NILP (BVAR (base_buffer, filename)) @@ -1813,7 +1816,6 @@ /* If `select-active-regions' is non-nil, save the region text. */ /* FIXME: Move this to Elisp (via before-change-functions). */ if (!NILP (BVAR (current_buffer, mark_active)) - && !inhibit_modification_hooks && XMARKER (BVAR (current_buffer, mark))->buffer && NILP (Vsaved_region_selection) && (EQ (Vselect_active_regions, Qonly) @@ -1924,9 +1926,6 @@ ptrdiff_t count = SPECPDL_INDEX (); struct rvoe_arg rvoe_arg; - if (inhibit_modification_hooks) - return; - start = make_number (start_int); end = make_number (end_int); preserve_marker = Qnil; @@ -1937,7 +1936,7 @@ specbind (Qinhibit_modification_hooks, Qt); /* If buffer is unmodified, run a special hook for that case. The - check for Vfirst_change_hook is just a minor optimization. */ + check for Vfirst_change_hook is just a minor optimization. */ if (SAVE_MODIFF >= MODIFF && !NILP (Vfirst_change_hook)) { ------------------------------------------------------------ revno: 116956 committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-04-08 05:39:40 -0700 message: Correct merge diff: === modified file 'src/alloc.c' --- src/alloc.c 2014-04-08 12:34:30 +0000 +++ src/alloc.c 2014-04-08 12:39:40 +0000 @@ -6895,14 +6895,14 @@ rec = &suspicious_free_history[suspicious_free_history_index++]; if (suspicious_free_history_index == - EARRAYSIZE (suspicious_free_history)) + ARRAYELTS (suspicious_free_history)) { suspicious_free_history_index = 0; } memset (rec, 0, sizeof (*rec)); rec->suspicious_object = ptr; - backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); + backtrace (&rec->backtrace[0], ARRAYELTS (rec->backtrace)); } static void ------------------------------------------------------------ revno: 116955 [merge] committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-04-08 05:34:30 -0700 message: More GC assertions diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-08 12:32:45 +0000 +++ src/ChangeLog 2014-04-08 12:34:30 +0000 @@ -1,5 +1,9 @@ 2014-04-08 Daniel Colascione + * alloc.c (sweep_symbols, mark_object): Assert that symbol + function cells contain valid lisp objects. (Modified version of + patch from Dmitry). + * alloc.c (detect_suspicious_free): Split actual stack capturing out into new function for easier breakpoint setting. (note_suspicious_free): New function. === modified file 'src/alloc.c' --- src/alloc.c 2014-04-08 12:32:45 +0000 +++ src/alloc.c 2014-04-08 12:34:30 +0000 @@ -6220,6 +6220,8 @@ break; CHECK_ALLOCATED_AND_LIVE (live_symbol_p); ptr->gcmarkbit = 1; + /* Attempt to catch bogus objects. */ + eassert (valid_lisp_object_p (ptr->function) >= 1); mark_object (ptr->function); mark_object (ptr->plist); switch (ptr->redirect) @@ -6640,6 +6642,8 @@ { ++num_used; sym->s.gcmarkbit = 0; + /* Attempt to catch bogus objects. */ + eassert (valid_lisp_object_p (sym->s.function) >= 1); } } ------------------------------------------------------------ revno: 116954 [merge] committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-04-08 05:32:45 -0700 message: Rearrange pointer logging diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-07 21:19:31 +0000 +++ src/ChangeLog 2014-04-08 12:32:45 +0000 @@ -1,3 +1,9 @@ +2014-04-08 Daniel Colascione + + * alloc.c (detect_suspicious_free): Split actual stack capturing + out into new function for easier breakpoint setting. + (note_suspicious_free): New function. + 2014-04-07 Stefan Monnier * lisp.h (struct Lisp_Symbol): New bitfield `pinned'. === modified file 'src/alloc.c' --- src/alloc.c 2014-04-07 20:54:16 +0000 +++ src/alloc.c 2014-04-08 12:32:45 +0000 @@ -6885,7 +6885,24 @@ } static void -detect_suspicious_free (void *ptr) +note_suspicious_free (void* ptr) +{ + struct suspicious_free_record* rec; + + rec = &suspicious_free_history[suspicious_free_history_index++]; + if (suspicious_free_history_index == + EARRAYSIZE (suspicious_free_history)) + { + suspicious_free_history_index = 0; + } + + memset (rec, 0, sizeof (*rec)); + rec->suspicious_object = ptr; + backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); +} + +static void +detect_suspicious_free (void* ptr) { int i; @@ -6894,17 +6911,7 @@ for (i = 0; i < ARRAYELTS (suspicious_objects); ++i) if (suspicious_objects[i] == ptr) { - struct suspicious_free_record *rec - = &suspicious_free_history[suspicious_free_history_index++]; - if (suspicious_free_history_index == - ARRAYELTS (suspicious_free_history)) - { - suspicious_free_history_index = 0; - } - - memset (rec, 0, sizeof (*rec)); - rec->suspicious_object = ptr; - backtrace (rec->backtrace, ARRAYELTS (rec->backtrace)); + note_suspicious_free (ptr); suspicious_objects[i] = NULL; } } ------------------------------------------------------------ revno: 116953 committer: Daniel Colascione branch nick: trunk timestamp: Tue 2014-04-08 03:33:48 -0700 message: Tweak completion documentation diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-04-07 21:19:31 +0000 +++ doc/lispref/ChangeLog 2014-04-08 10:33:48 +0000 @@ -1,3 +1,8 @@ +2014-04-08 Daniel Colascione + + * minibuf.texi (Programmed Completion): Improve phrasing, remove + incorrect bullet count. + 2014-04-07 Glenn Morris * os.texi (Recording Input): Dribble files may contain passwords. === modified file 'doc/lispref/minibuf.texi' --- doc/lispref/minibuf.texi 2014-03-31 02:25:02 +0000 +++ doc/lispref/minibuf.texi 2014-04-08 10:33:48 +0000 @@ -1734,7 +1734,7 @@ @item A flag specifying the type of completion operation to perform. This -is one of the following four values: +flag may be one of the following values. @table @code @item nil ------------------------------------------------------------ revno: 116952 committer: Leo Liu branch nick: trunk timestamp: Tue 2014-04-08 11:32:37 +0800 message: Use lexical-binding and require cl-lib * net/rcirc.el (rcirc, rcirc-handler-ctcp-KEEPALIVE) (rcirc-handler-generic, rcirc-fill-paragraph) (rcirc-format-response-string, rcirc-target-buffer) (rcirc-last-line, rcirc-record-activity, rcirc-split-activity) (rcirc-activity-string, rcirc-make-trees, rcirc-cmd-ctcp) (rcirc-ctcp-sender-PING, rcirc-browse-url) (rcirc-markup-timestamp, rcirc-markup-attributes) (rcirc-markup-my-nick, rcirc-markup-urls) (rcirc-markup-bright-nicks, rcirc-markup-fill) (rcirc-check-auth-status, rcirc-handler-WALLOPS) (rcirc-handler-JOIN, rcirc-handler-PART-or-KICK) (rcirc-handler-PART, rcirc-handler-KICK, rcirc-handler-QUIT) (rcirc-handler-NICK, rcirc-handler-PING, rcirc-handler-PONG) (rcirc-handler-TOPIC, rcirc-handler-301, rcirc-handler-317) (rcirc-handler-332, rcirc-handler-333, rcirc-handler-477) (rcirc-handler-MODE, rcirc-handler-353, rcirc-handler-366) (rcirc-authenticate, rcirc-handler-INVITE, rcirc-handler-ERROR) (rcirc-handler-ctcp-VERSION, rcirc-handler-ctcp-TIME) (rcirc-handler-CTCP-response): Fix unused arguments warnings and use cl-lib. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-07 21:19:31 +0000 +++ lisp/ChangeLog 2014-04-08 03:32:37 +0000 @@ -1,3 +1,27 @@ +2014-04-08 Leo Liu + + Use lexical-binding and require cl-lib. + * net/rcirc.el (rcirc, rcirc-handler-ctcp-KEEPALIVE) + (rcirc-handler-generic, rcirc-fill-paragraph) + (rcirc-format-response-string, rcirc-target-buffer) + (rcirc-last-line, rcirc-record-activity, rcirc-split-activity) + (rcirc-activity-string, rcirc-make-trees, rcirc-cmd-ctcp) + (rcirc-ctcp-sender-PING, rcirc-browse-url) + (rcirc-markup-timestamp, rcirc-markup-attributes) + (rcirc-markup-my-nick, rcirc-markup-urls) + (rcirc-markup-bright-nicks, rcirc-markup-fill) + (rcirc-check-auth-status, rcirc-handler-WALLOPS) + (rcirc-handler-JOIN, rcirc-handler-PART-or-KICK) + (rcirc-handler-PART, rcirc-handler-KICK, rcirc-handler-QUIT) + (rcirc-handler-NICK, rcirc-handler-PING, rcirc-handler-PONG) + (rcirc-handler-TOPIC, rcirc-handler-301, rcirc-handler-317) + (rcirc-handler-332, rcirc-handler-333, rcirc-handler-477) + (rcirc-handler-MODE, rcirc-handler-353, rcirc-handler-366) + (rcirc-authenticate, rcirc-handler-INVITE, rcirc-handler-ERROR) + (rcirc-handler-ctcp-VERSION, rcirc-handler-ctcp-TIME) + (rcirc-handler-CTCP-response): Fix unused arguments warnings and + use cl-lib. + 2014-04-07 João Távora * elec-pair.el (electric-pair--syntax-ppss): === modified file 'lisp/net/rcirc.el' --- lisp/net/rcirc.el 2014-01-01 07:43:34 +0000 +++ lisp/net/rcirc.el 2014-04-08 03:32:37 +0000 @@ -1,10 +1,10 @@ -;;; rcirc.el --- default, simple IRC client. +;;; rcirc.el --- default, simple IRC client -*- lexical-binding: t; -*- ;; Copyright (C) 2005-2014 Free Software Foundation, Inc. ;; Author: Ryan Yeske ;; Maintainers: Ryan Yeske , -;; Deniz Dogan +;; Leo Liu ;; Keywords: comm ;; This file is part of GNU Emacs. @@ -43,9 +43,9 @@ ;;; Code: +(require 'cl-lib) (require 'ring) (require 'time-date) -(eval-when-compile (require 'cl)) (defgroup rcirc nil "Simple IRC client." @@ -489,7 +489,7 @@ (when (string= server (process-name p)) (setq connected p))) (if (not connected) - (condition-case e + (condition-case nil (rcirc-connect server port nick user-name full-name channels password encryption) (quit (message "Quit connecting to %s" server))) @@ -629,7 +629,7 @@ (cancel-timer rcirc-keepalive-timer)) (setq rcirc-keepalive-timer nil))) -(defun rcirc-handler-ctcp-KEEPALIVE (process target sender message) +(defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message) (with-rcirc-process-buffer process (setq header-line-format (format "%f" (- (rcirc-float-time) (string-to-number message)))))) @@ -752,7 +752,7 @@ (defvar rcirc-responses-no-activity '("305" "306") "Responses that don't trigger activity in the mode-line indicator.") -(defun rcirc-handler-generic (process response sender args text) +(defun rcirc-handler-generic (process response sender args _text) "Generic server response handler." (rcirc-print process sender response nil (mapconcat 'identity (cdr args) " ") @@ -1222,13 +1222,13 @@ (ring-insert rcirc-input-ring input) (setq rcirc-input-ring-index 0)))))) -(defun rcirc-fill-paragraph (&optional arg) - (interactive "p") +(defun rcirc-fill-paragraph (&optional justify) + (interactive "P") (when (> (point) rcirc-prompt-end-marker) (save-restriction (narrow-to-region rcirc-prompt-end-marker (point-max)) (let ((fill-column rcirc-max-message-length)) - (fill-region (point-min) (point-max)))))) + (fill-region (point-min) (point-max) justify))))) (defun rcirc-process-input-line (line) (if (string-match "^/\\([^ ]+\\) ?\\(.*\\)$" line) @@ -1393,9 +1393,9 @@ (rcirc-add-face start (match-beginning 0) face) (setq start (match-beginning 0)) (replace-match - (case (aref (match-string 1) 0) + (cl-case (aref (match-string 1) 0) (?f (setq face - (case (string-to-char (match-string 3)) + (cl-case (string-to-char (match-string 3)) (?w 'font-lock-warning-face) (?p 'rcirc-server-prefix) (?s 'rcirc-server) @@ -1431,9 +1431,9 @@ (rcirc-add-face start (match-beginning 0) face)) (buffer-substring (point-min) (point-max)))) -(defun rcirc-target-buffer (process sender response target text) +(defun rcirc-target-buffer (process sender response target _text) "Return a buffer to print the server response." - (assert (not (bufferp target))) + (cl-assert (not (bufferp target))) (with-rcirc-process-buffer process (cond ((not target) (rcirc-any-buffer process)) @@ -1474,11 +1474,10 @@ (defun rcirc-last-line (process nick target) "Return the line from the last activity from NICK in TARGET." - (let* ((chanbuf (rcirc-get-buffer process target)) - (line (or (cdr (assoc-string target - (gethash nick (with-rcirc-server-buffer - rcirc-nick-table)) t)) - (rcirc-last-quit-line process nick target)))) + (let ((line (or (cdr (assoc-string target + (gethash nick (with-rcirc-server-buffer + rcirc-nick-table)) t)) + (rcirc-last-quit-line process nick target)))) (if line line ;;(message "line is nil for %s in %s" nick target) @@ -1956,7 +1955,7 @@ (let ((t1 (with-current-buffer b1 rcirc-last-post-time)) (t2 (with-current-buffer b2 rcirc-last-post-time))) (time-less-p t2 t1))))) - (pushnew type rcirc-activity-types) + (cl-pushnew type rcirc-activity-types) (unless (and (equal rcirc-activity old-activity) (member type old-types)) (rcirc-update-activity-string))))) @@ -1977,13 +1976,13 @@ (defun rcirc-split-activity (activity) "Return a cons cell with ACTIVITY split into (lopri . hipri)." (let (lopri hipri) - (dolist (buf rcirc-activity) + (dolist (buf activity) (with-current-buffer buf (if (and rcirc-low-priority-flag (not (member 'nick rcirc-activity-types))) - (add-to-list 'lopri buf t) - (add-to-list 'hipri buf t)))) - (cons lopri hipri))) + (push buf lopri) + (push buf hipri)))) + (cons (nreverse lopri) (nreverse hipri)))) (defvar rcirc-update-activity-string-hook nil "Hook run whenever the activity string is updated.") @@ -2015,7 +2014,7 @@ (with-current-buffer b (dolist (type rcirc-activity-types) (rcirc-add-face 0 (length s) - (case type + (cl-case type (nick 'rcirc-track-nick) (keyword 'rcirc-track-keyword)) s))) @@ -2123,7 +2122,7 @@ (when (and (listp x) (listp (cadr x))) (setcdr x (if (> (length (cdr x)) 1) (rcirc-make-trees (cdr x)) - (setcdr x (list (cdadr x))))))) + (setcdr x (list (cl-cdadr x))))))) alist))) ;;; /commands these are called with 3 args: PROCESS, TARGET, which is @@ -2281,7 +2280,7 @@ (mapconcat 'identity (cdr arglist) " ")))) (rcirc-send-string process (concat "KICK " target " " argstring)))) -(defun rcirc-cmd-ctcp (args &optional process target) +(defun rcirc-cmd-ctcp (args &optional process _target) (if (string-match "^\\([^ ]+\\)\\s-+\\(.+\\)$" args) (let* ((target (match-string 1 args)) (request (upcase (match-string 2 args))) @@ -2292,7 +2291,7 @@ (rcirc-print process (rcirc-nick process) "ERROR" nil "usage: /ctcp NICK REQUEST"))) -(defun rcirc-ctcp-sender-PING (process target request) +(defun rcirc-ctcp-sender-PING (process target _request) "Send a CTCP PING message to TARGET." (let ((timestamp (format "%.0f" (rcirc-float-time)))) (rcirc-send-ctcp process target "PING" timestamp))) @@ -2412,21 +2411,20 @@ (lambda (x) (>= point (cdr x))) rcirc-urls)) (completions (mapcar (lambda (x) (car x)) filtered)) - (initial-input (caar filtered)) - (history (mapcar (lambda (x) (car x)) (cdr filtered)))) - (browse-url (completing-read "rcirc browse-url: " - completions nil nil initial-input 'history) + (defaults (mapcar (lambda (x) (car x)) filtered))) + (browse-url (completing-read "Rcirc browse-url: " + completions nil nil (car defaults) nil defaults) arg))) -(defun rcirc-markup-timestamp (sender response) +(defun rcirc-markup-timestamp (_sender _response) (goto-char (point-min)) (insert (rcirc-facify (format-time-string rcirc-time-format) 'rcirc-timestamp))) -(defun rcirc-markup-attributes (sender response) +(defun rcirc-markup-attributes (_sender _response) (while (re-search-forward "\\([\C-b\C-_\C-v]\\).*?\\(\\1\\|\C-o\\)" nil t) (rcirc-add-face (match-beginning 0) (match-end 0) - (case (char-after (match-beginning 1)) + (cl-case (char-after (match-beginning 1)) (?\C-b 'bold) (?\C-v 'italic) (?\C-_ 'underline))) @@ -2440,7 +2438,7 @@ (while (re-search-forward "\C-o+" nil t) (delete-region (match-beginning 0) (match-end 0)))) -(defun rcirc-markup-my-nick (sender response) +(defun rcirc-markup-my-nick (_sender response) (with-syntax-table rcirc-nick-syntax-table (while (re-search-forward (concat "\\b" (regexp-quote (rcirc-nick @@ -2454,7 +2452,7 @@ 'rcirc-nick-in-message-full-line) (rcirc-record-activity (current-buffer) 'nick))))) -(defun rcirc-markup-urls (sender response) +(defun rcirc-markup-urls (_sender _response) (while (and rcirc-url-regexp ;; nil means disable URL catching (re-search-forward rcirc-url-regexp nil t)) (let* ((start (match-beginning 0)) @@ -2485,7 +2483,7 @@ (rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-keyword) (rcirc-record-activity (current-buffer) 'keyword)))))) -(defun rcirc-markup-bright-nicks (sender response) +(defun rcirc-markup-bright-nicks (_sender response) (when (and rcirc-bright-nicks (string= response "NAMES")) (with-syntax-table rcirc-nick-syntax-table @@ -2493,7 +2491,7 @@ (rcirc-add-face (match-beginning 0) (match-end 0) 'rcirc-bright-nick))))) -(defun rcirc-markup-fill (sender response) +(defun rcirc-markup-fill (_sender response) (when (not (string= response "372")) ; /motd (let ((fill-prefix (or rcirc-fill-prefix @@ -2574,7 +2572,7 @@ sender))) message t)))) -(defun rcirc-check-auth-status (process sender args text) +(defun rcirc-check-auth-status (process sender args _text) "Check if the user just authenticated. If authenticated, runs `rcirc-authenticated-hook' with PROCESS as the only argument." @@ -2602,10 +2600,10 @@ (run-hook-with-args 'rcirc-authenticated-hook process) (remove-hook 'rcirc-authenticated-hook 'rcirc-join-channels-post-auth t)))))) -(defun rcirc-handler-WALLOPS (process sender args text) +(defun rcirc-handler-WALLOPS (process sender args _text) (rcirc-print process sender "WALLOPS" sender (car args) t)) -(defun rcirc-handler-JOIN (process sender args text) +(defun rcirc-handler-JOIN (process sender args _text) (let ((channel (car args))) (with-current-buffer (rcirc-get-buffer-create process channel) ;; when recently rejoining, restore the linestamp @@ -2626,7 +2624,7 @@ (rcirc-print process sender "JOIN" sender channel)))) ;; PART and KICK are handled the same way -(defun rcirc-handler-PART-or-KICK (process response channel sender nick args) +(defun rcirc-handler-PART-or-KICK (process _response channel _sender nick _args) (rcirc-ignore-update-automatic nick) (if (not (string= nick (rcirc-nick process))) ;; this is someone else leaving @@ -2643,7 +2641,7 @@ (when buffer (rcirc-disconnect-buffer buffer))))) -(defun rcirc-handler-PART (process sender args text) +(defun rcirc-handler-PART (process sender args _text) (let* ((channel (car args)) (reason (cadr args)) (message (concat channel " " reason))) @@ -2654,10 +2652,10 @@ (rcirc-handler-PART-or-KICK process "PART" channel sender sender reason))) -(defun rcirc-handler-KICK (process sender args text) +(defun rcirc-handler-KICK (process sender args _text) (let* ((channel (car args)) (nick (cadr args)) - (reason (caddr args)) + (reason (cl-caddr args)) (message (concat nick " " channel " " reason))) (rcirc-print process sender "KICK" channel message t) ;; print in private chat buffer if it exists @@ -2682,7 +2680,7 @@ (cons (cons nick line) rcirc-recent-quit-alist)))))))))) -(defun rcirc-handler-QUIT (process sender args text) +(defun rcirc-handler-QUIT (process sender args _text) (rcirc-ignore-update-automatic sender) (mapc (lambda (channel) ;; broadcast quit message each channel @@ -2692,7 +2690,7 @@ (rcirc-nick-channels process sender)) (rcirc-nick-remove process sender)) -(defun rcirc-handler-NICK (process sender args text) +(defun rcirc-handler-NICK (process sender args _text) (let* ((old-nick sender) (new-nick (car args)) (channels (rcirc-nick-channels process old-nick))) @@ -2723,25 +2721,25 @@ ;; reauthenticate (when rcirc-auto-authenticate-flag (rcirc-authenticate)))))) -(defun rcirc-handler-PING (process sender args text) +(defun rcirc-handler-PING (process _sender args _text) (rcirc-send-string process (concat "PONG :" (car args)))) -(defun rcirc-handler-PONG (process sender args text) +(defun rcirc-handler-PONG (_process _sender _args _text) ;; do nothing ) -(defun rcirc-handler-TOPIC (process sender args text) +(defun rcirc-handler-TOPIC (process sender args _text) (let ((topic (cadr args))) (rcirc-print process sender "TOPIC" (car args) topic) (with-current-buffer (rcirc-get-buffer process (car args)) (setq rcirc-topic topic)))) (defvar rcirc-nick-away-alist nil) -(defun rcirc-handler-301 (process sender args text) +(defun rcirc-handler-301 (process _sender args text) "RPL_AWAY" (let* ((nick (cadr args)) (rec (assoc-string nick rcirc-nick-away-alist)) - (away-message (caddr args))) + (away-message (cl-caddr args))) (when (or (not rec) (not (string= (cdr rec) away-message))) ;; away message has changed @@ -2751,7 +2749,7 @@ (setq rcirc-nick-away-alist (cons (cons nick away-message) rcirc-nick-away-alist)))))) -(defun rcirc-handler-317 (process sender args text) +(defun rcirc-handler-317 (process sender args _text) "RPL_WHOISIDLE" (let* ((nick (nth 1 args)) (idle-secs (string-to-number (nth 2 args))) @@ -2765,31 +2763,31 @@ nick idle-string signon-string))) (rcirc-print process sender "317" nil message t))) -(defun rcirc-handler-332 (process sender args text) +(defun rcirc-handler-332 (process _sender args _text) "RPL_TOPIC" (let ((buffer (or (rcirc-get-buffer process (cadr args)) (rcirc-get-temp-buffer-create process (cadr args))))) (with-current-buffer buffer - (setq rcirc-topic (caddr args))))) + (setq rcirc-topic (cl-caddr args))))) -(defun rcirc-handler-333 (process sender args text) +(defun rcirc-handler-333 (process sender args _text) "333 says who set the topic and when. Not in rfc1459.txt" (let ((buffer (or (rcirc-get-buffer process (cadr args)) (rcirc-get-temp-buffer-create process (cadr args))))) (with-current-buffer buffer - (let ((setter (caddr args)) + (let ((setter (cl-caddr args)) (time (current-time-string (seconds-to-time - (string-to-number (cadddr args)))))) + (string-to-number (cl-cadddr args)))))) (rcirc-print process sender "TOPIC" (cadr args) (format "%s (%s on %s)" rcirc-topic setter time)))))) -(defun rcirc-handler-477 (process sender args text) +(defun rcirc-handler-477 (process sender args _text) "ERR_NOCHANMODES" - (rcirc-print process sender "477" (cadr args) (caddr args))) + (rcirc-print process sender "477" (cadr args) (cl-caddr args))) -(defun rcirc-handler-MODE (process sender args text) +(defun rcirc-handler-MODE (process sender args _text) (let ((target (car args)) (msg (mapconcat 'identity (cdr args) " "))) (rcirc-print process sender "MODE" @@ -2809,7 +2807,7 @@ (let ((tmpnam (concat " " (downcase channel) "TMP" (process-name process)))) (get-buffer-create tmpnam))) -(defun rcirc-handler-353 (process sender args text) +(defun rcirc-handler-353 (process _sender args _text) "RPL_NAMREPLY" (let ((channel (nth 2 args)) (names (or (nth 3 args) ""))) @@ -2822,7 +2820,7 @@ (goto-char (point-max)) (insert (car (last args)) " ")))) -(defun rcirc-handler-366 (process sender args text) +(defun rcirc-handler-366 (process sender args _text) "RPL_ENDOFNAMES" (let* ((channel (cadr args)) (buffer (rcirc-get-temp-buffer-create process channel))) @@ -2847,14 +2845,14 @@ (dolist (i rcirc-authinfo) (let ((process (rcirc-buffer-process)) (server (car i)) - (nick (caddr i)) + (nick (cl-caddr i)) (method (cadr i)) - (args (cdddr i))) + (args (cl-cdddr i))) (when (and (string-match server rcirc-server)) (if (and (memq method '(nickserv chanserv bitlbee)) (string-match nick rcirc-nick)) ;; the following methods rely on the user's nickname. - (case method + (cl-case method (nickserv (rcirc-send-privmsg process @@ -2878,10 +2876,10 @@ "Q@CServe.quakenet.org" (format "AUTH %s %s" nick (car args)))))))))) -(defun rcirc-handler-INVITE (process sender args text) +(defun rcirc-handler-INVITE (process sender args _text) (rcirc-print process sender "INVITE" nil (mapconcat 'identity args " ") t)) -(defun rcirc-handler-ERROR (process sender args text) +(defun rcirc-handler-ERROR (process sender args _text) (rcirc-print process sender "ERROR" nil (mapconcat 'identity args " "))) (defun rcirc-handler-CTCP (process target sender text) @@ -2899,7 +2897,7 @@ (rcirc-print process sender "CTCP" target (format "%s" text) t)))))) -(defun rcirc-handler-ctcp-VERSION (process target sender args) +(defun rcirc-handler-ctcp-VERSION (process _target sender _args) (rcirc-send-string process (concat "NOTICE " sender " :\C-aVERSION " rcirc-id-string @@ -2908,12 +2906,12 @@ (defun rcirc-handler-ctcp-ACTION (process target sender args) (rcirc-print process sender "ACTION" target args t)) -(defun rcirc-handler-ctcp-TIME (process target sender args) +(defun rcirc-handler-ctcp-TIME (process _target sender _args) (rcirc-send-string process (concat "NOTICE " sender " :\C-aTIME " (current-time-string) "\C-a"))) -(defun rcirc-handler-CTCP-response (process target sender message) +(defun rcirc-handler-CTCP-response (process _target sender message) (rcirc-print process sender "CTCP" nil message t)) (defgroup rcirc-faces nil ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.