emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Patch for pc-select.el


From: Sun Yijiang
Subject: Re: Fwd: Patch for pc-select.el
Date: Sun, 6 Jan 2008 14:46:38 +0800

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 <address@hidden>
Subject: Re: Fwd: Patch for pc-select.el
To: address@hidden
Cc: address@hidden
Message-ID: <address@hidden>
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 <address@hidden>
> MIME-Version: 1.0
> To: address@hidden
> 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-devel




------------------------------

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

End of Emacs-devel Digest, Vol 45, Issue 144
********************************************


reply via email to

[Prev in Thread] Current Thread [Next in Thread]