aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2012-04-14 11:11:27 -0700
committerPaul Eggert2012-04-14 11:11:27 -0700
commit899b41b6e37a321e14559d2cf3c05ea3f8063811 (patch)
tree1ca101db0dfe3f96c4fb40eae537003f32e51557
parent3078ffdd457776d0b44b40a9581c36b56b780450 (diff)
parent3c80ae807c532597ba07ff028efc8add447f962e (diff)
downloademacs-899b41b6e37a321e14559d2cf3c05ea3f8063811.tar.gz
emacs-899b41b6e37a321e14559d2cf3c05ea3f8063811.zip
Merge from trunk.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/ChangeLog23
-rw-r--r--lisp/progmodes/which-func.el2
-rw-r--r--lisp/server.el67
-rw-r--r--lisp/vc/diff-mode.el2
5 files changed, 85 insertions, 14 deletions
diff --git a/etc/NEWS b/etc/NEWS
index e5157fd9da9..69e04cf9244 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -60,8 +60,11 @@ character when doing minibuffer filename prompts.
60** which-function-mode now applies to all applicable major modes by default. 60** which-function-mode now applies to all applicable major modes by default.
61 61
62** erc will look up server/channel names via auth-source and use the 62** erc will look up server/channel names via auth-source and use the
63 channel keys found, if any. 63channel keys found, if any.
64 64
65** The `server-auth-key' variable can be used to set a permanent
66shared key for Emacs Server.
67
65** Obsolete packages: 68** Obsolete packages:
66 69
67*** mailpost.el 70*** mailpost.el
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c25fab9b619..5b16d78f1ca 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,26 @@
12012-04-14 Juanma Barranquero <lekktu@gmail.com>
2
3 * server.el (server-auth-key, server-generate-key): Doc fixes.
4 (server-get-auth-key): Doc fix. Use `string-match-p'.
5 (server-start): Reflow docstring.
6
72012-04-14 Lars Ingebrigtsen <larsi@gnus.org>
8
9 * server.el (server-generate-key): `called-interactively-p'
10 requires a parameter.
11
122012-04-14 Michal Nazarewicz <mina86@mina86.com>
13
14 * server.el (server-auth-key): New variable.
15 (server-generate-key): New function.
16 (server-get-auth-key): New function.
17 (server-start): Use the new variable and functions to allow
18 setting a permanent server key (bug#9423).
19
202012-04-14 Leo Liu <sdl.web@gmail.com>
21
22 * vc/diff-mode.el (diff-file-prev/next): Fix typo.
23
12012-04-14 Paul Eggert <eggert@cs.ucla.edu> 242012-04-14 Paul Eggert <eggert@cs.ucla.edu>
2 25
3 Spelling fixes. 26 Spelling fixes.
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index bacc542a388..c8435c14ea2 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -80,7 +80,7 @@
80For other modes it is disabled. If this is equal to t, 80For other modes it is disabled. If this is equal to t,
81then Which Function mode is enabled in any major mode that supports it." 81then Which Function mode is enabled in any major mode that supports it."
82 :group 'which-func 82 :group 'which-func
83 :version "24.2" ; added objc-mode 83 :version "24.2" ; explicit list -> t
84 :type '(choice (const :tag "All modes" t) 84 :type '(choice (const :tag "All modes" t)
85 (repeat (symbol :tag "Major mode")))) 85 (repeat (symbol :tag "Major mode"))))
86 86
diff --git a/lisp/server.el b/lisp/server.el
index 404bebc4747..058bc55d87d 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -139,6 +139,32 @@ directory residing in a NTFS partition instead."
139;;;###autoload 139;;;###autoload
140(put 'server-auth-dir 'risky-local-variable t) 140(put 'server-auth-dir 'risky-local-variable t)
141 141
142(defcustom server-auth-key nil
143 "Server authentication key.
144
145Normally, the authentication key is randomly generated when the
146server starts, which guarantees some level of security. It is
147recommended to leave it that way. Using a long-lived shared key
148will decrease security (especially since the key is transmitted as
149plain text).
150
151In some situations however, it can be difficult to share randomly
152generated passwords with remote hosts (eg. no shared directory),
153so you can set the key with this variable and then copy the
154server file to the remote host (with possible changes to IP
155address and/or port if that applies).
156
157The key must consist of 64 ASCII printable characters except for
158space (this means characters from ! to ~; or from code 33 to 126).
159
160You can use \\[server-generate-key] to get a random authentication
161key."
162 :group 'server
163 :type '(choice
164 (const :tag "Random" nil)
165 (string :tag "Password"))
166 :version "24.2")
167
142(defcustom server-raise-frame t 168(defcustom server-raise-frame t
143 "If non-nil, raise frame when switching to a buffer." 169 "If non-nil, raise frame when switching to a buffer."
144 :group 'server 170 :group 'server
@@ -522,13 +548,38 @@ See variable `server-auth-dir' for details."
522 (unless safe 548 (unless safe
523 (error "The directory `%s' is unsafe" dir))))) 549 (error "The directory `%s' is unsafe" dir)))))
524 550
551(defun server-generate-key ()
552 "Generate and return a random authentication key.
553The key is a 64-byte string of random chars in the range `!'..`~'.
554If called interactively, also inserts it into current buffer."
555 (interactive)
556 (let ((auth-key
557 (loop repeat 64
558 collect (+ 33 (random 94)) into auth
559 finally return (concat auth))))
560 (if (called-interactively-p 'interactive)
561 (insert auth-key))
562 auth-key))
563
564(defun server-get-auth-key ()
565 "Return server's authentication key.
566
567If `server-auth-key' is nil, just call `server-generate-key'.
568Otherwise, if `server-auth-key' is a valid key, return it.
569If the key is not valid, signal an error."
570 (if server-auth-key
571 (if (string-match-p "^[!-~]\\{64\\}$" server-auth-key)
572 server-auth-key
573 (error "The key '%s' is invalid" server-auth-key))
574 (server-generate-key)))
575
525;;;###autoload 576;;;###autoload
526(defun server-start (&optional leave-dead inhibit-prompt) 577(defun server-start (&optional leave-dead inhibit-prompt)
527 "Allow this Emacs process to be a server for client processes. 578 "Allow this Emacs process to be a server for client processes.
528This starts a server communications subprocess through which 579This starts a server communications subprocess through which client
529client \"editors\" can send your editing commands to this Emacs 580\"editors\" can send your editing commands to this Emacs job.
530job. To use the server, set up the program `emacsclient' in the 581To use the server, set up the program `emacsclient' in the Emacs
531Emacs distribution as your standard \"editor\". 582distribution as your standard \"editor\".
532 583
533Optional argument LEAVE-DEAD (interactively, a prefix arg) means just 584Optional argument LEAVE-DEAD (interactively, a prefix arg) means just
534kill any existing server communications subprocess. 585kill any existing server communications subprocess.
@@ -615,13 +666,7 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
615 (unless server-process (error "Could not start server process")) 666 (unless server-process (error "Could not start server process"))
616 (process-put server-process :server-file server-file) 667 (process-put server-process :server-file server-file)
617 (when server-use-tcp 668 (when server-use-tcp
618 (let ((auth-key 669 (let ((auth-key (server-get-auth-key)))
619 (loop
620 ;; The auth key is a 64-byte string of random chars in the
621 ;; range `!'..`~'.
622 repeat 64
623 collect (+ 33 (random 94)) into auth
624 finally return (concat auth))))
625 (process-put server-process :auth-key auth-key) 670 (process-put server-process :auth-key auth-key)
626 (with-temp-file server-file 671 (with-temp-file server-file
627 (set-buffer-multibyte nil) 672 (set-buffer-multibyte nil)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 16e33889c31..8b6b85dd22e 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -545,7 +545,7 @@ but in the file header instead, in which case move forward to the first hunk."
545 (condition-case-unless-debug nil (diff-refine-hunk) (error nil)))) 545 (condition-case-unless-debug nil (diff-refine-hunk) (error nil))))
546 546
547(easy-mmode-define-navigation 547(easy-mmode-define-navigation
548 diff-file diff-file-header-re "file" diff-end-of-hunk) 548 diff-file diff-file-header-re "file" diff-end-of-file)
549 549
550(defun diff-restrict-view (&optional arg) 550(defun diff-restrict-view (&optional arg)
551 "Restrict the view to the current hunk. 551 "Restrict the view to the current hunk.