From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: [mp26@os.inf.tu-dresden.de: Patch for pc-select.el] Date: Thu, 15 Nov 2007 23:28:06 -0500 Message-ID: Reply-To: rms@gnu.org NNTP-Posting-Host: lo.gmane.org Content-Type: text/plain; charset=ISO-8859-15 X-Trace: ger.gmane.org 1195187313 10525 80.91.229.12 (16 Nov 2007 04:28:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 Nov 2007 04:28:33 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 16 05:28:37 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Issoj-0005IT-RR for ged-emacs-devel@m.gmane.org; Fri, 16 Nov 2007 05:28:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IssoW-00054o-UX for ged-emacs-devel@m.gmane.org; Thu, 15 Nov 2007 23:28:20 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IssoN-00050P-0c for emacs-devel@gnu.org; Thu, 15 Nov 2007 23:28:11 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IssoL-0004zJ-Ao for emacs-devel@gnu.org; Thu, 15 Nov 2007 23:28:09 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IssoK-0004zB-PL for emacs-devel@gnu.org; Thu, 15 Nov 2007 23:28:08 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IssoK-0007vy-4G for emacs-devel@gnu.org; Thu, 15 Nov 2007 23:28:08 -0500 Original-Received: from rms by fencepost.gnu.org with local (Exim 4.60) (envelope-from ) id 1IssoI-0003NB-TT; Thu, 15 Nov 2007 23:28:06 -0500 X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:83307 Archived-At: Would someone please DTRT with this, then ack? ------- Start of forwarded message ------- X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=failed version=3.1.0 Date: Wed, 14 Nov 2007 22:18:07 +0100 From: Martin Pohlack MIME-Version: 1.0 To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="------------050501090105060407000103" Subject: Patch for pc-select.el This is a multi-part message in MIME format. - --------------050501090105060407000103 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Hi, I tried to send the patch below to the author of pc-select.el, but his address is no longer valid. So I'm resending it to this address. - ---------------------------------------------------------------------- Hi, I just recently switched to emacs (from xemacs) and found the behavior of pc-selection-mode (pc-select.el) a little bit irritating. Attached is a patch which fixes this. It basically allows using the shift+move selection at the same time as Ctrl-Space+Move selection mode. Originally, normal move operations (without shift) would disable the mark unconditionally, thereby disabling the region for Ctrl-Space-started operations. Cheers, Martin Pohlack - --------------050501090105060407000103 Content-Type: text/plain; name="pc-select.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="pc-select.diff" This patch adds tracking whether we ourselves did activate the mark. If not, we should not deactivate it later on with our move functions. This prevents interference between manually starting a selection (Ctrl-Space + Move) and doing shifted moves. Both can now be used at the same time (as in xemacs). - --- /usr/share/emacs/23.0.60/lisp/emulation/pc-select.el 2007-11-06 10:12:29.000000000 +0100 +++ pc-select.el 2007-11-14 18:05:22.000000000 +0100 @@ -254,6 +254,10 @@ `function-key-map' before PC Selection mode had changed that association.") +(defvar pc-select-shifted-mark nil + "Holds whether we ourselves did activate the mark. Only then + should we deactivate if later on.") + ;;;; ;; misc ;;;; @@ -284,7 +288,15 @@ (defun ensure-mark() ;; make sure mark is active ;; test if it is active, if it isn't, set it and activate it - - (or mark-active (set-mark-command nil))) + (or mark-active (set-mark-command nil)) + (setq pc-select-shifted-mark t)) + +(defun maybe-deactivate-mark() + ;; maybe switch off mark (only if *we* switched it on) + (if pc-select-shifted-mark + (progn + (setq mark-active nil) + (setq pc-select-shifted-mark nil)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;; forward and mark @@ -427,7 +439,7 @@ "Deactivate mark; move point right ARG characters \(left if ARG negative). On reaching end of buffer, stop and signal error." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (forward-char arg)) (defun forward-word-nomark (&optional arg) @@ -436,13 +448,13 @@ If an edge of the buffer is reached, point is left there and nil is returned." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (forward-word arg)) (defun forward-line-nomark (&optional arg) "Deactivate mark; move cursor vertically down ARG lines." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (forward-line arg) (setq this-command 'forward-line) ) @@ -452,7 +464,7 @@ With argument, do it that many times. Negative arg -N means move backward across N balanced expressions." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (forward-sexp arg)) (defun forward-paragraph-nomark (&optional arg) @@ -464,7 +476,7 @@ A paragraph end is the beginning of a line which is not part of the paragraph to which the end of the previous line belongs, or the end of the buffer." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (forward-paragraph arg)) (defun next-line-nomark (&optional arg) @@ -483,7 +495,7 @@ Then it does not try to move vertically. This goal column is stored in `goal-column', which is nil when there is none." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (with-no-warnings (next-line arg)) (setq this-command 'next-line)) @@ -492,14 +504,14 @@ With argument ARG not nil or 1, move forward ARG - 1 lines first. If scan reaches end of buffer, stop there without error." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (end-of-line arg) (setq this-command 'end-of-line)) (defun backward-line-nomark (&optional arg) "Deactivate mark; move cursor vertically up ARG lines." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (if (null arg) (setq arg 1)) (forward-line (- arg)) @@ -512,7 +524,7 @@ Negative ARG means scroll upward. When calling from a program, supply a number as argument or nil." (interactive "P") - - (setq mark-active nil) + (maybe-deactivate-mark) (cond (pc-select-override-scroll-error (condition-case nil (scroll-down arg) (beginning-of-buffer (goto-char (point-min))))) @@ -528,7 +540,7 @@ Don't use this command in Lisp programs! \(goto-char (point-max)) is faster and avoids clobbering the mark." (interactive "P") - - (setq mark-active nil) + (maybe-deactivate-mark) (let ((size (- (point-max) (point-min)))) (goto-char (if arg (- (point-max) @@ -663,14 +675,14 @@ "Deactivate mark; move point left ARG characters (right if ARG negative). On attempt to pass beginning or end of buffer, stop and signal error." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (backward-char arg)) (defun backward-word-nomark (&optional arg) "Deactivate mark; move backward until encountering the end of a word. With argument, do this that many times." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (backward-word arg)) (defun backward-sexp-nomark (&optional arg) @@ -678,7 +690,7 @@ With argument, do it that many times. Negative arg -N means move forward across N balanced expressions." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (backward-sexp arg)) (defun backward-paragraph-nomark (&optional arg) @@ -693,7 +705,7 @@ See `forward-paragraph' for more information." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (backward-paragraph arg)) (defun previous-line-nomark (&optional arg) @@ -706,7 +718,7 @@ a semipermanent goal column to which this command always moves. Then it does not try to move vertically." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (with-no-warnings (previous-line arg)) (setq this-command 'previous-line)) @@ -715,7 +727,7 @@ With argument ARG not nil or 1, move forward ARG - 1 lines first. If scan reaches end of buffer, stop there without error." (interactive "p") - - (setq mark-active nil) + (maybe-deactivate-mark) (beginning-of-line arg)) (defun scroll-up-nomark (&optional arg) @@ -724,7 +736,7 @@ Negative ARG means scroll downward. When calling from a program, supply a number as argument or nil." (interactive "P") - - (setq mark-active nil) + (maybe-deactivate-mark) (cond (pc-select-override-scroll-error (condition-case nil (scroll-up arg) (end-of-buffer (goto-char (point-max))))) @@ -740,7 +752,7 @@ Don't use this command in Lisp programs! \(goto-char (point-min)) is faster and avoids clobbering the mark." (interactive "P") - - (setq mark-active nil) + (maybe-deactivate-mark) (let ((size (- (point-max) (point-min)))) (goto-char (if arg (+ (point-min) - --------------050501090105060407000103-- ------- End of forwarded message -------