------------------------------------------------------------ revno: 115628 committer: Chong Yidong branch nick: trunk timestamp: Fri 2013-12-20 15:12:04 +0800 message: Add/fix docs for add-face-text-property * doc/lispref/text.texi (Changing Properties): Improve documentation for add-face-text-property. (Special Properties): Mention add-face-text-property. * src/textprop.c (Fadd_face_text_property): Doc fix. Rename `appendp' argument to `append'. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2013-12-18 14:54:24 +0000 +++ doc/lispref/ChangeLog 2013-12-20 07:12:04 +0000 @@ -1,3 +1,9 @@ +2013-12-20 Chong Yidong + + * text.texi (Changing Properties): Improve documentation for + add-face-text-property. + (Special Properties): Mention add-face-text-property. + 2013-12-18 Chong Yidong * customize.texi (Custom Themes): Document custom-known-themes === modified file 'doc/lispref/text.texi' --- doc/lispref/text.texi 2013-09-13 08:26:03 +0000 +++ doc/lispref/text.texi 2013-12-20 07:12:04 +0000 @@ -2825,29 +2825,37 @@ @end defun @defun add-face-text-property start end face &optional appendp object -@code{face} text attributes can be combined. If you want to make a -section both italic and green, you can either define a new face that -have those attributes, or you can add both these attributes separately -to text: +This function acts on the text between @var{start} and @var{end}, +adding the face @var{face} to the @code{face} text property. +@var{face} should be a valid value for the @code{face} property +(@pxref{Special Properties}), such as a face name or an anonymous face +(@pxref{Faces}). + +If any text in the region already has a non-nil @code{face} property, +those face(s) are retained. This function sets the @code{face} +property to a list of faces, with @var{face} as the first element (by +default) and the pre-existing faces as the remaining elements. If the +optional argument @var{append} is non-@code{nil}, @var{face} is +appended to the end of the list instead. Note that in a face list, +the first occurring value for each attribute takes precedence. + +For example, the following code would assign a italicized green face +to the text between @var{start} and @var{end}: @example (add-face-text-property @var{start} @var{end} 'italic) -(add-face-text-property @var{start} @var{end} '(:foreground "#00ff00")) +(add-face-text-property @var{start} @var{end} '(:foreground "red")) +(add-face-text-property @var{start} @var{end} '(:foreground "green")) @end example -The attribute is (by default) prepended to the list of face -attributes, and the first attribute of the same type takes -precedence. So if you have two @code{:foreground} specifications, the -first one will take effect. - -If you pass in @var{appendp}, the attribute will be appended instead -of prepended, which means that it will have no effect if there is -already an attribute of the same type. - +The optional argument @var{object}, if non-@code{nil}, specifies a +buffer or string to act on, rather than the current buffer. If +@var{object} is a string, then @var{start} and @var{end} are +zero-based indices into the string. @end defun - The easiest way to make a string with text properties -is with @code{propertize}: + The easiest way to make a string with text properties is with +@code{propertize}: @defun propertize string &rest properties This function returns a copy of @var{string} which has the text @@ -3081,6 +3089,9 @@ dynamically updating the @code{face} property of characters based on the context. +The @code{add-face-text-property} function provides a convenient way +to set this text property. @xref{Changing Properties}. + @item font-lock-face @kindex font-lock-face @r{(text property)} This property specifies a value for the @code{face} property that Font === modified file 'etc/NEWS' --- etc/NEWS 2013-12-20 05:20:33 +0000 +++ etc/NEWS 2013-12-20 07:12:04 +0000 @@ -164,6 +164,7 @@ using the scroll bar (i.e. dragging the thumb down even when the end of the buffer is visible). ++++ ** New function `add-face-text-property' has been added, which can be used to conveniently prepend/append new face attributes to text. === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-19 19:06:53 +0000 +++ src/ChangeLog 2013-12-20 07:12:04 +0000 @@ -1,3 +1,8 @@ +2013-12-20 Chong Yidong + + * textprop.c (Fadd_face_text_property): Doc fix. Rename `appendp' + argument to `append'. + 2013-12-19 Eli Zaretskii * xdisp.c (extend_face_to_end_of_line): Use default face, not the === modified file 'src/textprop.c' --- src/textprop.c 2013-11-25 17:30:09 +0000 +++ src/textprop.c 2013-12-20 07:12:04 +0000 @@ -1338,20 +1338,27 @@ DEFUN ("add-face-text-property", Fadd_face_text_property, Sadd_face_text_property, 3, 5, 0, doc: /* Add the face property to the text from START to END. -The third argument FACE specifies the face to add. -If any text in the region already has any face properties, this new -face property will be added to the front of the face property list. -If the optional fourth argument APPENDP is non-nil, append to the end -of the face property list instead. -If the optional fifth argument OBJECT is a buffer (or nil, which means -the current buffer), START and END are buffer positions (integers or +FACE specifies the face to add. It should be a valid value of the +`face' property (typically a face name or a plist of face attributes +and values). + +If any text in the region already has a non-nil `face' property, those +face(s) are retained. This is done by setting the `face' property to +a list of faces, with FACE as the first element (by default) and the +pre-existing faces as the remaining elements. + +If optional fourth argument APPEND is non-nil, append FACE to the end +of the face list instead. + +If optional fifth argument OBJECT is a buffer (or nil, which means the +current buffer), START and END are buffer positions (integers or markers). If OBJECT is a string, START and END are 0-based indices into it. */) (Lisp_Object start, Lisp_Object end, Lisp_Object face, - Lisp_Object appendp, Lisp_Object object) + Lisp_Object append, Lisp_Object object) { add_text_properties_1 (start, end, list2 (Qface, face), object, - (NILP (appendp) + (NILP (append) ? TEXT_PROPERTY_PREPEND : TEXT_PROPERTY_APPEND)); return Qnil; ------------------------------------------------------------ revno: 115627 fixes bug: http://debbugs.gnu.org/16010 author: Vitalie Spinu committer: Chong Yidong branch nick: trunk timestamp: Fri 2013-12-20 14:25:19 +0800 message: comint.el (comint-output-filter): Fix rear-nonsticky property placement. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 06:11:00 +0000 +++ lisp/ChangeLog 2013-12-20 06:25:19 +0000 @@ -1,3 +1,8 @@ +2013-12-20 Vitalie Spinu + + * comint.el (comint-output-filter): Fix rear-nonsticky property + placement (Bug#16010). + 2013-12-20 Chong Yidong * faces.el (read-color): Minor fix for completion function. === modified file 'lisp/comint.el' --- lisp/comint.el 2013-12-18 03:02:39 +0000 +++ lisp/comint.el 2013-12-20 06:25:19 +0000 @@ -2062,23 +2062,22 @@ (let ((prompt-start (save-excursion (forward-line 0) (point))) (inhibit-read-only t)) (when comint-prompt-read-only - (with-silent-modifications - (or (= (point-min) prompt-start) - (get-text-property (1- prompt-start) 'read-only) - (put-text-property - (1- prompt-start) prompt-start 'read-only 'fence)) - (add-text-properties - prompt-start (point) - '(read-only t rear-nonsticky t front-sticky (read-only))))) + (with-silent-modifications + (or (= (point-min) prompt-start) + (get-text-property (1- prompt-start) 'read-only) + (put-text-property (1- prompt-start) + prompt-start 'read-only 'fence)) + (add-text-properties prompt-start (point) + '(read-only t front-sticky (read-only))))) (when comint-last-prompt (remove-text-properties (car comint-last-prompt) (cdr comint-last-prompt) '(font-lock-face))) (setq comint-last-prompt (cons (copy-marker prompt-start) (point-marker))) - (add-text-properties (car comint-last-prompt) - (cdr comint-last-prompt) - '(font-lock-face comint-highlight-prompt))) + (add-text-properties prompt-start (point) + '(rear-nonsticky t + font-lock-face comint-highlight-prompt))) (goto-char saved-point))))))) (defun comint-preinput-scroll-to-bottom () ------------------------------------------------------------ revno: 115626 committer: Chong Yidong branch nick: trunk timestamp: Fri 2013-12-20 14:11:00 +0800 message: * faces.el (read-color): Minor fix for completion function. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 05:20:33 +0000 +++ lisp/ChangeLog 2013-12-20 06:11:00 +0000 @@ -1,3 +1,7 @@ +2013-12-20 Chong Yidong + + * faces.el (read-color): Minor fix for completion function. + 2013-12-20 Dmitry Gutov * progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): New === modified file 'lisp/faces.el' --- lisp/faces.el 2013-12-13 04:14:17 +0000 +++ lisp/faces.el 2013-12-20 06:11:00 +0000 @@ -1836,7 +1836,7 @@ (if (color-defined-p string) (list string)))) ((eq flag 'lambda) ; Test completion. - (or (memq string colors) + (or (member string colors) (color-defined-p string))))) nil t))) ------------------------------------------------------------ revno: 115625 committer: Katsumi Yamaoka branch nick: trunk timestamp: Fri 2013-12-20 05:53:04 +0000 message: lisp/gnus/gnus-spec.el (gnus-tmp-article-number): Remove duplicate defvar diff: === modified file 'lisp/gnus/gnus-spec.el' --- lisp/gnus/gnus-spec.el 2013-09-13 07:28:16 +0000 +++ lisp/gnus/gnus-spec.el 2013-12-20 05:53:04 +0000 @@ -81,7 +81,6 @@ (defvar gnus-tmp-unread-and-unselected) (defvar gnus-tmp-news-method) (defvar gnus-tmp-news-server) -(defvar gnus-tmp-article-number) (defvar gnus-mouse-face) (defvar gnus-mouse-face-prop) (defvar gnus-tmp-header) ------------------------------------------------------------ revno: 115624 fixes bug: http://debbugs.gnu.org/16182 committer: Dmitry Gutov branch nick: trunk timestamp: Fri 2013-12-20 07:20:33 +0200 message: * lisp/progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): New option. (ruby-smie--indent-to-stmt-p): Use it. (ruby-smie-rules): Revert the logic in the handling of `when'. Expand the `begin' clause to handle `ruby-align-to-stmt-keywords'. (ruby-deep-arglist, ruby-deep-indent-paren) (ruby-deep-indent-paren-style): Update docstrings to note that the vars don't have any effect with SMIE. * test/automated/ruby-mode-tests.el: Add tests for `ruby-align-to-stmt-keywords'. * test/indent/ruby.rb: Update examples to reflect the lack of change in default indentation of `begin' blocks. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-12-19 21:02:46 +0000 +++ etc/NEWS 2013-12-20 05:20:33 +0000 @@ -714,6 +714,8 @@ *** Add more Ruby file types to `auto-mode-alist'. +*** New option `ruby-align-to-stmt-keywords'. + ** JS Mode *** Better indentation of multiple-variable declarations. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 04:53:24 +0000 +++ lisp/ChangeLog 2013-12-20 05:20:33 +0000 @@ -1,3 +1,14 @@ +2013-12-20 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-align-to-stmt-keywords): New + option. (Bug#16182) + (ruby-smie--indent-to-stmt-p): Use it. + (ruby-smie-rules): Revert the logic in the handling of `when'. + Expand the begin clause to handle `ruby-align-to-stmt-keywords'. + (ruby-deep-arglist, ruby-deep-indent-paren) + (ruby-deep-indent-paren-style): Update docstrings to note that the + vars don't have any effect with SMIE. + 2013-12-20 Jay Belanger * calc/calc.el (calc-enter, calc-pop): Use the variable === modified file 'lisp/progmodes/ruby-mode.el' --- lisp/progmodes/ruby-mode.el 2013-12-19 05:06:24 +0000 +++ lisp/progmodes/ruby-mode.el 2013-12-20 05:20:33 +0000 @@ -226,9 +226,48 @@ :group 'ruby :safe 'integerp) +(defcustom ruby-align-to-stmt-keywords nil + "Keywords to align their expression body to statement. +When nil, an expression that begins with one these keywords is +indented to the column of the keyword. Example: + + tee = if foo + bar + else + qux + end + +If this value is t or contains a symbol with the name of given +keyword, the expression is indented to align to the beginning of +the statement: + + tee = if foo + bar + else + qux + end + +Only has effect when `ruby-use-smie' is t. +" + :type '(choice + (const :tag "None" nil) + (const :tag "All" t) + (repeat :tag "User defined" + (choice (const if) + (const while) + (const unless) + (const until) + (const begin) + (const case) + (const for)))) + :group 'ruby + :safe 'listp + :version "24.4") + (defcustom ruby-deep-arglist t "Deep indent lists in parenthesis when non-nil. -Also ignores spaces after parenthesis when 'space." +Also ignores spaces after parenthesis when `space'. +Only has effect when `ruby-use-smie' is nil." :type 'boolean :group 'ruby :safe 'booleanp) @@ -236,11 +275,13 @@ (defcustom ruby-deep-indent-paren '(?\( ?\[ ?\] t) "Deep indent lists in parenthesis when non-nil. The value t means continuous line. -Also ignores spaces after parenthesis when 'space." +Also ignores spaces after parenthesis when `space'. +Only has effect when `ruby-use-smie' is nil." :group 'ruby) (defcustom ruby-deep-indent-paren-style 'space - "Default deep indent style." + "Default deep indent style. +Only has effect when `ruby-use-smie' is nil." :options '(t nil space) :group 'ruby) (defcustom ruby-encoding-map @@ -520,6 +561,10 @@ (smie-backward-sexp ";") (cons 'column (smie-indent-virtual)))) +(defun ruby-smie--indent-to-stmt-p (keyword) + (or (eq t ruby-align-to-stmt-keywords) + (memq (intern keyword) ruby-align-to-stmt-keywords))) + (defun ruby-smie-rules (kind token) (pcase (cons kind token) (`(:elem . basic) ruby-indent-level) @@ -572,7 +617,9 @@ (`(:before . ,(or `"else" `"then" `"elsif" `"rescue" `"ensure")) (smie-rule-parent)) (`(:before . "when") - (if (not (smie-rule-sibling-p)) 0)) ;; ruby-indent-level + ;; Align to the previous `when', but look up the virtual + ;; indentation of `case'. + (if (smie-rule-sibling-p) 0 (smie-rule-parent))) (`(:after . ,(or "=" "iuwu-mod" "+" "-" "*" "/" "&&" "||" "%" "**" "^" "&" "<=>" ">" "<" ">=" "<=" "==" "===" "!=" "<<" ">>" "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" "|" @@ -581,9 +628,11 @@ (smie-indent--hanging-p) ruby-indent-level)) (`(:after . ,(or "?" ":")) ruby-indent-level) - (`(:before . "begin") - (unless (save-excursion (skip-chars-backward " \t") (bolp)) - (smie-rule-parent))) + (`(:before . ,(or "if" "while" "unless" "until" "begin" "case" "for")) + (when (not (save-excursion (skip-chars-backward " \t") (bolp))) + (if (ruby-smie--indent-to-stmt-p token) + (ruby-smie--indent-to-stmt) + (cons 'column (current-column))))) )) (defun ruby-imenu-create-index-in-block (prefix beg end) === modified file 'test/ChangeLog' --- test/ChangeLog 2013-12-17 01:31:55 +0000 +++ test/ChangeLog 2013-12-20 05:20:33 +0000 @@ -1,3 +1,11 @@ +2013-12-20 Dmitry Gutov + + * automated/ruby-mode-tests.el: Add tests for + `ruby-align-to-stmt-keywords'. + + * indent/ruby.rb: Update examples to reflect the lack of change in + default indentation of `begin' blocks. + 2013-12-17 Dmitry Gutov * indent/ruby.rb: Update examples according to the change === modified file 'test/automated/ruby-mode-tests.el' --- test/automated/ruby-mode-tests.el 2013-12-06 04:22:08 +0000 +++ test/automated/ruby-mode-tests.el 2013-12-20 05:20:33 +0000 @@ -282,6 +282,57 @@ | 3) |"))) +(ert-deftest ruby-align-to-stmt-keywords-t () + (let ((ruby-align-to-stmt-keywords t)) + (ruby-should-indent-buffer + "foo = if bar? + | 1 + |else + | 2 + |end + | + |foo || begin + | bar + |end + | + |foo || + | begin + | bar + | end + |" + "foo = if bar? + | 1 + |else + | 2 + | end + | + | foo || begin + | bar + |end + | + | foo || + | begin + |bar + | end + |") + )) + +(ert-deftest ruby-align-to-stmt-keywords-case () + (let ((ruby-align-to-stmt-keywords '(case))) + (ruby-should-indent-buffer + "b = case a + |when 13 + | 6 + |else + | 42 + |end" + "b = case a + | when 13 + | 6 + | else + | 42 + | end"))) + (ert-deftest ruby-move-to-block-stops-at-indentation () (ruby-with-temp-buffer "def f\nend" (beginning-of-line) === modified file 'test/indent/ruby.rb' --- test/indent/ruby.rb 2013-12-19 05:06:24 +0000 +++ test/indent/ruby.rb 2013-12-20 05:20:33 +0000 @@ -114,17 +114,17 @@ puts "there" end - case a - when "a" - 6 - # Support for this syntax was removed in Ruby 1.9, so we - # probably don't need to handle it either. - # when "b" : - # 7 - # when "c" : 2 - when "d" then 4 - else 5 - end + b = case a + when "a" + 6 + # Support for this syntax was removed in Ruby 1.9, so we + # probably don't need to handle it either. + # when "b" : + # 7 + # when "c" : 2 + when "d" then 4 + else 5 + end end # Some Cucumber code: @@ -321,18 +321,13 @@ foo | bar -foo || - begin - bar - end - def qux foo ||= begin - bar - tee - rescue - oomph - end + bar + tee + rescue + oomph + end end %^abc^ ------------------------------------------------------------ revno: 115623 committer: Jay Belanger branch nick: trunk timestamp: Thu 2013-12-19 22:53:24 -0600 message: lisp/calc/calc.el (calc-enter, calc-pop): Use the variable `calc-context-sensitive-enter'. doc/misc/calc.texi (Stack Manipulation Commands): Mention using the variable `calc-context-sensitive-enter' for `calc-enter' and `calc-pop'. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2013-12-12 09:57:56 +0000 +++ doc/misc/ChangeLog 2013-12-20 04:53:24 +0000 @@ -1,3 +1,8 @@ +2013-12-20 Jay Belanger + + * calc.texi (Stack Manipulation Commands): Mention using the variable + `calc-context-sensitive-enter' for `calc-enter' and `calc-pop'. + 2013-12-12 Michael Albinus * tramp.texi (direntry): Use ssh but rsh. === modified file 'doc/misc/calc.texi' --- doc/misc/calc.texi 2013-11-17 04:22:24 +0000 +++ doc/misc/calc.texi 2013-12-20 04:53:24 +0000 @@ -11801,6 +11801,18 @@ leaving the first, third, fourth, and so on; @kbd{M-3 M-@key{DEL}} deletes the third stack element. +The above commands do not depend on the location of the cursor. +If the customizable variable @code{calc-context-sensitive-enter} is +non-@code{nil} (@pxref{Customizing Calc}), these commands will become +context sensitive. For example, instead of duplicating the top of the stack, +@key{RET} will copy the element at the cursor to the top of the +stack. With a positive numeric prefix, a copy of the element at the +cursor and the appropriate number of preceding elements will be placed +at the top of the stack. A negative prefix will still duplicate the +specified element of the stack regardless of the cursor position. +Similarly, @key{DEL} will remove the corresponding elements from the +stack. + @kindex @key{TAB} @pindex calc-roll-down To exchange the top two elements of the stack, press @key{TAB} @@ -35697,11 +35709,13 @@ @end defvar @defvar calc-context-sensitive-enter -The command @code{calc-enter} will typically duplicate the top of the -stack. If @code{calc-context-sensitive-enter} is non-@code{nil}, -then the @code{calc-enter} will copy the element at the cursor to the -top of the stack. The default value of -@code{calc-context-sensitive-enter} is @code{nil}. +The commands @code{calc-enter} and @code{calc-pop} will typically +duplicate the top of the stack. If +@code{calc-context-sensitive-enter} is non-@code{nil}, then the +@code{calc-enter} will copy the element at the cursor to the +top of the stack and @code{calc-pop} will delete the element at the +cursor. The default value of @code{calc-context-sensitive-enter} is +@code{nil}. @end defvar @defvar calc-undo-length === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 04:29:08 +0000 +++ lisp/ChangeLog 2013-12-20 04:53:24 +0000 @@ -1,3 +1,8 @@ +2013-12-20 Jay Belanger + + * calc/calc.el (calc-enter, calc-pop): Use the variable + `calc-context-sensitive-enter'. + 2013-12-20 Lars Magne Ingebrigtsen * net/shr.el (shr-insert): Protect against infloops in degenerate === modified file 'lisp/calc/calc.el' --- lisp/calc/calc.el 2013-11-17 04:22:24 +0000 +++ lisp/calc/calc.el 2013-12-20 04:53:24 +0000 @@ -429,7 +429,8 @@ (defcustom calc-context-sensitive-enter nil - "If non-nil, the stack element under the cursor will be copied by `calc-enter'." + "If non-nil, the stack element under the cursor will be copied by `calc-enter' +and deleted by `calc-pop'." :group 'calc :version "24.4" :type 'boolean) @@ -2259,41 +2260,47 @@ (defun calc-enter (n) (interactive "p") - (calc-wrapper - (cond ((< n 0) - (calc-push-list (calc-top-list 1 (- n)))) - ((= n 0) - (calc-push-list (calc-top-list (calc-stack-size)))) - (t - (if (not calc-context-sensitive-enter) - (calc-push-list (calc-top-list n)) - (let ((num (max 1 (calc-locate-cursor-element (point))))) - (calc-push-list (calc-top-list n num)))))))) + (let ((num (if calc-context-sensitive-enter (max 1 (calc-locate-cursor-element (point)))))) + (calc-wrapper + (cond ((< n 0) + (calc-push-list (calc-top-list 1 (- n)))) + ((= n 0) + (calc-push-list (calc-top-list (calc-stack-size)))) + (num + (calc-push-list (calc-top-list n num))) + (t + (calc-push-list (calc-top-list n))))) + (if (and calc-context-sensitive-enter (> n 0)) (calc-cursor-stack-index (+ num n))))) (defun calc-pop (n) (interactive "P") - (calc-wrapper - (let* ((nn (prefix-numeric-value n)) - (top (and (null n) (calc-top 1)))) - (cond ((and (null n) - (eq (car-safe top) 'incomplete) - (> (length top) (if (eq (nth 1 top) 'intv) 3 2))) - (calc-pop-push-list 1 (let ((tt (copy-sequence top))) - (setcdr (nthcdr (- (length tt) 2) tt) nil) - (list tt)))) - ((< nn 0) - (if (and calc-any-selections - (calc-top-selected 1 (- nn))) - (calc-delete-selection (- nn)) - (calc-pop-stack 1 (- nn) t))) - ((= nn 0) - (calc-pop-stack (calc-stack-size) 1 t)) - (t - (if (and calc-any-selections - (= nn 1) - (calc-top-selected 1 1)) - (calc-delete-selection 1) - (calc-pop-stack nn))))))) + (let ((num (if calc-context-sensitive-enter (max 1 (calc-locate-cursor-element (point)))))) + (calc-wrapper + (let* ((nn (prefix-numeric-value n)) + (top (and (null n) (calc-top 1)))) + (cond ((and calc-context-sensitive-enter (> num 1)) + (calc-pop-stack nn num)) + ((and (null n) + (eq (car-safe top) 'incomplete) + (> (length top) (if (eq (nth 1 top) 'intv) 3 2))) + (calc-pop-push-list 1 (let ((tt (copy-sequence top))) + (setcdr (nthcdr (- (length tt) 2) tt) nil) + (list tt)))) + ((< nn 0) + (if (and calc-any-selections + (calc-top-selected 1 (- nn))) + (calc-delete-selection (- nn)) + (calc-pop-stack 1 (- nn) t))) + ((= nn 0) + (calc-pop-stack (calc-stack-size) 1 t)) + (t + (if (and calc-any-selections + (= nn 1) + (calc-top-selected 1 1)) + (calc-delete-selection 1) + (calc-pop-stack nn)))))) + (if calc-context-sensitive-enter (calc-cursor-stack-index (1- num))))) + ------------------------------------------------------------ revno: 115622 committer: Lars Magne Ingebrigtsen branch nick: trunk timestamp: Fri 2013-12-20 05:29:08 +0100 message: * net/shr.el (shr-insert): Protect against infloops in degenerate tables. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 01:50:46 +0000 +++ lisp/ChangeLog 2013-12-20 04:29:08 +0000 @@ -1,3 +1,8 @@ +2013-12-20 Lars Magne Ingebrigtsen + + * net/shr.el (shr-insert): Protect against infloops in degenerate + tables. + 2013-12-20 Rüdiger Sonderfeld * progmodes/octave.el (octave): Add link to manual and octave === modified file 'lisp/net/shr.el' --- lisp/net/shr.el 2013-12-17 02:48:06 +0000 +++ lisp/net/shr.el 2013-12-20 04:29:08 +0000 @@ -461,6 +461,7 @@ (setq shr-state nil) (let (found) (while (and (> (current-column) shr-width) + (> shr-width 0) (progn (setq found (shr-find-fill-point)) (not (eolp)))) ------------------------------------------------------------ revno: 115621 committer: Rüdiger Sonderfeld branch nick: trunk timestamp: Fri 2013-12-20 02:50:46 +0100 message: octave-mode: Link to manual. * lisp/progmodes/octave.el (octave): Add link to manual and octave homepage. (octave-mode-menu): Link to octave-mode manual. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 00:38:02 +0000 +++ lisp/ChangeLog 2013-12-20 01:50:46 +0000 @@ -1,3 +1,9 @@ +2013-12-20 Rüdiger Sonderfeld + + * progmodes/octave.el (octave): Add link to manual and octave + homepage. + (octave-mode-menu): Link to octave-mode manual. + 2013-12-20 Leo Liu * skeleton.el (skeleton-pair-insert-maybe): Disable newline === modified file 'lisp/progmodes/octave.el' --- lisp/progmodes/octave.el 2013-12-11 13:50:46 +0000 +++ lisp/progmodes/octave.el 2013-12-20 01:50:46 +0000 @@ -49,6 +49,8 @@ (defgroup octave nil "Editing Octave code." + :link '(custom-manual "(octave-mode)Top") + :link '(url-link "http://www.gnu.org/s/octave") :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces) :group 'languages) @@ -180,6 +182,7 @@ ["Hide Process Buffer" octave-hide-process-buffer t] ["Kill Process" octave-kill-process t]) "---" + ["Octave Mode Manual" (info "(octave-mode)Top") t] ["Customize Octave" (customize-group 'octave) t] ["Submit Bug Report" report-emacs-bug t])) ------------------------------------------------------------ revno: 115620 fixes bug: http://debbugs.gnu.org/16138 committer: Leo Liu branch nick: trunk timestamp: Fri 2013-12-20 08:38:02 +0800 message: * skeleton.el (skeleton-pair-insert-maybe): Disable newline insertion using skeleton-end-newline. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-20 00:07:08 +0000 +++ lisp/ChangeLog 2013-12-20 00:38:02 +0000 @@ -1,3 +1,8 @@ +2013-12-20 Leo Liu + + * skeleton.el (skeleton-pair-insert-maybe): Disable newline + insertion using skeleton-end-newline. (Bug#16138) + 2013-12-20 Juri Linkov * replace.el (occur-engine): Use `add-face-text-property' === modified file 'lisp/skeleton.el' --- lisp/skeleton.el 2013-10-17 04:51:05 +0000 +++ lisp/skeleton.el 2013-12-20 00:38:02 +0000 @@ -509,7 +509,6 @@ (let* ((mark (and skeleton-autowrap (or (eq last-command 'mouse-drag-region) (and transient-mark-mode mark-active)))) - (skeleton-end-hook) (char last-command-event) (skeleton (or (assq char skeleton-pair-alist) (assq char skeleton-pair-default-alist) @@ -520,7 +519,9 @@ (if (not skeleton-pair-on-word) (looking-at "\\w")) (funcall skeleton-pair-filter-function)))) (self-insert-command (prefix-numeric-value arg)) - (skeleton-insert (cons nil skeleton) (if mark -1)))))) + ;; Newlines not desirable for inserting pairs. See bug#16138. + (let ((skeleton-end-newline nil)) + (skeleton-insert (cons nil skeleton) (if mark -1))))))) ;; A more serious example can be found in sh-script.el ------------------------------------------------------------ revno: 115619 fixes bug: http://debbugs.gnu.org/14645 committer: Juri Linkov branch nick: trunk timestamp: Fri 2013-12-20 02:07:08 +0200 message: * lisp/replace.el (occur-engine): Use `add-face-text-property' to add the face property to matches and titles. * lisp/hi-lock.el (hi-green): Use lighter color "light green" closer to the palette of other hi-lock colors. (hi-lock-set-pattern): Prepend hi-lock face to the existing face. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 22:12:12 +0000 +++ lisp/ChangeLog 2013-12-20 00:07:08 +0000 @@ -1,3 +1,12 @@ +2013-12-20 Juri Linkov + + * replace.el (occur-engine): Use `add-face-text-property' + to add the face property to matches and titles. (Bug#14645) + + * hi-lock.el (hi-green): Use lighter color "light green" closer to + the palette of other hi-lock colors. + (hi-lock-set-pattern): Prepend hi-lock face to the existing face. + 2013-12-19 Juri Linkov * isearch.el (isearch-mode-map): Bind `M-s e' to `isearch-edit-string'. === modified file 'lisp/hi-lock.el' --- lisp/hi-lock.el 2013-06-03 08:51:50 +0000 +++ lisp/hi-lock.el 2013-12-20 00:07:08 +0000 @@ -164,9 +164,9 @@ (defface hi-green '((((min-colors 88) (background dark)) - (:background "green1" :foreground "black")) + (:background "light green" :foreground "black")) (((background dark)) (:background "green" :foreground "black")) - (((min-colors 88)) (:background "green1")) + (((min-colors 88)) (:background "light green")) (t (:background "green"))) "Face for hi-lock mode." :group 'hi-lock-faces) @@ -715,7 +715,7 @@ "Highlight REGEXP with face FACE." ;; Hashcons the regexp, so it can be passed to remove-overlays later. (setq regexp (hi-lock--hashcons regexp)) - (let ((pattern (list regexp (list 0 (list 'quote face) t)))) + (let ((pattern (list regexp (list 0 (list 'quote face) 'prepend)))) ;; Refuse to highlight a text that is already highlighted. (unless (assoc regexp hi-lock-interactive-patterns) (push pattern hi-lock-interactive-patterns) === modified file 'lisp/replace.el' --- lisp/replace.el 2013-12-19 00:29:41 +0000 +++ lisp/replace.el 2013-12-20 00:07:08 +0000 @@ -1471,13 +1471,12 @@ (setq matches (1+ matches)) (add-text-properties (match-beginning 0) (match-end 0) - (append - `(occur-match t) - (when match-face - ;; Use `face' rather than `font-lock-face' here - ;; so as to override faces copied from the buffer. - `(face ,match-face))) - curstring) + '(occur-match t) curstring) + (when match-face + ;; Add `match-face' to faces copied from the buffer. + (add-face-text-property + (match-beginning 0) (match-end 0) + match-face nil curstring)) ;; Avoid infloop (Bug#7593). (let ((end (match-end 0))) (setq start (if (= start end) (1+ start) end))))) @@ -1572,11 +1571,9 @@ (buffer-name buf)) 'read-only t)) (setq end (point)) - (add-text-properties beg end - (append - (when title-face - `(font-lock-face ,title-face)) - `(occur-title ,buf)))) + (add-text-properties beg end `(occur-title ,buf)) + (when title-face + (add-face-text-property beg end title-face))) (goto-char (point-min))))))) ;; Display total match count and regexp for multi-buffer. (when (and (not (zerop global-lines)) (> (length buffers) 1)) @@ -1592,8 +1589,8 @@ global-lines (if (= global-lines 1) "" "s"))) (query-replace-descr regexp))) (setq end (point)) - (add-text-properties beg end (when title-face - `(font-lock-face ,title-face)))) + (when title-face + (add-face-text-property beg end title-face))) (goto-char (point-min))) (if coding ;; CODING is buffer-file-coding-system of the first buffer ------------------------------------------------------------ revno: 115618 fixes bug: http://debbugs.gnu.org/16035 committer: Juri Linkov branch nick: trunk timestamp: Fri 2013-12-20 00:12:12 +0200 message: * lisp/isearch.el (isearch-mode-map): Bind `M-s e' to `isearch-edit-string'. Put :advertised-binding on `M-s c', `M-s r', `M-s e'. (Bug#16035) (minibuffer-history-symbol): Move variable declaration closer to its usage. * lisp/isearchb.el (isearchb): Add `event-basic-type' on `last-command-event'. (Bug#14785) * lisp/gnus/gnus.el (gnus-suppress-keymap): * lisp/gnus/gnus-art.el (gnus-article-mode-map): * lisp/gnus/gnus-group.el (gnus-group-mode-map): * lisp/gnus/gnus-sum.el (gnus-summary-mode-map, gnus-summary-backend-map): Remove [backspace] key binding because it shadows DEL (bug#16035). * lisp/gnus/mm-decode.el (mm-viewer-completion-map): Remove duplicate definition. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 21:10:41 +0000 +++ lisp/ChangeLog 2013-12-19 22:12:12 +0000 @@ -1,5 +1,15 @@ 2013-12-19 Juri Linkov + * isearch.el (isearch-mode-map): Bind `M-s e' to `isearch-edit-string'. + Put :advertised-binding on `M-s c', `M-s r', `M-s e'. (Bug#16035) + (minibuffer-history-symbol): Move variable declaration closer to + its usage. + + * isearchb.el (isearchb): Add `event-basic-type' on `last-command-event'. + (Bug#14785) + +2013-12-19 Juri Linkov + * vc/log-edit.el (log-edit-insert-filenames-without-changelog): New function. (log-edit-hook): Add it to :options. (Bug#16170) === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2013-12-19 04:48:52 +0000 +++ lisp/gnus/ChangeLog 2013-12-19 22:12:12 +0000 @@ -1,3 +1,13 @@ +2013-12-19 Juri Linkov + + * gnus.el (gnus-suppress-keymap): + * gnus-art.el (gnus-article-mode-map): + * gnus-group.el (gnus-group-mode-map): + * gnus-sum.el (gnus-summary-mode-map, gnus-summary-backend-map): + Remove [backspace] key binding because it shadows DEL (bug#16035). + + * mm-decode.el (mm-viewer-completion-map): Remove duplicate definition. + 2013-12-19 Katsumi Yamaoka * gnus-uu.el (gnus-uu-decode-binhex, gnus-uu-decode-binhex-view): === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2013-11-27 06:39:37 +0000 +++ lisp/gnus/gnus-art.el 2013-12-19 22:12:12 +0000 @@ -4395,7 +4395,6 @@ [?\S-\ ] gnus-article-goto-prev-page "\177" gnus-article-goto-prev-page [delete] gnus-article-goto-prev-page - [backspace] gnus-article-goto-prev-page "\C-c^" gnus-article-refer-article "h" gnus-article-show-summary "s" gnus-article-show-summary === modified file 'lisp/gnus/gnus-group.el' --- lisp/gnus/gnus-group.el 2013-10-30 06:34:26 +0000 +++ lisp/gnus/gnus-group.el 2013-12-19 22:12:12 +0000 @@ -571,7 +571,6 @@ "p" gnus-group-prev-unread-group "\177" gnus-group-prev-unread-group [delete] gnus-group-prev-unread-group - [backspace] gnus-group-prev-unread-group "N" gnus-group-next-group "P" gnus-group-prev-group "\M-n" gnus-group-next-unread-group-same-level === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2013-09-17 17:22:32 +0000 +++ lisp/gnus/gnus-sum.el 2013-12-19 22:12:12 +0000 @@ -1850,7 +1850,6 @@ [?\S-\ ] gnus-summary-prev-page "\177" gnus-summary-prev-page [delete] gnus-summary-prev-page - [backspace] gnus-summary-prev-page "\r" gnus-summary-scroll-up "\M-\r" gnus-summary-scroll-down "n" gnus-summary-next-unread-article @@ -2222,7 +2221,6 @@ "\M-\C-e" gnus-summary-expire-articles-now "\177" gnus-summary-delete-article [delete] gnus-summary-delete-article - [backspace] gnus-summary-delete-article "m" gnus-summary-move-article "r" gnus-summary-respool-article "w" gnus-summary-edit-article === modified file 'lisp/gnus/gnus.el' --- lisp/gnus/gnus.el 2013-08-13 07:18:50 +0000 +++ lisp/gnus/gnus.el 2013-12-19 22:12:12 +0000 @@ -3035,7 +3035,7 @@ (defun gnus-suppress-keymap (keymap) (suppress-keymap keymap) - (let ((keys `([backspace] [delete] "\177" "\M-u"))) ;gnus-mouse-2 + (let ((keys `([delete] "\177" "\M-u"))) ;gnus-mouse-2 (while keys (define-key keymap (pop keys) 'undefined)))) === modified file 'lisp/gnus/mm-decode.el' --- lisp/gnus/mm-decode.el 2013-10-23 03:35:49 +0000 +++ lisp/gnus/mm-decode.el 2013-12-19 22:12:12 +0000 @@ -538,14 +538,6 @@ map) "Keymap for input viewer with completion.") -(defvar mm-viewer-completion-map - (let ((map (make-sparse-keymap 'mm-viewer-completion-map))) - (set-keymap-parent map minibuffer-local-completion-map) - ;; Should we bind other key to minibuffer-complete-word? - (define-key map " " 'self-insert-command) - map) - "Keymap for input viewer with completion.") - ;;; The functions. (defun mm-alist-to-plist (alist) === modified file 'lisp/isearch.el' --- lisp/isearch.el 2013-12-19 00:29:41 +0000 +++ lisp/isearch.el 2013-12-19 22:12:12 +0000 @@ -500,6 +500,11 @@ (define-key map "\M-r" 'isearch-toggle-regexp) (define-key map "\M-e" 'isearch-edit-string) + (put 'isearch-toggle-case-fold :advertised-binding "\M-sc") + (put 'isearch-toggle-regexp :advertised-binding "\M-sr") + (put 'isearch-edit-string :advertised-binding "\M-se") + + (define-key map "\M-se" 'isearch-edit-string) (define-key map "\M-sc" 'isearch-toggle-case-fold) (define-key map "\M-si" 'isearch-toggle-invisible) (define-key map "\M-sr" 'isearch-toggle-regexp) @@ -1146,8 +1151,6 @@ (isearch-done) (isearch-clean-overlays)) -(defvar minibuffer-history-symbol) ;; from external package gmhist.el - (defun isearch-fail-pos (&optional msg) "Return position of first mismatch in search string, or nil if none. If MSG is non-nil, use variable `isearch-message', otherwise `isearch-string'." @@ -1300,6 +1303,8 @@ (isearch-abort) ;; outside of let to restore outside global values ))) +(defvar minibuffer-history-symbol) ;; from external package gmhist.el + (defun isearch-edit-string () "Edit the search string in the minibuffer. The following additional command keys are active while editing. === modified file 'lisp/isearchb.el' --- lisp/isearchb.el 2013-01-01 09:11:05 +0000 +++ lisp/isearchb.el 2013-12-19 22:12:12 +0000 @@ -139,7 +139,8 @@ (if last-command-event (setq iswitchb-rescan t iswitchb-text (concat iswitchb-text - (char-to-string last-command-event)))) + (char-to-string + (event-basic-type last-command-event))))) (iswitchb-set-matches) (let* ((match (car iswitchb-matches)) (buf (and match (get-buffer match)))) ------------------------------------------------------------ revno: 115617 fixes bug: http://debbugs.gnu.org/16170 committer: Juri Linkov branch nick: trunk timestamp: Thu 2013-12-19 23:10:41 +0200 message: * lisp/vc/log-edit.el (log-edit-insert-filenames-without-changelog): New function. (log-edit-hook): Add it to :options. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 21:02:46 +0000 +++ lisp/ChangeLog 2013-12-19 21:10:41 +0000 @@ -1,5 +1,11 @@ 2013-12-19 Juri Linkov + * vc/log-edit.el (log-edit-insert-filenames-without-changelog): + New function. + (log-edit-hook): Add it to :options. (Bug#16170) + +2013-12-19 Juri Linkov + * simple.el (eval-expression-print-format): Don't check for command names and the last command. Always display additional formats of the integer result in the echo area, and insert them === modified file 'lisp/vc/log-edit.el' --- lisp/vc/log-edit.el 2013-12-18 23:51:45 +0000 +++ lisp/vc/log-edit.el 2013-12-19 21:10:41 +0000 @@ -137,6 +137,7 @@ log-edit-insert-cvs-template log-edit-insert-changelog log-edit-insert-filenames + log-edit-insert-filenames-without-changelog log-edit-show-files))) (defcustom log-edit-mode-hook (if (boundp 'vc-log-mode-hook) vc-log-mode-hook) @@ -664,6 +665,21 @@ (insert "Affected files: \n" (mapconcat 'identity (log-edit-files) " \n"))) +(defun log-edit-insert-filenames-without-changelog () + "Insert the list of files that have no ChangeLog message." + (interactive) + (let ((files + (delq nil + (mapcar + (lambda (file) + (unless (or (cdr-safe (log-edit-changelog-entries file)) + (equal (file-name-nondirectory file) "ChangeLog")) + file)) + (log-edit-files))))) + (when files + (goto-char (point-max)) + (insert (mapconcat 'identity files ", ") ": ")))) + (defun log-edit-add-to-changelog () "Insert this log message into the appropriate ChangeLog file." (interactive) ------------------------------------------------------------ revno: 115616 fixes bug: http://debbugs.gnu.org/12985 committer: Juri Linkov branch nick: trunk timestamp: Thu 2013-12-19 23:02:46 +0200 message: * lisp/simple.el (eval-expression-print-format): Don't check for command names and the last command. Always display additional formats of the integer result in the echo area, and insert them to the current buffer only with a zero prefix arg. Display character when char-displayable-p is non-nil. (eval-expression): With a zero prefix arg, set `print-length' and `print-level' to nil, and insert the integer values from `eval-expression-print-format' at the end. Doc fix. * lisp/emacs-lisp/lisp-mode.el (eval-print-last-sexp): Add arg `eval-last-sexp-arg-internal'. Doc fix. (eval-last-sexp-1): Pass arg `eval-last-sexp-arg-internal' to `eval-last-sexp-print-value'. Doc fix. (eval-last-sexp-print-value): Add arg `eval-last-sexp-arg-internal'. Set `print-length' and `print-level' to nil when arg is zero. (eval-last-sexp): Doc fix. (eval-defun-2): Print the integer values from `eval-expression-print-format' at the end. * lisp/emacs-lisp/edebug.el (edebug-eval-defun): Print the integer values from `eval-expression-print-format' at the end. * lisp/ielm.el (ielm-eval-input): Print the integer values from `eval-expression-print-format' at the end. diff: === modified file 'etc/NEWS' --- etc/NEWS 2013-12-19 00:29:41 +0000 +++ etc/NEWS 2013-12-19 21:02:46 +0000 @@ -119,6 +119,12 @@ ** `eval-defun' on an already defined defcustom calls the :set function, if there is one. +** A zero prefix arg of `eval-last-sexp' (`C-x C-e'), +`eval-expression' (`M-:') and `eval-print-last-sexp' (`C-j') inserts +a list with no limit on its length and level (by using nil values of +`print-length' and `print-level'), and inserts additional formats for +integers (octal, hexadecimal, and character). + ** If the new variable `enable-dir-local-variables' is nil, directory local variables are ignored. May be useful for some modes that want to ignore directory-locals while still respecting file-locals. === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 16:25:25 +0000 +++ lisp/ChangeLog 2013-12-19 21:02:46 +0000 @@ -1,3 +1,30 @@ +2013-12-19 Juri Linkov + + * simple.el (eval-expression-print-format): Don't check for + command names and the last command. Always display additional + formats of the integer result in the echo area, and insert them + to the current buffer only with a zero prefix arg. + Display character when char-displayable-p is non-nil. + (eval-expression): With a zero prefix arg, set `print-length' and + `print-level' to nil, and insert the integer values from + `eval-expression-print-format' at the end. Doc fix. (Bug#12985) + + * emacs-lisp/lisp-mode.el (eval-print-last-sexp): Add arg + `eval-last-sexp-arg-internal'. Doc fix. + (eval-last-sexp-1): Pass arg `eval-last-sexp-arg-internal' to + `eval-last-sexp-print-value'. Doc fix. + (eval-last-sexp-print-value): Add arg `eval-last-sexp-arg-internal'. + Set `print-length' and `print-level' to nil when arg is zero. + (eval-last-sexp): Doc fix. + (eval-defun-2): Print the integer values from + `eval-expression-print-format' at the end. + + * emacs-lisp/edebug.el (edebug-eval-defun): Print the integer + values from `eval-expression-print-format' at the end. + + * ielm.el (ielm-eval-input): Print the integer + values from `eval-expression-print-format' at the end. + 2013-12-19 Teodor Zlatanov * net/eww.el (eww-exit, eww-close, eww-mode-map): Revert change of === modified file 'lisp/emacs-lisp/edebug.el' --- lisp/emacs-lisp/edebug.el 2013-08-08 23:14:20 +0000 +++ lisp/emacs-lisp/edebug.el 2013-12-19 21:02:46 +0000 @@ -497,7 +497,10 @@ (put (nth 1 form) 'saved-face nil))))) (setq edebug-result (eval (eval-sexp-add-defvars form) lexical-binding)) (if (not edebugging) - (princ edebug-result) + (prog1 + (princ edebug-result) + (let ((str (eval-expression-print-format edebug-result))) + (if str (princ str)))) edebug-result))) === modified file 'lisp/emacs-lisp/lisp-mode.el' --- lisp/emacs-lisp/lisp-mode.el 2013-11-05 09:47:47 +0000 +++ lisp/emacs-lisp/lisp-mode.el 2013-12-19 21:02:46 +0000 @@ -858,7 +858,7 @@ \\{lisp-interaction-mode-map}" :abbrev-table nil) -(defun eval-print-last-sexp () +(defun eval-print-last-sexp (&optional eval-last-sexp-arg-internal) "Evaluate sexp before point; print value into current buffer. If `eval-expression-debug-on-error' is non-nil, which is the default, @@ -866,11 +866,13 @@ Note that printing the result is controlled by the variables `eval-expression-print-length' and `eval-expression-print-level', -which see." - (interactive) +which see. With a zero prefix arg, print output with no limit +on the length and level of lists, and include additional formats +for integers (octal, hexadecimal, and character)." + (interactive "P") (let ((standard-output (current-buffer))) (terpri) - (eval-last-sexp t) + (eval-last-sexp (or eval-last-sexp-arg-internal t)) (terpri))) @@ -1013,18 +1015,26 @@ (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) "Evaluate sexp before point; print value in the echo area. -With argument, print output into current buffer." +With argument, print output into current buffer. +With a zero prefix arg, print output with no limit on the length +and level of lists, and include additional formats for integers +\(octal, hexadecimal, and character)." (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) ;; Setup the lexical environment if lexical-binding is enabled. (eval-last-sexp-print-value - (eval (eval-sexp-add-defvars (preceding-sexp)) lexical-binding)))) - - -(defun eval-last-sexp-print-value (value) + (eval (eval-sexp-add-defvars (preceding-sexp)) lexical-binding) + eval-last-sexp-arg-internal))) + + +(defun eval-last-sexp-print-value (value &optional eval-last-sexp-arg-internal) (let ((unabbreviated (let ((print-length nil) (print-level nil)) (prin1-to-string value))) - (print-length eval-expression-print-length) - (print-level eval-expression-print-level) + (print-length (and (not (zerop (prefix-numeric-value + eval-last-sexp-arg-internal))) + eval-expression-print-length)) + (print-level (and (not (zerop (prefix-numeric-value + eval-last-sexp-arg-internal))) + eval-expression-print-level)) (beg (point)) end) (prog1 @@ -1070,6 +1080,9 @@ Interactively, with prefix argument, print output into current buffer. Truncates long output according to the value of the variables `eval-expression-print-length' and `eval-expression-print-level'. +With a zero prefix arg, print output with no limit on the length +and level of lists, and include additional formats for integers +\(octal, hexadecimal, and character). If `eval-expression-debug-on-error' is non-nil, which is the default, this command arranges for all errors to enter the debugger." @@ -1167,6 +1180,8 @@ ;; will make eval-region return. (goto-char end) form)))))) + (let ((str (eval-expression-print-format (car values)))) + (if str (princ str))) ;; The result of evaluation has been put onto VALUES. So return it. (car values)) === modified file 'lisp/ielm.el' --- lisp/ielm.el 2013-10-18 00:55:15 +0000 +++ lisp/ielm.el 2013-12-19 21:02:46 +0000 @@ -458,7 +458,9 @@ ;; Self-referential objects cause loops in the printer, so ;; trap quits here. May as well do errors, too (unless for-effect - (setq output (concat output (pp-to-string result)))) + (setq output (concat output (pp-to-string result) + (let ((str (eval-expression-print-format result))) + (if str (propertize str 'font-lock-face 'shadow)))))) (error (setq error-type "IELM Error") (setq result "Error during pretty-printing (bug in pp)")) (quit (setq error-type "IELM Error") === modified file 'lisp/simple.el' --- lisp/simple.el 2013-12-18 02:43:47 +0000 +++ lisp/simple.el 2013-12-19 21:02:46 +0000 @@ -1365,13 +1365,12 @@ in addition to the value printed by prin1 in functions which display the result of expression evaluation." (if (and (integerp value) - (or (not (memq this-command '(eval-last-sexp eval-print-last-sexp))) - (eq this-command last-command) - (if (boundp 'edebug-active) edebug-active))) + (or (eq standard-output t) + (zerop (prefix-numeric-value current-prefix-arg)))) (let ((char-string - (if (or (if (boundp 'edebug-active) edebug-active) - (memq this-command '(eval-last-sexp eval-print-last-sexp))) - (prin1-char value)))) + (if (and (characterp value) + (char-displayable-p value)) + (prin1-char value)))) (if char-string (format " (#o%o, #x%x, %s)" value value char-string) (format " (#o%o, #x%x)" value value))))) @@ -1399,8 +1398,11 @@ Value is also consed on to front of the variable `values'. Optional argument INSERT-VALUE non-nil (interactively, with prefix argument) means insert the result into the current buffer -instead of printing it in the echo area. Truncates long output -according to the value of the variables `eval-expression-print-length' +instead of printing it in the echo area. With a zero prefix arg, +insert the result with no limit on the length and level of lists, +and include additional formats for integers (octal, hexadecimal, +and character). Truncates long output according to the value +of the variables `eval-expression-print-length' and `eval-expression-print-level'. If `eval-expression-debug-on-error' is non-nil, which is the default, @@ -1422,13 +1424,19 @@ (unless (eq old-value new-value) (setq debug-on-error new-value)))) - (let ((print-length eval-expression-print-length) - (print-level eval-expression-print-level) + (let ((print-length (and (not (zerop (prefix-numeric-value insert-value))) + eval-expression-print-length)) + (print-level (and (not (zerop (prefix-numeric-value insert-value))) + eval-expression-print-level)) (deactivate-mark)) (if insert-value (with-no-warnings (let ((standard-output (current-buffer))) - (prin1 (car values)))) + (prog1 + (prin1 (car values)) + (when (zerop (prefix-numeric-value insert-value)) + (let ((str (eval-expression-print-format (car values)))) + (if str (princ str))))))) (prog1 (prin1 (car values) t) (let ((str (eval-expression-print-format (car values)))) ------------------------------------------------------------ revno: 115615 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-12-19 21:25:13 +0200 message: Fix last commit for TTYs. diff: === modified file 'src/xdisp.c' --- src/xdisp.c 2013-12-19 19:06:53 +0000 +++ src/xdisp.c 2013-12-19 19:25:13 +0000 @@ -18955,12 +18955,11 @@ it->c = it->char_to_display = ' '; it->len = 1; - face = FACE_FROM_ID (f, default_face->id); if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 && (it->glyph_row->used[LEFT_MARGIN_AREA] < WINDOW_LEFT_MARGIN_WIDTH (it->w)) && !it->glyph_row->mode_line_p - && face && face->background != FRAME_BACKGROUND_PIXEL (f)) + && default_face->background != FRAME_BACKGROUND_PIXEL (f)) { struct glyph *g = it->glyph_row->glyphs[LEFT_MARGIN_AREA]; struct glyph *e = g + it->glyph_row->used[LEFT_MARGIN_AREA]; @@ -18990,18 +18989,16 @@ it->face_id = default_face->id; else it->face_id = face->id; - face = FACE_FROM_ID (f, it->face_id); PRODUCE_GLYPHS (it); while (it->current_x <= it->last_visible_x) PRODUCE_GLYPHS (it); - face = FACE_FROM_ID (f, default_face->id); if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 && (it->glyph_row->used[RIGHT_MARGIN_AREA] < WINDOW_RIGHT_MARGIN_WIDTH (it->w)) && !it->glyph_row->mode_line_p - && face && face->background != FRAME_BACKGROUND_PIXEL (f)) + && default_face->background != FRAME_BACKGROUND_PIXEL (f)) { struct glyph *g = it->glyph_row->glyphs[RIGHT_MARGIN_AREA]; struct glyph *e = g + it->glyph_row->used[RIGHT_MARGIN_AREA]; ------------------------------------------------------------ revno: 115614 fixes bug: http://debbugs.gnu.org/16192 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-12-19 21:06:53 +0200 message: Fix bug #16192 with highlight of display margins when region is active src/xdisp.c (extend_face_to_end_of_line): Use default face, not the current text face, for extending the face of the display margins. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-19 17:51:18 +0000 +++ src/ChangeLog 2013-12-19 19:06:53 +0000 @@ -1,5 +1,9 @@ 2013-12-19 Eli Zaretskii + * xdisp.c (extend_face_to_end_of_line): Use default face, not the + current text face, for extending the face of the display margins. + (Bug#16192) + * casefiddle.c (Fupcase_word, Fdowncase_word, Fcapitalize_word): Doc fix. (Bug#16190) === modified file 'src/xdisp.c' --- src/xdisp.c 2013-12-16 19:29:04 +0000 +++ src/xdisp.c 2013-12-19 19:06:53 +0000 @@ -18876,14 +18876,16 @@ && it->glyph_row->used[LEFT_MARGIN_AREA] == 0) { it->glyph_row->glyphs[LEFT_MARGIN_AREA][0] = space_glyph; - it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = face->id; + it->glyph_row->glyphs[LEFT_MARGIN_AREA][0].face_id = + default_face->id; it->glyph_row->used[LEFT_MARGIN_AREA] = 1; } if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 && it->glyph_row->used[RIGHT_MARGIN_AREA] == 0) { it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0] = space_glyph; - it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = face->id; + it->glyph_row->glyphs[RIGHT_MARGIN_AREA][0].face_id = + default_face->id; it->glyph_row->used[RIGHT_MARGIN_AREA] = 1; } } @@ -18952,15 +18954,8 @@ it->object = make_number (0); it->c = it->char_to_display = ' '; it->len = 1; - /* The last row's blank glyphs should get the default face, to - avoid painting the rest of the window with the region face, - if the region ends at ZV. */ - if (it->glyph_row->ends_at_zv_p) - it->face_id = default_face->id; - else - it->face_id = face->id; - face = FACE_FROM_ID (f, it->face_id); + face = FACE_FROM_ID (f, default_face->id); if (WINDOW_LEFT_MARGIN_WIDTH (it->w) > 0 && (it->glyph_row->used[LEFT_MARGIN_AREA] < WINDOW_LEFT_MARGIN_WIDTH (it->w)) @@ -18974,6 +18969,7 @@ it->current_x += g->pixel_width; it->area = LEFT_MARGIN_AREA; + it->face_id = default_face->id; while (it->glyph_row->used[LEFT_MARGIN_AREA] < WINDOW_LEFT_MARGIN_WIDTH (it->w)) { @@ -18987,11 +18983,20 @@ it->area = TEXT_AREA; } + /* The last row's blank glyphs should get the default face, to + avoid painting the rest of the window with the region face, + if the region ends at ZV. */ + if (it->glyph_row->ends_at_zv_p) + it->face_id = default_face->id; + else + it->face_id = face->id; + face = FACE_FROM_ID (f, it->face_id); PRODUCE_GLYPHS (it); while (it->current_x <= it->last_visible_x) PRODUCE_GLYPHS (it); + face = FACE_FROM_ID (f, default_face->id); if (WINDOW_RIGHT_MARGIN_WIDTH (it->w) > 0 && (it->glyph_row->used[RIGHT_MARGIN_AREA] < WINDOW_RIGHT_MARGIN_WIDTH (it->w)) @@ -19005,6 +19010,7 @@ it->current_x += g->pixel_width; it->area = RIGHT_MARGIN_AREA; + it->face_id = default_face->id; while (it->glyph_row->used[RIGHT_MARGIN_AREA] < WINDOW_RIGHT_MARGIN_WIDTH (it->w)) { ------------------------------------------------------------ revno: 115613 committer: Rüdiger Sonderfeld branch nick: trunk timestamp: Thu 2013-12-19 19:00:05 +0100 message: Update .gitignore. It should probably be kept better in sync with .bzrignore. * .gitignore: Ignore refcard temporaries and info/*.info files. diff: === modified file '.gitignore' --- .gitignore 2013-06-12 10:31:24 +0000 +++ .gitignore 2013-12-19 18:00:05 +0000 @@ -17,3 +17,6 @@ /bin/ /site-lisp/ /leim/ja-dic/ +etc/refcards/*.aux +etc/refcards/*.log +info/*.info === modified file 'ChangeLog' --- ChangeLog 2013-12-17 20:43:43 +0000 +++ ChangeLog 2013-12-19 18:00:05 +0000 @@ -1,3 +1,7 @@ +2013-12-19 Rüdiger Sonderfeld + + * .gitignore: Ignore refcard temporaries and info/*.info files. + 2013-12-17 Paul Eggert Merge from gnulib, incorporating: ------------------------------------------------------------ revno: 115612 fixes bug: http://debbugs.gnu.org/16190 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2013-12-19 19:51:18 +0200 message: Fix bug #16190 with documentation of capitalize-word. src/casefiddle.c (Fupcase_word, Fdowncase_word, Fcapitalize_word): Doc fix. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-19 10:25:48 +0000 +++ src/ChangeLog 2013-12-19 17:51:18 +0000 @@ -1,3 +1,8 @@ +2013-12-19 Eli Zaretskii + + * casefiddle.c (Fupcase_word, Fdowncase_word, Fcapitalize_word): + Doc fix. (Bug#16190) + 2013-12-19 Jan Djärv * nsterm.h (KEY_NS_DRAG_FILE, KEY_NS_DRAG_COLOR, KEY_NS_DRAG_TEXT): === modified file 'src/casefiddle.c' --- src/casefiddle.c 2013-11-01 10:00:47 +0000 +++ src/casefiddle.c 2013-12-19 17:51:18 +0000 @@ -365,7 +365,11 @@ } DEFUN ("upcase-word", Fupcase_word, Supcase_word, 1, 1, "p", - doc: /* Convert following word (or ARG words) to upper case, moving over. + doc: /* Convert to upper case from point to end of word, moving over. + +If point is in the middle of a word, the part of that word before point +is ignored when moving forward. + With negative argument, convert previous words but do not move. See also `capitalize-word'. */) (Lisp_Object arg) @@ -380,7 +384,11 @@ } DEFUN ("downcase-word", Fdowncase_word, Sdowncase_word, 1, 1, "p", - doc: /* Convert following word (or ARG words) to lower case, moving over. + doc: /* Convert to lower case from point to end of word, moving over. + +If point is in the middle of a word, the part of that word before point +is ignored when moving forward. + With negative argument, convert previous words but do not move. */) (Lisp_Object arg) { @@ -394,9 +402,14 @@ } DEFUN ("capitalize-word", Fcapitalize_word, Scapitalize_word, 1, 1, "p", - doc: /* Capitalize the following word (or ARG words), moving over. + doc: /* Capitalize from point to the end of word, moving over. +With numerical argument ARG, capitalize the next ARG-1 words as well. This gives the word(s) a first character in upper case and the rest lower case. + +If point is in the middle of a word, the part of that word before point +is ignored when moving forward. + With negative argument, capitalize previous words but do not move. */) (Lisp_Object arg) { ------------------------------------------------------------ revno: 115611 committer: Ted Zlatanov branch nick: quickfixes timestamp: Thu 2013-12-19 11:25:25 -0500 message: eww: Revert r115470 UI wrappers (eww-exit, eww-close) * net/eww.el (eww-exit, eww-close, eww-mode-map): Revert change of 2013-12-11 (r115470). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 14:00:55 +0000 +++ lisp/ChangeLog 2013-12-19 16:25:25 +0000 @@ -1,3 +1,8 @@ +2013-12-19 Teodor Zlatanov + + * net/eww.el (eww-exit, eww-close, eww-mode-map): Revert change of + 2013-12-11 (r115470). + 2013-12-19 Stefan Monnier * hl-line.el (hl-line-make-overlay): New fun. Set priority (bug#16192). === modified file 'lisp/net/eww.el' --- lisp/net/eww.el 2013-12-17 21:17:05 +0000 +++ lisp/net/eww.el 2013-12-19 16:25:25 +0000 @@ -395,8 +395,7 @@ (defvar eww-mode-map (let ((map (make-sparse-keymap))) (suppress-keymap map) - (define-key map "q" 'eww-close) - (define-key map "Q" 'eww-exit) + (define-key map "q" 'quit-window) (define-key map "g" 'eww-reload) (define-key map [tab] 'shr-next-link) (define-key map [backtab] 'shr-previous-link) @@ -423,8 +422,8 @@ (easy-menu-define nil map "" '("Eww" - ["Exit" eww-exit t] - ["Close browser" eww-close t] + ["Exit" eww-quit t] + ["Close browser" quit-window t] ["Reload" eww-reload t] ["Back to previous page" eww-back-url :active (not (zerop (length eww-history)))] @@ -455,17 +454,6 @@ ;;(setq buffer-read-only t) ) -(defun eww-exit () - "Exit the Emacs Web Wowser." - (interactive) - (setq eww-history nil) - (kill-buffer (current-buffer))) - -(defun eww-close () - "Close the Emacs Web Wowser browser, leaving history intact." - (interactive) - (quit-window)) - (defun eww-save-history () (push (list :url eww-current-url :title eww-current-title ------------------------------------------------------------ revno: 115610 fixes bug: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16192 committer: Stefan Monnier branch nick: trunk timestamp: Thu 2013-12-19 09:00:55 -0500 message: * lisp/hl-line.el (hl-line-make-overlay): New fun. Set priority. (hl-line-highlight, global-hl-line-highlight): Use it. (hl-line-overlay): Use defvar-local. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 10:25:48 +0000 +++ lisp/ChangeLog 2013-12-19 14:00:55 +0000 @@ -1,12 +1,18 @@ +2013-12-19 Stefan Monnier + + * hl-line.el (hl-line-make-overlay): New fun. Set priority (bug#16192). + (hl-line-highlight, global-hl-line-highlight): Use it. + (hl-line-overlay): Use defvar-local. + 2013-12-19 Jan Djärv * term/ns-win.el: Require dnd. (global-map): Remove drag items. (ns-insert-text, ns-set-foreground-at-mouse) - (ns-set-background-at-mouse): Remove - (ns-drag-n-drop, ns-drag-n-drop-other-frame) - (ns-drag-n-drop-as-text, ns-drag-n-drop-as-text-other-frame): New - functions. + (ns-set-background-at-mouse): + Remove (ns-drag-n-drop, ns-drag-n-drop-other-frame) + (ns-drag-n-drop-as-text, ns-drag-n-drop-as-text-other-frame): + New functions. 2013-12-19 Glenn Morris @@ -79,8 +85,8 @@ 2013-12-18 Tassilo Horn - * textmodes/reftex-vars.el (reftex-label-alist-builtin): Reference - tables with ~\ref{...} instead of only \ref{...}. + * textmodes/reftex-vars.el (reftex-label-alist-builtin): + Reference tables with ~\ref{...} instead of only \ref{...}. 2013-12-18 Chong Yidong @@ -113,8 +119,8 @@ 2013-12-18 Le Wang - * comint.el (comint-previous-matching-input-from-input): Retain - point (Bug#13404). + * comint.el (comint-previous-matching-input-from-input): + Retain point (Bug#13404). 2013-12-18 Chong Yidong === modified file 'lisp/hl-line.el' --- lisp/hl-line.el 2013-08-05 14:26:57 +0000 +++ lisp/hl-line.el 2013-12-19 14:00:55 +0000 @@ -1,4 +1,4 @@ -;;; hl-line.el --- highlight the current line +;;; hl-line.el --- highlight the current line -*- lexical-binding:t -*- ;; Copyright (C) 1998, 2000-2013 Free Software Foundation, Inc. @@ -61,9 +61,8 @@ ;;; Code: -(defvar hl-line-overlay nil +(defvar-local hl-line-overlay nil "Overlay used by Hl-Line mode to highlight the current line.") -(make-variable-buffer-local 'hl-line-overlay) (defvar global-hl-line-overlay nil "Overlay used by Global-Hl-Line mode to highlight the current line.") @@ -155,13 +154,18 @@ (remove-hook 'change-major-mode-hook #'hl-line-unhighlight t) (remove-hook 'pre-command-hook #'hl-line-unhighlight t))) +(defun hl-line-make-overlay () + (let ((ol (make-overlay (point) (point)))) + (overlay-put ol 'priority -50) ;(bug#16192) + (overlay-put ol 'face hl-line-face) + ol)) + (defun hl-line-highlight () "Activate the Hl-Line overlay on the current line." (if hl-line-mode ; Might be changed outside the mode function. (progn (unless hl-line-overlay - (setq hl-line-overlay (make-overlay 1 1)) ; to be moved - (overlay-put hl-line-overlay 'face hl-line-face)) + (setq hl-line-overlay (hl-line-make-overlay))) ; To be moved. (overlay-put hl-line-overlay 'window (unless hl-line-sticky-flag (selected-window))) (hl-line-move hl-line-overlay)) @@ -200,8 +204,7 @@ (when global-hl-line-mode ; Might be changed outside the mode function. (unless (window-minibuffer-p) (unless global-hl-line-overlay - (setq global-hl-line-overlay (make-overlay 1 1)) ; to be moved - (overlay-put global-hl-line-overlay 'face hl-line-face)) + (setq global-hl-line-overlay (hl-line-make-overlay))) ; To be moved. (overlay-put global-hl-line-overlay 'window (unless global-hl-line-sticky-flag (selected-window))) ------------------------------------------------------------ revno: 115609 fixes bug: http://debbugs.gnu.org/8051 committer: Jan Djärv branch nick: trunk timestamp: Thu 2013-12-19 11:25:48 +0100 message: Make NS port use the normal dnd functions. * lisp/term/ns-win.el: Require dnd. (global-map): Remove drag items. (ns-insert-text, ns-set-foreground-at-mouse) (ns-set-background-at-mouse): Remove (ns-drag-n-drop, ns-drag-n-drop-other-frame) (ns-drag-n-drop-as-text, ns-drag-n-drop-as-text-other-frame): New functions. * src/nsterm.h (KEY_NS_DRAG_FILE, KEY_NS_DRAG_COLOR, KEY_NS_DRAG_TEXT): Remove. * src/nsterm.m (Qfile, Qurl): New. (EV_MODIFIERS2): New macro. (EV_MODIFIERS): Use EV_MODIFIERS2. (ns_term_init): Remove font and color from DND, does not work on newer OSX, and other ports don't have them. (performDragOperation:): Handle modifiers used during drag. Use DRAG_N_DROP_EVENT instead of NS specific events. Remove global Lisp variables used to communicate with ns-win.el. Remove font and color handling. (syms_of_nsterm): Defsym Qfile and Qurl. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2013-12-19 08:14:37 +0000 +++ lisp/ChangeLog 2013-12-19 10:25:48 +0000 @@ -1,3 +1,13 @@ +2013-12-19 Jan Djärv + + * term/ns-win.el: Require dnd. + (global-map): Remove drag items. + (ns-insert-text, ns-set-foreground-at-mouse) + (ns-set-background-at-mouse): Remove + (ns-drag-n-drop, ns-drag-n-drop-other-frame) + (ns-drag-n-drop-as-text, ns-drag-n-drop-as-text-other-frame): New + functions. + 2013-12-19 Glenn Morris * emacs-lisp/ert.el (ert-select-tests): === modified file 'lisp/term/ns-win.el' --- lisp/term/ns-win.el 2013-10-20 09:26:15 +0000 +++ lisp/term/ns-win.el 2013-12-19 10:25:48 +0000 @@ -50,6 +50,7 @@ (require 'faces) (require 'menu-bar) (require 'fontset) +(require 'dnd) (defgroup ns nil "GNUstep/Mac OS X specific features." @@ -160,10 +161,6 @@ (define-key global-map [ns-power-off] 'save-buffers-kill-emacs) (define-key global-map [ns-open-file] 'ns-find-file) (define-key global-map [ns-open-temp-file] [ns-open-file]) -(define-key global-map [ns-drag-file] 'ns-find-file) -(define-key global-map [ns-drag-color] 'ns-set-foreground-at-mouse) -(define-key global-map [S-ns-drag-color] 'ns-set-background-at-mouse) -(define-key global-map [ns-drag-text] 'ns-insert-text) (define-key global-map [ns-change-font] 'ns-respond-to-change-font) (define-key global-map [ns-open-file-line] 'ns-open-file-select-line) (define-key global-map [ns-spi-service-call] 'ns-spi-service-call) @@ -365,14 +362,6 @@ ;;;; Inter-app communications support. -(defvar ns-input-text) ; nsterm.m - -(defun ns-insert-text () - "Insert contents of `ns-input-text' at point." - (interactive) - (insert ns-input-text) - (setq ns-input-text nil)) - (defun ns-insert-file () "Insert contents of file `ns-input-file' like insert-file but with less prompting. If file is a directory perform a `find-file' on it." @@ -518,6 +507,50 @@ (ns-hide-emacs 'activate) (find-file f))))) + +(defun ns-drag-n-drop (event &optional new-frame force-text) + "Edit the files listed in the drag-n-drop EVENT. +Switch to a buffer editing the last file dropped." + (interactive "e") + (let* ((window (posn-window (event-start event))) + (arg (car (cdr (cdr event)))) + (type (car arg)) + (data (car (cdr arg))) + (url-or-string (cond ((eq type 'file) + (concat "file:" data)) + (t data)))) + (set-frame-selected-window nil window) + (when new-frame + (select-frame (make-frame))) + (raise-frame) + (setq window (selected-window)) + (if force-text + (dnd-insert-text window 'private data) + (dnd-handle-one-url window 'private url-or-string)))) + + +(defun ns-drag-n-drop-other-frame (event) + "Edit the files listed in the drag-n-drop EVENT, in other frames. +May create new frames, or reuse existing ones. The frame editing +the last file dropped is selected." + (interactive "e") + (ns-drag-n-drop event t)) + +(defun ns-drag-n-drop-as-text (event) + "Drop the data in EVENT as text." + (interactive "e") + (ns-drag-n-drop event nil t)) + +(defun ns-drag-n-drop-as-text-other-frame (event) + "Drop the data in EVENT as text in a new frame." + (interactive "e") + (ns-drag-n-drop event t t)) + +(global-set-key [drag-n-drop] 'ns-drag-n-drop) +(global-set-key [C-drag-n-drop] 'ns-drag-n-drop-other-frame) +(global-set-key [M-drag-n-drop] 'ns-drag-n-drop-as-text) +(global-set-key [C-M-drag-n-drop] 'ns-drag-n-drop-as-text-other-frame) + ;;;; Frame-related functions. ;; nsterm.m @@ -830,40 +863,6 @@ (t nil)))) -(defvar ns-input-color) ; nsterm.m - -(defun ns-set-foreground-at-mouse () - "Set the foreground color at the mouse location to `ns-input-color'." - (interactive) - (let* ((pos (mouse-position)) - (frame (car pos)) - (face (ns-face-at-pos pos))) - (cond - ((eq face 'cursor) - (modify-frame-parameters frame (list (cons 'cursor-color - ns-input-color)))) - ((not face) - (modify-frame-parameters frame (list (cons 'foreground-color - ns-input-color)))) - (t - (set-face-foreground face ns-input-color frame))))) - -(defun ns-set-background-at-mouse () - "Set the background color at the mouse location to `ns-input-color'." - (interactive) - (let* ((pos (mouse-position)) - (frame (car pos)) - (face (ns-face-at-pos pos))) - (cond - ((eq face 'cursor) - (modify-frame-parameters frame (list (cons 'cursor-color - ns-input-color)))) - ((not face) - (modify-frame-parameters frame (list (cons 'background-color - ns-input-color)))) - (t - (set-face-background face ns-input-color frame))))) - ;; Set some options to be as Nextstep-like as possible. (setq frame-title-format t icon-title-format t) === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-19 08:40:11 +0000 +++ src/ChangeLog 2013-12-19 10:25:48 +0000 @@ -1,3 +1,19 @@ +2013-12-19 Jan Djärv + + * nsterm.h (KEY_NS_DRAG_FILE, KEY_NS_DRAG_COLOR, KEY_NS_DRAG_TEXT): + Remove. + + * nsterm.m (Qfile, Qurl): New. + (EV_MODIFIERS2): New macro. + (EV_MODIFIERS): Use EV_MODIFIERS2. + (ns_term_init): Remove font and color from DND, does not work on + newer OSX, and other ports don't have them. + (performDragOperation:): Handle modifiers used during drag. + Use DRAG_N_DROP_EVENT instead of NS specific events (Bug#8051). + Remove global Lisp variables used to communicate with ns-win.el. + Remove font and color handling. + (syms_of_nsterm): Defsym Qfile and Qurl. + 2013-12-19 Anders Lindgren * nsterm.m (NSTRACE_SIZE, NSTRACE_RECT): New macros. === modified file 'src/nsterm.h' --- src/nsterm.h 2013-12-19 08:40:11 +0000 +++ src/nsterm.h 2013-12-19 10:25:48 +0000 @@ -458,9 +458,6 @@ #define KEY_NS_POWER_OFF ((1<<28)|(0<<16)|1) #define KEY_NS_OPEN_FILE ((1<<28)|(0<<16)|2) #define KEY_NS_OPEN_TEMP_FILE ((1<<28)|(0<<16)|3) -#define KEY_NS_DRAG_FILE ((1<<28)|(0<<16)|4) -#define KEY_NS_DRAG_COLOR ((1<<28)|(0<<16)|5) -#define KEY_NS_DRAG_TEXT ((1<<28)|(0<<16)|6) #define KEY_NS_CHANGE_FONT ((1<<28)|(0<<16)|7) #define KEY_NS_OPEN_FILE_LINE ((1<<28)|(0<<16)|8) #define KEY_NS_PUT_WORKING_TEXT ((1<<28)|(0<<16)|9) === modified file 'src/nsterm.m' --- src/nsterm.m 2013-12-19 08:40:11 +0000 +++ src/nsterm.m 2013-12-19 10:25:48 +0000 @@ -80,7 +80,7 @@ #endif /* Detailed tracing. "S" means "size" and "LL" stands for "lower left". */ -#if 1 +#if 0 int term_trace_num = 0; #define NSTRACE_SIZE(str,size) fprintf (stderr, \ "%s:%d: [%d] " str \ @@ -196,6 +196,7 @@ static Lisp_Object QUTF8_STRING; static Lisp_Object Qcocoa, Qgnustep; +static Lisp_Object Qfile, Qurl; /* On OS X picks up the default NSGlobalDomain AppleAntiAliasingThreshold, the maximum font size to NOT antialias. On GNUstep there is currently @@ -278,31 +279,32 @@ #define NSRightCommandKeyMask (0x000010 | NSCommandKeyMask) #define NSLeftAlternateKeyMask (0x000020 | NSAlternateKeyMask) #define NSRightAlternateKeyMask (0x000040 | NSAlternateKeyMask) -#define EV_MODIFIERS(e) \ - ((([e modifierFlags] & NSHelpKeyMask) ? \ +#define EV_MODIFIERS2(flags) \ + (((flags & NSHelpKeyMask) ? \ hyper_modifier : 0) \ | (!EQ (ns_right_alternate_modifier, Qleft) && \ - (([e modifierFlags] & NSRightAlternateKeyMask) \ + ((flags & NSRightAlternateKeyMask) \ == NSRightAlternateKeyMask) ? \ parse_solitary_modifier (ns_right_alternate_modifier) : 0) \ - | (([e modifierFlags] & NSAlternateKeyMask) ? \ + | ((flags & NSAlternateKeyMask) ? \ parse_solitary_modifier (ns_alternate_modifier) : 0) \ - | (([e modifierFlags] & NSShiftKeyMask) ? \ + | ((flags & NSShiftKeyMask) ? \ shift_modifier : 0) \ | (!EQ (ns_right_control_modifier, Qleft) && \ - (([e modifierFlags] & NSRightControlKeyMask) \ + ((flags & NSRightControlKeyMask) \ == NSRightControlKeyMask) ? \ parse_solitary_modifier (ns_right_control_modifier) : 0) \ - | (([e modifierFlags] & NSControlKeyMask) ? \ + | ((flags & NSControlKeyMask) ? \ parse_solitary_modifier (ns_control_modifier) : 0) \ - | (([e modifierFlags] & NS_FUNCTION_KEY_MASK) ? \ + | ((flags & NS_FUNCTION_KEY_MASK) ? \ parse_solitary_modifier (ns_function_modifier) : 0) \ | (!EQ (ns_right_command_modifier, Qleft) && \ - (([e modifierFlags] & NSRightCommandKeyMask) \ + ((flags & NSRightCommandKeyMask) \ == NSRightCommandKeyMask) ? \ parse_solitary_modifier (ns_right_command_modifier) : 0) \ - | (([e modifierFlags] & NSCommandKeyMask) ? \ + | ((flags & NSCommandKeyMask) ? \ parse_solitary_modifier (ns_command_modifier):0)) +#define EV_MODIFIERS(e) EV_MODIFIERS2 ([e modifierFlags]) #define EV_UDMODIFIERS(e) \ ((([e type] == NSLeftMouseDown) ? down_modifier : 0) \ @@ -4377,9 +4379,7 @@ NSStringPboardType, NSTabularTextPboardType, NSFilenamesPboardType, - NSURLPboardType, - NSColorPboardType, - NSFontPboardType, nil] retain]; + NSURLPboardType, nil] retain]; /* If fullscreen is in init/default-frame-alist, focus isn't set right for fullscreen windows, so set this. */ @@ -6647,6 +6647,8 @@ NSString *type; NSEvent *theEvent = [[self window] currentEvent]; NSPoint position; + NSDragOperation op = [sender draggingSourceOperationMask]; + int modifiers = 0; NSTRACE (performDragOperation); @@ -6658,6 +6660,20 @@ pb = [sender draggingPasteboard]; type = [pb availableTypeFromArray: ns_drag_types]; + + if (! (op & (NSDragOperationMove|NSDragOperationDelete)) && + // URL drags contain all operations (0xf), don't allow all to be set. + (op & 0xf) != 0xf) + { + if (op & NSDragOperationLink) + modifiers |= NSControlKeyMask; + if (op & NSDragOperationCopy) + modifiers |= NSAlternateKeyMask; + if (op & NSDragOperationGeneric) + modifiers |= NSCommandKeyMask; + } + + modifiers = EV_MODIFIERS2 (modifiers); if (type == 0) { return NO; @@ -6674,34 +6690,37 @@ fenum = [files objectEnumerator]; while ( (file = [fenum nextObject]) ) { - emacs_event->kind = NS_NONKEY_EVENT; - emacs_event->code = KEY_NS_DRAG_FILE; + emacs_event->kind = DRAG_N_DROP_EVENT; XSETINT (emacs_event->x, x); XSETINT (emacs_event->y, y); ns_input_file = append2 (ns_input_file, build_string ([file UTF8String])); - emacs_event->modifiers = EV_MODIFIERS (theEvent); + emacs_event->modifiers = modifiers; + emacs_event->arg = list2 (Qfile, build_string ([file UTF8String])); EV_TRAILER (theEvent); } return YES; } else if ([type isEqualToString: NSURLPboardType]) { - NSString *file; - NSURL *fileURL; - - if (!(fileURL = [NSURL URLFromPasteboard: pb]) || - [fileURL isFileURL] == NO) - return NO; - - file = [fileURL path]; - emacs_event->kind = NS_NONKEY_EVENT; - emacs_event->code = KEY_NS_DRAG_FILE; + NSURL *url = [NSURL URLFromPasteboard: pb]; + if (url == nil) return NO; + + emacs_event->kind = DRAG_N_DROP_EVENT; XSETINT (emacs_event->x, x); XSETINT (emacs_event->y, y); - ns_input_file = append2 (ns_input_file, build_string ([file UTF8String])); - emacs_event->modifiers = EV_MODIFIERS (theEvent); + emacs_event->modifiers = modifiers; + emacs_event->arg = list2 (Qurl, + build_string ([[url absoluteString] + UTF8String])); EV_TRAILER (theEvent); + + if ([url isFileURL] != NO) + { + NSString *file = [url path]; + ns_input_file = append2 (ns_input_file, + build_string ([file UTF8String])); + } return YES; } else if ([type isEqualToString: NSStringPboardType] @@ -6712,46 +6731,11 @@ if (! (data = [pb stringForType: type])) return NO; - emacs_event->kind = NS_NONKEY_EVENT; - emacs_event->code = KEY_NS_DRAG_TEXT; - XSETINT (emacs_event->x, x); - XSETINT (emacs_event->y, y); - ns_input_text = build_string ([data UTF8String]); - emacs_event->modifiers = EV_MODIFIERS (theEvent); - EV_TRAILER (theEvent); - return YES; - } - else if ([type isEqualToString: NSColorPboardType]) - { - NSColor *c = [NSColor colorFromPasteboard: pb]; - emacs_event->kind = NS_NONKEY_EVENT; - emacs_event->code = KEY_NS_DRAG_COLOR; - XSETINT (emacs_event->x, x); - XSETINT (emacs_event->y, y); - ns_input_color = ns_color_to_lisp (c); - emacs_event->modifiers = EV_MODIFIERS (theEvent); - EV_TRAILER (theEvent); - return YES; - } - else if ([type isEqualToString: NSFontPboardType]) - { - /* impl based on GNUstep NSTextView.m */ - NSData *data = [pb dataForType: NSFontPboardType]; - NSDictionary *dict = [NSUnarchiver unarchiveObjectWithData: data]; - NSFont *font = [dict objectForKey: NSFontAttributeName]; - char fontSize[10]; - - if (font == nil) - return NO; - - emacs_event->kind = NS_NONKEY_EVENT; - emacs_event->code = KEY_NS_CHANGE_FONT; - XSETINT (emacs_event->x, x); - XSETINT (emacs_event->y, y); - ns_input_font = build_string ([[font fontName] UTF8String]); - snprintf (fontSize, 10, "%f", [font pointSize]); - ns_input_fontsize = build_string (fontSize); - emacs_event->modifiers = EV_MODIFIERS (theEvent); + emacs_event->kind = DRAG_N_DROP_EVENT; + XSETINT (emacs_event->x, x); + XSETINT (emacs_event->y, y); + emacs_event->modifiers = modifiers; + emacs_event->arg = list2 (Qnil, build_string ([data UTF8String])); EV_TRAILER (theEvent); return YES; } @@ -7514,6 +7498,9 @@ DEFSYM (Qcontrol, "control"); DEFSYM (QUTF8_STRING, "UTF8_STRING"); + DEFSYM (Qfile, "file"); + DEFSYM (Qurl, "url"); + Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); Fput (Qmeta, Qmodifier_value, make_number (meta_modifier)); @@ -7524,10 +7511,6 @@ "The file specified in the last NS event."); ns_input_file =Qnil; - DEFVAR_LISP ("ns-input-text", ns_input_text, - "The data received in the last NS text drag event."); - ns_input_text =Qnil; - DEFVAR_LISP ("ns-working-text", ns_working_text, "String for visualizing working composition sequence."); ns_working_text =Qnil; @@ -7544,10 +7527,6 @@ "The line specified in the last NS event."); ns_input_line =Qnil; - DEFVAR_LISP ("ns-input-color", ns_input_color, - "The color specified in the last NS event."); - ns_input_color =Qnil; - DEFVAR_LISP ("ns-input-spi-name", ns_input_spi_name, "The service name specified in the last NS event."); ns_input_spi_name =Qnil; ------------------------------------------------------------ revno: 115608 committer: Jan Djärv branch nick: trunk timestamp: Thu 2013-12-19 09:40:11 +0100 message: Redo size constraint for NS so frames can span screens. * nsterm.h (ns_output): Remove dont_constrain. * nsterm.m (NSTRACE_SIZE, NSTRACE_RECT): New macros. (ns_constrain_all_frames, x_set_offset): Remove assignment to dont_constrain. (updateFrameSize:, windowWillResize:toSize:): Add trace. (constrainFrameRect): Remove special case nr_screens == 1. Don't constrain size to size of view. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2013-12-19 07:38:08 +0000 +++ src/ChangeLog 2013-12-19 08:40:11 +0000 @@ -1,5 +1,16 @@ 2013-12-19 Anders Lindgren + * nsterm.m (NSTRACE_SIZE, NSTRACE_RECT): New macros. + (ns_constrain_all_frames, x_set_offset): Remove assignment to + dont_constrain. + (updateFrameSize:, windowWillResize:toSize:): Add trace. + (constrainFrameRect): Remove special case nr_screens == 1. + Don't constrain size to size of view. + + * nsterm.h (ns_output): Remove dont_constrain. + +2013-12-19 Anders Lindgren + * nsterm.m (mouseDown:): Generate HORIZ_WHEEL_EVENT. 2013-12-18 Paul Eggert === modified file 'src/nsterm.h' --- src/nsterm.h 2013-12-07 16:48:12 +0000 +++ src/nsterm.h 2013-12-19 08:40:11 +0000 @@ -687,9 +687,6 @@ /* This is the Emacs structure for the NS display this frame is on. */ struct ns_display_info *display_info; - /* Non-zero if we want to constrain the frame to the screen. */ - int dont_constrain; - /* Non-zero if we are zooming (maximizing) the frame. */ int zooming; }; === modified file 'src/nsterm.m' --- src/nsterm.m 2013-12-19 07:38:08 +0000 +++ src/nsterm.m 2013-12-19 08:40:11 +0000 @@ -79,6 +79,28 @@ #define NSTRACE(x) #endif +/* Detailed tracing. "S" means "size" and "LL" stands for "lower left". */ +#if 1 +int term_trace_num = 0; +#define NSTRACE_SIZE(str,size) fprintf (stderr, \ + "%s:%d: [%d] " str \ + " (S:%.0f x %.0f)\n", \ + __FILE__, __LINE__, ++term_trace_num,\ + size.height, \ + size.width) +#define NSTRACE_RECT(s,r) fprintf (stderr, \ + "%s:%d: [%d] " s \ + " (LL:%.0f x %.0f -> S:%.0f x %.0f)\n", \ + __FILE__, __LINE__, ++term_trace_num,\ + r.origin.x, \ + r.origin.y, \ + r.size.height, \ + r.size.width) +#else +#define NSTRACE_SIZE(str,size) +#define NSTRACE_RECT(s,r) +#endif + extern NSString *NSMenuDidBeginTrackingNotification; /* ========================================================================== @@ -605,7 +627,6 @@ NSView *view = FRAME_NS_VIEW (f); /* This no-op will trigger the default window placing * constraint system. */ - f->output_data.ns->dont_constrain = 0; [[view window] setFrameOrigin:[[view window] frame].origin]; } } @@ -1225,7 +1246,6 @@ #endif /* Constrain the setFrameTopLeftPoint so we don't move behind the menu bar. */ - f->output_data.ns->dont_constrain = 0; [[view window] setFrameTopLeftPoint: NSMakePoint (SCREENMAXBOUND (f->left_pos), SCREENMAXBOUND ([fscreen frame].size.height @@ -5684,10 +5704,13 @@ NSRect wr = [window frame]; int extra = 0; int oldc = cols, oldr = rows; - int oldw = FRAME_PIXEL_WIDTH (emacsframe), - oldh = FRAME_PIXEL_HEIGHT (emacsframe); + int oldw = FRAME_PIXEL_WIDTH (emacsframe); + int oldh = FRAME_PIXEL_HEIGHT (emacsframe); int neww, newh; + NSTRACE (updateFrameSize); + NSTRACE_SIZE ("Original size", NSMakeSize (oldw, oldh)); + if (! [self isFullscreen]) { #ifdef NS_IMPL_GNUSTEP @@ -5731,6 +5754,8 @@ sz.width = FRAME_COLUMN_WIDTH (emacsframe); sz.height = FRAME_LINE_HEIGHT (emacsframe); [win setResizeIncrements: sz]; + + NSTRACE_SIZE ("New size", NSMakeSize (neww, newh)); } [view setFrame: NSMakeRect (0, 0, neww, newh)]; @@ -5744,6 +5769,7 @@ int extra = 0; NSTRACE (windowWillResize); + NSTRACE_SIZE ("Original size", frameSize); /*fprintf (stderr,"Window will resize: %.0f x %.0f\n",frameSize.width,frameSize.height); */ if (fs_state == FULLSCREEN_MAXIMIZED @@ -6903,19 +6929,39 @@ NSUInteger nr_screens = [[NSScreen screens] count]; struct frame *f = ((EmacsView *)[self delegate])->emacsframe; NSTRACE (constrainFrameRect); - - if (nr_screens == 1) - { - NSRect r = [super constrainFrameRect:frameRect toScreen:screen]; - return r; - } - - if (f->output_data.ns->dont_constrain - || ns_menu_bar_should_be_hidden ()) + NSTRACE_RECT ("input", frameRect); + + if (ns_menu_bar_should_be_hidden ()) return frameRect; - f->output_data.ns->dont_constrain = 1; - return [super constrainFrameRect:frameRect toScreen:screen]; + /* The default implementation does two things 1) ensure that the top + of the rectangle is below the menu bar (or below the top of the + screen) and 2) resizes windows larger than the screen. As we + don't want the latter, a smaller rectangle is used. */ +#define FAKE_HEIGHT 64 + float old_top = frameRect.origin.y + frameRect.size.height; + NSRect r; + r.size.height = FAKE_HEIGHT; + r.size.width = frameRect.size.width; + r.origin.x = frameRect.origin.x; + r.origin.y = old_top - FAKE_HEIGHT; + + NSTRACE_RECT ("input to super", r); + + r = [super constrainFrameRect:r toScreen:screen]; + + NSTRACE_RECT ("output from super", r); + + float new_top = r.origin.y + FAKE_HEIGHT; + if (new_top < old_top) + { + frameRect.origin.y = new_top - frameRect.size.height; + } + + NSTRACE_RECT ("output", frameRect); + + return frameRect; +#undef FAKE_HEIGHT } @end /* EmacsWindow */