Now on revision 111979. ------------------------------------------------------------ revno: 111979 committer: Stefan Monnier branch nick: trunk timestamp: Fri 2013-03-08 23:15:53 -0500 message: Separate mouse-1-click-follows-link from mouse-drag-region. * lisp/mouse.el (mouse--down-1-maybe-follows-link): New function. (key-translation-map): Use it to implement mouse-1-click-follows-link. (mouse-drag-line, mouse-drag-track): Remove mouse-1-click-follows-link code. (mouse--remap-link-click-p): Remove. * src/keyboard.c (access_keymap_keyremap): Accept nil return value from functions to mean "no change". * src/keyboard.h (EVENT_START, EVENT_END, POSN_WINDOW, POSN_POSN) (POSN_WINDOW_POSN, POSN_TIMESTAMP): Be careful since events may come from Elisp via unread-command-events. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-03-08 08:11:28 +0000 +++ lisp/ChangeLog 2013-03-09 04:15:53 +0000 @@ -1,10 +1,19 @@ +2013-03-09 Stefan Monnier + + Separate mouse-1-click-follows-link from mouse-drag-region. + * mouse.el (mouse--down-1-maybe-follows-link): New function. + (key-translation-map): Use it to implement mouse-1-click-follows-link. + (mouse-drag-line, mouse-drag-track): + Remove mouse-1-click-follows-link code. + (mouse--remap-link-click-p): Remove. + 2013-03-08 Jambunathan K * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. (hi-lock-read-regexp-defaults): New defun. (hi-lock-line-face-buffer, hi-lock-face-buffer) - (hi-lock-face-phrase-buffer): Propagate above change. Update - docstring (bug#13892). + (hi-lock-face-phrase-buffer): Propagate above change. + Update docstring (bug#13892). * subr.el (find-tag-default-as-regexp): New defun. * replace.el (read-regexp): Propagate above change. @@ -45,13 +54,13 @@ 2013-03-07 Dmitry Gutov - * progmodes/js.el (js--multi-line-declaration-indentation): Merge - from js2-mode (https://github.com/mooz/js2-mode/issues/89). + * progmodes/js.el (js--multi-line-declaration-indentation): + Merge from js2-mode (https://github.com/mooz/js2-mode/issues/89). 2013-03-06 Dmitry Gutov - * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only - propertize regexp when not inside a string (Bug#13885). + * progmodes/ruby-mode.el (ruby-syntax-propertize-function): + Only propertize regexp when not inside a string (Bug#13885). 2013-03-06 Alan Mackenzie @@ -62,8 +71,8 @@ 2013-03-05 Michael Albinus - * net/tramp-compat.el (tramp-compat-delete-directory): Implement - TRASH argument. + * net/tramp-compat.el (tramp-compat-delete-directory): + Implement TRASH argument. 2013-03-05 Dmitry Gutov === modified file 'lisp/mouse.el' --- lisp/mouse.el 2013-02-07 01:54:50 +0000 +++ lisp/mouse.el 2013-03-09 04:15:53 +0000 @@ -93,6 +93,49 @@ :version "22.1" :group 'mouse) +(defun mouse--down-1-maybe-follows-link (&optional _prompt) + "Turn `mouse-1' events into `mouse-2' events if follows-link. +Expects to be bound to `down-mouse-1' in `key-translation-map'." + (if (or (null mouse-1-click-follows-link) + (not (eq (if (eq mouse-1-click-follows-link 'double) + 'double-down-mouse-1 'down-mouse-1) + (car-safe last-input-event))) + (not (mouse-on-link-p (event-start last-input-event))) + (and (not mouse-1-click-in-non-selected-windows) + (not (eq (selected-window) + (posn-window (event-start last-input-event)))))) + nil + (let ((this-event last-input-event) + (timedout + (sit-for (if (numberp mouse-1-click-follows-link) + (/ (abs mouse-1-click-follows-link) 1000.0) + 0)))) + (if (if (and (numberp mouse-1-click-follows-link) + (>= mouse-1-click-follows-link 0)) + timedout (not timedout)) + nil + + (let ((event (read-event))) + (if (eq (car-safe event) (if (eq mouse-1-click-follows-link 'double) + 'double-mouse-1 'mouse-1)) + ;; Turn the mouse-1 into a mouse-2 to follow links. + (let ((newup (if (eq mouse-1-click-follows-link 'double) + 'double-mouse-2 'mouse-2)) + (newdown (if (eq mouse-1-click-follows-link 'double) + 'double-down-mouse-2 'down-mouse-2))) + ;; If mouse-2 has never been done by the user, it doesn't have + ;; the necessary property to be interpreted correctly. + (put newup 'event-kind (get (car event) 'event-kind)) + (put newdown 'event-kind (get (car this-event) 'event-kind)) + (push (cons newup (cdr event)) unread-command-events) + (vector (cons newdown (cdr this-event)))) + (push event unread-command-events) + nil)))))) + +(define-key key-translation-map [down-mouse-1] + #'mouse--down-1-maybe-follows-link) +(define-key key-translation-map [double-down-mouse-1] + #'mouse--down-1-maybe-follows-link) ;; Provide a mode-specific menu on a mouse button. @@ -418,8 +461,6 @@ (window (posn-window start)) (frame (window-frame window)) (minibuffer-window (minibuffer-window frame)) - (on-link (and mouse-1-click-follows-link - (mouse-on-link-p start))) (side (and (eq line 'vertical) (or (cdr (assq 'vertical-scroll-bars (frame-parameters frame))) @@ -507,12 +548,6 @@ (- growth))))))) ;; Process the terminating event. (unless dragged - (when (and (mouse-event-p event) on-link - (mouse--remap-link-click-p start-event event)) - ;; If mouse-2 has never been done by the user, it doesn't have - ;; the necessary property to be interpreted correctly. - (put 'mouse-2 'event-kind 'mouse-click) - (setcar event 'mouse-2)) (push event unread-command-events)))) (defun mouse-drag-mode-line (start-event) @@ -770,7 +805,6 @@ (setq mouse-selection-click-count-buffer (current-buffer)) (deactivate-mark) (let* ((scroll-margin 0) ; Avoid margin scrolling (Bug#9541). - (original-window (selected-window)) ;; We've recorded what we needed from the current buffer and ;; window, now let's jump to the place of the event, where things ;; are happening. @@ -788,15 +822,7 @@ (nth 3 bounds) ;; Don't count the mode line. (1- (nth 3 bounds)))) - (on-link (and mouse-1-click-follows-link - ;; Use start-point before the intangibility - ;; treatment, in case we click on a link inside - ;; intangible text. - (mouse-on-link-p start-posn))) (click-count (1- (event-click-count start-event))) - (remap-double-click (and on-link - (eq mouse-1-click-follows-link 'double) - (= click-count 1))) ;; Suppress automatic hscrolling, because that is a nuisance ;; when setting point near the right fringe (but see below). (auto-hscroll-mode-saved auto-hscroll-mode) @@ -809,8 +835,6 @@ (if (< (point) start-point) (goto-char start-point)) (setq start-point (point)) - (if remap-double-click - (setq click-count 0)) ;; Activate the region, using `mouse-start-end' to determine where ;; to put point and mark (e.g., double-click will select a word). @@ -826,6 +850,7 @@ (track-mouse (while (progn (setq event (read-event)) + (trace-values event) (or (mouse-movement-p event) (memq (car-safe event) '(switch-frame select-window)))) (unless (memq (car-safe event) '(switch-frame select-window)) @@ -900,21 +925,6 @@ (or end-point (= (window-start start-window) start-window-start))) - (when (and on-link - (= start-point (point)) - (mouse--remap-link-click-p start-event event)) - ;; If we rebind to mouse-2, reselect previous selected - ;; window, so that the mouse-2 event runs in the same - ;; situation as if user had clicked it directly. Fixes - ;; the bug reported by juri@jurta.org on 2005-12-27. - (if (or (vectorp on-link) (stringp on-link)) - (setq event (aref on-link 0)) - (select-window original-window) - (setcar event 'mouse-2) - ;; If this mouse click has never been done by the - ;; user, it doesn't have the necessary property to be - ;; interpreted correctly. - (put 'mouse-2 'event-kind 'mouse-click))) (push event unread-command-events))))))) (defun mouse--drag-set-mark-and-point (start click click-count) @@ -932,22 +942,6 @@ (set-mark beg) (goto-char end))))) -(defun mouse--remap-link-click-p (start-event end-event) - (or (and (eq mouse-1-click-follows-link 'double) - (= (event-click-count start-event) 2)) - (and - (not (eq mouse-1-click-follows-link 'double)) - (= (event-click-count start-event) 1) - (= (event-click-count end-event) 1) - (or (not (integerp mouse-1-click-follows-link)) - (let ((t0 (posn-timestamp (event-start start-event))) - (t1 (posn-timestamp (event-end end-event)))) - (and (integerp t0) (integerp t1) - (if (> mouse-1-click-follows-link 0) - (<= (- t1 t0) mouse-1-click-follows-link) - (< (- t0 t1) mouse-1-click-follows-link)))))))) - - ;; Commands to handle xterm-style multiple clicks. (defun mouse-skip-word (dir) "Skip over word, over whitespace, or over identical punctuation. === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-08 21:37:41 +0000 +++ src/ChangeLog 2013-03-09 04:15:53 +0000 @@ -1,3 +1,12 @@ +2013-03-09 Stefan Monnier + + * keyboard.h (EVENT_START, EVENT_END, POSN_WINDOW, POSN_POSN) + (POSN_WINDOW_POSN, POSN_TIMESTAMP): Be careful since events may come + from Elisp via unread-command-events. + + * keyboard.c (access_keymap_keyremap): Accept nil return value from + functions to mean "no change". + 2013-03-08 Paul Eggert region-cache.c, scroll.c, search.c: Use bool for booleans. @@ -19,8 +28,8 @@ * lisp.h (find_newline, find_newline_no_quit): Adjust prototype. * bidi.c (bidi_find_paragraph_start): Pass byte position to find_newline_no_quit, thus eliminating CHAR_TO_BYTE. - * editfns.c (Fconstrain_to_field): Break long line. Adjust - call to find_newline. + * editfns.c (Fconstrain_to_field): Break long line. + Adjust call to find_newline. * indent.c (vmotion): Adjust calls to find_newline_no_quit. Use DEC_BOTH to start next search from the previous buffer position, where appropriate. @@ -270,8 +279,8 @@ 2013-03-02 Eli Zaretskii - * textprop.c (Fadd_text_properties, Fremove_text_properties): If - the interval tree changes as a side effect of calling + * textprop.c (Fadd_text_properties, Fremove_text_properties): + If the interval tree changes as a side effect of calling modify_region, re-do processing starting from the call to validate_interval_range. (Bug#13743) @@ -347,8 +356,8 @@ * textprop.c (Fadd_text_properties, Fremove_text_properties) (Fremove_list_of_text_properties): Skip all of the intervals in the region between START and END that already have resp. don't - have the requested properties, not just the first one. Add - assertions that the loop afterwards always modifies the + have the requested properties, not just the first one. + Add assertions that the loop afterwards always modifies the properties. (Bug#13743) 2013-02-25 Stefan Monnier === modified file 'src/keyboard.c' --- src/keyboard.c 2013-03-07 03:01:17 +0000 +++ src/keyboard.c 2013-03-09 04:15:53 +0000 @@ -8699,7 +8699,7 @@ barf--don't ignore it. (To ignore it safely, we would need to gcpro a bunch of other variables.) */ - if (! (VECTORP (next) || STRINGP (next))) + if (! (NILP (next) || VECTORP (next) || STRINGP (next))) error ("Function %s returns invalid key sequence", SSDATA (SYMBOL_NAME (tem))); } === modified file 'src/keyboard.h' --- src/keyboard.h 2013-02-11 19:21:23 +0000 +++ src/keyboard.h 2013-03-09 04:15:53 +0000 @@ -421,18 +421,18 @@ (EVENT_HAS_PARAMETERS (event) ? XCAR (event) : (event)) /* Extract the starting and ending positions from a composite event. */ -#define EVENT_START(event) (XCAR (XCDR (event))) -#define EVENT_END(event) (XCAR (XCDR (XCDR (event)))) +#define EVENT_START(event) (CAR_SAFE (CDR_SAFE (event))) +#define EVENT_END(event) (CAR_SAFE (CDR_SAFE (CDR_SAFE (event)))) /* Extract the click count from a multi-click event. */ #define EVENT_CLICK_COUNT(event) (Fnth (make_number (2), (event))) /* Extract the fields of a position. */ -#define POSN_WINDOW(posn) (XCAR (posn)) -#define POSN_POSN(posn) (XCAR (XCDR (posn))) +#define POSN_WINDOW(posn) (CAR_SAFE (posn)) +#define POSN_POSN(posn) (CAR_SAFE (CDR_SAFE (posn))) #define POSN_SET_POSN(posn,x) (XSETCAR (XCDR (posn), (x))) -#define POSN_WINDOW_POSN(posn) (XCAR (XCDR (XCDR (posn)))) -#define POSN_TIMESTAMP(posn) (XCAR (XCDR (XCDR (XCDR (posn))))) +#define POSN_WINDOW_POSN(posn) (CAR_SAFE (CDR_SAFE (CDR_SAFE (posn)))) +#define POSN_TIMESTAMP(posn) (CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (posn))))) #define POSN_SCROLLBAR_PART(posn) (Fnth (make_number (4), (posn))) /* A cons (STRING . STRING-CHARPOS), or nil in mouse-click events. ------------------------------------------------------------ revno: 111978 committer: Jay Belanger branch nick: trunk timestamp: Fri 2013-03-08 20:27:46 -0600 message: * refcards/calccard.tex: Remove incorrect entry. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2013-03-05 22:35:41 +0000 +++ etc/ChangeLog 2013-03-09 02:27:46 +0000 @@ -1,3 +1,7 @@ +2013-03-09 Jay Belanger + + * refcards/calccard.tex: Remove incorrect entry. + 2013-03-05 Paul Eggert FILE's lock is now always .#FILE and may be a regular file (Bug#13807). === modified file 'etc/refcards/calccard.tex' --- etc/refcards/calccard.tex 2013-01-01 09:11:05 +0000 +++ etc/refcards/calccard.tex 2013-03-09 02:27:46 +0000 @@ -554,7 +554,6 @@ \key{symbolic (vs.\ numeric) mode}{m s} \key{fractions (vs.\ float) mode}{m f} \key{suppress evaluation of formulas}{m O} -\key{simplify formulas automatically}{m S} \key{return to default evaluation rules}{m D} \key{``Big'' display mode}{d B} ------------------------------------------------------------ revno: 111977 committer: Paul Eggert branch nick: trunk timestamp: Fri 2013-03-08 13:37:41 -0800 message: region-cache.c, scroll.c, search.c: Use bool for booleans. * lisp.h (compile_pattern): * scroll.c (do_scrolling, do_direct_scrolling): * search.c (struct regexp_cache, compile_pattern_1) (compile_pattern, string_match_1, search_command) (trivial_regexp_p, search_buffer, Freplace_match, match_limit) (search_regs_saved, Fregexp_quote): Use bool for boolean. * region-cache.c (region_cache_forward, region_cache_backward): Fix comments to match code: these functions return int, not boolean. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-08 09:34:35 +0000 +++ src/ChangeLog 2013-03-08 21:37:41 +0000 @@ -1,3 +1,16 @@ +2013-03-08 Paul Eggert + + region-cache.c, scroll.c, search.c: Use bool for booleans. + * lisp.h (compile_pattern): + * scroll.c (do_scrolling, do_direct_scrolling): + * search.c (struct regexp_cache, compile_pattern_1) + (compile_pattern, string_match_1, search_command) + (trivial_regexp_p, search_buffer, Freplace_match, match_limit) + (search_regs_saved, Fregexp_quote): + Use bool for boolean. + * region-cache.c (region_cache_forward, region_cache_backward): + Fix comments to match code: these functions return int, not boolean. + 2013-03-08 Dmitry Antipov * search.c (find_newline): Accept start and end byte positions === modified file 'src/lisp.h' --- src/lisp.h 2013-03-08 09:34:35 +0000 +++ src/lisp.h 2013-03-08 21:37:41 +0000 @@ -3357,7 +3357,7 @@ struct re_registers; extern struct re_pattern_buffer *compile_pattern (Lisp_Object, struct re_registers *, - Lisp_Object, int, bool); + Lisp_Object, bool, bool); extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object); extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *, ptrdiff_t); === modified file 'src/region-cache.c' --- src/region-cache.c 2013-01-01 09:11:05 +0000 +++ src/region-cache.c 2013-03-08 21:37:41 +0000 @@ -695,8 +695,9 @@ /* Interface: using the cache. */ -/* Return true if the text immediately after POS in BUF is known, for - the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest +/* Return the value for the text immediately after POS in BUF if the value + is known, for the purposes of CACHE, and return zero otherwise. + If NEXT is non-zero, set *NEXT to the nearest position after POS where the knowledge changes. */ int region_cache_forward (struct buffer *buf, struct region_cache *c, @@ -732,8 +733,9 @@ } } -/* Return true if the text immediately before POS in BUF is known, for - the purposes of CACHE. If NEXT is non-zero, set *NEXT to the nearest +/* Return the value for the text immediately before POS in BUF if the + value is known, for the purposes of CACHE, and return zero + otherwise. If NEXT is non-zero, set *NEXT to the nearest position before POS where the knowledge changes. */ int region_cache_backward (struct buffer *buf, struct region_cache *c, ptrdiff_t pos, ptrdiff_t *next) === modified file 'src/scroll.c' --- src/scroll.c 2013-01-01 09:11:05 +0000 +++ src/scroll.c 2013-03-08 21:37:41 +0000 @@ -246,9 +246,8 @@ struct matrix_elt *p; int i, j, k; - /* Set to 1 if we have set a terminal window with - set_terminal_window. It's unsigned to work around GCC bug 48228. */ - unsigned int terminal_window_p = 0; + /* True if we have set a terminal window with set_terminal_window. */ + bool terminal_window_p = 0; /* A queue for line insertions to be done. */ struct queue { int count, pos; }; @@ -657,18 +656,16 @@ alloca (window_size * sizeof *queue_start); struct alt_queue *queue = queue_start; - /* Set to 1 if a terminal window has been set with - set_terminal_window: */ - int terminal_window_p = 0; + /* True if a terminal window has been set with set_terminal_window. */ + bool terminal_window_p = 0; - /* A nonzero value of write_follows indicates that a write has been - selected, allowing either an insert or a delete to be selected - next. When write_follows is zero, a delete cannot be selected + /* If true, a write has been selected, allowing either an insert or a + delete to be selected next. If false, a delete cannot be selected unless j < i, and an insert cannot be selected unless i < j. This corresponds to a similar restriction (with the ordering reversed) in calculate_direct_scrolling, which is intended to ensure that lines marked as inserted will be blank. */ - int write_follows_p = 1; + bool write_follows_p = 1; /* For each row in the new matrix what row of the old matrix it is. */ int *copy_from = alloca (window_size * sizeof *copy_from); === modified file 'src/search.c' --- src/search.c 2013-03-08 09:34:35 +0000 +++ src/search.c 2013-03-08 21:37:41 +0000 @@ -49,8 +49,8 @@ Lisp_Object syntax_table; struct re_pattern_buffer buf; char fastmap[0400]; - /* Nonzero means regexp was compiled to do full POSIX backtracking. */ - char posix; + /* True means regexp was compiled to do full POSIX backtracking. */ + bool posix; }; /* The instances of that struct. */ @@ -100,7 +100,7 @@ ptrdiff_t, int); static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, int, - Lisp_Object, Lisp_Object, int); + Lisp_Object, Lisp_Object, bool); static _Noreturn void matcher_overflow (void) @@ -112,13 +112,14 @@ PATTERN is the pattern to compile. CP is the place to put the result. TRANSLATE is a translation table for ignoring case, or nil for none. - POSIX is nonzero if we want full backtracking (POSIX style) - for this pattern. 0 means backtrack only enough to get a valid match. + POSIX is true if we want full backtracking (POSIX style) for this pattern. + False means backtrack only enough to get a valid match. The behavior also depends on Vsearch_spaces_regexp. */ static void -compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object translate, int posix) +compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, + Lisp_Object translate, bool posix) { char *val; reg_syntax_t old; @@ -205,12 +206,12 @@ values that will result from matching this pattern. If it is 0, we should compile the pattern not to record any subexpression bounds. - POSIX is nonzero if we want full backtracking (POSIX style) - for this pattern. 0 means backtrack only enough to get a valid match. */ + POSIX is true if we want full backtracking (POSIX style) for this pattern. + False means backtrack only enough to get a valid match. */ struct re_pattern_buffer * compile_pattern (Lisp_Object pattern, struct re_registers *regp, - Lisp_Object translate, int posix, bool multibyte) + Lisp_Object translate, bool posix, bool multibyte) { struct regexp_cache *cp, **cpp; @@ -267,7 +268,7 @@ static Lisp_Object -looking_at_1 (Lisp_Object string, int posix) +looking_at_1 (Lisp_Object string, bool posix) { Lisp_Object val; unsigned char *p1, *p2; @@ -365,7 +366,8 @@ } static Lisp_Object -string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix) +string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, + bool posix) { ptrdiff_t val; struct re_pattern_buffer *bufp; @@ -975,9 +977,9 @@ static Lisp_Object search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, - Lisp_Object count, int direction, int RE, int posix) + Lisp_Object count, int direction, int RE, bool posix) { - register EMACS_INT np; + EMACS_INT np; EMACS_INT lim; ptrdiff_t lim_byte; EMACS_INT n = direction; @@ -1047,9 +1049,9 @@ return make_number (np); } -/* Return 1 if REGEXP it matches just one constant string. */ +/* Return true if REGEXP it matches just one constant string. */ -static int +static bool trivial_regexp_p (Lisp_Object regexp) { ptrdiff_t len = SBYTES (regexp); @@ -1118,7 +1120,7 @@ static EMACS_INT search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n, - int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix) + int RE, Lisp_Object trt, Lisp_Object inverse_trt, bool posix) { ptrdiff_t len = SCHARS (string); ptrdiff_t len_byte = SBYTES (string); @@ -1273,7 +1275,7 @@ /* Set to positive if we find a non-ASCII char that need translation. Otherwise set to zero later. */ int char_base = -1; - int boyer_moore_ok = 1; + bool boyer_moore_ok = 1; /* MULTIBYTE says whether the text to be searched is multibyte. We must convert PATTERN to match that, or we will not really @@ -2282,12 +2284,12 @@ (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp) { enum { nochange, all_caps, cap_initial } case_action; - register ptrdiff_t pos, pos_byte; - int some_multiletter_word; - int some_lowercase; - int some_uppercase; - int some_nonuppercase_initial; - register int c, prevc; + ptrdiff_t pos, pos_byte; + bool some_multiletter_word; + bool some_lowercase; + bool some_uppercase; + bool some_nonuppercase_initial; + int c, prevc; ptrdiff_t sub; ptrdiff_t opoint, newpoint; @@ -2432,7 +2434,7 @@ { ptrdiff_t substart = -1; ptrdiff_t subend = 0; - int delbackslash = 0; + bool delbackslash = 0; FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); @@ -2529,7 +2531,7 @@ ptrdiff_t substed_alloc_size, substed_len; bool buf_multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); bool str_multibyte = STRING_MULTIBYTE (newtext); - int really_changed = 0; + bool really_changed = 0; substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length ? STRING_BYTES_BOUND @@ -2695,7 +2697,7 @@ } static Lisp_Object -match_limit (Lisp_Object num, int beginningp) +match_limit (Lisp_Object num, bool beginningp) { EMACS_INT n; @@ -2968,9 +2970,9 @@ return Qnil; } -/* If non-zero the match data have been saved in saved_search_regs +/* If true the match data have been saved in saved_search_regs during the execution of a sentinel or filter. */ -static int search_regs_saved; +static bool search_regs_saved; static struct re_registers saved_search_regs; static Lisp_Object saved_last_thing_searched; @@ -3035,9 +3037,9 @@ doc: /* Return a regexp string which matches exactly STRING and nothing else. */) (Lisp_Object string) { - register char *in, *out, *end; - register char *temp; - int backslashes_added = 0; + char *in, *out, *end; + char *temp; + ptrdiff_t backslashes_added = 0; CHECK_STRING (string); ------------------------------------------------------------ revno: 111976 committer: Dmitry Antipov branch nick: trunk timestamp: Fri 2013-03-08 13:34:35 +0400 message: * search.c (find_newline): Accept start and end byte positions as arguments and allow -1 if not known. (find_newline_no_quit): Likewise for start position. * lisp.h (find_newline, find_newline_no_quit): Adjust prototype. * bidi.c (bidi_find_paragraph_start): Pass byte position to find_newline_no_quit, thus eliminating CHAR_TO_BYTE. * editfns.c (Fconstrain_to_field): Break long line. Adjust call to find_newline. * indent.c (vmotion): Adjust calls to find_newline_no_quit. Use DEC_BOTH to start next search from the previous buffer position, where appropriate. * xdisp.c (back_to_previous_line_start, forward_to_next_line_start) (get_visually_first_element, move_it_vertically_backward): Likewise. Obtain byte position from the display iterator, where appropriate. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-03-08 02:32:21 +0000 +++ src/ChangeLog 2013-03-08 09:34:35 +0000 @@ -1,3 +1,20 @@ +2013-03-08 Dmitry Antipov + + * search.c (find_newline): Accept start and end byte positions + as arguments and allow -1 if not known. + (find_newline_no_quit): Likewise for start position. + * lisp.h (find_newline, find_newline_no_quit): Adjust prototype. + * bidi.c (bidi_find_paragraph_start): Pass byte position to + find_newline_no_quit, thus eliminating CHAR_TO_BYTE. + * editfns.c (Fconstrain_to_field): Break long line. Adjust + call to find_newline. + * indent.c (vmotion): Adjust calls to find_newline_no_quit. + Use DEC_BOTH to start next search from the previous buffer + position, where appropriate. + * xdisp.c (back_to_previous_line_start, forward_to_next_line_start) + (get_visually_first_element, move_it_vertically_backward): Likewise. + Obtain byte position from the display iterator, where appropriate. + 2013-03-08 Paul Eggert print.c, process.c: Use bool for booleans. === modified file 'src/bidi.c' --- src/bidi.c 2013-03-07 23:37:36 +0000 +++ src/bidi.c 2013-03-08 09:34:35 +0000 @@ -1104,11 +1104,14 @@ while (pos_byte > BEGV_BYTE && n++ < MAX_PARAGRAPH_SEARCH && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) - /* FIXME: What if the paragraph beginning is covered by a - display string? And what if a display string covering some - of the text over which we scan back includes - paragraph_start_re? */ - pos = find_newline_no_quit (pos - 1, -1, &pos_byte); + { + /* FIXME: What if the paragraph beginning is covered by a + display string? And what if a display string covering some + of the text over which we scan back includes + paragraph_start_re? */ + DEC_BOTH (pos, pos_byte); + pos = find_newline_no_quit (pos, pos_byte, -1, &pos_byte); + } if (n >= MAX_PARAGRAPH_SEARCH) pos_byte = BEGV_BYTE; return pos_byte; === modified file 'src/editfns.c' --- src/editfns.c 2013-03-07 03:01:17 +0000 +++ src/editfns.c 2013-03-08 09:34:35 +0000 @@ -669,7 +669,8 @@ a non-nil property of that name, then any field boundaries are ignored. Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) - (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) + (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, + Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) { /* If non-zero, then the original point, before re-positioning. */ ptrdiff_t orig_point = 0; @@ -735,7 +736,8 @@ /* This is the ONLY_IN_LINE case, check that NEW_POS and FIELD_BOUND are on the same line by seeing whether there's an intervening newline or not. */ - || (find_newline (XFASTINT (new_pos), XFASTINT (field_bound), + || (find_newline (XFASTINT (new_pos), -1, + XFASTINT (field_bound), -1, fwd ? -1 : 1, &shortage, NULL, 1), shortage != 0))) /* Constrain NEW_POS to FIELD_BOUND. */ === modified file 'src/indent.c' --- src/indent.c 2013-03-07 04:42:59 +0000 +++ src/indent.c 2013-03-08 09:34:35 +0000 @@ -1840,10 +1840,13 @@ while ((vpos > vtarget || first) && from > BEGV) { - ptrdiff_t bytepos; + ptrdiff_t bytepos = from_byte; Lisp_Object propval; - prevline = find_newline_no_quit (from - 1, -1, &bytepos); + prevline = from; + DEC_BOTH (prevline, bytepos); + prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos); + while (prevline > BEGV && ((selective > 0 && indented_beyond_p (prevline, bytepos, selective)) @@ -1853,7 +1856,10 @@ Qinvisible, text_prop_object), TEXT_PROP_MEANS_INVISIBLE (propval)))) - prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); + { + DEC_BOTH (prevline, bytepos); + prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos); + } pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, /* Don't care for VPOS... */ 1 << (BITS_PER_SHORT - 1), @@ -1890,7 +1896,7 @@ ptrdiff_t bytepos; Lisp_Object propval; - prevline = find_newline_no_quit (from, -1, &bytepos); + prevline = find_newline_no_quit (from, from_byte, -1, &bytepos); while (prevline > BEGV && ((selective > 0 && indented_beyond_p (prevline, bytepos, selective)) @@ -1900,7 +1906,10 @@ Qinvisible, text_prop_object), TEXT_PROP_MEANS_INVISIBLE (propval)))) - prevline = find_newline_no_quit (prevline - 1, -1, &bytepos); + { + DEC_BOTH (prevline, bytepos); + prevline = find_newline_no_quit (prevline, bytepos, -1, &bytepos); + } pos = *compute_motion (prevline, bytepos, 0, lmargin, 0, from, /* Don't care for VPOS... */ 1 << (BITS_PER_SHORT - 1), === modified file 'src/lisp.h' --- src/lisp.h 2013-03-08 02:32:21 +0000 +++ src/lisp.h 2013-03-08 09:34:35 +0000 @@ -3364,11 +3364,12 @@ extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object); extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, Lisp_Object); -extern ptrdiff_t find_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t *, ptrdiff_t *, bool); +extern ptrdiff_t find_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, + ptrdiff_t, ptrdiff_t *, ptrdiff_t *, bool); extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, bool); -extern ptrdiff_t find_newline_no_quit (ptrdiff_t, ptrdiff_t, ptrdiff_t *); +extern ptrdiff_t find_newline_no_quit (ptrdiff_t, ptrdiff_t, + ptrdiff_t, ptrdiff_t *); extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t *); extern void syms_of_search (void); === modified file 'src/search.c' --- src/search.c 2013-03-06 16:35:23 +0000 +++ src/search.c 2013-03-08 09:34:35 +0000 @@ -621,7 +621,7 @@ } -/* Search for COUNT newlines between START and END. +/* Search for COUNT newlines between START/START_BYTE and END/END_BYTE. If COUNT is positive, search forwards; END must be >= START. If COUNT is negative, search backwards for the -COUNTth instance; @@ -645,11 +645,11 @@ except when inside redisplay. */ ptrdiff_t -find_newline (ptrdiff_t start, ptrdiff_t end, ptrdiff_t count, - ptrdiff_t *shortage, ptrdiff_t *bytepos, bool allow_quit) +find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end, + ptrdiff_t end_byte, ptrdiff_t count, ptrdiff_t *shortage, + ptrdiff_t *bytepos, bool allow_quit) { struct region_cache *newline_cache; - ptrdiff_t start_byte = -1, end_byte = -1; int direction; if (count > 0) @@ -706,7 +706,7 @@ next_change is the position of the next known region. */ ceiling_byte = min (CHAR_TO_BYTE (next_change) - 1, ceiling_byte); } - else + else if (start_byte == -1) start_byte = CHAR_TO_BYTE (start); /* The dumb loop can only scan text stored in contiguous @@ -783,7 +783,7 @@ next_change is the position of the next known region. */ ceiling_byte = max (CHAR_TO_BYTE (next_change), ceiling_byte); } - else + else if (start_byte == -1) start_byte = CHAR_TO_BYTE (start); /* Stop scanning before the gap. */ @@ -944,9 +944,10 @@ /* Like find_newline, but doesn't allow QUITting and doesn't return SHORTAGE. */ ptrdiff_t -find_newline_no_quit (ptrdiff_t from, ptrdiff_t cnt, ptrdiff_t *bytepos) +find_newline_no_quit (ptrdiff_t from, ptrdiff_t frombyte, + ptrdiff_t cnt, ptrdiff_t *bytepos) { - return find_newline (from, 0, cnt, NULL, bytepos, 0); + return find_newline (from, frombyte, 0, -1, cnt, NULL, bytepos, 0); } /* Like find_newline, but returns position before the newline, not @@ -958,7 +959,7 @@ ptrdiff_t cnt, ptrdiff_t *bytepos) { ptrdiff_t shortage; - ptrdiff_t pos = find_newline (from, to, cnt, &shortage, bytepos, 1); + ptrdiff_t pos = find_newline (from, -1, to, -1, cnt, &shortage, bytepos, 1); if (shortage == 0) { === modified file 'src/xdisp.c' --- src/xdisp.c 2013-03-07 23:37:36 +0000 +++ src/xdisp.c 2013-03-08 09:34:35 +0000 @@ -5905,8 +5905,10 @@ static void back_to_previous_line_start (struct it *it) { - IT_CHARPOS (*it) = find_newline_no_quit (IT_CHARPOS (*it) - 1, -1, - &IT_BYTEPOS (*it)); + ptrdiff_t cp = IT_CHARPOS (*it), bp = IT_BYTEPOS (*it); + + DEC_BOTH (cp, bp); + IT_CHARPOS (*it) = find_newline_no_quit (cp, bp, -1, &IT_BYTEPOS (*it)); } @@ -5978,7 +5980,8 @@ if (!newline_found_p) { ptrdiff_t bytepos, start = IT_CHARPOS (*it); - ptrdiff_t limit = find_newline_no_quit (start, 1, &bytepos); + ptrdiff_t limit = find_newline_no_quit (start, IT_BYTEPOS (*it), + 1, &bytepos); Lisp_Object pos; eassert (!STRINGP (it->string)); @@ -7432,7 +7435,8 @@ if (string_p) it->bidi_it.charpos = it->bidi_it.bytepos = 0; else - it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it), -1, + it->bidi_it.charpos = find_newline_no_quit (IT_CHARPOS (*it), + IT_BYTEPOS (*it), -1, &it->bidi_it.bytepos); bidi_paragraph_init (it->paragraph_embedding, &it->bidi_it, 1); do @@ -9067,10 +9071,11 @@ && IT_CHARPOS (*it) > BEGV && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') { - ptrdiff_t nl_pos = find_newline_no_quit (IT_CHARPOS (*it) - 1, -1, - NULL); + ptrdiff_t cp = IT_CHARPOS (*it), bp = IT_BYTEPOS (*it); - move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS); + DEC_BOTH (cp, bp); + cp = find_newline_no_quit (cp, bp, -1, NULL); + move_it_to (it, cp, -1, -1, -1, MOVE_TO_POS); } bidi_unshelve_cache (it3data, 1); } ------------------------------------------------------------ revno: 111975 committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-03-08 00:37:59 -0800 message: * doc/misc/faq.texi (Top): Don't say this was updated @today. That's irrelevant and leads to spurious diffs. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2013-03-08 02:11:25 +0000 +++ doc/misc/ChangeLog 2013-03-08 08:37:59 +0000 @@ -1,3 +1,8 @@ +2013-03-08 Glenn Morris + + * faq.texi (Top): Don't say this was updated @today. + That's irrelevant and leads to spurious diffs. + 2013-03-08 Jay Belanger * calc.texi (Basic Operations on Units): Fix === modified file 'doc/misc/faq.texi' --- doc/misc/faq.texi 2013-02-12 17:36:54 +0000 +++ doc/misc/faq.texi 2013-03-08 08:37:59 +0000 @@ -58,8 +58,7 @@ @node Top, FAQ notation, (dir), (dir) @top The GNU Emacs FAQ -@c FIXME @today is just the day we ran `makeinfo'. -This is the GNU Emacs FAQ, last updated on @today{}. +This is the GNU Emacs FAQ. This FAQ is maintained as a part of GNU Emacs. If you find any errors, or have any suggestions, please use @kbd{M-x report-emacs-bug} to report ------------------------------------------------------------ revno: 111974 committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-03-08 00:11:59 -0800 message: Fix doc typo in previous change diff: === modified file 'lisp/subr.el' --- lisp/subr.el 2013-03-08 04:18:16 +0000 +++ lisp/subr.el 2013-03-08 08:11:59 +0000 @@ -2701,7 +2701,7 @@ "Return regexp that matches the default tag at point. If there is no tag at point, return nil. -When in a major mode that does not provide it's own +When in a major mode that does not provide its own `find-tag-default-function', return a regexp that matches the symbol at point exactly." (let* ((tagf (or find-tag-default-function ------------------------------------------------------------ revno: 111973 committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-03-08 00:11:28 -0800 message: ChangeLog entries should be attributed to the author of the changes diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-03-08 04:18:16 +0000 +++ lisp/ChangeLog 2013-03-08 08:11:28 +0000 @@ -14,26 +14,23 @@ * calc/calc-units.el (calc-convert-units): Fix the way that default new units are stored. -2013-03-07 Karl Fogel +2013-03-07 Matthias Meulien * bookmark.el: Define a face to highlight bookmark names in bookmark menu buffers, where the default is a bold face similarly - to buffer names in buffer menu buffers. Patch by Matthias Meulien - . - + to buffer names in buffer menu buffers. (bookmark-menu-bookmark): New face to highlight bookmark names. (bookmark-insert-location): Remove duplicated text property to conform to buffer list (see `list-buffers'). (bookmark-bmenu-list, bookmark-bmenu-hide-filenames): Apply face `bookmark-menu-bookmark' to bookmark names. -2013-03-07 Karl Fogel +2013-03-07 Matthias Meulien + Karl Fogel * bookmark.el: Display the bookmark list header similarly to the buffer list header (see `list-buffers'), where the default is now - an immovable/immutable header line. Patch by Matthias Meulien - with a few tweaks by me. - + an immovable/immutable header line. (bookmark-bmenu-use-header-line): New variable. (bookmark-bmenu-inline-header-height): New name for `bookmark-bmenu-header-height', to avoid confusion with the code ------------------------------------------------------------ revno: 111972 [merge] committer: Glenn Morris branch nick: trunk timestamp: Fri 2013-03-08 00:04:30 -0800 message: Merge from emacs-24; up to r111325 diff: === modified file 'lisp/org/ChangeLog' --- lisp/org/ChangeLog 2013-02-28 06:30:48 +0000 +++ lisp/org/ChangeLog 2013-03-08 08:04:30 +0000 @@ -1,3 +1,9 @@ +2013-03-08 Bastien Guerry + + * org-exp.el (org-export-normalize-links): Fix critical bug: do + not rely on `org-context' to guess where to prevent links + normalization. + 2013-02-28 Achim Gratz * org.el (org-org-menu): Use correct key "C-u C-c C-x !" to do === modified file 'lisp/org/org-exp.el' --- lisp/org/org-exp.el 2013-02-07 07:11:59 +0000 +++ lisp/org/org-exp.el 2013-03-08 06:37:21 +0000 @@ -2113,8 +2113,7 @@ (put-text-property (match-beginning 0) (match-end 0) 'org-normalized-link t)) (goto-char (point-min)) (while (re-search-forward re-plain-link nil t) - (unless (or (get-text-property (match-beginning 0) 'org-normalized-link) - (assoc :tags (org-context))) + (unless (get-text-property (match-beginning 0) 'org-normalized-link) (goto-char (1- (match-end 0))) (org-if-unprotected-at (1+ (match-beginning 0)) (let* ((s (concat (match-string 1) ------------------------------------------------------------ revno: 111971 committer: Jambunathan K branch nick: trunk timestamp: Fri 2013-03-08 09:48:16 +0530 message: Provide for customizing default regexp in hi-lock commands (Bug#13892). * lisp/hi-lock.el (hi-lock-read-regexp-defaults-function): New var. (hi-lock-read-regexp-defaults): New defun. (hi-lock-line-face-buffer, hi-lock-face-buffer) (hi-lock-face-phrase-buffer): Propagate above change. Update docstring. * lisp/subr.el (find-tag-default-as-regexp): New defun. * lisp/replace.el (read-regexp): Propagate above change. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-03-08 02:11:25 +0000 +++ lisp/ChangeLog 2013-03-08 04:18:16 +0000 @@ -1,3 +1,14 @@ +2013-03-08 Jambunathan K + + * hi-lock.el (hi-lock-read-regexp-defaults-function): New var. + (hi-lock-read-regexp-defaults): New defun. + (hi-lock-line-face-buffer, hi-lock-face-buffer) + (hi-lock-face-phrase-buffer): Propagate above change. Update + docstring (bug#13892). + + * subr.el (find-tag-default-as-regexp): New defun. + * replace.el (read-regexp): Propagate above change. + 2013-03-08 Jay Belanger * calc/calc-units.el (calc-convert-units): Fix the way that default === modified file 'lisp/hi-lock.el' --- lisp/hi-lock.el 2013-01-28 20:00:35 +0000 +++ lisp/hi-lock.el 2013-03-08 04:18:16 +0000 @@ -279,6 +279,26 @@ map) "Key map for hi-lock.") +(defvar hi-lock-read-regexp-defaults-function + 'hi-lock-read-regexp-defaults + "Function that provides default regexp(s) for highlighting commands. +This function should take no arguments and return one of nil, a +regexp or a list of regexps for use with highlighting commands - +`hi-lock-face-phrase-buffer', `hi-lock-line-face-buffer' and +`hi-lock-face-buffer'. The return value of this function is used +as DEFAULTS param of `read-regexp' while executing the +highlighting command. This function is called only during +interactive use. + +For example, to highlight at symbol at point use + + \(setq hi-lock-read-regexp-defaults-function + 'find-tag-default-as-regexp\) + +If you need different defaults for different highlighting +operations, use `this-command' to identify the command under +execution.") + ;; Visible Functions ;;;###autoload @@ -399,17 +419,18 @@ ;;;###autoload (defun hi-lock-line-face-buffer (regexp &optional face) "Set face of all lines containing a match of REGEXP to FACE. -Interactively, prompt for REGEXP then FACE, using a buffer-local -history list for REGEXP and a global history list for FACE. +Interactively, prompt for REGEXP then FACE. Use +`hi-lock-read-regexp-defaults-function' to retrieve default +value(s) of REGEXP. Use the global history list for FACE. -If Font Lock mode is enabled in the buffer, it is used to -highlight REGEXP. If Font Lock mode is disabled, overlays are -used for highlighting; in this case, the highlighting will not be -updated as you type." +Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, +use overlays for highlighting. If overlays are used, the +highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight line" (car regexp-history))) + (read-regexp "Regexp to highlight line" + (funcall hi-lock-read-regexp-defaults-function))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -424,17 +445,18 @@ ;;;###autoload (defun hi-lock-face-buffer (regexp &optional face) "Set face of each match of REGEXP to FACE. -Interactively, prompt for REGEXP then FACE, using a buffer-local -history list for REGEXP and a global history list for FACE. +Interactively, prompt for REGEXP then FACE. Use +`hi-lock-read-regexp-defaults-function' to retrieve default +value(s) REGEXP. Use the global history list for FACE. -If Font Lock mode is enabled in the buffer, it is used to -highlight REGEXP. If Font Lock mode is disabled, overlays are -used for highlighting; in this case, the highlighting will not be -updated as you type." +Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, +use overlays for highlighting. If overlays are used, the +highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay - (read-regexp "Regexp to highlight" (car regexp-history))) + (read-regexp "Regexp to highlight" + (funcall hi-lock-read-regexp-defaults-function))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -445,18 +467,22 @@ ;;;###autoload (defun hi-lock-face-phrase-buffer (regexp &optional face) "Set face of each match of phrase REGEXP to FACE. -If called interactively, replaces whitespace in REGEXP with -arbitrary whitespace and makes initial lower-case letters case-insensitive. +Interactively, prompt for REGEXP then FACE. Use +`hi-lock-read-regexp-defaults-function' to retrieve default +value(s) of REGEXP. Use the global history list for FACE. When +called interactively, replace whitespace in user provided regexp +with arbitrary whitespace and make initial lower-case letters +case-insensitive before highlighting with `hi-lock-set-pattern'. -If Font Lock mode is enabled in the buffer, it is used to -highlight REGEXP. If Font Lock mode is disabled, overlays are -used for highlighting; in this case, the highlighting will not be -updated as you type." +Use Font lock mode, if enabled, to highlight REGEXP. Otherwise, +use overlays for highlighting. If overlays are used, the +highlighting will not update as you type." (interactive (list (hi-lock-regexp-okay (hi-lock-process-phrase - (read-regexp "Phrase to highlight" (car regexp-history)))) + (read-regexp "Phrase to highlight" + (funcall hi-lock-read-regexp-defaults-function)))) (hi-lock-read-face-name))) (or (facep face) (setq face 'hi-yellow)) (unless hi-lock-mode (hi-lock-mode 1)) @@ -622,6 +648,11 @@ (error "Regexp cannot match an empty string") regexp)) +(defun hi-lock-read-regexp-defaults () + "Return the latest regexp from `regexp-history'. +See `hi-lock-read-regexp-defaults-function' for details." + (car regexp-history)) + (defun hi-lock-read-face-name () "Return face for interactive highlighting. When `hi-lock-auto-select-face' is non-nil, just return the next face. === modified file 'lisp/replace.el' --- lisp/replace.el 2013-02-25 20:57:44 +0000 +++ lisp/replace.el 2013-03-08 04:18:16 +0000 @@ -603,15 +603,7 @@ (append suggestions (list - ;; Regexp for tag at point. - (let* ((tagf (or find-tag-default-function - (get major-mode 'find-tag-default-function) - 'find-tag-default)) - (tag (funcall tagf))) - (cond ((not tag) "") - ((eq tagf 'find-tag-default) - (format "\\_<%s\\_>" (regexp-quote tag))) - (t (regexp-quote tag)))) + (find-tag-default-as-regexp) (car regexp-search-ring) (regexp-quote (or (car search-ring) "")) (car (symbol-value query-replace-from-history-variable))))) === modified file 'lisp/subr.el' --- lisp/subr.el 2013-02-09 16:20:29 +0000 +++ lisp/subr.el 2013-03-08 04:18:16 +0000 @@ -2697,6 +2697,22 @@ (setq to (point))))) (buffer-substring-no-properties from to)))) +(defun find-tag-default-as-regexp () + "Return regexp that matches the default tag at point. +If there is no tag at point, return nil. + +When in a major mode that does not provide it's own +`find-tag-default-function', return a regexp that matches the +symbol at point exactly." + (let* ((tagf (or find-tag-default-function + (get major-mode 'find-tag-default-function) + 'find-tag-default)) + (tag (funcall tagf))) + (cond ((not tag)) + ((eq tagf 'find-tag-default) + (format "\\_<%s\\_>" (regexp-quote tag))) + (t (regexp-quote tag))))) + (defun play-sound (sound) "SOUND is a list of the form `(sound KEYWORD VALUE...)'. The following keywords are recognized: ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.