Now on revision 109916. ------------------------------------------------------------ revno: 109916 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-09-06 23:47:30 -0700 message: * syssignal.h (handle_on_main_thread): Always declare, even if FORWARD_SIGNAL_TO_MAIN_THREAD is not defined. This ports to platforms without HAVE_PTHREAD. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-07 01:27:44 +0000 +++ src/ChangeLog 2012-09-07 06:47:30 +0000 @@ -1,3 +1,9 @@ +2012-09-07 Paul Eggert + + * syssignal.h (handle_on_main_thread): Always declare, + even if FORWARD_SIGNAL_TO_MAIN_THREAD is not defined. + This ports to platforms without HAVE_PTHREAD. + 2012-09-06 Paul Eggert Signal-handler cleanup (Bug#12327). === modified file 'src/syssignal.h' --- src/syssignal.h 2012-09-07 01:27:44 +0000 +++ src/syssignal.h 2012-09-07 06:47:30 +0000 @@ -84,5 +84,6 @@ #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD extern pthread_t main_thread; +#endif + void handle_on_main_thread (int, signal_handler_t); -#endif ------------------------------------------------------------ revno: 109915 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2012-09-07 09:06:05 +0400 message: * lisp/progmodes/ruby-mode.el (ruby-beginning-of-defun): Only consider 3 keywords defun beginners. (ruby-end-of-defun): Expect that the point is at the beginning of the defun. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-07 05:00:32 +0000 +++ lisp/ChangeLog 2012-09-07 05:06:05 +0000 @@ -8,6 +8,9 @@ * progmodes/ruby-mode.el (ruby-end-of-defun) (ruby-beginning-of-defun): Simplify, allow indentation before block beginning and end keywords. + (ruby-beginning-of-defun): Only consider 3 keywords defun beginners. + (ruby-end-of-defun): Expect that the point is at the beginning of + the defun. 2012-09-06 Stefan Monnier === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2012-09-07 04:36:20 +0000 +++ lisp/progmodes/ruby-mode.el 2012-09-07 05:06:05 +0000 @@ -98,6 +98,10 @@ (defconst ruby-block-end-re "\\_") +(defconst ruby-defun-beg-re + '"\\(def\\|class\\|module\\)" + "Regexp to match the beginning of a defun, in the general sense.") + (eval-and-compile (defconst ruby-here-doc-beg-re "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" @@ -833,13 +837,12 @@ (+ indent ruby-indent-level) indent)))) -;; TODO: Why isn't one ruby-*-of-defun written in terms of the other? (defun ruby-beginning-of-defun (&optional arg) "Move backward to the beginning of the current top-level defun. With ARG, move backward multiple defuns. Negative ARG means move forward." (interactive "p") - (and (re-search-backward (concat "^\\s *\\(" ruby-block-beg-re "\\)\\_>") + (and (re-search-backward (concat "^\\s *" ruby-defun-beg-re "\\_>") nil t (or arg 1)) (beginning-of-line))) @@ -848,9 +851,9 @@ With ARG, move forward multiple defuns. Negative ARG means move backward." (interactive "p") - (and (re-search-forward (concat "^\\s *" ruby-block-end-re) nil t (or arg 1)) - (beginning-of-line)) - (forward-line 1)) + (ruby-forward-sexp) + (when (looking-back (concat "^\\s *" ruby-block-end-re)) + (forward-line 1))) (defun ruby-beginning-of-indent () "Backtrack to a line which can be used as a reference for @@ -1050,7 +1053,7 @@ (let (mname mlist (indent 0)) ;; get current method (or class/module) (if (re-search-backward - (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" + (concat "^[ \t]*" ruby-defun-beg-re "[ \t]+" "\\(" ;; \\. and :: for class method "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)" ------------------------------------------------------------ revno: 109914 fixes bug: http://debbugs.gnu.org/7014 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-09-07 13:00:32 +0800 message: Fix for invoking C-h c from the minibuffer. * help.el (describe-key-briefly): Allow the message to be seen when invoked from the minibuffer. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-07 04:36:20 +0000 +++ lisp/ChangeLog 2012-09-07 05:00:32 +0000 @@ -1,3 +1,8 @@ +2012-09-07 Chong Yidong + + * help.el (describe-key-briefly): Allow the message to be seen + when invoked from the minibuffer (Bug#7014). + 2012-09-07 Dmitry Gutov * progmodes/ruby-mode.el (ruby-end-of-defun) === modified file 'lisp/help.el' --- lisp/help.el 2012-09-05 09:22:20 +0000 +++ lisp/help.el 2012-09-07 05:00:32 +0000 @@ -585,6 +585,8 @@ (setq saved-yank-menu (copy-sequence yank-menu)) (menu-bar-update-yank-menu "(any string)" nil)) (setq key (read-key-sequence "Describe key (or click or menu item): ")) + ;; Clear the echo area message (Bug#7014). + (message nil) ;; If KEY is a down-event, read and discard the ;; corresponding up-event. Note that there are also ;; down-events on scroll bars and mode lines: the actual ------------------------------------------------------------ revno: 109913 fixes bug: http://debbugs.gnu.org/12269 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-09-07 12:51:26 +0800 message: Add a couple of xrefs to the Lisp manual. * markers.texi (Moving Markers): Add xref to Point. * syntax.texi (Low-Level Parsing): Add xref to Parser State. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-09-04 21:21:00 +0000 +++ doc/lispref/ChangeLog 2012-09-07 04:51:26 +0000 @@ -1,3 +1,10 @@ +2012-09-07 Chong Yidong + + * markers.texi (Moving Markers): Add xref to Point (Bug#7151). + + * syntax.texi (Low-Level Parsing): Add xref to Parser State + (Bug#12269). + 2012-09-04 Lars Ingebrigtsen * debugging.texi (Explicit Debug): Document `debug-on-message'. === modified file 'doc/lispref/markers.texi' --- doc/lispref/markers.texi 2012-05-27 01:34:14 +0000 +++ doc/lispref/markers.texi 2012-09-07 04:51:26 +0000 @@ -355,9 +355,9 @@ If @var{position} is less than 1, @code{set-marker} moves @var{marker} to the beginning of the buffer. If @var{position} is greater than the -size of the buffer, @code{set-marker} moves marker to the end of the -buffer. If @var{position} is @code{nil} or a marker that points -nowhere, then @var{marker} is set to point nowhere. +size of the buffer (@pxref{Point}), @code{set-marker} moves marker to +the end of the buffer. If @var{position} is @code{nil} or a marker +that points nowhere, then @var{marker} is set to point nowhere. The value returned is @var{marker}. === modified file 'doc/lispref/syntax.texi' --- doc/lispref/syntax.texi 2012-08-04 14:33:00 +0000 +++ doc/lispref/syntax.texi 2012-09-07 04:51:26 +0000 @@ -878,6 +878,9 @@ @var{start}, not scanning past @var{limit}. It stops at position @var{limit} or when certain criteria described below are met, and sets point to the location where parsing stops. It returns a parser state +@ifinfo +(@pxref{Parser State}) +@end ifinfo describing the status of the parse at the point where it stops. @cindex parenthesis depth ------------------------------------------------------------ revno: 109912 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2012-09-07 08:36:20 +0400 message: * lisp/progmodes/ruby-mode.el (ruby-end-of-defun) (ruby-beginning-of-defun): Simplify, allow indentation before block beginning and end keywords. Also, fix accidental change in the former. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-07 04:15:56 +0000 +++ lisp/ChangeLog 2012-09-07 04:36:20 +0000 @@ -1,3 +1,9 @@ +2012-09-07 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-end-of-defun) + (ruby-beginning-of-defun): Simplify, allow indentation before + block beginning and end keywords. + 2012-09-06 Stefan Monnier * emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2012-09-07 04:15:56 +0000 +++ lisp/progmodes/ruby-mode.el 2012-09-07 04:36:20 +0000 @@ -839,8 +839,8 @@ With ARG, move backward multiple defuns. Negative ARG means move forward." (interactive "p") - (and (re-search-backward (concat "^\\(" ruby-block-beg-re "\\)\\b") - nil 'move (or arg 1)) + (and (re-search-backward (concat "^\\s *\\(" ruby-block-beg-re "\\)\\_>") + nil t (or arg 1)) (beginning-of-line))) (defun ruby-end-of-defun (&optional arg) @@ -848,7 +848,7 @@ With ARG, move forward multiple defuns. Negative ARG means move backward." (interactive "p") - (and (re-search-forward ruby-indent-beg-re nil 'move (or arg 1)) + (and (re-search-forward (concat "^\\s *" ruby-block-end-re) nil t (or arg 1)) (beginning-of-line)) (forward-line 1)) ------------------------------------------------------------ revno: 109911 fixes bug: http://debbugs.gnu.org/11613 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2012-09-07 08:15:56 +0400 message: * lisp/progmodes/ruby-mode.el (ruby-indent-beg-re): Add pieces from ruby-beginning-of-indent, simplify, allow all keywords to have indentation before them. (ruby-beginning-of-indent): Adjust for above. Search until the found point is not inside a string or comment. (ruby-font-lock-keywords): Allow symbols to start with "@" character, give them higher priority than variables. (ruby-syntax-propertize-function) (ruby-font-lock-syntactic-keywords): Remove the "not comments" matchers. Expression expansions are not comments when inside a string, and there comment syntax status is irrelevant. (ruby-match-expression-expansion): New function. Check that expression expansion is inside a string, and it's not escaped. (ruby-font-lock-keywords): Use it. * test/automated/ruby-mode-tests.el: New tests (Bug#11613). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-06 15:35:08 +0000 +++ lisp/ChangeLog 2012-09-07 04:15:56 +0000 @@ -51,6 +51,23 @@ Let-bind `isearch-word' to the argument `delimited-flag'. (Bug#10885, bug#10887) +2012-09-07 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-indent-beg-re): Add pieces from + ruby-beginning-of-indent, simplify, allow all keywords to have + indentation before them. + (ruby-beginning-of-indent): Adjust for above. Search until the + found point is not inside a string or comment. + (ruby-font-lock-keywords): Allow symbols to start with "@" + character, give them higher priority than variables. + (ruby-syntax-propertize-function) + (ruby-font-lock-syntactic-keywords): Remove the "not comments" + matchers. Expression expansions are not comments when inside a + string, and there comment syntax status is irrelevant. + (ruby-match-expression-expansion): New function. Check that + expression expansion is inside a string, and it's not escaped. + (ruby-font-lock-keywords): Use it. + 2012-09-05 Martin Rudalics * help.el (temp-buffer-max-height): New default value. === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2012-09-04 04:42:47 +0000 +++ lisp/progmodes/ruby-mode.el 2012-09-07 04:15:56 +0000 @@ -64,8 +64,8 @@ "Regexp to match keywords that nest without blocks.") (defconst ruby-indent-beg-re - (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)\\|" - (regexp-opt '("if" "unless" "case" "while" "until" "for" "begin"))) + (concat "^\\s *" (regexp-opt '("class" "module" "def" "if" "unless" "case" + "while" "until" "for" "begin")) "\\_>") "Regexp to match where the indentation gets deeper.") (defconst ruby-modifier-beg-keywords @@ -848,19 +848,18 @@ With ARG, move forward multiple defuns. Negative ARG means move backward." (interactive "p") - (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\($\\|\\b[^_]\\)") - nil 'move (or arg 1)) + (and (re-search-forward ruby-indent-beg-re nil 'move (or arg 1)) (beginning-of-line)) (forward-line 1)) (defun ruby-beginning-of-indent () - "TODO: document" - ;; I don't understand this function. - ;; It seems like it should move to the line where indentation should deepen, - ;; but ruby-indent-beg-re only accounts for whitespace before class, module and def, - ;; so this will only match other block beginners at the beginning of the line. - (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>") nil 'move) - (beginning-of-line))) + "Backtrack to a line which can be used as a reference for +calculating indentation on the lines after it." + (while (and (re-search-backward ruby-indent-beg-re nil 'move) + (if (ruby-in-ppss-context-p 'anything) + t + ;; We can stop, then. + (beginning-of-line))))) (defun ruby-move-to-block (n) "Move to the beginning (N < 0) or the end (N > 0) of the current block @@ -1171,8 +1170,6 @@ (ruby-syntax-enclosing-percent-literal end) (funcall (syntax-propertize-rules - ;; #{ }, #$hoge, #@foo are not comments. - ("\\(#\\)[{$@]" (1 ".")) ;; $' $" $` .... are variables. ;; ?' ?" ?` are ascii codes. ("\\([?$]\\)[#\"'`]" @@ -1304,8 +1301,7 @@ (concat "-?\\([\"']\\|\\)" contents "\\1")))))) (defconst ruby-font-lock-syntactic-keywords - `( ;; #{ }, #$hoge, #@foo are not comments - ("\\(#\\)[{$@]" 1 (1 . nil)) + `( ;; the last $', $", $` in the respective string is not variable ;; the last ?', ?", ?` in the respective string is not ascii code ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)" @@ -1527,6 +1523,9 @@ ;; variables '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>" 2 font-lock-variable-name-face) + ;; symbols + '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" + 2 font-lock-reference-face) ;; variables '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W" 1 font-lock-variable-name-face) @@ -1535,12 +1534,9 @@ ;; constants '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" 2 font-lock-type-face) - ;; symbols - '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" - 2 font-lock-reference-face) '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-reference-face) ;; expression expansion - '("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)" + '(ruby-match-expression-expansion 0 font-lock-variable-name-face t) ;; warn lower camel case ;'("\\<[a-z]+[a-z0-9]*[A-Z][A-Za-z0-9]*\\([!?]?\\|\\>\\)" @@ -1548,6 +1544,10 @@ ) "Additional expressions to highlight in Ruby mode.") +(defun ruby-match-expression-expansion (limit) + (when (re-search-forward "[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)" limit 'move) + (ruby-in-ppss-context-p 'string))) + ;;;###autoload (define-derived-mode ruby-mode prog-mode "Ruby" "Major mode for editing Ruby scripts. === modified file 'test/ChangeLog' --- test/ChangeLog 2012-08-28 16:01:59 +0000 +++ test/ChangeLog 2012-09-07 04:15:56 +0000 @@ -1,3 +1,7 @@ +2012-09-07 Dmitry Gutov + + * automated/ruby-mode-tests.el: New tests (Bug#11613). + 2012-08-28 Chong Yidong * automated/files.el: Test every combination of values for === modified file 'test/automated/ruby-mode-tests.el' --- test/automated/ruby-mode-tests.el 2012-08-12 22:06:56 +0000 +++ test/automated/ruby-mode-tests.el 2012-09-07 04:15:56 +0000 @@ -57,6 +57,13 @@ (cadr values-plist))) (setq values-plist (cddr values-plist))))) +(defun ruby-assert-face (content pos face) + (with-temp-buffer + (insert content) + (ruby-mode) + (font-lock-fontify-buffer) + (should (eq face (get-text-property pos 'face))))) + (ert-deftest ruby-indent-after-symbol-made-from-string-interpolation () "It can indent the line after symbol made using string interpolation." (ruby-should-indent "def foo(suffix)\n :\"bar#{suffix}\"\n" @@ -84,6 +91,11 @@ (ruby-should-indent "foo = {\na: b" ruby-indent-level) (ruby-should-indent "foo(\na" ruby-indent-level))) +(ert-deftest ruby-indent-after-keyword-in-a-string () + (ruby-should-indent "a = \"abc\nif\"\n " 0) + (ruby-should-indent "a = %w[abc\n def]\n " 0) + (ruby-should-indent "a = \"abc\n def\"\n " 0)) + (ert-deftest ruby-indent-simple () (ruby-should-indent-buffer "if foo @@ -217,6 +229,19 @@ (should (string= "foo {|b|\n}\n" (buffer-substring-no-properties (point-min) (point-max)))))) +(ert-deftest ruby-recognize-symbols-starting-with-at-character () + (ruby-assert-face ":@abc" 3 'font-lock-constant-face)) + +(ert-deftest ruby-hash-character-not-interpolation () + (ruby-assert-face "\"This is #{interpolation}\"" 15 + 'font-lock-variable-name-face) + (ruby-assert-face "\"This is \\#{no interpolation} despite the #\"" + 15 'font-lock-string-face) + (ruby-assert-face "#@comment, not ruby code" 3 'font-lock-comment-face) + (ruby-assert-state "#@comment, not ruby code" 4 t) + (ruby-assert-face "# A comment cannot have #{an interpolation} in it" + 30 'font-lock-comment-face)) + (provide 'ruby-mode-tests) ;;; ruby-mode-tests.el ends here ------------------------------------------------------------ revno: 109910 committer: Chong Yidong branch nick: trunk timestamp: Fri 2012-09-07 12:07:00 +0800 message: Partially revert last Gnus merge. The add-face function has been added gnus-compat.el, but is not in Emacs; this leaves Gnus in an unusable state. * lisp/gnus/gnus-salt.el (gnus-tree-highlight-node): * lisp/gnus/gnus-sum.el (gnus-summary-highlight-line): * lisp/gnus/gnus-group.el (gnus-group-highlight-line): Revert use of add-face. * lisp/gnus/gnus-util.el (gnus-put-text-property-excluding-characters-with-faces): Restore. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-09-06 22:13:45 +0000 +++ lisp/gnus/ChangeLog 2012-09-07 04:07:00 +0000 @@ -1,3 +1,12 @@ +2012-09-07 Chong Yidong + + * gnus-util.el + (gnus-put-text-property-excluding-characters-with-faces): Restore. + + * gnus-salt.el (gnus-tree-highlight-node): + * gnus-sum.el (gnus-summary-highlight-line): + * gnus-group.el (gnus-group-highlight-line): Revert use of add-face. + 2012-09-06 Lars Ingebrigtsen * gnus-util.el: Fix compilation error on XEmacs 21.4. === modified file 'lisp/gnus/gnus-group.el' --- lisp/gnus/gnus-group.el 2012-09-06 22:13:45 +0000 +++ lisp/gnus/gnus-group.el 2012-09-07 04:07:00 +0000 @@ -1669,7 +1669,9 @@ gnus-group-highlight)))) (unless (eq face (get-text-property beg 'face)) (let ((inhibit-read-only t)) - (add-face beg end (if (boundp face) (symbol-value face) face))) + (gnus-put-text-property-excluding-characters-with-faces + beg end 'face + (if (boundp face) (symbol-value face) face))) (gnus-extent-start-open beg)))) (defun gnus-group-get-icon (group) === modified file 'lisp/gnus/gnus-salt.el' --- lisp/gnus/gnus-salt.el 2012-09-06 22:13:45 +0000 +++ lisp/gnus/gnus-salt.el 2012-09-07 04:07:00 +0000 @@ -660,7 +660,9 @@ (not (eval (caar list)))) (setq list (cdr list))))) (unless (eq (setq face (cdar list)) (get-text-property beg 'face)) - (add-face beg end (if (boundp face) (symbol-value face) face))))) + (gnus-put-text-property-excluding-characters-with-faces + beg end 'face + (if (boundp face) (symbol-value face) face))))) (defun gnus-tree-indent (level) (insert (make-string (1- (* (1+ gnus-tree-node-length) level)) ? ))) === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2012-09-06 22:13:45 +0000 +++ lisp/gnus/gnus-sum.el 2012-09-07 04:07:00 +0000 @@ -12522,8 +12522,9 @@ (not (memq article gnus-newsgroup-cached))))) (let ((face (funcall (gnus-summary-highlight-line-0)))) (unless (eq face (get-text-property beg 'face)) - (add-face beg (point-at-eol) - (setq face (if (boundp face) (symbol-value face) face))) + (gnus-put-text-property-excluding-characters-with-faces + beg (point-at-eol) 'face + (setq face (if (boundp face) (symbol-value face) face))) (when gnus-summary-highlight-line-function (funcall gnus-summary-highlight-line-function article face)))))) === modified file 'lisp/gnus/gnus-util.el' --- lisp/gnus/gnus-util.el 2012-09-06 22:13:45 +0000 +++ lisp/gnus/gnus-util.el 2012-09-07 04:07:00 +0000 @@ -866,6 +866,19 @@ (setq beg (point))) (gnus-overlay-put (gnus-make-overlay beg (point)) prop val))))) +(defun gnus-put-text-property-excluding-characters-with-faces (beg end + prop val) + "The same as `put-text-property', but don't put props on characters with the `gnus-face' property." + (let ((b beg)) + (while (/= b end) + (when (get-text-property b 'gnus-face) + (setq b (next-single-property-change b 'gnus-face nil end))) + (when (/= b end) + (inline + (gnus-put-text-property + b (setq b (next-single-property-change b 'gnus-face nil end)) + prop val)))))) + (defmacro gnus-faces-at (position) "Return a list of faces at POSITION." (if (featurep 'xemacs) ------------------------------------------------------------ revno: 109909 fixes bug: http://debbugs.gnu.org/12327 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-09-06 18:27:44 -0700 message: Signal-handler cleanup. Emacs's signal handlers were written in the old 4.2BSD style with sigblock and sigmask and so forth, and this led to some inefficiencies and confusion. Rewrite these to use pthread_sigmask etc. without copying signal sets around. Also, get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and 'signal', and instead use functions that do not attempt to take over the system name space. This patch causes Emacs's text segment to shrink by 0.7% on my platform, Fedora 17 x86-64. * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): Adjust to syssignal.h changes. (SIGNAL_H_AB): Remove; no longer needed. * src/alloc.c, src/emacsgtkfixed.c, src/nsfns.m, src/widget.c, src/xmenu.c: Do not include or "syssignal.h", as these modules do not use signals. * src/atimer.c, src/callproc.c, src/data.c, src/dispnew.c, src/emacs.c: * src/floatfns.c, src/gtkutil.c, src/keyboard.c, src/process.c, src/sound.c: * src/sysdep.c, src/term.c, src/xterm.c: Do not include , as "syssignal.h" does that for us now. * src/atimer.c (sigmask_atimers): New function. (block_atimers, unblock_atimers): New functions, replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS. All uses replaced. * src/conf_post.h [SIGNAL_H_AHB]: Do not include ; no longer needed here. * src/emacs.c (main): Inspect existing signal handler with sigaction, so that there's no need to block and unblock SIGHUP. * src/sysdep.c (struct save_signal): New member 'action', replacing old member 'handler'. (save_signal_handlers, restore_signal_handlers): Use sigaction instead of 'signal' to save and restore. (get_set_sighandler, set_sighandler) [!WINDOWSNT]: New function. All users of 'signal' modified to use set_sighandler if they're writeonly, and to use sys_signal if they're read+write. (emacs_sigaction_init, forwarded_signal): New functions. (sys_signal): Remove. All uses replaced by calls to sigaction and emacs_sigaction_init, or by direct calls to 'signal'. (sys_sigmask) [!__GNUC__]: Remove; no longer needed. (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove; all uses replaced by pthread_sigmask etc. calls. * src/syssignal.h: Include . (emacs_sigaction_init, forwarded_signal): New decls. (SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t. (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask. (sigmask, sys_sigmask): Remove; no longer needed. (sigpause): Remove. All uses replaced by its definiens, sigsuspend. (sigblock, sigunblock, sigfree): (sigsetmask) [!defined sigsetmask]: Remove. All uses replaced by pthread_sigmask. (signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN) no longer need to be replaced, and its typical old uses are now done via emacs_sigaction_init and sigaction. (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls. (sys_sigdel): Remove; unused. (NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-04 17:34:54 +0000 +++ ChangeLog 2012-09-07 01:27:44 +0000 @@ -1,3 +1,10 @@ +2012-09-06 Paul Eggert + + Signal-handler cleanup (Bug#12327). + * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): + Adjust to syssignal.h changes. + (SIGNAL_H_AB): Remove; no longer needed. + 2012-09-04 Paul Eggert Simplify redefinition of 'abort' (Bug#12316). === modified file 'configure.ac' --- configure.ac 2012-09-04 17:34:54 +0000 +++ configure.ac 2012-09-07 01:27:44 +0000 @@ -3445,7 +3445,7 @@ cygwin ) AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl multi-line AC_DEFINEs are hard. :( - AC_DEFINE(PTY_OPEN, [ do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)]) + AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)]) AC_DEFINE(PTY_NAME_SPRINTF, []) AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) ;; @@ -3474,7 +3474,7 @@ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD dnl to prevent sigchld_handler from intercepting the child's death. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask (SIGCHLD)); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) dnl if HAVE_POSIX_OPENPT if test "x$ac_cv_func_posix_openpt" = xyes; then AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)]) @@ -3519,18 +3519,15 @@ ;; sol2* ) - dnl Uses sigblock/sigunblock rather than sighold/sigrelse, - dnl which appear to be BSD4.1 specific. It may also be appropriate - dnl for SVR4.x (x<2) but I'm not sure. fnf@cygnus.com dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() dnl from intercepting that death. If any child but grantpt's should die dnl within, it should be caught after sigrelse(2). - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; unixware ) dnl Comments are as per sol2*. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; esac @@ -3820,13 +3817,6 @@ AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on some systems, where it requires time.h.]) ;; - - netbsd | openbsd ) - dnl Greg A. Woods says we must include signal.h - dnl before syssignal.h is included, to work around interface conflicts - dnl that are handled with CPP __RENAME() macro in signal.h. - AC_DEFINE(SIGNAL_H_AHB, 1, [Define if AH_BOTTOM should include signal.h.]) - ;; esac === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-06 16:42:48 +0000 +++ src/ChangeLog 2012-09-07 01:27:44 +0000 @@ -1,3 +1,57 @@ +2012-09-06 Paul Eggert + + Signal-handler cleanup (Bug#12327). + Emacs's signal handlers were written in the old 4.2BSD style with + sigblock and sigmask and so forth, and this led to some + inefficiencies and confusion. Rewrite these to use + pthread_sigmask etc. without copying signal sets around. Also, + get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and + 'signal', and instead use functions that do not attempt to take + over the system name space. This patch causes Emacs's text + segment to shrink by 0.7% on my platform, Fedora 17 x86-64. + * alloc.c, emacsgtkfixed.c, nsfns.m, widget.c, xmenu.c: + Do not include or "syssignal.h", as these + modules do not use signals. + * atimer.c, callproc.c, data.c, dispnew.c, emacs.c, floatfns.c: + * gtkutil.c, keyboard.c, process.c, sound.c, sysdep.c, term.c, xterm.c: + Do not include , as "syssignal.h" does that for us now. + * atimer.c (sigmask_atimers): New function. + (block_atimers, unblock_atimers): New functions, + replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS. + All uses replaced. + * conf_post.h [SIGNAL_H_AHB]: Do not include ; + no longer needed here. + * emacs.c (main): Inspect existing signal handler with sigaction, + so that there's no need to block and unblock SIGHUP. + * sysdep.c (struct save_signal): New member 'action', replacing + old member 'handler'. + (save_signal_handlers, restore_signal_handlers): + Use sigaction instead of 'signal' to save and restore. + (get_set_sighandler, set_sighandler) [!WINDOWSNT]: + New function. All users of 'signal' modified to use set_sighandler + if they're writeonly, and to use sys_signal if they're read+write. + (emacs_sigaction_init, forwarded_signal): New functions. + (sys_signal): Remove. All uses replaced by calls to sigaction + and emacs_sigaction_init, or by direct calls to 'signal'. + (sys_sigmask) [!__GNUC__]: Remove; no longer needed. + (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove; + all uses replaced by pthread_sigmask etc. calls. + * syssignal.h: Include . + (emacs_sigaction_init, forwarded_signal): New decls. + (SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t. + (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask. + (sigmask, sys_sigmask): Remove; no longer needed. + (sigpause): Remove. All uses replaced by its definiens, sigsuspend. + (sigblock, sigunblock, sigfree): + (sigsetmask) [!defined sigsetmask]: + Remove. All uses replaced by pthread_sigmask. + (signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN) + no longer need to be replaced, and its typical old uses + are now done via emacs_sigaction_init and sigaction. + (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls. + (sys_sigdel): Remove; unused. + (NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef. + 2012-09-06 Eli Zaretskii * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke @@ -50,7 +104,7 @@ 2012-09-05 Paul Eggert - Fix race conditions with signal handlers and errno. + Fix race conditions with signal handlers and errno (Bug#12327). Be more systematic about preserving errno whenever a signal handler returns, even if it's not in the main thread. Do this by renaming signal handlers to distinguish between signal delivery === modified file 'src/alloc.c' --- src/alloc.c 2012-09-06 09:15:44 +0000 +++ src/alloc.c 2012-09-07 01:27:44 +0000 @@ -26,8 +26,6 @@ #include /* For CHAR_BIT. */ #include -#include - #ifdef HAVE_PTHREAD #include #endif @@ -42,7 +40,6 @@ #include "keyboard.h" #include "frame.h" #include "blockinput.h" -#include "syssignal.h" #include "termhooks.h" /* For struct terminal. */ #include #include === modified file 'src/atimer.c' --- src/atimer.c 2012-09-05 21:33:53 +0000 +++ src/atimer.c 2012-09-07 01:27:44 +0000 @@ -17,7 +17,6 @@ along with GNU Emacs. If not, see . */ #include -#include #include #include #include "lisp.h" @@ -51,8 +50,24 @@ /* Block/unblock SIGALRM. */ -#define BLOCK_ATIMERS sigblock (sigmask (SIGALRM)) -#define UNBLOCK_ATIMERS sigunblock (sigmask (SIGALRM)) +static void +sigmask_atimers (int how) +{ + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGALRM); + pthread_sigmask (how, &blocked, 0); +} +static void +block_atimers (void) +{ + sigmask_atimers (SIG_BLOCK); +} +static void +unblock_atimers (void) +{ + sigmask_atimers (SIG_UNBLOCK); +} /* Function prototypes. */ @@ -109,7 +124,7 @@ t->fn = fn; t->client_data = client_data; - BLOCK_ATIMERS; + block_atimers (); /* Compute the timer's expiration time. */ switch (type) @@ -130,7 +145,7 @@ /* Insert the timer in the list of active atimers. */ schedule_atimer (t); - UNBLOCK_ATIMERS; + unblock_atimers (); /* Arrange for a SIGALRM at the time the next atimer is ripe. */ set_alarm (); @@ -146,7 +161,7 @@ { int i; - BLOCK_ATIMERS; + block_atimers (); for (i = 0; i < 2; ++i) { @@ -173,7 +188,7 @@ } } - UNBLOCK_ATIMERS; + unblock_atimers (); } @@ -204,7 +219,7 @@ void stop_other_atimers (struct atimer *t) { - BLOCK_ATIMERS; + block_atimers (); if (t) { @@ -229,7 +244,7 @@ stopped_atimers = append_atimer_lists (atimers, stopped_atimers); atimers = t; - UNBLOCK_ATIMERS; + unblock_atimers (); } @@ -244,7 +259,7 @@ struct atimer *t = atimers; struct atimer *next; - BLOCK_ATIMERS; + block_atimers (); atimers = stopped_atimers; stopped_atimers = NULL; @@ -255,7 +270,7 @@ t = next; } - UNBLOCK_ATIMERS; + unblock_atimers (); } } @@ -397,9 +412,9 @@ { if (pending_atimers) { - BLOCK_ATIMERS; + block_atimers (); run_timers (); - UNBLOCK_ATIMERS; + unblock_atimers (); } } @@ -412,7 +427,9 @@ { if (on) { - signal (SIGALRM, deliver_alarm_signal); + struct sigaction action; + emacs_sigaction_init (&action, deliver_alarm_signal); + sigaction (SIGALRM, &action, 0); set_alarm (); } else @@ -423,8 +440,10 @@ void init_atimer (void) { + struct sigaction action; free_atimers = stopped_atimers = atimers = NULL; pending_atimers = 0; /* pending_signals is initialized in init_keyboard.*/ - signal (SIGALRM, deliver_alarm_signal); + emacs_sigaction_init (&action, deliver_alarm_signal); + sigaction (SIGALRM, &action, 0); } === modified file 'src/callproc.c' --- src/callproc.c 2012-08-25 03:11:12 +0000 +++ src/callproc.c 2012-09-07 01:27:44 +0000 @@ -19,7 +19,6 @@ #include -#include #include #include #include @@ -506,9 +505,6 @@ if (fd_output >= 0) fd1 = fd_output; -#if 0 /* Some systems don't have sigblock. */ - mask = sigblock (sigmask (SIGCHLD)); -#endif /* Record that we're about to create a synchronous process. */ synch_process_alive = 1; === modified file 'src/conf_post.h' --- src/conf_post.h 2012-09-05 17:05:32 +0000 +++ src/conf_post.h 2012-09-07 01:27:44 +0000 @@ -40,11 +40,6 @@ #endif #endif -#ifdef SIGNAL_H_AHB -#undef SIGNAL_H_AHB -#include -#endif - /* This silences a few compilation warnings on FreeBSD. */ #ifdef BSD_SYSTEM_AHB #undef BSD_SYSTEM_AHB === modified file 'src/data.c' --- src/data.c 2012-09-05 21:33:53 +0000 +++ src/data.c 2012-09-07 01:27:44 +0000 @@ -19,7 +19,6 @@ #include -#include #include #include @@ -3210,7 +3209,7 @@ static _Noreturn void handle_arith_signal (int sig) { - sigsetmask (SIGEMPTYMASK); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); xsignal0 (Qarith_error); } @@ -3223,6 +3222,7 @@ void init_data (void) { + struct sigaction action; /* Don't do this if just dumping out. We don't want to call `signal' in this case so that we don't have trouble with dumping @@ -3231,5 +3231,6 @@ if (!initialized) return; #endif /* CANNOT_DUMP */ - signal (SIGFPE, deliver_arith_signal); + emacs_sigaction_init (&action, deliver_arith_signal); + sigaction (SIGFPE, &action, 0); } === modified file 'src/dispnew.c' --- src/dispnew.c 2012-09-05 21:33:53 +0000 +++ src/dispnew.c 2012-09-07 01:27:44 +0000 @@ -21,7 +21,6 @@ #define DISPEXTERN_INLINE EXTERN_INLINE -#include #include #include #include @@ -5560,7 +5559,9 @@ int width, height; struct tty_display_info *tty; - signal (SIGWINCH, deliver_window_change_signal); + struct sigaction action; + emacs_sigaction_init (&action, deliver_window_change_signal); + sigaction (SIGWINCH, &action, 0); /* The frame size change obviously applies to a single termcap-controlled terminal, but we can't decide which. @@ -6175,7 +6176,11 @@ #ifndef CANNOT_DUMP if (initialized) #endif /* CANNOT_DUMP */ - signal (SIGWINCH, deliver_window_change_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_window_change_signal); + sigaction (SIGWINCH, &action, 0); + } #endif /* SIGWINCH */ /* If running as a daemon, no need to initialize any frames/terminal. */ === modified file 'src/emacs.c' --- src/emacs.c 2012-09-05 21:33:53 +0000 +++ src/emacs.c 2012-09-07 01:27:44 +0000 @@ -20,7 +20,6 @@ #include -#include #include #include @@ -322,7 +321,12 @@ going to send is probably blocked, so we have to unblock it if we want to really receive it. */ #ifndef MSDOS - sigunblock (sigmask (fatal_error_code)); + { + sigset_t unblocked; + sigemptyset (&unblocked); + sigaddset (&unblocked, fatal_error_code); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + } #endif kill (getpid (), fatal_error_code); @@ -339,7 +343,10 @@ static void handle_danger_signal (int sig) { - signal (sig, deliver_danger_signal); + struct sigaction action; + emacs_sigaction_init (&action, deliver_danger_signal); + sigaction (sig, &action, 0); + malloc_warning ("Operating system warns that virtual memory is running low.\n"); /* It might be unsafe to call do_auto_save now. */ @@ -683,6 +690,7 @@ char dname_arg2[80]; #endif char *ch_to_dir; + struct sigaction fatal_error_action; #if GC_MARK_STACK stack_base = &dummy; @@ -1103,6 +1111,7 @@ } init_signals (); + emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal); /* Don't catch SIGHUP if dumping. */ if (1 @@ -1111,13 +1120,17 @@ #endif ) { - sigblock (sigmask (SIGHUP)); /* In --batch mode, don't catch SIGHUP if already ignored. That makes nohup work. */ - if (! noninteractive - || signal (SIGHUP, SIG_IGN) != SIG_IGN) - signal (SIGHUP, deliver_fatal_signal); - sigunblock (sigmask (SIGHUP)); + bool catch_SIGHUP = !noninteractive; + if (!catch_SIGHUP) + { + struct sigaction old_action; + sigaction (SIGHUP, 0, &old_action); + catch_SIGHUP = old_action.sa_handler != SIG_IGN; + } + if (catch_SIGHUP) + sigaction (SIGHUP, &fatal_error_action, 0); } if ( @@ -1141,68 +1154,73 @@ add_user_signal (SIGUSR2, "sigusr2"); #endif #ifdef SIGABRT - signal (SIGABRT, deliver_fatal_signal); + sigaction (SIGABRT, &fatal_error_action, 0); #endif #ifdef SIGHWE - signal (SIGHWE, deliver_fatal_signal); + sigaction (SIGHWE, &fatal_error_action, 0); #endif #ifdef SIGPRE - signal (SIGPRE, deliver_fatal_signal); + sigaction (SIGPRE, &fatal_error_action, 0); #endif #ifdef SIGORE - signal (SIGORE, deliver_fatal_signal); + sigaction (SIGORE, &fatal_error_action, 0); #endif #ifdef SIGUME - signal (SIGUME, deliver_fatal_signal); + sigaction (SIGUME, &fatal_error_action, 0); #endif #ifdef SIGDLK - signal (SIGDLK, deliver_fatal_signal); + sigaction (SIGDLK, &fatal_error_action, 0); #endif #ifdef SIGCPULIM - signal (SIGCPULIM, deliver_fatal_signal); + sigaction (SIGCPULIM, &fatal_error_action, 0); #endif #ifdef SIGIOT /* This is missing on some systems - OS/2, for example. */ - signal (SIGIOT, deliver_fatal_signal); + sigaction (SIGIOT, &fatal_error_action, 0); #endif #ifdef SIGEMT - signal (SIGEMT, deliver_fatal_signal); + sigaction (SIGEMT, &fatal_error_action, 0); #endif - signal (SIGFPE, deliver_fatal_signal); + sigaction (SIGFPE, &fatal_error_action, 0); #ifdef SIGBUS - signal (SIGBUS, deliver_fatal_signal); + sigaction (SIGBUS, &fatal_error_action, 0); #endif - signal (SIGSEGV, deliver_fatal_signal); + sigaction (SIGSEGV, &fatal_error_action, 0); #ifdef SIGSYS - signal (SIGSYS, deliver_fatal_signal); + sigaction (SIGSYS, &fatal_error_action, 0); #endif /* May need special treatment on MS-Windows. See http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html Please update the doc of kill-emacs, kill-emacs-hook, and NEWS if you change this. */ - if (noninteractive) signal (SIGINT, deliver_fatal_signal); - signal (SIGTERM, deliver_fatal_signal); + if (noninteractive) + sigaction (SIGINT, &fatal_error_action, 0); + sigaction (SIGTERM, &fatal_error_action, 0); #ifdef SIGXCPU - signal (SIGXCPU, deliver_fatal_signal); + sigaction (SIGXCPU, &fatal_error_action, 0); #endif #ifdef SIGXFSZ - signal (SIGXFSZ, deliver_fatal_signal); + sigaction (SIGXFSZ, &fatal_error_action, 0); #endif /* SIGXFSZ */ #ifdef SIGDANGER /* This just means available memory is getting low. */ - signal (SIGDANGER, deliver_danger_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_danger_signal); + sigaction (SIGDANGER, &action, 0); + } #endif #ifdef AIX /* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */ - signal (SIGXCPU, deliver_fatal_signal); - signal (SIGIOINT, deliver_fatal_signal); - signal (SIGGRANT, deliver_fatal_signal); - signal (SIGRETRACT, deliver_fatal_signal); - signal (SIGSOUND, deliver_fatal_signal); - signal (SIGMSG, deliver_fatal_signal); + sigaction (SIGXCPU, &fatal_error_action, 0); + sigaction (SIGIOINT, &fatal_error_action, 0); + sigaction (SIGGRANT, &fatal_error_action, 0); + sigaction (SIGRETRACT, &fatal_error_action, 0); + sigaction (SIGSOUND, &fatal_error_action, 0); + sigaction (SIGMSG, &fatal_error_action, 0); #endif /* AIX */ } === modified file 'src/emacsgtkfixed.c' --- src/emacsgtkfixed.c 2012-04-23 07:34:29 +0000 +++ src/emacsgtkfixed.c 2012-09-07 01:27:44 +0000 @@ -21,7 +21,6 @@ #include #include "emacsgtkfixed.h" -#include #include #include #include "lisp.h" === modified file 'src/floatfns.c' --- src/floatfns.c 2012-09-05 21:33:53 +0000 +++ src/floatfns.c 2012-09-07 01:27:44 +0000 @@ -45,7 +45,6 @@ */ #include -#include #include #include "lisp.h" #include "syssignal.h" === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-09-04 17:34:54 +0000 +++ src/gtkutil.c 2012-09-07 01:27:44 +0000 @@ -21,7 +21,6 @@ #ifdef USE_GTK #include -#include #include #include @@ -1979,7 +1978,10 @@ /* I really don't know why this is needed, but without this the GLIBC add on library linuxthreads hangs when the Gnome file chooser backend creates threads. */ - sigblock (sigmask (__SIGRTMIN)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, __SIGRTMIN); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif /* HAVE_PTHREAD */ #ifdef HAVE_GTK_FILE_SELECTION_NEW @@ -2001,7 +2003,7 @@ filesel_done = xg_dialog_run (f, w); #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigunblock (sigmask (__SIGRTMIN)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif if (filesel_done == GTK_RESPONSE_OK) @@ -2057,7 +2059,10 @@ Lisp_Object font = Qnil; #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigblock (sigmask (__SIGRTMIN)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, __SIGRTMIN); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif /* HAVE_PTHREAD */ w = gtk_font_chooser_dialog_new @@ -2086,7 +2091,7 @@ done = xg_dialog_run (f, w); #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigunblock (sigmask (__SIGRTMIN)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif if (done == GTK_RESPONSE_OK) === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-05 21:33:53 +0000 +++ src/keyboard.c 2012-09-07 01:27:44 +0000 @@ -21,7 +21,6 @@ #define KEYBOARD_INLINE EXTERN_INLINE -#include #include #include #include "lisp.h" @@ -3680,7 +3679,7 @@ if (immediate_quit && NILP (Vinhibit_quit)) { immediate_quit = 0; - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); QUIT; } } @@ -3832,7 +3831,11 @@ unhold_keyboard_input (); #ifdef SIGIO if (!noninteractive) - signal (SIGIO, deliver_input_available_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_input_available_signal); + sigaction (SIGIO, &action, 0); + } #endif /* SIGIO */ start_polling (); } @@ -6780,10 +6783,12 @@ #ifdef SIGIO if (interrupt_input) { - SIGMASKTYPE mask; - mask = sigblock (sigmask (SIGIO)); + sigset_t blocked, procmask; + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); read_avail_input (expected); - sigsetmask (mask); + pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #ifdef POLL_FOR_INPUT @@ -6792,10 +6797,12 @@ it's always set. */ if (!interrupt_input && poll_suppress_count == 0) { - SIGMASKTYPE mask; - mask = sigblock (sigmask (SIGALRM)); + sigset_t blocked, procmask; + sigemptyset (&blocked); + sigaddset (&blocked, SIGALRM); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); read_avail_input (expected); - sigsetmask (mask); + pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #endif @@ -6831,10 +6838,12 @@ #ifdef SIGIO if (interrupt_input) { - SIGMASKTYPE mask; - mask = sigblock (sigmask (SIGIO)); + sigset_t blocked, procmask; + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); kbd_buffer_store_event (&event); - sigsetmask (mask); + pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #endif @@ -7295,6 +7304,7 @@ void add_user_signal (int sig, const char *name) { + struct sigaction action; struct user_signal_info *p; for (p = user_signals; p; p = p->next) @@ -7309,7 +7319,8 @@ p->next = user_signals; user_signals = p; - signal (sig, deliver_user_signal); + emacs_sigaction_init (&action, deliver_user_signal); + sigaction (sig, &action, 0); } static void @@ -7381,7 +7392,7 @@ for (p = user_signals; p; p = p->next) if (p->npending > 0) { - SIGMASKTYPE mask; + sigset_t blocked, procmask; if (nstored == 0) { @@ -7391,7 +7402,10 @@ } nstored += p->npending; - mask = sigblock (sigmask (p->sig)); + sigemptyset (&blocked); + sigaddset (&blocked, p->sig); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); + do { buf.code = p->sig; @@ -7399,7 +7413,8 @@ p->npending--; } while (p->npending > 0); - sigsetmask (mask); + + pthread_sigmask (SIG_SETMASK, &procmask, 0); } return nstored; @@ -10838,7 +10853,10 @@ /* If SIGINT isn't blocked, don't let us be interrupted by another SIGINT, it might be harmful due to non-reentrancy in I/O functions. */ - sigblock (sigmask (SIGINT)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGINT); + pthread_sigmask (SIG_BLOCK, &blocked, 0); fflush (stdout); reset_all_sys_modes (); @@ -10909,7 +10927,7 @@ #endif /* not MSDOS */ fflush (stdout); init_all_sys_modes (); - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); } else { @@ -10922,7 +10940,7 @@ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; immediate_quit = 0; - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); saved = gl_state; GCPRO4 (saved.object, saved.global_code, saved.current_syntax_table, saved.old_prop); @@ -10967,7 +10985,7 @@ if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) Fkill_emacs (Qnil); - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); /* Prevent another signal from doing this before we finish. */ clear_waiting_for_input (); input_pending = 0; @@ -11402,17 +11420,23 @@ SIGINT. There is special code in interrupt_signal to exit Emacs on SIGINT when there are no termcap frames on the controlling terminal. */ - signal (SIGINT, deliver_interrupt_signal); + struct sigaction action; + emacs_sigaction_init (&action, deliver_interrupt_signal); + sigaction (SIGINT, &action, 0); #ifndef DOS_NT /* For systems with SysV TERMIO, C-g is set up for both SIGINT and SIGQUIT and we can't tell which one it will give us. */ - signal (SIGQUIT, deliver_interrupt_signal); + sigaction (SIGQUIT, &action, 0); #endif /* not DOS_NT */ } /* Note SIGIO has been undef'd if FIONREAD is missing. */ #ifdef SIGIO if (!noninteractive) - signal (SIGIO, deliver_input_available_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_input_available_signal); + sigaction (SIGIO, &action, 0); + } #endif /* SIGIO */ /* Use interrupt input by default, if it works and noninterrupt input @@ -11424,7 +11448,7 @@ interrupt_input = 0; #endif - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); dribble = 0; if (keyboard_init_hook) === modified file 'src/nsfns.m' --- src/nsfns.m 2012-08-17 23:38:43 +0000 +++ src/nsfns.m 2012-09-07 01:27:44 +0000 @@ -30,7 +30,6 @@ interpretation of even the system includes. */ #include -#include #include #include #include === modified file 'src/process.c' --- src/process.c 2012-09-06 16:42:48 +0000 +++ src/process.c 2012-09-07 01:27:44 +0000 @@ -23,7 +23,6 @@ #define PROCESS_INLINE EXTERN_INLINE -#include #include #include #include @@ -1612,8 +1611,7 @@ #if !defined (WINDOWSNT) && defined (FD_CLOEXEC) int wait_child_setup[2]; #endif - sigset_t procmask; - sigset_t blocked; + sigset_t blocked, procmask; struct sigaction sigint_action; struct sigaction sigquit_action; struct sigaction sigpipe_action; @@ -1765,12 +1763,6 @@ int xforkin = forkin; int xforkout = forkout; -#if 0 /* This was probably a mistake--it duplicates code later on, - but fails to handle all the cases. */ - /* Make sure SIGCHLD is not blocked in the child. */ - sigsetmask (SIGEMPTYMASK); -#endif - /* Make the pty be the controlling terminal of the process. */ #ifdef HAVE_PTYS /* First, disconnect its current controlling terminal. */ @@ -5434,7 +5426,10 @@ static _Noreturn void handle_pipe_signal (int sig) { - sigunblock (sigmask (SIGPIPE)); + sigset_t unblocked; + sigemptyset (&unblocked); + sigaddset (&unblocked, SIGPIPE); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); _longjmp (send_process_frame, 1); } @@ -5534,7 +5529,7 @@ struct Lisp_Process *p = XPROCESS (proc); ssize_t rv; struct coding_system *coding; - void (*volatile old_sigpipe) (int); + struct sigaction old_sigpipe_action; if (p->raw_status_new) update_status (p); @@ -5673,7 +5668,9 @@ /* Send this batch, using one or more write calls. */ ptrdiff_t written = 0; int outfd = p->outfd; - old_sigpipe = signal (SIGPIPE, deliver_pipe_signal); + struct sigaction action; + emacs_sigaction_init (&action, deliver_pipe_signal); + sigaction (SIGPIPE, &action, &old_sigpipe_action); #ifdef DATAGRAM_SOCKETS if (DATAGRAM_CHAN_P (outfd)) { @@ -5684,7 +5681,7 @@ written = rv; else if (errno == EMSGSIZE) { - signal (SIGPIPE, old_sigpipe); + sigaction (SIGPIPE, &old_sigpipe_action, 0); report_file_error ("sending datagram", Fcons (proc, Qnil)); } @@ -5709,7 +5706,7 @@ } #endif } - signal (SIGPIPE, old_sigpipe); + sigaction (SIGPIPE, &old_sigpipe_action, 0); if (rv < 0) { @@ -5769,7 +5766,7 @@ } else { - signal (SIGPIPE, old_sigpipe); + sigaction (SIGPIPE, &old_sigpipe_action, 0); proc = process_sent_to; p = XPROCESS (proc); p->raw_status_new = 0; @@ -7389,7 +7386,11 @@ #ifndef CANNOT_DUMP if (! noninteractive || initialized) #endif - signal (SIGCHLD, deliver_child_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_child_signal); + sigaction (SIGCHLD, &action, 0); + } #endif FD_ZERO (&input_wait_mask); === modified file 'src/sound.c' --- src/sound.c 2012-09-04 17:34:54 +0000 +++ src/sound.c 2012-09-07 01:27:44 +0000 @@ -48,7 +48,6 @@ #include "lisp.h" #include "dispextern.h" #include "atimer.h" -#include #include "syssignal.h" /* END: Common Includes */ @@ -316,7 +315,12 @@ turn_on_atimers (1); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + { + sigset_t unblocked; + sigemptyset (&unblocked); + sigaddset (&unblocked, SIGIO); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + } #endif if (saved_errno != 0) error ("%s: %s", msg, strerror (saved_errno)); @@ -728,6 +732,9 @@ vox_configure (struct sound_device *sd) { int val; +#ifdef SIGIO + sigset_t blocked; +#endif eassert (sd->fd >= 0); @@ -736,7 +743,9 @@ troubles. */ turn_on_atimers (0); #ifdef SIGIO - sigblock (sigmask (SIGIO)); + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif val = sd->format; @@ -770,7 +779,7 @@ turn_on_atimers (1); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif } @@ -786,7 +795,10 @@ be interrupted by a signal. Block the ones we know to cause troubles. */ #ifdef SIGIO - sigblock (sigmask (SIGIO)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif turn_on_atimers (0); @@ -795,7 +807,7 @@ turn_on_atimers (1); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif /* Close the device. */ === modified file 'src/sysdep.c' --- src/sysdep.c 2012-09-05 21:33:53 +0000 +++ src/sysdep.c 2012-09-07 01:27:44 +0000 @@ -22,7 +22,6 @@ #define SYSTIME_INLINE EXTERN_INLINE #include -#include #include #include #ifdef HAVE_PWD_H @@ -303,27 +302,34 @@ termination of subprocesses, perhaps involving a kernel bug too, but no idea what it is. Just as a hunch we signal SIGCHLD to see if that causes the problem to go away or get worse. */ - sigsetmask (sigmask (SIGCHLD)); + sigset_t sigchild_mask; + sigemptyset (&sigchild_mask); + sigaddset (&sigchild_mask, SIGCHLD); + pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0); + if (0 > kill (pid, 0)) { - sigsetmask (SIGEMPTYMASK); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); kill (getpid (), SIGCHLD); break; } if (wait_debugging) sleep (1); else - sigpause (SIGEMPTYMASK); + sigsuspend (&empty_mask); #else /* not BSD_SYSTEM, and not HPUX version >= 6 */ #ifdef WINDOWSNT wait (0); break; #else /* not WINDOWSNT */ - sigblock (sigmask (SIGCHLD)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGCHLD); + pthread_sigmask (SIG_BLOCK, &blocked, 0); errno = 0; if (kill (pid, 0) == -1 && errno == ESRCH) { - sigunblock (sigmask (SIGCHLD)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); break; } @@ -457,11 +463,11 @@ #endif /* not MSDOS */ -/* Record a signal code and the handler for it. */ +/* Record a signal code and the action for it. */ struct save_signal { int code; - void (*handler) (int); + struct sigaction action; }; static void save_signal_handlers (struct save_signal *); @@ -619,8 +625,9 @@ { while (saved_handlers->code) { - saved_handlers->handler - = (void (*) (int)) signal (saved_handlers->code, SIG_IGN); + struct sigaction action; + emacs_sigaction_init (&action, SIG_IGN); + sigaction (saved_handlers->code, &action, &saved_handlers->action); saved_handlers++; } } @@ -630,7 +637,7 @@ { while (saved_handlers->code) { - signal (saved_handlers->code, saved_handlers->handler); + sigaction (saved_handlers->code, &saved_handlers->action, 0); saved_handlers++; } } @@ -687,13 +694,17 @@ void request_sigio (void) { + sigset_t unblocked; + if (noninteractive) return; + sigemptyset (&unblocked); #ifdef SIGWINCH - sigunblock (sigmask (SIGWINCH)); + sigaddset (&unblocked, SIGWINCH); #endif - sigunblock (sigmask (SIGIO)); + sigaddset (&unblocked, SIGIO); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); interrupts_deferred = 0; } @@ -701,6 +712,8 @@ void unrequest_sigio (void) { + sigset_t blocked; + if (noninteractive) return; @@ -709,10 +722,12 @@ return; #endif + sigemptyset (&blocked); #ifdef SIGWINCH - sigblock (sigmask (SIGWINCH)); + sigaddset (&blocked, SIGWINCH); #endif - sigblock (sigmask (SIGIO)); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, 0); interrupts_deferred = 1; } @@ -1471,20 +1486,16 @@ } } -/* POSIX signals support - DJB */ -/* Anyone with POSIX signals should have ANSI C declarations */ - sigset_t empty_mask; -#ifndef WINDOWSNT - -signal_handler_t -sys_signal (int signal_number, signal_handler_t action) +/* Store into *ACTION a signal action suitable for Emacs, with handler + HANDLER. */ +void +emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) { - struct sigaction new_action, old_action; - sigemptyset (&new_action.sa_mask); - new_action.sa_handler = action; - new_action.sa_flags = 0; + sigemptyset (&action->sa_mask); + action->sa_handler = handler; + action->sa_flags = 0; #if defined (SA_RESTART) /* Emacs mostly works better with restartable system services. If this flag exists, we probably want to turn it on here. @@ -1501,54 +1512,8 @@ # if defined (BROKEN_SA_RESTART) || defined (SYNC_INPUT) if (noninteractive) # endif - new_action.sa_flags = SA_RESTART; -#endif - sigaction (signal_number, &new_action, &old_action); - return (old_action.sa_handler); -} - -#endif /* WINDOWSNT */ - -#ifndef __GNUC__ -/* If we're compiling with GCC, we don't need this function, since it - can be written as a macro. */ -sigset_t -sys_sigmask (int sig) -{ - sigset_t mask; - sigemptyset (&mask); - sigaddset (&mask, sig); - return mask; -} -#endif - -/* I'd like to have these guys return pointers to the mask storage in here, - but there'd be trouble if the code was saving multiple masks. I'll be - safe and pass the structure. It normally won't be more than 2 bytes - anyhow. - DJB */ - -sigset_t -sys_sigblock (sigset_t new_mask) -{ - sigset_t old_mask; - pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask); - return (old_mask); -} - -sigset_t -sys_sigunblock (sigset_t new_mask) -{ - sigset_t old_mask; - pthread_sigmask (SIG_UNBLOCK, &new_mask, &old_mask); - return (old_mask); -} - -sigset_t -sys_sigsetmask (sigset_t new_mask) -{ - sigset_t old_mask; - pthread_sigmask (SIG_SETMASK, &new_mask, &old_mask); - return (old_mask); + action->sa_flags = SA_RESTART; +#endif } #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD === modified file 'src/syssignal.h' --- src/syssignal.h 2012-09-05 21:33:53 +0000 +++ src/syssignal.h 2012-09-07 01:27:44 +0000 @@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +#include + extern void init_signals (void); #ifdef HAVE_PTHREAD @@ -26,63 +28,16 @@ #define FORWARD_SIGNAL_TO_MAIN_THREAD #endif -/* Don't #include . That header should always be #included - before "config.h", because some configuration files (like s/hpux.h) - indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file - #includes , then that will re-#define SIGIO and confuse - things. */ -/* XXX This is not correct anymore, there is a BROKEN_SIGIO macro. */ - -#define SIGMASKTYPE sigset_t - -#define SIGEMPTYMASK (empty_mask) extern sigset_t empty_mask; -/* POSIX pretty much destroys any possibility of writing sigmask as a - macro in standard C. We always define our own version because the - predefined macro in Glibc 2.1 is only provided for compatibility for old - programs that use int as signal mask type. */ -#undef sigmask -#ifdef __GNUC__ -#define sigmask(SIG) \ - ({ \ - sigset_t _mask; \ - sigemptyset (&_mask); \ - sigaddset (&_mask, SIG); \ - _mask; \ - }) -#else /* ! defined (__GNUC__) */ -extern sigset_t sys_sigmask (); -#define sigmask(SIG) (sys_sigmask (SIG)) -#endif /* ! defined (__GNUC__) */ - -#undef sigpause -#define sigpause(MASK) sigsuspend (&(MASK)) - -#define sigblock(SIG) sys_sigblock (SIG) -#define sigunblock(SIG) sys_sigunblock (SIG) -#ifndef sigsetmask -#define sigsetmask(SIG) sys_sigsetmask (SIG) -#endif -#undef signal -#define signal(SIG,ACT) sys_signal(SIG,ACT) - -/* Whether this is what all systems want or not, this is what - appears to be assumed in the source, for example data.c:arith_error. */ typedef void (*signal_handler_t) (int); -signal_handler_t sys_signal (int signal_number, signal_handler_t action); -sigset_t sys_sigblock (sigset_t new_mask); -sigset_t sys_sigunblock (sigset_t new_mask); -sigset_t sys_sigsetmask (sigset_t new_mask); +extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); + #if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN) _Noreturn void croak (char *); #endif -#define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG) - -#define sigfree() sigsetmask (SIGEMPTYMASK) - #if defined (SIGIO) && defined (BROKEN_SIGIO) # undef SIGIO #endif @@ -97,12 +52,8 @@ #undef SIGPTY #endif - -/* FIXME? Emacs only defines NSIG_MINIMUM on some platforms? */ #if NSIG < NSIG_MINIMUM -# ifdef NSIG -# undef NSIG -# endif +# undef NSIG # define NSIG NSIG_MINIMUM #endif === modified file 'src/term.c' --- src/term.c 2012-09-04 17:34:54 +0000 +++ src/term.c 2012-09-07 01:27:44 +0000 @@ -25,7 +25,6 @@ #include #include #include -#include #include #include "lisp.h" @@ -2932,7 +2931,10 @@ no_controlling_tty = 1; #else #ifdef TIOCNOTTY /* Try BSD ioctls. */ - sigblock (sigmask (SIGTTOU)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGTTOU); + pthread_sigmask (SIG_BLOCK, &blocked, 0); fd = emacs_open (DEV_TTY, O_RDWR, 0); if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) { @@ -2940,7 +2942,7 @@ } if (fd != -1) emacs_close (fd); - sigunblock (sigmask (SIGTTOU)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #else /* Unknown system. */ croak (); @@ -3074,9 +3076,14 @@ /* On some systems, tgetent tries to access the controlling terminal. */ - sigblock (sigmask (SIGTTOU)); - status = tgetent (tty->termcap_term_buffer, terminal_type); - sigunblock (sigmask (SIGTTOU)); + { + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGTTOU); + pthread_sigmask (SIG_BLOCK, &blocked, 0); + status = tgetent (tty->termcap_term_buffer, terminal_type); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); + } if (status < 0) { === modified file 'src/widget.c' --- src/widget.c 2012-09-04 17:34:54 +0000 +++ src/widget.c 2012-09-07 01:27:44 +0000 @@ -50,9 +50,6 @@ #include #include "../lwlib/lwlib.h" -#include -#include "syssignal.h" - #include "character.h" #include "font.h" === modified file 'src/xmenu.c' --- src/xmenu.c 2012-09-04 17:34:54 +0000 +++ src/xmenu.c 2012-09-07 01:27:44 +0000 @@ -32,11 +32,6 @@ #include -#if 0 /* Why was this included? And without syssignal.h? */ -/* On 4.3 this loses if it comes after xterm.h. */ -#include -#endif - #include #include === modified file 'src/xterm.c' --- src/xterm.c 2012-09-04 17:34:54 +0000 +++ src/xterm.c 2012-09-07 01:27:44 +0000 @@ -21,7 +21,6 @@ /* Xt features made by Fred Pierresteguy. */ #include -#include #include #include @@ -29,9 +28,6 @@ #include "lisp.h" #include "blockinput.h" - -/* Need syssignal.h for various externs and definitions that may be required - by some configurations for calls to signal later in this source file. */ #include "syssignal.h" /* This may include sys/types.h, and that somehow loses @@ -7766,7 +7762,9 @@ #ifdef USG /* USG systems forget handlers when they are used; must reestablish each time */ - signal (signalnum, x_connection_signal); + struct sigaction action; + emacs_sigaction_init (&action, x_connection_signal); + sigaction (signalnum, &action, 0); #endif /* USG */ } @@ -7876,10 +7874,15 @@ } /* Ordinary stack unwind doesn't deal with these. */ + { + sigset_t unblocked; + sigemptyset (&unblocked); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + sigaddset (&unblocked, SIGIO); #endif - sigunblock (sigmask (SIGALRM)); + sigaddset (&unblocked, SIGALRM); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + } TOTALLY_UNBLOCK_INPUT; unbind_to (idx, Qnil); @@ -10759,6 +10762,8 @@ void x_initialize (void) { + struct sigaction action; + baud_rate = 19200; x_noop_count = 0; @@ -10805,7 +10810,8 @@ XSetErrorHandler (x_error_handler); XSetIOErrorHandler (x_io_error_quitter); - signal (SIGPIPE, x_connection_signal); + emacs_sigaction_init (&action, x_connection_signal); + sigaction (SIGPIPE, &action, 0); } ------------------------------------------------------------ revno: 109908 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2012-09-06 22:13:45 +0000 message: Misc changes made in Gnus master Use combining faces for highlighting. Change ephemeral Gnus group names to be prettier. gnus-util.el: Fix compilation error on XEmacs 21.4. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-09-06 02:20:21 +0000 +++ lisp/gnus/ChangeLog 2012-09-06 22:13:45 +0000 @@ -1,3 +1,27 @@ +2012-09-06 Lars Ingebrigtsen + + * gnus-util.el: Fix compilation error on XEmacs 21.4. + +2012-09-06 Juri Linkov + + * gnus-group.el (gnus-read-ephemeral-gmane-group): Change the naming + scheme for buffer names to be more consistent with other group and + article buffer names in Gnus. + +2012-09-06 Lars Ingebrigtsen + + * gnus-util.el + (gnus-put-text-property-excluding-characters-with-faces): Remove. + + * gnus-compat.el: Define compat function `add-face' from Wolfgang + Jenkner. + + * gnus-group.el (gnus-group-highlight-line): Use combining faces. + + * gnus-sum.el (gnus-summary-highlight-line): Ditto. + + * gnus-salt.el (gnus-tree-highlight-node): Ditto. + 2012-09-06 Katsumi Yamaoka * gnus-score.el (gnus-score-decode-text-parts): Use #' for === modified file 'lisp/gnus/gnus-group.el' --- lisp/gnus/gnus-group.el 2012-09-05 22:45:43 +0000 +++ lisp/gnus/gnus-group.el 2012-09-06 22:13:45 +0000 @@ -1669,9 +1669,7 @@ gnus-group-highlight)))) (unless (eq face (get-text-property beg 'face)) (let ((inhibit-read-only t)) - (gnus-put-text-property-excluding-characters-with-faces - beg end 'face - (if (boundp face) (symbol-value face) face))) + (add-face beg end (if (boundp face) (symbol-value face) face))) (gnus-extent-start-open beg)))) (defun gnus-group-get-icon (group) @@ -2388,7 +2386,7 @@ group start (+ start range))) (write-region (point-min) (point-max) tmpfile) (gnus-group-read-ephemeral-group - (format "%s.start-%s.range-%s" group start range) + (format "nndoc+ephemeral:%s.start-%s.range-%s" group start range) `(nndoc ,tmpfile (nndoc-article-type mbox)))) (delete-file tmpfile))) @@ -2481,7 +2479,7 @@ "/.*$" "")))) (write-region (point-min) (point-max) tmpfile) (gnus-group-read-ephemeral-group - (format "gnus-read-ephemeral-bug:%s" + (format "nndoc+ephemeral:bug#%s" (mapconcat 'number-to-string ids ",")) `(nndoc ,tmpfile (nndoc-article-type mbox)) === modified file 'lisp/gnus/gnus-salt.el' --- lisp/gnus/gnus-salt.el 2012-07-24 22:17:17 +0000 +++ lisp/gnus/gnus-salt.el 2012-09-06 22:13:45 +0000 @@ -660,9 +660,7 @@ (not (eval (caar list)))) (setq list (cdr list))))) (unless (eq (setq face (cdar list)) (get-text-property beg 'face)) - (gnus-put-text-property-excluding-characters-with-faces - beg end 'face - (if (boundp face) (symbol-value face) face))))) + (add-face beg end (if (boundp face) (symbol-value face) face))))) (defun gnus-tree-indent (level) (insert (make-string (1- (* (1+ gnus-tree-node-length) level)) ? ))) === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2012-08-28 09:40:11 +0000 +++ lisp/gnus/gnus-sum.el 2012-09-06 22:13:45 +0000 @@ -12522,9 +12522,8 @@ (not (memq article gnus-newsgroup-cached))))) (let ((face (funcall (gnus-summary-highlight-line-0)))) (unless (eq face (get-text-property beg 'face)) - (gnus-put-text-property-excluding-characters-with-faces - beg (point-at-eol) 'face - (setq face (if (boundp face) (symbol-value face) face))) + (add-face beg (point-at-eol) + (setq face (if (boundp face) (symbol-value face) face))) (when gnus-summary-highlight-line-function (funcall gnus-summary-highlight-line-function article face)))))) === modified file 'lisp/gnus/gnus-util.el' --- lisp/gnus/gnus-util.el 2012-09-06 02:20:21 +0000 +++ lisp/gnus/gnus-util.el 2012-09-06 22:13:45 +0000 @@ -866,19 +866,6 @@ (setq beg (point))) (gnus-overlay-put (gnus-make-overlay beg (point)) prop val))))) -(defun gnus-put-text-property-excluding-characters-with-faces (beg end - prop val) - "The same as `put-text-property', but don't put props on characters with the `gnus-face' property." - (let ((b beg)) - (while (/= b end) - (when (get-text-property b 'gnus-face) - (setq b (next-single-property-change b 'gnus-face nil end))) - (when (/= b end) - (inline - (gnus-put-text-property - b (setq b (next-single-property-change b 'gnus-face nil end)) - prop val)))))) - (defmacro gnus-faces-at (position) "Return a list of faces at POSITION." (if (featurep 'xemacs) @@ -1932,8 +1919,11 @@ "Return non-nil if STR1 is a prefix of STR2. If IGNORE-CASE is non-nil, the comparison is done without paying attention to case differences." - (eq t (compare-strings str1 nil nil - str2 0 (length str1) ignore-case)))) + (and (<= (length str1) (length str2)) + (let ((prefix (substring str2 0 (length str1)))) + (if ignore-case + (string-equal (downcase str1) (downcase prefix)) + (string-equal str1 prefix)))))) (eval-and-compile (if (fboundp 'macroexpand-all) ------------------------------------------------------------ revno: 109907 fixes bug: http://debbugs.gnu.org/12327 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2012-09-06 19:42:48 +0300 message: Fix bug #12327 with SIGCHLD handling on Windows and some other systems. src/process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke SIGCHLD handling on systems that don't have WNOHANG. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-06 09:15:44 +0000 +++ src/ChangeLog 2012-09-06 16:42:48 +0000 @@ -1,3 +1,8 @@ +2012-09-06 Eli Zaretskii + + * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke + SIGCHLD handling on systems that don't have WNOHANG. (Bug#12327) + 2012-09-06 Dmitry Antipov Explicitly mark buffer_defaults and buffer_local_symbols. === modified file 'src/process.c' --- src/process.c 2012-09-05 21:33:53 +0000 +++ src/process.c 2012-09-06 16:42:48 +0000 @@ -6518,9 +6518,9 @@ #if (defined WINDOWSNT \ || (defined USG && !defined GNU_LINUX \ && !(defined HPUX && defined WNOHANG))) +enum { CAN_HANDLE_MULTIPLE_CHILDREN = 0 }; +#else enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 }; -#else -enum { CAN_HANDLE_MULTIPLE_CHILDREN = 0 }; #endif static void ------------------------------------------------------------ revno: 109906 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12367 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2012-09-06 11:35:08 -0400 message: * lisp/emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args. (cl--make-usage-args): Strip _ from argument names. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-06 09:38:56 +0000 +++ lisp/ChangeLog 2012-09-06 15:35:08 +0000 @@ -1,3 +1,9 @@ +2012-09-06 Stefan Monnier + + * emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args + (bug#12367). + (cl--make-usage-args): Strip _ from argument names. + 2012-09-06 Rüdiger Sonderfeld * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use === modified file 'lisp/emacs-lisp/cl-macs.el' --- lisp/emacs-lisp/cl-macs.el 2012-09-04 17:40:25 +0000 +++ lisp/emacs-lisp/cl-macs.el 2012-09-06 15:35:08 +0000 @@ -393,9 +393,14 @@ (mapcar (lambda (x) (cond ((symbolp x) - (if (eq ?\& (aref (symbol-name x) 0)) - (setq state x) - (make-symbol (upcase (symbol-name x))))) + (let ((first (aref (symbol-name x) 0))) + (if (eq ?\& first) + (setq state x) + ;; Strip a leading underscore, since it only + ;; means that this argument is unused. + (make-symbol (upcase (if (eq ?_ first) + (substring (symbol-name x) 1) + (symbol-name x))))))) ((not (consp x)) x) ((memq state '(nil &rest)) (cl--make-usage-args x)) (t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR). @@ -479,7 +484,13 @@ (let ((arg (pop args))) (or (consp arg) (setq arg (list arg))) (let* ((karg (if (consp (car arg)) (caar arg) - (intern (format ":%s" (car arg))))) + (let ((name (symbol-name (car arg)))) + ;; Strip a leading underscore, since it only + ;; means that this argument is unused, but + ;; shouldn't affect the key's name (bug#12367). + (if (eq ?_ (aref name 0)) + (setq name (substring name 1))) + (intern (format ":%s" name))))) (varg (if (consp (car arg)) (cl-cadar arg) (car arg))) (def (if (cdr arg) (cadr arg) (or (car cl--bind-defs) (cadr (assq varg cl--bind-defs))))) ------------------------------------------------------------ revno: 109905 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-09-06 17:38:56 +0800 message: Remove references to obsolete variable speedbar-key-map. * speedbar.el (speedbar-update-flag, speedbar-mode): Remove references to obsolete variable speedbar-key-map. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-06 09:36:40 +0000 +++ lisp/ChangeLog 2012-09-06 09:38:56 +0000 @@ -1,7 +1,3 @@ -2012-09-06 Chong Yidong - - * progmodes/vhdl-mode.el - 2012-09-06 Rüdiger Sonderfeld * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use @@ -14,6 +10,9 @@ * frame.el (window-system-version): Mark as obsolete. + * speedbar.el (speedbar-update-flag, speedbar-mode): Remove uses + of obsolete variable speedbar-key-map. + 2012-09-06 Juri Linkov * replace.el (replace-lax-whitespace): New defcustom. === modified file 'lisp/speedbar.el' --- lisp/speedbar.el 2012-07-26 01:27:33 +0000 +++ lisp/speedbar.el 2012-09-06 09:38:56 +0000 @@ -763,7 +763,7 @@ "Non-nil means to automatically update the display. When this is nil then speedbar will not follow the attached frame's directory. If you want to change this while speedbar is active, either use -\\[customize] or call \\ `\\[speedbar-toggle-updates]'." +\\[customize] or call \\ `\\[speedbar-toggle-updates]'." :group 'speedbar :initialize 'custom-initialize-default :set (lambda (sym val) @@ -1083,7 +1083,7 @@ (define-derived-mode speedbar-mode fundamental-mode "Speedbar" "Major mode for managing a display of directories and tags. -\\ +\\ The first line represents the default directory of the speedbar frame. Each directory segment is a button which jumps speedbar's default directory to that directory. Buttons are activated by clicking `\\[speedbar-click]'. @@ -1120,7 +1120,7 @@ tags start with >. Click the name of the tag to go to that position in the selected file. -\\{speedbar-key-map}" +\\{speedbar-mode-map}" (save-excursion (setq font-lock-keywords nil) ;; no font-locking please (setq truncate-lines t) ------------------------------------------------------------ revno: 109904 author: Rüdiger Sonderfeld committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-09-06 17:36:40 +0800 message: Fix use of obsolete variables in vhdl-mode.el. * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use obsolete alias speedbar-key-map. (vhdl-doc-variable, vhdl-doc-mode): Use called-interactively-p. (vhdl-index-menu-init): Don't use obsolete variable font-lock-maximum-size. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-06 09:29:32 +0000 +++ lisp/ChangeLog 2012-09-06 09:36:40 +0000 @@ -1,5 +1,17 @@ 2012-09-06 Chong Yidong + * progmodes/vhdl-mode.el + +2012-09-06 Rüdiger Sonderfeld + + * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use + obsolete alias speedbar-key-map. + (vhdl-doc-variable, vhdl-doc-mode): Use called-interactively-p. + (vhdl-index-menu-init): Don't use obsolete variable + font-lock-maximum-size. + +2012-09-06 Chong Yidong + * frame.el (window-system-version): Mark as obsolete. 2012-09-06 Juri Linkov === modified file 'lisp/progmodes/vhdl-mode.el' --- lisp/progmodes/vhdl-mode.el 2012-07-25 05:48:19 +0000 +++ lisp/progmodes/vhdl-mode.el 2012-09-06 09:36:40 +0000 @@ -4138,10 +4138,7 @@ (set (make-local-variable 'imenu-generic-expression) vhdl-imenu-generic-expression) (when (and vhdl-index-menu (fboundp 'imenu)) - (if (or (not (boundp 'font-lock-maximum-size)) - (> font-lock-maximum-size (buffer-size))) - (imenu-add-to-menubar "Index") - (message "Scanning buffer for index...buffer too big")))) + (imenu-add-to-menubar "Index"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Source file menu (using `easy-menu.el') @@ -14385,10 +14382,10 @@ (define-key vhdl-speedbar-key-map (int-to-string key) `(lambda () (interactive) (vhdl-speedbar-set-depth ,key))) (setq key (1+ key))))) - (define-key speedbar-key-map "h" + (define-key speedbar-mode-map "h" (lambda () (interactive) (speedbar-change-initial-expansion-list "vhdl directory"))) - (define-key speedbar-key-map "H" + (define-key speedbar-mode-map "H" (lambda () (interactive) (speedbar-change-initial-expansion-list "vhdl project"))) ;; menu @@ -17400,7 +17397,8 @@ "Display VARIABLE's documentation in *Help* buffer." (interactive) (unless (featurep 'xemacs) - (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p))) + (help-setup-xref (list #'vhdl-doc-variable variable) + (called-interactively-p 'interactive))) (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*") (princ (documentation-property variable 'variable-documentation)) @@ -17412,7 +17410,8 @@ "Display VHDL Mode documentation in *Help* buffer." (interactive) (unless (featurep 'xemacs) - (help-setup-xref (list #'vhdl-doc-mode) (interactive-p))) + (help-setup-xref (list #'vhdl-doc-mode) + (called-interactively-p 'interactive))) (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*") (princ mode-name) ------------------------------------------------------------ revno: 109903 committer: Chong Yidong branch nick: trunk timestamp: Thu 2012-09-06 17:29:32 +0800 message: * frame.el (window-system-version): Mark as obsolete. See http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00412.html diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-06 08:49:40 +0000 +++ etc/NEWS 2012-09-06 09:29:32 +0000 @@ -695,6 +695,7 @@ ** `automount-dir-prefix' is obsolete. ** `buffer-has-markers-at' is obsolete. +** `window-system-version' is obsolete. * Changes in Emacs 24.3 on non-free operating systems === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-06 08:49:40 +0000 +++ lisp/ChangeLog 2012-09-06 09:29:32 +0000 @@ -1,3 +1,7 @@ +2012-09-06 Chong Yidong + + * frame.el (window-system-version): Mark as obsolete. + 2012-09-06 Juri Linkov * replace.el (replace-lax-whitespace): New defcustom. === modified file 'lisp/frame.el' --- lisp/frame.el 2012-08-15 16:29:11 +0000 +++ lisp/frame.el 2012-09-06 09:29:32 +0000 @@ -1657,6 +1657,10 @@ (make-variable-buffer-local 'show-trailing-whitespace) +;; Defined in dispnew.c. +(make-obsolete-variable + 'window-system-version "it does not give useful information." "24.3") + (provide 'frame) ;;; frame.el ends here ------------------------------------------------------------ revno: 109902 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2012-09-06 13:15:44 +0400 message: Explicitly mark buffer_defaults and buffer_local_symbols. * alloc.c (Fgarbage_collect): Mark buffer_defaults and mark_local_symbols here. (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking since special buffers aren't marked here any more. (allocate_buffer): Chain new buffer with all_buffers here... * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and not here. (Vbuffer_defaults, Vbuffer_local_symbols): Remove. (syms_of_buffer): Remove staticpro of the above. (init_buffer_once): Set names for buffer_defaults and buffer_local_symbols. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-06 08:04:49 +0000 +++ src/ChangeLog 2012-09-06 09:15:44 +0000 @@ -1,3 +1,18 @@ +2012-09-06 Dmitry Antipov + + Explicitly mark buffer_defaults and buffer_local_symbols. + * alloc.c (Fgarbage_collect): Mark buffer_defaults and + mark_local_symbols here. + (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking + since special buffers aren't marked here any more. + (allocate_buffer): Chain new buffer with all_buffers here... + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and + not here. + (Vbuffer_defaults, Vbuffer_local_symbols): Remove. + (syms_of_buffer): Remove staticpro of the above. + (init_buffer_once): Set names for buffer_defaults and + buffer_local_symbols. + 2012-09-06 Paul Eggert Use bool for booleans in font-related modules. === modified file 'src/alloc.c' --- src/alloc.c 2012-09-06 07:10:25 +0000 +++ src/alloc.c 2012-09-06 09:15:44 +0000 @@ -278,6 +278,7 @@ static Lisp_Object make_pure_vector (ptrdiff_t); static void mark_glyph_matrix (struct glyph_matrix *); static void mark_face_cache (struct face_cache *); +static void mark_buffer (struct buffer *); #if !defined REL_ALLOC || defined SYSTEM_MALLOC static void refill_memory_reserve (void); @@ -3281,7 +3282,10 @@ XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text) - header_size) / word_size); - /* Note that the fields of B are not initialized. */ + /* Put B on the chain of all buffers including killed ones. */ + b->header.next.buffer = all_buffers; + all_buffers = b; + /* Note that the rest fields of B are not initialized. */ return b; } @@ -5473,6 +5477,9 @@ /* Mark all the special slots that serve as the roots of accessibility. */ + mark_buffer (&buffer_defaults); + mark_buffer (&buffer_local_symbols); + for (i = 0; i < staticidx; i++) mark_object (*staticvec[i]); @@ -5950,9 +5957,7 @@ #ifdef GC_CHECK_MARKED_OBJECTS m = mem_find (po); - if (m == MEM_NIL && !SUBRP (obj) - && po != &buffer_defaults - && po != &buffer_local_symbols) + if (m == MEM_NIL && !SUBRP (obj)) emacs_abort (); #endif /* GC_CHECK_MARKED_OBJECTS */ @@ -5969,15 +5974,14 @@ { case PVEC_BUFFER: #ifdef GC_CHECK_MARKED_OBJECTS - if (po != &buffer_defaults && po != &buffer_local_symbols) - { - struct buffer *b; - FOR_EACH_BUFFER (b) - if (b == po) - break; - if (b == NULL) - emacs_abort (); - } + { + struct buffer *b; + FOR_EACH_BUFFER (b) + if (b == po) + break; + if (b == NULL) + emacs_abort (); + } #endif /* GC_CHECK_MARKED_OBJECTS */ mark_buffer ((struct buffer *) ptr); break; === modified file 'src/buffer.c' --- src/buffer.c 2012-09-04 17:34:54 +0000 +++ src/buffer.c 2012-09-06 09:15:44 +0000 @@ -60,10 +60,6 @@ struct buffer alignas (GCALIGNMENT) buffer_defaults; -/* A Lisp_Object pointer to the above, used for staticpro */ - -static Lisp_Object Vbuffer_defaults; - /* This structure marks which slots in a buffer have corresponding default values in buffer_defaults. Each such slot has a nonzero value in this structure. @@ -87,9 +83,6 @@ struct buffer alignas (GCALIGNMENT) buffer_local_symbols; -/* A Lisp_Object pointer to the above, used for staticpro */ -static Lisp_Object Vbuffer_local_symbols; - /* Return the symbol of the per-buffer variable at offset OFFSET in the buffer structure. */ @@ -595,10 +588,6 @@ bset_width_table (b, Qnil); b->prevent_redisplay_optimizations_p = 1; - /* Put this on the chain of all buffers including killed ones. */ - b->header.next.buffer = all_buffers; - all_buffers = b; - /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ bset_pt_marker (b, Qnil); @@ -819,10 +808,6 @@ b->width_run_cache = 0; bset_width_table (b, Qnil); - /* Put this on the chain of all buffers including killed ones. */ - b->header.next.buffer = all_buffers; - all_buffers = b; - name = Fcopy_sequence (name); set_string_intervals (name, NULL); bset_name (b, name); @@ -5145,10 +5130,11 @@ buffer_local_symbols.indirections = 0; set_buffer_intervals (&buffer_defaults, NULL); set_buffer_intervals (&buffer_local_symbols, NULL); + /* This is not strictly necessary, but let's make them initialized. */ + bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*")); + bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*")); XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); - XSETBUFFER (Vbuffer_defaults, &buffer_defaults); XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); - XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); /* Set up the default values of various buffer slots. */ /* Must do these before making the first buffer! */ @@ -5430,8 +5416,6 @@ last_overlay_modification_hooks = Fmake_vector (make_number (10), Qnil); - staticpro (&Vbuffer_defaults); - staticpro (&Vbuffer_local_symbols); staticpro (&Qfundamental_mode); staticpro (&Qmode_class); staticpro (&QSFundamental); ------------------------------------------------------------ revno: 109901 fixes bug: http://debbugs.gnu.org/10885 committer: Juri Linkov branch nick: trunk timestamp: Thu 2012-09-06 11:49:40 +0300 message: * lisp/replace.el (replace-lax-whitespace): New defcustom. (query-replace, query-replace-regexp, query-replace-regexp-eval) (replace-string, replace-regexp): Mention it in docstrings. (perform-replace, replace-highlight): Let-bind isearch-lax-whitespace and isearch-regexp-lax-whitespace according to the values of replace-lax-whitespace and regexp-flag. Don't let-bind search-whitespace-regexp. * lisp/isearch.el (isearch-query-replace): Let-bind replace-lax-whitespace instead of let-binding replace-search-function and replace-re-search-function. (isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace and isearch-regexp-lax-whitespace to lazy-highlight variables. (isearch-toggle-symbol): Set isearch-regexp to nil in isearch-word mode (like in isearch-toggle-word). diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-05 09:22:20 +0000 +++ etc/NEWS 2012-09-06 08:49:40 +0000 @@ -197,6 +197,13 @@ `isearch-lax-whitespace'. In regexp incremental search, it toggles the value of the variable `isearch-regexp-lax-whitespace'. +** query-replace changes + +*** When new option `replace-lax-whitespace' is non-nil, +and you enter a space or spaces in the strings or regexps +to be replaced, `query-replace' will match any sequence matched +by the regexp `search-whitespace-regexp'. + ** M-x move-to-column, if called interactively with no prefix arg, now prompts for a column number. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-06 08:33:17 +0000 +++ lisp/ChangeLog 2012-09-06 08:49:40 +0000 @@ -1,5 +1,23 @@ 2012-09-06 Juri Linkov + * replace.el (replace-lax-whitespace): New defcustom. + (query-replace, query-replace-regexp, query-replace-regexp-eval) + (replace-string, replace-regexp): Mention it in docstrings. + (perform-replace, replace-highlight): Let-bind + isearch-lax-whitespace and isearch-regexp-lax-whitespace according + to the values of replace-lax-whitespace and regexp-flag. + Don't let-bind search-whitespace-regexp. (Bug#10885) + + * isearch.el (isearch-query-replace): Let-bind + replace-lax-whitespace instead of let-binding + replace-search-function and replace-re-search-function. + (isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace + and isearch-regexp-lax-whitespace to lazy-highlight variables. + (isearch-toggle-symbol): Set isearch-regexp to nil + in isearch-word mode (like in isearch-toggle-word). + +2012-09-06 Juri Linkov + * replace.el (replace-search-function) (replace-re-search-function): Set default values to nil. (perform-replace): Let-bind isearch-related variables based on === modified file 'lisp/isearch.el' --- lisp/isearch.el 2012-09-02 09:31:45 +0000 +++ lisp/isearch.el 2012-09-06 08:49:40 +0000 @@ -1405,6 +1405,7 @@ (interactive) (setq isearch-word (unless (eq isearch-word 'isearch-symbol-regexp) 'isearch-symbol-regexp)) + (if isearch-word (setq isearch-regexp nil)) (setq isearch-success t isearch-adjusted t) (isearch-update)) @@ -1579,14 +1580,11 @@ ;; set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) - (replace-search-function - (if (and isearch-lax-whitespace (not regexp-flag)) - #'search-forward-lax-whitespace - replace-search-function)) - (replace-re-search-function - (if (and isearch-regexp-lax-whitespace regexp-flag) - #'re-search-forward-lax-whitespace - replace-re-search-function)) + (replace-lax-whitespace + (and search-whitespace-regexp + (if isearch-regexp + isearch-regexp-lax-whitespace + isearch-lax-whitespace))) ;; Set `isearch-recursive-edit' to nil to prevent calling ;; `exit-recursive-edit' in `isearch-done' that terminates ;; the execution of this command when it is non-nil. @@ -2956,10 +2954,14 @@ (let ((case-fold-search isearch-lazy-highlight-case-fold-search) (isearch-regexp isearch-lazy-highlight-regexp) (isearch-word isearch-lazy-highlight-word) + (isearch-lax-whitespace + isearch-lazy-highlight-lax-whitespace) + (isearch-regexp-lax-whitespace + isearch-lazy-highlight-regexp-lax-whitespace) + (isearch-forward isearch-lazy-highlight-forward) (search-invisible nil) ; don't match invisible text (retry t) (success nil) - (isearch-forward isearch-lazy-highlight-forward) (bound (if isearch-lazy-highlight-forward (min (or isearch-lazy-highlight-end-limit (point-max)) (if isearch-lazy-highlight-wrapped === modified file 'lisp/replace.el' --- lisp/replace.el 2012-09-06 08:33:17 +0000 +++ lisp/replace.el 2012-09-06 08:49:40 +0000 @@ -33,6 +33,14 @@ :type 'boolean :group 'matching) +(defcustom replace-lax-whitespace nil + "Non-nil means `query-replace' matches a sequence of whitespace chars. +When you enter a space or spaces in the strings or regexps to be replaced, +it will match any sequence matched by the regexp `search-whitespace-regexp'." + :type 'boolean + :group 'matching + :version "24.3") + (defvar query-replace-history nil "Default history list for query-replace commands. See `query-replace-from-history-variable' and @@ -226,6 +234,10 @@ matched is all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the string +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. @@ -270,6 +282,10 @@ all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. @@ -346,6 +362,10 @@ Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. +If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches that are surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on." @@ -437,6 +457,10 @@ \(Preserving case means that if the string matched is all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the string +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. @@ -475,6 +499,10 @@ Preserve case in each match if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. +If `replace-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. @@ -1760,6 +1788,10 @@ replace-search-function) (let ((isearch-regexp regexp-flag) (isearch-word delimited-flag) + (isearch-lax-whitespace + (and replace-lax-whitespace (not regexp-flag))) + (isearch-regexp-lax-whitespace + (and replace-lax-whitespace regexp-flag)) (isearch-case-fold-search case-fold-search) (isearch-forward t)) (isearch-search-fun)))) @@ -2113,7 +2145,10 @@ (let ((isearch-string search-string) (isearch-regexp regexp-flag) (isearch-word delimited-flag) - (search-whitespace-regexp nil) + (isearch-lax-whitespace + (and replace-lax-whitespace (not regexp-flag))) + (isearch-regexp-lax-whitespace + (and replace-lax-whitespace regexp-flag)) (isearch-case-fold-search case-fold-search) (isearch-forward t) (isearch-error nil)) ------------------------------------------------------------ revno: 109900 fixes bug: http://debbugs.gnu.org/10885 committer: Juri Linkov branch nick: trunk timestamp: Thu 2012-09-06 11:33:17 +0300 message: Use `isearch-search-fun' in `perform-replace' (bug#10885, bug#10887). * lisp/replace.el (replace-search-function) (replace-re-search-function): Set default values to nil. (perform-replace): Let-bind isearch-related variables based on replace-related values, call `isearch-search-fun' and let-bind the result to `search-function'. Remove code that sets `search-function' and `search-string' separately for `delimited-flag'. (replace-highlight): Add new argument `delimited-flag' and rename other arguments to the names used in `perform-replace'. Let-bind `isearch-word' to the argument `delimited-flag'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-05 09:22:20 +0000 +++ lisp/ChangeLog 2012-09-06 08:33:17 +0000 @@ -1,3 +1,17 @@ +2012-09-06 Juri Linkov + + * replace.el (replace-search-function) + (replace-re-search-function): Set default values to nil. + (perform-replace): Let-bind isearch-related variables based on + replace-related values, call `isearch-search-fun' and let-bind + the result to `search-function'. Remove code that sets + `search-function' and `search-string' separately for + `delimited-flag'. + (replace-highlight): Add new argument `delimited-flag' and + rename other arguments to the names used in `perform-replace'. + Let-bind `isearch-word' to the argument `delimited-flag'. + (Bug#10885, bug#10887) + 2012-09-05 Martin Rudalics * help.el (temp-buffer-max-height): New default value. === modified file 'lisp/replace.el' --- lisp/replace.el 2012-08-06 05:33:39 +0000 +++ lisp/replace.el 2012-09-06 08:33:17 +0000 @@ -1717,12 +1717,12 @@ (replace-match newtext fixedcase literal) noedit) -(defvar replace-search-function 'search-forward +(defvar replace-search-function nil "Function to use when searching for strings to replace. It is used by `query-replace' and `replace-string', and is called with three arguments, as if it were `search-forward'.") -(defvar replace-re-search-function 're-search-forward +(defvar replace-re-search-function nil "Function to use when searching for regexps to replace. It is used by `query-replace-regexp', `replace-regexp', `query-replace-regexp-eval', and `map-query-replace-regexp'. @@ -1755,9 +1755,14 @@ (nocasify (not (and case-replace case-fold-search))) (literal (or (not regexp-flag) (eq regexp-flag 'literal))) (search-function - (if regexp-flag - replace-re-search-function - replace-search-function)) + (or (if regexp-flag + replace-re-search-function + replace-search-function) + (let ((isearch-regexp regexp-flag) + (isearch-word delimited-flag) + (isearch-case-fold-search case-fold-search) + (isearch-forward t)) + (isearch-search-fun)))) (search-string from-string) (real-match-data nil) ; The match data for the current match. (next-replacement nil) @@ -1811,12 +1816,6 @@ (vector repeat-count repeat-count replacements replacements))))) - (if delimited-flag - (setq search-function 're-search-forward - search-string (concat "\\b" - (if regexp-flag from-string - (regexp-quote from-string)) - "\\b"))) (when query-replace-lazy-highlight (setq isearch-lazy-highlight-last-string nil)) @@ -1898,7 +1897,7 @@ (replace-highlight (nth 0 real-match-data) (nth 1 real-match-data) start end search-string - (or delimited-flag regexp-flag) case-fold-search)) + regexp-flag delimited-flag case-fold-search)) (setq noedit (replace-match-maybe-edit next-replacement nocasify literal @@ -1917,7 +1916,7 @@ (replace-highlight (match-beginning 0) (match-end 0) start end search-string - (or delimited-flag regexp-flag) case-fold-search) + regexp-flag delimited-flag case-fold-search) ;; Bind message-log-max so we don't fill up the message log ;; with a bunch of identical messages. (let ((message-log-max nil) @@ -2099,15 +2098,11 @@ (if (= replace-count 1) "" "s"))) (or (and keep-going stack) multi-buffer))) -(defvar isearch-error) -(defvar isearch-forward) -(defvar isearch-case-fold-search) -(defvar isearch-string) - (defvar replace-overlay nil) (defun replace-highlight (match-beg match-end range-beg range-end - string regexp case-fold) + search-string regexp-flag delimited-flag + case-fold-search) (if query-replace-highlight (if replace-overlay (move-overlay replace-overlay match-beg match-end (current-buffer)) @@ -2115,13 +2110,11 @@ (overlay-put replace-overlay 'priority 1001) ;higher than lazy overlays (overlay-put replace-overlay 'face 'query-replace))) (if query-replace-lazy-highlight - (let ((isearch-string string) - (isearch-regexp regexp) - ;; Set isearch-word to nil because word-replace is regexp-based, - ;; so `isearch-search-fun' should not use `word-search-forward'. - (isearch-word nil) + (let ((isearch-string search-string) + (isearch-regexp regexp-flag) + (isearch-word delimited-flag) (search-whitespace-regexp nil) - (isearch-case-fold-search case-fold) + (isearch-case-fold-search case-fold-search) (isearch-forward t) (isearch-error nil)) (isearch-lazy-highlight-new-loop range-beg range-end)))) ------------------------------------------------------------ revno: 109899 committer: Paul Eggert branch nick: trunk timestamp: Thu 2012-09-06 01:04:49 -0700 message: Use bool for booleans in font-related modules. * font.c (font_intern_prop, font_style_to_value) (font_style_symbolic, font_parse_xlfd, font_parse_fcname) (generate_otf_features, font_check_otf_features, font_check_otf) (font_match_p, font_list_entities, font_at): * fontset.c (fontset_id_valid_p, reorder_font_vector (fontset_find_font, Fset_fontset_font) (face_suitable_for_char_p) [0]: * ftfont.c (fc_initialized, ftfont_get_open_type_spec) (ftfont_open, ftfont_text_extents, ftfont_check_otf): (m17n_flt_initialized, ftfont_shape_by_flt): * ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw): * nsfont.m (nsfont_draw): * w32font.c (w32font_draw): * w32term.c (x_draw_glyphless_glyph_string_foreground): Use bool for booleans. * font.h: Adjust to above API changes. (struct font, struct font_driver, struct font_driver_list): Use bool for booleans. (struct font): Remove useless member encoding_type. All users removed. * fontset.c, xftfont.c: Omit unnecessary static decls. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-06 07:10:25 +0000 +++ src/ChangeLog 2012-09-06 08:04:49 +0000 @@ -1,3 +1,28 @@ +2012-09-06 Paul Eggert + + Use bool for booleans in font-related modules. + * font.c (font_intern_prop, font_style_to_value) + (font_style_symbolic, font_parse_xlfd, font_parse_fcname) + (generate_otf_features, font_check_otf_features, font_check_otf) + (font_match_p, font_list_entities, font_at): + * fontset.c (fontset_id_valid_p, reorder_font_vector + (fontset_find_font, Fset_fontset_font) + (face_suitable_for_char_p) [0]: + * ftfont.c (fc_initialized, ftfont_get_open_type_spec) + (ftfont_open, ftfont_text_extents, ftfont_check_otf): + (m17n_flt_initialized, ftfont_shape_by_flt): + * ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw): + * nsfont.m (nsfont_draw): + * w32font.c (w32font_draw): + * w32term.c (x_draw_glyphless_glyph_string_foreground): + Use bool for booleans. + * font.h: Adjust to above API changes. + (struct font, struct font_driver, struct font_driver_list): + Use bool for booleans. + (struct font): Remove useless member encoding_type. + All users removed. + * fontset.c, xftfont.c: Omit unnecessary static decls. + 2012-09-06 Dmitry Antipov * alloc.c (mark_object): Revert window marking code === modified file 'src/font.c' --- src/font.c 2012-09-01 06:38:52 +0000 +++ src/font.c 2012-09-06 08:04:49 +0000 @@ -216,13 +216,12 @@ /* Return a Lispy value of a font property value at STR and LEN bytes. - If STR is "*", return nil. - If FORCE_SYMBOL is zero and all characters in STR are digits, - return an integer. Otherwise, return a symbol interned from - STR. */ + If STR is "*", return nil. If FORCE_SYMBOL, or if STR does not + consist entirely of one or more digits, return a symbol interned + from STR. Otherwise, return an integer. */ Lisp_Object -font_intern_prop (const char *str, ptrdiff_t len, int force_symbol) +font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) { ptrdiff_t i; Lisp_Object tem; @@ -306,7 +305,8 @@ VAL is an integer. */ int -font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror) +font_style_to_value (enum font_property_index prop, Lisp_Object val, + bool noerror) { Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); int len; @@ -385,7 +385,8 @@ } Lisp_Object -font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face) +font_style_symbolic (Lisp_Object font, enum font_property_index prop, + bool for_face) { Lisp_Object val = AREF (font, prop); Lisp_Object table, elt; @@ -1101,7 +1102,7 @@ } else { - int wild_card_found = 0; + bool wild_card_found = 0; Lisp_Object prop[XLFD_LAST_INDEX]; if (FONT_ENTITY_P (font)) @@ -1337,7 +1338,7 @@ } else if (*p == '-') { - int decimal = 0, size_found = 1; + bool decimal = 0, size_found = 1; for (q = p + 1; *q && *q != ':'; q++) if (! c_isdigit (*q)) { @@ -1938,7 +1939,7 @@ { Lisp_Object val; char *p; - int asterisk; + bool asterisk; p = features; *p = '\0'; @@ -2302,11 +2303,12 @@ } } -static int -font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table) +static bool +font_check_otf_features (Lisp_Object script, Lisp_Object langsys, + Lisp_Object features, Lisp_Object table) { Lisp_Object val; - int negative; + bool negative; table = assq_no_quit (script, table); if (NILP (table)) @@ -2342,7 +2344,7 @@ /* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */ -static int +static bool font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) { Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil; @@ -2376,7 +2378,7 @@ /* Check if FONT (font-entity or font-object) matches with the font specification SPEC. */ -int +bool font_match_p (Lisp_Object spec, Lisp_Object font) { Lisp_Object prop[FONT_SPEC_MAX], *props; @@ -2694,7 +2696,7 @@ Lisp_Object ftype, val; Lisp_Object list = Qnil; int size; - int need_filtering = 0; + bool need_filtering = 0; int i; eassert (FONT_SPEC_P (spec)); @@ -3036,15 +3038,14 @@ { Lisp_Object font_entity; Lisp_Object prefer; - int result, i; + int i; FRAME_PTR f = XFRAME (frame); if (NILP (XCDR (entities)) && ASIZE (XCAR (entities)) == 1) { font_entity = AREF (XCAR (entities), 0); - if (c < 0 - || (result = font_has_char (f, font_entity, c)) > 0) + if (c < 0 || font_has_char (f, font_entity, c) > 0) return font_entity; return Qnil; } @@ -3618,7 +3619,7 @@ Lisp_Object string) { FRAME_PTR f; - int multibyte; + bool multibyte; Lisp_Object font_object; multibyte = (NILP (string) === modified file 'src/font.h' --- src/font.h 2012-09-02 16:56:31 +0000 +++ src/font.h 2012-09-06 08:04:49 +0000 @@ -320,19 +320,10 @@ negative if that information is not in the font. */ int underline_position; - /* 1 if `vertical-centering-font-regexp' matches this font name. + /* True if `vertical-centering-font-regexp' matches this font name. In this case, we render characters at vertical center positions of lines. */ - int vertical_centering; - - /* Encoding type of the font. The value is one of - 0, 1, 2, or 3: - 0: code points 0x20..0x7F or 0x2020..0x7F7F are used - 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used - 2: code points 0x20A0..0x7FFF are used - 3: code points 0xA020..0xFF7F are used - If the member `font_encoder' is not NULL, this member is ignored. */ - unsigned char encoding_type; + bool vertical_centering; /* The baseline position of a font is normally `ascent' value of the font. However, there exist many fonts which don't set `ascent' to @@ -506,9 +497,9 @@ /* Symbol indicating the type of the font-driver. */ Lisp_Object type; - /* 1 iff the font's foundry, family, and adstyle names are case + /* True iff the font's foundry, family, and adstyle names are case sensitive. */ - int case_sensitive; + bool case_sensitive; /* Return a cache of font-entities on frame F. The cache must be a cons whose cdr part is the actual cache area. */ @@ -592,11 +583,11 @@ /* Optional. Draw glyphs between FROM and TO of S->char2b at (X Y) pixel - position of frame F with S->FACE and S->GC. If WITH_BACKGROUND - is nonzero, fill the background in advance. It is assured that - WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ + position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, + fill the background in advance. It is assured that WITH_BACKGROUND + is false when (FROM > 0 || TO < S->nchars). */ int (*draw) (struct glyph_string *s, int from, int to, - int x, int y, int with_background); + int x, int y, bool with_background); /* Optional. Store bitmap data for glyph-code CODE of FONT in BITMAP. It is @@ -648,7 +639,7 @@ short, return -1. */ int (*otf_drive) (struct font *font, Lisp_Object features, Lisp_Object gstring_in, int from, int to, - Lisp_Object gstring_out, int idx, int alternate_subst); + Lisp_Object gstring_out, int idx, bool alternate_subst); /* Optional. Make the font driver ready for frame F. Usually this function @@ -699,9 +690,9 @@ Return non-zero if FONT_OBJECT can be used as a (cached) font for ENTITY on frame F. */ - int (*cached_font_ok) (struct frame *f, - Lisp_Object font_object, - Lisp_Object entity); + bool (*cached_font_ok) (struct frame *f, + Lisp_Object font_object, + Lisp_Object entity); }; @@ -711,9 +702,9 @@ struct font_driver_list { - /* 1 iff this driver is currently used. It is ignored in the global + /* True iff this driver is currently used. It is ignored in the global font driver list.*/ - int on; + bool on; /* Pointer to the font driver. */ struct font_driver *driver; /* Pointer to the next element of the chain. */ @@ -744,12 +735,12 @@ extern int font_registry_charsets (Lisp_Object, struct charset **, struct charset **); extern int font_style_to_value (enum font_property_index prop, - Lisp_Object name, int noerror); + Lisp_Object name, bool noerror); extern Lisp_Object font_style_symbolic (Lisp_Object font, enum font_property_index prop, - int for_face); + bool for_face); -extern int font_match_p (Lisp_Object spec, Lisp_Object font); +extern bool font_match_p (Lisp_Object spec, Lisp_Object font); extern Lisp_Object font_list_entities (Lisp_Object frame, Lisp_Object spec); @@ -774,7 +765,7 @@ extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name); extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len, - int force_symbol); + bool force_symbol); extern void font_update_sort_order (int *order); extern void font_parse_family_registry (Lisp_Object family, === modified file 'src/fontset.c' --- src/fontset.c 2012-08-22 07:20:42 +0000 +++ src/fontset.c 2012-09-06 08:04:49 +0000 @@ -185,21 +185,12 @@ /* Prototype declarations for static functions. */ -static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); -static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, - int, int); -static void reorder_font_vector (Lisp_Object, struct font *); -static Lisp_Object fontset_font (Lisp_Object, int, struct face *, int); static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); -static Lisp_Object fontset_pattern_regexp (Lisp_Object); -static void accumulate_script_ranges (Lisp_Object, Lisp_Object, - Lisp_Object); -static void set_fontset_font (Lisp_Object, Lisp_Object); -/* Return 1 if ID is a valid fontset id, else return 0. +/* Return true if ID is a valid fontset id. Optimized away if ENABLE_CHECKING is not defined. */ -static int +static bool fontset_id_valid_p (int id) { return (id >= 0 && id < ASIZE (Vfontset_table) - 1); @@ -413,7 +404,7 @@ Lisp_Object vec, font_object; int size; int i; - int score_changed = 0; + bool score_changed = 0; if (font) XSETFONT (font_object, font); @@ -544,10 +535,11 @@ ID is a charset-id that must be preferred, or -1 meaning no preference. - If FALLBACK is nonzero, search only fallback fonts. */ + If FALLBACK, search only fallback fonts. */ static Lisp_Object -fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback) +fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, + bool fallback) { Lisp_Object vec, font_group; int i, charset_matched = 0, found_index; @@ -919,11 +911,11 @@ #if 0 -/* Return 1 if FACE is suitable for displaying character C. - Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P +/* Return true if FACE is suitable for displaying character C. + Called from the macro FACE_SUITABLE_FOR_CHAR_P when C is not an ASCII character. */ -int +bool face_suitable_for_char_p (struct face *face, int c) { Lisp_Object fontset, rfont_def; @@ -1470,7 +1462,7 @@ Lisp_Object range_list; struct charset *charset = NULL; Lisp_Object fontname; - int ascii_changed = 0; + bool ascii_changed = 0; fontset = check_fontset_name (name, &frame); === modified file 'src/ftfont.c' --- src/ftfont.c 2012-09-04 17:34:54 +0000 +++ src/ftfont.c 2012-09-06 08:04:49 +0000 @@ -45,7 +45,7 @@ static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif; /* Flag to tell if FcInit is already called or not. */ -static int fc_initialized; +static bool fc_initialized; /* Handle to a FreeType library instance. */ static FT_Library ft_library; @@ -65,7 +65,7 @@ #ifdef HAVE_LIBOTF /* The following four members must be here in this order to be compatible with struct xftfont_info (in xftfont.c). */ - int maybe_otf; /* Flag to tell if this may be OTF or not. */ + bool maybe_otf; /* Flag to tell if this may be OTF or not. */ OTF *otf; #endif /* HAVE_LIBOTF */ FT_Size ft_size; @@ -543,9 +543,9 @@ /* We can't draw a text without device dependent functions. */ NULL, /* draw */ ftfont_get_bitmap, - NULL, /* get_bitmap */ NULL, /* free_bitmap */ NULL, /* get_outline */ + NULL, /* free_outline */ ftfont_anchor_point, #ifdef HAVE_LIBOTF ftfont_otf_capability, @@ -661,7 +661,8 @@ { struct OpenTypeSpec *spec = malloc (sizeof *spec); Lisp_Object val; - int i, j, negative; + int i, j; + bool negative; if (! spec) return NULL; @@ -1185,7 +1186,7 @@ FT_Size ft_size; FT_UInt size; Lisp_Object val, filename, idx, cache, font_object; - int scalable; + bool scalable; int spacing; char name[256]; int i, len; @@ -1243,7 +1244,7 @@ ftfont_info->ft_size = ft_face->size; ftfont_info->index = XINT (idx); #ifdef HAVE_LIBOTF - ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; + ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0; ftfont_info->otf = NULL; #endif /* HAVE_LIBOTF */ /* This means that there's no need of transformation. */ @@ -1392,7 +1393,8 @@ struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; int width = 0; - int i, first; + int i; + bool first; if (ftfont_info->ft_size != ft_face->size) FT_Activate_Size (ftfont_info->ft_size); @@ -1682,10 +1684,12 @@ struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; OTF *otf = flt_font_ft->otf; OTF_Tag *tags; - int i, n, negative; + int i, n; + bool negative; if (FEATURE_ANY (0) && FEATURE_ANY (1)) - /* Return 1 iff any of GSUB or GPOS support the script (and language). */ + /* Return true iff any of GSUB or GPOS support the script (and + language). */ return (otf && (OTF_check_features (otf, 0, spec->script, spec->langsys, NULL, 0) > 0 @@ -2390,7 +2394,7 @@ static MFLTGlyphString gstring; -static int m17n_flt_initialized; +static bool m17n_flt_initialized; static Lisp_Object ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, @@ -2400,7 +2404,7 @@ ptrdiff_t i; struct MFLTFontFT flt_font_ft; MFLT *flt = NULL; - int with_variation_selector = 0; + bool with_variation_selector = 0; if (! m17n_flt_initialized) { @@ -2421,7 +2425,7 @@ break; c = LGLYPH_CHAR (g); if (CHAR_VARIATION_SELECTOR_P (c)) - with_variation_selector++; + with_variation_selector = 1; } len = i; === modified file 'src/ftxfont.c' --- src/ftxfont.c 2012-07-05 18:35:48 +0000 +++ src/ftxfont.c 2012-09-06 08:04:49 +0000 @@ -43,14 +43,6 @@ #endif struct font_driver ftxfont_driver; -/* Prototypes for helper function. */ -static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long); -static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *, - unsigned, int, int, XPoint *, int, int *, - int); -static void ftxfont_draw_background (FRAME_PTR, struct font *, GC, - int, int, int); - struct ftxfont_frame_data { /* Background and foreground colors. */ @@ -143,7 +135,9 @@ } static int -ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsigned int code, int x, int y, XPoint *p, int size, int *n, int flush) +ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, + unsigned int code, int x, int y, XPoint *p, int size, + int *n, bool flush) { struct font_bitmap bitmap; unsigned char *b; @@ -232,13 +226,6 @@ XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); } -/* Prototypes for font-driver methods. */ -static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object); -static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object); -static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int); -static void ftxfont_close (FRAME_PTR, struct font *); -static int ftxfont_draw (struct glyph_string *, int, int, int, int, int); - static Lisp_Object ftxfont_list (Lisp_Object frame, Lisp_Object spec) { @@ -280,7 +267,8 @@ } static int -ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) +ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, + bool with_background) { FRAME_PTR f = s->f; struct face *face = s->face; === modified file 'src/nsfont.m' --- src/nsfont.m 2012-09-04 17:34:54 +0000 +++ src/nsfont.m 2012-09-06 08:04:49 +0000 @@ -625,7 +625,7 @@ static int nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics); static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, - int with_background); + bool with_background); struct font_driver nsfont_driver = { @@ -833,7 +833,6 @@ font = (struct font *) font_info; font->pixel_size = [sfont pointSize]; font->driver = &nsfont_driver; - font->encoding_type = FONT_ENCODING_NOT_DECIDED; font->encoding_charset = -1; font->repertory_charset = -1; font->default_ascent = 0; @@ -1042,12 +1041,12 @@ /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel - position of frame F with S->FACE and S->GC. If WITH_BACKGROUND - is nonzero, fill the background in advance. It is assured that - WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ + position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, + fill the background in advance. It is assured that WITH_BACKGROUND + is false when (FROM > 0 || TO < S->nchars). */ static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, - int with_background) + bool with_background) /* NOTE: focus and clip must be set also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ { === modified file 'src/w32font.c' --- src/w32font.c 2012-08-15 14:20:16 +0000 +++ src/w32font.c 2012-09-06 08:04:49 +0000 @@ -635,9 +635,9 @@ /* w32 implementation of draw for font backend. Optional. Draw glyphs between FROM and TO of S->char2b at (X Y) pixel - position of frame F with S->FACE and S->GC. If WITH_BACKGROUND - is nonzero, fill the background in advance. It is assured that - WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). + position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, + fill the background in advance. It is assured that WITH_BACKGROUND + is false when (FROM > 0 || TO < S->nchars). TODO: Currently this assumes that the colors and fonts are already set in the DC. This seems to be true now, but maybe only due to @@ -647,7 +647,7 @@ int w32font_draw (struct glyph_string *s, int from, int to, - int x, int y, int with_background) + int x, int y, bool with_background) { UINT options; HRGN orig_clip = NULL; @@ -804,7 +804,7 @@ w32font_otf_drive (struct font *font, Lisp_Object features, Lisp_Object gstring_in, int from, int to, Lisp_Object gstring_out, int idx, - int alternate_subst); + bool alternate_subst); */ /* Internal implementation of w32font_list. @@ -987,7 +987,6 @@ font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth; font->vertical_centering = 0; - font->encoding_type = 0; font->baseline_offset = 0; font->relative_compose = 0; font->default_ascent = w32_font->metrics.tmAscent; === modified file 'src/w32font.h' --- src/w32font.h 2012-09-01 06:38:52 +0000 +++ src/w32font.h 2012-09-06 08:04:49 +0000 @@ -77,7 +77,7 @@ int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, struct font_metrics *metrics); int w32font_draw (struct glyph_string *s, int from, int to, - int x, int y, int with_background); + int x, int y, bool with_background); int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); === modified file 'src/xfont.c' --- src/xfont.c 2012-09-02 16:56:31 +0000 +++ src/xfont.c 2012-09-06 08:04:49 +0000 @@ -126,7 +126,7 @@ static unsigned xfont_encode_char (struct font *, int); static int xfont_text_extents (struct font *, unsigned *, int, struct font_metrics *); -static int xfont_draw (struct glyph_string *, int, int, int, int, int); +static int xfont_draw (struct glyph_string *, int, int, int, int, bool); static int xfont_check (FRAME_PTR, struct font *); struct font_driver xfont_driver = @@ -217,9 +217,9 @@ /* Check if CHARS (cons or vector) is supported by XFONT whose encoding charset is ENCODING (XFONT is NULL) or by a font whose registry corresponds to ENCODING and REPERTORY. - Return 1 if supported, return 0 otherwise. */ + Return true if supported. */ -static int +static bool xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont, struct charset *encoding, struct charset *repertory) { @@ -1019,7 +1019,8 @@ } static int -xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) +xfont_draw (struct glyph_string *s, int from, int to, int x, int y, + bool with_background) { XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont; int len = to - from; @@ -1040,7 +1041,7 @@ for (i = 0; i < len ; i++) str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); BLOCK_INPUT; - if (with_background > 0) + if (with_background) { if (s->padding_p) for (i = 0; i < len; i++) @@ -1066,7 +1067,7 @@ } BLOCK_INPUT; - if (with_background > 0) + if (with_background) { if (s->padding_p) for (i = 0; i < len; i++) === modified file 'src/xftfont.c' --- src/xftfont.c 2012-08-16 06:57:48 +0000 +++ src/xftfont.c 2012-09-06 08:04:49 +0000 @@ -52,7 +52,7 @@ /* The following five members must be here in this order to be compatible with struct ftfont_info (in ftfont.c). */ #ifdef HAVE_LIBOTF - int maybe_otf; /* Flag to tell if this may be OTF or not. */ + bool maybe_otf; /* Flag to tell if this may be OTF or not. */ OTF *otf; #endif /* HAVE_LIBOTF */ FT_Size ft_size; @@ -92,7 +92,7 @@ else { XGCValues xgcv; - int fg_done = 0, bg_done = 0; + bool fg_done = 0, bg_done = 0; BLOCK_INPUT; XGetGCValues (FRAME_X_DISPLAY (f), gc, @@ -111,7 +111,7 @@ *bg = xftface_info->xft_fg, bg_done = 1; } - if (fg_done + bg_done < 2) + if (! (fg_done & bg_done)) { XColor colors[2]; @@ -137,19 +137,6 @@ } -static Lisp_Object xftfont_list (Lisp_Object, Lisp_Object); -static Lisp_Object xftfont_match (Lisp_Object, Lisp_Object); -static Lisp_Object xftfont_open (FRAME_PTR, Lisp_Object, int); -static void xftfont_close (FRAME_PTR, struct font *); -static int xftfont_prepare_face (FRAME_PTR, struct face *); -static void xftfont_done_face (FRAME_PTR, struct face *); -static int xftfont_has_char (Lisp_Object, int); -static unsigned xftfont_encode_char (struct font *, int); -static int xftfont_text_extents (struct font *, unsigned *, int, - struct font_metrics *); -static int xftfont_draw (struct glyph_string *, int, int, int, int, int); -static int xftfont_end_for_frame (FRAME_PTR f); - struct font_driver xftfont_driver; static Lisp_Object @@ -470,7 +457,7 @@ font->underline_thickness = 0; } #ifdef HAVE_LIBOTF - xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; + xftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0; xftfont_info->otf = NULL; #endif /* HAVE_LIBOTF */ xftfont_info->ft_size = ft_face->size; @@ -630,7 +617,8 @@ } static int -xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) +xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, + bool with_background) { FRAME_PTR f = s->f; struct face *face = s->face; @@ -711,15 +699,17 @@ return 0; } -static int -xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity) +static bool +xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, + Lisp_Object entity) { struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object); FcPattern *oldpat = info->xftfont->pattern; Display *display = FRAME_X_DISPLAY (f); FcPattern *pat = FcPatternCreate (); FcBool b1, b2; - int ok = 0, i1, i2, r1, r2; + bool ok = 0; + int i1, i2, r1, r2; xftfont_add_rendering_parameters (pat, entity); XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); ------------------------------------------------------------ revno: 109898 committer: Dmitry Antipov branch nick: trunk timestamp: Thu 2012-09-06 11:10:25 +0400 message: * alloc.c (mark_object): Revert window marking code since it's unsafe for the Fset_window_configuration. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-05 21:33:53 +0000 +++ src/ChangeLog 2012-09-06 07:10:25 +0000 @@ -1,3 +1,8 @@ +2012-09-06 Dmitry Antipov + + * alloc.c (mark_object): Revert window marking code + since it's unsafe for the Fset_window_configuration. + 2012-09-05 Paul Eggert Fix race conditions with signal handlers and errno. === modified file 'src/alloc.c' --- src/alloc.c 2012-09-05 15:34:45 +0000 +++ src/alloc.c 2012-09-06 07:10:25 +0000 @@ -6019,22 +6019,18 @@ case PVEC_WINDOW: { struct window *w = (struct window *) ptr; - bool leaf = NILP (w->hchild) && NILP (w->vchild); - - if (leaf && NILP (w->buffer)) - /* If the window is deleted, mark just the window itself. */ - VECTOR_MARK (ptr); - else + + /* Even if the window is deleted, we can't mark just the window + itself because set-window-configuration can resurrect it. */ + mark_vectorlike (ptr); + /* Mark glyphs for leaf windows. Marking window + matrices is sufficient because frame matrices + use the same glyph memory. */ + if (NILP (w->hchild) && NILP (w->vchild) + && w->current_matrix) { - mark_vectorlike (ptr); - /* Mark glyphs for leaf windows. Marking window - matrices is sufficient because frame matrices - use the same glyph memory. */ - if (leaf && w->current_matrix) - { - mark_glyph_matrix (w->current_matrix); - mark_glyph_matrix (w->desired_matrix); - } + mark_glyph_matrix (w->current_matrix); + mark_glyph_matrix (w->desired_matrix); } } break; ------------------------------------------------------------ revno: 109897 committer: Katsumi Yamaoka branch nick: trunk timestamp: Thu 2012-09-06 02:20:21 +0000 message: [Gnus] XEmacs 21.5 compilation fix * gnus-score.el (gnus-score-decode-text-parts): Use #' for mm-text-parts used in labels macro to make it work with XEmacs 21.5. * gnus-util.el (gnus-string-prefix-p): New function, an alias to string-prefix-p in Emacs >=23.2. * nnmaildir.el (nnmaildir--ensure-suffix, nnmaildir--add-flag) (nnmaildir--remove-flag, nnmaildir--scan): Use gnus-string-match-p instead of string-match-p. (nnmaildir--scan): Use gnus-string-prefix-p instead of string-prefix-p. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2012-09-06 01:49:15 +0000 +++ lisp/gnus/ChangeLog 2012-09-06 02:20:21 +0000 @@ -1,3 +1,16 @@ +2012-09-06 Katsumi Yamaoka + + * gnus-score.el (gnus-score-decode-text-parts): Use #' for + mm-text-parts used in labels macro to make it work with XEmacs 21.5. + + * gnus-util.el (gnus-string-prefix-p): New function, an alias to + string-prefix-p in Emacs >=23.2. + + * nnmaildir.el (nnmaildir--ensure-suffix, nnmaildir--add-flag) + (nnmaildir--remove-flag, nnmaildir--scan): Use gnus-string-match-p + instead of string-match-p. + (nnmaildir--scan): Use gnus-string-prefix-p instead of string-prefix-p. + 2012-09-06 Kenichi Handa * qp.el (quoted-printable-decode-region): Fix previous change; handle === modified file 'lisp/gnus/gnus-score.el' --- lisp/gnus/gnus-score.el 2012-09-05 22:35:32 +0000 +++ lisp/gnus/gnus-score.el 2012-09-06 02:20:21 +0000 @@ -1720,7 +1720,7 @@ (defun gnus-score-decode-text-parts () (labels ((mm-text-parts (handle) (cond ((stringp (car handle)) - (let ((parts (mapcan 'mm-text-parts (cdr handle)))) + (let ((parts (mapcan #'mm-text-parts (cdr handle)))) (if (equal "multipart/alternative" (car handle)) ;; pick the first supported alternative (list (car parts)) @@ -1730,7 +1730,7 @@ (when (string-match "^text/" (mm-handle-media-type handle)) (list handle))) - (t (mapcan 'mm-text-parts handle)))) + (t (mapcan #'mm-text-parts handle)))) (my-mm-display-part (handle) (when handle (save-restriction === modified file 'lisp/gnus/gnus-util.el' --- lisp/gnus/gnus-util.el 2012-07-24 22:17:17 +0000 +++ lisp/gnus/gnus-util.el 2012-09-06 02:20:21 +0000 @@ -1926,6 +1926,15 @@ (save-match-data (string-match regexp string start)))) +(if (fboundp 'string-prefix-p) + (defalias 'gnus-string-prefix-p 'string-prefix-p) + (defun gnus-string-prefix-p (str1 str2 &optional ignore-case) + "Return non-nil if STR1 is a prefix of STR2. +If IGNORE-CASE is non-nil, the comparison is done without paying attention +to case differences." + (eq t (compare-strings str1 nil nil + str2 0 (length str1) ignore-case)))) + (eval-and-compile (if (fboundp 'macroexpand-all) (defalias 'gnus-macroexpand-all 'macroexpand-all) === modified file 'lisp/gnus/nnmaildir.el' --- lisp/gnus/nnmaildir.el 2012-09-05 22:45:43 +0000 +++ lisp/gnus/nnmaildir.el 2012-09-06 02:20:21 +0000 @@ -100,14 +100,14 @@ (defun nnmaildir--ensure-suffix (filename) "Ensure that FILENAME contains the suffix \":2,\"." - (if (string-match-p ":2," filename) + (if (gnus-string-match-p ":2," filename) filename (concat filename ":2,"))) (defun nnmaildir--add-flag (flag suffix) "Return a copy of SUFFIX where FLAG is set. SUFFIX should start with \":2,\"." - (unless (string-match-p "^:2," suffix) + (unless (gnus-string-match-p "^:2," suffix) (error "Invalid suffix `%s'" suffix)) (let* ((flags (substring suffix 3)) (flags-as-list (append flags nil)) @@ -120,7 +120,7 @@ (defun nnmaildir--remove-flag (flag suffix) "Return a copy of SUFFIX where FLAG is cleared. SUFFIX should start with \":2,\"." - (unless (string-match-p "^:2," suffix) + (unless (gnus-string-match-p "^:2," suffix) (error "Invalid suffix `%s'" suffix)) (let* ((flags (substring suffix 3)) (flags-as-list (append flags nil)) @@ -856,11 +856,11 @@ (when (or ;; first look for marks in suffix, if it's valid... (when (and (stringp suffix) - (string-prefix-p ":2," suffix)) + (gnus-string-prefix-p ":2," suffix)) (or - (not (string-match-p + (not (gnus-string-match-p (string (nnmaildir--mark-to-flag 'read)) suffix)) - (string-match-p + (gnus-string-match-p (string (nnmaildir--mark-to-flag 'tick)) suffix))) ;; then look in marks directories (not (file-exists-p (concat cdir prefix)))