commit c4d8c6aaade23a33df93332c3320234392749578 (HEAD, refs/remotes/origin/master) Author: Eli Zaretskii Date: Fri Oct 9 11:12:58 2015 +0300 Avoid inflooping in font-lock * lisp/font-lock.el (font-lock-extend-region-wholelines): Bind inhibit-field-text-motion around the call to line-beginning-position, to avoid inflooping. (Bug#21615) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index e2660bf..21cf3ae 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1166,7 +1166,9 @@ Put first the functions more likely to cause a change and cheaper to compute.") (let ((changed nil)) (goto-char font-lock-beg) (unless (bolp) - (setq changed t font-lock-beg (line-beginning-position))) + (setq changed t font-lock-beg + (let ((inhibit-field-text-motion t)) + (line-beginning-position)))) (goto-char font-lock-end) (unless (bolp) (unless (eq font-lock-end commit 9a30d6b22307aeaac008d5fbbdffd8950e86208a Author: Tassilo Horn Date: Fri Oct 9 09:56:40 2015 +0200 Refactor duplicated code; ensure default is in completions * lisp/textmodes/reftex-cite.el (reftex--query-search-regexps): New function. (reftex-extract-bib-entries): Use it. (reftex-extract-bib-entries-from-thebibliography): Use it. diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el index 8f3f2cc..a35d411 100644 --- a/lisp/textmodes/reftex-cite.el +++ b/lisp/textmodes/reftex-cite.el @@ -177,6 +177,28 @@ If RETURN is non-nil, just return the entry and restore point." (progn (forward-list 1) (point))) (error (min (point-max) (+ 300 (point))))))) +(defun reftex--query-search-regexps (default) + "Query for regexps for searching entries using DEFAULT as default. +Return a list of regular expressions." + (split-string + (completing-read + (concat + "Regex { && Regex...}: " + "[" default "]: ") + ;; Ensure default is always in the completion list. + (let ((def (when default (list default))) + (coll (if reftex-mode + (if (fboundp 'LaTeX-bibitem-list) + (LaTeX-bibitem-list) + (cdr (assoc 'bibview-cache + (symbol-value reftex-docstruct-symbol)))) + nil))) + (if (and def (member def coll)) + coll + (cons def coll))) + nil nil nil 'reftex-cite-regexp-hist) + "[ \t]*&&[ \t]*")) + ;;; Parse bibtex buffers (defun reftex-extract-bib-entries (buffers) "Extract bib entries which match regexps from BUFFERS. @@ -189,20 +211,7 @@ Return list with entries." ;; Read a regexp, completing on known citation keys. (setq default (regexp-quote (reftex-get-bibkey-default))) - (setq re-list - (split-string - (completing-read - (concat - "Regex { && Regex...}: " - "[" default "]: ") - (if reftex-mode - (if (fboundp 'LaTeX-bibitem-list) - (or (LaTeX-bibitem-list) '("")) - (cdr (assoc 'bibview-cache - (symbol-value reftex-docstruct-symbol)))) - nil) - nil nil nil 'reftex-cite-regexp-hist) - "[ \t]*&&[ \t]*")) + (setq re-list (reftex--query-search-regexps default)) (if (or (null re-list ) (equal re-list '(""))) (setq re-list (list default))) @@ -394,20 +403,7 @@ The environment should be located in FILES." ;; Read a regexp, completing on known citation keys. (setq default (regexp-quote (reftex-get-bibkey-default))) - (setq re-list - (split-string - (completing-read - (concat - "Regex { && Regex...}: " - "[" default "]: ") - (if reftex-mode - (if (fboundp 'LaTeX-bibitem-list) - (LaTeX-bibitem-list) - (cdr (assoc 'bibview-cache - (symbol-value reftex-docstruct-symbol)))) - nil) - nil nil nil 'reftex-cite-regexp-hist) - "[ \t]*&&[ \t]*")) + (setq re-list (reftex--query-search-regexps default)) (if (or (null re-list ) (equal re-list '(""))) (setq re-list (list default))) commit 424072f752ad7928b2be560e9d5dbadf82f62228 Author: Vincent Belaïche Date: Fri Oct 9 07:52:15 2015 +0200 Typo in example * autotype.texi (Skeletons as Abbrevs): "if" -> "ifst" in the example. diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi index a147d4b..f7c1fa1 100644 --- a/doc/misc/autotype.texi +++ b/doc/misc/autotype.texi @@ -200,7 +200,7 @@ the output from @kbd{M-x list-abbrevs} to make it look like this: @example (c-mode-abbrev-table) -"if" 0 "" c-if +"ifst" 0 "" c-if @end example @noindent commit 111cebc0c7b86c1ce3507a32e19de5a32a9d2225 Author: Stefan Monnier Date: Thu Oct 8 22:25:38 2015 -0400 * lisp/calc/calc.el: Silence byte-compiler warnings (calc-scan-for-dels): Use ignore-errors. (calc-dispatch, calc-do-dispatch): Make unused arg optional. (calc-read-key-sequence): Remove unused var `prompt2'. (calc-kill-stack-buffer): Remove unused var `buflist'. (calc): Remove unused var `oldbuf'. (calc-refresh): Use inhibit-read-only. (calc-can-abbrev-vectors): Declare. (calc-record): Remove unused var `mainbuf'. (math-sub-bignum): Remove unused var `sum'. (math-svo-c, math-svo-wid, math-svo-off): Declare. diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 0709c61..e44226d 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -1105,20 +1105,18 @@ Used by `calc-user-invocation'.") "The key map for entering Calc digits.") (mapc (lambda (x) - (condition-case err - (progn - (define-key calc-digit-map x 'calcDigit-backspace) - (define-key calc-mode-map x 'calc-pop) - (define-key calc-mode-map - (if (and (vectorp x) (featurep 'xemacs)) - (if (= (length x) 1) - (vector (if (consp (aref x 0)) - (cons 'meta (aref x 0)) - (list 'meta (aref x 0)))) - "\e\C-d") - (vconcat "\e" x)) - 'calc-pop-above)) - (error nil))) + (ignore-errors + (define-key calc-digit-map x 'calcDigit-backspace) + (define-key calc-mode-map x 'calc-pop) + (define-key calc-mode-map + (if (and (vectorp x) (featurep 'xemacs)) + (if (= (length x) 1) + (vector (if (consp (aref x 0)) + (cons 'meta (aref x 0)) + (list 'meta (aref x 0)))) + "\e\C-d") + (vconcat "\e" x)) + 'calc-pop-above))) (if calc-scan-for-dels (append (where-is-internal 'delete-backward-char global-map) (where-is-internal 'backward-delete-char global-map) @@ -1189,25 +1187,24 @@ Used by `calc-user-invocation'.") ;;;###autoload (define-key ctl-x-map "*" 'calc-dispatch) ;;;###autoload -(defun calc-dispatch (&optional arg) +(defun calc-dispatch (&optional _arg) "Invoke the GNU Emacs Calculator. See \\[calc-dispatch-help] for details." - (interactive "P") + (interactive) ; (sit-for echo-keystrokes) - (condition-case err ; look for other keys bound to calc-dispatch - (let ((keys (this-command-keys))) - (unless (or (not (stringp keys)) - (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" keys) - (eq (lookup-key calc-dispatch-map keys) 'calc-same-interface)) - (when (and (string-match "\\`[\C-@-\C-_]" keys) - (symbolp - (lookup-key calc-dispatch-map (substring keys 0 1)))) - (define-key calc-dispatch-map (substring keys 0 1) nil)) - (define-key calc-dispatch-map keys 'calc-same-interface))) - (error nil)) - (calc-do-dispatch arg)) + (ignore-errors ; look for other keys bound to calc-dispatch + (let ((keys (this-command-keys))) + (unless (or (not (stringp keys)) + (string-match "\\`\C-u\\|\\`\e[-0-9#]\\|`[\M--\M-0-\M-9]" keys) + (eq (lookup-key calc-dispatch-map keys) 'calc-same-interface)) + (when (and (string-match "\\`[\C-@-\C-_]" keys) + (symbolp + (lookup-key calc-dispatch-map (substring keys 0 1)))) + (define-key calc-dispatch-map (substring keys 0 1) nil)) + (define-key calc-dispatch-map keys 'calc-same-interface)))) + (calc-do-dispatch)) (defvar calc-dispatch-help nil) -(defun calc-do-dispatch (arg) +(defun calc-do-dispatch (&optional _arg) "Start the Calculator." (let ((key (calc-read-key-sequence (if calc-dispatch-help @@ -1225,8 +1222,7 @@ Used by `calc-user-invocation'.") (defun calc-read-key-sequence (prompt map) "Read keys, with prompt PROMPT and keymap MAP." - (let ((prompt2 (format "%s " (key-description (this-command-keys)))) - (glob (current-global-map)) + (let ((glob (current-global-map)) (loc (current-local-map))) (or (input-pending-p) (message "%s" prompt)) (let ((key (calc-read-key t)) @@ -1254,7 +1250,6 @@ embedded information from the appropriate buffers and tidy up the trail buffer." (let ((cb (current-buffer)) (info-list nil) - (buflist) ; (plural nil) (cea calc-embedded-active)) ;; Get a list of all buffers using this buffer for @@ -1448,42 +1443,41 @@ commands given here will actually operate on the *Calculator* stack." (set-buffer (window-buffer))) (if (derived-mode-p 'calc-mode) (calc-quit) - (let ((oldbuf (current-buffer))) - (calc-create-buffer) - (setq calc-was-keypad-mode nil) - (if (or (eq full-display t) - (and (null full-display) calc-full-mode)) - (switch-to-buffer (current-buffer) t) - (if (get-buffer-window (current-buffer)) - (select-window (get-buffer-window (current-buffer))) - (if calc-window-hook - (run-hooks 'calc-window-hook) - (let ((w (get-largest-window))) - (if (and pop-up-windows - (> (window-height w) - (+ window-min-height calc-window-height 2))) - (progn - (setq w (split-window w - (- (window-height w) - calc-window-height 2) - nil)) - (set-window-buffer w (current-buffer)) - (select-window w)) - (pop-to-buffer (current-buffer))))))) - (with-current-buffer (calc-trail-buffer) - (and calc-display-trail - (= (window-width) (frame-width)) - (calc-trail-display 1 t))) - (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit") - (run-hooks 'calc-start-hook) - (and (windowp full-display) - (window-point full-display) - (select-window full-display)) - (calc-check-defines) - (when (and calc-said-hello interactive) - (sit-for 2) - (message "")) - (setq calc-said-hello t))))) + (calc-create-buffer) + (setq calc-was-keypad-mode nil) + (if (or (eq full-display t) + (and (null full-display) calc-full-mode)) + (switch-to-buffer (current-buffer) t) + (if (get-buffer-window (current-buffer)) + (select-window (get-buffer-window (current-buffer))) + (if calc-window-hook + (run-hooks 'calc-window-hook) + (let ((w (get-largest-window))) + (if (and pop-up-windows + (> (window-height w) + (+ window-min-height calc-window-height 2))) + (progn + (setq w (split-window w + (- (window-height w) + calc-window-height 2) + nil)) + (set-window-buffer w (current-buffer)) + (select-window w)) + (pop-to-buffer (current-buffer))))))) + (with-current-buffer (calc-trail-buffer) + (and calc-display-trail + (= (window-width) (frame-width)) + (calc-trail-display 1 t))) + (message "Welcome to the GNU Emacs Calculator! Press `?' or `h' for help, `q' to quit") + (run-hooks 'calc-start-hook) + (and (windowp full-display) + (window-point full-display) + (select-window full-display)) + (calc-check-defines) + (when (and calc-said-hello interactive) + (sit-for 2) + (message "")) + (setq calc-said-hello t)))) ;;;###autoload (defun full-calc (&optional interactive) @@ -1999,9 +1993,9 @@ See calc-keypad for details." (interactive) (and (derived-mode-p 'calc-mode) (not calc-executing-macro) - (let* ((buffer-read-only nil) + (let* ((inhibit-read-only t) (save-point (point)) - (save-mark (condition-case err (mark) (error nil))) + (save-mark (ignore-errors (mark))) (save-aligned (looking-at "\\.$")) (thing calc-stack) (calc-any-evaltos nil)) @@ -2102,11 +2096,12 @@ the United States." (setq calc-trail-pointer (point-marker)))) calc-trail-buffer) +(defvar calc-can-abbrev-vectors) + (defun calc-record (val &optional prefix) (setq calc-aborted-prefix nil) (or calc-executing-macro - (let* ((mainbuf (current-buffer)) - (buf (calc-trail-buffer)) + (let* ((buf (calc-trail-buffer)) (calc-display-raw nil) (calc-can-abbrev-vectors t) (fval (if val @@ -3052,7 +3047,7 @@ largest Emacs integer.") (defun math-sub-bignum (a b) ; [l l l] (if b (if a - (let* ((a (copy-sequence a)) (aa a) (borrow nil) sum diff) + (let* ((a (copy-sequence a)) (aa a) (borrow nil) diff) (while (and aa b) (if borrow (if (>= (setq diff (- (car aa) (car b))) 1) @@ -3206,7 +3201,8 @@ largest Emacs integer.") aa a) (while (progn (setcar ss (% (setq prod (+ (+ (car ss) (* (car aa) d)) - c)) math-bignum-digit-size)) + c)) + math-bignum-digit-size)) (setq aa (cdr aa))) (setq c (/ prod math-bignum-digit-size) ss (or (cdr ss) (setcdr ss (list 0))))) @@ -3441,6 +3437,10 @@ largest Emacs integer.") ;; to math-stack-value-offset, but are used by math-stack-value-offset-fancy ;; in calccomp.el. +(defvar math-svo-c) +(defvar math-svo-wid) +(defvar math-svo-off) + (defun math-stack-value-offset (math-svo-c) (let* ((num (if calc-line-numbering 4 0)) (math-svo-wid (calc-window-width)) commit b3154551bc501ba46983ce2cc943100cfb803f8c Author: Daiki Ueno Date: Thu Oct 8 12:43:37 2015 +0900 Use g_clear_error instead of g_error_free * src/image.c: Define g_clear_error instead of g_error_free. (init_svg_functions): Resolve symbol g_clear_error instead of g_error_free. (svg_load_image): Use g_clear_error instead of g_error_free, to suppress GLib warnings when ERR is not set. See bug#21641. diff --git a/src/image.c b/src/image.c index 4d1d201..c702782 100644 --- a/src/image.c +++ b/src/image.c @@ -8991,7 +8991,7 @@ DEF_DLL_FN (int, gdk_pixbuf_get_bits_per_sample, (const GdkPixbuf *)); DEF_DLL_FN (void, g_type_init, (void)); # endif DEF_DLL_FN (void, g_object_unref, (gpointer)); -DEF_DLL_FN (void, g_error_free, (GError *)); +DEF_DLL_FN (void, g_clear_error, (GError **)); static bool init_svg_functions (void) @@ -9029,7 +9029,7 @@ init_svg_functions (void) LOAD_DLL_FN (gobject, g_type_init); # endif LOAD_DLL_FN (gobject, g_object_unref); - LOAD_DLL_FN (glib, g_error_free); + LOAD_DLL_FN (glib, g_clear_error); return 1; } @@ -9045,7 +9045,7 @@ init_svg_functions (void) # undef gdk_pixbuf_get_pixels # undef gdk_pixbuf_get_rowstride # undef gdk_pixbuf_get_width -# undef g_error_free +# undef g_clear_error # undef g_object_unref # undef g_type_init # undef rsvg_handle_close @@ -9063,7 +9063,7 @@ init_svg_functions (void) # define gdk_pixbuf_get_pixels fn_gdk_pixbuf_get_pixels # define gdk_pixbuf_get_rowstride fn_gdk_pixbuf_get_rowstride # define gdk_pixbuf_get_width fn_gdk_pixbuf_get_width -# define g_error_free fn_g_error_free +# define g_clear_error fn_g_clear_error # define g_object_unref fn_g_object_unref # define g_type_init fn_g_type_init # define rsvg_handle_close fn_rsvg_handle_close @@ -9318,7 +9318,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * /* FIXME: Use error->message so the user knows what is the actual problem with the image. */ image_error ("Error parsing SVG image `%s'", img->spec); - g_error_free (err); + g_clear_error (&err); return 0; } commit a00634c20988215a47ec6c00cea85a2eac162597 Author: Paul Eggert Date: Thu Oct 8 13:54:04 2015 -0700 * src/image.c (image_size_error): Simplify. diff --git a/src/image.c b/src/image.c index 617cf70..4d1d201 100644 --- a/src/image.c +++ b/src/image.c @@ -647,8 +647,7 @@ image_error (const char *format, ...) static void image_size_error (void) { - AUTO_STRING (max_image_size_name, "max-image-size"); - image_error ("Invalid image size (see `%s')", max_image_size_name); + image_error ("Invalid image size (see `max-image-size')"); } commit 5a3a6aa71f8c875b2d045d02628a0fc54d422295 Author: Paul Eggert Date: Thu Oct 8 13:42:38 2015 -0700 Fix problems caught with --enable-gcc-warnings * src/image.c (lookup_rgb_color): * src/xfns.c (x_defined_color): * src/xterm.c (x_parse_color): Remove unused locals. diff --git a/src/image.c b/src/image.c index 401689e..617cf70 100644 --- a/src/image.c +++ b/src/image.c @@ -4431,8 +4431,6 @@ lookup_rgb_color (struct frame *f, int r, int g, int b) dpyinfo = FRAME_DISPLAY_INFO (f); if (dpyinfo->red_bits > 0) { - unsigned long pr, pg, pb; - /* Apply gamma-correction like normal color allocation does. */ if (f->gamma) { diff --git a/src/xfns.c b/src/xfns.c index 9c5bc2b..f78e541 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -437,7 +437,6 @@ x_defined_color (struct frame *f, const char *color_name, XColor *color, bool alloc_p) { bool success_p = false; - Display *dpy = FRAME_X_DISPLAY (f); Colormap cmap = FRAME_X_COLORMAP (f); block_input (); diff --git a/src/xterm.c b/src/xterm.c index 83ef89c..cd6cdb0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2281,7 +2281,6 @@ Status x_parse_color (struct frame *f, const char *color_name, { Display *dpy = FRAME_X_DISPLAY (f); Colormap cmap = FRAME_X_COLORMAP (f); - Status status; struct color_name_cache_entry *cache_entry; if (color_name[0] == '#') commit 52fecf53e2756ddb765c5bea49edaae507671a1b Author: Jay Belanger Date: Thu Oct 8 08:38:45 2015 -0500 * lisp/calc/calc.el (calc-digit-start-entry): Fix typo. diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index 105e1e4..0709c61 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -2315,7 +2315,7 @@ the United States." ((eq last-command-event ?#) (format "%d#" calc-number-radix)) ((eq last-command-event ?_) "-") ((eq last-command-event ?@) "0@ ") - (t (char-to-string last-command-event))))) + (t (char-to-string last-command-event)))) (defvar calc-buffer) (defvar calc-prev-char) commit 2124b332a21c0baf918731aa23f44cd62177d073 Author: Jay Belanger Date: Thu Oct 8 08:32:00 2015 -0500 Format initial input uniformly. * lisp/calc/calc.el (calc-digit-start-entry): New function. * lisp/calc/calc.el (calcDigit-start): * lisp/calc/calc-aent.el (calc-alg-digit-entry): Use `calc-digit-start-entry' to format input. diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el index 6336c33..f4754c7 100644 --- a/lisp/calc/calc-aent.el +++ b/lisp/calc/calc-aent.el @@ -30,6 +30,7 @@ (require 'calc-macs) ;; Declare functions which are defined elsewhere. +(declare-function calc-digit-start-entry "calc" ()) (declare-function calc-refresh-evaltos "calc-ext" (&optional which-var)) (declare-function calc-execute-kbd-macro "calc-prog" (mac arg &rest prefix)) (declare-function math-is-true "calc-ext" (expr)) @@ -450,12 +451,7 @@ The value t means abort and give an error message.") ;;;###autoload (defun calc-alg-digit-entry () (calc-alg-entry - (cond ((eq last-command-event ?e) - (if (> calc-number-radix 14) (format "%d.^" calc-number-radix) "1e")) - ((eq last-command-event ?#) (format "%d#" calc-number-radix)) - ((eq last-command-event ?_) "-") - ((eq last-command-event ?@) "0@ ") - (t (char-to-string last-command-event))))) + (calc-digit-start-entry))) ;; The variable calc-digit-value is initially declared in calc.el, ;; but can be set by calcDigit-algebraic and calcDigit-edit. diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index de7bfb8..105e1e4 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -2309,6 +2309,14 @@ the United States." ;;;; Reading a number using the minibuffer. +(defun calc-digit-start-entry () + (cond ((eq last-command-event ?e) + (if (> calc-number-radix 14) (format "%d.^" calc-number-radix) "1e")) + ((eq last-command-event ?#) (format "%d#" calc-number-radix)) + ((eq last-command-event ?_) "-") + ((eq last-command-event ?@) "0@ ") + (t (char-to-string last-command-event))))) + (defvar calc-buffer) (defvar calc-prev-char) (defvar calc-prev-prev-char) @@ -2319,7 +2327,6 @@ the United States." (if (or calc-algebraic-mode (and (> calc-number-radix 14) (eq last-command-event ?e))) (calc-alg-digit-entry) - (calc-unread-command) (setq calc-aborted-prefix nil) (let* ((calc-digit-value nil) (calc-prev-char nil) @@ -2337,7 +2344,8 @@ the United States." (unwind-protect (progn (define-key global-map "\e" nil) - (read-from-minibuffer "Calc: " "" calc-digit-map)) + (read-from-minibuffer + "Calc: " (calc-digit-start-entry) calc-digit-map)) (define-key global-map "\e" old-esc)))))) (or calc-digit-value (setq calc-digit-value (math-read-number buf))) (if (stringp calc-digit-value)