all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Richard Stallman <rms@gnu.org>,
	Wolfgang Jenkner <wjenkner@inode.at>,
	emacs-devel@gnu.org
Subject: Bugs #7240, #9133 - fixing them both at the same time.
Date: Fri, 23 Sep 2011 19:26:39 +0000	[thread overview]
Message-ID: <20110923192639.GB2562@acm.acm> (raw)

Good Day, Richard and good evening, Wolfgang.

A quick reminder about these bugs:

#7240:
############################################

  This sentence follows some spaces.
############################################
Put point inside the sentence and type M-a.  Point goes to BOL rather
than to the "T".



#9133:
############################################
Test.

This is a test.  Does it work?
############################################
Put point at the end.  Do M-a  C-x DEL.  This spuriously deletes the
separating line.



The cause of these failures was trying to make one variable, par-beg, do
two different jobs, namely 1) beginning of the paragraph; 2) start of
text in the paragraph.

By separating these out into par-beg and text-beg the bug simply
evaporates.

Please try out the following patch and confirm to me that it's OK.  Then
I will commit it.

Wolfgang:  Thanks very much for taking the trouble to report this bug,
submitting a patch (even if it wasn't quite right), and nagging me to get
it properly fixed.  ;-)



=== modified file 'lisp/textmodes/paragraphs.el'
*** lisp/textmodes/paragraphs.el	2011-09-22 13:34:02 +0000
--- lisp/textmodes/paragraphs.el	2011-09-23 18:38:42 +0000
***************
*** 455,474 ****
    (let ((opoint (point))
          (sentence-end (sentence-end)))
      (while (< arg 0)
!       (let ((pos (point))
! 	    (par-beg
! 	     (save-excursion
! 	       (start-of-paragraph-text)
! 	       ;; Move PAR-BEG back over indentation
! 	       ;; to allow s1entence-end to match if it is anchored at
! 	       ;; BOL and the paragraph starts indented.
! 	       (beginning-of-line)
! 	       (point))))
  	(if (and (re-search-backward sentence-end par-beg t)
  		 (or (< (match-end 0) pos)
  		     (re-search-backward sentence-end par-beg t)))
  	    (goto-char (match-end 0))
! 	  (goto-char par-beg)))
        (setq arg (1+ arg)))
      (while (> arg 0)
        (let ((par-end (save-excursion (end-of-paragraph-text) (point))))
--- 455,481 ----
    (let ((opoint (point))
          (sentence-end (sentence-end)))
      (while (< arg 0)
!       (let* ((pos (point))
! 	     (text-beg
! 	      (progn (start-of-paragraph-text)
! 		     (point)))
! 	     ;; PAR-BEG allows sentence-end to match if it is
! 	     ;; anchored at BOL and the paragraph starts indented.
! 	     ;; This can happen thus, when "  (iii)" is an EOS anchored
! 	     ;; at BOL:
! 	     ;;   (iii) Beginning of next sentence.
! 	     (par-beg
! 	      (progn
! 		(backward-paragraph)
! 		(if (looking-at paragraph-separate)
! 		    (forward-line))
! 		(point))))
! 	(goto-char pos)
  	(if (and (re-search-backward sentence-end par-beg t)
  		 (or (< (match-end 0) pos)
  		     (re-search-backward sentence-end par-beg t)))
  	    (goto-char (match-end 0))
! 	  (goto-char text-beg)))
        (setq arg (1+ arg)))
      (while (> arg 0)
        (let ((par-end (save-excursion (end-of-paragraph-text) (point))))



-- 
Alan Mackenzie (Nuremberg, Germany).



             reply	other threads:[~2011-09-23 19:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 19:26 Alan Mackenzie [this message]
2011-09-23 23:45 ` Bugs #7240, #9133 - fixing them both at the same time Wolfgang Jenkner
2011-09-24 12:28 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110923192639.GB2562@acm.acm \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    --cc=wjenkner@inode.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.