emacs-devel
[Top][All Lists]
Advanced

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

Strange behaviour of M-h with negative arguments


From: H. Dieter Wilhelm
Subject: Strange behaviour of M-h with negative arguments
Date: Thu, 23 Oct 2014 07:40:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

The following message is a courtesy copy of an article
that has been posted to gmane.emacs.devel as well.

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 address@hidden

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



reply via email to

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