unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [mp26@os.inf.tu-dresden.de: Patch for pc-select.el]
@ 2007-11-16  4:28 Richard Stallman
  2007-11-16 17:58 ` Fwd: Patch for pc-select.el Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-11-16  4:28 UTC (permalink / raw)
  To: emacs-devel

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 <mp26@os.inf.tu-dresden.de>
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 -------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Patch for pc-select.el
  2007-11-16  4:28 [mp26@os.inf.tu-dresden.de: Patch for pc-select.el] Richard Stallman
@ 2007-11-16 17:58 ` Stefan Monnier
  2007-11-17  4:54   ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2007-11-16 17:58 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

> Would someone please DTRT with this, then ack?

Looked good to me, installed.
BTW: please try and find a way to include messages which doesn't break
patches (by quoting leading "-" into "- -").


        Stefan


> ------- 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 <mp26@os.inf.tu-dresden.de>
> 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 -------


> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Patch for pc-select.el
  2007-11-16 17:58 ` Fwd: Patch for pc-select.el Stefan Monnier
@ 2007-11-17  4:54   ` Richard Stallman
  2007-11-18  4:11     ` Stefan Monnier
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-11-17  4:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

    BTW: please try and find a way to include messages which doesn't break
    patches (by quoting leading "-" into "- -").

That is done by `f' in Rmail.  You can undo it with rmail-unforward.
If I remember, I copy the old message into the new one, but I don't
always remember.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Patch for pc-select.el
  2007-11-17  4:54   ` Richard Stallman
@ 2007-11-18  4:11     ` Stefan Monnier
  2007-11-18  9:52       ` Forwarded messages (was: Fwd: Patch for pc-select.el) Reiner Steib
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2007-11-18  4:11 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

> That is done by `f' in Rmail.  You can undo it with rmail-unforward.

I do not use rmail, so that doesn't really help me.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Forwarded messages (was: Fwd: Patch for pc-select.el)
  2007-11-18  4:11     ` Stefan Monnier
@ 2007-11-18  9:52       ` Reiner Steib
  2007-11-18 22:46         ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Reiner Steib @ 2007-11-18  9:52 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: rms, emacs-devel

[ The following message is a courtesy copy of an article that has
  been posted to news:gmane.emacs.devel as well. ]

On Sun, Nov 18 2007, Stefan Monnier wrote:

>> That is done by `f' in Rmail.  You can undo it with rmail-unforward.
>
> I do not use rmail, so that doesn't really help me.

Doesn't `gnus-summary-enter-digest-group'[1] work?

That aside, I think it would help if Richard would include the
Message-ID of the original mail when forwarding messages (allowing to
jump directly to the original mail).

Bye, Reiner.

[1]
,----[ `C-h k C-d' ]
| C-d runs the command gnus-summary-enter-digest-group
|   which is an interactive compiled Lisp function in `gnus-sum'.
| It is bound to C-d, A D, <menu-bar> <Article> <Enter digest buffer>.
| (gnus-summary-enter-digest-group &optional force)
| 
| Enter an nndoc group based on the current article.
| If force, force a digest interpretation.  If not, try
| to guess what the document format is.
`----
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Forwarded messages (was: Fwd: Patch for pc-select.el)
  2007-11-18  9:52       ` Forwarded messages (was: Fwd: Patch for pc-select.el) Reiner Steib
@ 2007-11-18 22:46         ` Richard Stallman
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2007-11-18 22:46 UTC (permalink / raw)
  To: Reiner Steib; +Cc: monnier, emacs-devel

    That aside, I think it would help if Richard would include the
    Message-ID of the original mail when forwarding messages (allowing to
    jump directly to the original mail).

I found an easy way to make that happen from now on.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Fwd: Patch for pc-select.el
@ 2008-01-06  6:46 Sun Yijiang
  0 siblings, 0 replies; 7+ messages in thread
From: Sun Yijiang @ 2008-01-06  6:46 UTC (permalink / raw)
  To: Stefan Monnier, Richard Stallman; +Cc: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 10235 bytes --]

Wait a minute.  I recently also found pc-selection.el broken with the latest
CVS version, but what I am using is the "lisp/emulation/pc-selection.el.gz"
which shipped with Emacs.  This patch seems only apply to the "standalone
version" version of pc-selection.el (maybe this one?
ftp://ftp.thp.uni-duisburg.de/pub/source/elisp/pc-select.el).  Are you guys
all using the standalone version?  I think we need a patch for the official
pc-select.el too, it's broken now.


------------------------------
>
> Message: 7
> Date: Fri, 16 Nov 2007 12:58:04 -0500
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Subject: Re: Fwd: Patch for pc-select.el
> To: rms@gnu.org
> Cc: emacs-devel@gnu.org
> Message-ID: <jwvfxz6vzth.fsf-monnier+emacs@gnu.org>
> Content-Type: text/plain; charset=us-ascii
>
> > Would someone please DTRT with this, then ack?
>
> Looked good to me, installed.
> BTW: please try and find a way to include messages which doesn't break
> patches (by quoting leading "-" into "- -").
>
>
>         Stefan
>
>
> > ------- 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 <mp26@os.inf.tu-dresden.de>
> > 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 -------
>
>
> > _______________________________________________
> > Emacs-devel mailing list
> > Emacs-devel@gnu.org
> > http://lists.gnu.org/mailman/listinfo/emacs-devel
>
>
>
>
> ------------------------------
>
> _______________________________________________
> Emacs-devel mailing list
> Emacs-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-devel
>
> End of Emacs-devel Digest, Vol 45, Issue 144
> ********************************************
>

[-- Attachment #1.2: Type: text/html, Size: 15138 bytes --]

[-- Attachment #2: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-01-06  6:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-16  4:28 [mp26@os.inf.tu-dresden.de: Patch for pc-select.el] Richard Stallman
2007-11-16 17:58 ` Fwd: Patch for pc-select.el Stefan Monnier
2007-11-17  4:54   ` Richard Stallman
2007-11-18  4:11     ` Stefan Monnier
2007-11-18  9:52       ` Forwarded messages (was: Fwd: Patch for pc-select.el) Reiner Steib
2007-11-18 22:46         ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2008-01-06  6:46 Fwd: Patch for pc-select.el Sun Yijiang

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).