all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled
@ 2011-01-30  5:00 PJ Weisberg
  2011-02-01 21:11 ` Stefan Monnier
  2011-02-08 20:46 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: PJ Weisberg @ 2011-01-30  5:00 UTC (permalink / raw)
  To: 7940


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

1) Open or create a file with logical lines longer than the width of the
window.
2) Enable visual-line-mode and pc-selection-mode (order doesn't matter).
3) Press the <home> and/or <end> keys with point on one of these long
lines.

Expected: Point moves to the beginning/end of the current visual line.
Observed: Point moves to the beginning/end of the current logical line.

I've attached two (mutually exclusive) patches against the trunk.  I've
never submitted a patch to Emacs before, so please let me know which is more
in line with the preferred way of doing things.

--PJ

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

[-- Attachment #2: pc-visual-line_if.patch --]
[-- Type: text/x-patch, Size: 3789 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: pj@irregularexpressions.net-20110130045542-\
#   nuvqsje84yncvflq
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: b4d2fcdcc523cadc51d5f47e1965a9610cfcb2db
# timestamp: 2011-01-29 20:56:16 -0800
# base_revision_id: schwab@linux-m68k.org-20110130003535-\
#   jminwifpi767oiw5
# 
# Begin patch
=== modified file 'lisp/emulation/pc-select.el'
--- lisp/emulation/pc-select.el	2011-01-25 04:08:28 +0000
+++ lisp/emulation/pc-select.el	2011-01-30 04:55:42 +0000
@@ -366,8 +366,11 @@
 If scan reaches end of buffer, stop there without error."
   (interactive "p")
   (pc-select-ensure-mark)
-  (end-of-line arg)
-  (setq this-command 'end-of-line))
+  (let ((eol-command (if visual-line-mode
+                         'end-of-visual-line
+                       'end-of-line)))
+    (funcall eol-command arg)
+    (setq this-command eol-command)))
 
 (defun backward-line-mark (&optional arg)
   "Ensure mark is active; move cursor vertically up ARG lines."
@@ -501,8 +504,11 @@
 If scan reaches end of buffer, stop there without error."
   (interactive "p")
   (pc-select-maybe-deactivate-mark)
-  (end-of-line arg)
-  (setq this-command 'end-of-line))
+  (let ((eol-command (if visual-line-mode
+                         'end-of-visual-line
+                       'end-of-line)))
+    (funcall eol-command arg)
+    (setq this-command eol-command)))
 
 (defun backward-line-nomark (&optional arg)
   "Deactivate mark; move cursor vertically up ARG lines."
@@ -628,8 +634,9 @@
 If scan reaches end of buffer, stop there without error."
   (interactive "p")
   (pc-select-ensure-mark)
-  (beginning-of-line arg))
-
+  (if visual-line-mode
+      (beginning-of-visual-line arg)
+    (beginning-of-line arg)))
 
 (defun scroll-up-mark (&optional arg)
   "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG.
@@ -728,7 +735,9 @@
 If scan reaches end of buffer, stop there without error."
   (interactive "p")
   (pc-select-maybe-deactivate-mark)
-  (beginning-of-line arg))
+  (if visual-line-mode
+      (beginning-of-visual-line arg)
+    (beginning-of-line arg)))
 
 (defun scroll-up-nomark (&optional arg)
   "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG.

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWRC6JvgAAed/gFAQCgBQ4//3
UhJAgL////BQBD5T3uvBYo9T2u73CSSNGiZTTwJoAp6eqe1Gp6R6j1DE9IMoJhNqaaJ6U9IeiAAA
ABoMSaJo0pjQj1B6Jo9IAAAGgilGqeKeieET1GR6QGQAAAAkkTETKeQmeoaTRhAxAAAQAw3lYeef
1M04C3ipM5mIQotSMsIPjeRqjCNoCHAHwOOBBxl4aWGYPXxKaJFljmeQGTDWtzs+2mz7/y3CNPGO
rdiId27xSXTNBg1nYJIe2zPTfXNNzHMLabjUbTcdQ4ekxuDQMMXOFjHmc+tmMoDYLXVEgExiUdae
GQGR+qsItp2CvVpcDG411hLyxqtblv4nf1X5b5B0QdsOyOVsYGx0w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[-- Type: text/x-patch, Size: 5804 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: pj@irregularexpressions.net-20110130033100-\
#   r8qs1ccpbbbsbg1e
# target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
# testament_sha1: 10ade64307d860af931f9f6fd8d3162c0b4d71e1
# timestamp: 2011-01-29 19:42:53 -0800
# base_revision_id: schwab@linux-m68k.org-20110130003535-\
#   jminwifpi767oiw5
# 
# Begin patch
=== modified file 'lisp/emulation/pc-select.el'
--- lisp/emulation/pc-select.el	2011-01-25 04:08:28 +0000
+++ lisp/emulation/pc-select.el	2011-01-30 03:31:00 +0000
@@ -369,6 +369,15 @@
   (end-of-line arg)
   (setq this-command 'end-of-line))
 
+(defun end-of-visual-line-mark (&optional arg)
+  "Ensure mark is active; move point to end of current visual line.
+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")
+  (pc-select-ensure-mark)
+  (end-of-visual-line arg)
+  (setq this-command 'end-of-visual-line))
+
 (defun backward-line-mark (&optional arg)
   "Ensure mark is active; move cursor vertically up ARG lines."
   (interactive "p")
@@ -504,6 +513,15 @@
   (end-of-line arg)
   (setq this-command 'end-of-line))
 
+(defun end-of-visual-line-nomark (&optional arg)
+  "Deactivate mark; move point to end of current visual line.
+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")
+  (pc-select-maybe-deactivate-mark)
+  (end-of-visual-line arg)
+  (setq this-command 'end-of-visual-line))
+
 (defun backward-line-nomark (&optional arg)
   "Deactivate mark; move cursor vertically up ARG lines."
   (interactive "p")
@@ -630,6 +648,13 @@
   (pc-select-ensure-mark)
   (beginning-of-line arg))
 
+(defun beginning-of-visual-line-mark (&optional arg)
+  "Ensure mark is active; move point to beginning of current visual line.
+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")
+  (pc-select-ensure-mark)
+  (beginning-of-visual-line arg))
 
 (defun scroll-up-mark (&optional arg)
   "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG.
@@ -730,6 +755,14 @@
   (pc-select-maybe-deactivate-mark)
   (beginning-of-line arg))
 
+(defun beginning-of-visual-line-nomark (&optional arg)
+  "Deactivate mark; move point to beginning of current visual line.
+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")
+  (pc-select-maybe-deactivate-mark)
+  (beginning-of-visual-line arg))
+
 (defun scroll-up-nomark (&optional arg)
   "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG.
 A near full screen is `next-screen-context-lines' less than a full screen.

