Now on revision 112796. ------------------------------------------------------------ revno: 112796 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2013-05-31 10:04:33 +0400 message: * lisp/progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): New function, checks if expression expansion is allowed in given parse state. (ruby-syntax-propertize-expansion): Use it. (ruby-syntax-propertize-function): Bind `case-fold-search' to nil around the body. * test/automated/ruby-mode-tests.el: New tests, for percent literals and expression expansion. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 23:45:41 +0000 +++ lisp/ChangeLog 2013-05-31 06:04:33 +0000 @@ -1,3 +1,12 @@ +2013-05-31 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-syntax-expansion-allowed-p): New + function, checks if point is inside a literal that allows + expression expansion. + (ruby-syntax-propertize-expansion): Use it. + (ruby-syntax-propertize-function): Bind `case-fold-search' to nil + around the body. + 2013-05-30 Juri Linkov * isearch.el (isearch-mode-map): Bind `isearch-toggle-invisible' === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-05-24 03:49:52 +0000 +++ lisp/progmodes/ruby-mode.el 2013-05-31 06:04:33 +0000 @@ -1349,6 +1349,7 @@ (declare-function ruby-syntax-propertize-percent-literal "ruby-mode" (limit)) ;; Unusual code layout confuses the byte-compiler. (declare-function ruby-syntax-propertize-expansion "ruby-mode" ()) +(declare-function ruby-syntax-expansion-allowed-p "ruby-mode" (parse-state)) (if (eval-when-compile (fboundp #'syntax-propertize-rules)) ;; New code that works independently from font-lock. @@ -1380,51 +1381,52 @@ (defun ruby-syntax-propertize-function (start end) "Syntactic keywords for Ruby mode. See `syntax-propertize-function'." - (goto-char start) - (remove-text-properties start end '(ruby-expansion-match-data)) - (ruby-syntax-propertize-heredoc end) - (ruby-syntax-enclosing-percent-literal end) - (funcall - (syntax-propertize-rules - ;; $' $" $` .... are variables. - ;; ?' ?" ?` are ascii codes. - ("\\([?$]\\)[#\"'`]" - (1 (unless (save-excursion - ;; Not within a string. - (nth 3 (syntax-ppss (match-beginning 0)))) - (string-to-syntax "\\")))) - ;; Regular expressions. Start with matching unescaped slash. - ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)" - (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1))))) - (when (or - ;; Beginning of a regexp. - (and (null (nth 8 state)) - (save-excursion - (forward-char -1) - (looking-back ruby-syntax-before-regexp-re - (point-at-bol)))) - ;; End of regexp. We don't match the whole - ;; regexp at once because it can have - ;; string interpolation inside, or span - ;; several lines. - (eq ?/ (nth 3 state))) - (string-to-syntax "\"/"))))) - ;; Expression expansions in strings. We're handling them - ;; here, so that the regexp rule never matches inside them. - (ruby-expression-expansion-re - (0 (ignore (ruby-syntax-propertize-expansion)))) - ("^=en\\(d\\)\\_>" (1 "!")) - ("^\\(=\\)begin\\_>" (1 "!")) - ;; Handle here documents. - ((concat ruby-here-doc-beg-re ".*\\(\n\\)") - (7 (unless (ruby-singleton-class-p (match-beginning 0)) - (put-text-property (match-beginning 7) (match-end 7) - 'syntax-table (string-to-syntax "\"")) - (ruby-syntax-propertize-heredoc end)))) - ;; Handle percent literals: %w(), %q{}, etc. - ((concat "\\(?:^\\|[[ \t\n<+(,=]\\)" ruby-percent-literal-beg-re) - (1 (prog1 "|" (ruby-syntax-propertize-percent-literal end))))) - (point) end)) + (let (case-fold-search) + (goto-char start) + (remove-text-properties start end '(ruby-expansion-match-data)) + (ruby-syntax-propertize-heredoc end) + (ruby-syntax-enclosing-percent-literal end) + (funcall + (syntax-propertize-rules + ;; $' $" $` .... are variables. + ;; ?' ?" ?` are ascii codes. + ("\\([?$]\\)[#\"'`]" + (1 (unless (save-excursion + ;; Not within a string. + (nth 3 (syntax-ppss (match-beginning 0)))) + (string-to-syntax "\\")))) + ;; Regular expressions. Start with matching unescaped slash. + ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)" + (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1))))) + (when (or + ;; Beginning of a regexp. + (and (null (nth 8 state)) + (save-excursion + (forward-char -1) + (looking-back ruby-syntax-before-regexp-re + (point-at-bol)))) + ;; End of regexp. We don't match the whole + ;; regexp at once because it can have + ;; string interpolation inside, or span + ;; several lines. + (eq ?/ (nth 3 state))) + (string-to-syntax "\"/"))))) + ;; Expression expansions in strings. We're handling them + ;; here, so that the regexp rule never matches inside them. + (ruby-expression-expansion-re + (0 (ignore (ruby-syntax-propertize-expansion)))) + ("^=en\\(d\\)\\_>" (1 "!")) + ("^\\(=\\)begin\\_>" (1 "!")) + ;; Handle here documents. + ((concat ruby-here-doc-beg-re ".*\\(\n\\)") + (7 (unless (ruby-singleton-class-p (match-beginning 0)) + (put-text-property (match-beginning 7) (match-end 7) + 'syntax-table (string-to-syntax "\"")) + (ruby-syntax-propertize-heredoc end)))) + ;; Handle percent literals: %w(), %q{}, etc. + ((concat "\\(?:^\\|[[ \t\n<+(,=]\\)" ruby-percent-literal-beg-re) + (1 (prog1 "|" (ruby-syntax-propertize-percent-literal end))))) + (point) end))) (defun ruby-syntax-propertize-heredoc (limit) (let ((ppss (syntax-ppss)) @@ -1496,9 +1498,10 @@ (defun ruby-syntax-propertize-expansion () ;; Save the match data to a text property, for font-locking later. ;; Set the syntax of all double quotes and backticks to punctuation. - (let ((beg (match-beginning 2)) - (end (match-end 2))) - (when (and beg (save-excursion (nth 3 (syntax-ppss beg)))) + (let* ((beg (match-beginning 2)) + (end (match-end 2)) + (state (and beg (save-excursion (syntax-ppss beg))))) + (when (ruby-syntax-expansion-allowed-p state) (put-text-property beg (1+ beg) 'ruby-expansion-match-data (match-data)) (goto-char beg) @@ -1506,6 +1509,17 @@ (put-text-property (match-beginning 0) (match-end 0) 'syntax-table (string-to-syntax ".")))))) + (defun ruby-syntax-expansion-allowed-p (parse-state) + "Return non-nil if expression expansion is allowed." + (let ((term (nth 3 parse-state))) + (cond + ((memq term '(?\" ?` ?\n))) + ((eq term t) + (save-match-data + (save-excursion + (goto-char (nth 8 parse-state)) + (looking-at "%\\(?:[QWrx]\\|\\W\\)"))))))) + (defun ruby-syntax-propertize-expansions (start end) (save-excursion (goto-char start) === modified file 'test/ChangeLog' --- test/ChangeLog 2013-05-29 06:50:48 +0000 +++ test/ChangeLog 2013-05-31 06:04:33 +0000 @@ -1,3 +1,8 @@ +2013-05-31 Dmitry Gutov + + * automated/ruby-mode-tests.el: New tests, for percent literals + and expression expansion. + 2013-05-29 Leo Liu * indent/octave.m: Tweak. === modified file 'test/automated/ruby-mode-tests.el' --- test/automated/ruby-mode-tests.el 2013-05-19 06:01:23 +0000 +++ test/automated/ruby-mode-tests.el 2013-05-31 06:04:33 +0000 @@ -353,6 +353,23 @@ ;; It's confused by the closing paren in the middle. (ruby-assert-state s 8 nil))) +(ert-deftest ruby-interpolation-inside-double-quoted-percent-literals () + (ruby-assert-face "%Q{foo #@bar}" 8 font-lock-variable-name-face) + (ruby-assert-face "%W{foo #@bar}" 8 font-lock-variable-name-face) + (ruby-assert-face "%r{foo #@bar}" 8 font-lock-variable-name-face) + (ruby-assert-face "%x{foo #@bar}" 8 font-lock-variable-name-face)) + +(ert-deftest ruby-no-interpolation-in-single-quoted-literals () + (ruby-assert-face "'foo #@bar'" 7 font-lock-string-face) + (ruby-assert-face "%q{foo #@bar}" 8 font-lock-string-face) + (ruby-assert-face "%w{foo #@bar}" 8 font-lock-string-face) + (ruby-assert-face "%s{foo #@bar}" 8 font-lock-string-face)) + +(ert-deftest ruby-no-unknown-percent-literals () + ;; No folding of case. + (ruby-assert-face "%S{foo}" 4 nil) + (ruby-assert-face "%R{foo}" 4 nil)) + (ert-deftest ruby-add-log-current-method-examples () (let ((pairs '(("foo" . "#foo") ("C.foo" . ".foo") ------------------------------------------------------------ revno: 112795 fixes bug: http://debbugs.gnu.org/14474 committer: Paul Eggert branch nick: trunk timestamp: Thu 2013-05-30 18:41:52 -0700 message: Don't let D-bus autolaunch mess up SIGCHLD handling. * xterm.c (x_term_init): Inhibit D-Bus autolaunch if D-Bus is not already configured. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-05-31 01:31:10 +0000 +++ src/ChangeLog 2013-05-31 01:41:52 +0000 @@ -1,5 +1,9 @@ 2013-05-31 Paul Eggert + Don't let D-bus autolaunch mess up SIGCHLD handling (Bug#14474). + * xterm.c (x_term_init): Inhibit D-Bus autolaunch if D-Bus is + not already configured. + * fileio.c (Finsert_file_contents): Remove unused local (Bug#8447). 2013-05-29 Eli Zaretskii === modified file 'src/xterm.c' --- src/xterm.c 2013-05-09 14:49:56 +0000 +++ src/xterm.c 2013-05-31 01:41:52 +0000 @@ -9897,6 +9897,13 @@ XSetLocaleModifiers (""); + /* If D-Bus is not already configured, inhibit D-Bus autolaunch, + as autolaunch can mess up Emacs's SIGCHLD handler. + FIXME: Rewrite subprocess handlers to use glib's child watchers. + See Bug#14474. */ + if (! egetenv ("DBUS_SESSION_BUS_ADDRESS")) + xputenv ("DBUS_SESSION_BUS_ADDRESS=unix:path=/dev/null"); + /* Emacs can only handle core input events, so make sure Gtk doesn't use Xinput or Xinput2 extensions. */ xputenv ("GDK_CORE_DEVICE_EVENTS=1"); ------------------------------------------------------------ revno: 112794 fixes bug: http://debbugs.gnu.org/8447 committer: Paul Eggert branch nick: trunk timestamp: Thu 2013-05-30 18:31:10 -0700 message: * fileio.c (Finsert_file_contents): Remove unused local. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-05-29 16:48:42 +0000 +++ src/ChangeLog 2013-05-31 01:31:10 +0000 @@ -1,3 +1,7 @@ +2013-05-31 Paul Eggert + + * fileio.c (Finsert_file_contents): Remove unused local (Bug#8447). + 2013-05-29 Eli Zaretskii * Makefile.in (mostlyclean): Remove *.res files. === modified file 'src/fileio.c' --- src/fileio.c 2013-05-29 01:07:53 +0000 +++ src/fileio.c 2013-05-31 01:31:10 +0000 @@ -3489,7 +3489,6 @@ EMACS_TIME mtime; int fd; ptrdiff_t inserted = 0; - bool nochange = 0; ptrdiff_t how_much; off_t beg_offset, end_offset; int unprocessed; @@ -4060,9 +4059,7 @@ if (bufpos == inserted) { /* Truncate the buffer to the size of the file. */ - if (same_at_start == same_at_end) - nochange = 1; - else + if (same_at_start != same_at_end) del_range_byte (same_at_start, same_at_end, 0); inserted = 0; ------------------------------------------------------------ revno: 112793 fixes bug: http://debbugs.gnu.org/11378 committer: Juri Linkov branch nick: trunk timestamp: Fri 2013-05-31 02:45:41 +0300 message: * lisp/isearch.el (isearch-mode-map): Bind `isearch-toggle-invisible' to "\M-si". (isearch-invisible): New variable. (isearch-forward): Doc fix. (isearch-mode): Set `isearch-invisible' to the value of `search-invisible'. (isearch-toggle-case-fold): Doc fix. (isearch-toggle-invisible): New command. (isearch-query-replace): Let-bind `search-invisible' to the value of `isearch-invisible'. (isearch-search): Use `isearch-invisible' instead of `search-invisible'. Let-bind `search-invisible' to the value of `isearch-invisible'. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-05-27 23:02:37 +0000 +++ etc/NEWS 2013-05-30 23:45:41 +0000 @@ -241,6 +241,9 @@ *** `C-x 8 RET' in Isearch mode reads a character by its Unicode name and adds it to the search string. +*** `M-s i' toggles the variable `isearch-invisible' between nil and +the value of the option `search-invisible' (or `open' when it's nil). + *** `query-replace' skips invisible text when `search-invisible' is nil, and opens overlays with hidden text when `search-invisible' is `open'. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 23:33:08 +0000 +++ lisp/ChangeLog 2013-05-30 23:45:41 +0000 @@ -1,5 +1,21 @@ 2013-05-30 Juri Linkov + * isearch.el (isearch-mode-map): Bind `isearch-toggle-invisible' + to "\M-si". + (isearch-invisible): New variable. + (isearch-forward): Doc fix. + (isearch-mode): Set `isearch-invisible' + to the value of `search-invisible'. + (isearch-toggle-case-fold): Doc fix. + (isearch-toggle-invisible): New command. + (isearch-query-replace): Let-bind `search-invisible' + to the value of `isearch-invisible'. + (isearch-search): Use `isearch-invisible' instead of + `search-invisible'. Let-bind `search-invisible' + to the value of `isearch-invisible'. (Bug#11378) + +2013-05-30 Juri Linkov + * replace.el (perform-replace): Avoid `isearch-range-invisible' call when `query-flag' is nil and `search-invisible' is non-nil. (Bug#11746) === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-05-27 22:42:11 +0000 +++ lisp/isearch.el 2013-05-30 23:45:41 +0000 @@ -514,6 +514,7 @@ (define-key map "\M-e" 'isearch-edit-string) (define-key map "\M-sc" 'isearch-toggle-case-fold) + (define-key map "\M-si" 'isearch-toggle-invisible) (define-key map "\M-sr" 'isearch-toggle-regexp) (define-key map "\M-sw" 'isearch-toggle-word) (define-key map "\M-s_" 'isearch-toggle-symbol) @@ -602,6 +603,11 @@ ;; case in the search string is ignored. (defvar isearch-case-fold-search nil) +;; search-invisible while searching. +;; either nil, t, or 'open. 'open means the same as t except that +;; opens hidden overlays. +(defvar isearch-invisible search-invisible) + (defvar isearch-last-case-fold-search nil) ;; Used to save default value while isearch is active @@ -700,6 +706,7 @@ nonincremental search. Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. +Type \\[isearch-toggle-invisible] to toggle search in invisible text. Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-word] to toggle word mode. Type \\[isearch-toggle-symbol] to toggle symbol mode. @@ -836,6 +843,7 @@ isearch-op-fun op-fun isearch-last-case-fold-search isearch-case-fold-search isearch-case-fold-search case-fold-search + isearch-invisible search-invisible isearch-string "" isearch-message "" isearch-cmds nil @@ -1474,7 +1482,8 @@ (isearch-update)) (defun isearch-toggle-case-fold () - "Toggle case folding in searching on or off." + "Toggle case folding in searching on or off. +Toggles the value of the variable `isearch-case-fold-search'." (interactive) (setq isearch-case-fold-search (if isearch-case-fold-search nil 'yes)) @@ -1487,6 +1496,23 @@ (sit-for 1) (isearch-update)) +(defun isearch-toggle-invisible () + "Toggle searching in invisible text on or off. +Toggles the variable `isearch-invisible' between values +nil and a non-nil value of the option `search-invisible' +\(or `open' if `search-invisible' is nil)." + (interactive) + (setq isearch-invisible + (if isearch-invisible nil (or search-invisible 'open))) + (let ((message-log-max nil)) + (message "%s%s [match %svisible text]" + (isearch-message-prefix nil isearch-nonincremental) + isearch-message + (if isearch-invisible "in" ""))) + (setq isearch-success t isearch-adjusted t) + (sit-for 1) + (isearch-update)) + ;; Word search @@ -1622,6 +1648,7 @@ ;; set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) + (search-invisible isearch-invisible) (replace-lax-whitespace isearch-lax-whitespace) (replace-regexp-lax-whitespace @@ -2638,9 +2665,10 @@ (setq isearch-case-fold-search (isearch-no-upper-case-p isearch-string isearch-regexp))) (condition-case lossage - (let ((inhibit-point-motion-hooks search-invisible) + (let ((inhibit-point-motion-hooks isearch-invisible) (inhibit-quit nil) (case-fold-search isearch-case-fold-search) + (search-invisible isearch-invisible) (retry t)) (setq isearch-error nil) (while retry @@ -2836,7 +2864,7 @@ searched too when `search-invisible' is t." (or (eq search-invisible t) (not (isearch-range-invisible beg end)))) -(make-obsolete 'isearch-filter-visible 'search-invisible "24.4") +(make-obsolete 'isearch-filter-visible 'isearch-invisible "24.4") ;; General utilities ------------------------------------------------------------ revno: 112792 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-05-30 19:33:08 -0400 message: * lisp/progmodes/gdb-mi.el (gdb-wait-for-pending): Fix typo. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 23:29:42 +0000 +++ lisp/ChangeLog 2013-05-30 23:33:08 +0000 @@ -6,6 +6,8 @@ 2013-05-30 Glenn Morris + * progmodes/gdb-mi.el (gdb-wait-for-pending): Fix typo. + * progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New. (cc-require): Suppress spurious "noruntime" warnings. (cc-require-when-compile): Use fboundp, for sake of compiler. === modified file 'lisp/progmodes/gdb-mi.el' --- lisp/progmodes/gdb-mi.el 2013-05-14 18:34:13 +0000 +++ lisp/progmodes/gdb-mi.el 2013-05-30 23:33:08 +0000 @@ -345,7 +345,7 @@ `(run-with-timer 0.5 nil '(lambda () - (if (not (gdb-find-if (lambda (handler) + (if (not (cl-find-if (lambda (handler) (gdb-handler-pending-trigger handler)) gdb-handler-list)) (progn ,@body) ------------------------------------------------------------ revno: 112791 fixes bug: http://debbugs.gnu.org/11746 committer: Juri Linkov branch nick: trunk timestamp: Fri 2013-05-31 02:29:42 +0300 message: * lisp/replace.el (perform-replace): Avoid `isearch-range-invisible' call when `query-flag' is nil and `search-invisible' is non-nil. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 23:20:05 +0000 +++ lisp/ChangeLog 2013-05-30 23:29:42 +0000 @@ -1,3 +1,9 @@ +2013-05-30 Juri Linkov + + * replace.el (perform-replace): Avoid `isearch-range-invisible' + call when `query-flag' is nil and `search-invisible' is non-nil. + (Bug#11746) + 2013-05-30 Glenn Morris * progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New. === modified file 'lisp/replace.el' --- lisp/replace.el 2013-05-29 23:43:39 +0000 +++ lisp/replace.el 2013-05-30 23:29:42 +0000 @@ -2093,6 +2093,9 @@ (setq skip-filtered-count (1+ skip-filtered-count))) ;; Optionally ignore invisible matches. ((not (or (eq search-invisible t) + ;; Don't open overlays for automatic replacements. + (and (not query-flag) search-invisible) + ;; Open hidden overlays for interactive replacements. (not (isearch-range-invisible (nth 0 real-match-data) (nth 1 real-match-data))))) (setq skip-invisible-count (1+ skip-invisible-count))) ------------------------------------------------------------ revno: 112790 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-05-30 19:20:05 -0400 message: cc-bytecomp tweaks for sake of byte-compiler * lisp/progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New. (cc-require): Suppress spurious "noruntime" warnings. (cc-require-when-compile): Use fboundp, for sake of compiler. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 23:18:39 +0000 +++ lisp/ChangeLog 2013-05-30 23:20:05 +0000 @@ -1,5 +1,9 @@ 2013-05-30 Glenn Morris + * progmodes/cc-bytecomp.el (cc-bytecomp-noruntime-functions): New. + (cc-require): Suppress spurious "noruntime" warnings. + (cc-require-when-compile): Use fboundp, for sake of compiler. + * progmodes/cc-mode.el: Move load of cc-vars before that of cc-langs (which in turn loads cc-vars), to quieten compiler. === modified file 'lisp/progmodes/cc-bytecomp.el' --- lisp/progmodes/cc-bytecomp.el 2013-01-01 09:11:05 +0000 +++ lisp/progmodes/cc-bytecomp.el 2013-05-30 23:20:05 +0000 @@ -232,6 +232,9 @@ (cc-bytecomp-setup-environment) t)))) +(defvar cc-bytecomp-noruntime-functions nil + "Saved value of `byte-compile-noruntime-functions'.") + (defmacro cc-require (cc-part) "Force loading of the corresponding .el file in the current directory during compilation, but compile in a `require'. Don't use within @@ -240,7 +243,16 @@ Having cyclic cc-require's will result in infinite recursion. That's somewhat intentional." `(progn - (eval-when-compile (cc-bytecomp-load (symbol-name ,cc-part))) + (eval-when-compile + (setq cc-bytecomp-noruntime-functions byte-compile-noruntime-functions) + (cc-bytecomp-load (symbol-name ,cc-part))) + ;; Hack to suppress spurious "might not be defined at runtime" warnings. + ;; The basic issue is that + ;; (eval-when-compile (require 'foo)) + ;; (require 'foo) + ;; produces bogus noruntime warnings about functions from foo. + (eval-when-compile + (setq byte-compile-noruntime-functions cc-bytecomp-noruntime-functions)) (require ,cc-part))) (defmacro cc-provide (feature) @@ -266,7 +278,7 @@ during compilation, but do a compile time `require' otherwise. Don't use within `eval-when-compile'." `(eval-when-compile - (if (and (featurep 'cc-bytecomp) + (if (and (fboundp 'cc-bytecomp-is-compiling) (cc-bytecomp-is-compiling)) (if (or (not load-in-progress) (not (featurep ,cc-part))) ------------------------------------------------------------ revno: 112789 committer: Glenn Morris branch nick: trunk timestamp: Thu 2013-05-30 19:18:39 -0400 message: * lisp/progmodes/cc-mode.el: Move load of cc-vars before that of cc-langs (which in turn loads cc-vars), to quieten compiler. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 15:44:54 +0000 +++ lisp/ChangeLog 2013-05-30 23:18:39 +0000 @@ -1,3 +1,8 @@ +2013-05-30 Glenn Morris + + * progmodes/cc-mode.el: Move load of cc-vars before that of + cc-langs (which in turn loads cc-vars), to quieten compiler. + 2013-05-30 Stefan Monnier * paren.el: Simplify the code. === modified file 'lisp/progmodes/cc-mode.el' --- lisp/progmodes/cc-mode.el 2013-05-28 15:42:56 +0000 +++ lisp/progmodes/cc-mode.el 2013-05-30 23:18:39 +0000 @@ -86,8 +86,8 @@ (load "cc-bytecomp" nil t))) (cc-require 'cc-defs) +(cc-require 'cc-vars) (cc-require-when-compile 'cc-langs) -(cc-require 'cc-vars) (cc-require 'cc-engine) (cc-require 'cc-styles) (cc-require 'cc-cmds) ------------------------------------------------------------ revno: 112788 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-05-30 11:44:54 -0400 message: * lisp/paren.el: Simplify the code. (show-paren-mode): Always start the timer. (show-paren--idle-timer): Rename from show-paren-idle-timer. (show-paren--overlay, show-paren--overlay-1): Rename from show-paren-overlay and show-paren-overlay-1, and initialize to an overlay rather than to nil. (show-paren-function): Misc cleanup and simplifications. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 14:20:52 +0000 +++ lisp/ChangeLog 2013-05-30 15:44:54 +0000 @@ -1,5 +1,15 @@ 2013-05-30 Stefan Monnier + * paren.el: Simplify the code. + (show-paren-mode): Always start the timer. + (show-paren--idle-timer): Rename from show-paren-idle-timer. + (show-paren--overlay, show-paren--overlay-1): Rename from + show-paren-overlay and show-paren-overlay-1, and initialize to an + overlay rather than to nil. + (show-paren-function): Misc cleanup and simplifications. + +2013-05-30 Stefan Monnier + * paren.el (show-paren-data-function): New hook. (show-paren--default): New function, extracted from show-paren-function. (show-paren-function): Use show-paren-data-function. === modified file 'lisp/paren.el' --- lisp/paren.el 2013-05-30 14:20:52 +0000 +++ lisp/paren.el 2013-05-30 15:44:54 +0000 @@ -37,11 +37,6 @@ :prefix "show-paren-" :group 'paren-matching) -;; This is the overlay used to highlight the matching paren. -(defvar show-paren-overlay nil) -;; This is the overlay used to highlight the closeparen right before point. -(defvar show-paren-overlay-1 nil) - (defcustom show-paren-style 'parenthesis "Style used when showing a matching paren. Valid styles are `parenthesis' (meaning show the matching paren), @@ -107,7 +102,14 @@ (defvar show-paren-highlight-openparen t "Non-nil turns on openparen highlighting when matching forward.") -(defvar show-paren-idle-timer nil) +(defvar show-paren--idle-timer nil) +(defvar show-paren--overlay + (let ((ol (make-overlay (point) (point) nil t))) (delete-overlay ol) ol) + "Overlay used to highlight the matching paren.") +(defvar show-paren--overlay-1 + (let ((ol (make-overlay (point) (point) nil t))) (delete-overlay ol) ol) + "Overlay used to highlight the paren at point.") + ;;;###autoload (define-minor-mode show-paren-mode @@ -120,27 +122,17 @@ matching parenthesis is highlighted in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time." :global t :group 'paren-showing - ;; Enable or disable the mechanism. - ;; First get rid of the old idle timer. - (if show-paren-idle-timer - (cancel-timer show-paren-idle-timer)) - (setq show-paren-idle-timer nil) - ;; If show-paren-mode is enabled in some buffer now, - ;; set up a new timer. - (when (memq t (mapcar (lambda (buffer) - (with-current-buffer buffer - show-paren-mode)) - (buffer-list))) - (setq show-paren-idle-timer (run-with-idle-timer - show-paren-delay t - 'show-paren-function))) - (unless show-paren-mode - (and show-paren-overlay - (eq (overlay-buffer show-paren-overlay) (current-buffer)) - (delete-overlay show-paren-overlay)) - (and show-paren-overlay-1 - (eq (overlay-buffer show-paren-overlay-1) (current-buffer)) - (delete-overlay show-paren-overlay-1)))) + ;; Enable or disable the mechanism. + ;; First get rid of the old idle timer. + (when show-paren--idle-timer + (cancel-timer show-paren--idle-timer) + (setq show-paren--idle-timer nil)) + (setq show-paren--idle-timer (run-with-idle-timer + show-paren-delay t + #'show-paren-function)) + (unless show-paren-mode + (delete-overlay show-paren--overlay) + (delete-overlay show-paren--overlay-1))) (defvar show-paren-data-function #'show-paren--default "Function to find the opener/closer at point and its match. @@ -183,7 +175,8 @@ (error (setq pos t mismatch t))) ;; Move back the other way and verify we get back to the ;; starting point. If not, these two parens don't really match. - ;; Maybe the one at point is escaped and doesn't really count. + ;; Maybe the one at point is escaped and doesn't really count, + ;; or one is inside a comment. (when (integerp pos) (unless (condition-case () (eq (point) (scan-sexps pos (- dir))) @@ -215,74 +208,62 @@ ;; Find the place to show, if there is one, ;; and show it until input arrives. (defun show-paren-function () - (if show-paren-mode - (let* ((data (funcall show-paren-data-function)) - (dir (if (ignore-errors (> (nth 2 data) (nth 0 data))) 1 -1)) - (pos (nth (if (= dir 1) 3 2) data)) + (let ((data (and show-paren-mode (funcall show-paren-data-function)))) + (if (not data) + (progn + ;; If show-paren-mode is nil in this buffer or if not at a paren that + ;; has a match, turn off any previous paren highlighting. + (delete-overlay show-paren--overlay) + (delete-overlay show-paren--overlay-1)) + + ;; Found something to highlight. + (let* ((here-beg (nth 0 data)) + (here-end (nth 1 data)) + (there-beg (nth 2 data)) + (there-end (nth 3 data)) (mismatch (nth 4 data)) - face) - ;; - ;; Highlight the other end of the sexp, or unhighlight if none. - (if (not (or pos mismatch)) - (progn - ;; If not at a paren that has a match, - ;; turn off any previous paren highlighting. - (and show-paren-overlay (overlay-buffer show-paren-overlay) - (delete-overlay show-paren-overlay)) - (and show-paren-overlay-1 (overlay-buffer show-paren-overlay-1) - (delete-overlay show-paren-overlay-1))) - ;; - ;; Use the correct face. - (if mismatch - (progn - (if show-paren-ring-bell-on-mismatch - (beep)) - (setq face 'show-paren-mismatch)) - (setq face 'show-paren-match)) - ;; - ;; If matching backwards, highlight the closeparen - ;; before point as well as its matching open. - ;; If matching forward, and the openparen is unbalanced, - ;; highlight the paren at point to indicate misbalance. - ;; Otherwise, turn off any such highlighting. - (if (and (not show-paren-highlight-openparen) (= dir 1) (integerp pos)) - (when (and show-paren-overlay-1 - (overlay-buffer show-paren-overlay-1)) - (delete-overlay show-paren-overlay-1)) - (let ((from (nth 0 data)) - (to (nth 1 data))) - (if show-paren-overlay-1 - (move-overlay show-paren-overlay-1 from to (current-buffer)) - (setq show-paren-overlay-1 (make-overlay from to nil t))) - ;; Always set the overlay face, since it varies. - (overlay-put show-paren-overlay-1 'priority show-paren-priority) - (overlay-put show-paren-overlay-1 'face face))) - ;; - ;; Turn on highlighting for the matching paren, if found. - ;; If it's an unmatched paren, turn off any such highlighting. - (if (not (integerp pos)) - (when show-paren-overlay (delete-overlay show-paren-overlay)) - (let ((to (if (or (eq show-paren-style 'expression) - (and (eq show-paren-style 'mixed) - (not (pos-visible-in-window-p pos)))) - (point) - (nth 3 data))) - (from (if (or (eq show-paren-style 'expression) - (and (eq show-paren-style 'mixed) - (not (pos-visible-in-window-p pos)))) - pos - (nth 2 data)))) - (if show-paren-overlay - (move-overlay show-paren-overlay from to (current-buffer)) - (setq show-paren-overlay (make-overlay from to nil t)))) - ;; Always set the overlay face, since it varies. - (overlay-put show-paren-overlay 'priority show-paren-priority) - (overlay-put show-paren-overlay 'face face)))) - ;; show-paren-mode is nil in this buffer. - (and show-paren-overlay - (delete-overlay show-paren-overlay)) - (and show-paren-overlay-1 - (delete-overlay show-paren-overlay-1)))) + (face + (if mismatch + (progn + (if show-paren-ring-bell-on-mismatch + (beep)) + 'show-paren-mismatch) + 'show-paren-match))) + ;; + ;; If matching backwards, highlight the closeparen + ;; before point as well as its matching open. + ;; If matching forward, and the openparen is unbalanced, + ;; highlight the paren at point to indicate misbalance. + ;; Otherwise, turn off any such highlighting. + (if (or (not here-beg) + (and (not show-paren-highlight-openparen) + (> here-end (point)) + (integerp there-beg))) + (delete-overlay show-paren--overlay-1) + (move-overlay show-paren--overlay-1 + here-beg here-end (current-buffer)) + ;; Always set the overlay face, since it varies. + (overlay-put show-paren--overlay-1 'priority show-paren-priority) + (overlay-put show-paren--overlay-1 'face face)) + ;; + ;; Turn on highlighting for the matching paren, if found. + ;; If it's an unmatched paren, turn off any such highlighting. + (if (not there-beg) + (delete-overlay show-paren--overlay) + (if (or (eq show-paren-style 'expression) + (and (eq show-paren-style 'mixed) + (let ((closest (if (< there-beg here-beg) + (1- there-end) (1+ there-beg)))) + (not (pos-visible-in-window-p closest))))) + (move-overlay show-paren--overlay + (point) + (if (< there-beg here-beg) there-beg there-end) + (current-buffer)) + (move-overlay show-paren--overlay + there-beg there-end (current-buffer))) + ;; Always set the overlay face, since it varies. + (overlay-put show-paren--overlay 'priority show-paren-priority) + (overlay-put show-paren--overlay 'face face)))))) (provide 'paren) ------------------------------------------------------------ revno: 112787 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-05-30 10:20:52 -0400 message: * lisp/paren.el (show-paren-data-function): New hook. (show-paren--default): New function, extracted from show-paren-function. (show-paren-function): Use show-paren-data-function. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 03:30:34 +0000 +++ lisp/ChangeLog 2013-05-30 14:20:52 +0000 @@ -1,3 +1,9 @@ +2013-05-30 Stefan Monnier + + * paren.el (show-paren-data-function): New hook. + (show-paren--default): New function, extracted from show-paren-function. + (show-paren-function): Use show-paren-data-function. + 2013-05-30 Glenn Morris * ielm.el (ielm-map, ielm-complete-symbol): === modified file 'lisp/paren.el' --- lisp/paren.el 2013-01-24 21:19:02 +0000 +++ lisp/paren.el 2013-05-30 14:20:52 +0000 @@ -142,67 +142,88 @@ (eq (overlay-buffer show-paren-overlay-1) (current-buffer)) (delete-overlay show-paren-overlay-1)))) +(defvar show-paren-data-function #'show-paren--default + "Function to find the opener/closer at point and its match. +The function is called with no argument and should return either nil +if there's no opener/closer at point, or a list of the form +\(HERE-BEG HERE-END THERE-BEG THERE-END MISMATCH) +Where HERE-BEG..HERE-END is expected to be around point.") + +(defun show-paren--default () + (let* ((oldpos (point)) + (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) + ((eq (syntax-class (syntax-after (point))) 4) 1))) + (unescaped + (when dir + ;; Verify an even number of quoting characters precede the paren. + ;; Follow the same logic as in `blink-matching-open'. + (= (if (= dir -1) 1 0) + (logand 1 (- (point) + (save-excursion + (if (= dir -1) (forward-char -1)) + (skip-syntax-backward "/\\") + (point))))))) + (here-beg (if (eq dir 1) (point) (1- (point)))) + (here-end (if (eq dir 1) (1+ (point)) (point))) + pos mismatch) + ;; + ;; Find the other end of the sexp. + (when unescaped + (save-excursion + (save-restriction + ;; Determine the range within which to look for a match. + (when blink-matching-paren-distance + (narrow-to-region + (max (point-min) (- (point) blink-matching-paren-distance)) + (min (point-max) (+ (point) blink-matching-paren-distance)))) + ;; Scan across one sexp within that range. + ;; Errors or nil mean there is a mismatch. + (condition-case () + (setq pos (scan-sexps (point) dir)) + (error (setq pos t mismatch t))) + ;; Move back the other way and verify we get back to the + ;; starting point. If not, these two parens don't really match. + ;; Maybe the one at point is escaped and doesn't really count. + (when (integerp pos) + (unless (condition-case () + (eq (point) (scan-sexps pos (- dir))) + (error nil)) + (setq pos nil))) + ;; If found a "matching" paren, see if it is the right + ;; kind of paren to match the one we started at. + (if (not (integerp pos)) + (if mismatch (list here-beg here-end nil nil t)) + (let ((beg (min pos oldpos)) (end (max pos oldpos))) + (unless (eq (syntax-class (syntax-after beg)) 8) + (setq mismatch + (not (or (eq (char-before end) + ;; This can give nil. + (cdr (syntax-after beg))) + (eq (char-after beg) + ;; This can give nil. + (cdr (syntax-after (1- end)))) + ;; The cdr might hold a new paren-class + ;; info rather than a matching-char info, + ;; in which case the two CDRs should match. + (eq (cdr (syntax-after (1- end))) + (cdr (syntax-after beg))))))) + (list here-beg here-end + (if (= dir 1) (1- pos) pos) + (if (= dir 1) pos (1+ pos)) + mismatch)))))))) + ;; Find the place to show, if there is one, ;; and show it until input arrives. (defun show-paren-function () (if show-paren-mode - (let* ((oldpos (point)) - (dir (cond ((eq (syntax-class (syntax-after (1- (point)))) 5) -1) - ((eq (syntax-class (syntax-after (point))) 4) 1))) - (unescaped - (when dir - ;; Verify an even number of quoting characters precede the paren. - ;; Follow the same logic as in `blink-matching-open'. - (= (if (= dir -1) 1 0) - (logand 1 (- (point) - (save-excursion - (if (= dir -1) (forward-char -1)) - (skip-syntax-backward "/\\") - (point))))))) - pos mismatch face) - ;; - ;; Find the other end of the sexp. - (when unescaped - (save-excursion - (save-restriction - ;; Determine the range within which to look for a match. - (when blink-matching-paren-distance - (narrow-to-region - (max (point-min) (- (point) blink-matching-paren-distance)) - (min (point-max) (+ (point) blink-matching-paren-distance)))) - ;; Scan across one sexp within that range. - ;; Errors or nil mean there is a mismatch. - (condition-case () - (setq pos (scan-sexps (point) dir)) - (error (setq pos t mismatch t))) - ;; Move back the other way and verify we get back to the - ;; starting point. If not, these two parens don't really match. - ;; Maybe the one at point is escaped and doesn't really count. - (when (integerp pos) - (unless (condition-case () - (eq (point) (scan-sexps pos (- dir))) - (error nil)) - (setq pos nil))) - ;; If found a "matching" paren, see if it is the right - ;; kind of paren to match the one we started at. - (when (integerp pos) - (let ((beg (min pos oldpos)) (end (max pos oldpos))) - (unless (eq (syntax-class (syntax-after beg)) 8) - (setq mismatch - (not (or (eq (char-before end) - ;; This can give nil. - (cdr (syntax-after beg))) - (eq (char-after beg) - ;; This can give nil. - (cdr (syntax-after (1- end)))) - ;; The cdr might hold a new paren-class - ;; info rather than a matching-char info, - ;; in which case the two CDRs should match. - (eq (cdr (syntax-after (1- end))) - (cdr (syntax-after beg)))))))))))) + (let* ((data (funcall show-paren-data-function)) + (dir (if (ignore-errors (> (nth 2 data) (nth 0 data))) 1 -1)) + (pos (nth (if (= dir 1) 3 2) data)) + (mismatch (nth 4 data)) + face) ;; ;; Highlight the other end of the sexp, or unhighlight if none. - (if (not pos) + (if (not (or pos mismatch)) (progn ;; If not at a paren that has a match, ;; turn off any previous paren highlighting. @@ -228,12 +249,8 @@ (when (and show-paren-overlay-1 (overlay-buffer show-paren-overlay-1)) (delete-overlay show-paren-overlay-1)) - (let ((from (if (= dir 1) - (point) - (- (point) 1))) - (to (if (= dir 1) - (+ (point) 1) - (point)))) + (let ((from (nth 0 data)) + (to (nth 1 data))) (if show-paren-overlay-1 (move-overlay show-paren-overlay-1 from to (current-buffer)) (setq show-paren-overlay-1 (make-overlay from to nil t))) @@ -249,14 +266,12 @@ (and (eq show-paren-style 'mixed) (not (pos-visible-in-window-p pos)))) (point) - pos)) + (nth 3 data))) (from (if (or (eq show-paren-style 'expression) (and (eq show-paren-style 'mixed) (not (pos-visible-in-window-p pos)))) pos - (save-excursion - (goto-char pos) - (- (point) dir))))) + (nth 2 data)))) (if show-paren-overlay (move-overlay show-paren-overlay from to (current-buffer)) (setq show-paren-overlay (make-overlay from to nil t)))) ------------------------------------------------------------ revno: 112786 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-05-30 09:57:44 -0400 message: * syntax.el (syntax-propertize-function): Fix docstring. diff: === modified file 'lisp/emacs-lisp/syntax.el' --- lisp/emacs-lisp/syntax.el 2013-04-22 14:11:37 +0000 +++ lisp/emacs-lisp/syntax.el 2013-05-30 13:57:44 +0000 @@ -56,12 +56,13 @@ ;; syntax-ppss-flush-cache since that would not only flush the cache but also ;; reset syntax-propertize--done which should not be done in this case). "Mode-specific function to apply `syntax-table' text properties. -The value of this variable is a function to be called by Font -Lock mode, prior to performing syntactic fontification on a -stretch of text. It is given two arguments, START and END: the -start and end of the text to be fontified. Major modes can -specify a custom function to apply `syntax-table' properties to -override the default syntax table in special cases. +It is the work horse of `syntax-propertize', which is called by things like +Font-Lock and indentation. + +It is given two arguments, START and END: the start and end of the text to +which `syntax-table' might need to be applied. Major modes can use this to +override the buffer's syntax table for special syntactic constructs that +cannot be handled just by the buffer's syntax-table. The specified function may call `syntax-ppss' on any position before END, but it should not call `syntax-ppss-flush-cache', ------------------------------------------------------------ revno: 112785 committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2013-05-30 17:27:55 +0800 message: Refine maintaining.texi. * maintaining.texi (Types of Log File): Supplement some information of change log files. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2013-05-15 23:14:18 +0000 +++ doc/emacs/ChangeLog 2013-05-30 09:27:55 +0000 @@ -1,3 +1,8 @@ +2013-05-30 Xue Fuqiao + + * maintaining.texi (Types of Log File): Supplement some + information of change log files. + 2013-05-15 Juri Linkov * search.texi (Repeat Isearch): Mention key `RET' to finish === modified file 'doc/emacs/maintaining.texi' --- doc/emacs/maintaining.texi 2013-01-02 16:13:04 +0000 +++ doc/emacs/maintaining.texi 2013-05-30 09:27:55 +0000 @@ -342,7 +342,9 @@ modification log for the entire system, which makes change log files somewhat redundant. One advantage that they retain is that it is sometimes useful to be able to view the transaction history of a -single directory separately from those of other directories. +single directory separately from those of other directories. Another +advantage is that commit logs can't be fixed in many version control +systems. A project maintained with version control can use just the version control log, or it can use both kinds of logs. It can handle some ------------------------------------------------------------ revno: 112784 committer: Glenn Morris branch nick: trunk timestamp: Wed 2013-05-29 20:30:34 -0700 message: Silence ielm compilation * lisp/ielm.el (ielm-map, ielm-complete-symbol): Use completion-at-point rather than obsolete functions. (inferior-emacs-lisp-mode): Doc fix. Set completion-at-point-functions, rather than comint-dynamic-complete-functions. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-05-30 03:27:46 +0000 +++ lisp/ChangeLog 2013-05-30 03:30:34 +0000 @@ -1,5 +1,11 @@ 2013-05-30 Glenn Morris + * ielm.el (ielm-map, ielm-complete-symbol): + Use completion-at-point rather than obsolete functions. + (inferior-emacs-lisp-mode): Doc fix. + Set completion-at-point-functions, rather than + comint-dynamic-complete-functions. + * eshell/em-cmpl.el (eshell-complete-lisp-symbol): New function. (eshell-cmpl-initialize, eshell-complete-parse-arguments): Replace obsolete lisp-complete-symbol with eshell-complete-lisp-symbol. === modified file 'lisp/ielm.el' --- lisp/ielm.el 2013-05-23 15:27:48 +0000 +++ lisp/ielm.el 2013-05-30 03:30:34 +0000 @@ -167,7 +167,7 @@ (defvar ielm-map (let ((map (make-sparse-keymap))) - (define-key map "\t" 'comint-dynamic-complete) + (define-key map "\t" 'completion-at-point) (define-key map "\C-m" 'ielm-return) (define-key map "\C-j" 'ielm-send-input) (define-key map "\e\C-x" 'eval-defun) ; for consistency with @@ -209,12 +209,13 @@ (defun ielm-complete-symbol nil "Complete the Lisp symbol before point." - ;; A wrapper for lisp-complete symbol that returns non-nil if + ;; A wrapper for completion-at-point that returns non-nil if ;; completion has occurred (let* ((btick (buffer-modified-tick)) (cbuffer (get-buffer "*Completions*")) - (ctick (and cbuffer (buffer-modified-tick cbuffer)))) - (lisp-complete-symbol) + (ctick (and cbuffer (buffer-modified-tick cbuffer))) + (completion-at-point-functions '(lisp-completion-at-point))) + (completion-at-point) ;; completion has occurred if: (or ;; the buffer has been modified @@ -461,7 +462,7 @@ Inputs longer than one line are moved to the line following the prompt (but see variable `ielm-dynamic-multiline-inputs'). -* \\[comint-dynamic-complete] completes Lisp symbols (or filenames, within strings), +* \\[completion-at-point] completes Lisp symbols (or filenames, within strings), or indents the line if there is nothing to complete. The current working buffer may be changed (with a call to `set-buffer', @@ -498,7 +499,7 @@ (set (make-local-variable 'paragraph-start) comint-prompt-regexp) (setq comint-input-sender 'ielm-input-sender) (setq comint-process-echoes nil) - (set (make-local-variable 'comint-dynamic-complete-functions) + (set (make-local-variable 'completion-at-point-functions) '(ielm-tab comint-replace-by-expanded-history ielm-complete-filename ielm-complete-symbol)) (set (make-local-variable 'ielm-prompt-internal) ielm-prompt) @@ -513,8 +514,6 @@ (set (make-local-variable 'indent-line-function) 'ielm-indent-line) (set (make-local-variable 'ielm-working-buffer) (current-buffer)) (set (make-local-variable 'fill-paragraph-function) 'lisp-fill-paragraph) - (add-hook 'completion-at-point-functions - 'lisp-completion-at-point nil 'local) ;; Value holders (set (make-local-variable '*) nil)