* Strange behaviour of M-h with negative arguments
@ 2014-10-23 5:40 H. Dieter Wilhelm
0 siblings, 0 replies; only message in thread
From: H. Dieter Wilhelm @ 2014-10-23 5:40 UTC (permalink / raw)
To: emacs-devel
Hello (),
please try from Emacs-24.4 to:
M-- M-h M-h M-h.
This is not in line with the other marking commands like M-@...
Would somebody please have a look at the following?
diff -c /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el /usr/local/src/emacs/lisp/textmodes/paragraphs.el
*** /usr/local/src/emacs-24.4/lisp/textmodes/paragraphs.el 2014-03-21 06:34:40.000000000 +0100
--- /usr/local/src/emacs/lisp/textmodes/paragraphs.el 2014-10-22 18:48:01.603492155 +0200
***************
*** 370,400 ****
(forward-paragraph (- arg)))
(defun mark-paragraph (&optional arg allow-extend)
! "Put point at beginning of this paragraph, mark at end.
! The paragraph marked is the one that contains point or follows point.
! With argument ARG, puts mark at end of a following paragraph, so that
! the number of paragraphs marked equals ARG.
! If ARG is negative, point is put at end of this paragraph, mark is put
! at beginning of this or a previous paragraph.
! Interactively (or if ALLOW-EXTEND is non-nil), if this command is
! repeated or (in Transient Mark mode) if the mark is active,
! it marks the next ARG paragraphs after the ones already marked."
! (interactive "p\np")
! (unless arg (setq arg 1))
! (when (zerop arg)
! (error "Cannot mark zero paragraphs"))
! (cond ((and allow-extend
! (or (and (eq last-command this-command) (mark t))
(and transient-mark-mode mark-active)))
(set-mark
(save-excursion
! (goto-char (mark))
(forward-paragraph arg)
(point))))
! (t
(forward-paragraph arg)
(push-mark nil t t)
(backward-paragraph arg))))
--- 370,411 ----
(forward-paragraph (- arg)))
(defun mark-paragraph (&optional arg allow-extend)
! "Put mark at beginning of this paragraph, point at end.
! The paragraph marked is the one that contains point or follows
! point.
! With argument ARG, puts mark at the end of a following paragraph,
! so that the number of paragraphs marked equals ARG.
! If ARG is negative, point is put at the beginning of this
! paragraph, mark is put at the end of this or a previous
! paragraph.
! Interactively, if this command is repeated or (in Transient Mark
! mode) if the mark is active, it marks the next ARG paragraphs
! after the ones already marked. This means when activating the
! mark before using this command, the current paragraph is only
! marked from point."
! (interactive "P\np")
! (cond ((zerop (prefix-numeric-value arg)) ;argument is zero
! (message "Will not mark zero paragraphs.")) ;currently ERROR
! ((and allow-extend ;we already called this function
! (or (and (eq last-command this-command) (mark t) mark-active)
(and transient-mark-mode mark-active)))
+ (if arg
+ (setq arg (prefix-numeric-value arg))
+ (if (< (mark) (point))
+ (setq arg -1)
+ (setq arg 1)))
(set-mark
(save-excursion
! (if mark-active (goto-char (mark)))
(forward-paragraph arg)
(point))))
! (t ;we are in an empty line or a paragraph
! (if arg
! (setq arg (prefix-numeric-value arg))
! (setq arg 1))
(forward-paragraph arg)
(push-mark nil t t)
(backward-paragraph arg))))
Diff finished. Thu Oct 23 07:28:33 2014
Thanks
Dieter
--
Best wishes
H. Dieter Wilhelm
Darmstadt, Germany
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-10-23 5:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 5:40 Strange behaviour of M-h with negative arguments H. Dieter Wilhelm
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.