aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-11-16 17:58:30 +0000
committerStefan Monnier2007-11-16 17:58:30 +0000
commitde299ed7418614fb5ee58d0eeb96dd505c0016f2 (patch)
tree000594265cada53a25e4f0ea2c346daef80a4efd
parent9efa445fbe19ce4631bf9c6265c6e91202d9d99d (diff)
downloademacs-de299ed7418614fb5ee58d0eeb96dd505c0016f2.tar.gz
emacs-de299ed7418614fb5ee58d0eeb96dd505c0016f2.zip
(pc-select-shifted-mark): New var.
(ensure-mark): Set it. (maybe-deactivate-mark): New fun. Use it everywhere instead of (setq mark-active nil)
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/emulation/pc-select.el58
2 files changed, 42 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a8859c8a3ca..24c578e1dfd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12007-11-16 Martin Pohlack <mp26@os.inf.tu-dresden.de> (tiny change)
2
3 * emulation/pc-select.el (pc-select-shifted-mark): New var.
4 (ensure-mark): Set it.
5 (maybe-deactivate-mark): New fun.
6 Use it everywhere instead of (setq mark-active nil)
7
12007-11-16 Dan Nicolaescu <dann@ics.uci.edu> 82007-11-16 Dan Nicolaescu <dann@ics.uci.edu>
2 9
3 * textmodes/reftex-dcr.el (reftex-start-itimer-once): Add check 10 * textmodes/reftex-dcr.el (reftex-start-itimer-once): Add check
diff --git a/lisp/emulation/pc-select.el b/lisp/emulation/pc-select.el
index a4e304616da..b9a3d3017d6 100644
--- a/lisp/emulation/pc-select.el
+++ b/lisp/emulation/pc-select.el
@@ -135,8 +135,8 @@ restored to their original values when PC Selection mode is toggled off.")
135 135
136(unless pc-select-default-key-bindings 136(unless pc-select-default-key-bindings
137 (let ((lst 137 (let ((lst
138 ;; This is to avoid confusion with the delete-selection-mode 138 ;; This is to avoid confusion with the delete-selection-mode.
139 ;; On simple displays you cant see that a region is active and 139 ;; On simple displays you can't see that a region is active and
140 ;; will be deleted on the next keypress IMHO especially for 140 ;; will be deleted on the next keypress IMHO especially for
141 ;; copy-region-as-kill this is confusing. 141 ;; copy-region-as-kill this is confusing.
142 ;; The same goes for exchange-point-and-mark 142 ;; The same goes for exchange-point-and-mark
@@ -182,7 +182,7 @@ restored to their original values when PC Selection mode is toggled off.")
182 ([prior] . scroll-down-nomark) 182 ([prior] . scroll-down-nomark)
183 183
184 ;; Next four lines are from Pete Forman. 184 ;; Next four lines are from Pete Forman.
185 ([C-down] . forward-paragraph-nomark) ; KNextPara cDn 185 ([C-down] . forward-paragraph-nomark) ; KNextPara cDn
186 ([C-up] . backward-paragraph-nomark) ; KPrevPara cUp 186 ([C-up] . backward-paragraph-nomark) ; KPrevPara cUp
187 ([S-C-down] . forward-paragraph-mark) 187 ([S-C-down] . forward-paragraph-mark)
188 ([S-C-up] . backward-paragraph-mark)))) 188 ([S-C-up] . backward-paragraph-mark))))
@@ -254,6 +254,10 @@ This variable holds the value associated with [M-delete] in the
254`function-key-map' before PC Selection mode had changed that 254`function-key-map' before PC Selection mode had changed that
255association.") 255association.")
256 256
257(defvar pc-select-shifted-mark nil
258 "Holds whether we ourselves did activate the mark. Only then
259 should we deactivate if later on.")
260
257;;;; 261;;;;
258;; misc 262;; misc
259;;;; 263;;;;
@@ -284,7 +288,15 @@ and `transient-mark-mode'."
284(defun ensure-mark() 288(defun ensure-mark()
285 ;; make sure mark is active 289 ;; make sure mark is active
286 ;; test if it is active, if it isn't, set it and activate it 290 ;; test if it is active, if it isn't, set it and activate it
287 (or mark-active (set-mark-command nil))) 291 (or mark-active (set-mark-command nil))
292 (setq pc-select-shifted-mark t))
293
294(defun maybe-deactivate-mark()
295 ;; maybe switch off mark (only if *we* switched it on)
296 (if pc-select-shifted-mark
297 (progn
298 (setq mark-active nil)
299 (setq pc-select-shifted-mark nil))))
288 300
289;;;;;;;;;;;;;;;;;;;;;;;;;;; 301;;;;;;;;;;;;;;;;;;;;;;;;;;;
290;;;;; forward and mark 302;;;;; forward and mark
@@ -427,7 +439,7 @@ Don't use this command in Lisp programs!
427 "Deactivate mark; move point right ARG characters \(left if ARG negative). 439 "Deactivate mark; move point right ARG characters \(left if ARG negative).
428On reaching end of buffer, stop and signal error." 440On reaching end of buffer, stop and signal error."
429 (interactive "p") 441 (interactive "p")
430 (setq mark-active nil) 442 (maybe-deactivate-mark)
431 (forward-char arg)) 443 (forward-char arg))
432 444
433(defun forward-word-nomark (&optional arg) 445(defun forward-word-nomark (&optional arg)
@@ -436,13 +448,13 @@ Normally returns t.
436If an edge of the buffer is reached, point is left there 448If an edge of the buffer is reached, point is left there
437and nil is returned." 449and nil is returned."
438 (interactive "p") 450 (interactive "p")
439 (setq mark-active nil) 451 (maybe-deactivate-mark)
440 (forward-word arg)) 452 (forward-word arg))
441 453
442(defun forward-line-nomark (&optional arg) 454(defun forward-line-nomark (&optional arg)
443 "Deactivate mark; move cursor vertically down ARG lines." 455 "Deactivate mark; move cursor vertically down ARG lines."
444 (interactive "p") 456 (interactive "p")
445 (setq mark-active nil) 457 (maybe-deactivate-mark)
446 (forward-line arg) 458 (forward-line arg)
447 (setq this-command 'forward-line) 459 (setq this-command 'forward-line)
448) 460)
@@ -452,7 +464,7 @@ and nil is returned."
452With argument, do it that many times. Negative arg -N means 464With argument, do it that many times. Negative arg -N means
453move backward across N balanced expressions." 465move backward across N balanced expressions."
454 (interactive "p") 466 (interactive "p")
455 (setq mark-active nil) 467 (maybe-deactivate-mark)
456 (forward-sexp arg)) 468 (forward-sexp arg))
457 469
458(defun forward-paragraph-nomark (&optional arg) 470(defun forward-paragraph-nomark (&optional arg)
@@ -464,7 +476,7 @@ A line which `paragraph-start' matches either separates paragraphs
464A paragraph end is the beginning of a line which is not part of the paragraph 476A paragraph end is the beginning of a line which is not part of the paragraph
465to which the end of the previous line belongs, or the end of the buffer." 477to which the end of the previous line belongs, or the end of the buffer."
466 (interactive "p") 478 (interactive "p")
467 (setq mark-active nil) 479 (maybe-deactivate-mark)
468 (forward-paragraph arg)) 480 (forward-paragraph arg))
469 481
470(defun next-line-nomark (&optional arg) 482(defun next-line-nomark (&optional arg)
@@ -483,7 +495,7 @@ a semipermanent goal column to which this command always moves.
483Then it does not try to move vertically. This goal column is stored 495Then it does not try to move vertically. This goal column is stored
484in `goal-column', which is nil when there is none." 496in `goal-column', which is nil when there is none."
485 (interactive "p") 497 (interactive "p")
486 (setq mark-active nil) 498 (maybe-deactivate-mark)
487 (with-no-warnings (next-line arg)) 499 (with-no-warnings (next-line arg))
488 (setq this-command 'next-line)) 500 (setq this-command 'next-line))
489 501
@@ -492,14 +504,14 @@ in `goal-column', which is nil when there is none."
492With argument ARG not nil or 1, move forward ARG - 1 lines first. 504With argument ARG not nil or 1, move forward ARG - 1 lines first.
493If scan reaches end of buffer, stop there without error." 505If scan reaches end of buffer, stop there without error."
494 (interactive "p") 506 (interactive "p")
495 (setq mark-active nil) 507 (maybe-deactivate-mark)
496 (end-of-line arg) 508 (end-of-line arg)
497 (setq this-command 'end-of-line)) 509 (setq this-command 'end-of-line))
498 510
499(defun backward-line-nomark (&optional arg) 511(defun backward-line-nomark (&optional arg)
500 "Deactivate mark; move cursor vertically up ARG lines." 512 "Deactivate mark; move cursor vertically up ARG lines."
501 (interactive "p") 513 (interactive "p")
502 (setq mark-active nil) 514 (maybe-deactivate-mark)
503 (if (null arg) 515 (if (null arg)
504 (setq arg 1)) 516 (setq arg 1))
505 (forward-line (- arg)) 517 (forward-line (- arg))
@@ -512,7 +524,7 @@ A near full screen is `next-screen-context-lines' less than a full screen.
512Negative ARG means scroll upward. 524Negative ARG means scroll upward.
513When calling from a program, supply a number as argument or nil." 525When calling from a program, supply a number as argument or nil."
514 (interactive "P") 526 (interactive "P")
515 (setq mark-active nil) 527 (maybe-deactivate-mark)
516 (cond (pc-select-override-scroll-error 528 (cond (pc-select-override-scroll-error
517 (condition-case nil (scroll-down arg) 529 (condition-case nil (scroll-down arg)
518 (beginning-of-buffer (goto-char (point-min))))) 530 (beginning-of-buffer (goto-char (point-min)))))
@@ -528,7 +540,7 @@ of the accessible part of the buffer.
528Don't use this command in Lisp programs! 540Don't use this command in Lisp programs!
529\(goto-char (point-max)) is faster and avoids clobbering the mark." 541\(goto-char (point-max)) is faster and avoids clobbering the mark."
530 (interactive "P") 542 (interactive "P")
531 (setq mark-active nil) 543 (maybe-deactivate-mark)
532 (let ((size (- (point-max) (point-min)))) 544 (let ((size (- (point-max) (point-min))))
533 (goto-char (if arg 545 (goto-char (if arg
534 (- (point-max) 546 (- (point-max)
@@ -663,14 +675,14 @@ Don't use this command in Lisp programs!
663 "Deactivate mark; move point left ARG characters (right if ARG negative). 675 "Deactivate mark; move point left ARG characters (right if ARG negative).
664On attempt to pass beginning or end of buffer, stop and signal error." 676On attempt to pass beginning or end of buffer, stop and signal error."
665 (interactive "p") 677 (interactive "p")
666 (setq mark-active nil) 678 (maybe-deactivate-mark)
667 (backward-char arg)) 679 (backward-char arg))
668 680
669(defun backward-word-nomark (&optional arg) 681(defun backward-word-nomark (&optional arg)
670 "Deactivate mark; move backward until encountering the end of a word. 682 "Deactivate mark; move backward until encountering the end of a word.
671With argument, do this that many times." 683With argument, do this that many times."
672 (interactive "p") 684 (interactive "p")
673 (setq mark-active nil) 685 (maybe-deactivate-mark)
674 (backward-word arg)) 686 (backward-word arg))
675 687
676(defun backward-sexp-nomark (&optional arg) 688(defun backward-sexp-nomark (&optional arg)
@@ -678,7 +690,7 @@ With argument, do this that many times."
678With argument, do it that many times. Negative arg -N means 690With argument, do it that many times. Negative arg -N means
679move forward across N balanced expressions." 691move forward across N balanced expressions."
680 (interactive "p") 692 (interactive "p")
681 (setq mark-active nil) 693 (maybe-deactivate-mark)
682 (backward-sexp arg)) 694 (backward-sexp arg))
683 695
684(defun backward-paragraph-nomark (&optional arg) 696(defun backward-paragraph-nomark (&optional arg)
@@ -693,7 +705,7 @@ blank line.
693 705
694See `forward-paragraph' for more information." 706See `forward-paragraph' for more information."
695 (interactive "p") 707 (interactive "p")
696 (setq mark-active nil) 708 (maybe-deactivate-mark)
697 (backward-paragraph arg)) 709 (backward-paragraph arg))
698 710
699(defun previous-line-nomark (&optional arg) 711(defun previous-line-nomark (&optional arg)
@@ -706,7 +718,7 @@ The command \\[set-goal-column] can be used to create
706a semipermanent goal column to which this command always moves. 718a semipermanent goal column to which this command always moves.
707Then it does not try to move vertically." 719Then it does not try to move vertically."
708 (interactive "p") 720 (interactive "p")
709 (setq mark-active nil) 721 (maybe-deactivate-mark)
710 (with-no-warnings (previous-line arg)) 722 (with-no-warnings (previous-line arg))
711 (setq this-command 'previous-line)) 723 (setq this-command 'previous-line))
712 724
@@ -715,7 +727,7 @@ Then it does not try to move vertically."
715With argument ARG not nil or 1, move forward ARG - 1 lines first. 727With argument ARG not nil or 1, move forward ARG - 1 lines first.
716If scan reaches end of buffer, stop there without error." 728If scan reaches end of buffer, stop there without error."
717 (interactive "p") 729 (interactive "p")
718 (setq mark-active nil) 730 (maybe-deactivate-mark)
719 (beginning-of-line arg)) 731 (beginning-of-line arg))
720 732
721(defun scroll-up-nomark (&optional arg) 733(defun scroll-up-nomark (&optional arg)
@@ -724,7 +736,7 @@ A near full screen is `next-screen-context-lines' less than a full screen.
724Negative ARG means scroll downward. 736Negative ARG means scroll downward.
725When calling from a program, supply a number as argument or nil." 737When calling from a program, supply a number as argument or nil."
726 (interactive "P") 738 (interactive "P")
727 (setq mark-active nil) 739 (maybe-deactivate-mark)
728 (cond (pc-select-override-scroll-error 740 (cond (pc-select-override-scroll-error
729 (condition-case nil (scroll-up arg) 741 (condition-case nil (scroll-up arg)
730 (end-of-buffer (goto-char (point-max))))) 742 (end-of-buffer (goto-char (point-max)))))
@@ -740,7 +752,7 @@ of the accessible part of the buffer.
740Don't use this command in Lisp programs! 752Don't use this command in Lisp programs!
741\(goto-char (point-min)) is faster and avoids clobbering the mark." 753\(goto-char (point-min)) is faster and avoids clobbering the mark."
742 (interactive "P") 754 (interactive "P")
743 (setq mark-active nil) 755 (maybe-deactivate-mark)
744 (let ((size (- (point-max) (point-min)))) 756 (let ((size (- (point-max) (point-min))))
745 (goto-char (if arg 757 (goto-char (if arg
746 (+ (point-min) 758 (+ (point-min)
@@ -984,5 +996,5 @@ you must modify it using \\[customize] or \\[pc-selection-mode]."
984 :group 'pc-select 996 :group 'pc-select
985 :require 'pc-select) 997 :require 'pc-select)
986 998
987;;; arch-tag: 10697b70-ae07-4f3e-ad23-7814a3f418c2 999;; arch-tag: 10697b70-ae07-4f3e-ad23-7814a3f418c2
988;;; pc-select.el ends here 1000;;; pc-select.el ends here