From 457882c20c301f076ff6a4ef7ffd78ed3d35e699 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 8 Mar 2013 13:37:41 -0800 Subject: [PATCH 01/95] 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. --- src/ChangeLog | 13 ++++++++++ src/lisp.h | 2 +- src/region-cache.c | 10 +++++--- src/scroll.c | 17 +++++------- src/search.c | 64 ++++++++++++++++++++++++---------------------- 5 files changed, 60 insertions(+), 46 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fe084b160c4..69e8303111a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/lisp.h b/src/lisp.h index 12906bfa33e..e4993866b1f 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -3357,7 +3357,7 @@ extern void record_unwind_save_match_data (void); 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); diff --git a/src/region-cache.c b/src/region-cache.c index 14e6982cd9a..452a5b3a065 100644 --- a/src/region-cache.c +++ b/src/region-cache.c @@ -695,8 +695,9 @@ know_region_cache (struct buffer *buf, struct region_cache *c, /* 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 @@ region_cache_forward (struct buffer *buf, struct region_cache *c, } } -/* 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) diff --git a/src/scroll.c b/src/scroll.c index 9e11feb64d4..037e338c696 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -246,9 +246,8 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, 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 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix, 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); diff --git a/src/search.c b/src/search.c index 8bcf556eeeb..c5ac7d494dc 100644 --- a/src/search.c +++ b/src/search.c @@ -49,8 +49,8 @@ struct regexp_cache 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 @@ static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, ptrdiff_t, 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 @@ matcher_overflow (void) 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 @@ clear_regexp_cache (void) 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 @@ compile_pattern (Lisp_Object pattern, struct re_registers *regp, 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 @@ data if you want to preserve them. */) } 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 @@ find_before_next_newline (ptrdiff_t from, ptrdiff_t to, 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 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, 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 struct re_registers search_regs_1; 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 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, /* 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 @@ since only regular expressions have distinguished subexpressions. */) (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 @@ since only regular expressions have distinguished subexpressions. */) { 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 @@ since only regular expressions have distinguished subexpressions. */) 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 @@ since only regular expressions have distinguished subexpressions. */) } static Lisp_Object -match_limit (Lisp_Object num, int beginningp) +match_limit (Lisp_Object num, bool beginningp) { EMACS_INT n; @@ -2968,9 +2970,9 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) 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 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, 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); From c410dad5e907d7780b83eacf2ad8990294c920b8 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Fri, 8 Mar 2013 20:27:46 -0600 Subject: [PATCH 02/95] * refcards/calccard.tex: Remove incorrect entry. --- etc/ChangeLog | 4 ++++ etc/refcards/calccard.tex | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index efa2c26b808..5bb1d89c25e 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -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). diff --git a/etc/refcards/calccard.tex b/etc/refcards/calccard.tex index f0d84575f32..f9803ebd39d 100644 --- a/etc/refcards/calccard.tex +++ b/etc/refcards/calccard.tex @@ -554,7 +554,6 @@ Variable names are single digits or whole words. \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} From 27a98a62d1c46b057428cc3ed964743b69628299 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Fri, 8 Mar 2013 23:15:53 -0500 Subject: [PATCH 03/95] 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. --- lisp/ChangeLog | 25 +++++++++----- lisp/mouse.el | 94 +++++++++++++++++++++++--------------------------- src/ChangeLog | 21 +++++++---- src/keyboard.c | 2 +- src/keyboard.h | 12 +++---- 5 files changed, 83 insertions(+), 71 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9dc7f06e02c..5e625aed387 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -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 diff --git a/lisp/mouse.el b/lisp/mouse.el index bd7242e3b20..f820d3aa6d7 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -93,6 +93,49 @@ point at the click position." :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 @@ must be one of the symbols `header', `mode', or `vertical'." (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 @@ must be one of the symbols `header', `mode', or `vertical'." (- 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 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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. diff --git a/src/ChangeLog b/src/ChangeLog index 69e8303111a..ae25a3c5d00 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/keyboard.c b/src/keyboard.c index 914378947ed..a66c28dc3d3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -8699,7 +8699,7 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, 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))); } diff --git a/src/keyboard.h b/src/keyboard.h index c6ade35dd52..8bb1c409efc 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -421,18 +421,18 @@ typedef struct _widget_value (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. From 3675b1698d0a3a5a8ee09354f2d15e233de8cece Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sat, 9 Mar 2013 12:06:23 +0100 Subject: [PATCH 04/95] Major rewrite due to changed D-Bus interface of GVFS 1.14. * net/tramp-gvfs.el (top): Extend check for gvfs availability. (tramp-gvfs-methods-mounttracker, tramp-gvfs-listmounts) (tramp-gvfs-mountlocation, tramp-gvfs-mountlocation-signature): New defconst. (tramp-gvfs-file-name-handler-alist) [directory-files]: [directory-files-and-attributes, file-exists-p, file-modes]: Use Tramp default handler. [file-acl, file-selinux-context, process-file, set-file-acl]: [set-file-modes, set-file-selinux-context, shell-command]: [start-file-process ]: Remove handler. [verify-visited-file-modtime]: New handler. (tramp-gvfs-dbus-string-to-byte-array) (tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all calls of `dbus-string-to-byte-array' and `tramp-gvfs-dbus-byte-array-to-string'. (tramp-gvfs-handle-copy-file) (tramp-gvfs-handle-delete-directory) (tramp-gvfs-handle-delete-file, tramp-gvfs-handle-file-attributes) (tramp-gvfs-handle-file-directory-p) (tramp-gvfs-handle-file-executable-p) (tramp-gvfs-handle-file-name-all-completions) (tramp-gvfs-handle-file-readable-p) (tramp-gvfs-handle-file-writable-p) (tramp-gvfs-handle-insert-directory) (tramp-gvfs-handle-insert-file-contents) (tramp-gvfs-handle-make-directory, tramp-gvfs-handle-rename-file) (tramp-gvfs-handle-set-visited-file-modtime) (tramp-gvfs-handle-write-region): Rewrite. (tramp-gvfs-handle-file-acl) (tramp-gvfs-handle-file-selinux-context) (tramp-gvfs-handle-process-file, tramp-gvfs-handle-set-file-acl) (tramp-gvfs-handle-set-file-modes) (tramp-gvfs-handle-set-file-selinux-context) (tramp-gvfs-handle-shell-command) (tramp-gvfs-handle-start-file-process) (tramp-gvfs-handle-verify-visited-file-modtime): Remove defuns. (tramp-gvfs-url-file-name): Do not use `file-truename', we work over the symlinks. Fix user handling. (top, tramp-gvfs-handler-mounted-unmounted): Handle different names of the D-Bus signals. (tramp-gvfs-connection-mounted-p): Handle different names of the D-Bus methods. (tramp-gvfs-mount-spec-entry): New defun. (tramp-gvfs-mount-spec): Use it. (tramp-gvfs-maybe-open-connection): Check, that in case of "smb" there is a share name. Handle different names of the D-Bus signals and methods. (tramp-gvfs-maybe-open-connection): Set connection properties needed for `tramp-check-cached-permissions'. (tramp-gvfs-send-command): Apply `tramp-gvfs-maybe-open-connection'. Return t or nil. * net/tramp.el (tramp-backtrace): Move up. (tramp-error): Apply a backtrace into the debug buffer when `tramp-verbose > 9. (tramp-file-mode-type-map, tramp-file-mode-from-int) (tramp-file-mode-permissions, tramp-get-local-uid) (tramp-get-local-gid, tramp-check-cached-permissions): Move from tramp-sh.el. * net/tramp-sh.el (tramp-file-mode-type-map) (tramp-check-cached-permissions, tramp-file-mode-from-int) (tramp-file-mode-permissions, tramp-get-local-uid) (tramp-get-local-gid): Move to tramp.el. --- lisp/ChangeLog | 69 ++++ lisp/net/tramp-gvfs.el | 846 +++++++++++++++++++++++++++-------------- lisp/net/tramp-sh.el | 97 ----- lisp/net/tramp.el | 112 +++++- 4 files changed, 745 insertions(+), 379 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5e625aed387..41d5a4ed0d0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,72 @@ +2013-03-09 Michael Albinus + + Major rewrite due to changed D-Bus interface of GVFS 1.14. + + * net/tramp-gvfs.el (top): Extend check for gvfs availability. + (tramp-gvfs-methods-mounttracker, tramp-gvfs-listmounts) + (tramp-gvfs-mountlocation, tramp-gvfs-mountlocation-signature): + New defconst. + (tramp-gvfs-file-name-handler-alist) [directory-files]: + [directory-files-and-attributes, file-exists-p, file-modes]: Use + Tramp default handler. + [file-acl, file-selinux-context, process-file, set-file-acl]: + [set-file-modes, set-file-selinux-context, shell-command]: + [start-file-process ]: Remove handler. + [verify-visited-file-modtime]: New handler. + (tramp-gvfs-dbus-string-to-byte-array) + (tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all + calls of `dbus-string-to-byte-array' and + `tramp-gvfs-dbus-byte-array-to-string'. + (tramp-gvfs-handle-copy-file) + (tramp-gvfs-handle-delete-directory) + (tramp-gvfs-handle-delete-file, tramp-gvfs-handle-file-attributes) + (tramp-gvfs-handle-file-directory-p) + (tramp-gvfs-handle-file-executable-p) + (tramp-gvfs-handle-file-name-all-completions) + (tramp-gvfs-handle-file-readable-p) + (tramp-gvfs-handle-file-writable-p) + (tramp-gvfs-handle-insert-directory) + (tramp-gvfs-handle-insert-file-contents) + (tramp-gvfs-handle-make-directory, tramp-gvfs-handle-rename-file) + (tramp-gvfs-handle-set-visited-file-modtime) + (tramp-gvfs-handle-write-region): Rewrite. + (tramp-gvfs-handle-file-acl) + (tramp-gvfs-handle-file-selinux-context) + (tramp-gvfs-handle-process-file, tramp-gvfs-handle-set-file-acl) + (tramp-gvfs-handle-set-file-modes) + (tramp-gvfs-handle-set-file-selinux-context) + (tramp-gvfs-handle-shell-command) + (tramp-gvfs-handle-start-file-process) + (tramp-gvfs-handle-verify-visited-file-modtime): Remove defuns. + (tramp-gvfs-url-file-name): Do not use `file-truename', we work + over the symlinks. Fix user handling. + (top, tramp-gvfs-handler-mounted-unmounted): Handle different names + of the D-Bus signals. + (tramp-gvfs-connection-mounted-p): Handle different names of the + D-Bus methods. + (tramp-gvfs-mount-spec-entry): New defun. + (tramp-gvfs-mount-spec): Use it. + (tramp-gvfs-maybe-open-connection): Check, that in case of "smb" + there is a share name. Handle different names of the D-Bus + signals and methods. + (tramp-gvfs-maybe-open-connection): Set connection properties + needed for `tramp-check-cached-permissions'. + (tramp-gvfs-send-command): Apply `tramp-gvfs-maybe-open-connection'. + Return t or nil. + + * net/tramp.el (tramp-backtrace): Move up. + (tramp-error): Apply a backtrace into the debug buffer when + `tramp-verbose > 9. + (tramp-file-mode-type-map, tramp-file-mode-from-int) + (tramp-file-mode-permissions, tramp-get-local-uid) + (tramp-get-local-gid, tramp-check-cached-permissions): Move from + tramp-sh.el. + + * net/tramp-sh.el (tramp-file-mode-type-map) + (tramp-check-cached-permissions, tramp-file-mode-from-int) + (tramp-file-mode-permissions, tramp-get-local-uid) + (tramp-get-local-gid): Move to tramp.el. + 2013-03-09 Stefan Monnier Separate mouse-1-click-follows-link from mouse-drag-region. diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 7473871e564..e3850653263 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -24,24 +24,28 @@ ;;; Commentary: ;; Access functions for the GVFS daemon from Tramp. Tested with GVFS -;; 1.0.2 (Ubuntu 8.10, Gnome 2.24). It has been reported also to run +;; 1.0 (Ubuntu 8.10, Gnome 2.24). It has been reported also to run ;; with GVFS 0.2.5 (Ubuntu 8.04, Gnome 2.22), but there is an ;; incompatibility with the mount_info structure, which has been ;; worked around. -;; It has also been tested with GVFS 1.6.2 (Ubuntu 10.04, Gnome 2.30), +;; It has also been tested with GVFS 1.6 (Ubuntu 10.04, Gnome 2.30), ;; where the default_location has been added to mount_info (see ;; . +;; With GVFS 1.14 (Ubuntu 12.10, Gnome 3.6) the interfaces have been +;; changed, again. So we must introspect the D-Bus interfaces. + ;; All actions to mount a remote location, and to retrieve mount ;; information, are performed by D-Bus messages. File operations ;; themselves are performed via the mounted filesystem in ~/.gvfs. ;; Consequently, GNU Emacs 23.1 with enabled D-Bus bindings is a ;; precondition. -;; The GVFS D-Bus interface is said to be unstable. There are even no -;; introspection data. The interface, as discovered during -;; development time, is given in respective comments. +;; The GVFS D-Bus interface is said to be unstable. There were even +;; no introspection data before GVFS 1.14. The interface, as +;; discovered during development time, is given in respective +;; comments. ;; The customer option `tramp-gvfs-methods' contains the list of ;; supported connection methods. Per default, these are "dav", @@ -147,7 +151,8 @@ ;; Emacs 23 on some system types. We don't call `dbus-ping', because ;; this would load dbus.el. (unless (and (tramp-compat-funcall 'dbus-get-unique-name :session) - (tramp-compat-process-running-p "gvfs-fuse-daemon")) + (or (tramp-compat-process-running-p "gvfs-fuse-daemon") + (tramp-compat-process-running-p "gvfsd-fuse"))) (error "Package `tramp-gvfs' not supported")) (defconst tramp-gvfs-path-mounttracker "/org/gtk/vfs/mounttracker" @@ -156,6 +161,35 @@ (defconst tramp-gvfs-interface-mounttracker "org.gtk.vfs.MountTracker" "The mount tracking interface in the GVFS daemon.") +;; Introspection data exist since GVFS 1.14. If there are no such +;; data, we expect an earlier interface. +(defconst tramp-gvfs-methods-mounttracker + (dbus-introspect-get-method-names + :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker + tramp-gvfs-interface-mounttracker) + "The list of supported methods of the mount tracking interface.") + +(defconst tramp-gvfs-listmounts + (if (member "ListMounts" tramp-gvfs-methods-mounttracker) + "ListMounts" + "listMounts") + "The name of the \"listMounts\" method. +It has been changed in GVFS 1.14.") + +(defconst tramp-gvfs-mountlocation + (if (member "MountLocation" tramp-gvfs-methods-mounttracker) + "MountLocation" + "mountLocation") + "The name of the \"mountLocation\" method. +It has been changed in GVFS 1.14.") + +(defconst tramp-gvfs-mountlocation-signature + (dbus-introspect-get-signature + :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker + tramp-gvfs-interface-mounttracker tramp-gvfs-mountlocation) + "The D-Bus signature of the \"mountLocation\" method. +It has been changed in GVFS 1.14.") + ;; ;; ;; (logand (lsh mode -9) 4) 0)) - (sgid (> (logand (lsh mode -9) 2) 0)) - (sticky (> (logand (lsh mode -9) 1) 0))) - (setq user (tramp-file-mode-permissions user suid "s")) - (setq group (tramp-file-mode-permissions group sgid "s")) - (setq other (tramp-file-mode-permissions other sticky "t")) - (concat type user group other))) - -(defun tramp-file-mode-permissions (perm suid suid-text) - "Convert a permission bitset into a string. -This is used internally by `tramp-file-mode-from-int'." - (let ((r (> (logand perm 4) 0)) - (w (> (logand perm 2) 0)) - (x (> (logand perm 1) 0))) - (concat (or (and r "r") "-") - (or (and w "w") "-") - (or (and suid x suid-text) ; suid, execute - (and suid (upcase suid-text)) ; suid, !execute - (and x "x") "-")))) ; !suid - (defun tramp-shell-case-fold (string) "Converts STRING to shell glob pattern which ignores case." (mapconcat @@ -4992,14 +4903,6 @@ This is used internally by `tramp-file-mode-from-int'." ;; The command might not always return a number. (if (and (equal id-format 'integer) (not (integerp res))) -1 res)))) -(defun tramp-get-local-uid (id-format) - (if (equal id-format 'integer) (user-uid) (user-login-name))) - -(defun tramp-get-local-gid (id-format) - (if (and (fboundp 'group-gid) (equal id-format 'integer)) - (tramp-compat-funcall 'group-gid) - (nth 3 (tramp-compat-file-attributes "~/" id-format)))) - ;; Some predefined connection properties. (defun tramp-get-inline-compress (vec prop size) "Return the compress command related to PROP. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index d959cfc854a..dc3dffd857b 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1505,12 +1505,18 @@ applicable)." (concat (format "(%d) # " level) fmt-string) args))))))) +(defsubst tramp-backtrace (vec-or-proc) + "Dump a backtrace into the debug buffer. +This function is meant for debugging purposes." + (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace)))) + (defsubst tramp-error (vec-or-proc signal fmt-string &rest args) "Emit an error. VEC-OR-PROC identifies the connection to use, SIGNAL is the signal identifier to be raised, remaining args passed to `tramp-message'. Finally, signal SIGNAL is raised." (let (tramp-message-show-message) + (tramp-backtrace vec-or-proc) (tramp-message vec-or-proc 1 "%s" (error-message-string @@ -1543,11 +1549,6 @@ an input event arrives. The other arguments are passed to `tramp-error'." "`M-x tramp-cleanup-this-connection'")) (sit-for 30)))))) -(defsubst tramp-backtrace (vec-or-proc) - "Dump a backtrace into the debug buffer. -This function is meant for debugging purposes." - (tramp-message vec-or-proc 10 "\n%s" (with-output-to-string (backtrace)))) - (defmacro with-parsed-tramp-file-name (filename var &rest body) "Parse a Tramp filename and make components available in the body. @@ -3660,6 +3661,107 @@ would yield `t'. On the other hand, the following check results in nil: (t (error "Tenth char `%c' must be one of `xtT-'" other-execute-or-sticky))))))) +(defconst tramp-file-mode-type-map + '((0 . "-") ; Normal file (SVID-v2 and XPG2) + (1 . "p") ; fifo + (2 . "c") ; character device + (3 . "m") ; multiplexed character device (v7) + (4 . "d") ; directory + (5 . "?") ; Named special file (XENIX) + (6 . "b") ; block device + (7 . "?") ; multiplexed block device (v7) + (8 . "-") ; regular file + (9 . "n") ; network special file (HP-UX) + (10 . "l") ; symlink + (11 . "?") ; ACL shadow inode (Solaris, not userspace) + (12 . "s") ; socket + (13 . "D") ; door special (Solaris) + (14 . "w")) ; whiteout (BSD) + "A list of file types returned from the `stat' system call. +This is used to map a mode number to a permission string.") + +;;;###tramp-autoload +(defun tramp-file-mode-from-int (mode) + "Turn an integer representing a file mode into an ls(1)-like string." + (let ((type (cdr + (assoc (logand (lsh mode -12) 15) tramp-file-mode-type-map))) + (user (logand (lsh mode -6) 7)) + (group (logand (lsh mode -3) 7)) + (other (logand (lsh mode -0) 7)) + (suid (> (logand (lsh mode -9) 4) 0)) + (sgid (> (logand (lsh mode -9) 2) 0)) + (sticky (> (logand (lsh mode -9) 1) 0))) + (setq user (tramp-file-mode-permissions user suid "s")) + (setq group (tramp-file-mode-permissions group sgid "s")) + (setq other (tramp-file-mode-permissions other sticky "t")) + (concat type user group other))) + +(defun tramp-file-mode-permissions (perm suid suid-text) + "Convert a permission bitset into a string. +This is used internally by `tramp-file-mode-from-int'." + (let ((r (> (logand perm 4) 0)) + (w (> (logand perm 2) 0)) + (x (> (logand perm 1) 0))) + (concat (or (and r "r") "-") + (or (and w "w") "-") + (or (and suid x suid-text) ; suid, execute + (and suid (upcase suid-text)) ; suid, !execute + (and x "x") "-")))) ; !suid + +;;;###tramp-autoload +(defun tramp-get-local-uid (id-format) + (if (equal id-format 'integer) (user-uid) (user-login-name))) + +;;;###tramp-autoload +(defun tramp-get-local-gid (id-format) + (if (and (fboundp 'group-gid) (equal id-format 'integer)) + (tramp-compat-funcall 'group-gid) + (nth 3 (tramp-compat-file-attributes "~/" id-format)))) + +;;;###tramp-autoload +(defun tramp-check-cached-permissions (vec access) + "Check `file-attributes' caches for VEC. +Return t if according to the cache access type ACCESS is known to +be granted." + (let ((result nil) + (offset (cond + ((eq ?r access) 1) + ((eq ?w access) 2) + ((eq ?x access) 3)))) + (dolist (suffix '("string" "integer") result) + (setq + result + (or + result + (let ((file-attr + (tramp-get-file-property + vec (tramp-file-name-localname vec) + (concat "file-attributes-" suffix) nil)) + (remote-uid + (tramp-get-connection-property + vec (concat "uid-" suffix) nil)) + (remote-gid + (tramp-get-connection-property + vec (concat "gid-" suffix) nil))) + (and + file-attr + (or + ;; Not a symlink + (eq t (car file-attr)) + (null (car file-attr))) + (or + ;; World accessible. + (eq access (aref (nth 8 file-attr) (+ offset 6))) + ;; User accessible and owned by user. + (and + (eq access (aref (nth 8 file-attr) offset)) + (equal remote-uid (nth 2 file-attr))) + ;; Group accessible and owned by user's + ;; principal group. + (and + (eq access (aref (nth 8 file-attr) (+ offset 3))) + (equal remote-gid (nth 3 file-attr))))))))))) + ;;;###tramp-autoload (defun tramp-local-host-p (vec) "Return t if this points to the local host, nil otherwise." From 74dd4abc5fb5ba21cdb3715b1d1d68bf27618b60 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sat, 9 Mar 2013 12:14:24 -0500 Subject: [PATCH 05/95] * lisp/mouse.el (mouse-drag-track): Remove left-over debugging code. --- lisp/ChangeLog | 10 +++++++--- lisp/mouse.el | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 41d5a4ed0d0..df4cf561588 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-03-09 Stefan Monnier + + * mouse.el (mouse-drag-track): Remove left-over debugging code. + 2013-03-09 Michael Albinus Major rewrite due to changed D-Bus interface of GVFS 1.14. @@ -6,9 +10,9 @@ (tramp-gvfs-methods-mounttracker, tramp-gvfs-listmounts) (tramp-gvfs-mountlocation, tramp-gvfs-mountlocation-signature): New defconst. - (tramp-gvfs-file-name-handler-alist) [directory-files]: - [directory-files-and-attributes, file-exists-p, file-modes]: Use - Tramp default handler. + (tramp-gvfs-file-name-handler-alist) [directory-files] + [directory-files-and-attributes, file-exists-p, file-modes]: + Use Tramp default handler. [file-acl, file-selinux-context, process-file, set-file-acl]: [set-file-modes, set-file-selinux-context, shell-command]: [start-file-process ]: Remove handler. diff --git a/lisp/mouse.el b/lisp/mouse.el index f820d3aa6d7..51601bca8df 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -850,7 +850,6 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by (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)) From bc989a58e2412c152c2aef9d35ca103979edebd5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 9 Mar 2013 20:09:33 +0200 Subject: [PATCH 06/95] coding.c (to_unicode): Fix a typo in a comment. --- src/coding.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coding.c b/src/coding.c index 32da72ab626..78e6cff7078 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7970,7 +7970,7 @@ wchar_t * to_unicode (Lisp_Object str, Lisp_Object *buf) { *buf = code_convert_string_norecord (str, Qutf_16le, 1); - /* We need to make a another copy (in addition to the one made by + /* We need to make another copy (in addition to the one made by code_convert_string_norecord) to ensure that the final string is _doubly_ zero terminated --- that is, that the string is terminated by two zero bytes and one utf-16le null character. From 8c39e8217487c352f824c7770430170a877cec07 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 9 Mar 2013 12:19:41 -0800 Subject: [PATCH 07/95] * admin/admin.el (add-release-logs): Provide interactive defaults. Allow specification of the release date. --- admin/ChangeLog | 5 +++++ admin/admin.el | 23 +++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index 6a636091a7c..a47d0d3c2dc 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2013-03-09 Glenn Morris + + * admin.el (add-release-logs): Provide interactive defaults. + Allow specification of the release date. + 2013-03-05 Paul Eggert * notes/unicode: Add notes about Emacs source file encoding. diff --git a/admin/admin.el b/admin/admin.el index e815dfade47..e7ef222f424 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -28,25 +28,32 @@ (defvar add-log-time-format) ; in add-log -(defun add-release-logs (root version) +(defun add-release-logs (root version &optional date) "Add \"Version VERSION released.\" change log entries in ROOT. -Root must be the root of an Emacs source tree." - (interactive "DEmacs root directory: \nNVersion number: ") +Root must be the root of an Emacs source tree. +Optional argument DATE is the release date, default today." + (interactive (list (read-directory-name "Emacs root directory: ") + (read-string "Version number: " + (format "%s.%s" emacs-major-version + emacs-minor-version)) + (read-string "Release date: " + (progn (require 'add-log) + (funcall add-log-time-format))))) (setq root (expand-file-name root)) (unless (file-exists-p (expand-file-name "src/emacs.c" root)) (error "%s doesn't seem to be the root of an Emacs source tree" root)) (require 'add-log) + (or date (setq date (funcall add-log-time-format))) (let* ((logs (process-lines "find" root "-name" "ChangeLog")) (entry (format "%s %s <%s>\n\n\t* Version %s released.\n\n" - (funcall add-log-time-format) + date (or add-log-full-name (user-full-name)) (or add-log-mailing-address user-mail-address) version))) (dolist (log logs) - (unless (string-match "/gnus/" log) - (find-file log) - (goto-char (point-min)) - (insert entry))))) + (find-file log) + (goto-char (point-min)) + (insert entry)))) (defun set-version-in-file (root file version rx) (find-file (expand-file-name file root)) From 78cd48e721d04b94b35f6e02e7c1022092bf702e Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 9 Mar 2013 12:22:27 -0800 Subject: [PATCH 08/95] * admin.el: Comment Add missing ChangeLog portion for previous change. --- admin/ChangeLog | 2 +- admin/admin.el | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index a47d0d3c2dc..2d09a749907 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,7 +1,7 @@ 2013-03-09 Glenn Morris * admin.el (add-release-logs): Provide interactive defaults. - Allow specification of the release date. + Allow specification of the release date. Don't exclude gnus/. 2013-03-05 Paul Eggert diff --git a/admin/admin.el b/admin/admin.el index e7ef222f424..fd9bde29f46 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -28,6 +28,10 @@ (defvar add-log-time-format) ; in add-log +;; Does this information need to be in every ChangeLog, as opposed to +;; just the top-level one? Only if you allow changes the same +;; day as the release. +;; http://lists.gnu.org/archive/html/emacs-devel/2013-03/msg00161.html (defun add-release-logs (root version &optional date) "Add \"Version VERSION released.\" change log entries in ROOT. Root must be the root of an Emacs source tree. From f6817529b479b942dc3a30cf091de9d0ca4c58a2 Mon Sep 17 00:00:00 2001 From: Jay Belanger Date: Sat, 9 Mar 2013 17:36:02 -0600 Subject: [PATCH 09/95] * doc/misc/calc.texi (Basic Operations on Units): Streamline some descriptions. --- doc/misc/ChangeLog | 5 +++++ doc/misc/calc.texi | 21 +++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 44a0b7b3211..6a1bfd90c20 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2013-03-09 Jay Belanger + + * calc.texi (Basic Operations on Units): Streamline some + descriptions. + 2013-03-08 Glenn Morris * faq.texi (Top): Don't say this was updated @today. diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi index 0bf7833ec34..44462d1d5a8 100644 --- a/doc/misc/calc.texi +++ b/doc/misc/calc.texi @@ -27859,7 +27859,8 @@ while typing @kbd{u c au/yr @key{RET}} produces If the units you request are inconsistent with the original units, the number will be converted into your units times whatever ``remainder'' -units are left over. For example, converting @samp{55 mph} into acres +units are left over. (This can be disabled; @pxref{Customizing Calc}.) +For example, converting @samp{55 mph} into acres produces @samp{6.08e-3 acre / m s}. (Recall that multiplication binds more strongly than division in Calc formulas, so the units here are acres per meter-second.) Remainder units are expressed in terms of @@ -27875,12 +27876,6 @@ change the @samp{s} to @samp{ms} to get @samp{9.8e-4 cm/ms^2}. The ``remainder unit'' @samp{cm} is left alone rather than being changed to the base unit @samp{m}. -If you want to disallow using inconsistent units, you can set the -customizable variable @code{calc-ensure-consistent-units} to @code{t} -(@pxref{Customizing Calc}). In this case, if you request units which -are inconsistent with the original units, you will be warned about it -and no conversion will occur. - You can use explicit unit conversion instead of the @kbd{u s} command to gain more control over the units of the result of an expression. For example, given @samp{5 m + 23 mm}, you can type @kbd{u c m} or @@ -27916,13 +27911,11 @@ prompt first for the old units which this value should be considered to have, then for the new units. (If the value on the stack can be simplified so that it doesn't contain any units, like @samp{ft/in} can be simplified to 12, then @kbd{u c} will still prompt for both old -units and new units. You can ignore the prompt for old units with -@key{RET}, or turn off the prompt by setting the customizable variable -@code{calc-allow-units-as-numbers} to @code{nil}; -@pxref{Customizing Calc}.) Assuming the old and new units you give are -consistent with each other, the result also will not contain any -units. For example, @kbd{@w{u c} cm @key{RET} in @key{RET}} converts -the number 2 on the stack to 5.08. +units and new units. This can be disabled; @pxref{Customizing Calc}.) +Assuming the old and new units you give are consistent with each +other, the result also will not contain any units. For example, +@kbd{@w{u c} cm @key{RET} in @key{RET}} converts the number 2 on the +stack to 5.08. @kindex u b @pindex calc-base-units From 9e4a1ee063273a17fff2efacf4620986e2410562 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 9 Mar 2013 18:14:29 -0800 Subject: [PATCH 10/95] Add note about release candidate --- admin/make-tarball.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index cfae61e092f..85cd505a28d 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -50,6 +50,14 @@ General steps (for each step, check for possible errors): For a pretest, start at version .90. After .99, use .990 (so that it sorts). + The final pretest should be a release candidate. Set the version + number to that of the actual release. Pick a date about a week + from now when you intend to make the release. Use M-x add-release-logs + to add the ChangeLog entries for that date to the tar file (but + not yet to the repository). Name the tar file as + emacs-XX-Y-rc1.tar. If all goes well in the following week, you + can simply rename the file and use it for the actual release. + 5. autoreconf -i -I m4 --force make bootstrap From 6b88120b111fb83db8d9854493a0e269b17adb11 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 9 Mar 2013 18:15:08 -0800 Subject: [PATCH 11/95] Fix typo in previous --- admin/make-tarball.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/make-tarball.txt b/admin/make-tarball.txt index 85cd505a28d..005c6694228 100644 --- a/admin/make-tarball.txt +++ b/admin/make-tarball.txt @@ -55,7 +55,7 @@ General steps (for each step, check for possible errors): from now when you intend to make the release. Use M-x add-release-logs to add the ChangeLog entries for that date to the tar file (but not yet to the repository). Name the tar file as - emacs-XX-Y-rc1.tar. If all goes well in the following week, you + emacs-XX.Y-rc1.tar. If all goes well in the following week, you can simply rename the file and use it for the actual release. 5. autoreconf -i -I m4 --force From 1a7bceef7a8cb7f32872e987d8786965f3ed26f0 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 9 Mar 2013 18:18:49 -0800 Subject: [PATCH 12/95] * admin/admin.el (add-release-logs): Use UTC for release date. --- admin/ChangeLog | 4 ++++ admin/admin.el | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/admin/ChangeLog b/admin/ChangeLog index 2d09a749907..a12e6c05e64 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,7 @@ +2013-03-10 Glenn Morris + + * admin.el (add-release-logs): Use UTC for release date. + 2013-03-09 Glenn Morris * admin.el (add-release-logs): Provide interactive defaults. diff --git a/admin/admin.el b/admin/admin.el index fd9bde29f46..fc793c17bd2 100644 --- a/admin/admin.el +++ b/admin/admin.el @@ -42,12 +42,14 @@ Optional argument DATE is the release date, default today." emacs-minor-version)) (read-string "Release date: " (progn (require 'add-log) - (funcall add-log-time-format))))) + (let ((add-log-time-zone-rule t)) + (funcall add-log-time-format)))))) (setq root (expand-file-name root)) (unless (file-exists-p (expand-file-name "src/emacs.c" root)) (error "%s doesn't seem to be the root of an Emacs source tree" root)) (require 'add-log) - (or date (setq date (funcall add-log-time-format))) + (or date (setq date (let ((add-log-time-zone-rule t)) + (funcall add-log-time-format)))) (let* ((logs (process-lines "find" root "-name" "ChangeLog")) (entry (format "%s %s <%s>\n\n\t* Version %s released.\n\n" date From 45ba025e53f8d91f7b46dfabafa5c8aafe4906dc Mon Sep 17 00:00:00 2001 From: Jambunathan K Date: Sun, 10 Mar 2013 14:14:07 +0530 Subject: [PATCH 13/95] Provide for customizing default regexp in occur commands (Bug#13892). * lisp/replace.el (occur-read-regexp-defaults-function): New var. (occur-read-regexp-defaults): New defun. (occur-read-primary-args): Propagate above change. --- lisp/ChangeLog | 6 ++++++ lisp/replace.el | 22 +++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index df4cf561588..20a3a6e1e50 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-10 Jambunathan K + + * replace.el (occur-read-regexp-defaults-function): New var. + (occur-read-regexp-defaults): New defun. + (occur-read-primary-args): Propagate above change (bug#13892). + 2013-03-09 Stefan Monnier * mouse.el (mouse-drag-track): Remove left-over debugging code. diff --git a/lisp/replace.el b/lisp/replace.el index ceb0fe4a63e..17eea19edd8 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1135,12 +1135,32 @@ which means to discard all text properties." :group 'matching :version "22.1") +(defvar occur-read-regexp-defaults-function + 'occur-read-regexp-defaults + "Function that provides default regexp(s) for occur commands. +This function should take no arguments and return one of nil, a +regexp or a list of regexps for use with occur commands - +`occur', `multi-occur' and `multi-occur-in-matching-buffers'. +The return value of this function is used as DEFAULTS param of +`read-regexp' while executing the occur command. This function +is called only during interactive use. + +For example, to check for occurrence of symbol at point use + + \(setq occur-read-regexp-defaults-function + 'find-tag-default-as-regexp\).") + +(defun occur-read-regexp-defaults () + "Return the latest regexp from `regexp-history'. +See `occur-read-regexp-defaults-function' for details." + (car regexp-history)) + (defun occur-read-primary-args () (let* ((perform-collect (consp current-prefix-arg)) (regexp (read-regexp (if perform-collect "Collect strings matching regexp" "List lines matching regexp") - (car regexp-history)))) + (funcall occur-read-regexp-defaults-function)))) (list regexp (if perform-collect ;; Perform collect operation From c230dd7d89730f565df77046d0666d2082e386ee Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Sun, 10 Mar 2013 23:36:35 +0900 Subject: [PATCH 14/95] On file insertion, skip decoding if all bytes are ASCII. --- src/ChangeLog | 14 ++++++++++++++ src/coding.c | 43 +++++++++++++++++++++++++++++++++++++++---- src/insdel.c | 19 ++++++++++++------- src/lisp.h | 4 ++++ 4 files changed, 69 insertions(+), 11 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index ae25a3c5d00..2c77950c262 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2013-03-10 handa + + * lisp.h (adjust_after_replace): Extern it. + + * coding.c (detect_coding): Cound the heading ASCII bytes in the + case of detection for coding_category_utf_8_auto. + (decode_coding_gap) [not CODING_DISABLE_ASCII_OPTIMIZATION]: Skip + decoding if all bytes are ASCII. + + * insdel.c (adjust_after_replace): Make it public. New arg + text_at_gap_tail. + (adjust_after_insert): Call adjust_after_replace with the new arg + value 0. + 2013-03-09 Stefan Monnier * keyboard.h (EVENT_START, EVENT_END, POSN_WINDOW, POSN_POSN) diff --git a/src/coding.c b/src/coding.c index 32da72ab626..f33b5e7c7d5 100644 --- a/src/coding.c +++ b/src/coding.c @@ -6349,7 +6349,12 @@ detect_coding (struct coding_system *coding) coding_systems = AREF (CODING_ID_ATTRS (coding->id), coding_attr_utf_bom); detect_info.found = detect_info.rejected = 0; - coding->head_ascii = 0; + for (src = coding->source; src < src_end; src++) + { + if (*src & 0x80) + break; + } + coding->head_ascii = src - coding->source; if (CONSP (coding_systems) && detect_coding_utf_8 (coding, &detect_info)) { @@ -7487,8 +7492,6 @@ decode_coding_gap (struct coding_system *coding, ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object attrs; - code_conversion_save (0, 0); - coding->src_object = Fcurrent_buffer (); coding->src_chars = chars; coding->src_bytes = bytes; @@ -7502,13 +7505,45 @@ decode_coding_gap (struct coding_system *coding, if (CODING_REQUIRE_DETECTION (coding)) detect_coding (coding); + attrs = CODING_ID_ATTRS (coding->id); +#ifndef CODING_DISABLE_ASCII_OPTIMIZATION + if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) + && NILP (CODING_ATTR_POST_READ (attrs)) + && NILP (get_translation_table (attrs, 0, NULL))) + { + /* We can skip the conversion if all source bytes are ASCII. */ + if (coding->head_ascii < 0) + { + /* We have not yet counted the number of ASCII bytes at the + head of the source. Do it now. */ + const unsigned char *src, *src_end; + + coding_set_source (coding); + src_end = coding->source + coding->src_bytes; + for (src = coding->source; src < src_end; src++) + { + if (*src & 0x80) + break; + } + coding->head_ascii = src - coding->source; + } + if (coding->src_bytes == coding->head_ascii) + { + /* No need of conversion. Use the data in the gap as is. */ + coding->produced_char = chars; + coding->produced = bytes; + adjust_after_replace (PT, PT_BYTE, Qnil, chars, bytes, 1); + return; + } + } +#endif /* not CODING_DISABLE_ASCII_OPTIMIZATION */ + code_conversion_save (0, 0); coding->mode |= CODING_MODE_LAST_BLOCK; current_buffer->text->inhibit_shrinking = 1; decode_coding (coding); current_buffer->text->inhibit_shrinking = 0; - attrs = CODING_ID_ATTRS (coding->id); if (! NILP (CODING_ATTR_POST_READ (attrs))) { ptrdiff_t prev_Z = Z, prev_Z_BYTE = Z_BYTE; diff --git a/src/insdel.c b/src/insdel.c index fc5a4576dc2..992cebb04b0 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1162,14 +1162,16 @@ insert_from_buffer_1 (struct buffer *buf, /* Record undo information and adjust markers and position keepers for a replacement of a text PREV_TEXT at FROM to a new text of LEN - chars (LEN_BYTE bytes) which resides in the gap just after - GPT_ADDR. + chars (LEN_BYTE bytes). If TEXT_AT_GAP_TAIL is zero, the new text + resides in the gap just after GPT_BYTE. Otherwise, the text + resides at the gap tail; i.e. at (GAP_END_ADDR - LEN_BNYTE). PREV_TEXT nil means the new text was just inserted. */ -static void +void adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, - Lisp_Object prev_text, ptrdiff_t len, ptrdiff_t len_byte) + Lisp_Object prev_text, ptrdiff_t len, ptrdiff_t len_byte, + int text_at_gap_tail) { ptrdiff_t nchars_del = 0, nbytes_del = 0; @@ -1189,8 +1191,11 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, GAP_SIZE -= len_byte; ZV += len; Z+= len; ZV_BYTE += len_byte; Z_BYTE += len_byte; - GPT += len; GPT_BYTE += len_byte; - if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ + if (! text_at_gap_tail) + { + GPT += len; GPT_BYTE += len_byte; + if (GAP_SIZE > 0) *(GPT_ADDR) = 0; /* Put an anchor. */ + } if (nchars_del > 0) adjust_markers_for_replace (from, from_byte, nchars_del, nbytes_del, @@ -1245,7 +1250,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte, GPT -= len; GPT_BYTE -= len_byte; ZV -= len; ZV_BYTE -= len_byte; Z -= len; Z_BYTE -= len_byte; - adjust_after_replace (from, from_byte, Qnil, newlen, len_byte); + adjust_after_replace (from, from_byte, Qnil, newlen, len_byte, 0); } /* Replace the text from character positions FROM to TO with NEW, diff --git a/src/lisp.h b/src/lisp.h index e4993866b1f..171292f942e 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2900,6 +2900,10 @@ extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t, extern void modify_region_1 (ptrdiff_t, ptrdiff_t, bool); extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); +extern void adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, + Lisp_Object prev_text, + ptrdiff_t len, ptrdiff_t len_byte, + int text_at_gap_tail); extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t, From 7d051e215477753b813864caa23c1009c7692bda Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Mon, 11 Mar 2013 00:06:04 +0900 Subject: [PATCH 15/95] Fix previous change. --- src/coding.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/coding.c b/src/coding.c index 98af4ddcef7..d6560a92b70 100644 --- a/src/coding.c +++ b/src/coding.c @@ -7509,7 +7509,9 @@ decode_coding_gap (struct coding_system *coding, #ifndef CODING_DISABLE_ASCII_OPTIMIZATION if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs)) && NILP (CODING_ATTR_POST_READ (attrs)) - && NILP (get_translation_table (attrs, 0, NULL))) + && NILP (get_translation_table (attrs, 0, NULL)) + && (inhibit_eol_conversion + || EQ (CODING_ID_EOL_TYPE (coding->id), Qunix))) { /* We can skip the conversion if all source bytes are ASCII. */ if (coding->head_ascii < 0) From 138c0ae83dcf3daede8d8a12459c9fca13d15fac Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 10 Mar 2013 19:28:04 +0200 Subject: [PATCH 16/95] Use macros from dispextern.h where appropriate. src/xdisp.c (display_tool_bar_line, redisplay_tool_bar) (redisplay_internal, set_cursor_from_row, try_window) (try_window_id, dump_glyph_row, extend_face_to_end_of_line) (display_line, notice_overwritten_cursor) (mouse_face_from_buffer_pos, note_mouse_highlight): Use MATRIX_ROW_DISPLAYS_TEXT_P. (note_mouse_highlight): Use MATRIX_ROW_GLYPH_START. (mouse_face_from_string_pos, fast_find_string_pos): Use MATRIX_ROW_VPOS. src/xfns.c (Fx_show_tip): Use MATRIX_ROW_DISPLAYS_TEXT_P. src/w32fns.c (Fx_show_tip): Use MATRIX_ROW_DISPLAYS_TEXT_P. src/xdisp.c (try_cursor_movement): Use MATRIX_ROW and MATRIX_MODE_LINE_ROW. src/dispnew.c (update_window): Use MATRIX_ROW and MATRIX_MODE_LINE_ROW. --- src/ChangeLog | 21 +++++++++++++++++++ src/dispnew.c | 4 ++-- src/w32fns.c | 4 ++-- src/xdisp.c | 56 ++++++++++++++++++++++++++------------------------- src/xfns.c | 4 ++-- 5 files changed, 56 insertions(+), 33 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 2c77950c262..b58bbc0a525 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,24 @@ +2013-03-10 Eli Zaretskii + + * xdisp.c (display_tool_bar_line, redisplay_tool_bar) + (redisplay_internal, set_cursor_from_row, try_window) + (try_window_id, dump_glyph_row, extend_face_to_end_of_line) + (display_line, notice_overwritten_cursor) + (mouse_face_from_buffer_pos, note_mouse_highlight): Use + MATRIX_ROW_DISPLAYS_TEXT_P. + (note_mouse_highlight): Use MATRIX_ROW_GLYPH_START. + (mouse_face_from_string_pos, fast_find_string_pos): Use + MATRIX_ROW_VPOS. + + * xfns.c (Fx_show_tip): Use MATRIX_ROW_DISPLAYS_TEXT_P. + + * w32fns.c (Fx_show_tip): Use MATRIX_ROW_DISPLAYS_TEXT_P. + + * xdisp.c (try_cursor_movement): Use MATRIX_ROW and + MATRIX_MODE_LINE_ROW. + + * dispnew.c (update_window): Use MATRIX_ROW and MATRIX_MODE_LINE_ROW. + 2013-03-10 handa * lisp.h (adjust_after_replace): Extern it. diff --git a/src/dispnew.c b/src/dispnew.c index f9fed7de406..9335365bc71 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -3392,8 +3392,8 @@ update_window (struct window *w, bool force_p) rif->update_window_begin_hook (w); yb = window_text_bottom_y (w); - row = desired_matrix->rows; - end = row + desired_matrix->nrows - 1; + row = MATRIX_ROW (desired_matrix, 0); + end = MATRIX_MODE_LINE_ROW (desired_matrix); /* Take note of the header line, if there is one. We will update it below, after updating all of the window's lines. */ diff --git a/src/w32fns.c b/src/w32fns.c index 6fd980c6b70..56cc1f37d08 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5824,7 +5824,7 @@ Text larger than the specified size is clipped. */) int row_width; /* Stop at the first empty row at the end. */ - if (!row->enabled_p || !row->displays_text_p) + if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row)) break; /* Let the row go over the full width of the frame. */ @@ -5885,7 +5885,7 @@ Text larger than the specified size is clipped. */) struct glyph *last; int row_width; - if (!row->enabled_p || !row->displays_text_p) + if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row)) break; row->full_width_p = 1; row_width = row->pixel_width; diff --git a/src/xdisp.c b/src/xdisp.c index c6e204702ce..511a5eeb2c3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -11711,7 +11711,8 @@ display_tool_bar_line (struct it *it, int height) no additional border below the possibly empty tool-bar lines. So to make the extra empty lines look "normal", we have to use the tool-bar face for the border too. */ - if (!row->displays_text_p && !EQ (Vauto_resize_tool_bars, Qgrow_only)) + if (!MATRIX_ROW_DISPLAYS_TEXT_P (row) + && !EQ (Vauto_resize_tool_bars, Qgrow_only)) it->face_id = DEFAULT_FACE_ID; extend_face_to_end_of_line (it); @@ -11732,7 +11733,7 @@ display_tool_bar_line (struct it *it, int height) compute_line_metrics (it); /* If line is empty, make it occupy the rest of the tool-bar. */ - if (!row->displays_text_p) + if (!MATRIX_ROW_DISPLAYS_TEXT_P (row)) { row->height = row->phys_height = it->last_visible_y - row->y; row->visible_height = row->height; @@ -11947,13 +11948,13 @@ redisplay_tool_bar (struct frame *f) /* If there are blank lines at the end, except for a partially visible blank line at the end that is smaller than FRAME_LINE_HEIGHT, change the tool-bar's height. */ - if (!row->displays_text_p + if (!MATRIX_ROW_DISPLAYS_TEXT_P (row) && row->height >= FRAME_LINE_HEIGHT (f)) change_height_p = 1; /* If row displays tool-bar items, but is partially visible, change the tool-bar's height. */ - if (row->displays_text_p + if (MATRIX_ROW_DISPLAYS_TEXT_P (row) && MATRIX_ROW_BOTTOM_Y (row) > it.last_visible_y && MATRIX_ROW_BOTTOM_Y (row) < max_tool_bar_height) change_height_p = 1; @@ -13144,7 +13145,7 @@ redisplay_internal (void) /* If this row displays text now but previously didn't, or vice versa, w->window_end_vpos may have to be adjusted. */ - if ((it.glyph_row - 1)->displays_text_p) + if (MATRIX_ROW_DISPLAYS_TEXT_P (it.glyph_row - 1)) { if (XFASTINT (w->window_end_vpos) < this_line_vpos) wset_window_end_vpos (w, make_number (this_line_vpos)); @@ -13754,7 +13755,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, /* Skip over glyphs not having an object at the start and the end of the row. These are special glyphs like truncation marks on terminal frames. */ - if (row->displays_text_p) + if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) { if (!row->reversed_p) { @@ -14931,8 +14932,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste we would rather display cursor in the next line. */ while (MATRIX_ROW_BOTTOM_Y (row) < last_y && MATRIX_ROW_END_CHARPOS (row) == PT - && row < w->current_matrix->rows - + w->current_matrix->nrows - 1 + && row < MATRIX_MODE_LINE_ROW (w->current_matrix) && MATRIX_ROW_START_CHARPOS (row+1) == PT && !cursor_row_p (row)) ++row; @@ -16171,8 +16171,8 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) wset_window_end_vpos (w, make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix))); eassert - (MATRIX_ROW (w->desired_matrix, - XFASTINT (w->window_end_vpos))->displays_text_p); + (MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->desired_matrix, + XFASTINT (w->window_end_vpos)))); } else { @@ -17581,7 +17581,7 @@ try_window_id (struct window *w) struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos); /* If last_row is the window end line, it should display text. */ - eassert (last_row->displays_text_p); + eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_row)); /* If window end line was partially visible before, begin displaying at that line. Otherwise begin displaying with the @@ -17628,7 +17628,7 @@ try_window_id (struct window *w) matrix. Set row to the last row displaying text in current matrix starting at first_unchanged_at_end_row, after scrolling. */ - eassert (first_unchanged_at_end_row->displays_text_p); + eassert (MATRIX_ROW_DISPLAYS_TEXT_P (first_unchanged_at_end_row)); row = find_last_row_displaying_text (w->current_matrix, &it, first_unchanged_at_end_row); eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); @@ -17682,10 +17682,10 @@ try_window_id (struct window *w) { if (desired_row->enabled_p) { - if (desired_row->displays_text_p) + if (MATRIX_ROW_DISPLAYS_TEXT_P (desired_row)) row = desired_row; } - else if (current_row->displays_text_p) + else if (MATRIX_ROW_DISPLAYS_TEXT_P (current_row)) row = current_row; } @@ -17865,7 +17865,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs) row->truncated_on_right_p, row->continued_p, MATRIX_ROW_CONTINUATION_LINE_P (row), - row->displays_text_p, + MATRIX_ROW_DISPLAYS_TEXT_P (row), row->ends_at_zv_p, row->fill_line_p, row->ends_in_middle_of_char_p, @@ -18501,7 +18501,7 @@ extend_face_to_end_of_line (struct it *it) face = FACE_FROM_ID (f, it->face_id); if (FRAME_WINDOW_P (f) - && it->glyph_row->displays_text_p + && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row) && face->box == FACE_NO_BOX && face->background == FRAME_BACKGROUND_PIXEL (f) && !face->stipple @@ -19761,7 +19761,7 @@ display_line (struct it *it) mark this glyph row as the one containing the overlay arrow. This is clearly a mess with variable size fonts. It would be better to let it be displayed like cursors under X. */ - if ((row->displays_text_p || !overlay_arrow_seen) + if ((MATRIX_ROW_DISPLAYS_TEXT_P (row) || !overlay_arrow_seen) && (overlay_arrow_string = overlay_arrow_at_row (it, row), !NILP (overlay_arrow_string))) { @@ -19861,7 +19861,7 @@ display_line (struct it *it) if (it->glyph_row < MATRIX_BOTTOM_TEXT_ROW (it->w->desired_matrix, it->w)) it->glyph_row->reversed_p = row->reversed_p; it->start = row->end; - return row->displays_text_p; + return MATRIX_ROW_DISPLAYS_TEXT_P (row); #undef RECORD_MAX_MIN_POS } @@ -25660,7 +25660,7 @@ notice_overwritten_cursor (struct window *w, enum glyph_row_area area, if (w->phys_cursor.vpos < 0 || w->phys_cursor.vpos >= w->current_matrix->nrows || (row = w->current_matrix->rows + w->phys_cursor.vpos, - !(row->enabled_p && row->displays_text_p))) + !(row->enabled_p && MATRIX_ROW_DISPLAYS_TEXT_P (row)))) return; if (row->cursor_in_fringe_p) @@ -26595,7 +26595,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, x = r1->x; /* Skip truncation glyphs at the start of the glyph row. */ - if (r1->displays_text_p) + if (MATRIX_ROW_DISPLAYS_TEXT_P (r1)) for (; glyph < end && INTEGERP (glyph->object) && glyph->charpos < 0; @@ -26646,7 +26646,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, glyph = end + r1->used[TEXT_AREA]; /* Skip truncation glyphs at the start of the glyph row. */ - if (r1->displays_text_p) + if (MATRIX_ROW_DISPLAYS_TEXT_P (r1)) for (; glyph > end && INTEGERP (glyph->object) && glyph->charpos < 0; @@ -26897,7 +26897,7 @@ fast_find_string_pos (struct window *w, ptrdiff_t pos, Lisp_Object object, } *y = best_row->y; - *vpos = best_row - w->current_matrix->rows; + *vpos = MATRIX_ROW_VPOS (best_row, w->current_matrix); } return best_glyph != NULL; @@ -26935,7 +26935,8 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, if (EQ (g->object, object) && startpos <= g->charpos && g->charpos <= endpos) { - hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; + hlinfo->mouse_face_beg_row + = MATRIX_ROW_VPOS (r, w->current_matrix); hlinfo->mouse_face_beg_y = r->y; hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; hlinfo->mouse_face_beg_x = gx; @@ -26953,7 +26954,8 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, if (EQ ((g-1)->object, object) && startpos <= (g-1)->charpos && (g-1)->charpos <= endpos) { - hlinfo->mouse_face_beg_row = r - w->current_matrix->rows; + hlinfo->mouse_face_beg_row + = MATRIX_ROW_VPOS (r, w->current_matrix); hlinfo->mouse_face_beg_y = r->y; hlinfo->mouse_face_beg_col = g - r->glyphs[TEXT_AREA]; for (gx = r->x, g1 = r->glyphs[TEXT_AREA]; g1 < g; ++g1) @@ -26992,7 +26994,7 @@ mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, r--; /* Set the end row and its vertical pixel coordinate. */ - hlinfo->mouse_face_end_row = r - w->current_matrix->rows; + hlinfo->mouse_face_end_row = MATRIX_ROW_VPOS (r, w->current_matrix); hlinfo->mouse_face_end_y = r->y; /* Compute and set the end column and the end column's horizontal @@ -27676,7 +27678,7 @@ note_mouse_highlight (struct frame *f, int x, int y) /* Clear mouse face if X/Y not over text. */ if (glyph == NULL || area != TEXT_AREA - || !MATRIX_ROW (w->current_matrix, vpos)->displays_text_p + || !MATRIX_ROW_DISPLAYS_TEXT_P (MATRIX_ROW (w->current_matrix, vpos)) /* Glyph's OBJECT is an integer for glyphs inserted by the display engine for its internal purposes, like truncation and continuation glyphs and blanks beyond the end of @@ -27688,7 +27690,7 @@ note_mouse_highlight (struct frame *f, int x, int y) all beyond the end of text. Treat such stretch glyphs like we do with NULL glyphs in L2R rows. */ || (MATRIX_ROW (w->current_matrix, vpos)->reversed_p - && glyph == MATRIX_ROW (w->current_matrix, vpos)->glyphs[TEXT_AREA] + && glyph == MATRIX_ROW_GLYPH_START (w->current_matrix, vpos) && glyph->type == STRETCH_GLYPH && glyph->avoid_cursor_p)) { diff --git a/src/xfns.c b/src/xfns.c index 5c93b8ef4da..a6a56c8c5e1 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5067,7 +5067,7 @@ Text larger than the specified size is clipped. */) int row_width; /* Stop at the first empty row at the end. */ - if (!row->enabled_p || !row->displays_text_p) + if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row)) break; /* Let the row go over the full width of the frame. */ @@ -5126,7 +5126,7 @@ Text larger than the specified size is clipped. */) struct glyph *last; int row_width; - if (!row->enabled_p || !row->displays_text_p) + if (!row->enabled_p || !MATRIX_ROW_DISPLAYS_TEXT_P (row)) break; row->full_width_p = 1; row_width = row->pixel_width; From d0ebc8269faa78a0f91423ec75a60a36dacf7723 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 17:37:42 -0400 Subject: [PATCH 17/95] * lisp/comint.el: Use with-silent-modifications. (comint-send-input, comint-snapshot-last-prompt) (comint-output-filter, comint-update-fence): Use with-silent-modifications. --- lisp/ChangeLog | 8 ++++- lisp/comint.el | 94 +++++++++++++++++++++++++------------------------- 2 files changed, 54 insertions(+), 48 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 20a3a6e1e50..8d2fdc9fcd6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-10 Stefan Monnier + + * comint.el (comint-send-input, comint-snapshot-last-prompt) + (comint-output-filter, comint-update-fence): + Use with-silent-modifications. + 2013-03-10 Jambunathan K * replace.el (occur-read-regexp-defaults-function): New var. @@ -21,7 +27,7 @@ Use Tramp default handler. [file-acl, file-selinux-context, process-file, set-file-acl]: [set-file-modes, set-file-selinux-context, shell-command]: - [start-file-process ]: Remove handler. + [start-file-process]: Remove handler. [verify-visited-file-modtime]: New handler. (tramp-gvfs-dbus-string-to-byte-array) (tramp-gvfs-dbus-byte-array-to-string): New defuns. Replace all diff --git a/lisp/comint.el b/lisp/comint.el index 21bd732b43c..93db4e24f2a 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -1805,28 +1805,28 @@ Similarly for Soar, Scheme, etc." (concat input "\n"))) (let ((beg (marker-position pmark)) - (end (if no-newline (point) (1- (point)))) - (inhibit-modification-hooks t)) - (when (> end beg) - (add-text-properties beg end - '(front-sticky t - font-lock-face comint-highlight-input)) - (unless comint-use-prompt-regexp - ;; Give old user input a field property of `input', to - ;; distinguish it from both process output and unsent - ;; input. The terminating newline is put into a special - ;; `boundary' field to make cursor movement between input - ;; and output fields smoother. - (add-text-properties - beg end - '(mouse-face highlight - help-echo "mouse-2: insert after prompt as new input")))) - (unless (or no-newline comint-use-prompt-regexp) - ;; Cover the terminating newline - (add-text-properties end (1+ end) - '(rear-nonsticky t - field boundary - inhibit-line-move-field-capture t)))) + (end (if no-newline (point) (1- (point))))) + (with-silent-modifications + (when (> end beg) + (add-text-properties beg end + '(front-sticky t + font-lock-face comint-highlight-input)) + (unless comint-use-prompt-regexp + ;; Give old user input a field property of `input', to + ;; distinguish it from both process output and unsent + ;; input. The terminating newline is put into a special + ;; `boundary' field to make cursor movement between input + ;; and output fields smoother. + (add-text-properties + beg end + '(mouse-face highlight + help-echo "mouse-2: insert after prompt as new input")))) + (unless (or no-newline comint-use-prompt-regexp) + ;; Cover the terminating newline + (add-text-properties end (1+ end) + '(rear-nonsticky t + field boundary + inhibit-line-move-field-capture t))))) (comint-snapshot-last-prompt) @@ -1909,11 +1909,12 @@ See `comint-carriage-motion' for details.") Freeze its attributes in place, even when more input comes along and moves the prompt overlay." (when comint-last-prompt-overlay - (let ((inhibit-read-only t) - (inhibit-modification-hooks t)) - (add-text-properties (overlay-start comint-last-prompt-overlay) - (overlay-end comint-last-prompt-overlay) - (overlay-properties comint-last-prompt-overlay))))) + (let ((inhibit-read-only t)) + (with-silent-modifications + (add-text-properties + (overlay-start comint-last-prompt-overlay) + (overlay-end comint-last-prompt-overlay) + (overlay-properties comint-last-prompt-overlay)))))) (defun comint-carriage-motion (start end) "Interpret carriage control characters in the region from START to END. @@ -2036,11 +2037,10 @@ Make backspaces delete the previous character." (run-hook-with-args 'comint-output-filter-functions string) (set-marker saved-point (point)) - (goto-char (process-mark process)) ; in case a filter moved it + (goto-char (process-mark process)) ; In case a filter moved it. (unless comint-use-prompt-regexp - (let ((inhibit-read-only t) - (inhibit-modification-hooks t)) + (with-silent-modifications (add-text-properties comint-last-output-start (point) '(front-sticky (field inhibit-line-move-field-capture) @@ -2051,16 +2051,16 @@ Make backspaces delete the previous character." ;; Highlight the prompt, where we define `prompt' to mean ;; the most recent output that doesn't end with a newline. (let ((prompt-start (save-excursion (forward-line 0) (point))) - (inhibit-read-only t) - (inhibit-modification-hooks t)) + (inhibit-read-only t)) (when comint-prompt-read-only - (or (= (point-min) prompt-start) - (get-text-property (1- prompt-start) 'read-only) - (put-text-property - (1- prompt-start) prompt-start 'read-only 'fence)) - (add-text-properties - prompt-start (point) - '(read-only t rear-nonsticky t front-sticky (read-only)))) + (with-silent-modifications + (or (= (point-min) prompt-start) + (get-text-property (1- prompt-start) 'read-only) + (put-text-property + (1- prompt-start) prompt-start 'read-only 'fence)) + (add-text-properties + prompt-start (point) + '(read-only t rear-nonsticky t front-sticky (read-only))))) (unless (and (bolp) (null comint-last-prompt-overlay)) ;; Need to create or move the prompt overlay (in the case ;; where there is no prompt ((bolp) == t), we still do @@ -2655,16 +2655,16 @@ read-only property of `fence', unless it already is read-only. If the character after point does not have a front-sticky read-only property, any read-only property of `fence' on the preceding newline is removed." - (let* ((pt (point)) (lst (get-text-property pt 'front-sticky)) - (inhibit-modification-hooks t)) + (let* ((pt (point)) (lst (get-text-property pt 'front-sticky))) (and (bolp) (not (bobp)) - (if (and (get-text-property pt 'read-only) - (if (listp lst) (memq 'read-only lst) t)) - (unless (get-text-property (1- pt) 'read-only) - (put-text-property (1- pt) pt 'read-only 'fence)) - (when (eq (get-text-property (1- pt) 'read-only) 'fence) - (remove-list-of-text-properties (1- pt) pt '(read-only))))))) + (with-silent-modifications + (if (and (get-text-property pt 'read-only) + (if (listp lst) (memq 'read-only lst) t)) + (unless (get-text-property (1- pt) 'read-only) + (put-text-property (1- pt) pt 'read-only 'fence)) + (when (eq (get-text-property (1- pt) 'read-only) 'fence) + (remove-list-of-text-properties (1- pt) pt '(read-only)))))))) (defun comint-kill-whole-line (&optional count) "Kill current line, ignoring read-only and field properties. From 33f5bc1cbc22e6b6b600f219aab0fdc4f987eec7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 17:39:11 -0400 Subject: [PATCH 18/95] * lisp/whitespace.el (whitespace-enable-predicate): New variable. (whitespace-enable-predicate): Use it. --- lisp/ChangeLog | 3 +++ lisp/whitespace.el | 44 +++++++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8d2fdc9fcd6..4add4d9383f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2013-03-10 Stefan Monnier + * whitespace.el (whitespace-enable-predicate): New variable. + (whitespace-enable-predicate): Use it. + * comint.el (comint-send-input, comint-snapshot-last-prompt) (comint-output-filter, comint-update-fence): Use with-silent-modifications. diff --git a/lisp/whitespace.el b/lisp/whitespace.el index ed7edbc5a68..975b89f2fc2 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -1145,29 +1145,31 @@ See also `whitespace-style', `whitespace-newline' and (unless whitespace-mode (whitespace-turn-off))))))) +(defvar whitespace-enable-predicate + (lambda () + (and (cond + ((eq whitespace-global-modes t)) + ((listp whitespace-global-modes) + (if (eq (car-safe whitespace-global-modes) 'not) + (not (memq major-mode (cdr whitespace-global-modes))) + (memq major-mode whitespace-global-modes))) + (t nil)) + ;; ...we have a display (we're running a batch job) + (not noninteractive) + ;; ...the buffer is not internal (name starts with a space) + (not (eq (aref (buffer-name) 0) ?\ )) + ;; ...the buffer is not special (name starts with *) + (or (not (eq (aref (buffer-name) 0) ?*)) + ;; except the scratch buffer. + (string= (buffer-name) "*scratch*")))) + "Predicate to decide which buffers obey `global-whitespace-mode'. +This function is called with no argument and should return non-nil +if the current buffer should obey `global-whitespace-mode'. +This variable is normally modified via `add-function'.") (defun whitespace-turn-on-if-enabled () - (when (cond - ((eq whitespace-global-modes t)) - ((listp whitespace-global-modes) - (if (eq (car-safe whitespace-global-modes) 'not) - (not (memq major-mode (cdr whitespace-global-modes))) - (memq major-mode whitespace-global-modes))) - (t nil)) - (let (inhibit-quit) - ;; Don't turn on whitespace mode if... - (or - ;; ...we don't have a display (we're running a batch job) - noninteractive - ;; ...or if the buffer is invisible (name starts with a space) - (eq (aref (buffer-name) 0) ?\ ) - ;; ...or if the buffer is temporary (name starts with *) - (and (eq (aref (buffer-name) 0) ?*) - ;; except the scratch buffer. - (not (string= (buffer-name) "*scratch*"))) - ;; Otherwise, turn on whitespace mode. - (whitespace-turn-on))))) - + (when (funcall whitespace-enable-predicate) + (whitespace-turn-on))) ;;;###autoload (define-minor-mode global-whitespace-newline-mode From 17f323276b7dea5410d8f495015ebd170ef14091 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 17:40:55 -0400 Subject: [PATCH 19/95] * lisp/emacs-lisp/byte-run.el (dont-compile): Declare obsolete. (with-no-warnings): Use `declare'. --- lisp/ChangeLog | 3 +++ lisp/emacs-lisp/byte-run.el | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4add4d9383f..75fa55da3eb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2013-03-10 Stefan Monnier + * emacs-lisp/byte-run.el (dont-compile): Declare obsolete. + (with-no-warnings): Use `declare'. + * whitespace.el (whitespace-enable-predicate): New variable. (whitespace-enable-predicate): Use it. diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 48bcefaee1a..7e1f89871f1 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -378,7 +378,7 @@ obsolete." (defmacro dont-compile (&rest body) "Like `progn', but the body always runs interpreted (not compiled). If you think you need this, you're probably making a mistake somewhere." - (declare (debug t) (indent 0)) + (declare (debug t) (indent 0) (obsolete nil "24.4")) (list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body))))) @@ -402,9 +402,9 @@ In interpreted code, this is entirely equivalent to `progn'." ;; macroexpansion. (list 'quote (eval (cons 'progn body) lexical-binding))) -(put 'with-no-warnings 'lisp-indent-function 0) (defun with-no-warnings (&rest body) "Like `progn', but prevents compiler warnings in the body." + (declare (indent 0)) ;; The implementation for the interpreter is basically trivial. (car (last body))) From d3e9f3a8431d8d3e132b19f9b5181e8afed2d1db Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 17:44:31 -0400 Subject: [PATCH 20/95] * lisp/term/xterm.el (xterm-function-map): Support format used with formatOtherKeys=1. Fixes: debbugs:13839 --- etc/NEWS | 2 + lisp/ChangeLog | 3 + lisp/term/xterm.el | 214 +++++++++++++++++++++++---------------------- 3 files changed, 114 insertions(+), 105 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 29ff9399930..364dd8bf53a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -264,6 +264,8 @@ file using `set-file-extended-attributes'. * Lisp Changes in Emacs 24.4 +** `dont-compile' is declared obsolete. + ** Support for filesystem notifications. Emacs now supports notifications of filesystem changes, such as creation, modification, and deletion of files. This requires the diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 75fa55da3eb..b609b219fc9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2013-03-10 Stefan Monnier + * term/xterm.el (xterm-function-map): Support format used with + formatOtherKeys=1 (bug#13839). + * emacs-lisp/byte-run.el (dont-compile): Declare obsolete. (with-no-warnings): Use `declare'. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index c03d64a2f54..ecaff7fe3a4 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -251,120 +251,124 @@ The relevant features are: ;; These keys are available in xterm starting from version 216 ;; if the modifyOtherKeys resource is set to 1. + (dolist (bind '((5 9 [C-tab]) + (5 13 [C-return]) + (5 39 [?\C-\']) + (5 44 [?\C-,]) + (5 45 [?\C--]) + (5 46 [?\C-.]) + (5 47 [?\C-/]) + (5 48 [?\C-0]) + (5 49 [?\C-1]) + ;; Not all C-DIGIT keys have a distinct binding. + (5 57 [?\C-9]) + (5 59 [?\C-\;]) + (5 61 [?\C-=]) + (5 92 [?\C-\\]) - (define-key map "\e[27;5;9~" [C-tab]) - (define-key map "\e[27;5;13~" [C-return]) - (define-key map "\e[27;5;39~" [?\C-\']) - (define-key map "\e[27;5;44~" [?\C-,]) - (define-key map "\e[27;5;45~" [?\C--]) - (define-key map "\e[27;5;46~" [?\C-.]) - (define-key map "\e[27;5;47~" [?\C-/]) - (define-key map "\e[27;5;48~" [?\C-0]) - (define-key map "\e[27;5;49~" [?\C-1]) - ;; Not all C-DIGIT keys have a distinct binding. - (define-key map "\e[27;5;57~" [?\C-9]) - (define-key map "\e[27;5;59~" [?\C-\;]) - (define-key map "\e[27;5;61~" [?\C-=]) - (define-key map "\e[27;5;92~" [?\C-\\]) + (6 33 [?\C-!]) + (6 34 [?\C-\"]) + (6 35 [?\C-#]) + (6 36 [?\C-$]) + (6 37 [?\C-%]) + (6 38 [?\C-&]) + (6 40 [?\C-\(]) + (6 41 [?\C-\)]) + (6 42 [?\C-*]) + (6 43 [?\C-+]) + (6 58 [?\C-:]) + (6 60 [?\C-<]) + (6 62 [?\C->]) + (6 63 [(control ??)]) - (define-key map "\e[27;6;33~" [?\C-!]) - (define-key map "\e[27;6;34~" [?\C-\"]) - (define-key map "\e[27;6;35~" [?\C-#]) - (define-key map "\e[27;6;36~" [?\C-$]) - (define-key map "\e[27;6;37~" [?\C-%]) - (define-key map "\e[27;6;38~" [?\C-&]) - (define-key map "\e[27;6;40~" [?\C-(]) - (define-key map "\e[27;6;41~" [?\C-)]) - (define-key map "\e[27;6;42~" [?\C-*]) - (define-key map "\e[27;6;43~" [?\C-+]) - (define-key map "\e[27;6;58~" [?\C-:]) - (define-key map "\e[27;6;60~" [?\C-<]) - (define-key map "\e[27;6;62~" [?\C->]) - (define-key map "\e[27;6;63~" [(control ??)]) + ;; These are the strings emitted for various C-M- + ;; combinations for keyboards whose Meta and Alt + ;; modifiers are on the same key (usually labeled "Alt"). + (13 9 [C-M-tab]) + (13 13 [C-M-return]) - ;; These are the strings emitted for various C-M- combinations - ;; for keyboards that the Meta and Alt modifiers are on the same - ;; key (usually labeled "Alt"). - (define-key map "\e[27;13;9~" [C-M-tab]) - (define-key map "\e[27;13;13~" [C-M-return]) + (13 39 [?\C-\M-\']) + (13 44 [?\C-\M-,]) + (13 45 [?\C-\M--]) + (13 46 [?\C-\M-.]) + (13 47 [?\C-\M-/]) + (13 48 [?\C-\M-0]) + (13 49 [?\C-\M-1]) + (13 50 [?\C-\M-2]) + (13 51 [?\C-\M-3]) + (13 52 [?\C-\M-4]) + (13 53 [?\C-\M-5]) + (13 54 [?\C-\M-6]) + (13 55 [?\C-\M-7]) + (13 56 [?\C-\M-8]) + (13 57 [?\C-\M-9]) + (13 59 [?\C-\M-\;]) + (13 61 [?\C-\M-=]) + (13 92 [?\C-\M-\\]) - (define-key map "\e[27;13;39~" [?\C-\M-\']) - (define-key map "\e[27;13;44~" [?\C-\M-,]) - (define-key map "\e[27;13;45~" [?\C-\M--]) - (define-key map "\e[27;13;46~" [?\C-\M-.]) - (define-key map "\e[27;13;47~" [?\C-\M-/]) - (define-key map "\e[27;13;48~" [?\C-\M-0]) - (define-key map "\e[27;13;49~" [?\C-\M-1]) - (define-key map "\e[27;13;50~" [?\C-\M-2]) - (define-key map "\e[27;13;51~" [?\C-\M-3]) - (define-key map "\e[27;13;52~" [?\C-\M-4]) - (define-key map "\e[27;13;53~" [?\C-\M-5]) - (define-key map "\e[27;13;54~" [?\C-\M-6]) - (define-key map "\e[27;13;55~" [?\C-\M-7]) - (define-key map "\e[27;13;56~" [?\C-\M-8]) - (define-key map "\e[27;13;57~" [?\C-\M-9]) - (define-key map "\e[27;13;59~" [?\C-\M-\;]) - (define-key map "\e[27;13;61~" [?\C-\M-=]) - (define-key map "\e[27;13;92~" [?\C-\M-\\]) + (14 33 [?\C-\M-!]) + (14 34 [?\C-\M-\"]) + (14 35 [?\C-\M-#]) + (14 36 [?\C-\M-$]) + (14 37 [?\C-\M-%]) + (14 38 [?\C-\M-&]) + (14 40 [?\C-\M-\(]) + (14 41 [?\C-\M-\)]) + (14 42 [?\C-\M-*]) + (14 43 [?\C-\M-+]) + (14 58 [?\C-\M-:]) + (14 60 [?\C-\M-<]) + (14 62 [?\C-\M->]) + (14 63 [(control meta ??)]) - (define-key map "\e[27;14;33~" [?\C-\M-!]) - (define-key map "\e[27;14;34~" [?\C-\M-\"]) - (define-key map "\e[27;14;35~" [?\C-\M-#]) - (define-key map "\e[27;14;36~" [?\C-\M-$]) - (define-key map "\e[27;14;37~" [?\C-\M-%]) - (define-key map "\e[27;14;38~" [?\C-\M-&]) - (define-key map "\e[27;14;40~" [?\C-\M-\(]) - (define-key map "\e[27;14;41~" [?\C-\M-\)]) - (define-key map "\e[27;14;42~" [?\C-\M-*]) - (define-key map "\e[27;14;43~" [?\C-\M-+]) - (define-key map "\e[27;14;58~" [?\C-\M-:]) - (define-key map "\e[27;14;60~" [?\C-\M-<]) - (define-key map "\e[27;14;62~" [?\C-\M->]) - (define-key map "\e[27;14;63~" [(control meta ??)]) + (7 9 [C-M-tab]) + (7 13 [C-M-return]) - (define-key map "\e[27;7;9~" [C-M-tab]) - (define-key map "\e[27;7;13~" [C-M-return]) + (7 32 [?\C-\M-\s]) + (7 39 [?\C-\M-\']) + (7 44 [?\C-\M-,]) + (7 45 [?\C-\M--]) + (7 46 [?\C-\M-.]) + (7 47 [?\C-\M-/]) + (7 48 [?\C-\M-0]) + (7 49 [?\C-\M-1]) + (7 50 [?\C-\M-2]) + (7 51 [?\C-\M-3]) + (7 52 [?\C-\M-4]) + (7 53 [?\C-\M-5]) + (7 54 [?\C-\M-6]) + (7 55 [?\C-\M-7]) + (7 56 [?\C-\M-8]) + (7 57 [?\C-\M-9]) + (7 59 [?\C-\M-\;]) + (7 61 [?\C-\M-=]) + (7 92 [?\C-\M-\\]) - (define-key map "\e[27;7;32~" [?\C-\M-\s]) - (define-key map "\e[27;7;39~" [?\C-\M-\']) - (define-key map "\e[27;7;44~" [?\C-\M-,]) - (define-key map "\e[27;7;45~" [?\C-\M--]) - (define-key map "\e[27;7;46~" [?\C-\M-.]) - (define-key map "\e[27;7;47~" [?\C-\M-/]) - (define-key map "\e[27;7;48~" [?\C-\M-0]) - (define-key map "\e[27;7;49~" [?\C-\M-1]) - (define-key map "\e[27;7;50~" [?\C-\M-2]) - (define-key map "\e[27;7;51~" [?\C-\M-3]) - (define-key map "\e[27;7;52~" [?\C-\M-4]) - (define-key map "\e[27;7;53~" [?\C-\M-5]) - (define-key map "\e[27;7;54~" [?\C-\M-6]) - (define-key map "\e[27;7;55~" [?\C-\M-7]) - (define-key map "\e[27;7;56~" [?\C-\M-8]) - (define-key map "\e[27;7;57~" [?\C-\M-9]) - (define-key map "\e[27;7;59~" [?\C-\M-\;]) - (define-key map "\e[27;7;61~" [?\C-\M-=]) - (define-key map "\e[27;7;92~" [?\C-\M-\\]) + (8 33 [?\C-\M-!]) + (8 34 [?\C-\M-\"]) + (8 35 [?\C-\M-#]) + (8 36 [?\C-\M-$]) + (8 37 [?\C-\M-%]) + (8 38 [?\C-\M-&]) + (8 40 [?\C-\M-\(]) + (8 41 [?\C-\M-\)]) + (8 42 [?\C-\M-*]) + (8 43 [?\C-\M-+]) + (8 58 [?\C-\M-:]) + (8 60 [?\C-\M-<]) + (8 62 [?\C-\M->]) + (8 63 [(control meta ??)]) - (define-key map "\e[27;8;33~" [?\C-\M-!]) - (define-key map "\e[27;8;34~" [?\C-\M-\"]) - (define-key map "\e[27;8;35~" [?\C-\M-#]) - (define-key map "\e[27;8;36~" [?\C-\M-$]) - (define-key map "\e[27;8;37~" [?\C-\M-%]) - (define-key map "\e[27;8;38~" [?\C-\M-&]) - (define-key map "\e[27;8;40~" [?\C-\M-\(]) - (define-key map "\e[27;8;41~" [?\C-\M-\)]) - (define-key map "\e[27;8;42~" [?\C-\M-*]) - (define-key map "\e[27;8;43~" [?\C-\M-+]) - (define-key map "\e[27;8;58~" [?\C-\M-:]) - (define-key map "\e[27;8;60~" [?\C-\M-<]) - (define-key map "\e[27;8;62~" [?\C-\M->]) - (define-key map "\e[27;8;63~" [(control meta ??)]) + (2 9 [S-tab]) + (2 13 [S-return]) - (define-key map "\e[27;2;9~" [S-tab]) - (define-key map "\e[27;2;13~" [S-return]) - - (define-key map "\e[27;6;9~" [C-S-tab]) - (define-key map "\e[27;6;13~" [C-S-return]) + (6 9 [C-S-tab]) + (6 13 [C-S-return]))) + (define-key map + (format "\e[27;%d;%d~" (nth 0 bind) (nth 1 bind)) (nth 2 bind)) + ;; For formatOtherKeys=1, the sequence is a bit shorter (bug#13839). + (define-key map + (format "\e[%d;%du" (nth 1 bind) (nth 0 bind)) (nth 2 bind))) ;; Other versions of xterm might emit these. (define-key map "\e[A" [up]) From 99ec16475a6d1bbe3b308f89e45afb0096e02f0e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 17:46:55 -0400 Subject: [PATCH 21/95] * src/bytecode.c (struct byte_stack): Remove `constants' when unused. --- src/ChangeLog | 16 ++++++++++------ src/bytecode.c | 10 +++++++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b58bbc0a525..044bd5fa245 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,14 +1,18 @@ +2013-03-10 Stefan Monnier + + * bytecode.c (struct byte_stack): Remove `constants' when unused. + 2013-03-10 Eli Zaretskii * xdisp.c (display_tool_bar_line, redisplay_tool_bar) (redisplay_internal, set_cursor_from_row, try_window) (try_window_id, dump_glyph_row, extend_face_to_end_of_line) (display_line, notice_overwritten_cursor) - (mouse_face_from_buffer_pos, note_mouse_highlight): Use - MATRIX_ROW_DISPLAYS_TEXT_P. + (mouse_face_from_buffer_pos, note_mouse_highlight): + Use MATRIX_ROW_DISPLAYS_TEXT_P. (note_mouse_highlight): Use MATRIX_ROW_GLYPH_START. - (mouse_face_from_string_pos, fast_find_string_pos): Use - MATRIX_ROW_VPOS. + (mouse_face_from_string_pos, fast_find_string_pos): + Use MATRIX_ROW_VPOS. * xfns.c (Fx_show_tip): Use MATRIX_ROW_DISPLAYS_TEXT_P. @@ -25,8 +29,8 @@ * coding.c (detect_coding): Cound the heading ASCII bytes in the case of detection for coding_category_utf_8_auto. - (decode_coding_gap) [not CODING_DISABLE_ASCII_OPTIMIZATION]: Skip - decoding if all bytes are ASCII. + (decode_coding_gap) [not CODING_DISABLE_ASCII_OPTIMIZATION]: + Skip decoding if all bytes are ASCII. * insdel.c (adjust_after_replace): Make it public. New arg text_at_gap_tail. diff --git a/src/bytecode.c b/src/bytecode.c index bd8abe85e04..628c4d90cf3 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -313,9 +313,11 @@ struct byte_stack Lisp_Object byte_string; const unsigned char *byte_string_start; +#if BYTE_MARK_STACK /* The vector of constants used during byte-code execution. Storing this here protects it from GC because mark_byte_stack marks it. */ Lisp_Object constants; +#endif /* Next entry in byte_stack_list. */ struct byte_stack *next; @@ -379,12 +381,12 @@ unmark_byte_stack (void) } -/* Fetch the next byte from the bytecode stream */ +/* Fetch the next byte from the bytecode stream. */ #define FETCH *stack.pc++ /* Fetch two bytes from the bytecode stream and make a 16-bit number - out of them */ + out of them. */ #define FETCH2 (op = FETCH, op + (FETCH << 8)) @@ -404,7 +406,7 @@ unmark_byte_stack (void) #define DISCARD(n) (top -= (n)) /* Get the value which is at the top of the execution stack, but don't - pop it. */ + pop it. */ #define TOP (*top) @@ -535,7 +537,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, stack.byte_string = bytestr; stack.pc = stack.byte_string_start = SDATA (bytestr); +#if BYTE_MARK_STACK stack.constants = vector; +#endif if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth)) memory_full (SIZE_MAX); top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top); From d2e24f924a37982172ec0708369570a0af315c7e Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 17:52:01 -0400 Subject: [PATCH 22/95] * src/lread.c: Minor cleanup. (FROM_FILE_P): New macro. (skip_dyn_bytes, unreadchar, read1): Use it. (read_list): Consolidate duplicated code. --- src/ChangeLog | 5 ++++ src/lread.c | 74 +++++++++++++++++++-------------------------------- 2 files changed, 32 insertions(+), 47 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 044bd5fa245..117c08d1875 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,10 @@ 2013-03-10 Stefan Monnier + * lread.c: Minor cleanup. + (FROM_FILE_P): New macro. + (skip_dyn_bytes, unreadchar, read1): Use it. + (read_list): Consolidate duplicated code. + * bytecode.c (struct byte_stack): Remove `constants' when unused. 2013-03-10 Eli Zaretskii diff --git a/src/lread.c b/src/lread.c index e7af86aa664..f8ab03af218 100644 --- a/src/lread.c +++ b/src/lread.c @@ -348,11 +348,14 @@ readchar (Lisp_Object readcharfun, bool *multibyte) return STRING_CHAR (buf); } +#define FROM_FILE_P(readcharfun) \ + (EQ (readcharfun, Qget_file_char) \ + || EQ (readcharfun, Qget_emacs_mule_file_char)) + static void skip_dyn_bytes (Lisp_Object readcharfun, ptrdiff_t n) { - if (EQ (readcharfun, Qget_file_char) - || EQ (readcharfun, Qget_emacs_mule_file_char)) + if (FROM_FILE_P (readcharfun)) { block_input (); /* FIXME: Not sure if it's needed. */ fseek (instream, n, SEEK_CUR); @@ -423,8 +426,7 @@ unreadchar (Lisp_Object readcharfun, int c) { unread_char = c; } - else if (EQ (readcharfun, Qget_file_char) - || EQ (readcharfun, Qget_emacs_mule_file_char)) + else if (FROM_FILE_P (readcharfun)) { unread_char = c; } @@ -2636,8 +2638,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) UNREAD (c); if (load_force_doc_strings - && (EQ (readcharfun, Qget_file_char) - || EQ (readcharfun, Qget_emacs_mule_file_char))) + && (FROM_FILE_P (readcharfun))) { /* If we are supposed to force doc strings into core right now, record the last string that we skipped, @@ -3573,8 +3574,10 @@ read_list (bool flag, Lisp_Object readcharfun) { if (doc_reference == 1) return make_number (0); - if (doc_reference == 2) + if (doc_reference == 2 && INTEGERP (XCDR (val))) { + char *saved = NULL; + file_offset saved_position; /* Get a doc string from the file we are loading. If it's in saved_doc_string, get it from there. @@ -3591,65 +3594,42 @@ read_list (bool flag, Lisp_Object readcharfun) && pos < (saved_doc_string_position + saved_doc_string_length)) { - ptrdiff_t start = pos - saved_doc_string_position; - ptrdiff_t from, to; - - /* Process quoting with ^A, - and find the end of the string, - which is marked with ^_ (037). */ - for (from = start, to = start; - saved_doc_string[from] != 037;) - { - int c = saved_doc_string[from++]; - if (c == 1) - { - c = saved_doc_string[from++]; - if (c == 1) - saved_doc_string[to++] = c; - else if (c == '0') - saved_doc_string[to++] = 0; - else if (c == '_') - saved_doc_string[to++] = 037; - } - else - saved_doc_string[to++] = c; - } - - return make_unibyte_string (saved_doc_string + start, - to - start); + saved = saved_doc_string; + saved_position = saved_doc_string_position; } /* Look in prev_saved_doc_string the same way. */ else if (pos >= prev_saved_doc_string_position && pos < (prev_saved_doc_string_position + prev_saved_doc_string_length)) { - ptrdiff_t start = - pos - prev_saved_doc_string_position; + saved = prev_saved_doc_string; + saved_position = prev_saved_doc_string_position; + } + if (saved) + { + ptrdiff_t start = pos - saved_position; ptrdiff_t from, to; /* Process quoting with ^A, and find the end of the string, which is marked with ^_ (037). */ for (from = start, to = start; - prev_saved_doc_string[from] != 037;) + saved[from] != 037;) { - int c = prev_saved_doc_string[from++]; + int c = saved[from++]; if (c == 1) { - c = prev_saved_doc_string[from++]; - if (c == 1) - prev_saved_doc_string[to++] = c; - else if (c == '0') - prev_saved_doc_string[to++] = 0; - else if (c == '_') - prev_saved_doc_string[to++] = 037; + c = saved[from++]; + saved[to++] = (c == 1 ? c + : c == '0' ? 0 + : c == '_' ? 037 + : c); } else - prev_saved_doc_string[to++] = c; + saved[to++] = c; } - return make_unibyte_string (prev_saved_doc_string - + start, + return make_unibyte_string (saved + start, to - start); } else From 819e2da92a18d7af03ccd9cf0a2e5b940eb7b54f Mon Sep 17 00:00:00 2001 From: Daniel Colascione Date: Sun, 10 Mar 2013 14:55:25 -0800 Subject: [PATCH 23/95] 2013-03-10 Daniel Colascione * w32term.h (GUISTR, GUI_ENCODE_FILE, GUI_ENCODE_SYSTEM, GUI_FN) (GUI_SDATA, guichar_t): Macros to abstract out differences between NTGUI_UNICODE and !NTGUI_UNICODE builds, some moved out of w32fns.c. * w32term.c (construct_drag_n_drop): Use the above macros to make drag-and-drop work for non-ASCII filenames in cygw32 builds. * w32fns.c (x_set_name, x_set_title): Use the above macros to properly display non-ASCII frame titles in cygw32 builds. * w32fns.c (Fw32_shell_execute): Use the above macros to properly call ShellExecute in cygw32 builds. * w32fn.c (Fx_file_dialog): Use the above macros to simplify the common file dialog code. * w32fns.c (Ffile_system_info): Remove from cygw32 builds, which can just use du like other systems. * coding.c (from_unicode_buffer): Declare. * coding.c (from_unicode_buffer): Implement. --- src/ChangeLog | 25 +++++++++++++++ src/coding.c | 14 +++++++++ src/coding.h | 3 ++ src/w32fns.c | 85 ++++++++++++++++++++++++++++----------------------- src/w32term.c | 13 +++++--- src/w32term.h | 17 +++++++++++ 6 files changed, 114 insertions(+), 43 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 117c08d1875..b553c96a1db 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,28 @@ +2013-03-10 Daniel Colascione + + * w32term.h (GUISTR, GUI_ENCODE_FILE, GUI_ENCODE_SYSTEM, GUI_FN) + (GUI_SDATA, guichar_t): Macros to abstract out differences between + NTGUI_UNICODE and !NTGUI_UNICODE builds, some moved out of + w32fns.c. + + * w32term.c (construct_drag_n_drop): Use the above macros to make + drag-and-drop work for non-ASCII filenames in cygw32 builds. + + * w32fns.c (x_set_name, x_set_title): Use the above macros to + properly display non-ASCII frame titles in cygw32 builds. + + * w32fns.c (Fw32_shell_execute): Use the above macros to properly + call ShellExecute in cygw32 builds. + + * w32fn.c (Fx_file_dialog): Use the above macros to simplify the + common file dialog code. + + * w32fns.c (Ffile_system_info): Remove from cygw32 builds, which + can just use du like other systems. + + * coding.c (from_unicode_buffer): Declare. + * coding.c (from_unicode_buffer): Implement. + 2013-03-10 Stefan Monnier * lread.c: Minor cleanup. diff --git a/src/coding.c b/src/coding.c index d6560a92b70..c18632f301b 100644 --- a/src/coding.c +++ b/src/coding.c @@ -286,6 +286,10 @@ encode_coding_XXX (struct coding_system *coding) #include #include +#ifdef HAVE_WCHAR_H +#include +#endif /* HAVE_WCHAR_H */ + #include "lisp.h" #include "character.h" #include "buffer.h" @@ -8003,6 +8007,16 @@ from_unicode (Lisp_Object str) return code_convert_string_norecord (str, Qutf_16le, 0); } +Lisp_Object +from_unicode_buffer (const wchar_t* wstr) +{ + return from_unicode ( + make_unibyte_string ( + (char*) wstr, + /* we get one of the two final 0 bytes for free. */ + 1 + sizeof (wchar_t) * wcslen (wstr))); +} + wchar_t * to_unicode (Lisp_Object str, Lisp_Object *buf) { diff --git a/src/coding.h b/src/coding.h index 28a7d776b63..c13567c3d53 100644 --- a/src/coding.h +++ b/src/coding.h @@ -715,6 +715,9 @@ extern wchar_t *to_unicode (Lisp_Object str, Lisp_Object *buf); failure modes. STR itself is not modified. */ extern Lisp_Object from_unicode (Lisp_Object str); +/* Convert WSTR to an Emacs string. */ +extern Lisp_Object from_unicode_buffer (const wchar_t* wstr); + #endif /* WINDOWSNT || CYGWIN */ /* Macros for backward compatibility. */ diff --git a/src/w32fns.c b/src/w32fns.c index 56cc1f37d08..cef2009d7a1 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1721,11 +1721,9 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) if (FRAME_W32_WINDOW (f)) { - if (STRING_MULTIBYTE (name)) - name = ENCODE_SYSTEM (name); - block_input (); - SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); + GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f), + GUI_SDATA (GUI_ENCODE_SYSTEM (name))); unblock_input (); } } @@ -1767,11 +1765,9 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) if (FRAME_W32_WINDOW (f)) { - if (STRING_MULTIBYTE (name)) - name = ENCODE_SYSTEM (name); - block_input (); - SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); + GUI_FN (SetWindowText) (FRAME_W32_WINDOW (f), + GUI_SDATA (GUI_ENCODE_SYSTEM (name))); unblock_input (); } } @@ -6006,14 +6002,6 @@ Value is t if tooltip was open, nil otherwise. */) #define FILE_NAME_COMBO_BOX cmb13 #define FILE_NAME_LIST lst1 -#ifdef NTGUI_UNICODE -#define GUISTR(x) (L ## x) -typedef wchar_t guichar_t; -#else /* !NTGUI_UNICODE */ -#define GUISTR(x) x -typedef char guichar_t; -#endif /* NTGUI_UNICODE */ - /* Callback for altering the behavior of the Open File dialog. Makes the Filename text field contain "Current Directory" and be read-only when "Directories" is selected in the filter. This @@ -6230,11 +6218,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) block_input (); file_details->lpfnHook = file_dialog_callback; -#ifdef NTGUI_UNICODE - file_opened = GetOpenFileNameW (file_details); -#else /* !NTGUI_UNICODE */ - file_opened = GetOpenFileNameA (file_details); -#endif /* NTGUI_UNICODE */ + file_opened = GUI_FN (GetOpenFileName) (file_details); unblock_input (); unbind_to (count, Qnil); } @@ -6243,11 +6227,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) { /* Get an Emacs string from the value Windows gave us. */ #ifdef NTGUI_UNICODE - filename = from_unicode ( - make_unibyte_string ( - (char*) filename_buf, - /* we get one of the two final 0 bytes for free. */ - 1 + sizeof (wchar_t) * wcslen (filename_buf))); + filename = from_unicode_buffer (filename_buf); #else /* !NTGUI_UNICODE */ dostounix_filename (filename_buf, 0); filename = DECODE_FILE (build_string (filename_buf)); @@ -6421,20 +6401,29 @@ an integer representing a ShowWindow flag: CHECK_STRING (document); /* Encode filename, current directory and parameters. */ - current_dir = ENCODE_FILE (BVAR (current_buffer, directory)); - document = ENCODE_FILE (document); - if (STRINGP (parameters)) - parameters = ENCODE_SYSTEM (parameters); + current_dir = BVAR (current_buffer, directory); - if ((int) ShellExecute (NULL, - (STRINGP (operation) ? - SDATA (operation) : NULL), - SDATA (document), - (STRINGP (parameters) ? - SDATA (parameters) : NULL), - SDATA (current_dir), - (INTEGERP (show_flag) ? - XINT (show_flag) : SW_SHOWDEFAULT)) +#ifdef CYGWIN + current_dir = Fcygwin_convert_file_name_to_windows (current_dir, Qt); + if (STRINGP (document)) + document = Fcygwin_convert_file_name_to_windows (document, Qt); +#endif /* CYGWIN */ + + current_dir = GUI_ENCODE_FILE (current_dir); + if (STRINGP (document)) + document = GUI_ENCODE_FILE (document); + if (STRINGP (parameters)) + parameters = GUI_ENCODE_SYSTEM (parameters); + + if ((int) GUI_FN (ShellExecute) (NULL, + (STRINGP (operation) ? + GUI_SDATA (operation) : NULL), + GUI_SDATA (document), + (STRINGP (parameters) ? + GUI_SDATA (parameters) : NULL), + GUI_SDATA (current_dir), + (INTEGERP (show_flag) ? + XINT (show_flag) : SW_SHOWDEFAULT)) > 32) return Qt; errstr = w32_strerror (0); @@ -6803,6 +6792,7 @@ The following %-sequences are provided: } +#ifdef WINDOWSNT DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0, doc: /* Return storage information about the file system FILENAME is on. Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total @@ -6898,6 +6888,8 @@ If the underlying system call fails, value is nil. */) return value; } +#endif /* WINDOWSNT */ + DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name, 0, 0, 0, doc: /* Return the name of Windows default printer device. */) @@ -7624,7 +7616,10 @@ only be necessary if the default setting causes problems. */); defsubr (&Sw32_window_exists_p); defsubr (&Sw32_battery_status); +#ifdef WINDOWSNT defsubr (&Sfile_system_info); +#endif + defsubr (&Sdefault_printer_name); defsubr (&Sset_message_beep); @@ -7805,3 +7800,15 @@ emacs_abort (void) } } } + +#ifdef NTGUI_UNICODE + +Lisp_Object +ntgui_encode_system (Lisp_Object str) +{ + Lisp_Object encoded; + to_unicode (str, &encoded); + return encoded; +} + +#endif /* NTGUI_UNICODE */ diff --git a/src/w32term.c b/src/w32term.c index 170f33ecd67..6137d54c837 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -3161,7 +3161,7 @@ construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) HDROP hdrop; POINT p; WORD num_files; - char *name; + guichar_t *name; int i, len; result->kind = DRAG_N_DROP_EVENT; @@ -3186,12 +3186,17 @@ construct_drag_n_drop (struct input_event *result, W32Msg *msg, struct frame *f) for (i = 0; i < num_files; i++) { - len = DragQueryFile (hdrop, i, NULL, 0); + len = GUI_FN (DragQueryFile) (hdrop, i, NULL, 0); if (len <= 0) continue; - name = alloca (len + 1); - DragQueryFile (hdrop, i, name, len + 1); + + name = alloca ((len + 1) * sizeof (*name)); + GUI_FN (DragQueryFile) (hdrop, i, name, len + 1); +#ifdef NTGUI_UNICODE + files = Fcons (from_unicode_buffer (name), files); +#else files = Fcons (DECODE_FILE (build_string (name)), files); +#endif /* NTGUI_UNICODE */ } DragFinish (hdrop); diff --git a/src/w32term.h b/src/w32term.h index 7154d549f21..a31c5de193d 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -761,6 +761,23 @@ extern const char* w32_name_of_message (UINT msg); #endif /* EMACSDEBUG */ +#ifdef NTGUI_UNICODE +extern Lisp_Object ntgui_encode_system (Lisp_Object str); +#define GUISTR(x) (L ## x) +#define GUI_ENCODE_FILE GUI_ENCODE_SYSTEM +#define GUI_ENCODE_SYSTEM(x) ntgui_encode_system (x) +#define GUI_FN(fn) fn ## W +typedef wchar_t guichar_t; +#else /* !NTGUI_UNICODE */ +#define GUISTR(x) x +#define GUI_ENCODE_FILE ENCODE_FILE +#define GUI_ENCODE_SYSTEM ENCODE_SYSTEM +#define GUI_FN(fn) fn +typedef char guichar_t; +#endif /* NTGUI_UNICODE */ + +#define GUI_SDATA(x) ((guichar_t*) SDATA (x)) + extern void syms_of_w32term (void); extern void syms_of_w32menu (void); extern void syms_of_w32fns (void); From cbae07d5e07f53472fa972cd31418a4fe851ac31 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 21:17:40 -0400 Subject: [PATCH 24/95] * src/keyboard.c: Move keyboard decoding to read_key_sequence. (decode_keyboard_code): Remove. (tty_read_avail_input): Don't try to decode input. (read_decoded_char): New function. (read_key_sequence): Use it. --- src/ChangeLog | 8 +++ src/keyboard.c | 145 +++++++++++++++++++++++------------------------- src/term.c | 2 +- src/termhooks.h | 28 +++++----- src/terminal.c | 2 +- src/textprop.c | 2 +- 6 files changed, 95 insertions(+), 92 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index b553c96a1db..2359311f98a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2013-03-11 Stefan Monnier + + * keyboard.c: Move keyboard decoding to read_key_sequence. + (decode_keyboard_code): Remove. + (tty_read_avail_input): Don't try to decode input. + (read_decoded_char): New function. + (read_key_sequence): Use it. + 2013-03-10 Daniel Colascione * w32term.h (GUISTR, GUI_ENCODE_FILE, GUI_ENCODE_SYSTEM, GUI_FN) diff --git a/src/keyboard.c b/src/keyboard.c index a66c28dc3d3..fe8b45a0130 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -6815,48 +6815,6 @@ gobble_input (void) return nread; } -static void -decode_keyboard_code (struct tty_display_info *tty, - struct coding_system *coding, - unsigned char *buf, int nbytes) -{ - unsigned char *src = buf; - const unsigned char *p; - int i; - - if (nbytes == 0) - return; - if (tty->meta_key != 2) - for (i = 0; i < nbytes; i++) - buf[i] &= ~0x80; - if (coding->carryover_bytes > 0) - { - src = alloca (coding->carryover_bytes + nbytes); - memcpy (src, coding->carryover, coding->carryover_bytes); - memcpy (src + coding->carryover_bytes, buf, nbytes); - nbytes += coding->carryover_bytes; - } - coding->destination = alloca (nbytes * 4); - coding->dst_bytes = nbytes * 4; - decode_coding_c_string (coding, src, nbytes, Qnil); - if (coding->produced_char == 0) - return; - for (i = 0, p = coding->destination; i < coding->produced_char; i++) - { - struct input_event event_buf; - - EVENT_INIT (event_buf); - event_buf.code = STRING_CHAR_ADVANCE (p); - event_buf.kind = - (ASCII_CHAR_P (event_buf.code) - ? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT); - /* See the comment in tty_read_avail_input. */ - event_buf.frame_or_window = tty->top_frame; - event_buf.arg = Qnil; - kbd_buffer_store_event (&event_buf); - } -} - /* This is the tty way of reading available input. Note that each terminal device has its own `struct terminal' object, @@ -7014,36 +6972,6 @@ tty_read_avail_input (struct terminal *terminal, #endif /* not MSDOS */ #endif /* not WINDOWSNT */ - if (TERMINAL_KEYBOARD_CODING (terminal)->common_flags - & CODING_REQUIRE_DECODING_MASK) - { - struct coding_system *coding = TERMINAL_KEYBOARD_CODING (terminal); - int from; - - /* Decode the key sequence except for those with meta - modifiers. */ - for (i = from = 0; ; i++) - if (i == nread || (tty->meta_key == 1 && (cbuf[i] & 0x80))) - { - struct input_event buf; - - decode_keyboard_code (tty, coding, cbuf + from, i - from); - if (i == nread) - break; - - EVENT_INIT (buf); - buf.kind = ASCII_KEYSTROKE_EVENT; - buf.modifiers = meta_modifier; - buf.code = cbuf[i] & ~0x80; - /* See the comment below. */ - buf.frame_or_window = tty->top_frame; - buf.arg = Qnil; - kbd_buffer_store_event (&buf); - from = i + 1; - } - return nread; - } - for (i = 0; i < nread; i++) { struct input_event buf; @@ -8783,6 +8711,71 @@ test_undefined (Lisp_Object binding) && EQ (Fcommand_remapping (binding, Qnil, Qnil), Qundefined))); } +/* Like `read_char' but applies keyboard-coding-system to tty input. */ +static Lisp_Object +read_decoded_char (int commandflag, Lisp_Object map, + Lisp_Object prev_event, bool *used_mouse_menu) +{ +#define MAX_ENCODED_BYTES 16 + Lisp_Object events[MAX_ENCODED_BYTES]; + int n = 0; + while (true) + { + Lisp_Object nextevt + = read_char (commandflag, map, prev_event, used_mouse_menu, NULL); + struct frame *frame = XFRAME (selected_frame); + struct terminal *terminal = frame->terminal; + if (!((FRAME_TERMCAP_P (frame) || FRAME_MSDOS_P (frame)) + && (TERMINAL_KEYBOARD_CODING (terminal)->common_flags + & CODING_REQUIRE_DECODING_MASK))) + return nextevt; /* No decoding needed. */ + else + { + int meta_key = terminal->display_info.tty->meta_key; + eassert (n < MAX_ENCODED_BYTES); + events[n++] = nextevt; + if (NATNUMP (nextevt) + && XINT (nextevt) < (meta_key == 1 ? 0x80 : 0x100)) + { /* An encoded byte sequence, let's try to decode it. */ + struct coding_system *coding + = TERMINAL_KEYBOARD_CODING (terminal); + unsigned char *src = alloca (n); + int i; + for (i = 0; i < n; i++) + src[i] = XINT (events[i]); + if (meta_key != 2) + for (i = 0; i < n; i++) + src[i] &= ~0x80; + coding->destination = alloca (n * 4); + coding->dst_bytes = n * 4; + decode_coding_c_string (coding, src, n, Qnil); + eassert (coding->produced_char <= n); + if (coding->produced_char == 0) + { /* The encoded sequence is incomplete. */ + if (n < MAX_ENCODED_BYTES) /* Avoid buffer overflow. */ + continue; /* Read on! */ + } + else + { + const unsigned char *p = coding->destination; + eassert (coding->carryover_bytes == 0); + n = 0; + while (n < coding->produced_char) + events[n++] = make_number (STRING_CHAR_ADVANCE (p)); + } + } + /* Now `events' should hold decoded events. + Normally, n should be equal to 1, but better not rely on it. + We can only return one event here, so return the first we + had and keep the others (if any) for later. */ + while (n > 1) + Vunread_command_events + = Fcons (events[--n], Vunread_command_events); + return events[0]; + } + } +} + /* Read a sequence of keys that ends with a non prefix character, storing it in KEYBUF, a buffer of size BUFSIZE. Prompt with PROMPT. @@ -9060,9 +9053,9 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, { KBOARD *interrupted_kboard = current_kboard; struct frame *interrupted_frame = SELECTED_FRAME (); - key = read_char (NILP (prompt), - current_binding, last_nonmenu_event, - &used_mouse_menu, NULL); + key = read_decoded_char (NILP (prompt), + current_binding, last_nonmenu_event, + &used_mouse_menu); if ((INTEGERP (key) && XINT (key) == -2) /* wrong_kboard_jmpbuf */ /* When switching to a new tty (with a new keyboard), read_char returns the new buffer, rather than -2 @@ -10553,7 +10546,7 @@ See also `current-input-mode'. */) if (tty->flow_control != !NILP (flow)) { #ifndef DOS_NT - /* this causes startup screen to be restored and messes with the mouse */ + /* This causes startup screen to be restored and messes with the mouse. */ reset_sys_modes (tty); #endif diff --git a/src/term.c b/src/term.c index a31fd51084e..822b74aa44e 100644 --- a/src/term.c +++ b/src/term.c @@ -1321,7 +1321,7 @@ term_get_fkeys_1 (void) if (!KEYMAPP (KVAR (kboard, Vinput_decode_map))) kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil)); - for (i = 0; i < (sizeof (keys)/sizeof (keys[0])); i++) + for (i = 0; i < (sizeof (keys) / sizeof (keys[0])); i++) { char *sequence = tgetstr (keys[i].cap, address); if (sequence) diff --git a/src/termhooks.h b/src/termhooks.h index 7385298d3d4..252dbabb6f9 100644 --- a/src/termhooks.h +++ b/src/termhooks.h @@ -382,7 +382,7 @@ struct terminal struct image_cache *image_cache; #endif /* HAVE_WINDOW_SYSTEM */ - /* Device-type dependent data shared amongst all frames on this terminal. */ + /* Device-type dependent data shared amongst all frames on this terminal. */ union display_info { struct tty_display_info *tty; /* termchar.h */ @@ -403,22 +403,22 @@ struct terminal the function `set-keyboard-coding-system'. */ struct coding_system *keyboard_coding; - /* Terminal characteristics. */ - /* XXX Are these really used on non-termcap displays? */ + /* Terminal characteristics. */ + /* XXX Are these really used on non-termcap displays? */ int must_write_spaces; /* Nonzero means spaces in the text must actually be output; can't just skip over some columns to leave them blank. */ - int fast_clear_end_of_line; /* Nonzero means terminal has a `ce' string */ + int fast_clear_end_of_line; /* Nonzero means terminal has a `ce' string. */ - int line_ins_del_ok; /* Terminal can insert and delete lines */ - int char_ins_del_ok; /* Terminal can insert and delete chars */ + int line_ins_del_ok; /* Terminal can insert and delete lines. */ + int char_ins_del_ok; /* Terminal can insert and delete chars. */ int scroll_region_ok; /* Terminal supports setting the scroll - window */ + window. */ int scroll_region_cost; /* Cost of setting the scroll window, - measured in characters. */ + measured in characters. */ int memory_below_frame; /* Terminal remembers lines scrolled - off bottom */ + off bottom. */ /* Window-based redisplay interface for this device (0 for tty devices). */ @@ -617,7 +617,7 @@ tset_selection_alist (struct terminal *t, Lisp_Object val) t->Vselection_alist = val; } -/* Chain of all terminal devices currently in use. */ +/* Chain of all terminal devices currently in use. */ extern struct terminal *terminal_list; #define FRAME_MUST_WRITE_SPACES(f) ((f)->terminal->must_write_spaces) @@ -638,14 +638,16 @@ extern struct terminal *terminal_list; #define FRAME_TERMINAL(f) ((f)->terminal) -/* Return true if the terminal device is not suspended. */ -#define TERMINAL_ACTIVE_P(d) (((d)->type != output_termcap && (d)->type !=output_msdos_raw) || (d)->display_info.tty->input) +/* Return true if the terminal device is not suspended. */ +#define TERMINAL_ACTIVE_P(d) \ + (((d)->type != output_termcap && (d)->type != output_msdos_raw) \ + || (d)->display_info.tty->input) extern struct terminal *get_terminal (Lisp_Object terminal, int); extern struct terminal *create_terminal (void); extern void delete_terminal (struct terminal *); -/* The initial terminal device, created by initial_term_init. */ +/* The initial terminal device, created by initial_term_init. */ extern struct terminal *initial_terminal; extern unsigned char *encode_terminal_code (struct glyph *, int, diff --git a/src/terminal.c b/src/terminal.c index 5e1f1ff77f7..c99c39c64ae 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -280,7 +280,7 @@ delete_terminal (struct terminal *terminal) xfree (terminal->name); terminal->name = NULL; - /* Check for live frames that are still on this terminal. */ + /* Check for live frames that are still on this terminal. */ FOR_EACH_FRAME (tail, frame) { struct frame *f = XFRAME (frame); diff --git a/src/textprop.c b/src/textprop.c index 18e893b3ef2..2b454485370 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -60,7 +60,7 @@ Lisp_Object Qinvisible, Qintangible, Qmouse_face; static Lisp_Object Qread_only; Lisp_Object Qminibuffer_prompt; -/* Sticky properties */ +/* Sticky properties. */ Lisp_Object Qfront_sticky, Qrear_nonsticky; /* If o1 is a cons whose cdr is a cons, return non-zero and set o2 to From 24958590a00900371b6b3b154fc1df5c980d056c Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sun, 10 Mar 2013 19:35:23 -0700 Subject: [PATCH 25/95] Add 24.3 release to ChangeLogs --- ChangeLog | 4 ++++ admin/ChangeLog | 4 ++++ doc/emacs/ChangeLog | 4 ++++ doc/lispintro/ChangeLog | 4 ++++ doc/lispref/ChangeLog | 4 ++++ doc/man/ChangeLog | 4 ++++ doc/misc/ChangeLog | 4 ++++ etc/ChangeLog | 4 ++++ leim/ChangeLog | 4 ++++ lib-src/ChangeLog | 4 ++++ lisp/ChangeLog | 4 ++++ lisp/cedet/ChangeLog | 4 ++++ lisp/erc/ChangeLog | 4 ++++ lisp/gnus/ChangeLog | 4 ++++ lisp/mh-e/ChangeLog | 4 ++++ lisp/org/ChangeLog | 4 ++++ lisp/url/ChangeLog | 4 ++++ lwlib/ChangeLog | 4 ++++ msdos/ChangeLog | 4 ++++ nextstep/ChangeLog | 4 ++++ nt/ChangeLog | 4 ++++ oldXMenu/ChangeLog | 4 ++++ src/ChangeLog | 4 ++++ test/ChangeLog | 4 ++++ 24 files changed, 96 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5c701479698..2a7f2b0e546 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-03-05 Paul Eggert * configure.ac (TERM_HEADER): Remove duplicate definition (Bug#13872). diff --git a/admin/ChangeLog b/admin/ChangeLog index 279ef4c0baf..20a1fcc4b65 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-10-12 Kenichi Handa * charsets/Makefile (JISC6226.map): Add missing mappings. diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 4531fed3d6a..330bcfaaaee 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-02-27 Bastien Guerry * xresources.texi (GTK resources): Fix broken link. diff --git a/doc/lispintro/ChangeLog b/doc/lispintro/ChangeLog index 379ad90d05a..6a3cffac520 100644 --- a/doc/lispintro/ChangeLog +++ b/doc/lispintro/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-03-03 Glenn Morris * emacs-lisp-intro.texi (Digression into C): Update example. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 8947685c52c..7b1e9f6a9ad 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-03-03 Glenn Morris * objects.texi (Symbol Type): Fix typo. diff --git a/doc/man/ChangeLog b/doc/man/ChangeLog index 0c77a9516e7..645f4a4031e 100644 --- a/doc/man/ChangeLog +++ b/doc/man/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-06-03 Glenn Morris * rcs-checkin.1: Remove. diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index f777696eff2..2a62dc852e9 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-02-28 Bastien Guerry * org.texi (Visibility cycling): Suggest to set diff --git a/etc/ChangeLog b/etc/ChangeLog index 9bb9d75c067..27642f9164d 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-02-28 Dmitry Gutov * NEWS: Add entries for ruby-mode. diff --git a/leim/ChangeLog b/leim/ChangeLog index 3436e34f8a2..21757b8472c 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-09-05 Eli Zaretskii * quail/hebrew.el ("yiddish-royal"): Fix several bogus entries. diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 1cf30eefcdc..871f572facd 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-10-26 Glenn Morris * Makefile.in (uninstall): No INSTALLABLES live in archlibdir. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index da4cdb9bc62..b853399e462 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-02-25 Glenn Morris * textmodes/paragraphs.el (mark-paragraph): Doc fix. diff --git a/lisp/cedet/ChangeLog b/lisp/cedet/ChangeLog index 07de8c79938..6f0b0133873 100644 --- a/lisp/cedet/ChangeLog +++ b/lisp/cedet/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-11-14 David Engster * semantic/symref/list.el (semantic-symref-symbol): Use diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index c0a204c80b3..c12cd68b595 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-11-13 Glenn Morris * erc.el (erc-modules): Add "notifications". Tweak "hecomplete" doc. diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index c6d36156cab..59a935ee829 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-02-10 Katsumi Yamaoka * nnir.el ("nnir"): Add 'virtual ability to nnir backend. (This was diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index 6794ff8bbfb..e9473a3e2f3 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-10-23 Stefan Monnier * mh-letter.el (mh-yank-hooks): Use make-obsolete-variable. diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index e576c4cf63c..cb3d201ee25 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-03-08 Bastien Guerry * org-exp.el (org-export-normalize-links): Fix critical bug: do diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 95c8edbe8b1..0927cb83090 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-10-13 Liam Stitt (tiny change) * url-vars.el (url-uncompressor-alist): diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 54f7c6088cf..3015aeecee0 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-10-06 Ulrich Müller * Makefile.in (AR, ARFLAGS): Get values from configure. diff --git a/msdos/ChangeLog b/msdos/ChangeLog index 0e7b1d73e7c..e95c8bdeebb 100644 --- a/msdos/ChangeLog +++ b/msdos/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-12-30 Eli Zaretskii * sed1v2.inp (TEMACS_LDFLAGS2): Remove editing. diff --git a/nextstep/ChangeLog b/nextstep/ChangeLog index c16d7bec178..dc6dcbfde0a 100644 --- a/nextstep/ChangeLog +++ b/nextstep/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-09-17 Glenn Morris * templates/Info-gnustep.plist.in, templates/InfoPlist.strings.in: diff --git a/nt/ChangeLog b/nt/ChangeLog index b455e660fd0..3c77a770837 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-11-24 Paul Eggert Revert recent change for Bug#8855; see ../src/ChangeLog. diff --git a/oldXMenu/ChangeLog b/oldXMenu/ChangeLog index fe80683fbb2..3ced7ae3982 100644 --- a/oldXMenu/ChangeLog +++ b/oldXMenu/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2012-10-06 Ulrich Müller * Makefile.in (AR, ARFLAGS): Get values from configure. diff --git a/src/ChangeLog b/src/ChangeLog index f67046ebd43..95046266751 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-03-05 Paul Eggert Fix a build failure on OpenBSD 4.x and MirBSD (Bug#13881). diff --git a/test/ChangeLog b/test/ChangeLog index c8383a73300..a2d657f57b5 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,7 @@ +2013-03-11 Glenn Morris + + * Version 24.3 released. + 2013-02-21 Fabián Ezequiel Gallina * automated/python-tests.el From 25c09217a0bb2ef721419304d5922d05ae8fc26b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Sun, 10 Mar 2013 22:56:18 -0400 Subject: [PATCH 26/95] * lisp/xt-mouse.el (xterm-mouse-event-read): Remove. (xterm-mouse--read-event-sequence-1000) (xterm-mouse--read-event-sequence-1006): Use read-event instead. --- etc/NEWS | 5 +++++ lisp/ChangeLog | 6 ++++++ lisp/xt-mouse.el | 26 ++++++-------------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 364dd8bf53a..27218ed8bf0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -238,6 +238,11 @@ It is layered as: * Incompatible Lisp Changes in Emacs 24.4 +** `read-event' does not return decoded chars in ttys any more. +Just as was the case in Emacs-22 and before, decoding of tty input according to +keyboard-coding-system is not performed in read-event any more. But contrary +to that past, it is still done before input-decode-map/function-key-map/... + ** Removed inhibit-local-menu-bar-menus. ** frame-local variables that affect redisplay do not work any more. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b609b219fc9..6755f5a9910 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2013-03-11 Stefan Monnier + + * xt-mouse.el (xterm-mouse-event-read): Remove. + (xterm-mouse--read-event-sequence-1000) + (xterm-mouse--read-event-sequence-1006): Use read-event instead. + 2013-03-10 Stefan Monnier * term/xterm.el (xterm-function-map): Support format used with diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el index 9ee6c51c07c..745bca7a2be 100644 --- a/lisp/xt-mouse.el +++ b/lisp/xt-mouse.el @@ -135,20 +135,6 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." (terminal-parameter nil 'xterm-mouse-y)))) pos) -;; Read XTerm sequences above ASCII 127 (#x7f) -(defun xterm-mouse-event-read () - ;; We get the characters decoded by the keyboard coding system. Try - ;; to recover the raw character. - (let ((c (read-event))) - (cond ;; If meta-flag is t we get a meta character - ((>= c ?\M-\^@) - (- c (- ?\M-\^@ 128))) - ;; Reencode the character in the keyboard coding system, if - ;; this is a non-ASCII character. - ((>= c #x80) - (aref (encode-coding-string (string c) (keyboard-coding-system)) 0)) - (t c)))) - (defun xterm-mouse-truncate-wrap (f) "Truncate with wrap-around." (condition-case nil @@ -167,7 +153,7 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." ;; Normal terminal mouse click reporting: expect three bytes, of the ;; form . Return a list (EVENT-TYPE X Y). (defun xterm-mouse--read-event-sequence-1000 () - (list (let ((code (- (xterm-mouse-event-read) 32))) + (list (let ((code (- (read-event) 32))) (intern ;; For buttons > 3, the release-event looks differently ;; (see xc/programs/xterm/button.c, function EditorButton), @@ -188,19 +174,19 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)." (setq xterm-mouse-last code) (format "down-mouse-%d" (+ 1 code)))))) ;; x and y coordinates - (- (xterm-mouse-event-read) 33) - (- (xterm-mouse-event-read) 33))) + (- (read-event) 33) + (- (read-event) 33))) ;; XTerm's 1006-mode terminal mouse click reporting has the form ;;