summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2016-07-09 07:06:53 +0200
committerMario Lang <mlang@delysid.org>2016-07-09 07:06:53 +0200
commite52ad7fdfc7148a75897c92588712169894f7a5c (patch)
treee38e46626f5c1247d52d9ba2ede1b26952950237
parent47f6336e6a9954a06fe8a88eb7a822ad5b4aedac (diff)
parent316bbd956e8ce9f5cbbc750fda61eb570276ceea (diff)
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
-rw-r--r--lisp/emacs-lisp/lisp-mode.el5
-rw-r--r--lisp/net/secrets.el58
-rw-r--r--lisp/net/tramp-gvfs.el71
3 files changed, 83 insertions, 51 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index a277d7a668..ee3bda95b8 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -168,7 +168,10 @@
(defvar lisp-doc-string-elt-property 'doc-string-elt
"The symbol property that holds the docstring position info.")
-(defconst lisp-prettify-symbols-alist '(("lambda" . ?λ))
+(defconst lisp-prettify-symbols-alist
+ '(("lambda" . ?λ)
+ ("sqrt" . ?√)
+ ("not" . ?¬))
"Alist of symbol/\"pretty\" characters to be displayed.")
;;;; Font-lock support.
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
index 55d5f007ac..ea26a521af 100644
--- a/lisp/net/secrets.el
+++ b/lisp/net/secrets.el
@@ -1,4 +1,4 @@
-;;; secrets.el --- Client interface to gnome-keyring and kwallet.
+;;; secrets.el --- Client interface to gnome-keyring and kwallet. -*- lexical-binding: t -*-
;; Copyright (C) 2010-2016 Free Software Foundation, Inc.
@@ -433,7 +433,7 @@ returned, and it will be stored in `secrets-session-path'."
"Handler for signals emitted by `secrets-interface-service'."
(cond
((string-equal (dbus-event-member-name last-input-event) "CollectionCreated")
- (add-to-list 'secrets-collection-paths (car args)))
+ (cl-pushnew (car args) secrets-collection-paths))
((string-equal (dbus-event-member-name last-input-event) "CollectionDeleted")
(setq secrets-collection-paths
(delete (car args) secrets-collection-paths)))))
@@ -610,12 +610,11 @@ The object labels of the found items are returned as list."
(error 'wrong-type-argument (car attributes)))
(unless (stringp (cadr attributes))
(error 'wrong-type-argument (cadr attributes)))
- (setq props (add-to-list
- 'props
+ (setq props (append
+ props
(list :dict-entry
(substring (symbol-name (car attributes)) 1)
- (cadr attributes))
- 'append)
+ (cadr attributes)))
attributes (cddr attributes)))
;; Search. The result is a list of object paths.
(setq result
@@ -649,12 +648,11 @@ The object path of the created item is returned."
(error 'wrong-type-argument (car attributes)))
(unless (stringp (cadr attributes))
(error 'wrong-type-argument (cadr attributes)))
- (setq props (add-to-list
- 'props
+ (setq props (append
+ props
(list :dict-entry
(substring (symbol-name (car attributes)) 1)
- (cadr attributes))
- 'append)
+ (cadr attributes)))
attributes (cddr attributes)))
;; Create the item.
(setq result
@@ -734,33 +732,30 @@ If there is no such item, or the item doesn't own this attribute, return nil."
;;; Visualization.
-(define-derived-mode secrets-mode nil "Secrets"
+(defvar secrets-mode-map
+ (let ((map (make-sparse-keymap)))
+ (set-keymap-parent map (make-composed-keymap special-mode-map widget-keymap))
+ (define-key map "n" 'next-line)
+ (define-key map "p" 'previous-line)
+ (define-key map "z" 'kill-this-buffer)
+ map)
+ "Keymap used in `secrets-mode' buffers.")
+
+(define-derived-mode secrets-mode special-mode "Secrets"
"Major mode for presenting password entries retrieved by Security Service.
In this mode, widgets represent the search results.
\\{secrets-mode-map}"
- ;; Keymap.
- (setq secrets-mode-map (copy-keymap special-mode-map))
- (set-keymap-parent secrets-mode-map widget-keymap)
- (define-key secrets-mode-map "z" 'kill-this-buffer)
-
+ (setq buffer-undo-list t)
+ (set (make-local-variable 'revert-buffer-function)
+ #'secrets-show-collections)
;; When we toggle, we must set temporary widgets.
(set (make-local-variable 'tree-widget-after-toggle-functions)
- '(secrets-tree-widget-after-toggle-function))
-
- (when (not (called-interactively-p 'interactive))
- ;; Initialize buffer.
- (setq buffer-read-only t)
- (let ((inhibit-read-only t))
- (erase-buffer))))
+ '(secrets-tree-widget-after-toggle-function)))
;; It doesn't make sense to call it interactively.
(put 'secrets-mode 'disabled t)
-;; The very first buffer created with `secrets-mode' does not have the
-;; keymap etc. So we create a dummy buffer. Stupid.
-(with-temp-buffer (secrets-mode))
-
;; We autoload `secrets-show-secrets' only on systems with D-Bus support.
;;;###autoload(when (featurep 'dbusbind)
;;;###autoload (autoload 'secrets-show-secrets "secrets" nil t))
@@ -783,10 +778,9 @@ to their attributes."
(secrets-mode)
(secrets-show-collections))))
-(defun secrets-show-collections ()
+(defun secrets-show-collections (&optional _ignore _noconfirm)
"Show all available collections."
- (let ((inhibit-read-only t)
- (alias (secrets-get-alias "default")))
+ (let ((inhibit-read-only t))
(erase-buffer)
(tree-widget-set-theme "folder")
(dolist (coll (secrets-list-collections))
@@ -855,7 +849,7 @@ to their attributes."
"%v\n"))))
attributes))))
-(defun secrets-tree-widget-after-toggle-function (widget &rest ignore)
+(defun secrets-tree-widget-after-toggle-function (widget &rest _ignore)
"Add a temporary widget to show the password."
(dolist (child (widget-get widget :children))
(when (widget-member child :secret)
@@ -867,7 +861,7 @@ to their attributes."
"Show password")))
(widget-setup))
-(defun secrets-tree-widget-show-password (widget &rest ignore)
+(defun secrets-tree-widget-show-password (widget &rest _ignore)
"Show password, and remove temporary widget."
(let ((parent (widget-get widget :parent)))
(widget-put parent :secret nil)
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 5afd290d35..038bb533c3 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -803,7 +803,7 @@ file names."
(tramp-gvfs-maybe-open-connection (vector method user host "/" hop)))
(setq localname
(replace-match
- (tramp-get-file-property v "/" "default-location" "~")
+ (tramp-get-connection-property v "default-location" "~")
nil t localname 1)))
;; Tilde expansion is not possible.
(when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
@@ -1418,8 +1418,8 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
(unless (string-equal prefix "/")
(tramp-set-file-property v "/" "prefix" prefix))
(tramp-set-file-property v "/" "fuse-mountpoint" fuse-mountpoint)
- (tramp-set-file-property
- v "/" "default-location" default-location)))))))
+ (tramp-set-connection-property
+ v "default-location" default-location)))))))
(when tramp-gvfs-enabled
(dbus-register-signal
@@ -1505,7 +1505,8 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
(unless (string-equal prefix "/")
(tramp-set-file-property vec "/" "prefix" prefix))
(tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint)
- (tramp-set-file-property vec "/" "default-location" default-location)
+ (tramp-set-connection-property
+ vec "default-location" default-location)
(throw 'mounted t)))))))
(defun tramp-gvfs-mount-spec-entry (key value)
@@ -1571,6 +1572,41 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
;; Connection functions.
+(defun tramp-gvfs-get-remote-uid (vec id-format)
+ "The uid of the remote connection VEC, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
+ (with-tramp-connection-property vec (format "uid-%s" id-format)
+ (let ((method (tramp-file-name-method vec))
+ (user (tramp-file-name-user vec))
+ (host (tramp-file-name-host vec))
+ (localname
+ (tramp-get-connection-property vec "default-location" nil)))
+ (cond
+ ((and user (equal id-format 'string)) user)
+ (localname
+ (nth 2 (file-attributes
+ (tramp-make-tramp-file-name method user host localname)
+ id-format)))
+ ((equal id-format 'integer) tramp-unknown-id-integer)
+ ((equal id-format 'string) tramp-unknown-id-string)))))
+
+(defun tramp-gvfs-get-remote-gid (vec id-format)
+ "The gid of the remote connection VEC, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
+ (with-tramp-connection-property vec (format "gid-%s" id-format)
+ (let ((method (tramp-file-name-method vec))
+ (user (tramp-file-name-user vec))
+ (host (tramp-file-name-host vec))
+ (localname
+ (tramp-get-connection-property vec "default-location" nil)))
+ (cond
+ (localname
+ (nth 3 (file-attributes
+ (tramp-make-tramp-file-name method user host localname)
+ id-format)))
+ ((equal id-format 'integer) tramp-unknown-id-integer)
+ ((equal id-format 'string) tramp-unknown-id-string)))))
+
(defun tramp-gvfs-maybe-open-connection (vec)
"Maybe open a connection VEC.
Does not do anything if a connection is already open, but re-opens the
@@ -1600,14 +1636,14 @@ connection if a previous connection has died for some reason."
(tramp-gvfs-object-path
(tramp-make-tramp-file-name method user host ""))))
- (when (and (string-equal method "smb")
- (string-equal localname "/"))
- (tramp-error vec 'file-error "Filename must contain a Windows share"))
-
(when (and (string-equal method "afp")
(string-equal localname "/"))
(tramp-error vec 'file-error "Filename must contain an AFP volume"))
+ (when (and (string-equal method "smb")
+ (string-equal localname "/"))
+ (tramp-error vec 'file-error "Filename must contain a Windows share"))
+
(with-tramp-progress-reporter
vec 3
(if (zerop (length user))
@@ -1680,16 +1716,15 @@ connection if a previous connection has died for some reason."
(tramp-get-connection-process vec) "connected" t))))
;; In `tramp-check-cached-permissions', the connection properties
- ;; {uig,gid}-{integer,string} are used. We set them to their local
- ;; counterparts.
- (with-tramp-connection-property
- vec "uid-integer" (tramp-get-local-uid 'integer))
- (with-tramp-connection-property
- vec "gid-integer" (tramp-get-local-gid 'integer))
- (with-tramp-connection-property
- vec "uid-string" (tramp-get-local-uid 'string))
- (with-tramp-connection-property
- vec "gid-string" (tramp-get-local-gid 'string)))
+ ;; {uig,gid}-{integer,string} are used. We set them to proper values.
+ (unless (tramp-get-connection-property vec "uid-integer" nil)
+ (tramp-gvfs-get-remote-uid vec 'integer))
+ (unless (tramp-get-connection-property vec "gid-integer" nil)
+ (tramp-gvfs-get-remote-gid vec 'integer))
+ (unless (tramp-get-connection-property vec "uid-string" nil)
+ (tramp-gvfs-get-remote-uid vec 'string))
+ (unless (tramp-get-connection-property vec "gid-string" nil)
+ (tramp-gvfs-get-remote-gid vec 'string)))
(defun tramp-gvfs-send-command (vec command &rest args)
"Send the COMMAND with its ARGS to connection VEC.