* 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.
This commit is contained in:
parent
db50ad5f11
commit
2013a2f955
6 changed files with 45 additions and 15 deletions
3
etc/NEWS
3
etc/NEWS
|
@ -254,11 +254,12 @@ You can pick the name of the function and the variables with `C-x 4 a'.
|
||||||
* Changes in Specialized Modes and Packages in Emacs 24.4
|
* Changes in Specialized Modes and Packages in Emacs 24.4
|
||||||
|
|
||||||
** CUA-mode
|
** CUA-mode
|
||||||
CUA-mode was changed to make use of delete-selection-mode and
|
*** CUA-mode was changed to make use of delete-selection-mode and
|
||||||
shift-select-mode. So you can now enable it independently from
|
shift-select-mode. So you can now enable it independently from
|
||||||
transient-mark-mode, delete-selection-mode, and shift-select-mode.
|
transient-mark-mode, delete-selection-mode, and shift-select-mode.
|
||||||
As a result, cua-highlight-region-shift-only is obsolete
|
As a result, cua-highlight-region-shift-only is obsolete
|
||||||
(you can disable transient-mark-mode to get the same result).
|
(you can disable transient-mark-mode to get the same result).
|
||||||
|
*** CUA's rectangles can now be used via `cua-rectangle-mark-mode'.
|
||||||
|
|
||||||
** `delete-selection-mode' can be used without transient-mark-mode.
|
** `delete-selection-mode' can be used without transient-mark-mode.
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,18 @@
|
||||||
|
2013-12-16 Stefan Monnier <monnier@iro.umontreal.ca>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
|
* emulation/cua-base.el (cua-repeat-replace-region):
|
||||||
|
Use with-current-buffer.
|
||||||
|
|
||||||
|
* net/gnutls.el: Use cl-lib.
|
||||||
|
(gnutls-negotiate): `mapcan' -> cl-mapcan.
|
||||||
|
|
||||||
2013-12-14 Teodor Zlatanov <tzz@lifelogs.com>
|
2013-12-14 Teodor Zlatanov <tzz@lifelogs.com>
|
||||||
|
|
||||||
* emacs-lisp/package.el (package-built-in-p): Support both
|
* emacs-lisp/package.el (package-built-in-p): Support both
|
||||||
|
|
|
@ -971,9 +971,8 @@ replaced by typing text over it and replaces it with the same stretch
|
||||||
of text."
|
of text."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(when cua--last-deleted-region-pos
|
(when cua--last-deleted-region-pos
|
||||||
(save-excursion
|
(with-current-buffer (car cua--last-deleted-region-pos)
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(set-buffer (car cua--last-deleted-region-pos))
|
|
||||||
(widen)
|
(widen)
|
||||||
;; Find the text that replaced the region via the undo list.
|
;; Find the text that replaced the region via the undo list.
|
||||||
(let ((ul buffer-undo-list)
|
(let ((ul buffer-undo-list)
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
(push (list 'apply 0 s e
|
(push (list 'apply 0 s e
|
||||||
'cua--rect-undo-handler
|
'cua--rect-undo-handler
|
||||||
(copy-sequence cua--rectangle) t s e)
|
(copy-sequence cua--rectangle) t s e)
|
||||||
buffer-undo-list))))
|
buffer-undo-list))))
|
||||||
|
|
||||||
(defun cua--rect-undo-handler (rect on s e)
|
(defun cua--rect-undo-handler (rect on s e)
|
||||||
(if (setq on (not on))
|
(if (setq on (not on))
|
||||||
|
@ -89,6 +89,21 @@
|
||||||
'cua--rect-undo-handler rect on s e)
|
'cua--rect-undo-handler rect on s e)
|
||||||
buffer-undo-list))
|
buffer-undo-list))
|
||||||
|
|
||||||
|
;;;###autoload
|
||||||
|
(define-minor-mode cua-rectangle-mark-mode
|
||||||
|
"Toggle the region as rectangular.
|
||||||
|
Activates the region if needed. Only lasts until the region is deactivated."
|
||||||
|
:keymap cua--rectangle-keymap
|
||||||
|
(cond
|
||||||
|
(cua-rectangle-mark-mode
|
||||||
|
(add-hook 'deactivate-mark-hook
|
||||||
|
(lambda () (cua-rectangle-mark-mode -1)))
|
||||||
|
(add-hook 'post-command-hook #'cua--rectangle-post-command nil t)
|
||||||
|
(cua-set-rectangle-mark))
|
||||||
|
(t
|
||||||
|
(cua--deactivate-rectangle)
|
||||||
|
(remove-hook 'post-command-hook #'cua--rectangle-post-command t))))
|
||||||
|
|
||||||
;;; Rectangle geometry
|
;;; Rectangle geometry
|
||||||
|
|
||||||
(defun cua--rectangle-top (&optional val)
|
(defun cua--rectangle-top (&optional val)
|
||||||
|
@ -708,8 +723,7 @@ If command is repeated at same position, delete the rectangle."
|
||||||
killed-rectangle "")))))
|
killed-rectangle "")))))
|
||||||
|
|
||||||
(defun cua--activate-rectangle ()
|
(defun cua--activate-rectangle ()
|
||||||
;; Turn on rectangular marking mode by disabling transient mark mode
|
;; Set cua--rectangle to indicate we're marking a rectangle.
|
||||||
;; and manually handling highlighting from a post command hook.
|
|
||||||
;; Be careful if we are already marking a rectangle.
|
;; Be careful if we are already marking a rectangle.
|
||||||
(setq cua--rectangle
|
(setq cua--rectangle
|
||||||
(if (and cua--last-rectangle
|
(if (and cua--last-rectangle
|
||||||
|
@ -725,7 +739,7 @@ If command is repeated at same position, delete the rectangle."
|
||||||
|
|
||||||
(defun cua--deactivate-rectangle ()
|
(defun cua--deactivate-rectangle ()
|
||||||
;; This is used to clean up after `cua--activate-rectangle'.
|
;; This is used to clean up after `cua--activate-rectangle'.
|
||||||
(mapc (function delete-overlay) cua--rectangle-overlays)
|
(mapc #'delete-overlay cua--rectangle-overlays)
|
||||||
(setq cua--last-rectangle (cons (current-buffer)
|
(setq cua--last-rectangle (cons (current-buffer)
|
||||||
(cons (point) ;; cua-save-point
|
(cons (point) ;; cua-save-point
|
||||||
cua--rectangle))
|
cua--rectangle))
|
||||||
|
@ -733,7 +747,10 @@ If command is repeated at same position, delete the rectangle."
|
||||||
cua--rectangle-overlays nil
|
cua--rectangle-overlays nil
|
||||||
cua--status-string nil
|
cua--status-string nil
|
||||||
cua--mouse-last-pos nil)
|
cua--mouse-last-pos nil)
|
||||||
(deactivate-mark))
|
;; FIXME: This call to cua-rectangle-mark-mode is a workaround.
|
||||||
|
;; Deactivation can happen in various different ways, and we
|
||||||
|
;; currently don't handle them all in a coherent way.
|
||||||
|
(if cua-rectangle-mark-mode (cua-rectangle-mark-mode -1)))
|
||||||
|
|
||||||
(defun cua--highlight-rectangle ()
|
(defun cua--highlight-rectangle ()
|
||||||
;; This function is used to highlight the rectangular region.
|
;; This function is used to highlight the rectangular region.
|
||||||
|
@ -879,7 +896,6 @@ With prefix argument, activate previous rectangle if possible."
|
||||||
(push-mark nil nil t)))
|
(push-mark nil nil t)))
|
||||||
(cua--activate-rectangle)
|
(cua--activate-rectangle)
|
||||||
(cua--rectangle-set-corners)
|
(cua--rectangle-set-corners)
|
||||||
(setq mark-active t)
|
|
||||||
(if cua-enable-rectangle-auto-help
|
(if cua-enable-rectangle-auto-help
|
||||||
(cua-help-for-rectangle t))))
|
(cua-help-for-rectangle t))))
|
||||||
|
|
||||||
|
@ -1385,7 +1401,7 @@ With prefix arg, indent to that column."
|
||||||
(if (not cua--rectangle) (apply orig args)
|
(if (not cua--rectangle) (apply orig args)
|
||||||
;; When cua--rectangle is active, just don't highlight at all, since we
|
;; When cua--rectangle is active, just don't highlight at all, since we
|
||||||
;; already do it elsewhere.
|
;; already do it elsewhere.
|
||||||
))
|
(funcall redisplay-unhighlight-region-function (nth 3 args))))
|
||||||
|
|
||||||
(defun cua--rectangle-region-extract (orig &optional delete)
|
(defun cua--rectangle-region-extract (orig &optional delete)
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
(eval-when-compile (require 'cl-lib))
|
(require 'cl-lib)
|
||||||
|
|
||||||
(defgroup gnutls nil
|
(defgroup gnutls nil
|
||||||
"Emacs interface to the GnuTLS library."
|
"Emacs interface to the GnuTLS library."
|
||||||
|
@ -210,7 +210,7 @@ defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT."
|
||||||
t)
|
t)
|
||||||
;; if a list, look for hostname matches
|
;; if a list, look for hostname matches
|
||||||
((listp gnutls-verify-error)
|
((listp gnutls-verify-error)
|
||||||
(mapcan
|
(cl-mapcan
|
||||||
(lambda (check)
|
(lambda (check)
|
||||||
(when (string-match (car check) hostname)
|
(when (string-match (car check) hostname)
|
||||||
(cdr check)))
|
(cdr check)))
|
||||||
|
|
|
@ -418,9 +418,6 @@ with a prefix argument, prompt for START-AT and FORMAT."
|
||||||
;; - lots of commands handle the region without paying attention to its
|
;; - lots of commands handle the region without paying attention to its
|
||||||
;; rectangular shape.
|
;; rectangular shape.
|
||||||
|
|
||||||
(add-hook 'deactivate-mark-hook
|
|
||||||
(lambda () (rectangle-mark-mode -1)))
|
|
||||||
|
|
||||||
(add-function :around redisplay-highlight-region-function
|
(add-function :around redisplay-highlight-region-function
|
||||||
#'rectangle--highlight-for-redisplay)
|
#'rectangle--highlight-for-redisplay)
|
||||||
(add-function :around redisplay-unhighlight-region-function
|
(add-function :around redisplay-unhighlight-region-function
|
||||||
|
@ -443,6 +440,8 @@ with a prefix argument, prompt for START-AT and FORMAT."
|
||||||
Activates the region if needed. Only lasts until the region is deactivated."
|
Activates the region if needed. Only lasts until the region is deactivated."
|
||||||
nil nil nil
|
nil nil nil
|
||||||
(when rectangle-mark-mode
|
(when rectangle-mark-mode
|
||||||
|
(add-hook 'deactivate-mark-hook
|
||||||
|
(lambda () (rectangle-mark-mode -1)))
|
||||||
(unless (region-active-p)
|
(unless (region-active-p)
|
||||||
(push-mark)
|
(push-mark)
|
||||||
(activate-mark))))
|
(activate-mark))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue