diff options
| author | Paul Eggert | 2012-04-14 11:11:27 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-04-14 11:11:27 -0700 |
| commit | 899b41b6e37a321e14559d2cf3c05ea3f8063811 (patch) | |
| tree | 1ca101db0dfe3f96c4fb40eae537003f32e51557 | |
| parent | 3078ffdd457776d0b44b40a9581c36b56b780450 (diff) | |
| parent | 3c80ae807c532597ba07ff028efc8add447f962e (diff) | |
| download | emacs-899b41b6e37a321e14559d2cf3c05ea3f8063811.tar.gz emacs-899b41b6e37a321e14559d2cf3c05ea3f8063811.zip | |
Merge from trunk.
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/ChangeLog | 23 | ||||
| -rw-r--r-- | lisp/progmodes/which-func.el | 2 | ||||
| -rw-r--r-- | lisp/server.el | 67 | ||||
| -rw-r--r-- | lisp/vc/diff-mode.el | 2 |
5 files changed, 85 insertions, 14 deletions
| @@ -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. | 63 | channel keys found, if any. |
| 64 | 64 | ||
| 65 | ** The `server-auth-key' variable can be used to set a permanent | ||
| 66 | shared 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 @@ | |||
| 1 | 2012-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 | |||
| 7 | 2012-04-14 Lars Ingebrigtsen <larsi@gnus.org> | ||
| 8 | |||
| 9 | * server.el (server-generate-key): `called-interactively-p' | ||
| 10 | requires a parameter. | ||
| 11 | |||
| 12 | 2012-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 | |||
| 20 | 2012-04-14 Leo Liu <sdl.web@gmail.com> | ||
| 21 | |||
| 22 | * vc/diff-mode.el (diff-file-prev/next): Fix typo. | ||
| 23 | |||
| 1 | 2012-04-14 Paul Eggert <eggert@cs.ucla.edu> | 24 | 2012-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 @@ | |||
| 80 | For other modes it is disabled. If this is equal to t, | 80 | For other modes it is disabled. If this is equal to t, |
| 81 | then Which Function mode is enabled in any major mode that supports it." | 81 | then 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 | |||
| 145 | Normally, the authentication key is randomly generated when the | ||
| 146 | server starts, which guarantees some level of security. It is | ||
| 147 | recommended to leave it that way. Using a long-lived shared key | ||
| 148 | will decrease security (especially since the key is transmitted as | ||
| 149 | plain text). | ||
| 150 | |||
| 151 | In some situations however, it can be difficult to share randomly | ||
| 152 | generated passwords with remote hosts (eg. no shared directory), | ||
| 153 | so you can set the key with this variable and then copy the | ||
| 154 | server file to the remote host (with possible changes to IP | ||
| 155 | address and/or port if that applies). | ||
| 156 | |||
| 157 | The key must consist of 64 ASCII printable characters except for | ||
| 158 | space (this means characters from ! to ~; or from code 33 to 126). | ||
| 159 | |||
| 160 | You can use \\[server-generate-key] to get a random authentication | ||
| 161 | key." | ||
| 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. | ||
| 553 | The key is a 64-byte string of random chars in the range `!'..`~'. | ||
| 554 | If 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 | |||
| 567 | If `server-auth-key' is nil, just call `server-generate-key'. | ||
| 568 | Otherwise, if `server-auth-key' is a valid key, return it. | ||
| 569 | If 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. |
| 528 | This starts a server communications subprocess through which | 579 | This starts a server communications subprocess through which client |
| 529 | client \"editors\" can send your editing commands to this Emacs | 580 | \"editors\" can send your editing commands to this Emacs job. |
| 530 | job. To use the server, set up the program `emacsclient' in the | 581 | To use the server, set up the program `emacsclient' in the Emacs |
| 531 | Emacs distribution as your standard \"editor\". | 582 | distribution as your standard \"editor\". |
| 532 | 583 | ||
| 533 | Optional argument LEAVE-DEAD (interactively, a prefix arg) means just | 584 | Optional argument LEAVE-DEAD (interactively, a prefix arg) means just |
| 534 | kill any existing server communications subprocess. | 585 | kill 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. |