all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#24660: 24.5; nxml-mode should support shift selection
@ 2016-10-10 16:41 Yuri Khan
  2016-10-10 16:57 ` Clément Pit--Claudel
  2016-10-18  6:46 ` Eli Zaretskii
  0 siblings, 2 replies; 3+ messages in thread
From: Yuri Khan @ 2016-10-10 16:41 UTC (permalink / raw)
  To: 24660

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Many movement commands, such as forward-word, forward-sexp,
forward-sentence, next-line, and their backward counterparts, support
shift selection. That is, holding down Shift along with their bindings
causes region to be activated and/or extended.

$ emacs -Q

C-x C-f /tmp/test.xml

    <html>|<head></head><body></body></html>

C-M-S-<right> ;; C-M-<right> (translated) runs forward-sexp

    <html>[<head>]</head><body></body></html>

C-M-S-<right> ;; C-M-<right> (translated) runs forward-sexp

    <html>[<head></head>]<body></body></html>


However, nxml-mode’s commands do not behave this way.

    <html>|<head></head><body></body></html>

C-M-S-n ;; C-M-n (translated) runs nxml-forward-element

Expected:

    <html>[<head></head>]<body></body></html>

Observed:

    <html><head></head>|<body></body></html>


The attached patch fixes this for me. It is based on current master (fd45b3f).

[-- Attachment #2: 0001-lisp-nxml-nxml-mode-Support-Shift-selection.patch --]
[-- Type: text/x-diff, Size: 3251 bytes --]

From 35175026f4809af9e711ba9a47a6214932473aaf Mon Sep 17 00:00:00 2001
From: Yuri Khan <yurivkhan@gmail.com>
Date: Mon, 10 Oct 2016 23:14:42 +0700
Subject: [PATCH] lisp/nxml/nxml-mode: Support Shift selection

---
 lisp/nxml/nxml-mode.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index cceb75e..0b9975f 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -1521,7 +1521,7 @@ references and character references.  A processing instruction
 consists of a target and a content string.  A comment or a CDATA
 section contains a single string.  An entity reference contains a
 single name.  A character reference contains a character number."
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (cond ((> arg 0)
 	 (while (progn
@@ -1733,7 +1733,7 @@ single name.  A character reference contains a character number."
     ret))
 
 (defun nxml-up-element (&optional arg)
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (if (< arg 0)
       (nxml-backward-up-element (- arg))
@@ -1761,7 +1761,7 @@ single name.  A character reference contains a character number."
        (apply #'error (cddr err))))))
 
 (defun nxml-backward-up-element (&optional arg)
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (if (< arg 0)
       (nxml-up-element (- arg))
@@ -1793,7 +1793,7 @@ single name.  A character reference contains a character number."
   "Move forward down into the content of an element.
 With ARG, do this that many times.
 Negative ARG means move backward but still down."
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (if (< arg 0)
       (nxml-backward-down-element (- arg))
@@ -1811,7 +1811,7 @@ Negative ARG means move backward but still down."
       (setq arg (1- arg)))))
 
 (defun nxml-backward-down-element (&optional arg)
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (if (< arg 0)
       (nxml-down-element (- arg))
@@ -1839,7 +1839,7 @@ Negative ARG means move backward but still down."
   "Move forward over one element.
 With ARG, do it that many times.
 Negative ARG means move backward."
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (if (< arg 0)
       (nxml-backward-element (- arg))
@@ -1858,7 +1858,7 @@ Negative ARG means move backward."
   "Move backward over one element.
 With ARG, do it that many times.
 Negative ARG means move forward."
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (if (< arg 0)
       (nxml-forward-element (- arg))
@@ -1893,7 +1893,7 @@ The paragraph marked is the one that contains point or follows point."
   (nxml-backward-paragraph))
 
 (defun nxml-forward-paragraph (&optional arg)
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (cond ((< arg 0)
 	 (nxml-backward-paragraph (- arg)))
@@ -1903,7 +1903,7 @@ The paragraph marked is the one that contains point or follows point."
 		     (> (setq arg (1- arg)) 0))))))
 
 (defun nxml-backward-paragraph (&optional arg)
-  (interactive "p")
+  (interactive "^p")
   (or arg (setq arg 1))
   (cond ((< arg 0)
 	 (nxml-forward-paragraph (- arg)))
-- 
2.10.1


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

end of thread, other threads:[~2016-10-18  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-10 16:41 bug#24660: 24.5; nxml-mode should support shift selection Yuri Khan
2016-10-10 16:57 ` Clément Pit--Claudel
2016-10-18  6:46 ` Eli Zaretskii

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.