commit 4c3cd27df9c0735d907813a8c16a87acc54b9edc (HEAD, refs/remotes/origin/master) Author: Dima Kogan Date: Mon Sep 19 22:55:34 2016 -0700 Give '$' punctuation syntax in make-mode (Bug#24477) * lisp/progmodes/make-mode.el (makefile-mode-syntax-table): Set syntax of '$' to punctuation. diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el index ba2b1cb94a..f67407f48e 100644 --- a/lisp/progmodes/make-mode.el +++ b/lisp/progmodes/make-mode.el @@ -713,6 +713,7 @@ The function must satisfy this calling convention: (modify-syntax-entry ?# "< " st) (modify-syntax-entry ?\n "> " st) (modify-syntax-entry ?= "." st) + (modify-syntax-entry ?$ "." st) st) "Syntax table used in `makefile-mode'.") commit 2fda57c6fb29262261911819ec8f5e4cccb3abbb Author: Noam Postavsky Date: Sat May 12 15:09:18 2018 -0400 Simplify eshell arg processing with (pop (nthcdr ...)) * lisp/eshell/esh-opt.el (eshell--set-option) (eshell--process-args): Use (pop (nthcdr ...)) instead of writing it out by hand. diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index 80eb15359a..d7a449450f 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -200,11 +200,7 @@ will be modified." (if (eq (nth 2 opt) t) (if (> ai (length eshell--args)) (error "%s: missing option argument" name) - (prog1 (nth ai eshell--args) - (if (> ai 0) - (setcdr (nthcdr (1- ai) eshell--args) - (nthcdr (1+ ai) eshell--args)) - (setq eshell--args (cdr eshell--args))))) + (pop (nthcdr ai eshell--args))) (or (nth 2 opt) t))))) (defun eshell--process-option (name switch kind ai options opt-vals) @@ -264,10 +260,7 @@ switch is unrecognized." ;; dash or switch argument found, parse (let* ((dash (match-string 1 arg)) (switch (match-string 2 arg))) - (if (= ai 0) - (setq eshell--args (cdr eshell--args)) - (setcdr (nthcdr (1- ai) eshell--args) - (nthcdr (1+ ai) eshell--args))) + (pop (nthcdr ai eshell--args)) (if dash (if (> (length switch) 0) (eshell--process-option name switch 1 ai options opt-vals) commit a4c616e27aa48e7d524e0c5cfaf67f17d04989e4 Author: Jay Kamat Date: Tue May 8 12:36:36 2018 -0700 esh-opt.el: Add a :parse-leading-options-only argument (Bug#28323) * lisp/eshell/esh-opt.el (eshell-eval-using-options): Add a new :parse-leading-options-only argument which ignores dash/switch arguments after the first positional argument. (eshell--process-args): Abort processing of arguments if we see one positional argument and :parse-leading-options-only is set. * lisp/eshell/em-tramp.el (eshell/sudo): Use :parse-leading-options-only, to avoid parsing subcommand switches as switches of sudo itself. * test/lisp/eshell/esh-opt-tests.el: Add tests for new and old behavior. diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el index 004c495490..9475f4ed94 100644 --- a/lisp/eshell/em-tramp.el +++ b/lisp/eshell/em-tramp.el @@ -107,6 +107,7 @@ Uses the system sudo through TRAMP's sudo method." '((?h "help" nil nil "show this usage screen") (?u "user" t user "execute a command as another USER") :show-usage + :parse-leading-options-only :usage "[(-u | --user) USER] COMMAND Execute a COMMAND as the superuser or another USER.") (throw 'eshell-external diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index 67b7d05985..80eb15359a 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -80,6 +80,10 @@ arguments, some do not. The recognized :KEYWORDS are: If present, do not pass MACRO-ARGS through `eshell-flatten-list' and `eshell-stringify-list'. +:parse-leading-options-only + If present, do not parse dash or switch arguments after the first +positional argument. Instead, treat them as positional arguments themselves. + For example, OPTIONS might look like: ((?C nil nil multi-column \"multi-column display\") @@ -245,12 +249,19 @@ switch is unrecognized." (list sym))))) options))) (ai 0) arg - (eshell--args args)) - (while (< ai (length eshell--args)) + (eshell--args args) + (pos-argument-found nil)) + (while (and (< ai (length eshell--args)) + ;; Abort if we saw the first pos argument and option is set + (not (and pos-argument-found + (memq :parse-leading-options-only options)))) (setq arg (nth ai eshell--args)) (if (not (and (stringp arg) (string-match "^-\\(-\\)?\\(.*\\)" arg))) - (setq ai (1+ ai)) + ;; Positional argument found, skip + (setq ai (1+ ai) + pos-argument-found t) + ;; dash or switch argument found, parse (let* ((dash (match-string 1 arg)) (switch (match-string 2 arg))) (if (= ai 0) diff --git a/test/lisp/eshell/esh-opt-tests.el b/test/lisp/eshell/esh-opt-tests.el new file mode 100644 index 0000000000..13b522b389 --- /dev/null +++ b/test/lisp/eshell/esh-opt-tests.el @@ -0,0 +1,124 @@ +;;; tests/esh-opt-tests.el --- esh-opt test suite + +;; Copyright (C) 2018 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'esh-opt) + +(ert-deftest esh-opt-process-args-test () + "Unit tests which verify correct behavior of `eshell--process-args'." + (should + (equal '(t) + (eshell--process-args + "sudo" + '("-a") + '((?a "all" nil show-all ""))))) + (should + (equal '(nil) + (eshell--process-args + "sudo" + '("-g") + '((?a "all" nil show-all ""))))) + (should + (equal '("root" "world") + (eshell--process-args + "sudo" + '("-u" "root" "world") + '((?u "user" t user "execute a command as another USER"))))) + (should + (equal '(nil "emerge" "-uDN" "world") + (eshell--process-args + "sudo" + '("emerge" "-uDN" "world") + '((?u "user" t user "execute a command as another USER") + :parse-leading-options-only)))) + (should + (equal '("root" "emerge" "-uDN" "world") + (eshell--process-args + "sudo" + '("-u" "root" "emerge" "-uDN" "world") + '((?u "user" t user "execute a command as another USER") + :parse-leading-options-only)))) + (should + (equal '("world" "emerge") + (eshell--process-args + "sudo" + '("-u" "root" "emerge" "-uDN" "world") + '((?u "user" t user "execute a command as another USER")))))) + +(ert-deftest test-eshell-eval-using-options () + "Tests for `eshell-eval-using-options'." + (eshell-eval-using-options + "sudo" '("-u" "root" "whoami") + '((?u "user" t user "execute a command as another USER") + :parse-leading-options-only) + (should (equal user "root"))) + (eshell-eval-using-options + "sudo" '("--user" "root" "whoami") + '((?u "user" t user "execute a command as another USER") + :parse-leading-options-only) + (should (equal user "root"))) + + (eshell-eval-using-options + "sudo" '("emerge" "-uDN" "world") + '((?u "user" t user "execute a command as another USER")) + (should (equal user "world"))) + (eshell-eval-using-options + "sudo" '("emerge" "-uDN" "world") + '((?u "user" t user "execute a command as another USER") + :parse-leading-options-only) + (should (eq user nil))) + + (eshell-eval-using-options + "ls" '("-I" "*.txt" "/dev/null") + '((?I "ignore" t ignore-pattern + "do not list implied entries matching pattern")) + (should (equal ignore-pattern "*.txt"))) + + (eshell-eval-using-options + "ls" '("-l" "/dev/null") + '((?l nil long-listing listing-style + "use a long listing format")) + (should (eql listing-style 'long-listing))) + (eshell-eval-using-options + "ls" '("/dev/null") + '((?l nil long-listing listing-style + "use a long listing format")) + (should (eq listing-style nil))) + + (eshell-eval-using-options + "ls" '("/dev/null" "-h") + '((?h "human-readable" 1024 human-readable + "print sizes in human readable format")) + (should (eql human-readable 1024))) + (eshell-eval-using-options + "ls" '("/dev/null" "--human-readable") + '((?h "human-readable" 1024 human-readable + "print sizes in human readable format")) + (should (eql human-readable 1024))) + (eshell-eval-using-options + "ls" '("/dev/null") + '((?h "human-readable" 1024 human-readable + "print sizes in human readable format")) + (should (eq human-readable nil)))) + +(provide 'esh-opt-tests) + +;;; esh-opt-tests.el ends here commit 92a8230e49a65be48442ee95cf50c90514e48f99 Author: Jay Kamat Date: Tue May 8 12:04:00 2018 -0700 esh-opt.el: Fix improper parsing of first argument (Bug#28323) Examples of broken behavior: sudo -u root whoami Outputs: -u ls -I '*.txt' /dev/null Errors with: *.txt: No such file or directory * lisp/eshell/esh-opt.el (eshell--process-args): Refactor usage of args to eshell--args, as we rely on modifications from eshell--process-option and vice versa. These modifications were not being propogated in the (if (= ai 0)) case, since popping the first element of a list doesn't destructively modify the underlying list object. diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el index b802696306..67b7d05985 100644 --- a/lisp/eshell/esh-opt.el +++ b/lisp/eshell/esh-opt.el @@ -246,26 +246,27 @@ switch is unrecognized." options))) (ai 0) arg (eshell--args args)) - (while (< ai (length args)) - (setq arg (nth ai args)) + (while (< ai (length eshell--args)) + (setq arg (nth ai eshell--args)) (if (not (and (stringp arg) (string-match "^-\\(-\\)?\\(.*\\)" arg))) (setq ai (1+ ai)) (let* ((dash (match-string 1 arg)) (switch (match-string 2 arg))) (if (= ai 0) - (setq args (cdr args)) - (setcdr (nthcdr (1- ai) args) (nthcdr (1+ ai) args))) + (setq eshell--args (cdr eshell--args)) + (setcdr (nthcdr (1- ai) eshell--args) + (nthcdr (1+ ai) eshell--args))) (if dash (if (> (length switch) 0) (eshell--process-option name switch 1 ai options opt-vals) - (setq ai (length args))) + (setq ai (length eshell--args))) (let ((len (length switch)) (index 0)) (while (< index len) (eshell--process-option name (aref switch index) 0 ai options opt-vals) (setq index (1+ index)))))))) - (nconc (mapcar #'cdr opt-vals) args))) + (nconc (mapcar #'cdr opt-vals) eshell--args))) ;;; esh-opt.el ends here commit 3cc714d1024c3e51a7dd996678d07dbf73de2306 Merge: 8f088e1513 c2ef847d3c Author: Glenn Morris Date: Tue May 15 09:09:48 2018 -0700 Merge from origin/emacs-26 c2ef847 (origin/emacs-26) Clarify the mode-line indicators in CC Mode commit 8f088e1513719d810febbf0754ab27c8243c2a1b Merge: 3ee1841f28 934bb475b9 Author: Glenn Morris Date: Tue May 15 09:09:48 2018 -0700 ; Merge from origin/emacs-26 The following commit was skipped: 934bb47 Fix filesystem littering by Flymake's legacy backend commit 3ee1841f288b5b9cf9301945d10db2b45688bcf8 Merge: b3956d85c7 b98cf9cdab Author: Glenn Morris Date: Tue May 15 09:09:48 2018 -0700 Merge from origin/emacs-26 b98cf9c ; Fix a typo in the Emacs manual 700fcd7 * doc/emacs/help.texi: Fix paren typo. c9c0e40 More minor changes in shell-related nodes of Emacs manual e6bf19c Fix inaccuracies in "Shell Ring" node of Emacs manual 087681b8 Improve documentation of kmacro commands and variables. be2e8cb * doc/man/emacs.1.in: Document --fg-daemon and --bg-daemon. 1d9e66a Don't check non-X frames for z order (Bug#31373) 7dc028e Check NSWindow is actually a frame Conflicts: src/nsfns.m commit b3956d85c71c30af732a8bc035ed39421bafe11d Author: Michael Albinus Date: Tue May 15 14:48:11 2018 +0200 Fix Bug#29575 * lisp/net/secrets.el (secrets-create-item): The new item does not need a unique label. (secrets-item-path, secrets-get-secret, secrets-get-attributes) (secrets-get-attribute, secrets-delete-item): ITEM can also be an object path. (Bug#29575) * test/lisp/net/secrets-tests.el (secrets-test03-items): Test also creation of two items with same label. Test `secrets-get-secret', `secrets-get-attribute' and `secrets-get-attributes' with object path. (secrets-test04-search): Harden test. diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index f7cc011615..22a4e8c7b0 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el @@ -641,8 +641,9 @@ The object labels of the found items are returned as list." (defun secrets-create-item (collection item password &rest attributes) "Create a new item in COLLECTION with label ITEM and password PASSWORD. -ATTRIBUTES are key-value pairs set for the created item. The -keys are keyword symbols, starting with a colon. Example: +The label ITEM must not be unique in COLLECTION. ATTRIBUTES are +key-value pairs set for the created item. The keys are keyword +symbols, starting with a colon. Example: (secrets-create-item \"Tramp collection\" \"item\" \"geheim\" :method \"sudo\" :user \"joe\" :host \"remote-host\") @@ -655,67 +656,73 @@ determined by this. If no `:xdg:schema' is given, \"org.freedesktop.Secret.Generic\" is used by default. The object path of the created item is returned." - (unless (member item (secrets-list-items collection)) - (let ((collection-path (secrets-unlock-collection collection)) - result props) - (unless (secrets-empty-path collection-path) - ;; Set default type if needed. - (unless (member :xdg:schema attributes) - (setq attributes - (append - attributes - `(:xdg:schema ,secrets-interface-item-type-generic)))) - ;; Create attributes list. - (while (consp (cdr attributes)) - (unless (keywordp (car attributes)) - (error 'wrong-type-argument (car attributes))) - (unless (stringp (cadr attributes)) - (error 'wrong-type-argument (cadr attributes))) - (setq props (append - props - `((:dict-entry - ,(substring (symbol-name (car attributes)) 1) - ,(cadr attributes)))) - attributes (cddr attributes))) - ;; Create the item. - (setq result - (dbus-call-method - :session secrets-service collection-path - secrets-interface-collection "CreateItem" - ;; Properties. - (append - `(:array - (:dict-entry ,(concat secrets-interface-item ".Label") - (:variant ,item))) - (when props - `((:dict-entry ,(concat secrets-interface-item ".Attributes") - (:variant ,(append '(:array) props)))))) - ;; Secret. - (append - `(:struct :object-path ,secrets-session-path - (:array :signature "y") ;; No parameters. - ,(dbus-string-to-byte-array password)) - ;; We add the content_type. In backward compatibility - ;; mode, nil is appended, which means nothing. - secrets-struct-secret-content-type) - ;; Do not replace. Replace does not seem to work. - nil)) - (secrets-prompt (cadr result)) - ;; Return the object path. - (car result))))) + (let ((collection-path (secrets-unlock-collection collection)) + result props) + (unless (secrets-empty-path collection-path) + ;; Set default type if needed. + (unless (member :xdg:schema attributes) + (setq attributes + (append + attributes `(:xdg:schema ,secrets-interface-item-type-generic)))) + ;; Create attributes list. + (while (consp (cdr attributes)) + (unless (keywordp (car attributes)) + (error 'wrong-type-argument (car attributes))) + (unless (stringp (cadr attributes)) + (error 'wrong-type-argument (cadr attributes))) + (setq props (append + props + `((:dict-entry + ,(substring (symbol-name (car attributes)) 1) + ,(cadr attributes)))) + attributes (cddr attributes))) + ;; Create the item. + (setq result + (dbus-call-method + :session secrets-service collection-path + secrets-interface-collection "CreateItem" + ;; Properties. + (append + `(:array + (:dict-entry ,(concat secrets-interface-item ".Label") + (:variant ,item))) + (when props + `((:dict-entry ,(concat secrets-interface-item ".Attributes") + (:variant ,(append '(:array) props)))))) + ;; Secret. + (append + `(:struct :object-path ,secrets-session-path + (:array :signature "y") ;; No parameters. + ,(dbus-string-to-byte-array password)) + ;; We add the content_type. In backward compatibility + ;; mode, nil is appended, which means nothing. + secrets-struct-secret-content-type) + ;; Do not replace. Replace does not seem to work. + nil)) + (secrets-prompt (cadr result)) + ;; Return the object path. + (car result)))) (defun secrets-item-path (collection item) "Return the object path of item labeled ITEM in COLLECTION. -If there is no such item, return nil." +If there are several items labeled ITEM, it is undefined which +one is returned. If there is no such item, return nil. + +ITEM can also be an object path, which is returned if contained in COLLECTION." (let ((collection-path (secrets-unlock-collection collection))) - (catch 'item-found - (dolist (item-path (secrets-get-items collection-path)) - (when (string-equal item (secrets-get-item-property item-path "Label")) - (throw 'item-found item-path)))))) + (or (and (member item (secrets-get-items collection-path)) item) + (catch 'item-found + (dolist (item-path (secrets-get-items collection-path)) + (when (string-equal + item (secrets-get-item-property item-path "Label")) + (throw 'item-found item-path))))))) (defun secrets-get-secret (collection item) "Return the secret of item labeled ITEM in COLLECTION. -If there is no such item, return nil." +If there are several items labeled ITEM, it is undefined which +one is returned. If there is no such item, return nil. + +ITEM can also be an object path, which is used if contained in COLLECTION." (let ((item-path (secrets-item-path collection item))) (unless (secrets-empty-path item-path) (dbus-byte-array-to-string @@ -726,8 +733,11 @@ If there is no such item, return nil." (defun secrets-get-attributes (collection item) "Return the lookup attributes of item labeled ITEM in COLLECTION. -If there is no such item, or the item has no attributes, return nil." - (unless (stringp collection) (setq collection "default")) +If there are several items labeled ITEM, it is undefined which +one is returned. If there is no such item, or the item has no +attributes, return nil. + +ITEM can also be an object path, which is used if contained in COLLECTION." (let ((item-path (secrets-item-path collection item))) (unless (secrets-empty-path item-path) (mapcar @@ -739,11 +749,19 @@ If there is no such item, or the item has no attributes, return nil." (defun secrets-get-attribute (collection item attribute) "Return the value of ATTRIBUTE of item labeled ITEM in COLLECTION. -If there is no such item, or the item doesn't own this attribute, return nil." +If there are several items labeled ITEM, it is undefined which +one is returned. If there is no such item, or the item doesn't +own this attribute, return nil. + +ITEM can also be an object path, which is used if contained in COLLECTION." (cdr (assoc attribute (secrets-get-attributes collection item)))) (defun secrets-delete-item (collection item) - "Delete ITEM in COLLECTION." + "Delete item labeled ITEM in COLLECTION. +If there are several items labeled ITEM, it is undefined which +one is deleted. + +ITEM can also be an object path, which is used if contained in COLLECTION." (let ((item-path (secrets-item-path collection item))) (unless (secrets-empty-path item-path) (secrets-prompt diff --git a/test/lisp/net/secrets-tests.el b/test/lisp/net/secrets-tests.el index 23512d48ee..fcc3a2d3e6 100644 --- a/test/lisp/net/secrets-tests.el +++ b/test/lisp/net/secrets-tests.el @@ -148,37 +148,48 @@ (skip-unless (secrets-empty-path secrets-session-path)) (unwind-protect - (progn + (let (item-path) ;; There shall be no items in the "session" collection. (should-not (secrets-list-items "session")) ;; There shall be items in the "Login" collection. (should (secrets-list-items "Login")) ;; Create a new item. - (secrets-create-item "session" "foo" "secret") - (should (string-equal (secrets-get-secret "session" "foo") "secret")) + (should (setq item-path (secrets-create-item "session" "foo" "secret"))) + (dolist (item `("foo" ,item-path)) + (should (string-equal (secrets-get-secret "session" item) "secret"))) + + ;; Create another item with same label. + (should (secrets-create-item "session" "foo" "geheim")) + (should (equal (secrets-list-items "session") '("foo" "foo"))) ;; Create an item with attributes. - (secrets-create-item - "session" "bar" "secret" - :method "sudo" :user "joe" :host "remote-host") (should - (string-equal (secrets-get-attribute "session" "bar" :method) "sudo")) - ;; The attributes are collected in reverse order. :xdg:schema - ;; is added silently. - (should - (equal - (secrets-get-attributes "session" "bar") - '((:xdg:schema . "org.freedesktop.Secret.Generic") - (:host . "remote-host") (:user . "joe") (:method . "sudo")))) + (setq item-path + (secrets-create-item + "session" "bar" "secret" + :method "sudo" :user "joe" :host "remote-host"))) + (dolist (item `("bar" ,item-path)) + (should + (string-equal (secrets-get-attribute "session" item :method) "sudo")) + ;; The attributes are collected in reverse order. + ;; :xdg:schema is added silently. + (should + (equal + (secrets-get-attributes "session" item) + '((:xdg:schema . "org.freedesktop.Secret.Generic") + (:host . "remote-host") (:user . "joe") (:method . "sudo"))))) ;; Create an item with another schema. - (secrets-create-item - "session" "baz" "secret" :xdg:schema "org.gnu.Emacs.foo") (should - (equal - (secrets-get-attributes "session" "baz") - '((:xdg:schema . "org.gnu.Emacs.foo")))) + (setq item-path + (secrets-create-item + "session" "baz" "secret" :xdg:schema "org.gnu.Emacs.foo"))) + (dolist (item `("baz" ,item-path)) + (should + (equal + (secrets-get-attributes "session" item) + '((:xdg:schema . "org.gnu.Emacs.foo"))))) ;; Delete them. (dolist (item (secrets-list-items "session")) @@ -201,15 +212,18 @@ (should-not (secrets-list-items "session")) ;; Create some items. - (secrets-create-item - "session" "foo" "secret" - :method "sudo" :user "joe" :host "remote-host") - (secrets-create-item - "session" "bar" "secret" - :method "sudo" :user "smith" :host "remote-host") - (secrets-create-item - "session" "baz" "secret" - :method "ssh" :user "joe" :host "other-host") + (should + (secrets-create-item + "session" "foo" "secret" + :method "sudo" :user "joe" :host "remote-host")) + (should + (secrets-create-item + "session" "bar" "secret" + :method "sudo" :user "smith" :host "remote-host")) + (should + (secrets-create-item + "session" "baz" "secret" + :method "ssh" :user "joe" :host "other-host")) ;; Search the items. (should-not (secrets-search-items "session" :user "john")) commit 73a367795f6dfc947a91798c6a62de822e199053 Merge: c595d5dd00 bb97552784 Author: Michael Albinus Date: Tue May 15 11:07:46 2018 +0200 Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs commit c595d5dd00980975286391151181883a8c71742d Author: Michael Albinus Date: Tue May 15 11:06:18 2018 +0200 Fix Bug#31068 * lisp/net/tramp-archive.el (tramp-archive-file-name-handler): Unregister unless `tramp-archive-enabled'. (Bug#31068) diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 448cfca2ca..42c3d40c1b 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -117,7 +117,7 @@ (defvar url-tramp-protocols) ;; We cannot check `tramp-gvfs-enabled' in loaddefs.el, because this -;; would load Tramp. So we make a cheaper check. +;; would load Tramp. So we make a cheaper check. ;;;###autoload (defvar tramp-archive-enabled (featurep 'dbusbind) "Non-nil when file archive support is available.") @@ -302,27 +302,33 @@ pass to the OPERATION." "Invoke the file archive related OPERATION. First arg specifies the OPERATION, second arg is a list of arguments to pass to the OPERATION." - (let* ((filename (apply 'tramp-archive-file-name-for-operation - operation args)) - (archive (tramp-archive-file-name-archive filename))) - ;; The file archive could be a directory, see Bug#30293. - (if (and archive - (tramp-archive-run-real-handler 'file-directory-p (list archive))) - (tramp-archive-run-real-handler operation args) - ;; Now run the handler. - (unless tramp-archive-enabled - (tramp-user-error nil "Package `tramp-archive' not supported")) - (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) - (tramp-gvfs-methods tramp-archive-all-gvfs-methods) - ;; Set uid and gid. gvfsd-archive could do it, but it doesn't. - (tramp-unknown-id-integer (user-uid)) - (tramp-unknown-id-string (user-login-name)) - (fn (assoc operation tramp-archive-file-name-handler-alist))) - (when (eq (cdr fn) 'tramp-archive-handle-not-implemented) - (setq args (cons operation args))) - (if fn - (save-match-data (apply (cdr fn) args)) - (tramp-archive-run-real-handler operation args)))))) + (if (not tramp-archive-enabled) + ;; Unregister `tramp-archive-file-name-handler'. + (progn + (tramp-register-file-name-handlers) + (tramp-archive-run-real-handler operation args)) + + (let* ((filename (apply 'tramp-archive-file-name-for-operation + operation args)) + (archive (tramp-archive-file-name-archive filename))) + + ;; The file archive could be a directory, see Bug#30293. + (if (and archive + (tramp-archive-run-real-handler + 'file-directory-p (list archive))) + (tramp-archive-run-real-handler operation args) + ;; Now run the handler. + (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods)) + (tramp-gvfs-methods tramp-archive-all-gvfs-methods) + ;; Set uid and gid. gvfsd-archive could do it, but it doesn't. + (tramp-unknown-id-integer (user-uid)) + (tramp-unknown-id-string (user-login-name)) + (fn (assoc operation tramp-archive-file-name-handler-alist))) + (when (eq (cdr fn) 'tramp-archive-handle-not-implemented) + (setq args (cons operation args))) + (if fn + (save-match-data (apply (cdr fn) args)) + (tramp-archive-run-real-handler operation args))))))) ;;;###autoload (progn (defun tramp-register-archive-file-name-handler () commit c2ef847d3ca45ac4c15a99d7eea462932d9cc9f4 (refs/remotes/origin/emacs-26) Author: Eli Zaretskii Date: Mon May 14 19:28:06 2018 +0300 Clarify the mode-line indicators in CC Mode * doc/emacs/programs.texi (Electric C): Explain '*' and '/' in the CC Mode mode-line. (Bug31445) diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index d3d7028c14..138f82a6bf 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1696,7 +1696,9 @@ chaotically indented code. If you are new to CC Mode, you might find it disconcerting. You can toggle electric action with the command @kbd{C-c C-l}; when it is enabled, @samp{/@var{c}l} appears in the mode line after the mode name (where @var{c}, if present, is @samp{*} -or @samp{/}): +or @samp{/}, depending on whether the comment style is block or line). +@xref{Minor Modes,,, ccmode, The CC Mode Manual}, for more about +mode-line indicators in CC Mode. @table @kbd @item C-c C-l commit 934bb475b9a729d0be4d78cd89c1d22d032ee3d7 Author: João Távora Date: Fri May 11 23:28:40 2018 +0100 Fix filesystem littering by Flymake's legacy backend The Flymake legacy "proc" backend, which is active by default will try to syntax-check foo.c/foo.cpp and many other types of files, but on failing to find a suitable Makefile target, will fail. There's nothing wrong with that except that it used to leave behind the foo_flymake.c and foo_flymake.cpp auxiliary files behind, littering the filesystem. * lisp/progmodes/flymake-proc.el (flymake-proc-legacy-flymake): Call init-function inside of the unwind-protect. diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el index c5bb79fee6..4792a94530 100644 --- a/lisp/progmodes/flymake-proc.el +++ b/lisp/progmodes/flymake-proc.el @@ -772,43 +772,43 @@ can also be executed interactively independently of (flymake-proc--clear-buildfile-cache) (flymake-proc--clear-project-include-dirs-cache) - (let* ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name)) - (cmd-and-args (funcall init-f)) - (cmd (nth 0 cmd-and-args)) - (args (nth 1 cmd-and-args)) - (dir (nth 2 cmd-and-args)) - (success nil)) + (let ((cleanup-f (flymake-proc--get-cleanup-function buffer-file-name)) + (success nil)) (unwind-protect - (cond - ((not cmd-and-args) - (flymake-log 1 "init function %s for %s failed, cleaning up" - init-f buffer-file-name)) - (t - (setq proc - (let ((default-directory (or dir default-directory))) - (when dir - (flymake-log 3 "starting process on dir %s" dir)) - (make-process - :name "flymake-proc" - :buffer (current-buffer) - :command (cons cmd args) - :noquery t - :filter - (lambda (proc string) - (let ((flymake-proc--report-fn report-fn)) - (flymake-proc--process-filter proc string))) - :sentinel - (lambda (proc event) - (let ((flymake-proc--report-fn report-fn)) - (flymake-proc--process-sentinel proc event)))))) - (process-put proc 'flymake-proc--output-buffer - (generate-new-buffer - (format " *flymake output for %s*" (current-buffer)))) - (setq flymake-proc--current-process proc) - (flymake-log 2 "started process %d, command=%s, dir=%s" - (process-id proc) (process-command proc) - default-directory) - (setq success t))) + (let* ((cmd-and-args (funcall init-f)) + (cmd (nth 0 cmd-and-args)) + (args (nth 1 cmd-and-args)) + (dir (nth 2 cmd-and-args))) + (cond + ((not cmd-and-args) + (flymake-log 1 "init function %s for %s failed, cleaning up" + init-f buffer-file-name)) + (t + (setq proc + (let ((default-directory (or dir default-directory))) + (when dir + (flymake-log 3 "starting process on dir %s" dir)) + (make-process + :name "flymake-proc" + :buffer (current-buffer) + :command (cons cmd args) + :noquery t + :filter + (lambda (proc string) + (let ((flymake-proc--report-fn report-fn)) + (flymake-proc--process-filter proc string))) + :sentinel + (lambda (proc event) + (let ((flymake-proc--report-fn report-fn)) + (flymake-proc--process-sentinel proc event)))))) + (process-put proc 'flymake-proc--output-buffer + (generate-new-buffer + (format " *flymake output for %s*" (current-buffer)))) + (setq flymake-proc--current-process proc) + (flymake-log 2 "started process %d, command=%s, dir=%s" + (process-id proc) (process-command proc) + default-directory) + (setq success t)))) (unless success (funcall cleanup-f)))))))) commit b98cf9cdabd710f89eb57645a163fd52db338404 Author: Eli Zaretskii Date: Sat May 12 12:09:05 2018 +0300 ; Fix a typo in the Emacs manual * doc/emacs/fixit.texi (Transpose): Fix a typo. Reported by Takesi Ayanokoji . diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi index 7cacac4240..fe2da7ae4f 100644 --- a/doc/emacs/fixit.texi +++ b/doc/emacs/fixit.texi @@ -180,7 +180,7 @@ Otherwise, a reverse search (@kbd{C-r}) is often the best way. dragging the word preceding or containing point forward as well. The punctuation characters between the words do not move. For example, @w{@samp{FOO, BAR}} transposes into @w{@samp{BAR, FOO}} rather than -@samp{@w{BAR FOO,}}. When point is at the end of the line, it will +@w{@samp{BAR FOO,}}. When point is at the end of the line, it will transpose the word before point with the first word on the next line. @kbd{C-M-t} (@code{transpose-sexps}) is a similar command for commit 700fcd77d7d3fbe7e48a637db9225706553b0262 Author: Paul Eggert Date: Fri May 11 16:09:14 2018 -0700 * doc/emacs/help.texi: Fix paren typo. diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index a5700760d4..94d27a276d 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -491,7 +491,7 @@ buffer (@pxref{Package Menu}). @findex describe-package @kindex C-h P @kbd{C-h P} (@code{describe-package}) prompts for the name of a -package (@pxref{Packages}, and displays a help buffer describing the +package (@pxref{Packages}), and displays a help buffer describing the attributes of the package and the features that it implements. The buffer lists the keywords that relate to the package in the form of buttons. Click on a button with @kbd{mouse-1} or @kbd{mouse-2} to see commit c9c0e40d673a5fc0d24d30ff67ccb7c7f2fb482a Author: Eli Zaretskii Date: Fri May 11 12:39:52 2018 +0300 More minor changes in shell-related nodes of Emacs manual * doc/emacs/misc.texi (Interactive Shell): Clarify how the window that displays "*shell*" is selected. (Shell Prompts): Fix a typo. Reported by Jorge in emacs-manual-bugs. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 4aa8e3f700..cd9b67bcde 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -784,7 +784,8 @@ text in the buffer. To give input to the subshell, go to the end of the buffer and type the input, terminated by @key{RET}. By default, when the subshell is invoked interactively, the -@file{*shell*} buffer is displayed in a new window. This behavior can +@file{*shell*} buffer is displayed in a new window, unless the current +window already shows the @file{*shell*} buffer. This behavior can be customized via @code{display-buffer-alist} (@pxref{Window Choice}). While the subshell is waiting or running a command, you can switch @@ -1071,7 +1072,7 @@ Emacs Lisp Reference Manual}). @vindex comint-use-prompt-regexp @vindex shell-prompt-pattern If you change the variable @code{comint-use-prompt-regexp} to a -non-@code{nil} value, then Comint mode recognize prompts using a +non-@code{nil} value, then Comint mode will recognize prompts using a regular expression (@pxref{Regexps}). In Shell mode, the regular expression is specified by the variable @code{shell-prompt-pattern}. The default value of @code{comint-use-prompt-regexp} is @code{nil}, commit e6bf19cfffaca98da4d8f83fb3675dc972337661 Author: Eli Zaretskii Date: Fri May 11 12:32:31 2018 +0300 Fix inaccuracies in "Shell Ring" node of Emacs manual * doc/emacs/misc.texi (Shell Ring): Don't mention 'M-s' and don't insist on Shell history commands being "jsut like" similar commands that operate on minibuffer history. Reported by Jorge in emacs-manual-bugs. diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 12ebfbf26a..4aa8e3f700 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi @@ -1145,10 +1145,11 @@ Display the buffer's history of shell commands in another window Shell buffers provide a history of previously entered shell commands. To reuse shell commands from the history, use the editing -commands @kbd{M-p}, @kbd{M-n}, @kbd{M-r} and @kbd{M-s}. These work -just like the minibuffer history commands (@pxref{Minibuffer +commands @kbd{M-p}, @kbd{M-n}, and @kbd{M-r}. These work +similar to the minibuffer history commands (@pxref{Minibuffer History}), except that they operate within the Shell buffer rather -than the minibuffer. +than the minibuffer, and @code{M-r} in a Shell buffer invokes +incremental search through shell command history. @kbd{M-p} fetches an earlier shell command to the end of the shell buffer. Successive use of @kbd{M-p} fetches successively earlier commit 087681b8590ba0aa32273c9e11fe088be223d114 Author: Eli Zaretskii Date: Fri May 11 12:11:14 2018 +0300 Improve documentation of kmacro commands and variables. * lisp/kmacro.el (kmacro-start-macro-or-insert-counter) (kmacro-counter, kmacro-set-format, kmacro-set-counter) (kmacro-add-counter, kmacro-counter-format) (kmacro-insert-counter): Clarify and improve the doc strings. (Bug#31243) diff --git a/lisp/kmacro.el b/lisp/kmacro.el index 8855fa5c31..7abd8aed79 100644 --- a/lisp/kmacro.el +++ b/lisp/kmacro.el @@ -233,12 +233,19 @@ macro to be executed before appending to it." ;;; Keyboard macro counter (defvar kmacro-counter 0 - "Current keyboard macro counter.") + "Current keyboard macro counter. + +This is normally initialized to zero when the macro is defined, +and incremented each time the value of the counter is inserted +into a buffer. See `kmacro-start-macro-or-insert-counter' for +more details.") (defvar kmacro-default-counter-format "%d") (defvar kmacro-counter-format "%d" - "Current keyboard macro counter format.") + "Current keyboard macro counter format. + +Can be set directly via `kmacro-set-format', which see.") (defvar kmacro-counter-format-start kmacro-counter-format "Macro format at start of macro execution.") @@ -254,9 +261,9 @@ macro to be executed before appending to it." (defun kmacro-insert-counter (arg) - "Insert macro counter, then increment it by ARG. + "Insert current value of `kmacro-counter', then increment it by ARG. Interactively, ARG defaults to 1. With \\[universal-argument], insert -previous `kmacro-counter', and do not modify counter." +current value of `kmacro-counter', but do not increment it." (interactive "P") (if kmacro-initial-counter-value (setq kmacro-counter kmacro-initial-counter-value @@ -268,7 +275,7 @@ previous `kmacro-counter', and do not modify counter." (defun kmacro-set-format (format) - "Set macro counter FORMAT." + "Set the format of `kmacro-counter' to FORMAT." (interactive "sMacro Counter Format: ") (setq kmacro-counter-format (if (equal format "") "%d" format)) @@ -284,7 +291,7 @@ previous `kmacro-counter', and do not modify counter." (defun kmacro-set-counter (arg) - "Set `kmacro-counter' to ARG or prompt if missing. + "Set the value of `kmacro-counter' to ARG, or prompt for value if no argument. With \\[universal-argument] prefix, reset counter to its value prior to this iteration of the macro." (interactive "NMacro counter value: ") (if (not (or defining-kbd-macro executing-kbd-macro)) @@ -298,7 +305,7 @@ With \\[universal-argument] prefix, reset counter to its value prior to this ite (defun kmacro-add-counter (arg) - "Add numeric prefix arg (prompt if missing) to macro counter. + "Add the value of numeric prefix arg (prompt if missing) to `kmacro-counter'. With \\[universal-argument], restore previous counter value." (interactive "NAdd to macro counter: ") (if kmacro-initial-counter-value @@ -677,18 +684,21 @@ use \\[kmacro-name-last-macro]." "Record subsequent keyboard input, defining a keyboard macro. The commands are recorded even as they are executed. -Sets the `kmacro-counter' to ARG (or 0 if no prefix arg) before defining the -macro. +Initializes the macro's `kmacro-counter' to ARG (or 0 if no prefix arg) +before defining the macro. With \\[universal-argument], appends to current keyboard macro (keeping the current value of `kmacro-counter'). -When defining/executing macro, inserts macro counter and increments -the counter with ARG or 1 if missing. With \\[universal-argument], -inserts previous `kmacro-counter' (but do not modify counter). +When used during defining/executing a macro, inserts the current value +of `kmacro-counter' and increments the counter value by ARG (or by 1 if no +prefix argument). With just \\[universal-argument], inserts the current value +of `kmacro-counter', but does not modify the counter; this is the +same as incrementing the counter by zero. -The macro counter can be modified via \\[kmacro-set-counter] and \\[kmacro-add-counter]. -The format of the counter can be modified via \\[kmacro-set-format]." +The macro counter can be set directly via \\[kmacro-set-counter] and \\[kmacro-add-counter]. +The format of the inserted value of the counter can be controlled +via \\[kmacro-set-format]." (interactive "P") (if (or defining-kbd-macro executing-kbd-macro) (kmacro-insert-counter arg) commit be2e8cb8be28affa830c21e2425573c3a1855a85 Author: Noam Postavsky Date: Thu May 10 22:47:04 2018 -0400 * doc/man/emacs.1.in: Document --fg-daemon and --bg-daemon. diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in index 5116953041..e332fb45c7 100644 --- a/doc/man/emacs.1.in +++ b/doc/man/emacs.1.in @@ -123,7 +123,7 @@ Use specified as the terminal instead of using stdin/stdout. This must be the first argument specified in the command line. .TP -.BI \-\-daemon "\fR[=\fPname\fR]" +.BI \-\-daemon "\fR[=\fPname\fR], " \-\-bg\-daemon "\fR[=\fPname\fR]" Start Emacs as a daemon, enabling the Emacs server and disconnecting from the terminal. You can then use the emacsclient (see .BR emacsclient (1)) @@ -131,6 +131,9 @@ command to connect to the server (with optional .IR name ")." .TP +.BI \-\-fg\-daemon "\fR[=\fPname\fR]" +Like "\-\-bg\-daemon", but don't disconnect from the terminal. +.TP .B \-\-version Display .I Emacs commit 1d9e66aea17787e03954f32c6cd7561c881bb444 Author: Noam Postavsky Date: Sun May 6 10:07:25 2018 -0400 Don't check non-X frames for z order (Bug#31373) * src/xfns.c (x_frame_list_z_order): Only use frames with `output_method' set to `output_x_window'. diff --git a/src/xfns.c b/src/xfns.c index 20fe61bffd..3da853ede8 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -5300,12 +5300,16 @@ x_frame_list_z_order (Display* dpy, Window window) Lisp_Object frame, tail; FOR_EACH_FRAME (tail, frame) - /* With a reparenting window manager the parent_desc field - usually specifies the topmost windows of our frames. - Otherwise FRAME_OUTER_WINDOW should do. */ - if (XFRAME (frame)->output_data.x->parent_desc == children[i] - || FRAME_OUTER_WINDOW (XFRAME (frame)) == children[i]) - frames = Fcons (frame, frames); + { + struct frame *cf = XFRAME (frame); + /* With a reparenting window manager the parent_desc + field usually specifies the topmost windows of our + frames. Otherwise FRAME_OUTER_WINDOW should do. */ + if (FRAME_X_P (cf) + && (cf->output_data.x->parent_desc == children[i] + || FRAME_OUTER_WINDOW (cf) == children[i])) + frames = Fcons (frame, frames); + } } if (children) XFree ((char *)children); commit 7dc028e2501feec7d7fca5987ab852b261aa4039 Author: Alan Third Date: Sun May 6 21:49:31 2018 +0100 Check NSWindow is actually a frame * src/nsfns.m (Fns_frame_list_z_order): Check NSWindow is an instance of EmacsView before treating it as one. diff --git a/src/nsfns.m b/src/nsfns.m index 7f2f060dda..bd1e2283a0 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -1497,7 +1497,8 @@ Frames are listed from topmost (first) to bottommost (last). */) Lisp_Object frame; /* Check against [win parentWindow] so that it doesn't match itself. */ - if (parent == nil || ns_window_is_ancestor (parent, [win parentWindow])) + if ([[win delegate] isKindOfClass:[EmacsView class]] + && (parent == nil || ns_window_is_ancestor (parent, [win parentWindow]))) { XSETFRAME (frame, ((EmacsView *)[win delegate])->emacsframe); frames = Fcons(frame, frames);