=== modified file 'lisp/simple.el'
--- lisp/simple.el	2011-01-25 04:08:28 +0000
+++ lisp/simple.el	2011-01-30 03:31:00 +0000
@@ -4808,6 +4808,10 @@
     (define-key map [remap kill-line] 'kill-visual-line)
     (define-key map [remap move-beginning-of-line] 'beginning-of-visual-line)
     (define-key map [remap move-end-of-line]  'end-of-visual-line)
+    (define-key map [remap end-of-line-nomark] 'end-of-visual-line-nomark)
+    (define-key map [remap end-of-line-mark] 'end-of-visual-line-mark)
+    (define-key map [remap beginning-of-line-nomark] 'beginning-of-visual-line-nomark)
+    (define-key map [remap beginning-of-line-mark] 'beginning-of-visual-line-mark)
     ;; These keybindings interfere with xterm function keys.  Are
     ;; there any other suitable bindings?
     ;; (define-key map "\M-[" 'previous-logical-line)

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWR1fby0AAxBfgEAQUef//3ay
UIq////wYAb33lpoYCyDUgGgGhjmAAmTAAmEwTCGAIwAJRCnkZDTKbUJtSehNDQDQAGmjQOYACZM
ACYTBMIYAjAAlNJTyp7RNRp5TBDamgAAAGTQA5gAJkwAJhMEwhgCMABUkgQNJoZNTDQSn5Mp6mU0
NGhtTajNRgQSZxTY1VX7O39po16MUCIKJv4QLJDe92gGCSVi1ZX9X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7xMTJZflh1AXB29YfF6rVVfb0eBlJ5
Sjx4m/yujwOrmzPS84npnshV0P30L0mqOyMfkP3KQ5PB0dDz6PV5J7Yz5pRh0z3O16Ot4lHwpqoy
lrzqwVEoaRml6N7B+66FjjHq60tqouKbaLTaMrndNDPw+8Vhxn9JgcEvbZv6eUe6YlRHNoR9Ed56
RhN/DLjNu2lFFQ4w2HM+Lj5xsqQ/E3xr1o3TYy64cZ1nZUj5y1k43m7tjuHI6EtJKM38m2Nt54Iy
c0ouGuQ1ji3NfyzzFVDOYSYUhsESAnSQOJ0rGcekUw7dryfpNeM0NQ06JomutReZR6KkyYXmIWiq
kS+j6QqRpxOKNN6L0vO1Mofo0piVJRUqjnWh48jSm506xch8DfODcnd41NhPeoathX8GwsXRwjfu
m2i+bDfmc4/s4i87jvw29tKOkehj/pWM0bZevlMvljNJu5fWGOo6HQnoLjv6KLFTkKLR+F5qXlNh
1w+5RhJthn54y+GihqjBYu9bJfSSpzXaNJ3w2GgsVllUly4dlnPD6g/V1AJhNL6oait1FGLQ48Vi
hJAcYB63SEOkrM1RfIVuOFG83lhkOdamZUxvvdZheWvzwNZ8dkWkoy1Z5rtlcSyMjOGqbFZaLGrw
SzGQ3dR5w5eFijTjGZuNM1n0Si5FLptjmOtFUXzymoxmEbUrmTjJjNJAjaOgg9LP/i7kinChIDq+
3lo=

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

* bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled
  2011-01-30  5:00 bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled PJ Weisberg
@ 2011-02-01 21:11 ` Stefan Monnier
  2011-02-05 21:41   ` PJ Weisberg
  2011-02-08 20:46 ` Stefan Monnier
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-02-01 21:11 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 7940

> I've attached two (mutually exclusive) patches against the trunk.  I've
> never submitted a patch to Emacs before, so please let me know which is more
> in line with the preferred way of doing things.

That's a good question.  I think the second looks cleaner, but suffers
from the major problem that simple.el ends up referring to
pc-select-mode, which is a mode that's rather deprecated.

I think we should actually declare pc-selection-mode obsolete.
Could you turn it off (and enable-delete-selection-mode instead, which
is otherwise enabled by pc-selection-mode) and see which other features
of pc-selection-mode you miss?


        Stefan

> --PJ
> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: pj@irregularexpressions.net-20110130045542-\
> #   nuvqsje84yncvflq
> # target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
> # testament_sha1: b4d2fcdcc523cadc51d5f47e1965a9610cfcb2db
> # timestamp: 2011-01-29 20:56:16 -0800
> # base_revision_id: schwab@linux-m68k.org-20110130003535-\
> #   jminwifpi767oiw5
> # 
> # Begin patch
> === modified file 'lisp/emulation/pc-select.el'
> --- lisp/emulation/pc-select.el	2011-01-25 04:08:28 +0000
> +++ lisp/emulation/pc-select.el	2011-01-30 04:55:42 +0000
> @@ -366,8 +366,11 @@
>  If scan reaches end of buffer, stop there without error."
>    (interactive "p")
>    (pc-select-ensure-mark)
> -  (end-of-line arg)
> -  (setq this-command 'end-of-line))
> +  (let ((eol-command (if visual-line-mode
> +                         'end-of-visual-line
> +                       'end-of-line)))
> +    (funcall eol-command arg)
> +    (setq this-command eol-command)))
 
>  (defun backward-line-mark (&optional arg)
>    "Ensure mark is active; move cursor vertically up ARG lines."
> @@ -501,8 +504,11 @@
>  If scan reaches end of buffer, stop there without error."
>    (interactive "p")
>    (pc-select-maybe-deactivate-mark)
> -  (end-of-line arg)
> -  (setq this-command 'end-of-line))
> +  (let ((eol-command (if visual-line-mode
> +                         'end-of-visual-line
> +                       'end-of-line)))
> +    (funcall eol-command arg)
> +    (setq this-command eol-command)))
 
>  (defun backward-line-nomark (&optional arg)
>    "Deactivate mark; move cursor vertically up ARG lines."
> @@ -628,8 +634,9 @@
>  If scan reaches end of buffer, stop there without error."
>    (interactive "p")
>    (pc-select-ensure-mark)
> -  (beginning-of-line arg))
> -
> +  (if visual-line-mode
> +      (beginning-of-visual-line arg)
> +    (beginning-of-line arg)))
 
>  (defun scroll-up-mark (&optional arg)
>    "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG.
> @@ -728,7 +735,9 @@
>  If scan reaches end of buffer, stop there without error."
>    (interactive "p")
>    (pc-select-maybe-deactivate-mark)
> -  (beginning-of-line arg))
> +  (if visual-line-mode
> +      (beginning-of-visual-line arg)
> +    (beginning-of-line arg)))
 
>  (defun scroll-up-nomark (&optional arg)
>    "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG.

> # Begin bundle
> IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWRC6JvgAAed/gFAQCgBQ4//3
> UhJAgL////BQBD5T3uvBYo9T2u73CSSNGiZTTwJoAp6eqe1Gp6R6j1DE9IMoJhNqaaJ6U9IeiAAA
> ABoMSaJo0pjQj1B6Jo9IAAAGgilGqeKeieET1GR6QGQAAAAkkTETKeQmeoaTRhAxAAAQAw3lYeef
> 1M04C3ipM5mIQotSMsIPjeRqjCNoCHAHwOOBBxl4aWGYPXxKaJFljmeQGTDWtzs+2mz7/y3CNPGO
> rdiId27xSXTNBg1nYJIe2zPTfXNNzHMLabjUbTcdQ4ekxuDQMMXOFjHmc+tmMoDYLXVEgExiUdae
> GQGR+qsItp2CvVpcDG411hLyxqtblv4nf1X5b5B0QdsOyOVsYGx0wJtKSfccbmALQrF4csGUjUwe
> D1PWK2YRUMYeCIGAv1ZKBFCkT5J3wbz1V9I0HWdQosUfxQ8LPtzvvWYnVt8aWUgsaVNY0xSp9IjO
> VEBomJ13xJCixsTQdXHOWDYHJ+edkomIZeL2o9H5yMBguRiDHeXZA5qBy+hV8LQ8TSiHLAGoyvkV
> sGDDgWwBugNTweS12InsfQfwUrafIz1YC5eLILi3IOfS9wEXxH6W1oYB4SsVBa8WjQppsS1EPCJU
> GsaHjadSsQ5wZSvBdoCgcIPddbN9rIxL4KadBZRpVruqIzQZzsVS8OhIyngxIKc5YasxaWYBpCYE
> 5Klvmktt2i1m0rZ6vCWH6TqMaIJL5a3aNCKhgy5xm4siDSaMB5skK/nFU5e+fP5hzQcuJCx+ouYG
> Y8aEeSUYo07HE4DSpjqGeKGv5W5KgxxbltiLC+N19KpdkBTmMAlQmZJqYbyJEHp6ZyafsAogsgsE
> nmdYmEAgFexKzXLP0At47OQWc+tNZIMXBwbkXKRb9Eyw8G6VzBxSt79F60zN4+zjeHrj7h8Um1Ms
> h4a9+51mbjx4TpNuNCXeUekTLVLAKPIBrdiu5ehvGUDRwvwFY4hImwK0h4ZI8Aqj7xJWm0mGB5dQ
> rhRoNCqLN/8mhcGY8FNUGS8OZCtrDeE8aqrkuU9rMIuS9C7ShVS7VLRoScK5YYZJ1t+kKi1VivQO
> B3TYEKA7gNScG28woU1Ws9OnUKuSfMDKqcOm46OKlBBUKUjFTAOLD53EvYTCKApCIRo7FmSvSFU4
> amhaUnhvpGdDPM2jmcBWpRWb9iCYWTJQPoFQZ6VwjWyq6q/BmX1d2dGUVsiRFGvJo+FlgWEPAxsH
> RjDYGbBZJlWvjzjkzQMwIw2wA3mnwkxjFHgcZSXxhWateAUMQzC2ISSd3CqXbgQSCSBnFzCssT3v
> mVs+rETwYnkV1QMSQCGQVY5ZjsK3ECfKTt2mFjiB2GazcDcDALkxG15mllixc0NQm46x6Z8MhN/i
> 7kinChICF0TfAA==

> # Bazaar merge directive format 2 (Bazaar 0.90)
> # revision_id: pj@irregularexpressions.net-20110130033100-\
> #   r8qs1ccpbbbsbg1e
> # target_branch: bzr://bzr.savannah.gnu.org/emacs/trunk/
> # testament_sha1: 10ade64307d860af931f9f6fd8d3162c0b4d71e1
> # timestamp: 2011-01-29 19:42:53 -0800
> # base_revision_id: schwab@linux-m68k.org-20110130003535-\
> #   jminwifpi767oiw5
> # 
> # Begin patch
> === modified file 'lisp/emulation/pc-select.el'
> --- lisp/emulation/pc-select.el	2011-01-25 04:08:28 +0000
> +++ lisp/emulation/pc-select.el	2011-01-30 03:31:00 +0000
> @@ -369,6 +369,15 @@
>    (end-of-line arg)
>    (setq this-command 'end-of-line))
 
> +(defun end-of-visual-line-mark (&optional arg)
> +  "Ensure mark is active; move point to end of current visual line.
> +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")
> +  (pc-select-ensure-mark)
> +  (end-of-visual-line arg)
> +  (setq this-command 'end-of-visual-line))
> +
>  (defun backward-line-mark (&optional arg)
>    "Ensure mark is active; move cursor vertically up ARG lines."
>    (interactive "p")
> @@ -504,6 +513,15 @@
>    (end-of-line arg)
>    (setq this-command 'end-of-line))
 
> +(defun end-of-visual-line-nomark (&optional arg)
> +  "Deactivate mark; move point to end of current visual line.
> +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")
> +  (pc-select-maybe-deactivate-mark)
> +  (end-of-visual-line arg)
> +  (setq this-command 'end-of-visual-line))
> +
>  (defun backward-line-nomark (&optional arg)
>    "Deactivate mark; move cursor vertically up ARG lines."
>    (interactive "p")
> @@ -630,6 +648,13 @@
>    (pc-select-ensure-mark)
>    (beginning-of-line arg))
 
> +(defun beginning-of-visual-line-mark (&optional arg)
> +  "Ensure mark is active; move point to beginning of current visual line.
> +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")
> +  (pc-select-ensure-mark)
> +  (beginning-of-visual-line arg))
 
>  (defun scroll-up-mark (&optional arg)
>    "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG.
> @@ -730,6 +755,14 @@
>    (pc-select-maybe-deactivate-mark)
>    (beginning-of-line arg))
 
> +(defun beginning-of-visual-line-nomark (&optional arg)
> +  "Deactivate mark; move point to beginning of current visual line.
> +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")
> +  (pc-select-maybe-deactivate-mark)
> +  (beginning-of-visual-line arg))
> +
>  (defun scroll-up-nomark (&optional arg)
>    "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG.
>  A near full screen is `next-screen-context-lines' less than a full screen.

> === modified file 'lisp/simple.el'
> --- lisp/simple.el	2011-01-25 04:08:28 +0000
> +++ lisp/simple.el	2011-01-30 03:31:00 +0000
> @@ -4808,6 +4808,10 @@
>      (define-key map [remap kill-line] 'kill-visual-line)
>      (define-key map [remap move-beginning-of-line] 'beginning-of-visual-line)
>      (define-key map [remap move-end-of-line]  'end-of-visual-line)
> +    (define-key map [remap end-of-line-nomark] 'end-of-visual-line-nomark)
> +    (define-key map [remap end-of-line-mark] 'end-of-visual-line-mark)
> +    (define-key map [remap beginning-of-line-nomark] 'beginning-of-visual-line-nomark)
> +    (define-key map [remap beginning-of-line-mark] 'beginning-of-visual-line-mark)
>      ;; These keybindings interfere with xterm function keys.  Are
>      ;; there any other suitable bindings?
>      ;; (define-key map "\M-[" 'previous-logical-line)

> # Begin bundle
> IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWR1fby0AAxBfgEAQUef//3ay
> UIq////wYAb33lpoYCyDUgGgGhjmAAmTAAmEwTCGAIwAJRCnkZDTKbUJtSehNDQDQAGmjQOYACZM
> ACYTBMIYAjAAlNJTyp7RNRp5TBDamgAAAGTQA5gAJkwAJhMEwhgCMABUkgQNJoZNTDQSn5Mp6mU0
> NGhtTajNRgQSZxTY1VX7O39po16MUCIKJv4QLJDe92gGCSVi1ZX9XwrDTda/HcSyRRtPd+Sn+C8Z
> UnoFh3FYmSSD2821XqLg+AybMYqyFsAvTcIrfUE7wRZb6OFYX8ekNRdpCYaAzkjCaAigoCJFg1mL
> A7f4uNtzZsN5iYnqe53NZyNZvVViGjy8JgxKhIGBtqHeYgXVUNtg116+uinLQv5Zn0i/4llFSe5Y
> nsfItE9Zz1U7SjqLPbUs8TuNB/3lzbzKOseeM1qdjYwTWRoBMYuEwj9a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3xr1o3TYy64cZ1nZUj5y1k43m7tjuHI6EtJKM38m2Nt54Iy
> c0ouGuQ1ji3NfyzzFVDOYSYUhsESAnSQOJ0rGcekUw7dryfpNeM0NQ06JomutReZR6KkyYXmIWiq
> kS+j6QqRpxOKNN6L0vO1Mofo0piVJRUqjnWh48jSm506xch8DfODcnd41NhPeoathX8GwsXRwjfu
> m2i+bDfmc4/s4i87jvw29tKOkehj/pWM0bZevlMvljNJu5fWGOo6HQnoLjv6KLFTkKLR+F5qXlNh
> 1w+5RhJthn54y+GihqjBYu9bJfSSpzXaNJ3w2GgsVllUly4dlnPD6g/V1AJhNL6oait1FGLQ48Vi
> hJAcYB63SEOkrM1RfIVuOFG83lhkOdamZUxvvdZheWvzwNZ8dkWkoy1Z5rtlcSyMjOGqbFZaLGrw
> SzGQ3dR5w5eFijTjGZuNM1n0Si5FLptjmOtFUXzymoxmEbUrmTjJjNJAjaOgg9LP/i7kinChIDq+
> 3lo=






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

* bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled
  2011-02-01 21:11 ` Stefan Monnier
@ 2011-02-05 21:41   ` PJ Weisberg
  0 siblings, 0 replies; 4+ messages in thread
From: PJ Weisberg @ 2011-02-05 21:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 7940

On 2/1/11, Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> I think we should actually declare pc-selection-mode obsolete.
> Could you turn it off (and enable-delete-selection-mode instead, which
> is otherwise enabled by pc-selection-mode) and see which other features
> of pc-selection-mode you miss?

I think delete-selection-mode is the only feature I notice that isn't
on by default in Emacs 23.

I'm not sure how you treat 'obsolete' features, but maybe you could
use the less clean-looking patch on pc-select.el to fix the bug and
then just not look at it ever again. ;-)

-PJ





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

* bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled
  2011-01-30  5:00 bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled PJ Weisberg
  2011-02-01 21:11 ` Stefan Monnier
@ 2011-02-08 20:46 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2011-02-08 20:46 UTC (permalink / raw)
  To: PJ Weisberg; +Cc: 7940-done

> 1) Open or create a file with logical lines longer than the width of the
> window.
> 2) Enable visual-line-mode and pc-selection-mode (order doesn't matter).
> 3) Press the <home> and/or <end> keys with point on one of these long
> lines.

> Expected: Point moves to the beginning/end of the current visual line.
> Observed: Point moves to the beginning/end of the current logical line.

Thanks for your report.  I've installed a different patch (see below)
which removes most of pc-select's code so it relies on shift-select-mode
instead, which ends up fixing your bug.


        Stefan


=== renamed file 'lisp/emulation/pc-select.el' => 'lisp/obsolete/pc-select.el'
--- lisp/emulation/pc-select.el	2011-01-25 04:08:28 +0000
+++ lisp/obsolete/pc-select.el	2011-02-08 19:26:07 +0000
@@ -7,6 +7,7 @@
 ;; Author: Michael Staats <michael@thp.Uni-Duisburg.DE>
 ;; Keywords: convenience emulations
 ;; Created: 26 Sep 1995
+;; Obsolete-since: 24.1
 
 ;; This file is part of GNU Emacs.
 
@@ -83,6 +84,9 @@
   :prefix "pc-select"
   :group 'emulations)
 
+(define-obsolete-variable-alias 'pc-select-override-scroll-error
+                                'scroll-error-top-bottom
+                                "24.1")
 (defcustom pc-select-override-scroll-error t
   "Non-nil means don't generate error on scrolling past edge of buffer.
 This variable applies in PC Selection mode only.
@@ -92,9 +96,6 @@
 errors are suppressed."
   :type 'boolean
   :group 'pc-select)
-(define-obsolete-variable-alias 'pc-select-override-scroll-error
-                                'scroll-error-top-bottom
-                                "24.1")
 
 (defcustom pc-select-selection-keys-only nil
   "Non-nil means only bind the basic selection keys when started.
@@ -132,73 +133,14 @@
 (defvar pc-select-default-key-bindings nil
   "These key bindings always get set by PC Selection mode.")
 
-(unless pc-select-default-key-bindings
-  (let ((lst
-	 ;; This is to avoid confusion with the delete-selection-mode.
-         ;; On simple displays you can't see that a region is active and
-	 ;; will be deleted on the next keypress IMHO especially for
-	 ;; copy-region-as-kill this is confusing.
-	 ;; The same goes for exchange-point-and-mark
-	 '(("\M-w" . copy-region-as-kill-nomark)
-	   ("\C-x\C-x" . exchange-point-and-mark-nomark)
-	   ([S-right]   . forward-char-mark)
-	   ([right]     . forward-char-nomark)
-	   ([C-S-right] . forward-word-mark)
-	   ([C-right]   . forward-word-nomark)
-	   ([S-left]    . backward-char-mark)
-	   ([left]      . backward-char-nomark)
-	   ([C-S-left]  . backward-word-mark)
-	   ([C-left]    . backward-word-nomark)
-	   ([S-down]    . next-line-mark)
-	   ([down]      . next-line-nomark)
-
-	   ([S-end]     . end-of-line-mark)
-	   ([end]       . end-of-line-nomark)
-	   ([S-C-end]   . end-of-buffer-mark)
-	   ([C-end]     . end-of-buffer-nomark)
-	   ([S-M-end]   . end-of-buffer-mark)
-	   ([M-end]     . end-of-buffer-nomark)
-
-	   ([S-next]    . scroll-up-mark)
-	   ([next]      . scroll-up-nomark)
-
-	   ([S-up]      . previous-line-mark)
-	   ([up]        . previous-line-nomark)
-
-	   ([S-home]    . beginning-of-line-mark)
-	   ([home]      . beginning-of-line-nomark)
-	   ([S-C-home]  . beginning-of-buffer-mark)
-	   ([C-home]    . beginning-of-buffer-nomark)
-	   ([S-M-home]  . beginning-of-buffer-mark)
-	   ([M-home]    . beginning-of-buffer-nomark)
-
-	   ([M-S-down]  . forward-line-mark)
-	   ([M-down]    . forward-line-nomark)
-	   ([M-S-up]    . backward-line-mark)
-	   ([M-up]      . backward-line-nomark)
-
-	   ([S-prior]   . scroll-down-mark)
-	   ([prior]     . scroll-down-nomark)
-
-	   ;; Next four lines are from Pete Forman.
-	   ([C-down]    . forward-paragraph-nomark)  ; KNextPara     cDn
-	   ([C-up]      . backward-paragraph-nomark) ; KPrevPara     cUp
-	   ([S-C-down]  . forward-paragraph-mark)
-	   ([S-C-up]    . backward-paragraph-mark))))
-
-    (setq pc-select-default-key-bindings lst)))
-
-(defvar pc-select-extra-key-bindings nil
-  "Key bindings to set only if `pc-select-selection-keys-only' is nil.")
-
-;; The following keybindings are for standard ISO keyboards
-;; as they are used with IBM compatible PCs, IBM RS/6000,
-;; MACs, many X-Stations and probably more
-(unless pc-select-extra-key-bindings
-  (let ((lst
-	 '(([S-insert]  . yank)
-	   ([C-insert]  . copy-region-as-kill)
-	   ([S-delete]  . kill-region)
+(defvar pc-select-extra-key-bindings
+  ;; The following keybindings are for standard ISO keyboards
+  ;; as they are used with IBM compatible PCs, IBM RS/6000,
+  ;; MACs, many X-Stations and probably more.
+  '(;; Commented out since it's been standard at least since Emacs-21.
+    ;;([S-insert]  . yank)
+    ;;([C-insert]  . copy-region-as-kill)
+    ;;([S-delete]  . kill-region)
 
 	   ;; The following bindings are useful on Sun Type 3 keyboards
 	   ;; They implement the Get-Delete-Put (copy-cut-paste)
@@ -218,19 +160,14 @@
 	   ;; I only used the one that is not covered above.
 	   ([C-M-delete]  . kill-sexp)
 	   ;; Next line proposed by Eli Barzilay
-	   ([C-escape]    . electric-buffer-list))))
-
-    (setq pc-select-extra-key-bindings lst)))
+    ([C-escape]    . electric-buffer-list))
+  "Key bindings to set only if `pc-select-selection-keys-only' is nil.")
 
 (defvar pc-select-meta-moves-sexps-key-bindings
-  '((([M-S-right] . forward-sexp-mark)
-     ([M-right]   . forward-sexp-nomark)
-     ([M-S-left]  . backward-sexp-mark)
-     ([M-left]    . backward-sexp-nomark))
-    (([M-S-right] . forward-word-mark)
-     ([M-right]   . forward-word-nomark)
-     ([M-S-left]  . backward-word-mark)
-     ([M-left]    . backward-word-nomark)))
+  '((([M-right]   . forward-sexp)
+     ([M-left]    . backward-sexp))
+    (([M-right]   . forward-word)
+     ([M-left]    . backward-word)))
   "The list of key bindings controlled by `pc-select-meta-moves-sexp'.
 The bindings in the car of this list get installed if
 `pc-select-meta-moves-sexp' is t, the bindings in the cadr of this
@@ -259,514 +196,6 @@
 
 (provide 'pc-select)
 
-(defun copy-region-as-kill-nomark (beg end)
-  "Save the region as if killed, but don't kill it; deactivate mark.
-If `interprogram-cut-function' is non-nil, also save the text for a window
-system cut and paste.
-
-Deactivating mark is to avoid confusion with `delete-selection-mode'
-and `transient-mark-mode'."
- (interactive "r")
- (copy-region-as-kill beg end)
- (setq mark-active nil)
- (message "Region saved"))
-
-(defun exchange-point-and-mark-nomark  ()
-  "Like `exchange-point-and-mark' but without activating the mark."
-  (interactive)
-  (exchange-point-and-mark)
-  (setq mark-active nil))
-
-;;;;
-;; non-interactive
-;;;;
-(defun pc-select-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))
-  ;; Remember who activated the mark.
-  (setq mark-active 'pc-select))
-
-(defun pc-select-maybe-deactivate-mark ()
-  ;; maybe switch off mark (only if *we* switched it on)
-  (when (eq mark-active 'pc-select)
-    (deactivate-mark)))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;;;; forward and mark
-;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
-(defun forward-char-mark (&optional arg)
-  "Ensure mark is active; move point right ARG characters (left if ARG negative).
-On reaching end of buffer, stop and signal error."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (forward-char arg))
-
-(defun forward-word-mark (&optional arg)
-  "Ensure mark is active; move point right ARG words (backward if ARG is negative).
-Normally returns t.
-If an edge of the buffer is reached, point is left there
-and nil is returned."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (forward-word arg))
-
-(defun forward-line-mark (&optional arg)
-  "Ensure mark is active; move cursor vertically down ARG lines."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (forward-line arg)
-  (setq this-command 'forward-line)
-)
-
-(defun forward-sexp-mark (&optional arg)
-  "Ensure mark is active; move forward across one balanced expression (sexp).
-With argument, do it that many times.  Negative arg -N means
-move backward across N balanced expressions."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (forward-sexp arg))
-
-(defun forward-paragraph-mark (&optional arg)
-  "Ensure mark is active; move forward to end of paragraph.
-With arg N, do it N times; negative arg -N means move backward N paragraphs.
-
-A line which `paragraph-start' matches either separates paragraphs
-\(if `paragraph-separate' matches it also) or is the first line of a paragraph.
-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")
-  (pc-select-ensure-mark)
-  (forward-paragraph arg))
-
-(defun next-line-mark (&optional arg)
-  "Ensure mark is active; move cursor vertically down ARG lines.
-If there is no character in the target line exactly under the current column,
-the cursor is positioned after the character in that line which spans this
-column, or at the end of the line if it is not long enough.
-If there is no line in the buffer after this one, behavior depends on the
-value of `next-line-add-newlines'.  If non-nil, it inserts a newline character
-to create a line, and moves the cursor to that line.  Otherwise it moves the
-cursor to the end of the buffer \(if already at the end of the buffer, an error
-is signaled).
-
-The command \\[set-goal-column] can be used to create
-a semipermanent goal column to which this command always moves.
-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")
-  (pc-select-ensure-mark)
-  (with-no-warnings (next-line arg))
-  (setq this-command 'next-line))
-
-(defun end-of-line-mark (&optional arg)
-  "Ensure mark is active; move point to end of current line.
-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")
-  (pc-select-ensure-mark)
-  (end-of-line arg)
-  (setq this-command 'end-of-line))
-
-(defun backward-line-mark (&optional arg)
-  "Ensure mark is active; move cursor vertically up ARG lines."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (if (null arg)
-      (setq arg 1))
-  (forward-line (- arg))
-  (setq this-command 'forward-line)
-)
-
-(defun scroll-down-mark (&optional arg)
-  "Ensure mark is active; scroll down ARG lines; or near full screen if no ARG.
-A near full screen is `next-screen-context-lines' less than a full screen.
-Negative ARG means scroll upward.
-When calling from a program, supply a number as argument or nil.
-Attempting to scroll past the edge of buffer does not raise an
-error, unless `pc-select-override-scroll-error' is nil."
-  (interactive "P")
-  (pc-select-ensure-mark)
-  (cond (pc-select-override-scroll-error
-	 (condition-case nil (scroll-down arg)
-	   (beginning-of-buffer (goto-char (point-min)))))
-	(t (scroll-down arg))))
-
-(defun end-of-buffer-mark (&optional arg)
-  "Ensure mark is active; move point to the end of the buffer.
-With arg N, put point N/10 of the way from the end.
-
-If the buffer is narrowed, this command uses the beginning and size
-of the accessible part of the buffer.
-
-Don't use this command in Lisp programs!
-\(goto-char \(point-max)) is faster and avoids clobbering the mark."
-  (interactive "P")
-  (pc-select-ensure-mark)
-  (let ((size (- (point-max) (point-min))))
-    (goto-char (if arg
-		   (- (point-max)
-		      (if (> size 10000)
-			  ;; Avoid overflow for large buffer sizes!
-			  (* (prefix-numeric-value arg)
-			     (/ size 10))
-			(/ (* size (prefix-numeric-value arg)) 10)))
-		 (point-max))))
-  ;; If we went to a place in the middle of the buffer,
-  ;; adjust it to the beginning of a line.
-  (if arg (forward-line 1)
-    ;; If the end of the buffer is not already on the screen,
-    ;; then scroll specially to put it near, but not at, the bottom.
-    (if (let ((old-point (point)))
-	  (save-excursion
-		    (goto-char (window-start))
-		    (vertical-motion (window-height))
-		    (< (point) old-point)))
-	(progn
-	  (overlay-recenter (point))
-	  (recenter -3)))))
-
-;;;;;;;;;
-;;;;; no mark
-;;;;;;;;;
-
-(defun forward-char-nomark (&optional arg)
-  "Deactivate mark; move point right ARG characters \(left if ARG negative).
-On reaching end of buffer, stop and signal error."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (forward-char arg))
-
-(defun forward-word-nomark (&optional arg)
-  "Deactivate mark; move point right ARG words \(backward if ARG is negative).
-Normally returns t.
-If an edge of the buffer is reached, point is left there
-and nil is returned."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (forward-word arg))
-
-(defun forward-line-nomark (&optional arg)
-  "Deactivate mark; move cursor vertically down ARG lines."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (forward-line arg)
-  (setq this-command 'forward-line)
-)
-
-(defun forward-sexp-nomark (&optional arg)
-  "Deactivate mark; move forward across one balanced expression (sexp).
-With argument, do it that many times.  Negative arg -N means
-move backward across N balanced expressions."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (forward-sexp arg))
-
-(defun forward-paragraph-nomark (&optional arg)
-  "Deactivate mark; move forward to end of paragraph.
-With arg N, do it N times; negative arg -N means move backward N paragraphs.
-
-A line which `paragraph-start' matches either separates paragraphs
-\(if `paragraph-separate' matches it also) or is the first line of a paragraph.
-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")
-  (pc-select-maybe-deactivate-mark)
-  (forward-paragraph arg))
-
-(defun next-line-nomark (&optional arg)
-  "Deactivate mark; move cursor vertically down ARG lines.
-If there is no character in the target line exactly under the current column,
-the cursor is positioned after the character in that line which spans this
-column, or at the end of the line if it is not long enough.
-If there is no line in the buffer after this one, behavior depends on the
-value of `next-line-add-newlines'.  If non-nil, it inserts a newline character
-to create a line, and moves the cursor to that line.  Otherwise it moves the
-cursor to the end of the buffer (if already at the end of the buffer, an error
-is signaled).
-
-The command \\[set-goal-column] can be used to create
-a semipermanent goal column to which this command always moves.
-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")
-  (pc-select-maybe-deactivate-mark)
-  (with-no-warnings (next-line arg))
-  (setq this-command 'next-line))
-
-(defun end-of-line-nomark (&optional arg)
-  "Deactivate mark; move point to end of current line.
-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")
-  (pc-select-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")
-  (pc-select-maybe-deactivate-mark)
-  (if (null arg)
-      (setq arg 1))
-  (forward-line (- arg))
-  (setq this-command 'forward-line)
-)
-
-(defun scroll-down-nomark (&optional arg)
-  "Deactivate mark; scroll down ARG lines; or near full screen if no ARG.
-A near full screen is `next-screen-context-lines' less than a full screen.
-Negative ARG means scroll upward.
-When calling from a program, supply a number as argument or nil.
-Attempting to scroll past the edge of buffer does not raise an
-error, unless `pc-select-override-scroll-error' is nil."
-  (interactive "P")
-  (pc-select-maybe-deactivate-mark)
-  (cond (pc-select-override-scroll-error
-	 (condition-case nil (scroll-down arg)
-	   (beginning-of-buffer (goto-char (point-min)))))
-	(t (scroll-down arg))))
-
-(defun end-of-buffer-nomark (&optional arg)
-  "Deactivate mark; move point to the end of the buffer.
-With arg N, put point N/10 of the way from the end.
-
-If the buffer is narrowed, this command uses the beginning and size
-of the accessible part of the buffer.
-
-Don't use this command in Lisp programs!
-\(goto-char (point-max)) is faster and avoids clobbering the mark."
-  (interactive "P")
-  (pc-select-maybe-deactivate-mark)
-  (let ((size (- (point-max) (point-min))))
-    (goto-char (if arg
-		   (- (point-max)
-		      (if (> size 10000)
-			  ;; Avoid overflow for large buffer sizes!
-			  (* (prefix-numeric-value arg)
-			     (/ size 10))
-			(/ (* size (prefix-numeric-value arg)) 10)))
-		 (point-max))))
-  ;; If we went to a place in the middle of the buffer,
-  ;; adjust it to the beginning of a line.
-  (if arg (forward-line 1)
-    ;; If the end of the buffer is not already on the screen,
-    ;; then scroll specially to put it near, but not at, the bottom.
-    (if (let ((old-point (point)))
-	  (save-excursion
-		    (goto-char (window-start))
-		    (vertical-motion (window-height))
-		    (< (point) old-point)))
-	(progn
-	  (overlay-recenter (point))
-	  (recenter -3)))))
-
-
-;;;;;;;;;;;;;;;;;;;;
-;;;;;; backwards and mark
-;;;;;;;;;;;;;;;;;;;;
-
-(defun backward-char-mark (&optional arg)
-  "Ensure mark is active; move point left ARG characters (right if ARG negative).
-On attempt to pass beginning or end of buffer, stop and signal error."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (backward-char arg))
-
-(defun backward-word-mark (&optional arg)
-  "Ensure mark is active; move backward until encountering the end of a word.
-With argument, do this that many times."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (backward-word arg))
-
-(defun backward-sexp-mark (&optional arg)
-  "Ensure mark is active; move backward across one balanced expression (sexp).
-With argument, do it that many times.  Negative arg -N means
-move forward across N balanced expressions."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (backward-sexp arg))
-
-(defun backward-paragraph-mark (&optional arg)
-  "Ensure mark is active; move backward to start of paragraph.
-With arg N, do it N times; negative arg -N means move forward N paragraphs.
-
-A paragraph start is the beginning of a line which is a
-`first-line-of-paragraph' or which is ordinary text and follows a
-paragraph-separating line; except: if the first real line of a
-paragraph is preceded by a blank line, the paragraph starts at that
-blank line.
-
-See `forward-paragraph' for more information."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (backward-paragraph arg))
-
-(defun previous-line-mark (&optional arg)
-  "Ensure mark is active; move cursor vertically up ARG lines.
-If there is no character in the target line exactly over the current column,
-the cursor is positioned after the character in that line which spans this
-column, or at the end of the line if it is not long enough.
-
-The command \\[set-goal-column] can be used to create
-a semipermanent goal column to which this command always moves.
-Then it does not try to move vertically.
-
-If you are thinking of using this in a Lisp program, consider using
-`forward-line' with a negative argument instead.  It is usually easier
-to use and more reliable (no dependence on goal column, etc.)."
-  (interactive "p")
-  (pc-select-ensure-mark)
-  (with-no-warnings (previous-line arg))
-  (setq this-command 'previous-line))
-
-(defun beginning-of-line-mark (&optional arg)
-  "Ensure mark is active; move point to beginning of current line.
-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")
-  (pc-select-ensure-mark)
-  (beginning-of-line arg))
-
-
-(defun scroll-up-mark (&optional arg)
-  "Ensure mark is active; scroll upward ARG lines; or near full screen if no ARG.
-A near full screen is `next-screen-context-lines' less than a full screen.
-Negative ARG means scroll downward.
-When calling from a program, supply a number as argument or nil.
-Attempting to scroll past the edge of buffer does not raise an
-error, unless `pc-select-override-scroll-error' is nil."
-  (interactive "P")
-  (pc-select-ensure-mark)
-  (cond (pc-select-override-scroll-error
-	 (condition-case nil (scroll-up arg)
-	   (end-of-buffer (goto-char (point-max)))))
-	(t (scroll-up arg))))
-
-(defun beginning-of-buffer-mark (&optional arg)
-  "Ensure mark is active; move point to the beginning of the buffer.
-With arg N, put point N/10 of the way from the beginning.
-
-If the buffer is narrowed, this command uses the beginning and size
-of the accessible part of the buffer.
-
-Don't use this command in Lisp programs!
-\(goto-char (point-min)) is faster and avoids clobbering the mark."
-  (interactive "P")
-  (pc-select-ensure-mark)
-  (let ((size (- (point-max) (point-min))))
-    (goto-char (if arg
-		   (+ (point-min)
-		      (if (> size 10000)
-			  ;; Avoid overflow for large buffer sizes!
-			  (* (prefix-numeric-value arg)
-			     (/ size 10))
-			(/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
-		 (point-min))))
-  (if arg (forward-line 1)))
-
-;;;;;;;;
-;;; no mark
-;;;;;;;;
-
-(defun backward-char-nomark (&optional arg)
-  "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")
-  (pc-select-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")
-  (pc-select-maybe-deactivate-mark)
-  (backward-word arg))
-
-(defun backward-sexp-nomark (&optional arg)
-  "Deactivate mark; move backward across one balanced expression (sexp).
-With argument, do it that many times.  Negative arg -N means
-move forward across N balanced expressions."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (backward-sexp arg))
-
-(defun backward-paragraph-nomark (&optional arg)
-  "Deactivate mark; move backward to start of paragraph.
-With arg N, do it N times; negative arg -N means move forward N paragraphs.
-
-A paragraph start is the beginning of a line which is a
-`first-line-of-paragraph' or which is ordinary text and follows a
-paragraph-separating line; except: if the first real line of a
-paragraph is preceded by a blank line, the paragraph starts at that
-blank line.
-
-See `forward-paragraph' for more information."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (backward-paragraph arg))
-
-(defun previous-line-nomark (&optional arg)
-  "Deactivate mark; move cursor vertically up ARG lines.
-If there is no character in the target line exactly over the current column,
-the cursor is positioned after the character in that line which spans this
-column, or at the end of the line if it is not long enough.
-
-The command \\[set-goal-column] can be used to create
-a semipermanent goal column to which this command always moves.
-Then it does not try to move vertically."
-  (interactive "p")
-  (pc-select-maybe-deactivate-mark)
-  (with-no-warnings (previous-line arg))
-  (setq this-command 'previous-line))
-
-(defun beginning-of-line-nomark (&optional arg)
-  "Deactivate mark; move point to beginning of current line.
-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")
-  (pc-select-maybe-deactivate-mark)
-  (beginning-of-line arg))
-
-(defun scroll-up-nomark (&optional arg)
-  "Deactivate mark; scroll upward ARG lines; or near full screen if no ARG.
-A near full screen is `next-screen-context-lines' less than a full screen.
-Negative ARG means scroll downward.
-When calling from a program, supply a number as argument or nil.
-Attempting to scroll past the edge of buffer does not raise an
-error, unless `pc-select-override-scroll-error' is nil."
-  (interactive "P")
-  (pc-select-maybe-deactivate-mark)
-  (cond (pc-select-override-scroll-error
-	 (condition-case nil (scroll-up arg)
-	   (end-of-buffer (goto-char (point-max)))))
-	(t (scroll-up arg))))
-
-(defun beginning-of-buffer-nomark (&optional arg)
-  "Deactivate mark; move point to the beginning of the buffer.
-With arg N, put point N/10 of the way from the beginning.
-
-If the buffer is narrowed, this command uses the beginning and size
-of the accessible part of the buffer.
-
-Don't use this command in Lisp programs!
-\(goto-char (point-min)) is faster and avoids clobbering the mark."
-  (interactive "P")
-  (pc-select-maybe-deactivate-mark)
-  (let ((size (- (point-max) (point-min))))
-    (goto-char (if arg
-		   (+ (point-min)
-		      (if (> size 10000)
-			  ;; Avoid overflow for large buffer sizes!
-			  (* (prefix-numeric-value arg)
-			     (/ size 10))
-			(/ (+ 10 (* size (prefix-numeric-value arg))) 10)))
-		 (point-min))))
-  (if arg (forward-line 1)))
-
-
 (defun pc-select-define-keys (alist keymap)
   "Make KEYMAP have the key bindings specified in ALIST."
   (let ((lst alist))
@@ -937,6 +366,7 @@
 
 	    (pc-select-save-and-set-var highlight-nonselected-windows nil)
 	    (pc-select-save-and-set-var transient-mark-mode t)
+	    (pc-select-save-and-set-var shift-select-mode t)
 	    (pc-select-save-and-set-var mark-even-if-inactive t)
 	    (pc-select-save-and-set-mode delete-selection-mode 1))
 	;;else
@@ -974,6 +404,7 @@
 
       (pc-select-restore-var highlight-nonselected-windows)
       (pc-select-restore-var transient-mark-mode)
+      (pc-select-restore-var shift-select-mode)
       (pc-select-restore-var mark-even-if-inactive)
       (pc-select-restore-mode delete-selection-mode)
       (and pc-select-old-M-delete-binding
@@ -981,5 +412,6 @@
 	     pc-select-old-M-delete-binding))
       (setq pc-select-key-bindings-alist nil
 	    pc-select-saved-settings-alist nil))))
+(make-obsolete 'pc-selection-mode 'delete-selection-mode "24.1")
 
 ;;; pc-select.el ends here






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

end of thread, other threads:[~2011-02-08 20:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-30  5:00 bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled PJ Weisberg
2011-02-01 21:11 ` Stefan Monnier
2011-02-05 21:41   ` PJ Weisberg
2011-02-08 20:46 ` Stefan Monnier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.