------------------------------------------------------------ revno: 116606 committer: martin rudalics branch nick: trunk timestamp: Fri 2014-02-28 10:10:55 +0100 message: Revert recent with-temp-buffer-window change (Bug#16816, Bug#16882). * window.el (with-temp-buffer-window): Revert change from 2014-02-21. Suggested by Thierry Volpiatto . Fix doc-string based on a suggestion by Nicolas Richard . * help.el (with-help-window): Fix doc-string. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 08:49:59 +0000 +++ lisp/ChangeLog 2014-02-28 09:10:55 +0000 @@ -1,7 +1,16 @@ +2014-02-28 Martin Rudalics + + Revert recent with-temp-buffer-window change (Bug#16816, Bug#16882). + * window.el (with-temp-buffer-window): Revert change from + 2014-02-21. Suggested by Thierry Volpiatto + . Fix doc-string based on a + suggestion by Nicolas Richard . + * help.el (with-help-window): Fix doc-string. + 2014-02-28 Ivan Kanis - * net/shr.el (shr-put-image): add custom variable - `shr-image-animate' to turn off image animation. It is so slow it + * net/shr.el (shr-put-image): Add custom variable + `shr-image-animate' to turn off image animation. It is so slow it will render emacs unusable. 2014-02-28 Michael Albinus @@ -3304,7 +3313,8 @@ * emacs-lisp/debug.el (debug): Use window-total-height instead of window-total-size. * frame.el (tool-bar-lines-needed): Defalias to tool-bar-height. - * help.el (describe-bindings-internal): Call help-buffer + * help.el (describe-bindings-internal): Use help-buffer as + argument for with-help-window. (temp-buffer-max-width): New option. (resize-temp-buffer-window, help-window-setup) (with-help-window): Rewrite. === modified file 'lisp/help.el' --- lisp/help.el 2014-02-10 01:34:22 +0000 +++ lisp/help.el 2014-02-28 09:10:55 +0000 @@ -1194,9 +1194,14 @@ ;; Note: It's usually always wrong to use `help-print-return-message' in ;; the body of `with-help-window'. (defmacro with-help-window (buffer-name &rest body) - "Display buffer with name BUFFER-NAME in a help window evaluating BODY. -Select help window if the current value of the user option -`help-window-select' says so. Return last value in BODY." + "Display buffer with name BUFFER-NAME in a help window. +Evaluate the forms in BODY with the buffer specified by +BUFFER-NAME current, put that buffer in `help-mode', display the +buffer in a window (see `with-temp-buffer-window' for details) +and issue a message how to deal with that \"help\" window when +it's no more needed. Select the help window if the current value +of the user option `help-window-select' says so. Return last +value in BODY." (declare (indent 1) (debug t)) `(progn ;; Make `help-window-point-marker' point nowhere. The only place === modified file 'lisp/window.el' --- lisp/window.el 2014-02-21 11:04:27 +0000 +++ lisp/window.el 2014-02-28 09:10:55 +0000 @@ -142,28 +142,27 @@ ;; Return the window. window)))) -;; Doc is very similar to with-output-to-temp-buffer. (defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body) - "Bind `standard-output' to BUFFER-OR-NAME, eval BODY, show the buffer. -BUFFER-OR-NAME must specify either a live buffer, or the name of a -buffer (if it does not exist, this macro creates it). - -This construct makes buffer BUFFER-OR-NAME empty before running BODY. -It does not make the buffer current for BODY. -Instead it binds `standard-output' to that buffer, so that output -generated with `prin1' and similar functions in BODY goes into -the buffer. - -At the end of BODY, this marks the specified buffer unmodified and -read-only, and displays it in a window (but does not select it, or make -the buffer current). The display happens by calling `display-buffer' -with the ACTION argument. If `temp-buffer-resize-mode' is enabled, -the relevant window shrinks automatically. - -This returns the value returned by BODY, unless QUIT-FUNCTION specifies -a function. In that case, it runs the function with two arguments - + "Evaluate BODY in a buffer BUFFER-OR-NAME and show that buffer. +BUFFER-OR-NAME must specify either a live buffer, or the name of +a buffer (if it does not exist, this macro creates it). + +Make the buffer specified by BUFFER-OR-NAME empty before running +BODY and make that buffer current for running the forms in BODY. +In addition, bind `standard-output' to that buffer, so that +output generated with `prin1' and similar functions in BODY goes +into that buffer. + +At the end of BODY, mark the specified buffer unmodified and +read-only, and display it in a window (but do not select it). +The display happens by calling `display-buffer' passing it the +ACTION argument. If `temp-buffer-resize-mode' is enabled, the +corresponding window may shrink automatically. + +Return the value returned by BODY, unless QUIT-FUNCTION specifies +a function. In that case, run that function with two arguments - the window showing the specified buffer and the value returned by -BODY - and returns the value returned by that function. +BODY - and return the value returned by that function. If the buffer is displayed on a new frame, the window manager may decide to select that frame. In that case, it's usually a good @@ -172,16 +171,16 @@ asking a `yes-or-no-p' question. This runs the hook `temp-buffer-window-setup-hook' before BODY, -with the specified buffer temporarily current. It runs the -hook `temp-buffer-window-show-hook' after displaying the buffer, -with that buffer temporarily current, and the window that was used to +with the specified buffer temporarily current. It runs the hook +`temp-buffer-window-show-hook' after displaying the buffer, with +that buffer temporarily current, and the window that was used to display it temporarily selected. -This construct is similar to `with-output-to-temp-buffer', but -runs different hooks. In particular, it does not run -`temp-buffer-setup-hook', which usually puts the buffer in Help mode. -Also, it does not call `temp-buffer-show-function' (the ACTION -argument replaces this)." +This construct is similar to `with-output-to-temp-buffer' but, +unlike that, makes BUFFER-OR-NAME current when running BODY. +Also, it neither runs `temp-buffer-setup-hook' which usually puts +the buffer in Help mode, nor `temp-buffer-show-function' (the +ACTION argument replaces this)." (declare (debug t)) (let ((buffer (make-symbol "buffer")) (window (make-symbol "window")) @@ -189,8 +188,8 @@ `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name)) (standard-output ,buffer) ,window ,value) - (setq ,value (progn ,@body)) (with-current-buffer ,buffer + (setq ,value (progn ,@body)) (setq ,window (temp-buffer-window-show ,buffer ,action))) (if (functionp ,quit-function) ------------------------------------------------------------ revno: 116605 committer: Ivan Kanis branch nick: trunk timestamp: Fri 2014-02-28 09:49:59 +0100 message: * net/shr.el (shr-put-image): add custom variable `shr-image-animate' to turn off image animation. It is so slow it will render emacs unusable. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 08:41:24 +0000 +++ lisp/ChangeLog 2014-02-28 08:49:59 +0000 @@ -1,3 +1,9 @@ +2014-02-28 Ivan Kanis + + * net/shr.el (shr-put-image): add custom variable + `shr-image-animate' to turn off image animation. It is so slow it + will render emacs unusable. + 2014-02-28 Michael Albinus * net/tramp-adb.el (tramp-adb-parse-device-names): === modified file 'lisp/net/shr.el' --- lisp/net/shr.el 2014-01-31 21:44:11 +0000 +++ lisp/net/shr.el 2014-02-28 08:49:59 +0000 @@ -100,6 +100,12 @@ :group 'shr :type 'function) +(defcustom shr-image-animate t + "If non nil image will be animated." + :version "24.4" + :group 'shr + :type 'boolean) + (defvar shr-content-function nil "If bound, this should be a function that will return the content. This is used for cid: URLs, and the function is called with the @@ -765,14 +771,15 @@ (insert-sliced-image image (or alt "*") nil 20 1) (insert-image image (or alt "*"))) (put-text-property start (point) 'image-size size) - (when (cond ((fboundp 'image-multi-frame-p) + (when (and shr-image-animate + (cond ((fboundp 'image-multi-frame-p) ;; Only animate multi-frame things that specify a ;; delay; eg animated gifs as opposed to ;; multi-page tiffs. FIXME? - (cdr (image-multi-frame-p image))) - ((fboundp 'image-animated-p) - (image-animated-p image))) - (image-animate image nil 60))) + (cdr (image-multi-frame-p image))) + ((fboundp 'image-animated-p) + (image-animated-p image)))) + (image-animate image nil 60))) image) (insert alt))) ------------------------------------------------------------ revno: 116604 committer: Michael Albinus branch nick: trunk timestamp: Fri 2014-02-28 09:47:43 +0100 message: * automated/tramp-tests.el (tramp--test-enabled) (tramp-test15-copy-directory): No special handling of tramp-adb.el anymore. It's fixed in that package. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2014-02-27 12:07:10 +0000 +++ test/ChangeLog 2014-02-28 08:47:43 +0000 @@ -1,3 +1,9 @@ +2014-02-28 Michael Albinus + + * automated/tramp-tests.el (tramp--test-enabled) + (tramp-test15-copy-directory): No special handling of tramp-adb.el + anymore. It's fixed in that package. + 2014-02-27 Michael Albinus * automated/tramp-tests.el (tramp--test-enabled): Move connection === modified file 'test/automated/tramp-tests.el' --- test/automated/tramp-tests.el 2014-02-27 12:07:10 +0000 +++ test/automated/tramp-tests.el 2014-02-28 08:47:43 +0000 @@ -82,10 +82,7 @@ (file-directory-p tramp-test-temporary-file-directory) (file-writable-p tramp-test-temporary-file-directory)))))) - (when (and (cdr tramp--test-enabled-checked) - (not (eq (tramp-find-foreign-file-name-handler - tramp-test-temporary-file-directory) - 'tramp-adb-file-name-handler))) + (when (cdr tramp--test-enabled-checked) ;; Cleanup connection. We don't cleanup for adb, because it ;; doesn't behave well when is disconnect several times. (tramp-cleanup-connection @@ -751,14 +748,11 @@ (write-region "foo" nil tmp-name4) (should (file-directory-p tmp-name1)) (should (file-exists-p tmp-name4)) - ;; We do not care, whether file permissions and time stamps - ;; are correct. Sometimes, it is not possible to manage - ;; them, for example in tramp-adb.el. - (ignore-errors (copy-directory tmp-name1 tmp-name2)) + (copy-directory tmp-name1 tmp-name2) (should (file-directory-p tmp-name2)) (should (file-exists-p tmp-name5)) ;; Target directory does exist already. - (ignore-errors (copy-directory tmp-name1 tmp-name2)) + (copy-directory tmp-name1 tmp-name2) (should (file-directory-p tmp-name3)) (should (file-exists-p tmp-name6))) (ignore-errors ------------------------------------------------------------ revno: 116603 committer: Michael Albinus branch nick: trunk timestamp: Fri 2014-02-28 09:41:24 +0100 message: * net/tramp-adb.el (tramp-adb-parse-device-names): Use `accept-process-output'. (tramp-adb-handle-file-truename): Cache the localname only. (tramp-adb-handle-make-directory) (tramp-adb-handle-delete-directory): Flush file properties correctly. (tramp-adb-handle-set-file-modes): Do not raise an error when file modes cannot be changed. * net/tramp-cache.el (tramp-flush-directory-property): Remove also file properties of symlinks. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 06:51:04 +0000 +++ lisp/ChangeLog 2014-02-28 08:41:24 +0000 @@ -1,3 +1,16 @@ +2014-02-28 Michael Albinus + + * net/tramp-adb.el (tramp-adb-parse-device-names): + Use `accept-process-output'. + (tramp-adb-handle-file-truename): Cache the localname only. + (tramp-adb-handle-make-directory) + (tramp-adb-handle-delete-directory): Flush file properties correctly. + (tramp-adb-handle-set-file-modes): Do not raise an error when file + modes cannot be changed. + + * net/tramp-cache.el (tramp-flush-directory-property): Remove also + file properties of symlinks. + 2014-02-28 Per Starbäck * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Update === modified file 'lisp/net/tramp-adb.el' --- lisp/net/tramp-adb.el 2014-02-27 11:59:04 +0000 +++ lisp/net/tramp-adb.el 2014-02-28 08:41:24 +0000 @@ -186,7 +186,8 @@ result) (tramp-compat-set-process-query-on-exit-flag p nil) (while (eq 'run (process-status p)) - (sleep-for 0.1)) + (accept-process-output p 0.1)) + (accept-process-output p 0.1) (goto-char (point-min)) (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t) (add-to-list 'result (list nil (match-string 1)))) @@ -227,83 +228,90 @@ ;; code could be shared? (defun tramp-adb-handle-file-truename (filename) "Like `file-truename' for Tramp files." - (with-parsed-tramp-file-name (expand-file-name filename) nil - (with-tramp-file-property v localname "file-truename" - (let ((result nil)) ; result steps in reverse order - (tramp-message v 4 "Finding true name for `%s'" filename) - (let* ((directory-sep-char ?/) - (steps (tramp-compat-split-string localname "/")) - (localnamedir (tramp-run-real-handler - 'file-name-as-directory (list localname))) - (is-dir (string= localname localnamedir)) - (thisstep nil) - (numchase 0) - ;; Don't make the following value larger than - ;; necessary. People expect an error message in a - ;; timely fashion when something is wrong; otherwise - ;; they might think that Emacs is hung. Of course, - ;; correctness has to come first. - (numchase-limit 20) - symlink-target) - (while (and steps (< numchase numchase-limit)) - (setq thisstep (pop steps)) - (tramp-message - v 5 "Check %s" - (mapconcat 'identity - (append '("") (reverse result) (list thisstep)) - "/")) - (setq symlink-target - (nth 0 (file-attributes - (tramp-make-tramp-file-name - method user host - (mapconcat 'identity - (append '("") - (reverse result) - (list thisstep)) - "/"))))) - (cond ((string= "." thisstep) - (tramp-message v 5 "Ignoring step `.'")) - ((string= ".." thisstep) - (tramp-message v 5 "Processing step `..'") - (pop result)) - ((stringp symlink-target) - ;; It's a symlink, follow it. - (tramp-message v 5 "Follow symlink to %s" symlink-target) - (setq numchase (1+ numchase)) - (when (file-name-absolute-p symlink-target) - (setq result nil)) - ;; If the symlink was absolute, we'll get a string - ;; like "/user@host:/some/target"; extract the - ;; "/some/target" part from it. - (when (tramp-tramp-file-p symlink-target) - (unless (tramp-equal-remote filename symlink-target) - (tramp-error - v 'file-error - "Symlink target `%s' on wrong host" symlink-target)) - (setq symlink-target localname)) - (setq steps - (append (tramp-compat-split-string - symlink-target "/") - steps))) - (t - ;; It's a file. - (setq result (cons thisstep result))))) - (when (>= numchase numchase-limit) - (tramp-error - v 'file-error - "Maximum number (%d) of symlinks exceeded" numchase-limit)) - (setq result (reverse result)) - ;; Combine list to form string. - (setq result - (if result - (mapconcat 'identity (cons "" result) "/") - "/")) - (when (and is-dir (or (string= "" result) - (not (string= (substring result -1) "/")))) - (setq result (concat result "/")))) - - (tramp-message v 4 "True name of `%s' is `%s'" filename result) - (tramp-make-tramp-file-name method user host result))))) + (format + "%s%s" + (with-parsed-tramp-file-name (expand-file-name filename) nil + (tramp-make-tramp-file-name + method user host + (with-tramp-file-property v localname "file-truename" + (let ((result nil)) ; result steps in reverse order + (tramp-message v 4 "Finding true name for `%s'" filename) + (let* ((directory-sep-char ?/) + (steps (tramp-compat-split-string localname "/")) + (localnamedir (tramp-run-real-handler + 'file-name-as-directory (list localname))) + (is-dir (string= localname localnamedir)) + (thisstep nil) + (numchase 0) + ;; Don't make the following value larger than + ;; necessary. People expect an error message in a + ;; timely fashion when something is wrong; otherwise + ;; they might think that Emacs is hung. Of course, + ;; correctness has to come first. + (numchase-limit 20) + symlink-target) + (while (and steps (< numchase numchase-limit)) + (setq thisstep (pop steps)) + (tramp-message + v 5 "Check %s" + (mapconcat 'identity + (append '("") (reverse result) (list thisstep)) + "/")) + (setq symlink-target + (nth 0 (file-attributes + (tramp-make-tramp-file-name + method user host + (mapconcat 'identity + (append '("") + (reverse result) + (list thisstep)) + "/"))))) + (cond ((string= "." thisstep) + (tramp-message v 5 "Ignoring step `.'")) + ((string= ".." thisstep) + (tramp-message v 5 "Processing step `..'") + (pop result)) + ((stringp symlink-target) + ;; It's a symlink, follow it. + (tramp-message v 5 "Follow symlink to %s" symlink-target) + (setq numchase (1+ numchase)) + (when (file-name-absolute-p symlink-target) + (setq result nil)) + ;; If the symlink was absolute, we'll get a string + ;; like "/user@host:/some/target"; extract the + ;; "/some/target" part from it. + (when (tramp-tramp-file-p symlink-target) + (unless (tramp-equal-remote filename symlink-target) + (tramp-error + v 'file-error + "Symlink target `%s' on wrong host" symlink-target)) + (setq symlink-target localname)) + (setq steps + (append (tramp-compat-split-string + symlink-target "/") + steps))) + (t + ;; It's a file. + (setq result (cons thisstep result))))) + (when (>= numchase numchase-limit) + (tramp-error + v 'file-error + "Maximum number (%d) of symlinks exceeded" numchase-limit)) + (setq result (reverse result)) + ;; Combine list to form string. + (setq result + (if result + (mapconcat 'identity (cons "" result) "/") + "/")) + (when (and is-dir (or (string= "" result) + (not (string= (substring result -1) "/")))) + (setq result (concat result "/")))) + + (tramp-message v 4 "True name of `%s' is `%s'" localname result) + result)))) + + ;; Preserve trailing "/". + (if (string-equal (file-name-nondirectory filename) "") "/" ""))) (defun tramp-adb-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." @@ -483,14 +491,12 @@ (tramp-adb-barf-unless-okay v (format "mkdir %s" (tramp-shell-quote-argument localname)) "Couldn't make directory %s" dir) - (tramp-flush-directory-property v (file-name-directory localname)))) + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-directory-property v localname))) (defun tramp-adb-handle-delete-directory (directory &optional recursive) "Like `delete-directory' for Tramp files." (setq directory (expand-file-name directory)) - (with-parsed-tramp-file-name (file-truename directory) nil - (tramp-flush-file-property v (file-name-directory localname)) - (tramp-flush-directory-property v localname)) (with-parsed-tramp-file-name directory nil (tramp-flush-file-property v (file-name-directory localname)) (tramp-flush-directory-property v localname) @@ -621,9 +627,8 @@ "Like `set-file-modes' for Tramp files." (with-parsed-tramp-file-name filename nil (tramp-flush-file-property v localname) - (tramp-adb-barf-unless-okay - v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname) - "Error while changing file's mode %s" filename))) + (tramp-adb-send-command-and-check + v (format "chmod %s %s" (tramp-compat-decimal-to-octal mode) localname)))) (defun tramp-adb-handle-set-file-times (filename &optional time) "Like `set-file-times' for Tramp files." === modified file 'lisp/net/tramp-cache.el' --- lisp/net/tramp-cache.el 2014-01-01 07:43:34 +0000 +++ lisp/net/tramp-cache.el 2014-02-28 08:41:24 +0000 @@ -168,7 +168,7 @@ ;;;###tramp-autoload (defun tramp-flush-file-property (key file) "Remove all properties of FILE in the cache context of KEY." - ;; Remove file property of symlinks. + ;; Remove file properties of symlinks. (let ((truename (tramp-get-file-property key file "file-truename" nil))) (when (and (stringp truename) (not (string-equal file truename))) @@ -183,8 +183,13 @@ (defun tramp-flush-directory-property (key directory) "Remove all properties of DIRECTORY in the cache context of KEY. Remove also properties of all files in subdirectories." - (let ((directory (tramp-run-real-handler - 'directory-file-name (list directory)))) + (let* ((directory (tramp-run-real-handler + 'directory-file-name (list directory))) + (truename (tramp-get-file-property key directory "file-truename" nil))) + ;; Remove file properties of symlinks. + (when (and (stringp truename) + (not (string-equal directory truename))) + (tramp-flush-directory-property key truename)) (tramp-message key 8 "%s" directory) (maphash (lambda (key _value) ------------------------------------------------------------ revno: 116602 fixes bug: http://debbugs.gnu.org/16781 author: Per Starbäck committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 22:51:04 -0800 message: * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Update required/optional fields to match development biblatex. (Trivial change that does not merit a :version bump.) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 06:44:49 +0000 +++ lisp/ChangeLog 2014-02-28 06:51:04 +0000 @@ -1,3 +1,8 @@ +2014-02-28 Per Starbäck + + * textmodes/bibtex.el (bibtex-biblatex-entry-alist): Update + required/optional fields to match development biblatex. (Bug#16781) + 2014-02-28 Andy Sawyer (tiny change) * saveplace.el (toggle-save-place): === modified file 'lisp/textmodes/bibtex.el' --- lisp/textmodes/bibtex.el 2014-01-01 07:43:34 +0000 +++ lisp/textmodes/bibtex.el 2014-02-28 06:51:04 +0000 @@ -546,9 +546,9 @@ ("location") ("isbn") ("pagetotal") ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate"))) ("InCollection" "Article in a Collection" - (("author") ("editor") ("title") ("year" nil nil 0) ("date" nil nil 0)) + (("author") ("title") ("year" nil nil 0) ("date" nil nil 0)) (("booktitle")) - (("editora") ("editorb") ("editorc") ("translator") ("annotator") + (("editor") ("editora") ("editorb") ("editorc") ("translator") ("annotator") ("commentator") ("introduction") ("foreword") ("afterword") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") ("maintitleaddon") ("booksubtitle") ("booktitleaddon") @@ -616,10 +616,11 @@ ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate"))) ("Proceedings" "Single-Volume Conference Proceedings" - (("editor") ("title") ("year" nil nil 0) ("date" nil nil 0)) + (("title") ("year" nil nil 0) ("date" nil nil 0)) nil (("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") ("maintitleaddon") ("eventtitle") ("eventdate") ("venue") ("language") + ("editor") ("volume") ("part") ("volumes") ("series") ("number") ("note") ("organization") ("publisher") ("location") ("month") ("isbn") ("chapter") ("pages") ("pagetotal") ("addendum") ("pubstate") @@ -633,9 +634,9 @@ ("isbn") ("pagetotal") ("addendum") ("pubstate") ("doi") ("eprint") ("eprintclass") ("eprinttype") ("url") ("urldate"))) ("InProceedings" "Article in Conference Proceedings" - (("author") ("editor") ("title") ("year" nil nil 0) ("date" nil nil 0)) + (("author") ("title") ("year" nil nil 0) ("date" nil nil 0)) (("booktitle")) - (("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") + (("editor") ("subtitle") ("titleaddon") ("maintitle") ("mainsubtitle") ("maintitleaddon") ("booksubtitle") ("booktitleaddon") ("eventtitle") ("eventdate") ("venue") ("language") ("volume") ("part") ("volumes") ("series") ("number") ("note") ------------------------------------------------------------ revno: 116601 fixes bug: http://debbugs.gnu.org/16673 author: Andy Sawyer committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 22:44:49 -0800 message: * lisp/saveplace.el (toggle-save-place): Fix argument handling (tiny change) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 05:29:45 +0000 +++ lisp/ChangeLog 2014-02-28 06:44:49 +0000 @@ -1,3 +1,8 @@ +2014-02-28 Andy Sawyer (tiny change) + + * saveplace.el (toggle-save-place): + Fix argument handling. (Bug#16673) + 2014-02-28 Glenn Morris * minibuffer.el (completions-first-difference) === modified file 'lisp/saveplace.el' --- lisp/saveplace.el 2014-02-21 00:35:08 +0000 +++ lisp/saveplace.el 2014-02-28 06:44:49 +0000 @@ -155,12 +155,12 @@ (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode) dired-directory))) (message "Buffer `%s' not visiting a file or directory" (buffer-name)) - (if (and save-place (or (not parg) (<= parg 0))) - (progn - (message "No place will be saved in this file") - (setq save-place nil)) - (message "Place will be saved") - (setq save-place t)))) + (setq save-place (if parg + (> (prefix-numeric-value parg) 0) + (not save-place))) + (message (if save-place + "Place will be saved" + "No place will be saved in this file")))) (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep)) ------------------------------------------------------------ revno: 116600 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 22:33:23 -0800 message: * doc/misc/info.texi (Help-Xref): Add submenu. This placates makeinfo 5.2, which otherwise actually emits a warning; surely a flagrant breach of the makeinfo philosophy...? diff: === modified file 'doc/misc/info.texi' --- doc/misc/info.texi 2014-02-28 06:25:47 +0000 +++ doc/misc/info.texi 2014-02-28 06:33:23 +0000 @@ -809,6 +809,11 @@ @end format +@menu +* Help-Cross:: Target of a cross-reference. +@end menu + + @node Help-Cross, , , Help-Xref @subsection The node reached by the cross reference in Info ------------------------------------------------------------ revno: 116599 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 22:25:47 -0800 message: Remove no-longer-relevant text about writing Info nodes by hand Ref: http://lists.gnu.org/archive/html/emacs-devel/2014-02/msg00359.html * doc/misc/info.texi (Further Reading): Rename node from Expert Info. Remove stuff about writing Info nodes by hand. (Help-Cross): Move node from (mainly deleted) chapter 3 to chapter 1. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-02-28 06:14:07 +0000 +++ doc/misc/ChangeLog 2014-02-28 06:25:47 +0000 @@ -1,5 +1,9 @@ 2014-02-28 Glenn Morris + * info.texi (Further Reading): Rename node from Expert Info. + Remove stuff about writing Info nodes by hand. + (Help-Cross): Move node from (mainly deleted) chapter 3 to chapter 1. + * info.texi: Nuke hand-written node pointers. 2014-02-28 Karl Berry === modified file 'doc/misc/info.texi' --- doc/misc/info.texi 2014-02-28 06:14:07 +0000 +++ doc/misc/info.texi 2014-02-28 06:25:47 +0000 @@ -79,7 +79,7 @@ @menu * Getting Started:: Getting started using an Info reader. * Advanced:: Advanced Info commands. -* Expert Info:: Info commands for experts. +* Further Reading:: Where to learn more about Info files. * GNU Free Documentation License:: The license for this documentation. * Index:: An index of topics, commands, and variables. @end menu @@ -89,9 +89,8 @@ This first part of this Info manual describes how to get around inside of Info. The second part of the manual describes various advanced -Info commands. The third part briefly explains how to generate Info -files from Texinfo files, and describes how to write an Info file -by hand. +Info commands. The third part contains references to other sources, +which explain how to generate Info files from Texinfo files. @ifnotinfo This manual is primarily designed for browsing with an Info reader @@ -809,6 +808,24 @@ >> Now type @kbd{n} to learn more commands. @end format + +@node Help-Cross, , , Help-Xref +@subsection The node reached by the cross reference in Info + + This is the node reached by the cross reference named @samp{Cross}. + + While this node is specifically intended to be reached by a cross +reference, most cross references lead to nodes that ``belong'' +someplace else far away in the structure of an Info document. So you +cannot expect this node to have a @samp{Next}, @samp{Previous} or +@samp{Up} links pointing back to where you came from. In general, the +@kbd{l} (el) command is the only way to get back there. + +@format +>> Type @kbd{l} to return to the node where the cross reference was. +@end format + + @node Help-Int @section Some intermediate Info commands @@ -1217,14 +1234,13 @@ @end vtable -@node Expert Info -@chapter Info for Experts +@node Further Reading +@chapter Further Reading @cindex Texinfo - This chapter explains how to write an Info file by hand. However, -in most cases, writing a Texinfo file is better, since you can use it -to make a printed manual or produce other formats, such as HTML and -DocBook, as well as for generating Info files. + Info files are created from Texinfo source files. You can use the +same source file to make a printed manual or produce other formats, +such as HTML and DocBook. The @code{makeinfo} command converts a Texinfo file into an Info file; @code{texinfo-format-region} and @code{texinfo-format-buffer} are GNU @@ -1240,250 +1256,6 @@ Documentation Format}, for how to install an Info file after you have created one. -However, if you want to edit an Info file manually and install it manually, -here is how. - -@menu -* Add:: Describes how to add new nodes to the hierarchy. - Also tells what nodes look like. -* Menus:: How to add to or create menus in Info nodes. -* Cross-refs:: How to add cross-references to Info nodes. -* Tags:: How to make tags tables for Info files. -* Checking:: Checking an Info File. -@end menu - -@node Add -@section Adding a new node to Info - -To add a new topic to the list in the Info directory, you must: - -@enumerate -@item -Create some nodes, in some file, to document that topic. -@item -Put that topic in the menu in the directory. @xref{Menus, Menu}. -@end enumerate - -@cindex node delimiters - The new node can live in an existing documentation file, or in a new -one. It must have a @samp{^_} character before it (invisible to the -user; this node has one but you cannot see it), and it ends with either -a @samp{^_}, a @samp{^L} (``formfeed''), or the end of file.@footnote{If -you put in a @samp{^L} to end a new node, be sure that there is a -@samp{^_} after it to start the next one, since @samp{^L} cannot -@emph{start} a node. Also, a nicer way to make a node boundary be a -page boundary as well is to put a @samp{^L} @emph{right after} the -@samp{^_}.} - - The @samp{^_} starting a node must be followed by a newline or a -@samp{^L} newline, after which comes the node's header line. The -header line must give the node's name (by which Info finds it), and -state the names of the @samp{Next}, @samp{Previous}, and @samp{Up} -nodes (if there are any). As you can see, this node's @samp{Up} node -is the node @samp{Expert Info}. The @samp{Next} node is @samp{Menus}. - -@cindex node header line format -@cindex format of node headers - The keywords @dfn{Node}, @dfn{Next}, @dfn{Previous}, and @dfn{Up} -may appear in any order, anywhere in the header line, but the -recommended order is the one in this sentence. Each keyword must be -followed by a colon, spaces and tabs, and then the appropriate name. -The name may be terminated with a tab, a comma, or a newline. A space -does not end it; node names may contain spaces. The case of letters -in the names is insignificant. - -@cindex node name format -@cindex Directory node - A node name has two forms. A node in the current file is named by -what appears after the @samp{Node: } in that node's first line. For -example, this node's name is @samp{Add}. A node in another file is -named by @samp{(@var{filename})@var{node-within-file}}, as in -@samp{(info)Add} for this node. If the file name starts with @samp{./}, -then it is relative to the current directory; otherwise, it is -relative starting from the standard directory for Info files of your -site. The name @samp{(@var{filename})Top} can be abbreviated to just -@samp{(@var{filename})}. By convention, the name @samp{Top} is used -for the ``highest'' node in any single file---the node whose @samp{Up} -points out of the file. The @samp{Directory} node is @file{(dir)}, it -points to a file @file{dir} which holds a large menu listing all the -Info documents installed on your site. The @samp{Top} node of a -document file listed in the @samp{Directory} should have an @samp{Up: -(dir)} in it. - -@cindex unstructured documents - The node name @kbd{*} is special: it refers to the entire file. -Thus, @kbd{g*} shows you the whole current file. The use of the -node @kbd{*} is to make it possible to make old-fashioned, -unstructured files into nodes of the tree. - - The @samp{Node:} name, in which a node states its own name, must not -contain a file name, since when Info searches for a node, it does not -expect a file name to be there. The @samp{Next}, @samp{Previous} and -@samp{Up} names may contain them. In this node, since the @samp{Up} -node is in the same file, it was not necessary to use one. - - Note that the nodes in this file have a file name in the header -line. The file names are ignored by Info, but they serve as comments -to help identify the node for the user. - -@node Menus -@section How to Create Menus - - Any node in the Info hierarchy may have a @dfn{menu}---a list of subnodes. -The @kbd{m} command searches the current node's menu for the topic which it -reads from the terminal. - -@cindex menu and menu entry format - A menu begins with a line starting with @w{@samp{* Menu:}}. The -rest of the line is a comment. After the starting line, every line -that begins with a @samp{* } lists a single topic. The name of the -topic---what the user must type at the @kbd{m}'s command prompt to -select this topic---comes right after the star and space, and is -followed by a colon, spaces and tabs, and the name of the node which -discusses that topic. The node name, like node names following -@samp{Next}, @samp{Previous} and @samp{Up}, may be terminated with a -tab, comma, or newline; it may also be terminated with a period. - - If the node name and topic name are the same, then rather than -giving the name twice, the abbreviation @samp{* @var{name}::} may be -used (and should be used, whenever possible, as it reduces the visual -clutter in the menu). - - It is considerate to choose the topic names so that they differ -from each other very near the beginning---this allows the user to type -short abbreviations. In a long menu, it is a good idea to capitalize -the beginning of each item name which is the minimum acceptable -abbreviation for it (a long menu is more than 5 or so entries). - - The nodes listed in a node's menu are called its ``subnodes,'' and it -is their ``superior''. They should each have an @samp{Up:} pointing at -the superior. It is often useful to arrange all or most of the subnodes -in a sequence of @samp{Next} and @samp{Previous} pointers so that -someone who wants to see them all need not keep revisiting the Menu. - - The Info Directory is simply the menu of the node @samp{(dir)Top}---that -is, node @samp{Top} in file @file{.../info/dir}. You can put new entries -in that menu just like any other menu. The Info Directory is @emph{not} the -same as the file directory called @file{info}. It happens that many of -Info's files live in that file directory, but they do not have to; and -files in that directory are not automatically listed in the Info -Directory node. - - Also, although the Info node graph is claimed to be a ``hierarchy,'' -in fact it can be @emph{any} directed graph. Shared structures and -pointer cycles are perfectly possible, and can be used if they are -appropriate to the meaning to be expressed. There is no need for all -the nodes in a file to form a connected structure. In fact, this file -has two connected components. You are in one of them, which is under -the node @samp{Top}; the other contains the node @samp{Help} which the -@kbd{h} command goes to. In fact, since there is no garbage -collector on the node graph, nothing terrible happens if a substructure -is not pointed to, but such a substructure is rather useless since nobody -can ever find out that it exists. - -@node Cross-refs -@section Creating Cross References - -@cindex cross reference format - A cross reference can be placed anywhere in the text, unlike a menu -item which must go at the front of a line. A cross reference looks -like a menu item except that it has @samp{*note} instead of @samp{*}. -It @emph{cannot} be terminated by a @samp{)}, because @samp{)}'s are -so often part of node names. If you wish to enclose a cross reference -in parentheses, terminate it with a period first. Here are two -examples of cross references pointers: - -@example -*Note details: commands. (See *note 3: Full Proof.) -@end example - -@noindent -@emph{These are just examples.} The places they ``lead to'' do not -really exist! - -@menu -* Help-Cross:: Target of a cross-reference. -@end menu - - -@node Help-Cross -@subsection The node reached by the cross reference in Info - - This is the node reached by the cross reference named @samp{Cross}. - - While this node is specifically intended to be reached by a cross -reference, most cross references lead to nodes that ``belong'' -someplace else far away in the structure of an Info document. So you -cannot expect this node to have a @samp{Next}, @samp{Previous} or -@samp{Up} links pointing back to where you came from. In general, the -@kbd{l} (el) command is the only way to get back there. - -@format ->> Type @kbd{l} to return to the node where the cross reference was. -@end format - -@node Tags -@section Tags Tables for Info Files - -@cindex tags tables in Info files - You can speed up the access to nodes of a large Info file by giving -it a tags table. Unlike the tags table for a program, the tags table for -an Info file lives inside the file itself and is used -automatically whenever Info reads in the file. - -@findex Info-tagify - To make a tags table, go to a node in the file using Emacs Info mode and type -@kbd{M-x Info-tagify}. Then you must use @kbd{C-x C-s} to save the -file. Info files produced by the @code{makeinfo} command that is part -of the Texinfo package always have tags tables to begin with. - -@cindex stale tags tables -@cindex update Info tags table - Once the Info file has a tags table, you must make certain it is up -to date. If you edit an Info file directly (as opposed to editing its -Texinfo source), and, as a result of deletion of text, any node moves back -more than a thousand characters in the file from the position -recorded in the tags table, Info will no longer be able to find that -node. To update the tags table, use the @code{Info-tagify} command -again. - - An Info file tags table appears at the end of the file and looks like -this: - -@example -^_^L -Tag Table: -File: info, Node: Cross-refs^?21419 -File: info, Node: Tags^?22145 -^_ -End Tag Table -@end example - -@noindent -Note that it contains one line per node, and this line contains -the beginning of the node's header (ending just after the node name), -a @samp{DEL} character, and the character position in the file of the -beginning of the node. - -@node Checking -@section Checking an Info File - -When creating an Info file, it is easy to forget the name of a node when -you are making a pointer to it from another node. If you put in the -wrong name for a node, this is not detected until someone tries to go -through the pointer using Info. Verification of the Info file is an -automatic process which checks all pointers to nodes and reports any -pointers which are invalid. Every @samp{Next}, @samp{Previous}, and -@samp{Up} is checked, as is every menu item and every cross reference. In -addition, any @samp{Next} which does not have a @samp{Previous} pointing -back is reported. Only pointers within the file are checked, because -checking pointers to other files would be terribly slow. But those are -usually few. - -@findex Info-validate -To check an Info file, do @kbd{M-x Info-validate} while looking at any -node of the file with Emacs Info mode. - @node GNU Free Documentation License @appendix GNU Free Documentation License @include doclicense.texi ------------------------------------------------------------ revno: 116598 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 22:14:07 -0800 message: * doc/misc/info.texi: Nuke hand-written node pointers. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-02-28 02:13:56 +0000 +++ doc/misc/ChangeLog 2014-02-28 06:14:07 +0000 @@ -1,3 +1,7 @@ +2014-02-28 Glenn Morris + + * info.texi: Nuke hand-written node pointers. + 2014-02-28 Karl Berry * info.texi (Top): Mention H for a summary of all commands. === modified file 'doc/misc/info.texi' --- doc/misc/info.texi 2014-02-28 02:13:56 +0000 +++ doc/misc/info.texi 2014-02-28 06:14:07 +0000 @@ -84,8 +84,7 @@ * Index:: An index of topics, commands, and variables. @end menu -@node Getting Started, Advanced, Top, Top -@comment node-name, next, previous, up +@node Getting Started @chapter Getting Started This first part of this Info manual describes how to get around inside @@ -218,8 +217,7 @@ the course. @end ifinfo -@node Help, Help-P, Help-Small-Screen, Getting Started -@comment node-name, next, previous, up +@node Help @section How to use Info You are talking to the program Info, for reading documentation. @@ -265,8 +263,7 @@ mouse button on the @samp{Next} link to do the same ``the mouse way''. @end format -@node Help-P, Help-^L, Help, Getting Started -@comment node-name, next, previous, up +@node Help-P @section Returning to the Previous node @kindex p @r{(Info mode)} @@ -298,8 +295,7 @@ the @samp{Next} link, to get to the node @samp{Help-^L} and learn more. @end format -@node Help-^L, Help-Inv, Help-P, Getting Started -@comment node-name, next, previous, up +@node Help-^L @section The Space, DEL, B and ^L commands This node's mode line tells you that you are now at node @@ -423,8 +419,7 @@ to visit the next node. @end format -@node Help-Inv, Help-M, Help-^L, Getting Started -@comment node-name, next, previous, up +@node Help-Inv @section Invisible text in Emacs Info Before discussing menus, we need to make some remarks that are only @@ -494,8 +489,7 @@ Now type @kbd{]} to go to the next node and learn about menus. -@node Help-M, Help-Xref, Help-Inv, Getting Started -@comment node-name, next, previous, up +@node Help-M @section Menus and the @kbd{m} command @cindex menus in an Info document @@ -733,8 +727,7 @@ >> Now type @kbd{u} to move back up to @samp{Help-M}. @end format -@node Help-Xref, Help-Int, Help-M, Getting Started -@comment node-name, next, previous, up +@node Help-Xref @section Following Cross-References @cindex cross references in Info documents @@ -816,8 +809,7 @@ >> Now type @kbd{n} to learn more commands. @end format -@node Help-Int, Help-Q, Help-Xref, Getting Started -@comment node-name, next, previous, up +@node Help-Int @section Some intermediate Info commands The introductory course is almost over; please continue @@ -906,8 +898,7 @@ @c If a menu appears at the end of this node, remove it. @c It is an accident of the menu updating command. -@node Help-Q, , Help-Int, Getting Started -@comment node-name, next, previous, up +@node Help-Q @section Quitting Info @kindex q @r{(Info mode)} @@ -966,8 +957,7 @@ @end menu -@node Search Text, Search Index, , Advanced -@comment node-name, next, previous, up +@node Search Text @section @kbd{s} searches Info documents @cindex searching Info documents @@ -1008,8 +998,7 @@ by setting the variable @code{Info-isearch-search} to @code{nil} (@pxref{Emacs Info Variables}). -@node Search Index, Go to node, Search Text, Advanced -@comment node-name, next, previous, up +@node Search Index @section @kbd{i} searches the indices for specific subjects @cindex searching Info indices @@ -1061,8 +1050,7 @@ a string and then looks up that string in all the indices of all the Info documents installed on your system. -@node Go to node, Choose menu subtopic, Search Index, Advanced -@comment node-name, next, previous, up +@node Go to node @section @kbd{g} goes to a node by name @kindex g @r{(Info mode)} @@ -1089,8 +1077,7 @@ all of the current file by typing @kbd{g*@key{RET}} or all of any other file with @kbd{g(@var{filename})*@key{RET}}. -@node Choose menu subtopic, Create Info buffer, Go to node, Advanced -@comment node-name, next, previous, up +@node Choose menu subtopic @section @kbd{1}--@kbd{9} choose a menu subtopic by its number @kindex 1 @r{through} 9 @r{(Info mode)} @@ -1115,8 +1102,7 @@ @kbd{m} instead, and specify the name, or use @key{TAB} to quickly move between menu items. -@node Create Info buffer, Emacs Info Variables, Choose menu subtopic, Advanced -@comment node-name, next, previous, up +@node Create Info buffer @section @kbd{M-n} creates a new independent Info buffer in Emacs @kindex M-n @r{(Info mode)} @@ -1145,8 +1131,7 @@ use the command @kbd{M-x info-display-manual} to show an Info manual by name, reusing an existing buffer if there is one. -@node Emacs Info Variables, , Create Info buffer, Advanced -@comment node-name, next, previous, up +@node Emacs Info Variables @section Emacs Info-mode Variables The following variables may modify the behavior of Info-mode in Emacs; @@ -1267,8 +1252,7 @@ * Checking:: Checking an Info File. @end menu -@node Add, Menus, , Expert Info -@comment node-name, next, previous, up +@node Add @section Adding a new node to Info To add a new topic to the list in the Info directory, you must: @@ -1342,8 +1326,7 @@ line. The file names are ignored by Info, but they serve as comments to help identify the node for the user. -@node Menus, Cross-refs, Add, Expert Info -@comment node-name, next, previous, up +@node Menus @section How to Create Menus Any node in the Info hierarchy may have a @dfn{menu}---a list of subnodes. @@ -1398,8 +1381,7 @@ is not pointed to, but such a substructure is rather useless since nobody can ever find out that it exists. -@node Cross-refs, Tags, Menus, Expert Info -@comment node-name, next, previous, up +@node Cross-refs @section Creating Cross References @cindex cross reference format @@ -1424,7 +1406,7 @@ @end menu -@node Help-Cross, , , Cross-refs +@node Help-Cross @subsection The node reached by the cross reference in Info This is the node reached by the cross reference named @samp{Cross}. @@ -1440,8 +1422,7 @@ >> Type @kbd{l} to return to the node where the cross reference was. @end format -@node Tags, Checking, Cross-refs, Expert Info -@comment node-name, next, previous, up +@node Tags @section Tags Tables for Info Files @cindex tags tables in Info files @@ -1484,7 +1465,7 @@ a @samp{DEL} character, and the character position in the file of the beginning of the node. -@node Checking, , Tags, Expert Info +@node Checking @section Checking an Info File When creating an Info file, it is easy to forget the name of a node when ------------------------------------------------------------ revno: 116597 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 21:35:53 -0800 message: * etc/NEWS: Minor edit diff: === modified file 'etc/NEWS' --- etc/NEWS 2014-02-28 04:15:21 +0000 +++ etc/NEWS 2014-02-28 05:35:53 +0000 @@ -1192,13 +1192,12 @@ The default `crm-separator' has been changed to allow surrounding spaces around the comma. ---- ++++ *** The `common-substring' argument of `display-completion-list', which has been documented as obsolete since Emacs 23.1, is now _really_ -obsolete, and no longer advertised. Instead use either -`completion-all-completions', which returns highlighted strings (including -for partial or substring completion), or call `completion-hilit-commonality' -to add the highlight. +obsolete, and no longer advertised. Instead either call +`completion-hilit-commonality' to add the highlighting; or use +`completion-all-completions', which returns highlighted strings. +++ *** New function `completion-table-with-cache' is a wrapper for ------------------------------------------------------------ revno: 116596 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 21:30:28 -0800 message: * doc/emacs/custom.texi: Typo fix. diff: === modified file 'doc/emacs/custom.texi' --- doc/emacs/custom.texi 2014-02-25 08:41:47 +0000 +++ doc/emacs/custom.texi 2014-02-28 05:30:28 +0000 @@ -573,7 +573,7 @@ which are distributed with Emacs, which customize Emacs's faces to fit various color schemes. (Note, however, that Custom themes need not be restricted to this purpose; they can be used to customize variables -too). +too.) @vindex custom-theme-load-path If you want Emacs to look for Custom themes in some other directory, ------------------------------------------------------------ revno: 116595 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 21:29:45 -0800 message: Some doc fixes for completion-hilit-commonality and friends * lisp/minibuffer.el (completions-first-difference) (completions-common-part, completion-hilit-commonality): Doc fixes. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 02:13:56 +0000 +++ lisp/ChangeLog 2014-02-28 05:29:45 +0000 @@ -1,3 +1,8 @@ +2014-02-28 Glenn Morris + + * minibuffer.el (completions-first-difference) + (completions-common-part, completion-hilit-commonality): Doc fixes. + 2014-02-28 Karl Berry * info.el (Info-mode-map): Add H for describe-mode, === modified file 'lisp/minibuffer.el' --- lisp/minibuffer.el 2014-02-27 08:01:22 +0000 +++ lisp/minibuffer.el 2014-02-28 05:29:45 +0000 @@ -1576,15 +1576,26 @@ (defface completions-first-difference '((t (:inherit bold))) - "Face added on the first uncommon character in completions in *Completions* buffer.") + "Face for the first uncommon character in completions. +See also the face `completions-common-part'.") (defface completions-common-part '((t nil)) - "Face added on the common prefix substring in completions in *Completions* buffer. -The idea of `completions-common-part' is that you can use it to -make the common parts less visible than normal, so that the rest -of the differing parts is, by contrast, slightly highlighted.") + "Face for the common prefix substring in completions. +The idea of this face is that you can use it to make the common parts +less visible than normal, so that the differing parts are emphasized +by contrast. +See also the face `completions-first-difference'.") (defun completion-hilit-commonality (completions prefix-len base-size) + "Apply font-lock highlighting to a list of completions, COMPLETIONS. +PREFIX-LEN is an integer. BASE-SIZE is an integer or nil (meaning zero). + +This adds the face `completions-common-part' to the first +\(PREFIX-LEN - BASE-SIZE) characters of each completion, and the face +`completions-first-difference' to the first character after that. + +It returns a list with font-lock properties applied to each element, +and with BASE-SIZE appended as the last element." (when completions (let ((com-str-len (- prefix-len (or base-size 0)))) (nconc ------------------------------------------------------------ revno: 116594 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Fri 2014-02-28 12:17:11 +0800 message: Doc fix for `face-spec-set'. * doc/lispref/display.texi (Defining Faces): Doc fix for `face-spec-set'. * etc/NEWS: Copyedit. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-02-28 01:49:25 +0000 +++ doc/lispref/ChangeLog 2014-02-28 04:15:21 +0000 @@ -1,5 +1,7 @@ 2014-02-28 Xue Fuqiao + * display.texi (Defining Faces): Doc fix for `face-spec-set'. + * elisp.texi (Top): * commands.texi (Generic Commands): (Defining Commands): Document `define-alternatives'. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2014-02-27 14:09:26 +0000 +++ doc/lispref/display.texi 2014-02-28 04:15:21 +0000 @@ -2359,16 +2359,20 @@ @var{spec} should be a face spec, as described in the above documentation for @code{defface}. +This function also defines @var{face} as a valid face name if it is +not already one, and (re)calculates its attributes on existing frames. + @cindex override spec @r{(for a face)} The argument @var{spec-type} determines which spec to set. If it is @code{nil} or @code{face-override-spec}, this function sets the @dfn{override spec}, which overrides over all other face specs on -@var{face}. If it is @code{face-defface-spec}, this function sets the -default face spec (the same one set by @code{defface}). If it is -@code{reset}, this function clears out all customization specs and -override specs from @var{face} (in this case, the value of @var{spec} -is ignored). Any other value of @var{spec-type} is reserved for -internal use. +@var{face}. If it is @code{customized-face} or @code{saved-face}, +this function sets the customized spec or the saved custom spec. If +it is @code{face-defface-spec}, this function sets the default face +spec (the same one set by @code{defface}). If it is @code{reset}, +this function clears out all customization specs and override specs +from @var{face} (in this case, the value of @var{spec} is ignored). +Any other value of @var{spec-type} is reserved for internal use. @end defun @node Attribute Functions === modified file 'etc/NEWS' --- etc/NEWS 2014-02-28 03:02:50 +0000 +++ etc/NEWS 2014-02-28 04:15:21 +0000 @@ -278,6 +278,13 @@ `display-buffer' choose or make a window at the bottom of the selected frame. +*** New display action function `display-buffer-no-window' to not +display the buffer in a window. + +*** New display action alist entry `allow-no-window' to indicate the +caller of `display-buffer' is ready to handle the case of not +displaying the buffer in a window. + ** Lisp evaluation changes +++ *** `eval-defun' on an already defined defcustom calls the :set function, @@ -1224,15 +1231,6 @@ *** The hook `term-setup-hook' is obsolete. It is entirely equivalent to `emacs-startup-hook'. See also the new `tty-setup-hook'. -** Window Handling - -*** New display action function `display-buffer-no-window' to not -display the buffer in a window. - -*** New display action alist entry `allow-no-window' to indicate the -caller of `display-buffer' is ready to handle the case of not -displaying the buffer in a window. - ** New hook `pre-redisplay-function'. +++ @@ -1353,6 +1351,7 @@ ** Face changes ++++ *** The function `face-spec-set' is now like `setq' for face specs. Its third arg now accepts values specifying a face spec type (defface, custom, or override spec), and the relevant spec is set accordingly. ------------------------------------------------------------ revno: 116593 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Fri 2014-02-28 11:04:12 +0800 message: Document `prettify-symbols-mode' and `global-prettify-symbols-mode'. * doc/emacs/emacs.texi (Top): * doc/emacs/programs.texi (Programs, Prettifying Symbols): Document `prettify-symbols-mode' and `global-prettify-symbols-mode'. * etc/NEWS: Markup changes. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-02-28 01:05:49 +0000 +++ doc/emacs/ChangeLog 2014-02-28 03:02:50 +0000 @@ -1,5 +1,9 @@ 2014-02-28 Xue Fuqiao + * emacs.texi (Top): + * programs.texi (Programs, Prettifying Symbols): + Document `prettify-symbols-mode' and `global-prettify-symbols-mode'. + * misc.texi (Saving Emacs Sessions): Document some new desktop user options. 2014-02-27 Xue Fuqiao === modified file 'doc/emacs/emacs.texi' --- doc/emacs/emacs.texi 2014-02-09 02:08:17 +0000 +++ doc/emacs/emacs.texi 2014-02-28 03:02:50 +0000 @@ -670,6 +670,7 @@ * Symbol Completion:: Completion on symbol names of your program or language. * MixedCase Words:: Dealing with identifiersLikeThis. * Semantic:: Suite of editing tools based on source code parsing. +* Prettifying Symbols:: Display symbols as composed characters. * Misc for Programs:: Other Emacs features useful for editing programs. * C Modes:: Special commands of C, C++, Objective-C, Java, IDL, Pike and AWK modes. === modified file 'doc/emacs/programs.texi' --- doc/emacs/programs.texi 2014-02-27 11:59:35 +0000 +++ doc/emacs/programs.texi 2014-02-28 03:02:50 +0000 @@ -38,6 +38,7 @@ * Symbol Completion:: Completion on symbol names of your program or language. * MixedCase Words:: Dealing with identifiersLikeThis. * Semantic:: Suite of editing tools based on source code parsing. +* Prettifying Symbols:: Display symbols as composed characters. * Misc for Programs:: Other Emacs features useful for editing programs. * C Modes:: Special commands of C, C++, Objective-C, Java, IDL, Pike and AWK modes. @@ -1432,6 +1433,37 @@ @xref{Top, Semantic,, semantic, Semantic}, for details. @end ifnottex +@node Prettifying Symbols +@section Prettifying Symbols +@cindex prettifying symbols +@cindex symbol, prettifying + +@code{prettify-symbols-mode} and @code{global-prettify-symbols-mode} +are two minor modes (@pxref{Minor Modes}) that can display specified +symbols as composed characters. For instance, in Emacs Lisp mode +(@pxref{Lisp Eval}), this mode will replace the string ``lambda'' with +the Greek lambda character. + +@findex prettify-symbols-mode +@vindex prettify-symbols-alist +When Prettify Symbols mode and Font Lock mode (@pxref{Font Lock}) are +enabled, symbols are prettified (displayed as composed characters) +according to the rules in @code{prettify-symbols-alist}, which are +locally defined by major modes (@pxref{Major Modes}) supporting +prettifying. To add further customizations for a given major mode, +you can modify @code{prettify-symbols-alist}. For example: + +@example +(add-hook 'emacs-lisp-mode-hook + (lambda () + (push '("<=" . ?≤) prettify-symbols-alist))) +@end example + +@findex global-prettify-symbols-mode +You can enable this mode locally in desired buffers, or use +@code{global-prettify-symbols-mode} to enable it for all modes that +support it. + @node Misc for Programs @section Other Features Useful for Editing Programs === modified file 'etc/NEWS' --- etc/NEWS 2014-02-28 01:49:25 +0000 +++ etc/NEWS 2014-02-28 03:02:50 +0000 @@ -1185,6 +1185,7 @@ The default `crm-separator' has been changed to allow surrounding spaces around the comma. +--- *** The `common-substring' argument of `display-completion-list', which has been documented as obsolete since Emacs 23.1, is now _really_ obsolete, and no longer advertised. Instead use either @@ -1200,6 +1201,7 @@ *** New function `completion-table-merge' to combine several completion tables by merging their completions. ++++ ** New minor modes `prettify-symbols-mode' and `global-prettify-symbols-mode' display specified symbols as composed characters. E.g., in Emacs Lisp mode, this replaces the string "lambda" with the Greek lambda character. ------------------------------------------------------------ revno: 116592 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 21:16:02 -0500 message: * info.el: Comment. diff: === modified file 'lisp/info.el' --- lisp/info.el 2014-02-28 02:13:56 +0000 +++ lisp/info.el 2014-02-28 02:16:02 +0000 @@ -3962,6 +3962,9 @@ (define-key map "f" 'Info-follow-reference) (define-key map "g" 'Info-goto-node) (define-key map "h" 'Info-help) + ;; This is for compatibility with standalone info (>~ version 5.2). + ;; Though for some time, standalone info had H and h reversed. + ;; See . (define-key map "H" 'describe-mode) (define-key map "i" 'Info-index) (define-key map "I" 'Info-virtual-index) ------------------------------------------------------------ revno: 116591 author: Karl Berry committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 21:13:56 -0500 message: Add H binding to info, for compatibility with standalone info Ref: http://lists.gnu.org/archive/html/emacs-devel/2014-02/msg00309.html * lisp/info.el (Info-mode-map): Add H for describe-mode, to synchronize with standalone Info. * doc/misc/info.texi (Top): Mention H for a summary of all commands. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2014-02-25 08:41:47 +0000 +++ doc/misc/ChangeLog 2014-02-28 02:13:56 +0000 @@ -1,3 +1,7 @@ +2014-02-28 Karl Berry + + * info.texi (Top): Mention H for a summary of all commands. + 2014-02-25 Glenn Morris * edt.texi (Quick start, Starting emulation): Update hook details. === modified file 'doc/misc/info.texi' --- doc/misc/info.texi 2014-01-06 05:25:46 +0000 +++ doc/misc/info.texi 2014-02-28 02:13:56 +0000 @@ -69,6 +69,8 @@ To read about advanced Info commands, type @kbd{n} twice. This brings you to @cite{Advanced Info Commands}, skipping over the `Getting Started' chapter. + +Type @kbd{H} to see a summary of all available commands. @end ifinfo @end ifnottex === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-28 01:55:12 +0000 +++ lisp/ChangeLog 2014-02-28 02:13:56 +0000 @@ -1,3 +1,8 @@ +2014-02-28 Karl Berry + + * info.el (Info-mode-map): Add H for describe-mode, + to synchronize with standalone Info. + 2014-02-28 Emilio C. Lopes * progmodes/sql.el (sql-interactive-mode): === modified file 'lisp/info.el' --- lisp/info.el 2014-02-15 03:58:38 +0000 +++ lisp/info.el 2014-02-28 02:13:56 +0000 @@ -3962,6 +3962,7 @@ (define-key map "f" 'Info-follow-reference) (define-key map "g" 'Info-goto-node) (define-key map "h" 'Info-help) + (define-key map "H" 'describe-mode) (define-key map "i" 'Info-index) (define-key map "I" 'Info-virtual-index) (define-key map "l" 'Info-history-back) ------------------------------------------------------------ revno: 116590 fixes bug: http://debbugs.gnu.org/11565 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 21:00:17 -0500 message: * src/doc.c (Fsnarf_documentation): Snarf not-yet-bound variables from custom-delayed-init-variables. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-02-27 19:22:10 +0000 +++ src/ChangeLog 2014-02-28 02:00:17 +0000 @@ -1,3 +1,8 @@ +2014-02-28 Glenn Morris + + * doc.c (Fsnarf_documentation): Snarf not-yet-bound variables + from custom-delayed-init-variables. (Bug#11565) + 2014-02-27 Martin Rudalics More fixes for mouse glyph calculations (Bug#16647). === modified file 'src/doc.c' --- src/doc.c 2014-01-03 05:37:58 +0000 +++ src/doc.c 2014-02-28 02:00:17 +0000 @@ -1,7 +1,6 @@ /* Record indices of function doc strings stored in a file. -Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software Foundation, -Inc. +Copyright (C) 1985-1986, 1993-1995, 1997-2014 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -559,6 +558,12 @@ char *p, *name; bool skip_file = 0; ptrdiff_t count; + /* Preloaded defcustoms using custom-initialize-delay are added to + this list, but kept unbound. See http://debbugs.gnu.org/11565 */ + Lisp_Object delayed_init = + find_symbol_value (intern ("custom-delayed-init-variables")); + + if (EQ (delayed_init, Qunbound)) delayed_init = Qnil; CHECK_STRING (filename); @@ -656,7 +661,8 @@ /* Install file-position as variable-documentation property and make it negative for a user-variable (doc starts with a `*'). */ - if (!NILP (Fboundp (sym))) + if (!NILP (Fboundp (sym)) + || !NILP (Fmemq (sym, delayed_init))) Fput (sym, Qvariable_documentation, make_number ((pos + end + 1 - buf) * (end[1] == '*' ? -1 : 1))); ------------------------------------------------------------ revno: 116589 fixes bug: http://debbugs.gnu.org/16814 author: Emilio C. Lopes committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 20:55:12 -0500 message: * lisp/progmodes/sql.el (sql-interactive-mode): Avoid setting global value of comint-input-ring-separator. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-27 15:41:13 +0000 +++ lisp/ChangeLog 2014-02-28 01:55:12 +0000 @@ -1,3 +1,8 @@ +2014-02-28 Emilio C. Lopes + + * progmodes/sql.el (sql-interactive-mode): + Avoid setting global comint-input-ring-separator. (Bug#16814) + 2014-02-27 Michael Albinus * net/dbus.el (dbus--init-bus): Declare function. === modified file 'lisp/progmodes/sql.el' --- lisp/progmodes/sql.el 2014-02-15 22:50:45 +0000 +++ lisp/progmodes/sql.el 2014-02-28 01:55:12 +0000 @@ -3928,8 +3928,8 @@ ;; People wanting a different history file for each ;; buffer/process/client/whatever can change separator and file-name ;; on the sql-interactive-mode-hook. - (setq comint-input-ring-separator sql-input-ring-separator - comint-input-ring-file-name sql-input-ring-file-name) + (setq-local comint-input-ring-separator sql-input-ring-separator) + (setq comint-input-ring-file-name sql-input-ring-file-name) ;; Calling the hook before calling comint-read-input-ring allows users ;; to set comint-input-ring-file-name in sql-interactive-mode-hook. (comint-read-input-ring t)) ------------------------------------------------------------ revno: 116588 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Fri 2014-02-28 09:51:15 +0800 message: Document `define-alternatives'. * doc/lispref/elisp.texi (Top): * doc/lispref/commands.texi (Generic Commands): (Defining Commands): Document `define-alternatives'. * etc/NEWS: Related edit. Unrelated copyedit. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-02-27 14:09:26 +0000 +++ doc/lispref/ChangeLog 2014-02-28 01:49:25 +0000 @@ -1,3 +1,9 @@ +2014-02-28 Xue Fuqiao + + * elisp.texi (Top): + * commands.texi (Generic Commands): + (Defining Commands): Document `define-alternatives'. + 2014-02-27 Xue Fuqiao * windows.texi (Window Sizes): Document `window-size'. === modified file 'doc/lispref/commands.texi' --- doc/lispref/commands.texi 2014-02-09 04:19:52 +0000 +++ doc/lispref/commands.texi 2014-02-28 01:49:25 +0000 @@ -134,6 +134,7 @@ * Interactive Codes:: The standard letter-codes for reading arguments in various ways. * Interactive Examples:: Examples of how to read interactive arguments. +* Generic Commands:: Select among command alternatives. @end menu @node Using Interactive @@ -575,6 +576,39 @@ @end group @end example +@node Generic Commands +@subsection Select among Command Alternatives +@cindex generic commands +@cindex alternatives, defining + +The macro @code{define-alternatives} can be used to define +@dfn{generic commands}. Generic commands are interactive functions +whose implementation can be selected among several alternatives, as a +matter of user preference. + +@defmac define-alternatives command &rest customizations +Define the new command `COMMAND'. + +The argument `COMMAND' should be a symbol. + +When a user runs @kbd{M-x COMMAND @key{RET}} for the first time, Emacs +will prompt for which alternative to use and record the selected +command as a custom variable. + +Running @kbd{C-u M-x COMMAND @key{RET}} prompts again for an +alternative and overwrites the previous choice. + +The variable @code{COMMAND-alternatives} contains an alist +(@pxref{Association Lists}) with alternative implementations of +`COMMAND'. @code{define-alternatives} does not have any effect until +this variable is set. + +If @var{customizations} is non-@var{nil}, it should be composed of +alternating @code{defcustom} keywords and values to add to the +declaration of @code{COMMAND-alternatives} (typically :group and +:version). +@end defmac + @node Interactive Call @section Interactive Call @cindex interactive call === modified file 'doc/lispref/elisp.texi' --- doc/lispref/elisp.texi 2014-02-21 08:04:15 +0000 +++ doc/lispref/elisp.texi 2014-02-28 01:49:25 +0000 @@ -746,6 +746,8 @@ * Interactive Codes:: The standard letter-codes for reading arguments in various ways. * Interactive Examples:: Examples of how to read interactive arguments. +* Generic Commands:: Select among command alternatives. + Input Events === modified file 'etc/NEWS' --- etc/NEWS 2014-02-28 01:05:49 +0000 +++ etc/NEWS 2014-02-28 01:49:25 +0000 @@ -730,7 +730,7 @@ +++ ** Octave mode -*** Font locking for texinfo comments and new keywords. +*** Font locking for Texinfo comments and new keywords. *** Completion in Octave file buffers. @@ -1155,6 +1155,7 @@ +++ ** New functions `special-form-p' and `macrop'. ++++ ** New macro `define-alternatives' can be used to define generic commands. Generic commands are interactive functions whose implementation can be selected among several alternatives, as a matter of user preference. ------------------------------------------------------------ revno: 116587 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Fri 2014-02-28 09:07:17 +0800 message: Some desktop doc. * doc/emacs/misc.texi (Saving Emacs Sessions): Document some new desktop user options. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-02-27 11:59:35 +0000 +++ doc/emacs/ChangeLog 2014-02-28 01:05:49 +0000 @@ -1,3 +1,7 @@ +2014-02-28 Xue Fuqiao + + * misc.texi (Saving Emacs Sessions): Document some new desktop user options. + 2014-02-27 Xue Fuqiao * programs.texi (Basic Indent): === modified file 'doc/emacs/misc.texi' --- doc/emacs/misc.texi 2014-02-18 01:33:30 +0000 +++ doc/emacs/misc.texi 2014-02-28 01:05:49 +0000 @@ -2193,6 +2193,32 @@ @code{desktop-clear-preserve-buffers-regexp}, whose value is a regular expression matching the names of buffers not to kill. +@vindex desktop-restore-frames +@code{desktop-restore-frames}, enabled by default, a non-@code{nil} +means save frames (@pxref{Frames}) to desktop file. + +@vindex desktop-restore-in-current-display +If the value of @code{desktop-restore-in-current-display} is @code{t}, +frames are restored in the current display. If @code{nil} (the +default), frames are restored in their original displays if possible. +If @samp{delete}, frames on other displays are deleted instead of +restored. + +@vindex desktop-restore-reuses-frames +If the value of @code{desktop-restore-reuses-frames} is @code{t} (the +default), restoring frames will reuse existing frames. If @code{nil}, +existing frames are deleted. If @samp{:keep}, existing frames are +kept but not reused. + +@vindex desktop-restore-forces-onscreen +If the value of @code{desktop-restore-forces-onscreen} is @code{t} +(the default), offscreen frames are restored onscreen. If +@samp{:all}, frames that are partially offscreen are also forced +onscreen. @strong{Notice:} Checking of frame boundaries is +approximate. It may not reliably detect frames whose +onscreen/offscreen state depends on a few pixels, especially near the +right and/or bottom borders of the screen. + If you want to save minibuffer history from one session to another, use the @code{savehist} library. === modified file 'etc/NEWS' --- etc/NEWS 2014-02-27 14:10:55 +0000 +++ etc/NEWS 2014-02-28 01:05:49 +0000 @@ -537,6 +537,7 @@ after `desktop-auto-save-timeout'. To disable this, customize that option to nil (or zero). ++++ *** `desktop-restore-frames', enabled by default, allows saving and restoring the frame/window configuration (frameset). Additional options `desktop-restore-in-current-display', `desktop-restore-reuses-frames' ------------------------------------------------------------ revno: 116586 committer: martin rudalics branch nick: trunk timestamp: Thu 2014-02-27 20:22:10 +0100 message: More fixes for mouse glyph calculations (Bug#16647). More fixes for mouse glyph calculations (Bug#16647). * window.c (coordinates_in_window): In intersection of horizontal and vertical window dividers prefer the horizontal one. Add some extra parens to last fix. (window_relative_x_coord): Return x-coordinate for header and mode line too. * xdisp.c (remember_mouse_glyph): In text area don't extend glyph into mode line to show the vertical drag cursor there immediately. Subdivide mouse glyphs in right fringes to show a horizontal drag cursor as soon as we enter the "grabbable width" portion. Handle vertical border case separately. Do not subdivide window divider areas. (note_mouse_highlight): On bottom divider of bottommost windows show vertical drag cursor only when the minibuffer window can be resized. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-02-27 17:42:00 +0000 +++ src/ChangeLog 2014-02-27 19:22:10 +0000 @@ -1,3 +1,21 @@ +2014-02-27 Martin Rudalics + + More fixes for mouse glyph calculations (Bug#16647). + * window.c (coordinates_in_window): In intersection of + horizontal and vertical window dividers prefer the horizontal + one. Add some extra parens to last fix. + (window_relative_x_coord): Return x-coordinate for header and + mode line too. + * xdisp.c (remember_mouse_glyph): In text area don't extend + glyph into mode line to show the vertical drag cursor there + immediately. Subdivide mouse glyphs in right fringes to show a + horizontal drag cursor as soon as we enter the "grabbable width" + portion. Handle vertical border case separately. Do not + subdivide window divider areas. + (note_mouse_highlight): On bottom divider of bottommost windows + show vertical drag cursor only when the minibuffer window can be + resized. + 2014-02-27 Eli Zaretskii * xdisp.c (pop_it): Restore the it->face_box_p flag which could be === modified file 'src/window.c' --- src/window.c 2014-02-26 08:07:34 +0000 +++ src/window.c 2014-02-27 19:22:10 +0000 @@ -1266,18 +1266,18 @@ if (y < top_y || y >= bottom_y || x < left_x || x >= right_x) return ON_NOTHING; - /* On vertical window divider (which prevails horizontal - dividers)? */ - if (!WINDOW_RIGHTMOST_P (w) - && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0 - && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w) - && x <= right_x) + /* On the horizontal window divider (which prevails the vertical + divider)? */ + if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0 + && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w)) + && y <= bottom_y) + return ON_BOTTOM_DIVIDER; + /* On vertical window divider? */ + else if (!WINDOW_RIGHTMOST_P (w) + && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0 + && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w) + && x <= right_x) return ON_RIGHT_DIVIDER; - /* On the horizontal window divider? */ - else if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0 - && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w)) - && y <= bottom_y) - return ON_BOTTOM_DIVIDER; /* On the mode or header line? */ else if ((WINDOW_WANTS_MODELINE_P (w) && y >= (bottom_y @@ -1295,12 +1295,12 @@ bars. Note: If scrollbars are on the left, the window that must be eventually resized is that on the left of WINDOW. */ if ((WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0) - && (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) - && !WINDOW_LEFTMOST_P (w) - && eabs (x - left_x) < grabbable_width) - || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) - && !WINDOW_RIGHTMOST_P (w) - && eabs (x - right_x) < grabbable_width)) + && ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + && !WINDOW_LEFTMOST_P (w) + && eabs (x - left_x) < grabbable_width) + || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) + && !WINDOW_RIGHTMOST_P (w) + && eabs (x - right_x) < grabbable_width))) return ON_VERTICAL_BORDER; else return part; @@ -1386,6 +1386,8 @@ case ON_TEXT: return x - window_box_left (w, TEXT_AREA); + case ON_HEADER_LINE: + case ON_MODE_LINE: case ON_LEFT_FRINGE: return x - left_x; === modified file 'src/xdisp.c' --- src/xdisp.c 2014-02-27 17:42:00 +0000 +++ src/xdisp.c 2014-02-27 19:22:10 +0000 @@ -2419,7 +2419,13 @@ } if (part != ON_MODE_LINE && part != ON_HEADER_LINE) - gx += window_box_left_offset (w, area); + { + gx += window_box_left_offset (w, area); + /* Don't expand over the modeline to make sure the vertical + drag cursor is shown early enough. */ + height = min (height, + max (0, WINDOW_BOX_HEIGHT_NO_MODE_LINE (w) - gy)); + } } else { @@ -2427,6 +2433,10 @@ gx = (x / width) * width; y -= gy; gy += (y / height) * height; + if (part != ON_MODE_LINE && part != ON_HEADER_LINE) + /* See comment above. */ + height = min (height, + max (0, WINDOW_BOX_HEIGHT_NO_MODE_LINE (w) - gy)); } break; @@ -2441,7 +2451,22 @@ gx = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ? window_box_right_offset (w, RIGHT_MARGIN_AREA) : window_box_right_offset (w, TEXT_AREA)); - width = WINDOW_RIGHT_FRINGE_WIDTH (w); + if (WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0 + && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) + && !WINDOW_RIGHTMOST_P (w)) + if (gx < WINDOW_PIXEL_WIDTH (w) - width) + /* Make sure the vertical border can get her own glyph to the + right of the one we build here. */ + width = WINDOW_RIGHT_FRINGE_WIDTH (w) - width; + else + width = WINDOW_PIXEL_WIDTH (w) - gx; + else + width = WINDOW_RIGHT_FRINGE_WIDTH (w); + + goto row_glyph; + + case ON_VERTICAL_BORDER: + gx = WINDOW_PIXEL_WIDTH (w) - width; goto row_glyph; case ON_SCROLL_BAR: @@ -2452,35 +2477,40 @@ ? WINDOW_RIGHT_FRINGE_WIDTH (w) : 0))); width = WINDOW_SCROLL_BAR_AREA_WIDTH (w); - goto row_glyph; + + row_glyph: + gr = 0, gy = 0; + for (; r <= end_row && r->enabled_p; ++r) + if (r->y + r->height > y) + { + gr = r; gy = r->y; + break; + } + + if (gr && gy <= y) + height = gr->height; + else + { + /* Use nominal line height at end of window. */ + y -= gy; + gy += (y / height) * height; + } + break; case ON_RIGHT_DIVIDER: - gx = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w); + gx = WINDOW_PIXEL_WIDTH (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w); width = WINDOW_RIGHT_DIVIDER_WIDTH (w); - goto row_glyph; + gy = 0; + /* The bottom divider prevails. */ + height = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w); + goto add_edge;; case ON_BOTTOM_DIVIDER: gx = 0; - width = WINDOW_RIGHT_PIXEL_EDGE (w) - WINDOW_RIGHT_DIVIDER_WIDTH (w); - - row_glyph: - gr = 0, gy = 0; - for (; r <= end_row && r->enabled_p; ++r) - if (r->y + r->height > y) - { - gr = r; gy = r->y; - break; - } - - if (gr && gy <= y) - height = gr->height; - else - { - /* Use nominal line height at end of window. */ - y -= gy; - gy += (y / height) * height; - } - break; + width = WINDOW_PIXEL_WIDTH (w); + gy = WINDOW_PIXEL_HEIGHT (w) - WINDOW_BOTTOM_DIVIDER_WIDTH (w); + height = WINDOW_BOTTOM_DIVIDER_WIDTH (w); + goto add_edge; default: ; @@ -2502,6 +2532,7 @@ goto store_rect; } + add_edge: gx += WINDOW_LEFT_EDGE_X (w); gy += WINDOW_TOP_EDGE_Y (w); @@ -28682,10 +28713,15 @@ help_echo_string = build_string ("drag-mouse-1: resize"); } else if (part == ON_BOTTOM_DIVIDER) - { - cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; - help_echo_string = build_string ("drag-mouse-1: resize"); - } + if (! WINDOW_BOTTOMMOST_P (w) + || minibuf_level + || NILP (Vresize_mini_windows)) + { + cursor = FRAME_X_OUTPUT (f)->vertical_drag_cursor; + help_echo_string = build_string ("drag-mouse-1: resize"); + } + else + cursor = FRAME_X_OUTPUT (f)->nontext_cursor; else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE || part == ON_SCROLL_BAR) cursor = FRAME_X_OUTPUT (f)->nontext_cursor; ------------------------------------------------------------ revno: 116585 fixes bug: http://debbugs.gnu.org/16870 committer: Eli Zaretskii branch nick: trunk timestamp: Thu 2014-02-27 19:42:00 +0200 message: Fix bug #16870 with 'box' face in display strings. src/xdisp.c (pop_it): Restore the it->face_box_p flag which could be reset by the face of the object just displayed. See also bug#76. (get_next_display_element): If the string came from a display property, examine the box face attribute at it->position, not at it->current.pos, since the latter was not updated yet. (handle_face_prop): Improve commentary. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-02-27 15:36:14 +0000 +++ src/ChangeLog 2014-02-27 17:42:00 +0000 @@ -1,3 +1,12 @@ +2014-02-27 Eli Zaretskii + + * xdisp.c (pop_it): Restore the it->face_box_p flag which could be + reset by the face of the object just displayed. See also bug#76. + (get_next_display_element): If the string came from a display + property, examine the box face attribute at it->position, not at + it->current.pos, since the latter was not updated yet. (Bug#16870) + (handle_face_prop): Improve commentary. + 2014-02-27 Michael Albinus * dbusbind.c (Fdbus__init_bus, Qdbus__init_bus, Sdbus__init_bus): === modified file 'src/xdisp.c' --- src/xdisp.c 2014-02-26 08:07:34 +0000 +++ src/xdisp.c 2014-02-27 17:42:00 +0000 @@ -3923,6 +3923,15 @@ For strings from wrap-prefix and line-prefix properties, use the default face, possibly remapped via Vface_remapping_alist. */ + /* Note that the fact that we use the face at _buffer_ + position means that a 'display' property on an overlay + string will not inherit the face of that overlay string, + but will instead revert to the face of buffer text + covered by the overlay. This is visible, e.g., when the + overlay specifies a box face, but neither the buffer nor + the display string do. This sounds like a design bug, + but Emacs always did that since v21.1, so changing that + might be a big deal. */ base_face_id = it->string_from_prefix_prop_p ? (!NILP (Vface_remapping_alist) ? lookup_basic_face (it->f, DEFAULT_FACE_ID) @@ -5956,7 +5965,16 @@ it->object = it->w->contents; break; case GET_FROM_STRING: - it->object = it->string; + { + struct face *face = FACE_FROM_ID (it->f, it->face_id); + + /* Restore the face_box_p flag, since it could have been + overwritten by the face of the object that we just finished + displaying. */ + if (face) + it->face_box_p = face->box != FACE_NO_BOX; + it->object = it->string; + } break; case GET_FROM_DISPLAY_VECTOR: if (it->s) @@ -7043,21 +7061,44 @@ If this is the last string character displayed, check the next buffer location. */ else if ((IT_STRING_CHARPOS (*it) >= SCHARS (it->string) - 1) - && (it->current.overlay_string_index - == it->n_overlay_strings - 1)) + /* n_overlay_strings is unreliable unless + overlay_string_index is non-negative. */ + && ((it->current.overlay_string_index >= 0 + && (it->current.overlay_string_index + == it->n_overlay_strings - 1)) + /* A string from display property. */ + || it->from_disp_prop_p)) { ptrdiff_t ignore; int next_face_id; struct text_pos pos = it->current.pos; - INC_TEXT_POS (pos, it->multibyte_p); - - next_face_id = face_at_buffer_position - (it->w, CHARPOS (pos), &ignore, - (IT_CHARPOS (*it) + TEXT_PROP_DISTANCE_LIMIT), 0, - -1); - it->end_of_box_run_p - = (FACE_FROM_ID (it->f, next_face_id)->box - == FACE_NO_BOX); + + /* For a string from a display property, the next + buffer position is stored in the 'position' + member of the iteration stack slot below the + current one, see handle_single_display_spec. By + contrast, it->current.pos was is not yet updated + to point to that buffer position; that will + happen in pop_it, after we finish displaying the + current string. Note that we already checked + above that it->sp is positive, so subtracting one + from it is safe. */ + if (it->from_disp_prop_p) + pos = (it->stack + it->sp - 1)->position; + else + INC_TEXT_POS (pos, it->multibyte_p); + + if (CHARPOS (pos) >= ZV) + it->end_of_box_run_p = true; + else + { + next_face_id = face_at_buffer_position + (it->w, CHARPOS (pos), &ignore, + CHARPOS (pos) + TEXT_PROP_DISTANCE_LIMIT, 0, -1); + it->end_of_box_run_p + = (FACE_FROM_ID (it->f, next_face_id)->box + == FACE_NO_BOX); + } } } } ------------------------------------------------------------ revno: 116584 committer: Michael Albinus branch nick: trunk timestamp: Thu 2014-02-27 16:41:13 +0100 message: * net/dbus.el (dbus--init-bus): Declare function. (dbus-path-local, dbus-interface-local): New defconst. (dbus-init-bus): Use them. (dbus-return-values-table): Extend doc. (dbus-handle-bus-disconnect): Extend error message. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-27 14:21:28 +0000 +++ lisp/ChangeLog 2014-02-27 15:41:13 +0000 @@ -1,3 +1,11 @@ +2014-02-27 Michael Albinus + + * net/dbus.el (dbus--init-bus): Declare function. + (dbus-path-local, dbus-interface-local): New defconst. + (dbus-init-bus): Use them. + (dbus-return-values-table): Extend doc. + (dbus-handle-bus-disconnect): Extend error message. + 2014-02-27 Juanma Barranquero * subr.el (y-or-n-p): Fix double space issue in message. === modified file 'lisp/net/dbus.el' --- lisp/net/dbus.el 2014-02-23 02:46:12 +0000 +++ lisp/net/dbus.el 2014-02-27 15:41:13 +0000 @@ -35,7 +35,7 @@ ;; Declare used subroutines and variables. (declare-function dbus-message-internal "dbusbind.c") -(declare-function dbus-init-bus-1 "dbusbind.c") +(declare-function dbus--init-bus "dbusbind.c") (defvar dbus-message-type-invalid) (defvar dbus-message-type-method-call) (defvar dbus-message-type-method-return) @@ -55,6 +55,9 @@ (defconst dbus-path-dbus "/org/freedesktop/DBus" "The object path used to talk to the bus itself.") +(defconst dbus-path-local (concat dbus-path-dbus "/Local") + "The object path used in local/in-process-generated messages.") + ;; Default D-Bus interfaces. (defconst dbus-interface-dbus "org.freedesktop.DBus" @@ -129,6 +132,15 @@ ;; ;; +(defconst dbus-interface-local (concat dbus-interface-dbus ".Local") + "An interface whose methods can only be invoked by the local implementation.") + +;; +;; +;; +;; +;; + ;; Emacs defaults. (defconst dbus-service-emacs "org.gnu.Emacs" "The well known service name of Emacs.") @@ -167,15 +179,20 @@ A key in this hash table is a list (:serial BUS SERIAL), like in `dbus-registered-objects-table'. BUS is either a Lisp symbol, `:system' or `:session', or a string denoting the bus address. -SERIAL is the serial number of the reply message.") +SERIAL is the serial number of the reply message. + +The value of an entry is a cons (STATE . RESULT). STATE can be +either `:pending' (we are still waiting for the result), +`:complete' (the result is available) or `:error' (the reply +message was an error message).") (defun dbus-call-method-handler (&rest args) "Handler for reply messages of asynchronous D-Bus message calls. It calls the function stored in `dbus-registered-objects-table'. The result will be made available in `dbus-return-values-table'." - (let* ((key (list :serial - (dbus-event-bus-name last-input-event) - (dbus-event-serial-number last-input-event))) + (let* ((key (list :serial + (dbus-event-bus-name last-input-event) + (dbus-event-serial-number last-input-event))) (result (gethash key dbus-return-values-table))) (when (consp result) (setcar result :complete) @@ -183,9 +200,9 @@ (defun dbus-notice-synchronous-call-errors (ev er) "Detect errors resulting from pending synchronous calls." - (let* ((key (list :serial - (dbus-event-bus-name ev) - (dbus-event-serial-number ev))) + (let* ((key (list :serial + (dbus-event-bus-name ev) + (dbus-event-serial-number ev))) (result (gethash key dbus-return-values-table))) (when (consp result) (setcar result :error) @@ -1718,7 +1735,7 @@ nil nil value) - '(dbus-error "Bus disconnected")) + (list 'dbus-error "Bus disconnected" bus)) (push key keys-to-remove))) dbus-registered-objects-table) (dolist (key keys-to-remove) @@ -1745,14 +1762,11 @@ connection used in the same Emacs process, like the one established by GTK+. It should be used with care for at least the `:system' and `:session' buses, because other Emacs Lisp packages might already use -this connection to those buses. -" - (dbus-init-bus-1 bus private) - (dbus-register-signal bus nil - "/org/freedesktop/DBus/Local" - "org.freedesktop.DBus.Local" - "Disconnected" - #'dbus-handle-bus-disconnect)) +this connection to those buses." + (dbus--init-bus bus private) + (dbus-register-signal + bus nil dbus-path-local dbus-interface-local + "Disconnected" #'dbus-handle-bus-disconnect)) ;; Initialize `:system' and `:session' buses. This adds their file ------------------------------------------------------------ revno: 116583 committer: Michael Albinus branch nick: trunk timestamp: Thu 2014-02-27 16:36:14 +0100 message: * dbusbind.c (Fdbus__init_bus, Qdbus__init_bus, Sdbus__init_bus): Rename from Fdbus_init_bus_1, Qdbus_init_bus_1, Sdbus_init_bus_1. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2014-02-26 08:07:34 +0000 +++ src/ChangeLog 2014-02-27 15:36:14 +0000 @@ -1,3 +1,8 @@ +2014-02-27 Michael Albinus + + * dbusbind.c (Fdbus__init_bus, Qdbus__init_bus, Sdbus__init_bus): + Rename from Fdbus_init_bus_1, Qdbus_init_bus_1, Sdbus_init_bus_1. + 2014-02-26 Martin Rudalics Fixes around Bug#16647. === modified file 'src/dbusbind.c' --- src/dbusbind.c 2014-02-21 04:32:11 +0000 +++ src/dbusbind.c 2014-02-27 15:36:14 +0000 @@ -42,7 +42,7 @@ /* Subroutines. */ -static Lisp_Object Qdbus_init_bus_1; +static Lisp_Object Qdbus__init_bus; static Lisp_Object Qdbus_get_unique_name; static Lisp_Object Qdbus_message_internal; @@ -1094,7 +1094,7 @@ if (NILP (val)) return; - busobj = CDR_SAFE(val); + busobj = CDR_SAFE (val); if (NILP (busobj)) { xd_registered_buses = Fdelete (val, xd_registered_buses); return; @@ -1121,11 +1121,11 @@ return; } -DEFUN ("dbus-init-bus-1", Fdbus_init_bus_1, Sdbus_init_bus_1, 1, 2, 0, +DEFUN ("dbus--init-bus", Fdbus__init_bus, Sdbus__init_bus, 1, 2, 0, doc: /* Establish the connection to D-Bus BUS. -This function is dbus-internal. You almost certainly want to use -dbus-init-bus. +This function is dbus internal. You almost certainly want to use +`dbus-init-bus'. BUS can be either the symbol `:system' or the symbol `:session', or it can be a string denoting the address of the corresponding bus. For @@ -1745,8 +1745,8 @@ syms_of_dbusbind (void) { - DEFSYM (Qdbus_init_bus_1, "dbus-init-bus-1"); - defsubr (&Sdbus_init_bus_1); + DEFSYM (Qdbus__init_bus, "dbus--init-bus"); + defsubr (&Sdbus__init_bus); DEFSYM (Qdbus_get_unique_name, "dbus-get-unique-name"); defsubr (&Sdbus_get_unique_name); ------------------------------------------------------------ revno: 116582 committer: Juanma Barranquero branch nick: trunk timestamp: Thu 2014-02-27 15:21:28 +0100 message: lisp/subr.el (y-or-n-p): Fix double space issue in message. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-27 11:59:04 +0000 +++ lisp/ChangeLog 2014-02-27 14:21:28 +0000 @@ -1,3 +1,7 @@ +2014-02-27 Juanma Barranquero + + * subr.el (y-or-n-p): Fix double space issue in message. + 2014-02-27 Michael Albinus * net/tramp.el (tramp-call-process): Improve trace message. === modified file 'lisp/subr.el' --- lisp/subr.el 2014-02-12 19:40:35 +0000 +++ lisp/subr.el 2014-02-27 14:21:28 +0000 @@ -2206,14 +2206,16 @@ ;; ¡Beware! when I tried to edebug this code, Emacs got into a weird state ;; where all the keys were unbound (i.e. it somehow got triggered ;; within read-key, apparently). I had to kill it. - (let ((answer 'recenter)) + (let ((answer 'recenter) + (padded (lambda (prompt &optional dialog) + (let ((l (length prompt))) + (concat prompt + (if (or (zerop l) (eq ?\s (aref prompt (1- l)))) + "" " ") + (if dialog "" "(y or n) ")))))) (cond (noninteractive - (setq prompt (concat prompt - (if (or (zerop (length prompt)) - (eq ?\s (aref prompt (1- (length prompt))))) - "" " ") - "(y or n) ")) + (setq prompt (funcall padded prompt)) (let ((temp-prompt prompt)) (while (not (memq answer '(act skip))) (let ((str (read-string temp-prompt))) @@ -2224,14 +2226,10 @@ ((and (display-popup-menus-p) (listp last-nonmenu-event) use-dialog-box) - (setq answer - (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) + (setq prompt (funcall padded prompt t) + answer (x-popup-dialog t `(,prompt ("Yes" . act) ("No" . skip))))) (t - (setq prompt (concat prompt - (if (or (zerop (length prompt)) - (eq ?\s (aref prompt (1- (length prompt))))) - "" " ") - "(y or n) ")) + (setq prompt (funcall padded prompt)) (while (let* ((scroll-actions '(recenter scroll-up scroll-down scroll-other-window scroll-other-window-down)) @@ -2264,9 +2262,7 @@ (discard-input)))) (let ((ret (eq answer 'act))) (unless noninteractive - ;; FIXME this prints one too many spaces, since prompt - ;; already ends in a space. Eg "... (y or n) y". - (message "%s %s" prompt (if ret "y" "n"))) + (message "%s%c" prompt (if ret ?y ?n))) ret))) ------------------------------------------------------------ revno: 116581 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2014-02-27 22:10:55 +0800 message: Document some changes about windows. * doc/lispref/windows.texi (Window Sizes): Document `window-size'. (Display Action Functions): Document `display-buffer-at-bottom'. (Window Configurations): Minor fixes. * doc/lispref/modes.texi (Header Lines): Document `window-header-line-height'. * doc/lispref/display.texi (Scroll Bars): Document `window-scroll-bar-width'. * etc/NEWS: Related markup. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-02-27 12:56:45 +0000 +++ doc/lispref/ChangeLog 2014-02-27 14:09:26 +0000 @@ -1,5 +1,13 @@ 2014-02-27 Xue Fuqiao + * windows.texi (Window Sizes): Document `window-size'. + (Display Action Functions): Document `display-buffer-at-bottom'. + (Window Configurations): Minor fixes. + + * modes.texi (Header Lines): Document `window-header-line-height'. + + * display.texi (Scroll Bars): Document `window-scroll-bar-width'. + * windows.texi (Window Sizes, Resizing Windows): Document some pixelwise window operations. === modified file 'doc/lispref/display.texi' --- doc/lispref/display.texi 2014-02-25 08:41:47 +0000 +++ doc/lispref/display.texi 2014-02-27 14:09:26 +0000 @@ -3849,6 +3849,12 @@ @var{horizontal-type} is not actually meaningful. @end defun +@defun window-scroll-bar-width &optional window +This function returns the width of @var{window}'s vertical scrollbar, +in pixels. @var{window} must be a live window. If @var{window} is +@code{nil} or omitted, it will be the selected window. +@end defun + If you don't specify these values for a window with @code{set-window-scroll-bars}, the buffer-local variables @code{scroll-bar-mode} and @code{scroll-bar-width} in the buffer being === modified file 'doc/lispref/modes.texi' --- doc/lispref/modes.texi 2014-01-10 19:40:32 +0000 +++ doc/lispref/modes.texi 2014-02-27 14:09:26 +0000 @@ -2221,6 +2221,15 @@ It is normally @code{nil}, so that ordinary buffers have no header line. @end defvar +The function @code{window-header-line-height} returns the height of +the header line: + +@defun window-header-line-height &optional window +Return the height of @var{window}'s header line, in pixels. +@var{window} must be a live window. If @var{window} is @code{nil} or +omitted, it will be the selected window. +@end defun + A window that is just one line tall never displays a header line. A window that is two lines tall cannot display both a mode line and a header line at once; if it has a mode line, then it does not display a === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2014-02-27 12:56:45 +0000 +++ doc/lispref/windows.texi 2014-02-27 14:09:26 +0000 @@ -413,6 +413,22 @@ font or size, the reported height and width for that window may differ from the actual number of text lines or columns displayed within it. +@defun window-size &optional window horizontal pixelwise round +This function returns the height or width of @var{window}. +@var{window} must be a valid window. The default value of +@var{window} is the selected window. + +If @var{horizontal} is omitted or nil, return the total height of +@var{window}, in lines; otherwise return the total width in columns. + +The optional argument @var{pixelwise} means return size of +@var{window}, in pixels. + +The optional argument @var{round} is ignored if @var{pixelwise} is +non-@code{nil}. Otherwise it is handled as for +@code{window-total-height} and @code{window-total-width}. +@end defun + @cindex window height @cindex height of a window @cindex total height of a window @@ -2078,6 +2094,15 @@ methods above, even if that window never showed @var{buffer} before. @end defun +@defun display-buffer-at-bottom buffer alist +This function tries to display @var{buffer} in a window at the bottom +of the selected frame. + +This either splits the window at the bottom of the frame or the +frame's root window, or reuses an existing window at the bottom of the +selected frame. +@end defun + @defun display-buffer-use-some-window buffer alist This function tries to display @var{buffer} by choosing an existing window and displaying the buffer in that window. It can fail if all @@ -3533,6 +3558,7 @@ (@code{set-window-configuration} effectively clones the windows of a frame into the root window of that very frame only). +@cindex window state @defun window-state-get &optional window writable This function returns the state of @var{window} as a Lisp object. The argument @var{window} must be a valid window and defaults to the root @@ -3554,10 +3580,11 @@ the following function to restore the state of the window. @defun window-state-put state &optional window ignore -This function puts the window state @var{state} into @var{window}. The -argument @var{state} should be the state of a window returned by an -earlier invocation of @code{window-state-get}, see above. The optional -argument @var{window} must specify a valid window and defaults to the +This function puts the window state @var{state} into @var{window}. +The argument @var{state} should be the state of a window returned by +an earlier invocation of @code{window-state-get}, see above. The +optional argument @var{window} can be either a live window or an +internal window (@pxref{Windows and Frames}) and defaults to the selected one. If @var{window} is not live, it is replaced by a live window before putting @var{state} into it. === modified file 'etc/NEWS' --- etc/NEWS 2014-02-27 12:00:30 +0000 +++ etc/NEWS 2014-02-27 14:10:55 +0000 @@ -254,9 +254,11 @@ and as such superfluous. After being reimplemented in Lisp, its interactive form was mistakenly retained. ++++ *** The functions `window-size' and `window-total-size' now have an optional argument to return a rounded size value. ++++ *** `window-state-put' now allows to put a window state into internal windows too. @@ -266,10 +268,12 @@ using the scroll bar (i.e. dragging the thumb down even when the end of the buffer is visible). ++++ *** New basic action function `display-buffer-in-previous-window' has `display-buffer' display a buffer in a window previously showing that buffer. ++++ *** New basic action function `display-buffer-at-bottom' has `display-buffer' choose or make a window at the bottom of the selected frame. ------------------------------------------------------------ revno: 116580 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2014-02-27 20:58:23 +0800 message: Document some (perhaps incomplete) pixelwise window operations. * doc/lispref/windows.texi (Window Sizes, Resizing Windows): Document some pixelwise window operations. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-02-27 11:59:35 +0000 +++ doc/lispref/ChangeLog 2014-02-27 12:56:45 +0000 @@ -1,5 +1,8 @@ 2014-02-27 Xue Fuqiao + * windows.texi (Window Sizes, Resizing Windows): Document some + pixelwise window operations. + * text.texi (Margins): Fix the description of RET and `C-j'. * frames.texi (Multiple Terminals): Document === modified file 'doc/lispref/windows.texi' --- doc/lispref/windows.texi 2014-02-21 13:33:57 +0000 +++ doc/lispref/windows.texi 2014-02-27 12:56:45 +0000 @@ -427,26 +427,55 @@ a frame may also contain an echo area, menu bar, and tool bar (@pxref{Size and Position}). -@defun window-total-height &optional window +@defun window-total-height &optional window round This function returns the total height, in lines, of the window @var{window}. If @var{window} is omitted or @code{nil}, it defaults to the selected window. If @var{window} is an internal window, the return value is the total height occupied by its descendant windows. + +If @var{window}'s pixel height is not an integral multiple of its +frame's character height, the number of lines occupied by @var{window} +is rounded internally. This is done in a way such that, if +@var{window} is a parent window, the sum of the total heights of all +its children internally equals the total height of @var{window}. + +If the optional argument @var{round} is @code{ceiling}, this function +will return the smallest integer larger than @var{window}'s pixel +height divided by the character height of @var{window}'s frame; if it +is @code{floor}, return the largest integer smaller than +@var{window}'s pixel height divided by the character height of +@var{window}'s frame. Any other value of @var{round} means to return +the internal total height of @var{window}. @end defun -@defun window-total-width &optional window +@defun window-total-width &optional window round This function returns the total width, in columns, of the window @var{window}. If @var{window} is omitted or @code{nil}, it defaults to the selected window. If @var{window} is internal, the return value is the total width occupied by its descendant windows. + +If @var{window}'s pixel width is not an integral multiple of its +frame's character width, the number of lines occupied by @var{window} +is rounded internally. This is done in a way such that, if +@var{window} is a parent window, the sum of the total widths of all +its children internally equals the total width of @var{window}. + +If the optional argument @var{round} is @code{ceiling}, this function +will return the smallest integer larger than @var{window}'s pixel +width divided by the character width of @var{window}'s frame; if it is +@code{floor}, return the largest integer smaller than @var{window}'s +pixel width divided by the character width of @var{window}'s frame. +Any other value of @var{round} means to return the internal total +width of @var{window}. @end defun -@defun window-total-size &optional window horizontal +@defun window-total-size &optional window horizontal round This function returns either the total height or width of the window @var{window}. If @var{horizontal} is omitted or @code{nil}, this is equivalent to calling @code{window-total-height} for @var{window}; otherwise it is equivalent to calling @code{window-total-width} for -@var{window}. +@var{window}. The optional argument @code{ROUND} is handled as for +@code{window-total-height} and @code{window-total-width}. @end defun @cindex full-width window @@ -479,7 +508,7 @@ @dfn{body width} is the width of the text area, which does not include the scroll bar, fringes, or margins. -@defun window-body-height &optional window +@defun window-body-height &optional window pixelwise This function returns the body height, in lines, of the window @var{window}. If @var{window} is omitted or @code{nil}, it defaults to the selected window; otherwise it must be a live window. @@ -489,7 +518,7 @@ use @code{window-text-height}, below. @end defun -@defun window-body-width &optional window +@defun window-body-width &optional window pixelwise This function returns the body width, in columns, of the window @var{window}. If @var{window} is omitted or @code{nil}, it defaults to the selected window; otherwise it must be a live window. @@ -571,7 +600,7 @@ arguments. Resizing an internal window causes its child windows to be resized to fit the same space. -@defun window-resizable window delta &optional horizontal ignore +@defun window-resizable window delta &optional horizontal ignore pixelwise This function returns @var{delta} if the size of @var{window} can be changed vertically by @var{delta} lines. If the optional argument @var{horizontal} is non-@code{nil}, it instead returns @var{delta} if @@ -596,9 +625,12 @@ of a header (if any), a mode line, plus a text area one line tall; and a minimum-width window as one consisting of fringes, margins, and scroll bar (if any), plus a text area two columns wide. + +If the optional argument @code{pixelwise} is non-@code{nil}, +@var{delta} will be interpreted as pixels. @end defun -@defun window-resize window delta &optional horizontal ignore +@defun window-resize window delta &optional horizontal ignore pixelwise This function resizes @var{window} by @var{delta} increments. If @var{horizontal} is @code{nil}, it changes the height by @var{delta} lines; otherwise, it changes the width by @var{delta} columns. A @@ -611,6 +643,9 @@ The optional argument @var{ignore} has the same meaning as for the function @code{window-resizable} above. +If the optional argument @code{pixelwise} is non-@code{nil}, +@var{delta} will be interpreted as pixels. + The choice of which window edges this function alters depends on the values of the option @code{window-combination-resize} and the combination limits of the involved windows; in some cases, it may alter @@ -623,12 +658,15 @@ @c shrink-window, and shrink-window-horizontally are documented in the @c Emacs manual. They are not preferred for calling from Lisp. -@defun adjust-window-trailing-edge window delta &optional horizontal +@defun adjust-window-trailing-edge window delta &optional horizontal pixelwise This function moves @var{window}'s bottom edge by @var{delta} lines. If optional argument @var{horizontal} is non-@code{nil}, it instead moves the right edge by @var{delta} columns. If @var{window} is @code{nil}, it defaults to the selected window. +If the optional argument @code{pixelwise} is non-@code{nil}, +@var{delta} will be interpreted as pixels. + A positive @var{delta} moves the edge downwards or to the right; a negative @var{delta} moves it upwards or to the left. If the edge cannot be moved as far as specified by @var{delta}, this function @@ -639,6 +677,21 @@ window is fixed-size), it may resize other windows. @end defun +@cindex pixelwise, resizing windows +@defopt window-resize-pixelwise +If the value of this user option is non-@code{nil}, window resizing +operations will be pixelwise. This currently affects the following +functions: @code{split-window}, @code{maximize-window}, +@code{minimize-window}, @code{fit-window-to-buffer} and +@code{fit-frame-to-buffer}, and all functions that symmetrically +resize a parent window. + +Note that when a frame's pixel size is not a multiple of the frame's +character size, at least one window may get resized pixelwise even if +this option is nil. The default value of this user option is +@code{nil}. +@end defopt + The following commands resize windows in more specific ways. When called interactively, they act on the selected window. ------------------------------------------------------------ revno: 116579 committer: Michael Albinus branch nick: trunk timestamp: Thu 2014-02-27 13:07:10 +0100 message: * automated/tramp-tests.el (tramp--test-enabled): Move connection cleanup into this function. Remove respective code from all test cases. (tramp--instrument-test-case): Declare `indent' and `debug'. Handle other errors as well. (tramp-test14-delete-directory): Check for `file-error' error. (tramp-test15-copy-directory): Ignore return value of `copy-directory'. It's too much hassle to handle it for tramp-adb.el. (tramp-test19-directory-files-and-attributes): Take care of timestamp of "../". (tramp-test20-file-modes, tramp-test27-start-file-process) (tramp-test28-shell-command): Skip for tramp-adb.el. (tramp-test21-file-links): `file-truename' shall preserve trailing link of directories. (tramp-test22-file-times): Skip if `set-file-times' returns nil. (tramp-test26-process-file, tramp-test28-shell-command): Let-bind `kill-buffer-query-functions' to nil. (tramp-test28-shell-command): Run `async-shell-command' with timeouts. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2014-02-21 10:43:49 +0000 +++ test/ChangeLog 2014-02-27 12:07:10 +0000 @@ -1,3 +1,24 @@ +2014-02-27 Michael Albinus + + * automated/tramp-tests.el (tramp--test-enabled): Move connection + cleanup into this function. Remove respective code from all test + cases. + (tramp--instrument-test-case): Declare `indent' and `debug'. + Handle other errors as well. + (tramp-test14-delete-directory): Check for `file-error' error. + (tramp-test15-copy-directory): Ignore return value of + `copy-directory'. It's too much hassle to handle it for tramp-adb.el. + (tramp-test19-directory-files-and-attributes): Take care of + timestamp of "../". + (tramp-test20-file-modes, tramp-test27-start-file-process) + (tramp-test28-shell-command): Skip for tramp-adb.el. + (tramp-test21-file-links): `file-truename' shall preserve trailing + link of directories. + (tramp-test22-file-times): Skip if `set-file-times' returns nil. + (tramp-test26-process-file, tramp-test28-shell-command): Let-bind + `kill-buffer-query-functions' to nil. + (tramp-test28-shell-command): Run `async-shell-command' with timeouts. + 2014-02-21 Michael Albinus * automated/tramp-tests.el === modified file 'test/automated/tramp-tests.el' --- test/automated/tramp-tests.el 2014-02-21 10:43:49 +0000 +++ test/automated/tramp-tests.el 2014-02-27 12:07:10 +0000 @@ -81,6 +81,17 @@ (file-remote-p tramp-test-temporary-file-directory) (file-directory-p tramp-test-temporary-file-directory) (file-writable-p tramp-test-temporary-file-directory)))))) + + (when (and (cdr tramp--test-enabled-checked) + (not (eq (tramp-find-foreign-file-name-handler + tramp-test-temporary-file-directory) + 'tramp-adb-file-name-handler))) + ;; Cleanup connection. We don't cleanup for adb, because it + ;; doesn't behave well when is disconnect several times. + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + nil 'keep-password)) + ;; Return result. (cdr tramp--test-enabled-checked)) @@ -93,15 +104,21 @@ "Run BODY with `tramp-verbose' equal VERBOSE. Print the the content of the Tramp debug buffer, if BODY does not eval properly in `should', `should-not' or `should-error'." - `(let ((tramp-verbose ,verbose)) + (declare (indent 1) (debug (natnump body))) + `(let ((tramp-verbose ,verbose) + (tramp-debug-on-error t)) (condition-case err (progn ,@body) - (ert-test-failed + (ert-test-skipped + (signal (car err) (cdr err))) + (error (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (with-current-buffer (tramp-get-connection-buffer v) + (message "%s" (buffer-string))) (with-current-buffer (tramp-get-debug-buffer v) (message "%s" (buffer-string)))) + (message "%s" err) (signal (car err) (cdr err)))))) -(put 'tramp--instrument-test-case 'lisp-indent-function 1) (ert-deftest tramp-test00-availability () "Test availability of Tramp functions." @@ -571,9 +588,6 @@ (ert-deftest tramp-test07-file-exists-p () "Check `file-exist-p', `write-region' and `delete-file'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (should-not (file-exists-p tmp-name)) @@ -585,9 +599,6 @@ (ert-deftest tramp-test08-file-local-copy () "Check `file-local-copy'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name1 (tramp--test-make-temp-name)) tmp-name2) @@ -605,9 +616,6 @@ (ert-deftest tramp-test09-insert-file-contents () "Check `insert-file-contents'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -629,9 +637,6 @@ (ert-deftest tramp-test10-write-region () "Check `write-region'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -666,9 +671,6 @@ (ert-deftest tramp-test11-copy-file () "Check `copy-file'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (tramp--test-make-temp-name))) @@ -687,9 +689,6 @@ (ert-deftest tramp-test12-rename-file () "Check `rename-file'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (tramp--test-make-temp-name))) @@ -708,9 +707,6 @@ "Check `make-directory'. This tests also `file-directory-p' and `file-accessible-directory-p'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -723,9 +719,6 @@ (ert-deftest tramp-test14-delete-directory () "Check `delete-directory'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) ;; Delete empty directory. @@ -736,16 +729,13 @@ ;; Delete non-empty directory. (make-directory tmp-name) (write-region "foo" nil (expand-file-name "bla" tmp-name)) - (should-error (delete-directory tmp-name)) + (should-error (delete-directory tmp-name) :type 'file-error) (delete-directory tmp-name 'recursive) (should-not (file-directory-p tmp-name)))) (ert-deftest tramp-test15-copy-directory () "Check `copy-directory'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let* ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (tramp--test-make-temp-name)) @@ -761,11 +751,14 @@ (write-region "foo" nil tmp-name4) (should (file-directory-p tmp-name1)) (should (file-exists-p tmp-name4)) - (copy-directory tmp-name1 tmp-name2) + ;; We do not care, whether file permissions and time stamps + ;; are correct. Sometimes, it is not possible to manage + ;; them, for example in tramp-adb.el. + (ignore-errors (copy-directory tmp-name1 tmp-name2)) (should (file-directory-p tmp-name2)) (should (file-exists-p tmp-name5)) ;; Target directory does exist already. - (copy-directory tmp-name1 tmp-name2) + (ignore-errors (copy-directory tmp-name1 tmp-name2)) (should (file-directory-p tmp-name3)) (should (file-exists-p tmp-name6))) (ignore-errors @@ -775,9 +768,6 @@ (ert-deftest tramp-test16-directory-files () "Check `directory-files'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let* ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (expand-file-name "bla" tmp-name1)) @@ -806,9 +796,6 @@ (ert-deftest tramp-test17-insert-directory () "Check `insert-directory'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let* ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (expand-file-name "foo" tmp-name1))) @@ -844,9 +831,6 @@ "Check `file-attributes'. This tests also `file-readable-p' and `file-regular-p'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name)) attr) @@ -889,39 +873,35 @@ (ert-deftest tramp-test19-directory-files-and-attributes () "Check `directory-files-and-attributes'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) - (tramp--instrument-test-case 10 - (let ((tmp-name (tramp--test-make-temp-name)) - attr) + ;; `directory-files-and-attributes' contains also values for "../". + ;; We must nesure, that this doesn't change during tests, for + ;; example due to handling temporary files. + (let* ((tmp-name1 (tramp--test-make-temp-name)) + (tmp-name2 (expand-file-name "bla" tmp-name1)) + attr) (unwind-protect (progn - (make-directory tmp-name) - (should (file-directory-p tmp-name)) - (write-region "foo" nil (expand-file-name "foo" tmp-name)) - (write-region "bar" nil (expand-file-name "bar" tmp-name)) - (write-region "boz" nil (expand-file-name "boz" tmp-name)) - (setq attr (directory-files-and-attributes tmp-name)) + (make-directory tmp-name1) + (should (file-directory-p tmp-name1)) + (make-directory tmp-name2) + (should (file-directory-p tmp-name2)) + (write-region "foo" nil (expand-file-name "foo" tmp-name2)) + (write-region "bar" nil (expand-file-name "bar" tmp-name2)) + (write-region "boz" nil (expand-file-name "boz" tmp-name2)) + (setq attr (directory-files-and-attributes tmp-name2)) (should (consp attr)) (dolist (elt attr) - ;; We cannot include "." and "..". They might have - ;; changed their timestamp already. - (when (string-match "foo$\\|bar$\\|baz$" (car elt)) - (should - (equal (file-attributes (expand-file-name (car elt) tmp-name)) - (cdr elt))))) - (setq attr (directory-files-and-attributes tmp-name 'full)) + (should + (equal (file-attributes (expand-file-name (car elt) tmp-name2)) + (cdr elt)))) + (setq attr (directory-files-and-attributes tmp-name2 'full)) (dolist (elt attr) - ;; We cannot include "." and "..". They might have - ;; changed their timestamp already. - (when (string-match "foo$\\|bar$\\|baz$" (car elt)) - (should - (equal (file-attributes (car elt)) (cdr elt))))) - (setq attr (directory-files-and-attributes tmp-name nil "^b")) + (should + (equal (file-attributes (car elt)) (cdr elt)))) + (setq attr (directory-files-and-attributes tmp-name2 nil "^b")) (should (equal (mapcar 'car attr) '("bar" "boz")))) - (ignore-errors (delete-directory tmp-name 'recursive)))))) + (ignore-errors (delete-directory tmp-name1 'recursive))))) (ert-deftest tramp-test20-file-modes () "Check `file-modes'. @@ -931,10 +911,9 @@ (not (memq (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) + '(tramp-adb-file-name-handler + tramp-gvfs-file-name-handler + tramp-smb-file-name-handler)))) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -949,8 +928,7 @@ (should (= (file-modes tmp-name) #o444)) (should-not (file-executable-p tmp-name)) ;; A file is always writable for user "root". - (when (and (stringp (file-remote-p tmp-name 'user)) - (not (string-equal (file-remote-p tmp-name 'user) "root"))) + (when (not (string-equal (file-remote-p tmp-name 'user) "root")) (should-not (file-writable-p tmp-name)))) (ignore-errors (delete-file tmp-name))))) @@ -958,9 +936,6 @@ "Check `file-symlink-p'. This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (tramp--test-make-temp-name)) @@ -1014,7 +989,13 @@ (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) (ignore-errors (delete-file tmp-name1) - (delete-file tmp-name2))))) + (delete-file tmp-name2))) + + ;; `file-truename' shall preserve trailing link of directories. + (let* ((dir1 (directory-file-name tramp-test-temporary-file-directory)) + (dir2 (file-name-as-directory dir1))) + (should (string-equal (file-truename dir1) (expand-file-name dir1))) + (should (string-equal (file-truename dir2) (expand-file-name dir2)))))) (ert-deftest tramp-test22-file-times () "Check `set-file-times' and `file-newer-than-file-p'." @@ -1024,9 +1005,6 @@ (memq (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name1 (tramp--test-make-temp-name)) (tmp-name2 (tramp--test-make-temp-name)) @@ -1036,8 +1014,11 @@ (write-region "foo" nil tmp-name1) (should (file-exists-p tmp-name1)) (should (consp (nth 5 (file-attributes tmp-name1)))) - ;; '(0 0) means don't know, and will be replaced by `current-time'. - (set-file-times tmp-name1 '(0 1)) + ;; '(0 0) means don't know, and will be replaced by + ;; `current-time'. Therefore, we use '(0 1). + ;; We skip the test, if the remote handler is not able to + ;; set the correct time. + (skip-unless (set-file-times tmp-name1 '(0 1))) ;; Dumb busyboxes are not able to return the date correctly. ;; They say "don't know. (skip-unless (not (equal (nth 5 (file-attributes tmp-name1)) '(0 0)))) @@ -1055,9 +1036,6 @@ (ert-deftest tramp-test23-visited-file-modtime () "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -1075,9 +1053,6 @@ (ert-deftest tramp-test24-file-name-completion () "Check `file-name-completion' and `file-name-all-completions'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -1100,9 +1075,6 @@ (ert-deftest tramp-test25-load () "Check `load'." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name))) (unwind-protect @@ -1126,12 +1098,10 @@ (memq (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name)) - (default-directory tramp-test-temporary-file-directory)) + (default-directory tramp-test-temporary-file-directory) + kill-buffer-query-functions) (unwind-protect (progn ;; We cannot use "/bin/true" and "/bin/false"; those paths @@ -1162,10 +1132,9 @@ (not (memq (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) + '(tramp-adb-file-name-handler + tramp-gvfs-file-name-handler + tramp-smb-file-name-handler)))) (let ((default-directory tramp-test-temporary-file-directory) (tmp-name (tramp--test-make-temp-name)) @@ -1215,13 +1184,13 @@ (not (memq (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) - '(tramp-gvfs-file-name-handler tramp-smb-file-name-handler)))) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) + '(tramp-adb-file-name-handler + tramp-gvfs-file-name-handler + tramp-smb-file-name-handler)))) (let ((tmp-name (tramp--test-make-temp-name)) - (default-directory tramp-test-temporary-file-directory)) + (default-directory tramp-test-temporary-file-directory) + kill-buffer-query-functions) (unwind-protect (with-temp-buffer (write-region "foo" nil tmp-name) @@ -1244,10 +1213,12 @@ (async-shell-command (format "ls %s" (file-name-nondirectory tmp-name)) (current-buffer)) (accept-process-output (get-buffer-process (current-buffer)) 1) - (while (ignore-errors - (memq (process-status (get-buffer-process (current-buffer))) - '(run open))) - (accept-process-output (get-buffer-process (current-buffer)) 1)) + (with-timeout (10 (ert-fail "`async-shell-command' timed out")) + (while + (ignore-errors + (memq (process-status (get-buffer-process (current-buffer))) + '(run open))) + (accept-process-output (get-buffer-process (current-buffer)) 1))) ;; `ls' could produce colorized output. (goto-char (point-min)) (while (re-search-forward tramp-color-escape-sequence-regexp nil t) @@ -1266,10 +1237,12 @@ (get-buffer-process (current-buffer)) (format "%s\n" (file-name-nondirectory tmp-name))) (accept-process-output (get-buffer-process (current-buffer)) 1) - (while (ignore-errors - (memq (process-status (get-buffer-process (current-buffer))) - '(run open))) - (accept-process-output (get-buffer-process (current-buffer)) 1)) + (with-timeout (10 (ert-fail "`async-shell-command' timed out")) + (while + (ignore-errors + (memq (process-status (get-buffer-process (current-buffer))) + '(run open))) + (accept-process-output (get-buffer-process (current-buffer)) 1))) (should (string-equal (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) @@ -1282,9 +1255,6 @@ (eq (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) 'tramp-sh-file-name-handler)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let* ((default-directory tramp-test-temporary-file-directory) (tmp-name1 (tramp--test-make-temp-name)) @@ -1326,9 +1296,6 @@ (ert-deftest tramp-test30-utf8 () "Check UTF8 encoding in file names and file contents." (skip-unless (tramp--test-enabled)) - (tramp-cleanup-connection - (tramp-dissect-file-name tramp-test-temporary-file-directory) - nil 'keep-password) (let ((tmp-name (tramp--test-make-temp-name)) (coding-system-for-read 'utf-8) ------------------------------------------------------------ revno: 116578 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2014-02-27 20:00:30 +0800 message: Some doc about electric-indent-mode. * doc/lispref/text.texi (Margins): Fix the description of RET and `C-j'. * doc/emacs/programs.texi (Basic Indent): (Other C Commands): Fix the description of RET and `C-j'. * doc/emacs/indent.texi (Indentation Commands): Move the description of `C-j' from here... * doc/emacs/basic.texi (Inserting Text): ... to here. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2014-02-25 08:41:47 +0000 +++ doc/emacs/ChangeLog 2014-02-27 11:59:35 +0000 @@ -1,3 +1,12 @@ +2014-02-27 Xue Fuqiao + + * programs.texi (Basic Indent): + (Other C Commands): Fix the description of RET and `C-j'. + + * indent.texi (Indentation Commands): Move the description of + `C-j' from here... + * basic.texi (Inserting Text): ... to here. + 2014-02-25 Glenn Morris * custom.texi (Terminal Init): === modified file 'doc/emacs/basic.texi' --- doc/emacs/basic.texi 2014-01-31 09:41:54 +0000 +++ doc/emacs/basic.texi 2014-02-27 11:59:35 +0000 @@ -40,14 +40,20 @@ @xref{Point}. @kindex RET +@kindex C-j @cindex newline +@findex electric-indent-just-newline To end a line and start a new one, type @key{RET} (@code{newline}). (The @key{RET} key may be labeled @key{Return} or @key{Enter} on your keyboard, but we refer to it as @key{RET} in this manual.) This -command inserts a newline character into the buffer. If point is at -the end of the line, the effect is to create a new blank line after -it; if point is in the middle of a line, the line is split at that -position. +command inserts a newline character into the buffer, then indent +(@pxref{Indentation}) accroding to major mode. If point is at the end +of the line, the effect is to create a new blank line after it and +indent the new line; if point is in the middle of a line, the line is +split at that position. To turn off the auto-indentation, you can +either desable Electric Indent mode (@pxref{Indent Convenience}) or +type @kbd{C-j}, which inserts just a newline, without any +auto-indentation. As we explain later in this manual, you can change the way Emacs handles text insertion by turning on @dfn{minor modes}. For instance, === modified file 'doc/emacs/indent.texi' --- doc/emacs/indent.texi 2014-01-28 02:17:51 +0000 +++ doc/emacs/indent.texi 2014-02-27 11:59:35 +0000 @@ -64,11 +64,6 @@ ways. @table @kbd -@item C-j -@kindex C-j -@findex newline-and-indent -Perform @key{RET} followed by @key{TAB} (@code{newline-and-indent}). - @item C-M-o @kindex C-M-o @findex split-line === modified file 'doc/emacs/programs.texi' --- doc/emacs/programs.texi 2014-02-17 18:04:17 +0000 +++ doc/emacs/programs.texi 2014-02-27 11:59:35 +0000 @@ -366,9 +366,9 @@ @table @kbd @item @key{TAB} Adjust indentation of current line (@code{indent-for-tab-command}). -@item C-j +@item @key{RET} Insert a newline, then adjust indentation of following line -(@code{newline-and-indent}). +(@code{newline}). @end table @kindex TAB @r{(programming modes)} @@ -382,12 +382,9 @@ the preceding lines; if the region is active, @key{TAB} indents each line within the region, not just the current line. -@kindex C-j @r{(indenting source code)} -@findex newline-and-indent - The command @kbd{C-j} (@code{newline-and-indent}), which was -documented in @ref{Indentation Commands}, does the same as @key{RET} -followed by @key{TAB}: it inserts a new line, then adjusts the line's -indentation. + The command @key{RET} (@code{newline}), which was documented in +@ref{Inserting Text}, does the same as @key{C-j} followed by +@key{TAB}: it inserts a new line, then adjusts the line's indentation. When indenting a line that starts within a parenthetical grouping, Emacs usually places the start of the line under the preceding line @@ -1681,18 +1678,18 @@ @findex c-context-line-break This command inserts a line break and indents the new line in a manner appropriate to the context. In normal code, it does the work of -@kbd{C-j} (@code{newline-and-indent}), in a C preprocessor line it -additionally inserts a @samp{\} at the line break, and within comments -it's like @kbd{M-j} (@code{c-indent-new-comment-line}). +@key{RET} (@code{newline}), in a C preprocessor line it additionally +inserts a @samp{\} at the line break, and within comments it's like +@kbd{M-j} (@code{c-indent-new-comment-line}). @code{c-context-line-break} isn't bound to a key by default, but it needs a binding to be useful. The following code will bind it to -@kbd{C-j}. We use @code{c-initialization-hook} here to make sure +@kbd{RET}. We use @code{c-initialization-hook} here to make sure the keymap is loaded before we try to change it. @example (defun my-bind-clb () - (define-key c-mode-base-map "\C-j" + (define-key c-mode-base-map "\C-m" 'c-context-line-break)) (add-hook 'c-initialization-hook 'my-bind-clb) @end example @@ -1812,6 +1809,7 @@ @table @kbd @item @key{TAB} @code{tab-to-tab-stop}. +@c FIXME: Maybe this should be consistent with other programming modes. @item C-j Insert a newline and then indent using @code{tab-to-tab-stop}. @item : === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-02-27 10:15:52 +0000 +++ doc/lispref/ChangeLog 2014-02-27 11:59:35 +0000 @@ -1,5 +1,7 @@ 2014-02-27 Xue Fuqiao + * text.texi (Margins): Fix the description of RET and `C-j'. + * frames.texi (Multiple Terminals): Document `display-monitor-attributes-list' and `display-monitor-attributes'. (Display Feature Testing): Add some notes about multi-monitor. === modified file 'doc/lispref/text.texi' --- doc/lispref/text.texi 2014-02-10 02:37:43 +0000 +++ doc/lispref/text.texi 2014-02-27 11:59:35 +0000 @@ -1717,7 +1717,7 @@ @defopt left-margin This variable specifies the base left margin column. In Fundamental -mode, @kbd{C-j} indents to this column. This variable automatically +mode, @kbd{RET} indents to this column. This variable automatically becomes buffer-local when set in any fashion. @end defopt === modified file 'doc/misc/cc-mode.texi' --- doc/misc/cc-mode.texi 2014-01-25 04:53:33 +0000 +++ doc/misc/cc-mode.texi 2014-02-27 11:59:35 +0000 @@ -751,6 +751,7 @@ @end itemize @table @asis +@c FIXME: This should be `electric-indent-just-newline' since GNU Emacs 24.4. @item @kbd{C-j} (@code{newline-and-indent}) @kindex C-j @findex newline-and-indent @@ -7054,6 +7055,7 @@ @kindex RET @kindex C-j @emph{Why doesn't the @kbd{RET} key indent the new line?} +@c FIXME: `electric-indent-mode' is enabled by default in GNU Emacs 24.4. Emacs's convention is that @kbd{RET} just adds a newline, and that @kbd{C-j} adds a newline and indents it. You can make @kbd{RET} do this === modified file 'doc/misc/octave-mode.texi' --- doc/misc/octave-mode.texi 2014-01-06 05:25:46 +0000 +++ doc/misc/octave-mode.texi 2014-02-27 11:59:35 +0000 @@ -148,6 +148,7 @@ in one of your Emacs startup files. @end table +@c FIXME: `electric-indent-mode' is enabled by default in GNU Emacs 24.4. A common problem is that the @key{RET} key does @emph{not} indent the line to where the new text should go after inserting the newline. This is because the standard Emacs convention is that @key{RET} (aka === modified file 'doc/misc/vip.texi' --- doc/misc/vip.texi 2014-02-25 08:41:47 +0000 +++ doc/misc/vip.texi 2014-02-27 11:59:35 +0000 @@ -1568,6 +1568,7 @@ @kindex 011 TAB (@code{indent-for-tab-command}) Indent line for current major mode (@code{indent-for-tab-command}). @item C-j +@c FIXME: This should be `electric-indent-just-newline' since GNU Emacs 24.4. @kindex 012 @kbd{C-j} (@code{newline-and-indent}) Insert a newline, then indent according to mode (@code{newline-and-indent}). @item C-k ------------------------------------------------------------ revno: 116577 committer: Michael Albinus branch nick: trunk timestamp: Thu 2014-02-27 12:59:04 +0100 message: Tramp adb fixes, found during test campaign. * net/tramp.el (tramp-call-process): Improve trace message. (tramp-handle-insert-file-contents): Trace error case. * net/tramp-adb.el (tramp-adb-file-name-handler-alist) : Use `tramp-handle-insert-directory'. (tramp-adb-handle-insert-directory): Remove function. (tramp-adb-send-command-and-check): New defun, replacing `tramp-adb-command-exit-status'. Change all callees. (tramp-adb-handle-file-attributes) (tramp-adb-handle-directory-files-and-attributes): Use it. (tramp-adb-ls-output-name-less-p): Use `directory-listing-before-filename-regexp'. (tramp-adb-handle-delete-directory): Flush also file properties of the truename of directory. (tramp-adb-handle-file-name-all-completions): Add "./" and "../". (tramp-adb-handle-file-local-copy): Make the local copy readable. (tramp-adb-handle-write-region): Implement APPEND. (tramp-adb-handle-rename-file): Make it more robust. Flush file properties correctly. (tramp-adb-maybe-open-connection): Set `tramp-current-*' variables. Check for connected devices only when needed. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2014-02-27 08:01:22 +0000 +++ lisp/ChangeLog 2014-02-27 11:59:04 +0000 @@ -1,3 +1,27 @@ +2014-02-27 Michael Albinus + + * net/tramp.el (tramp-call-process): Improve trace message. + (tramp-handle-insert-file-contents): Trace error case. + + * net/tramp-adb.el (tramp-adb-file-name-handler-alist) + : Use `tramp-handle-insert-directory'. + (tramp-adb-handle-insert-directory): Remove function. + (tramp-adb-send-command-and-check): New defun, replacing + `tramp-adb-command-exit-status'. Change all callees. + (tramp-adb-handle-file-attributes) + (tramp-adb-handle-directory-files-and-attributes): Use it. + (tramp-adb-ls-output-name-less-p): Use + `directory-listing-before-filename-regexp'. + (tramp-adb-handle-delete-directory): Flush also file properties of + the truename of directory. + (tramp-adb-handle-file-name-all-completions): Add "./" and "../". + (tramp-adb-handle-file-local-copy): Make the local copy readable. + (tramp-adb-handle-write-region): Implement APPEND. + (tramp-adb-handle-rename-file): Make it more robust. Flush file + properties correctly. + (tramp-adb-maybe-open-connection): Set `tramp-current-*' + variables. Check for connected devices only when needed. + 2014-02-27 Glenn Morris * minibuffer.el (completion-table-dynamic) === modified file 'lisp/net/tramp-adb.el' --- lisp/net/tramp-adb.el 2014-02-19 19:24:32 +0000 +++ lisp/net/tramp-adb.el 2014-02-27 11:59:04 +0000 @@ -38,7 +38,6 @@ ;; Pacify byte-compiler. (defvar directory-sep-char) -(defvar dired-move-to-filename-regexp) (defcustom tramp-adb-program "adb" "Name of the Android Debug Bridge program." @@ -134,7 +133,7 @@ (find-backup-file-name . tramp-handle-find-backup-file-name) ;; `find-file-noselect' performed by default handler. ;; `get-file-buffer' performed by default handler. - (insert-directory . tramp-adb-handle-insert-directory) + (insert-directory . tramp-handle-insert-directory) (insert-file-contents . tramp-handle-insert-file-contents) (load . tramp-handle-load) (make-auto-save-file-name . tramp-handle-make-auto-save-file-name) @@ -309,17 +308,17 @@ (defun tramp-adb-handle-file-attributes (filename &optional id-format) "Like `file-attributes' for Tramp files." (unless id-format (setq id-format 'integer)) - (ignore-errors - (with-parsed-tramp-file-name filename nil - (with-tramp-file-property - v localname (format "file-attributes-%s" id-format) - (tramp-adb-barf-unless-okay - v (format "%s -d -l %s" - (tramp-adb-get-ls-command v) - (tramp-shell-quote-argument localname)) "") - (with-current-buffer (tramp-get-buffer v) - (tramp-adb-sh-fix-ls-output) - (cdar (tramp-do-parse-file-attributes-with-ls v id-format))))))) + (with-parsed-tramp-file-name filename nil + (with-tramp-file-property + v localname (format "file-attributes-%s" id-format) + (and + (tramp-adb-send-command-and-check + v (format "%s -d -l %s" + (tramp-adb-get-ls-command v) + (tramp-shell-quote-argument localname))) + (with-current-buffer (tramp-get-buffer v) + (tramp-adb-sh-fix-ls-output) + (cdar (tramp-do-parse-file-attributes-with-ls v id-format))))))) (defun tramp-do-parse-file-attributes-with-ls (vec &optional id-format) "Parse `file-attributes' for Tramp files using the ls(1) command." @@ -366,11 +365,19 @@ (with-tramp-file-property v localname (format "directory-files-attributes-%s-%s-%s-%s" full match id-format nosort) - (tramp-adb-barf-unless-okay - v (format "%s -a -l %s" - (tramp-adb-get-ls-command v) - (tramp-shell-quote-argument localname)) "") (with-current-buffer (tramp-get-buffer v) + (when (tramp-adb-send-command-and-check + v (format "%s -a -l %s" + (tramp-adb-get-ls-command v) + (tramp-shell-quote-argument localname))) + ;; We insert also filename/. and filename/.., because "ls" doesn't. + (narrow-to-region (point) (point)) + (tramp-adb-send-command + v (format "%s -d -a -l %s %s" + (tramp-adb-get-ls-command v) + (concat (file-name-as-directory localname) ".") + (concat (file-name-as-directory localname) ".."))) + (widen)) (tramp-adb-sh-fix-ls-output) (let ((result (tramp-do-parse-file-attributes-with-ls v (or id-format 'integer)))) @@ -392,8 +399,7 @@ (defun tramp-adb-get-ls-command (vec) (with-tramp-connection-property vec "ls" (tramp-message vec 5 "Finding a suitable `ls' command") - (if (zerop (tramp-adb-command-exit-status - vec "ls --color=never -al /dev/null")) + (if (tramp-adb-send-command-and-check vec "ls --color=never -al /dev/null") ;; On CyanogenMod based system BusyBox is used and "ls" output ;; coloring is enabled by default. So we try to disable it ;; when possible. @@ -417,35 +423,6 @@ (and (not (string-match "\\(^--\\|^[^-]\\)" s)) s)) switches)))))) -(defun tramp-adb-handle-insert-directory - (filename switches &optional _wildcard _full-directory-p) - "Like `insert-directory' for Tramp files." - (when (stringp switches) - (setq switches (tramp-adb--gnu-switches-to-ash (split-string switches)))) - (with-parsed-tramp-file-name (file-truename filename) nil - (with-current-buffer (tramp-get-buffer v) - (let ((name (tramp-shell-quote-argument (directory-file-name localname))) - (switch-d (member "-d" switches)) - (switch-t (member "-t" switches)) - (switches (mapconcat 'identity (remove "-t" switches) " "))) - (tramp-adb-barf-unless-okay - v (format "%s %s %s" (tramp-adb-get-ls-command v) switches name) - "Cannot insert directory listing: %s" filename) - (unless switch-d - ;; We insert also filename/. and filename/.., because "ls" doesn't. - (narrow-to-region (point) (point)) - (ignore-errors - (tramp-adb-barf-unless-okay - v (format "%s -d %s %s %s" - (tramp-adb-get-ls-command v) - switches - (concat (file-name-as-directory name) ".") - (concat (file-name-as-directory name) "..")) - "Cannot insert directory listing: %s" filename)) - (widen)) - (tramp-adb-sh-fix-ls-output switch-t))) - (insert-buffer-substring (tramp-get-buffer v)))) - (defun tramp-adb-sh-fix-ls-output (&optional sort-by-time) "Insert dummy 0 in empty size columns. Androids \"ls\" command doesn't insert size column for directories: @@ -489,9 +466,9 @@ (defun tramp-adb-ls-output-name-less-p (a b) "Sort \"ls\" output by name, ascending." (let (posa posb) - (string-match dired-move-to-filename-regexp a) + (string-match directory-listing-before-filename-regexp a) (setq posa (match-end 0)) - (string-match dired-move-to-filename-regexp b) + (string-match directory-listing-before-filename-regexp b) (setq posb (match-end 0)) (string-lessp (substring a posa) (substring b posb)))) @@ -511,6 +488,9 @@ (defun tramp-adb-handle-delete-directory (directory &optional recursive) "Like `delete-directory' for Tramp files." (setq directory (expand-file-name directory)) + (with-parsed-tramp-file-name (file-truename directory) nil + (tramp-flush-file-property v (file-name-directory localname)) + (tramp-flush-directory-property v localname)) (with-parsed-tramp-file-name directory nil (tramp-flush-file-property v (file-name-directory localname)) (tramp-flush-directory-property v localname) @@ -538,20 +518,22 @@ (with-tramp-file-property v localname "file-name-all-completions" (save-match-data (tramp-adb-send-command - v (format "%s %s" + v (format "%s -a %s" (tramp-adb-get-ls-command v) (tramp-shell-quote-argument localname))) (mapcar (lambda (f) - (if (file-directory-p f) + (if (file-directory-p (expand-file-name f directory)) (file-name-as-directory f) f)) (with-current-buffer (tramp-get-buffer v) - (delq - nil - (mapcar - (lambda (l) (and (not (string-match "^[[:space:]]*$" l)) l)) - (split-string (buffer-string) "\n")))))))))) + (append + '("." "..") + (delq + nil + (mapcar + (lambda (l) (and (not (string-match "^[[:space:]]*$" l)) l)) + (split-string (buffer-string) "\n"))))))))))) (defun tramp-adb-handle-file-local-copy (filename) "Like `file-local-copy' for Tramp files." @@ -567,7 +549,10 @@ (delete-file tmpfile) (tramp-error v 'file-error "Cannot make local copy of file `%s'" filename)) - (set-file-modes tmpfile (file-modes filename))) + (set-file-modes + tmpfile + (logior (or (file-modes filename) 0) + (tramp-compat-octal-to-decimal "0400")))) tmpfile))) (defun tramp-adb-handle-file-writable-p (filename) @@ -577,9 +562,8 @@ (with-tramp-file-property v localname "file-writable-p" (if (tramp-adb-find-test-command v) (if (file-exists-p filename) - (zerop - (tramp-adb-command-exit-status - v (format "test -w %s" (tramp-shell-quote-argument localname)))) + (tramp-adb-send-command-and-check + v (format "test -w %s" (tramp-shell-quote-argument localname))) (and (file-directory-p (file-name-directory filename)) (file-writable-p (file-name-directory filename)))) @@ -599,9 +583,6 @@ "Like `write-region' for Tramp files." (setq filename (expand-file-name filename)) (with-parsed-tramp-file-name filename nil - (when append - (tramp-error - v 'file-error "Cannot append to file using Tramp (`%s')" filename)) (when (and confirm (file-exists-p filename)) (unless (y-or-n-p (format "File %s exists; overwrite anyway? " filename)) @@ -612,6 +593,12 @@ (tramp-flush-file-property v localname) (let* ((curbuf (current-buffer)) (tmpfile (tramp-compat-make-temp-file filename))) + (when (and append (file-exists-p filename)) + (copy-file filename tmpfile 'ok) + (set-file-modes + tmpfile + (logior (or (file-modes tmpfile) 0) + (tramp-compat-octal-to-decimal "0600")))) (tramp-run-real-handler 'write-region (list start end tmpfile append 'no-message lockname confirm)) @@ -645,8 +632,8 @@ (let ((time (if (or (null time) (equal time '(0 0))) (current-time) time))) - (tramp-adb-command-exit-status - ;; use shell arithmetic because of Emacs integer size limit + (tramp-adb-send-command-and-check + ;; Use shell arithmetic because of Emacs integer size limit. v (format "touch -t $(( %d * 65536 + %d )) %s" (car time) (cadr time) (tramp-shell-quote-argument localname)))))) @@ -704,32 +691,36 @@ (setq filename (expand-file-name filename) newname (expand-file-name newname)) - (with-parsed-tramp-file-name - (if (tramp-tramp-file-p filename) filename newname) nil - (with-tramp-progress-reporter - v 0 (format "Renaming %s to %s" newname filename) - - (if (and (tramp-equal-remote filename newname) - (not (file-directory-p filename))) - (progn - (when (and (not ok-if-already-exists) - (file-exists-p newname)) - (tramp-error v 'file-already-exists newname)) - ;; We must also flush the cache of the directory, because - ;; `file-attributes' reads the values from there. - (tramp-flush-file-property v (file-name-directory localname)) - (tramp-flush-file-property v localname) - ;; Short track. - (tramp-adb-barf-unless-okay - v (format - "mv %s %s" - (tramp-file-name-handler 'file-remote-p filename 'localname) - localname) - "Error renaming %s to %s" filename newname)) - - ;; Rename by copy. - (copy-file filename newname ok-if-already-exists t t) - (delete-file filename))))) + (let ((t1 (tramp-tramp-file-p filename)) + (t2 (tramp-tramp-file-p newname))) + (with-parsed-tramp-file-name (if t1 filename newname) nil + (with-tramp-progress-reporter + v 0 (format "Renaming %s to %s" filename newname) + + (if (and t1 t2 + (tramp-equal-remote filename newname) + (not (file-directory-p filename))) + (let ((l1 (tramp-file-name-handler + 'file-remote-p filename 'localname)) + (l2 (tramp-file-name-handler + 'file-remote-p newname 'localname))) + (when (and (not ok-if-already-exists) + (file-exists-p newname)) + (tramp-error v 'file-already-exists newname)) + ;; We must also flush the cache of the directory, because + ;; `file-attributes' reads the values from there. + (tramp-flush-file-property v (file-name-directory l1)) + (tramp-flush-file-property v l1) + (tramp-flush-file-property v (file-name-directory l2)) + (tramp-flush-file-property v l2) + ;; Short track. + (tramp-adb-barf-unless-okay + v (format "mv %s %s" l1 l2) + "Error renaming %s to %s" filename newname)) + + ;; Rename by copy. + (copy-file filename newname ok-if-already-exists t t) + (delete-file filename)))))) (defun tramp-adb-handle-process-file (program &optional infile destination display &rest args) @@ -1010,7 +1001,7 @@ "Checks, whether the ash has a builtin \"test\" command. This happens for Android >= 4.0." (with-tramp-connection-property vec "test" - (zerop (tramp-adb-command-exit-status vec "type test")))) + (tramp-adb-send-command-and-check vec "type test"))) ;; Connection functions @@ -1033,9 +1024,9 @@ (while (re-search-forward "\r+$" nil t) (replace-match "" nil nil))))) -(defun tramp-adb-command-exit-status +(defun tramp-adb-send-command-and-check (vec command) - "Run COMMAND and return its exit status. + "Run COMMAND and and check its exit status. Sends `echo $?' along with the COMMAND for checking the exit status. If COMMAND is nil, just sends `echo $?'. Returns the exit status found." (tramp-adb-send-command @@ -1049,14 +1040,14 @@ vec 'file-error "Couldn't find exit status of `%s'" command)) (skip-chars-forward "^ ") (prog1 - (read (current-buffer)) + (zerop (read (current-buffer))) (let (buffer-read-only) (delete-region (match-beginning 0) (point-max)))))) (defun tramp-adb-barf-unless-okay (vec command fmt &rest args) "Run COMMAND, check exit status, throw error if exit status not okay. FMT and ARGS are passed to `error'." - (unless (zerop (tramp-adb-command-exit-status vec command)) + (unless (tramp-adb-send-command-and-check vec command) (apply 'tramp-error vec 'file-error fmt args))) (defun tramp-adb-wait-for-output (proc &optional timeout) @@ -1099,7 +1090,7 @@ (p (get-buffer-process buf)) (host (tramp-file-name-host vec)) (user (tramp-file-name-user vec)) - (devices (mapcar 'cadr (tramp-adb-parse-device-names nil)))) + devices) ;; Maybe we know already that "su" is not supported. We cannot ;; use a connection property, because we have not checked yet @@ -1111,6 +1102,10 @@ (and p (processp p) (memq (process-status p) '(run open))) (save-match-data (when (and p (processp p)) (delete-process p)) + (setq tramp-current-method (tramp-file-name-method vec) + tramp-current-user (tramp-file-name-user vec) + tramp-current-host (tramp-file-name-host vec) + devices (mapcar 'cadr (tramp-adb-parse-device-names nil))) (if (not devices) (tramp-error vec 'file-error "No device connected")) (if (and (> (length host) 0) (not (member host devices))) @@ -1165,7 +1160,7 @@ ;; Change user if indicated. (when user (tramp-adb-send-command vec (format "su %s" user)) - (unless (zerop (tramp-adb-command-exit-status vec nil)) + (unless (tramp-adb-send-command-and-check vec nil) (delete-process p) (tramp-set-file-property vec "" "su-command-p" nil) (tramp-error === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2014-02-21 07:52:04 +0000 +++ lisp/net/tramp.el 2014-02-27 11:59:04 +0000 @@ -3050,10 +3050,13 @@ v 3 (format "Inserting `%s'" filename) (unwind-protect (if (not (file-exists-p filename)) - ;; We don't raise a Tramp error, because it might be - ;; suppressed, like in `find-file-noselect-1'. - (signal 'file-error - (list "File not found on remote host" filename)) + (progn + ;; We don't raise a Tramp error, because it might be + ;; suppressed, like in `find-file-noselect-1'. + (tramp-message + v 1 "File not `%s' found on remote host" filename) + (signal 'file-error + (list "File not found on remote host" filename))) (if (and (tramp-local-host-p v) (let (file-name-handler-alist) @@ -4082,7 +4085,7 @@ Furthermore, traces are written with verbosity of 6." (tramp-message (vector tramp-current-method tramp-current-user tramp-current-host nil nil) - 6 "%s %s %s" program infile args) + 6 "`%s %s' %s" program (mapconcat 'identity args " ") infile) (if (executable-find program) (apply 'call-process program infile destination display args) 1)) ------------------------------------------------------------ revno: 116576 committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2014-02-27 18:26:14 +0800 message: Fix previous change. diff: === modified file 'etc/NEWS' --- etc/NEWS 2014-02-27 08:09:11 +0000 +++ etc/NEWS 2014-02-27 10:26:14 +0000 @@ -128,6 +128,7 @@ ** Multi-monitor support has been added. ++++ *** New functions `display-monitor-attributes-list' and `frame-monitor-attributes' can be used to obtain information about each physical monitor on multi-monitor setups. ------------------------------------------------------------ revno: 116575 [merge] committer: Xue Fuqiao branch nick: trunk timestamp: Thu 2014-02-27 18:22:13 +0800 message: Some doc about multi-monitor. * doc/lispref/frames.texi (Multiple Terminals): Document `display-monitor-attributes-list' and `display-monitor-attributes'. (Display Feature Testing): Add some notes about multi-monitor. * etc/NEWS: Related edit. diff: === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2014-02-27 08:01:22 +0000 +++ doc/lispref/ChangeLog 2014-02-27 10:15:52 +0000 @@ -1,3 +1,9 @@ +2014-02-27 Xue Fuqiao + + * frames.texi (Multiple Terminals): Document + `display-monitor-attributes-list' and `display-monitor-attributes'. + (Display Feature Testing): Add some notes about multi-monitor. + 2014-02-27 Glenn Morris * minibuf.texi (Programmed Completion): === modified file 'doc/lispref/frames.texi' --- doc/lispref/frames.texi 2014-01-01 07:43:34 +0000 +++ doc/lispref/frames.texi 2014-02-27 10:15:52 +0000 @@ -266,10 +266,6 @@ server, Emacs knows by the similarity in their names that they share a single keyboard. - On some ``multi-monitor'' setups, a single X display outputs to more -than one physical monitor. Currently, there is no way for Emacs to -distinguish between the different physical monitors. - @deffn Command make-frame-on-display display &optional parameters This function creates and returns a new frame on @var{display}, taking the other frame parameters from the alist @var{parameters}. @@ -316,6 +312,61 @@ on that display (@pxref{Deleting Frames}). @end defun +@cindex multi-monitor + On some ``multi-monitor'' setups, a single X display outputs to more +than one physical monitor. @code{display-monitor-attributes-list} and +@code{frame-monitor-attributes} can be used to obtain information +about each physical monitor on multi-monitor setups. + +@defun display-monitor-attributes-list &optional display +This function returns a list of physical monitor attributes on +@var{display}. Each element of the list is an association list, +representing the attributes of each physical monitor. The first +element corresponds to the primary monitor. + +Attributes for a physical monitor are: + +@table @samp +@item geometry +Position and size in pixels in the form of @samp{(X Y WIDTH HEIGHT)} + +@item workarea +Position and size of the workarea in pixels in the form of @samp{(X Y +WIDTH HEIGHT)} + +@item mm-size +Width and height in millimeters in the form of @samp{(WIDTH HEIGHT)} + +@item frames +List of frames dominated by the physical monitor + +@item name +Name of the physical monitor as a string +@end table + +where X, Y, WIDTH, and HEIGHT are integers. @samp{name} is optional. + +A frame is dominated by a physical monitor when either the +largest area of the frame resides in the monitor, or the monitor +is the closest to the frame if the frame does not intersect any +physical monitors. Every non-tip frame (including invisible one) +in a graphical display is dominated by exactly one physical +monitor at a time, though it can span multiple (or no) physical +monitors. + +@var{display} defaults to the selected frame's display. +@end defun + +@defun frame-monitor-attributes &optional frame +This function returns the attributes of the physical monitor +dominating @var{frame}, which defaults to the selected frame. + +A frame is dominated by a physical monitor when either the +largest area of the frame resides in the monitor, or the monitor +is the closest to the frame if the frame does not intersect any +physical monitors. +@end defun + @node Frame Parameters @section Frame Parameters @cindex frame parameters @@ -2370,12 +2421,13 @@ This function returns the number of screens associated with the display. @end defun +@c FIXME: Document `x-display-pixel-{width, height}'? @defun display-pixel-height &optional display This function returns the height of the screen in pixels. On a character terminal, it gives the height in characters. For graphical terminals, note that on ``multi-monitor'' setups this -refers to the pixel width for all physical monitors associated with +refers to the pixel height for all physical monitors associated with @var{display}. @xref{Multiple Terminals}. @end defun @@ -2388,14 +2440,23 @@ @var{display}. @xref{Multiple Terminals}. @end defun +@c FIXME: Document `x-display-mm-{width, height}'? @defun display-mm-height &optional display This function returns the height of the screen in millimeters, or @code{nil} if Emacs cannot get that information. + +For graphical terminals, note that on ``multi-monitor'' setups this +refers to the height for all physical monitors associated with +@var{display}. @xref{Multiple Terminals}. @end defun @defun display-mm-width &optional display This function returns the width of the screen in millimeters, or @code{nil} if Emacs cannot get that information. + +For graphical terminals, note that on ``multi-monitor'' setups this +refers to the width for all physical monitors associated with +@var{display}. @xref{Multiple Terminals}. @end defun @defopt display-mm-dimensions-alist ------------------------------------------------------------ revno: 116574 committer: Glenn Morris branch nick: trunk timestamp: Thu 2014-02-27 00:09:11 -0800 message: * etc/NEWS: Copyedit. diff: === modified file 'etc/NEWS' --- etc/NEWS 2014-02-27 08:01:22 +0000 +++ etc/NEWS 2014-02-27 08:09:11 +0000 @@ -1178,10 +1178,12 @@ The default `crm-separator' has been changed to allow surrounding spaces around the comma. -*** The `common-substring' arg of `display-completion-list' is obsolete. -Either use `completion-all-completions', which returns highlighted -strings (including for partial or substring completion), or call -`completion-hilit-commonality' to add the highlight. +*** The `common-substring' argument of `display-completion-list', +which has been documented as obsolete since Emacs 23.1, is now _really_ +obsolete, and no longer advertised. Instead use either +`completion-all-completions', which returns highlighted strings (including +for partial or substring completion), or call `completion-hilit-commonality' +to add the highlight. +++ *** New function `completion-table-with-cache' is a wrapper for ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.