diff options
| author | Stefan Monnier | 2013-12-15 21:24:08 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2013-12-15 21:24:08 -0500 |
| commit | 2013a2f955e4dc6edf9869767e9f5d70fbf9d69c (patch) | |
| tree | d641c6fe8fc0b763645a5447f1fda75987cc4ac0 | |
| parent | db50ad5f11cc5809c27091181a13ee7aa34ec5ed (diff) | |
| download | emacs-2013a2f955e4dc6edf9869767e9f5d70fbf9d69c.tar.gz emacs-2013a2f955e4dc6edf9869767e9f5d70fbf9d69c.zip | |
* lisp/emulation/cua-rect.el (cua-rectangle-mark-mode): New minor mode.
(cua--deactivate-rectangle): Don't deactivate the mark.
(cua-set-rectangle-mark): Don't set mark-active since
cua--activate-rectangle already does it for us.
(cua--rectangle-highlight-for-redisplay): Unhighlight a previous
non-rectangular region.
* lisp/emulation/cua-base.el (cua-repeat-replace-region):
Use with-current-buffer.
* lisp/net/gnutls.el: Use cl-lib.
(gnutls-negotiate): `mapcan' -> cl-mapcan.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 15 | ||||
| -rw-r--r-- | lisp/emulation/cua-base.el | 3 | ||||
| -rw-r--r-- | lisp/emulation/cua-rect.el | 30 | ||||
| -rw-r--r-- | lisp/net/gnutls.el | 4 | ||||
| -rw-r--r-- | lisp/rect.el | 5 |
6 files changed, 45 insertions, 15 deletions
| @@ -254,11 +254,12 @@ You can pick the name of the function and the variables with `C-x 4 a'. | |||
| 254 | * Changes in Specialized Modes and Packages in Emacs 24.4 | 254 | * Changes in Specialized Modes and Packages in Emacs 24.4 |
| 255 | 255 | ||
| 256 | ** CUA-mode | 256 | ** CUA-mode |
| 257 | CUA-mode was changed to make use of delete-selection-mode and | 257 | *** CUA-mode was changed to make use of delete-selection-mode and |
| 258 | shift-select-mode. So you can now enable it independently from | 258 | shift-select-mode. So you can now enable it independently from |
| 259 | transient-mark-mode, delete-selection-mode, and shift-select-mode. | 259 | transient-mark-mode, delete-selection-mode, and shift-select-mode. |
| 260 | As a result, cua-highlight-region-shift-only is obsolete | 260 | As a result, cua-highlight-region-shift-only is obsolete |
| 261 | (you can disable transient-mark-mode to get the same result). | 261 | (you can disable transient-mark-mode to get the same result). |
| 262 | *** CUA's rectangles can now be used via `cua-rectangle-mark-mode'. | ||
| 262 | 263 | ||
| 263 | ** `delete-selection-mode' can be used without transient-mark-mode. | 264 | ** `delete-selection-mode' can be used without transient-mark-mode. |
| 264 | 265 | ||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0eabdf86ffa..f4a42c6f4c0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2013-12-16 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * emulation/cua-rect.el (cua-rectangle-mark-mode): New minor mode. | ||
| 4 | (cua--deactivate-rectangle): Don't deactivate the mark. | ||
| 5 | (cua-set-rectangle-mark): Don't set mark-active since | ||
| 6 | cua--activate-rectangle already does it for us. | ||
| 7 | (cua--rectangle-highlight-for-redisplay): Unhighlight a previous | ||
| 8 | non-rectangular region. | ||
| 9 | |||
| 10 | * emulation/cua-base.el (cua-repeat-replace-region): | ||
| 11 | Use with-current-buffer. | ||
| 12 | |||
| 13 | * net/gnutls.el: Use cl-lib. | ||
| 14 | (gnutls-negotiate): `mapcan' -> cl-mapcan. | ||
| 15 | |||
| 1 | 2013-12-14 Teodor Zlatanov <tzz@lifelogs.com> | 16 | 2013-12-14 Teodor Zlatanov <tzz@lifelogs.com> |
| 2 | 17 | ||
| 3 | * emacs-lisp/package.el (package-built-in-p): Support both | 18 | * emacs-lisp/package.el (package-built-in-p): Support both |
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 24149a33c89..4a158087d12 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el | |||
| @@ -971,9 +971,8 @@ replaced by typing text over it and replaces it with the same stretch | |||
| 971 | of text." | 971 | of text." |
| 972 | (interactive "P") | 972 | (interactive "P") |
| 973 | (when cua--last-deleted-region-pos | 973 | (when cua--last-deleted-region-pos |
| 974 | (save-excursion | 974 | (with-current-buffer (car cua--last-deleted-region-pos) |
| 975 | (save-restriction | 975 | (save-restriction |
| 976 | (set-buffer (car cua--last-deleted-region-pos)) | ||
| 977 | (widen) | 976 | (widen) |
| 978 | ;; Find the text that replaced the region via the undo list. | 977 | ;; Find the text that replaced the region via the undo list. |
| 979 | (let ((ul buffer-undo-list) | 978 | (let ((ul buffer-undo-list) |
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index 71578031cba..4e0782c870b 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el | |||
| @@ -78,7 +78,7 @@ | |||
| 78 | (push (list 'apply 0 s e | 78 | (push (list 'apply 0 s e |
| 79 | 'cua--rect-undo-handler | 79 | 'cua--rect-undo-handler |
| 80 | (copy-sequence cua--rectangle) t s e) | 80 | (copy-sequence cua--rectangle) t s e) |
| 81 | buffer-undo-list)))) | 81 | buffer-undo-list)))) |
| 82 | 82 | ||
| 83 | (defun cua--rect-undo-handler (rect on s e) | 83 | (defun cua--rect-undo-handler (rect on s e) |
| 84 | (if (setq on (not on)) | 84 | (if (setq on (not on)) |
| @@ -89,6 +89,21 @@ | |||
| 89 | 'cua--rect-undo-handler rect on s e) | 89 | 'cua--rect-undo-handler rect on s e) |
| 90 | buffer-undo-list)) | 90 | buffer-undo-list)) |
| 91 | 91 | ||
| 92 | ;;;###autoload | ||
| 93 | (define-minor-mode cua-rectangle-mark-mode | ||
| 94 | "Toggle the region as rectangular. | ||
| 95 | Activates the region if needed. Only lasts until the region is deactivated." | ||
| 96 | :keymap cua--rectangle-keymap | ||
| 97 | (cond | ||
| 98 | (cua-rectangle-mark-mode | ||
| 99 | (add-hook 'deactivate-mark-hook | ||
| 100 | (lambda () (cua-rectangle-mark-mode -1))) | ||
| 101 | (add-hook 'post-command-hook #'cua--rectangle-post-command nil t) | ||
| 102 | (cua-set-rectangle-mark)) | ||
| 103 | (t | ||
| 104 | (cua--deactivate-rectangle) | ||
| 105 | (remove-hook 'post-command-hook #'cua--rectangle-post-command t)))) | ||
| 106 | |||
| 92 | ;;; Rectangle geometry | 107 | ;;; Rectangle geometry |
| 93 | 108 | ||
| 94 | (defun cua--rectangle-top (&optional val) | 109 | (defun cua--rectangle-top (&optional val) |
| @@ -708,8 +723,7 @@ If command is repeated at same position, delete the rectangle." | |||
| 708 | killed-rectangle ""))))) | 723 | killed-rectangle ""))))) |
| 709 | 724 | ||
| 710 | (defun cua--activate-rectangle () | 725 | (defun cua--activate-rectangle () |
| 711 | ;; Turn on rectangular marking mode by disabling transient mark mode | 726 | ;; Set cua--rectangle to indicate we're marking a rectangle. |
| 712 | ;; and manually handling highlighting from a post command hook. | ||
| 713 | ;; Be careful if we are already marking a rectangle. | 727 | ;; Be careful if we are already marking a rectangle. |
| 714 | (setq cua--rectangle | 728 | (setq cua--rectangle |
| 715 | (if (and cua--last-rectangle | 729 | (if (and cua--last-rectangle |
| @@ -725,7 +739,7 @@ If command is repeated at same position, delete the rectangle." | |||
| 725 | 739 | ||
| 726 | (defun cua--deactivate-rectangle () | 740 | (defun cua--deactivate-rectangle () |
| 727 | ;; This is used to clean up after `cua--activate-rectangle'. | 741 | ;; This is used to clean up after `cua--activate-rectangle'. |
| 728 | (mapc (function delete-overlay) cua--rectangle-overlays) | 742 | (mapc #'delete-overlay cua--rectangle-overlays) |
| 729 | (setq cua--last-rectangle (cons (current-buffer) | 743 | (setq cua--last-rectangle (cons (current-buffer) |
| 730 | (cons (point) ;; cua-save-point | 744 | (cons (point) ;; cua-save-point |
| 731 | cua--rectangle)) | 745 | cua--rectangle)) |
| @@ -733,7 +747,10 @@ If command is repeated at same position, delete the rectangle." | |||
| 733 | cua--rectangle-overlays nil | 747 | cua--rectangle-overlays nil |
| 734 | cua--status-string nil | 748 | cua--status-string nil |
| 735 | cua--mouse-last-pos nil) | 749 | cua--mouse-last-pos nil) |
| 736 | (deactivate-mark)) | 750 | ;; FIXME: This call to cua-rectangle-mark-mode is a workaround. |
| 751 | ;; Deactivation can happen in various different ways, and we | ||
| 752 | ;; currently don't handle them all in a coherent way. | ||
| 753 | (if cua-rectangle-mark-mode (cua-rectangle-mark-mode -1))) | ||
| 737 | 754 | ||
| 738 | (defun cua--highlight-rectangle () | 755 | (defun cua--highlight-rectangle () |
| 739 | ;; This function is used to highlight the rectangular region. | 756 | ;; This function is used to highlight the rectangular region. |
| @@ -879,7 +896,6 @@ With prefix argument, activate previous rectangle if possible." | |||
| 879 | (push-mark nil nil t))) | 896 | (push-mark nil nil t))) |
| 880 | (cua--activate-rectangle) | 897 | (cua--activate-rectangle) |
| 881 | (cua--rectangle-set-corners) | 898 | (cua--rectangle-set-corners) |
| 882 | (setq mark-active t) | ||
| 883 | (if cua-enable-rectangle-auto-help | 899 | (if cua-enable-rectangle-auto-help |
| 884 | (cua-help-for-rectangle t)))) | 900 | (cua-help-for-rectangle t)))) |
| 885 | 901 | ||
| @@ -1385,7 +1401,7 @@ With prefix arg, indent to that column." | |||
| 1385 | (if (not cua--rectangle) (apply orig args) | 1401 | (if (not cua--rectangle) (apply orig args) |
| 1386 | ;; When cua--rectangle is active, just don't highlight at all, since we | 1402 | ;; When cua--rectangle is active, just don't highlight at all, since we |
| 1387 | ;; already do it elsewhere. | 1403 | ;; already do it elsewhere. |
| 1388 | )) | 1404 | (funcall redisplay-unhighlight-region-function (nth 3 args)))) |
| 1389 | 1405 | ||
| 1390 | (defun cua--rectangle-region-extract (orig &optional delete) | 1406 | (defun cua--rectangle-region-extract (orig &optional delete) |
| 1391 | (cond | 1407 | (cond |
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 5bf9adc2b53..e9ba6288b6f 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | 35 | ||
| 36 | ;;; Code: | 36 | ;;; Code: |
| 37 | 37 | ||
| 38 | (eval-when-compile (require 'cl-lib)) | 38 | (require 'cl-lib) |
| 39 | 39 | ||
| 40 | (defgroup gnutls nil | 40 | (defgroup gnutls nil |
| 41 | "Emacs interface to the GnuTLS library." | 41 | "Emacs interface to the GnuTLS library." |
| @@ -210,7 +210,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." | |||
| 210 | t) | 210 | t) |
| 211 | ;; if a list, look for hostname matches | 211 | ;; if a list, look for hostname matches |
| 212 | ((listp gnutls-verify-error) | 212 | ((listp gnutls-verify-error) |
| 213 | (mapcan | 213 | (cl-mapcan |
| 214 | (lambda (check) | 214 | (lambda (check) |
| 215 | (when (string-match (car check) hostname) | 215 | (when (string-match (car check) hostname) |
| 216 | (cdr check))) | 216 | (cdr check))) |
diff --git a/lisp/rect.el b/lisp/rect.el index be29517e087..cece0950880 100644 --- a/lisp/rect.el +++ b/lisp/rect.el | |||
| @@ -418,9 +418,6 @@ with a prefix argument, prompt for START-AT and FORMAT." | |||
| 418 | ;; - lots of commands handle the region without paying attention to its | 418 | ;; - lots of commands handle the region without paying attention to its |
| 419 | ;; rectangular shape. | 419 | ;; rectangular shape. |
| 420 | 420 | ||
| 421 | (add-hook 'deactivate-mark-hook | ||
| 422 | (lambda () (rectangle-mark-mode -1))) | ||
| 423 | |||
| 424 | (add-function :around redisplay-highlight-region-function | 421 | (add-function :around redisplay-highlight-region-function |
| 425 | #'rectangle--highlight-for-redisplay) | 422 | #'rectangle--highlight-for-redisplay) |
| 426 | (add-function :around redisplay-unhighlight-region-function | 423 | (add-function :around redisplay-unhighlight-region-function |
| @@ -443,6 +440,8 @@ with a prefix argument, prompt for START-AT and FORMAT." | |||
| 443 | Activates the region if needed. Only lasts until the region is deactivated." | 440 | Activates the region if needed. Only lasts until the region is deactivated." |
| 444 | nil nil nil | 441 | nil nil nil |
| 445 | (when rectangle-mark-mode | 442 | (when rectangle-mark-mode |
| 443 | (add-hook 'deactivate-mark-hook | ||
| 444 | (lambda () (rectangle-mark-mode -1))) | ||
| 446 | (unless (region-active-p) | 445 | (unless (region-active-p) |
| 447 | (push-mark) | 446 | (push-mark) |
| 448 | (activate-mark)))) | 447 | (activate-mark)))) |