------------------------------------------------------------ revno: 116941 committer: Leo Liu branch nick: trunk timestamp: Sat 2014-04-05 10:33:36 +0800 message: * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add define-compilation-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-04 23:31:02 +0000 +++ lisp/ChangeLog 2014-04-05 02:33:36 +0000 @@ -1,3 +1,8 @@ +2014-04-05 Leo Liu + + * emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add + define-compilation-mode. + 2014-04-04 João Távora * elec-pair.el: === modified file 'lisp/emacs-lisp/lisp-mode.el' --- lisp/emacs-lisp/lisp-mode.el 2014-03-17 06:22:58 +0000 +++ lisp/emacs-lisp/lisp-mode.el 2014-04-05 02:33:36 +0000 @@ -104,7 +104,8 @@ (regexp-opt '("defun" "defun*" "defsubst" "defmacro" "defadvice" "define-skeleton" - "define-minor-mode" "define-global-minor-mode" + "define-compilation-mode" "define-minor-mode" + "define-global-minor-mode" "define-globalized-minor-mode" "define-derived-mode" "define-generic-mode" "define-compiler-macro" "define-modify-macro" ------------------------------------------------------------ revno: 116940 committer: João Távora branch nick: trunk timestamp: Sat 2014-04-05 00:31:02 +0100 message: Improve on previous quote autopairing change * lisp/elec-pair.el: (electric-pair--syntax-ppss): When inside comments parse from comment beginning. (electric-pair--balance-info): Fix typo in comment. (electric-pair--in-unterminated-string-p): Delete. (electric-pair--unbalanced-strings-p): New function. (electric-pair-string-bound-function): New var. (electric-pair-inhibit-if-helps-balance): Decide quote pairing according to `electric-pair--in-unterminated-string-p' * test/automated/electric-tests.el (define-electric-pair-test): Don't overtest.. (inhibit-in-mismatched-string-inside-ruby-comments): New test. (inhibit-in-mismatched-string-inside-c-comments): New test. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-04 20:16:24 +0000 +++ lisp/ChangeLog 2014-04-04 23:31:02 +0000 @@ -1,3 +1,15 @@ +2014-04-04 João Távora + + * elec-pair.el: + (electric-pair--syntax-ppss): When inside comments parse from + comment beginning. + (electric-pair--balance-info): Fix typo in comment. + (electric-pair--in-unterminated-string-p): Delete. + (electric-pair--unbalanced-strings-p): New function. + (electric-pair-string-bound-function): New var. + (electric-pair-inhibit-if-helps-balance): Decide quote pairing + according to `electric-pair--in-unterminated-string-p' + 2014-04-04 Stefan Monnier * textmodes/reftex-parse.el (reftex--index-tags): Rename `index-tags'. === modified file 'lisp/elec-pair.el' --- lisp/elec-pair.el 2014-04-02 09:59:06 +0000 +++ lisp/elec-pair.el 2014-04-04 23:31:02 +0000 @@ -257,11 +257,19 @@ (let* ((pos (or pos (point))) (where (or where '(string comment))) (quick-ppss (syntax-ppss)) - (quick-ppss-at-pos (syntax-ppss pos))) - (if (or (and (nth 3 quick-ppss) (memq 'string where)) - (and (nth 4 quick-ppss) (memq 'comment where))) + (quick-ppss-at-pos (syntax-ppss pos)) + (in-string (and (nth 3 quick-ppss-at-pos) (memq 'string where))) + (in-comment (and (nth 4 quick-ppss-at-pos) (memq 'comment where))) + (s-or-c-start (cond (in-string + (1+ (nth 8 quick-ppss))) + (in-comment + (goto-char (nth 8 quick-ppss)) + (forward-comment (- (point-max))) + (skip-syntax-forward " >!") + (point))))) + (if s-or-c-start (with-syntax-table electric-pair-text-syntax-table - (parse-partial-sexp (1+ (nth 8 quick-ppss)) pos)) + (parse-partial-sexp s-or-c-start pos)) ;; HACK! cc-mode apparently has some `syntax-ppss' bugs (if (memq major-mode '(c-mode c++ mode)) (parse-partial-sexp (point-min) pos) @@ -351,7 +359,7 @@ (scan-error (cond ((or ;; some error happened and it is not of the "ended - ;; prematurely" kind"... + ;; prematurely" kind... (not (string-match "ends prematurely" (nth 1 err))) ;; ... or we were in a comment and just came out of ;; it. @@ -364,18 +372,29 @@ (funcall ended-prematurely-fn))))))) (cons innermost outermost))) -(defun electric-pair--in-unterminated-string-p (char) - "Return non-nil if inside unterminated string started by CHAR" - (let* ((ppss (syntax-ppss)) - (relevant-ppss (if (nth 4 ppss) ; in comment - (electric-pair--syntax-ppss) - ppss)) +(defvar electric-pair-string-bound-function 'point-max + "Next buffer position where strings are syntatically unexpected. +Value is a function called with no arguments and returning a +buffer position. Major modes should set this variable +buffer-locally if they experience slowness with +`electric-pair-mode' when pairing quotes.") + +(defun electric-pair--unbalanced-strings-p (char) + "Return non-nil if there are unbalanced strings started by CHAR." + (let* ((selector-ppss (syntax-ppss)) + (relevant-ppss (save-excursion + (if (nth 4 selector-ppss) ; comment + (electric-pair--syntax-ppss + (progn + (goto-char (nth 8 selector-ppss)) + (forward-comment (point-max)) + (skip-syntax-backward " >!") + (point))) + (syntax-ppss + (funcall electric-pair-string-bound-function))))) (string-delim (nth 3 relevant-ppss))) - (and (or (eq t string-delim) - (eq char string-delim)) - (condition-case nil (progn (scan-sexps (nth 8 relevant-ppss) 1) - nil) - (scan-error t))))) + (or (eq t string-delim) + (eq char string-delim)))) (defun electric-pair--inside-string-p (char) "Return non-nil if point is inside a string started by CHAR. @@ -408,9 +427,7 @@ (t (eq (cdr outermost) pair))))) ((eq syntax ?\") - (save-excursion - (goto-char (point-max)) - (electric-pair--in-unterminated-string-p char))))) + (electric-pair--unbalanced-strings-p char)))) (insert-char char))))) (defun electric-pair-skip-if-helps-balance (char) === modified file 'test/ChangeLog' --- test/ChangeLog 2014-04-02 09:59:06 +0000 +++ test/ChangeLog 2014-04-04 23:31:02 +0000 @@ -1,3 +1,10 @@ +2014-04-04 João Távora + + * automated/electric-tests.el (define-electric-pair-test): Don't + overtest.. + (inhibit-in-mismatched-string-inside-ruby-comments): New test. + (inhibit-in-mismatched-string-inside-c-comments): New test. + 2014-04-02 João Távora * automated/electric-tests.el (inhibit-if-strings-mismatched): === modified file 'test/automated/electric-tests.el' --- test/automated/electric-tests.el 2014-04-02 09:59:06 +0000 +++ test/automated/electric-tests.el 2014-04-04 23:31:02 +0000 @@ -141,7 +141,7 @@ expected-string expected-point bindings - (modes '(quote (emacs-lisp-mode ruby-mode c++-mode))) + (modes '(quote (ruby-mode c++-mode))) (test-in-comments t) (test-in-strings t) (test-in-code t) @@ -303,6 +303,48 @@ :bindings `((electric-pair-text-syntax-table . ,prog-mode-syntax-table))) +(define-electric-pair-test inhibit-in-mismatched-string-inside-ruby-comments + "foo\"\" +# +# \"bar\" +# \" \" +# \" +# +baz\"\"" + "\"" + :modes '(ruby-mode) + :test-in-strings nil + :test-in-comments nil + :expected-point 19 + :expected-string + "foo\"\" +# +# \"bar\"\" +# \" \" +# \" +# +baz\"\"" + :fixture-fn #'(lambda () (goto-char (point-min)) (search-forward "bar"))) + +(define-electric-pair-test inhibit-in-mismatched-string-inside-c-comments + "foo\"\"/* + \"bar\" + \" \" + \" +*/baz\"\"" + "\"" + :modes '(c-mode) + :test-in-strings nil + :test-in-comments nil + :expected-point 18 + :expected-string + "foo\"\"/* + \"bar\"\" + \" \" + \" +*/baz\"\"" + :fixture-fn #'(lambda () (goto-char (point-min)) (search-forward "bar"))) + ;;; More quotes, but now don't bind `electric-pair-text-syntax-table' ;;; to `prog-mode-syntax-table'. Use the defaults for ------------------------------------------------------------ revno: 116939 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2014-04-04 16:16:24 -0400 message: * lisp/textmodes/reftex-parse.el (reftex--index-tags): Rename `index-tags'. Move declaration before first use. (reftex-move-to-next-arg): Silence compiler warning. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-04 12:10:22 +0000 +++ lisp/ChangeLog 2014-04-04 20:16:24 +0000 @@ -1,7 +1,13 @@ +2014-04-04 Stefan Monnier + + * textmodes/reftex-parse.el (reftex--index-tags): Rename `index-tags'. + Move declaration before first use. + (reftex-move-to-next-arg): Silence compiler warning. + 2014-04-04 Joost Kremers (tiny change) - * textmodes/reftex-toc.el (reftex-toc, reftex-re-enlarge): Use - `window-total-width' instead of `window-width'. + * textmodes/reftex-toc.el (reftex-toc, reftex-re-enlarge): + Use `window-total-width' instead of `window-width'. 2014-04-03 Daniel Colascione @@ -38,8 +44,8 @@ 2014-04-02 João Távora - * elec-pair.el (electric-pair-inhibit-if-helps-balance): Inhibit - quote pairing if point-max is inside an unterminated string. + * elec-pair.el (electric-pair-inhibit-if-helps-balance): + Inhibit quote pairing if point-max is inside an unterminated string. (electric-pair--looking-at-unterminated-string-p): Delete. (electric-pair--in-unterminated-string-p): New function. @@ -51,8 +57,8 @@ 2014-03-31 Leo Liu - * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): Refactor - out eldoc-documentation-function-default. + * emacs-lisp/eldoc.el (eldoc-print-current-symbol-info): + Refactor out eldoc-documentation-function-default. (eldoc-documentation-function-default): New function. (eldoc-documentation-function): Change value. @@ -87,8 +93,8 @@ 2014-03-30 Daniel Colascione - * comint.el (comint-send-input): Deactivate - completion-in-region-mode before we send comint input. + * comint.el (comint-send-input): + Deactivate completion-in-region-mode before we send comint input. (Bug#17139). * simple.el (keyboard-quit): Deactivate completion-in-region-mode === modified file 'lisp/textmodes/reftex-parse.el' --- lisp/textmodes/reftex-parse.el 2014-03-29 00:53:32 +0000 +++ lisp/textmodes/reftex-parse.el 2014-04-04 20:16:24 +0000 @@ -50,6 +50,8 @@ (interactive) (reftex-access-scan-info '(16))) +(defvar reftex--index-tags) + ;;;###autoload (defun reftex-do-parse (rescan &optional file) "Do a document rescan. @@ -75,7 +77,7 @@ (file (or file (buffer-file-name))) (true-file (file-truename file)) (bibview-cache (assq 'bibview-cache old-list)) - (index-tags (cdr (assq 'index-tags old-list))) + (reftex--index-tags (cdr (assq 'index-tags old-list))) from-file appendix docstruct tmp) ;; Make sure replacement is really an option here @@ -95,7 +97,7 @@ (t (error "This should not happen (reftex-do-parse)")))) ;; Reset index-tags if we scan everything - (if (equal rescan 1) (setq index-tags nil)) + (if (equal rescan 1) (setq reftex--index-tags nil)) ;; Find active toc entry and initialize section-numbers (setq reftex-active-toc (reftex-last-assoc-before-elt @@ -140,11 +142,12 @@ (entry (or (assq 'is-multi docstruct) (car (push (list 'is-multi is-multi) docstruct))))) (setcdr entry (cons is-multi nil))) - (and index-tags (setq index-tags (sort index-tags 'string<))) + (and reftex--index-tags + (setq reftex--index-tags (sort reftex--index-tags 'string<))) (let ((index-tag-cell (assq 'index-tags docstruct))) (if index-tag-cell - (setcdr index-tag-cell index-tags) - (push (cons 'index-tags index-tags) docstruct))) + (setcdr index-tag-cell reftex--index-tags) + (push (cons 'index-tags reftex--index-tags) docstruct))) (unless (assq 'xr docstruct) (let* ((allxr (reftex-all-assq 'xr-doc docstruct)) (alist (mapcar @@ -194,8 +197,6 @@ (nreverse file-list))) ;; Bound in the caller, reftex-do-parse. -(defvar index-tags) - (defun reftex-parse-from-file (file docstruct master-dir) "Scan the buffer for labels and save them in a list." (let ((regexp (reftex-everything-regexp)) @@ -305,7 +306,7 @@ (when reftex-support-index (setq index-entry (reftex-index-info file)) (when index-entry - (add-to-list 'index-tags (nth 1 index-entry)) + (add-to-list 'reftex--index-tags (nth 1 index-entry)) (push index-entry docstruct)))) ((match-end 11) @@ -772,7 +773,7 @@ ;; Index entry (and reftex-support-index (setq entry (reftex-index-info-safe buffer-file-name)) - ;; FIXME: (add-to-list 'index-tags (nth 1 index-entry)) + ;; FIXME: (add-to-list 'reftex--index-tags (nth 1 index-entry)) (push entry (cdr tail)))))))))) (error nil)) @@ -942,7 +943,7 @@ specials (car specials)))))) -(defsubst reftex-move-to-next-arg (&optional ignore) +(defsubst reftex-move-to-next-arg (&optional _ignore) "Assuming that we are at the end of a macro name or a macro argument, move forward to the opening parenthesis of the next argument. This function understands the splitting of macros over several lines ------------------------------------------------------------ revno: 116938 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2014-04-04 13:26:23 -0400 message: * lisp/erc/erc.el (erc-invite-only-mode, erc-toggle-channel-mode): Simplify. (erc-load-script): Tighten a regexp. diff: === modified file 'lisp/erc/ChangeLog' --- lisp/erc/ChangeLog 2014-02-25 17:37:25 +0000 +++ lisp/erc/ChangeLog 2014-04-04 17:26:23 +0000 @@ -1,3 +1,8 @@ +2014-04-04 Stefan Monnier + + * erc.el (erc-invite-only-mode, erc-toggle-channel-mode): Simplify. + (erc-load-script): Tighten a regexp. + 2014-02-25 Julien Danjou * erc-networks.el (erc-determine-network): Check that NETWORK as a === modified file 'lisp/erc/erc.el' --- lisp/erc/erc.el 2014-02-10 01:34:22 +0000 +++ lisp/erc/erc.el 2014-04-04 17:26:23 +0000 @@ -5542,12 +5542,11 @@ (interactive "P") (erc-set-active-buffer (current-buffer)) (let ((tgt (erc-default-target))) - (cond ((or (not tgt) (not (erc-channel-p tgt))) - (erc-display-message nil 'error (current-buffer) 'no-target)) - (arg (erc-load-irc-script-lines (list (concat "/mode " tgt " -i")) - t)) - (t (erc-load-irc-script-lines (list (concat "/mode " tgt " +i")) - t))))) + (if (or (not tgt) (not (erc-channel-p tgt))) + (erc-display-message nil 'error (current-buffer) 'no-target) + (erc-load-irc-script-lines + (list (concat "/mode " tgt (if arg " -i" " +i"))) + t)))) (defun erc-get-channel-mode-from-keypress (key) "Read a key sequence and call the corresponding channel mode function. @@ -5579,15 +5578,14 @@ (interactive "P") (erc-set-active-buffer (current-buffer)) (let ((tgt (or channel (erc-default-target)))) - (cond ((or (null tgt) (null (erc-channel-p tgt))) - (erc-display-message nil 'error 'active 'no-target)) - ((member mode erc-channel-modes) - (erc-log (format "%s: Toggle mode %s OFF" tgt mode)) - (message "Toggle channel mode %s OFF" mode) - (erc-server-send (format "MODE %s -%s" tgt mode))) - (t (erc-log (format "%s: Toggle channel mode %s ON" tgt mode)) - (message "Toggle channel mode %s ON" mode) - (erc-server-send (format "MODE %s +%s" tgt mode)))))) + (if (or (null tgt) (null (erc-channel-p tgt))) + (erc-display-message nil 'error 'active 'no-target) + (let* ((active (member mode erc-channel-modes)) + (newstate (if active "OFF" "ON"))) + (erc-log (format "%s: Toggle mode %s %s" tgt mode newstate)) + (message "Toggle channel mode %s %s" mode newstate) + (erc-server-send (format "MODE %s %s%s" + tgt (if active "-" "+") mode)))))) (defun erc-insert-mode-command () "Insert the line \"/mode \" at `point'." @@ -5650,7 +5648,7 @@ script." (erc-log (concat "erc-load-script: " file)) (cond - ((string-match "\\.el$" file) + ((string-match "\\.el\\'" file) (load file)) (t (erc-load-irc-script file)))) ------------------------------------------------------------ revno: 116937 author: Joost Kremers committer: Tassilo Horn branch nick: trunk timestamp: Fri 2014-04-04 14:10:22 +0200 message: Use `window-total-width' instead of `window-width'. * textmodes/reftex-toc.el (reftex-toc, reftex-re-enlarge): Use `window-total-width' instead of `window-width'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-04-03 00:18:08 +0000 +++ lisp/ChangeLog 2014-04-04 12:10:22 +0000 @@ -1,3 +1,8 @@ +2014-04-04 Joost Kremers (tiny change) + + * textmodes/reftex-toc.el (reftex-toc, reftex-re-enlarge): Use + `window-total-width' instead of `window-width'. + 2014-04-03 Daniel Colascione * subr.el (set-transient-map): Remove rms's workaround entirely; === modified file 'lisp/textmodes/reftex-toc.el' --- lisp/textmodes/reftex-toc.el 2014-03-29 00:53:32 +0000 +++ lisp/textmodes/reftex-toc.el 2014-04-04 12:10:22 +0000 @@ -241,13 +241,13 @@ (< (window-height) (* 2 window-min-height))) (delete-other-windows)) - (setq reftex-last-window-width (window-width) + (setq reftex-last-window-width (window-total-width) reftex-last-window-height (window-height)) ; remember (unless unsplittable (if reftex-toc-split-windows-horizontally (split-window-right - (floor (* (window-width) + (floor (* (window-total-width) reftex-toc-split-windows-fraction))) (split-window-below (floor (* (window-height) @@ -374,8 +374,8 @@ (defun reftex-re-enlarge () "Enlarge window to a remembered size." (let ((count (if reftex-toc-split-windows-horizontally - (- (or reftex-last-window-width (window-width)) - (window-width)) + (- (or reftex-last-window-width (window-total-width)) + (window-total-width)) (- (or reftex-last-window-height (window-height)) (window-height))))) (when (> count 0) ------------------------------------------------------------ revno: 116936 committer: Daniel Colascione branch nick: trunk timestamp: Thu 2014-04-03 13:46:04 -0700 message: Rename EARRAYSIZE to ARRAYELTS diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-04-03 07:14:02 +0000 +++ src/ChangeLog 2014-04-03 20:46:04 +0000 @@ -1,7 +1,7 @@ 2014-04-03 Daniel Colascione In all places below, change expressions of the form sizeof(arr) / - sizeof(arr[0]) to EARRAYSIZE(arr). + sizeof(arr[0]) to ARRAYELTS(arr). * xterm.c (x_term_init): See above. @@ -64,7 +64,7 @@ * data.c (Ffset): Abort if we're trying to set a function call to a dead lisp object. - * lisp.h (EARRAYSIZE): New macro. + * lisp.h (ARRAYELTS): New macro. * alloc.c: Include execinfo.h if available. (SUSPICIOUS_OBJECT_CHECKING): New macro; define unconditionally. === modified file 'src/alloc.c' --- src/alloc.c 2014-04-03 00:37:51 +0000 +++ src/alloc.c 2014-04-03 20:46:04 +0000 @@ -6835,7 +6835,7 @@ char* end_a = end; int i; - for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i) { + for (i = 0; i < ARRAYELTS (suspicious_objects); ++i) { char* suspicious_object = suspicious_objects[i]; if (begin_a <= suspicious_object && suspicious_object < end_a) return suspicious_object; @@ -6852,12 +6852,12 @@ eassert (ptr != NULL); - for (i = 0; i < EARRAYSIZE (suspicious_objects); ++i) + for (i = 0; i < ARRAYELTS (suspicious_objects); ++i) if (suspicious_objects[i] == ptr) { 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; } @@ -6865,7 +6865,7 @@ memset (rec, 0, sizeof (*rec)); rec->suspicious_object = ptr; #ifdef HAVE_EXECINFO_H - backtrace (&rec->backtrace[0], EARRAYSIZE (rec->backtrace)); + backtrace (&rec->backtrace[0], ARRAYELTS (rec->backtrace)); #endif suspicious_objects[i] = NULL; } @@ -6884,7 +6884,7 @@ /* Right now, we care only about vectors. */ if (VECTORLIKEP (obj)) { suspicious_objects[suspicious_object_index++] = XVECTOR (obj); - if (suspicious_object_index == EARRAYSIZE (suspicious_objects)) + if (suspicious_object_index == ARRAYELTS (suspicious_objects)) suspicious_object_index = 0; } #endif === modified file 'src/chartab.c' --- src/chartab.c 2014-04-03 07:14:02 +0000 +++ src/chartab.c 2014-04-03 20:46:04 +0000 @@ -1221,7 +1221,7 @@ static uniprop_decoder_t uniprop_decoder [] = { uniprop_decode_value_run_length }; -static const int uniprop_decoder_count = EARRAYSIZE (uniprop_decoder); +static const int uniprop_decoder_count = ARRAYELTS (uniprop_decoder); /* Return the decoder of char-table TABLE or nil if none. */ @@ -1299,7 +1299,7 @@ uniprop_encode_value_run_length, uniprop_encode_value_numeric }; -static const int uniprop_encoder_count = EARRAYSIZE (uniprop_encoder); +static const int uniprop_encoder_count = ARRAYELTS (uniprop_encoder); /* Return the encoder of char-table TABLE or nil if none. */ === modified file 'src/dired.c' --- src/dired.c 2014-04-03 07:14:02 +0000 +++ src/dired.c 2014-04-03 20:46:04 +0000 @@ -984,7 +984,7 @@ values[10] = INTEGER_TO_CONS (s.st_ino); values[11] = INTEGER_TO_CONS (s.st_dev); - return Flist (EARRAYSIZE (values), values); + return Flist (ARRAYELTS (values), values); } DEFUN ("file-attributes-lessp", Ffile_attributes_lessp, Sfile_attributes_lessp, 2, 2, 0, === modified file 'src/dosfns.c' --- src/dosfns.c 2014-04-03 07:14:02 +0000 +++ src/dosfns.c 2014-04-03 20:46:04 +0000 @@ -402,7 +402,7 @@ { int i; - for (i = 0; i < EARRAYSIZE (vga_colors); i++) + for (i = 0; i < ARRAYELTS (vga_colors); i++) if (xstrcasecmp (name, vga_colors[i]) == 0) return i; @@ -422,7 +422,7 @@ return build_string (unspecified_fg); else if (idx == FACE_TTY_DEFAULT_BG_COLOR) return build_string (unspecified_bg); - else if (idx >= 0 && idx < EARRAYSIZE (vga_colors)) + else if (idx >= 0 && idx < ARRAYELTS (vga_colors)) return build_string (vga_colors[idx]); else return Qunspecified; /* meaning the default */ === modified file 'src/emacs.c' --- src/emacs.c 2014-04-03 07:14:02 +0000 +++ src/emacs.c 2014-04-03 20:46:04 +0000 @@ -1817,7 +1817,7 @@ } /* Look for a match with a known old-fashioned option. */ - for (i = 0; i < EARRAYSIZE (standard_args); i++) + for (i = 0; i < ARRAYELTS (standard_args); i++) if (!strcmp (argv[from], standard_args[i].name)) { options[from] = standard_args[i].nargs; @@ -1839,7 +1839,7 @@ match = -1; - for (i = 0; i < EARRAYSIZE (standard_args); i++) + for (i = 0; i < ARRAYELTS (standard_args); i++) if (standard_args[i].longname && !strncmp (argv[from], standard_args[i].longname, thislen)) === modified file 'src/fileio.c' --- src/fileio.c 2014-04-03 07:14:02 +0000 +++ src/fileio.c 2014-04-03 20:46:04 +0000 @@ -2909,7 +2909,7 @@ } #endif - return Flist (EARRAYSIZE (values), values); + return Flist (ARRAYELTS (values), values); } DEFUN ("set-file-selinux-context", Fset_file_selinux_context, === modified file 'src/frame.c' --- src/frame.c 2014-04-03 07:14:02 +0000 +++ src/frame.c 2014-04-03 20:46:04 +0000 @@ -2867,7 +2867,7 @@ param_index = Fget (prop, Qx_frame_parameter); if (NATNUMP (param_index) - && XFASTINT (param_index) < EARRAYSIZE (frame_parms) + && XFASTINT (param_index) < ARRAYELTS (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); } @@ -2915,7 +2915,7 @@ param_index = Fget (prop, Qx_frame_parameter); if (NATNUMP (param_index) - && XFASTINT (param_index) < EARRAYSIZE (frame_parms) + && XFASTINT (param_index) < ARRAYELTS (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)]) (*(FRAME_RIF (f)->frame_parm_handlers[XINT (param_index)])) (f, val, old_value); } @@ -3226,7 +3226,7 @@ { Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter); if (NATNUMP (parm_index) - && XFASTINT (parm_index) < EARRAYSIZE (frame_parms) + && XFASTINT (parm_index) < ARRAYELTS (frame_parms) && FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)]) (*FRAME_RIF (f)->frame_parm_handlers[XFASTINT (parm_index)]) (f, bgcolor, Qnil); @@ -4560,7 +4560,7 @@ { int i; - for (i = 0; i < EARRAYSIZE (frame_parms); i++) + for (i = 0; i < ARRAYELTS (frame_parms); i++) { Lisp_Object v = intern_c_string (frame_parms[i].name); if (frame_parms[i].variable) === modified file 'src/fringe.c' --- src/fringe.c 2014-04-03 07:14:02 +0000 +++ src/fringe.c 2014-04-03 20:46:04 +0000 @@ -474,7 +474,7 @@ #define NO_FRINGE_BITMAP 0 #define UNDEF_FRINGE_BITMAP 1 -#define MAX_STANDARD_FRINGE_BITMAPS EARRAYSIZE (standard_bitmaps) +#define MAX_STANDARD_FRINGE_BITMAPS ARRAYELTS (standard_bitmaps) static struct fringe_bitmap **fringe_bitmaps; static Lisp_Object *fringe_faces; === modified file 'src/image.c' --- src/image.c 2014-04-03 07:14:02 +0000 +++ src/image.c 2014-04-03 20:46:04 +0000 @@ -3955,7 +3955,7 @@ { int i; - for (i = 0; i < EARRAYSIZE (xpm_color_key_strings); i++) + for (i = 0; i < ARRAYELTS (xpm_color_key_strings); i++) if (strcmp (xpm_color_key_strings[i], s) == 0) return i; return -1; === modified file 'src/keyboard.c' --- src/keyboard.c 2014-04-03 07:14:02 +0000 +++ src/keyboard.c 2014-04-03 20:46:04 +0000 @@ -1446,7 +1446,7 @@ Vthis_command_keys_shift_translated = Qnil; /* Read next key sequence; i gets its length. */ - i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), + i = read_key_sequence (keybuf, ARRAYELTS (keybuf), Qnil, 0, 1, 1, 0); /* A filter may have run while we were reading the input. */ @@ -1694,7 +1694,7 @@ menus. */ specbind (Qecho_keystrokes, make_number (0)); - i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), + i = read_key_sequence (keybuf, ARRAYELTS (keybuf), Qnil, 0, 1, 1, 1); unbind_to (count, Qnil); @@ -5484,7 +5484,7 @@ event->modifiers, Qfunction_key, Qnil, lispy_accent_keys, &accent_key_syms, - EARRAYSIZE (lispy_accent_keys)); + ARRAYELTS (lispy_accent_keys)); #if 0 #ifdef XK_kana_A @@ -5493,7 +5493,7 @@ event->modifiers & ~shift_modifier, Qfunction_key, Qnil, lispy_kana_keys, &func_key_syms, - EARRAYSIZE (lispy_kana_keys)); + ARRAYELTS (lispy_kana_keys)); #endif /* XK_kana_A */ #endif /* 0 */ @@ -5504,7 +5504,7 @@ event->modifiers, Qfunction_key, Qnil, iso_lispy_function_keys, &func_key_syms, - EARRAYSIZE (iso_lispy_function_keys)); + ARRAYELTS (iso_lispy_function_keys)); #endif /* Handle system-specific or unknown keysyms. */ @@ -5530,17 +5530,17 @@ event->modifiers, Qfunction_key, Qnil, lispy_function_keys, &func_key_syms, - EARRAYSIZE (lispy_function_keys)); + ARRAYELTS (lispy_function_keys)); #ifdef HAVE_NTGUI case MULTIMEDIA_KEY_EVENT: - if (event->code < EARRAYSIZE (lispy_multimedia_keys) + if (event->code < ARRAYELTS (lispy_multimedia_keys) && event->code > 0 && lispy_multimedia_keys[event->code]) { return modify_event_symbol (event->code, event->modifiers, Qfunction_key, Qnil, lispy_multimedia_keys, &func_key_syms, - EARRAYSIZE (lispy_multimedia_keys)); + ARRAYELTS (lispy_multimedia_keys)); } return Qnil; #endif @@ -6262,7 +6262,7 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "alt", "super", "hyper", "shift", "control", "meta" }; -#define NUM_MOD_NAMES EARRAYSIZE (modifier_names) +#define NUM_MOD_NAMES ARRAYELTS (modifier_names) static Lisp_Object modifier_symbols; @@ -9752,7 +9752,7 @@ memset (keybuf, 0, sizeof keybuf); GCPRO1 (keybuf[0]); - gcpro1.nvars = EARRAYSIZE (keybuf); + gcpro1.nvars = ARRAYELTS (keybuf); if (NILP (continue_echo)) { @@ -9766,7 +9766,7 @@ cancel_hourglass (); #endif - i = read_key_sequence (keybuf, EARRAYSIZE (keybuf), + i = read_key_sequence (keybuf, ARRAYELTS (keybuf), prompt, ! NILP (dont_downcase_last), ! NILP (can_return_switch_frame), 0, 0); @@ -10669,7 +10669,7 @@ } XSETFASTINT (val[3], quit_char); - return Flist (EARRAYSIZE (val), val); + return Flist (ARRAYELTS (val), val); } DEFUN ("posn-at-x-y", Fposn_at_x_y, Sposn_at_x_y, 2, 4, 0, @@ -11037,7 +11037,7 @@ { int i; - int len = EARRAYSIZE (head_table); + int len = ARRAYELTS (head_table); for (i = 0; i < len; i++) { @@ -11053,13 +11053,13 @@ staticpro (&button_down_location); mouse_syms = Fmake_vector (make_number (5), Qnil); staticpro (&mouse_syms); - wheel_syms = Fmake_vector (make_number (EARRAYSIZE (lispy_wheel_names)), + wheel_syms = Fmake_vector (make_number (ARRAYELTS (lispy_wheel_names)), Qnil); staticpro (&wheel_syms); { int i; - int len = EARRAYSIZE (modifier_names); + int len = ARRAYELTS (modifier_names); modifier_symbols = Fmake_vector (make_number (len), Qnil); for (i = 0; i < len; i++) === modified file 'src/lisp.h' --- src/lisp.h 2014-04-03 00:18:08 +0000 +++ src/lisp.h 2014-04-03 20:46:04 +0000 @@ -59,7 +59,7 @@ #define min(a, b) ((a) < (b) ? (a) : (b)) /* Find number of elements in array */ -#define EARRAYSIZE(arr) (sizeof (arr) / sizeof ((arr)[0])) +#define ARRAYELTS(arr) (sizeof (arr) / sizeof ((arr)[0])) /* EMACS_INT - signed integer wide enough to hold an Emacs value EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if === modified file 'src/macfont.m' --- src/macfont.m 2014-04-03 07:14:02 +0000 +++ src/macfont.m 2014-04-03 20:46:04 +0000 @@ -237,7 +237,7 @@ unichar characters[] = {0xfffd}; NSString *string = [NSString stringWithCharacters:characters - length:EARRAYSIZE (characters)]; + length:ARRAYELTS (characters)]; NSGlyphInfo *glyphInfo = [NSGlyphInfo glyphInfoWithCharacterIdentifier:cid collection:collection @@ -825,7 +825,7 @@ {{0, 100}, {1, 200}, {CGFLOAT_MAX, CGFLOAT_MAX}}}}; int i; - for (i = 0; i < EARRAYSIZE (numeric_traits); i++) + for (i = 0; i < ARRAYELTS (numeric_traits); i++) { num = CFDictionaryGetValue (dict, numeric_traits[i].trait); if (num && CFNumberGetValue (num, kCFNumberCGFloatType, &floatval)) @@ -1907,7 +1907,7 @@ if (! traits) goto err; - for (i = 0; i < EARRAYSIZE (numeric_traits); i++) + for (i = 0; i < ARRAYELTS (numeric_traits); i++) { tmp = AREF (spec, numeric_traits[i].index); if (INTEGERP (tmp)) @@ -3583,7 +3583,7 @@ { attributes = CFDictionaryCreate (NULL, (const void **) keys, (const void **) values, - EARRAYSIZE (keys), + ARRAYELTS (keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease (values[1]); @@ -3794,7 +3794,7 @@ CTLineRef ctline = NULL; string = CFStringCreateWithCharacters (NULL, characters, - EARRAYSIZE (characters)); + ARRAYELTS (characters)); if (string) { @@ -3810,7 +3810,7 @@ attributes = CFDictionaryCreate (NULL, (const void **) keys, (const void **) values, - EARRAYSIZE (keys), + ARRAYELTS (keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); CFRelease (glyph_info); === modified file 'src/msdos.c' --- src/msdos.c 2014-04-03 07:14:02 +0000 +++ src/msdos.c 2014-04-03 20:46:04 +0000 @@ -564,7 +564,7 @@ }; int i = 0; - while (i < EARRAYSIZE (std_dimension)) + while (i < ARRAYELTS (std_dimension)) { if (std_dimension[i].need_vga <= have_vga && std_dimension[i].rows >= *rows) @@ -3465,7 +3465,7 @@ static const char * const tempdirs[] = { "$TMPDIR", "$TEMP", "$TMP", "c:/" }; - const int imax = EARRAYSIZE (tempdirs); + const int imax = ARRAYELTS (tempdirs); /* Make sure they have a usable $TMPDIR. Many Emacs functions use temporary files and assume "/tmp" if $TMPDIR is unset, which === modified file 'src/nsfns.m' --- src/nsfns.m 2014-04-03 07:14:02 +0000 +++ src/nsfns.m 2014-04-03 20:46:04 +0000 @@ -1024,7 +1024,7 @@ }; int i; - for (i = 0; i < EARRAYSIZE (r); ++i) + for (i = 0; i < ARRAYELTS (r); ++i) { if (NILP (Fassq (r[i].tem, parms))) { === modified file 'src/nsterm.m' --- src/nsterm.m 2014-04-03 07:14:02 +0000 +++ src/nsterm.m 2014-04-03 20:46:04 +0000 @@ -2012,7 +2012,7 @@ Internal call used by NSView-keyDown. -------------------------------------------------------------------------- */ { - const unsigned last_keysym = EARRAYSIZE (convert_ns_to_X_keysym); + const unsigned last_keysym = ARRAYELTS (convert_ns_to_X_keysym); unsigned keysym; /* An array would be faster, but less easy to read. */ for (keysym = 0; keysym < last_keysym; keysym += 2) === modified file 'src/sysdep.c' --- src/sysdep.c 2014-04-03 07:14:02 +0000 +++ src/sysdep.c 2014-04-03 20:46:04 +0000 @@ -255,7 +255,7 @@ #endif /* not DOS_NT */ } - baud_rate = (emacs_ospeed < EARRAYSIZE (baud_convert) + baud_rate = (emacs_ospeed < ARRAYELTS (baud_convert) ? baud_convert[emacs_ospeed] : 9600); if (baud_rate == 0) baud_rate = 1200; === modified file 'src/term.c' --- src/term.c 2014-04-03 07:14:02 +0000 +++ src/term.c 2014-04-03 20:46:04 +0000 @@ -1339,7 +1339,7 @@ if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil)); - for (i = 0; i < EARRAYSIZE (keys); i++) + for (i = 0; i < ARRAYELTS (keys); i++) { char *sequence = tgetstr (keys[i].cap, address); if (sequence) === modified file 'src/unexcw.c' --- src/unexcw.c 2014-04-03 07:14:02 +0000 +++ src/unexcw.c 2014-04-03 20:46:04 +0000 @@ -81,7 +81,7 @@ #endif assert (exe_header_buffer->file_header.f_nscns > 0); assert (exe_header_buffer->file_header.f_nscns <= - EARRAYSIZE (exe_header_buffer->section_header)); + ARRAYELTS (exe_header_buffer->section_header)); assert (exe_header_buffer->file_header.f_opthdr > 0); ret = === modified file 'src/w32.c' --- src/w32.c 2014-04-03 07:14:02 +0000 +++ src/w32.c 2014-04-03 20:46:04 +0000 @@ -1707,7 +1707,7 @@ /* We maintain 1-sec samples for the last 16 minutes in a circular buffer. */ static struct load_sample samples[16*60]; static int first_idx = -1, last_idx = -1; -static int max_idx = EARRAYSIZE (samples); +static int max_idx = ARRAYELTS (samples); static int buf_next (int from) @@ -2511,7 +2511,7 @@ int i; - const int imax = EARRAYSIZE (tempdirs); + const int imax = ARRAYELTS (tempdirs); /* Implementation note: This function explicitly works with ANSI file names, not with UTF-8 encoded file names. This is because @@ -2584,7 +2584,7 @@ {"LANG", NULL}, }; -#define N_ENV_VARS EARRAYSIZE (dflt_envvars) +#define N_ENV_VARS ARRAYELTS (dflt_envvars) /* We need to copy dflt_envvars[] and work on the copy because we don't want the dumped Emacs to inherit the values of === modified file 'src/w32fns.c' --- src/w32fns.c 2014-04-03 07:14:02 +0000 +++ src/w32fns.c 2014-04-03 20:46:04 +0000 @@ -723,7 +723,7 @@ cmap = Qnil; - for (i = 0; i < EARRAYSIZE (w32_color_map); pc++, i++) + for (i = 0; i < ARRAYELTS (w32_color_map); pc++, i++) cmap = Fcons (Fcons (build_string (pc->name), make_number (pc->colorref)), cmap); === modified file 'src/xfaces.c' --- src/xfaces.c 2014-04-03 07:14:02 +0000 +++ src/xfaces.c 2014-04-03 20:46:04 +0000 @@ -515,7 +515,7 @@ fputc ('\n', stderr); - for (i = n = 0; i < EARRAYSIZE (color_count); ++i) + for (i = n = 0; i < ARRAYELTS (color_count); ++i) if (color_count[i]) { fprintf (stderr, "%3d: %5d", i, color_count[i]); === modified file 'src/xfns.c' --- src/xfns.c 2014-04-03 07:14:02 +0000 +++ src/xfns.c 2014-04-03 20:46:04 +0000 @@ -1944,7 +1944,7 @@ best_xim_style (XIMStyles *xim) { int i, j; - int nr_supported = EARRAYSIZE (supported_xim_styles); + int nr_supported = ARRAYELTS (supported_xim_styles); for (i = 0; i < nr_supported; ++i) for (j = 0; j < xim->count_styles; ++j) === modified file 'src/xterm.c' --- src/xterm.c 2014-04-03 07:14:02 +0000 +++ src/xterm.c 2014-04-03 20:46:04 +0000 @@ -10103,7 +10103,7 @@ }; int i; - const int atom_count = EARRAYSIZE (atom_refs); + const int atom_count = ARRAYELTS (atom_refs); /* 1 for _XSETTINGS_SN */ const int total_atom_count = 1 + atom_count; Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return);