From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7940: 23.2; Home and End keys don't work as expected with both pc-selection-mode and visual-line-mode enabled Date: Tue, 08 Feb 2011 15:46:08 -0500 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297200306 31354 80.91.229.12 (8 Feb 2011 21:25:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 8 Feb 2011 21:25:06 +0000 (UTC) Cc: 7940-done@debbugs.gnu.org To: PJ Weisberg Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 08 22:25:00 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pmv3Q-0000Hq-M0 for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Feb 2011 22:24:57 +0100 Original-Received: from localhost ([127.0.0.1]:35641 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmv3P-0005iC-Pv for geb-bug-gnu-emacs@m.gmane.org; Tue, 08 Feb 2011 16:24:55 -0500 Original-Received: from [140.186.70.92] (port=43549 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pmv13-0003ST-AR for bug-gnu-emacs@gnu.org; Tue, 08 Feb 2011 16:24:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PmulD-0001ED-Do for bug-gnu-emacs@gnu.org; Tue, 08 Feb 2011 16:06:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:50337) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PmulD-0001E9-Ad for bug-gnu-emacs@gnu.org; Tue, 08 Feb 2011 16:06:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PmuK2-0000Cf-Iv for bug-gnu-emacs@gnu.org; Tue, 08 Feb 2011 15:38:02 -0500 Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Feb 2011 20:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 7940 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 7940@debbugs.gnu.org, monnier@IRO.UMontreal.CA Original-Received: via spool by 7940-done@debbugs.gnu.org id=D7940.1297197452742 (code D ref 7940); Tue, 08 Feb 2011 20:38:02 +0000 Original-Received: (at 7940-done) by debbugs.gnu.org; 8 Feb 2011 20:37:32 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PmuJW-0000Bu-PO for submit@debbugs.gnu.org; Tue, 08 Feb 2011 15:37:32 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PmuJU-0000Bh-AG for 7940-done@debbugs.gnu.org; Tue, 08 Feb 2011 15:37:29 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id p18KkjDF019768; Tue, 8 Feb 2011 15:46:45 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 316AAB4106; Tue, 8 Feb 2011 15:46:08 -0500 (EST) In-Reply-To: (PJ Weisberg's message of "Sat, 29 Jan 2011 21:00:09 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV3735=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Tue, 08 Feb 2011 15:38:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:44006 Archived-At: > 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 and/or 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 ;; 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