unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Bob Rogers <rogers-emacs@rgrjr.dyndns.org>
To: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Multiple bugs in lisp-mode M-q on paragraphs within #|..|#	comments
Date: Sat, 24 Mar 2007 20:23:48 -0400	[thread overview]
Message-ID: <17925.49428.760951.346087@rgrjr.dyndns.org> (raw)
In-Reply-To: <4605A120.6030400@gmx.at>

[-- Attachment #1: message body text --]
[-- Type: text/plain, Size: 1242 bytes --]

   From: martin rudalics <rudalics@gmx.at>
   Date: Sat, 24 Mar 2007 23:07:28 +0100

   I suppose `comment-end' is "" in you buffer.

That seems to be the case, at least initially.

   Then the problem is with the following stretch of code in
   `fill-paragraph':

	  (and fill-paragraph-handle-comment
	      ;; Our code only handles \n-terminated comments right now.
	      comment-start (equal comment-end "")
	      (let ((fill-paragraph-handle-comment nil))
		(fill-comment-paragraph arg)))

   We have to find something more intelligent here.

Is this really the place?  If I add a call to error just before the
fill-comment-paragraph call, none of the four bugs cause it to be
called.

   It might be better to recognize Lisp "#|...|#" comments explicitly at
a point where we know we're dealing with Lisp.  The attached patch is a
total hack, but it seems to relieve the symptoms of the first three bugs
(and changes that of the fourth).  This style of comment can be nested,
so the hack will get confused if still inside a comment but after an
inner comment.  The changed symptoms of the fourth bug suggest that the
bounds passed to the fill-region-as-paragraph call are wrong.  But I'll
bet someone else can do better.

					-- Bob


[-- Attachment #2: lisp-comment-fill-1.patch --]
[-- Type: text/plain, Size: 1619 bytes --]

Index: lisp/emacs-lisp/lisp-mode.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/lisp-mode.el,v
retrieving revision 1.200
diff -c -r1.200 lisp-mode.el
*** lisp/emacs-lisp/lisp-mode.el	5 Mar 2007 03:20:58 -0000	1.200
--- lisp/emacs-lisp/lisp-mode.el	25 Mar 2007 00:13:20 -0000
***************
*** 1246,1252 ****
  paragraph of it that point is in, preserving the comment's indentation
  and initial semicolons."
    (interactive "P")
!   (or (fill-comment-paragraph justify)
        ;; Since fill-comment-paragraph returned nil, that means we're not in
        ;; a comment: Point is on a program line; we are interested
        ;; particularly in docstring lines.
--- 1246,1266 ----
  paragraph of it that point is in, preserving the comment's indentation
  and initial semicolons."
    (interactive "P")
!   (or (if (save-excursion
! 	    (and (re-search-backward "#|\\||#" nil t)
! 		 (equal (match-string 0) "#|")))
! 	  ;; We are in a "#|...|#" comment.  [Assuming we haven't been
! 	  ;; fooled by quoted strings or ;-comments.]
! 	  (let ((start (save-excursion
! 			 (forward-paragraph -1)
! 			 (point)))
! 		(end (save-excursion
! 		       (forward-paragraph 1)
! 		       (point))))
! 	    (message "trying it")
! 	    (fill-region-as-paragraph start end justify))
! 	  ;; Try "normal" comment paragraph fill.
! 	  (fill-comment-paragraph justify))
        ;; Since fill-comment-paragraph returned nil, that means we're not in
        ;; a comment: Point is on a program line; we are interested
        ;; particularly in docstring lines.

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2007-03-25  0:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-24 19:32 Multiple bugs in lisp-mode M-q on paragraphs within #|..|# comments Bob Rogers
2007-03-24 19:40 ` Bob Rogers
2007-03-24 19:51   ` Lennart Borgman (gmail)
2007-03-24 20:04 ` Chong Yidong
2007-03-24 20:59   ` Bob Rogers
2007-03-24 22:07     ` martin rudalics
2007-03-25  0:23       ` Bob Rogers [this message]
2007-03-25 10:18         ` martin rudalics
2007-03-25 14:13           ` Bob Rogers
2007-03-25 19:53 ` Stefan Monnier
2007-03-25 23:05   ` Bob Rogers
2007-03-28  2:57 ` Stefan Monnier
2007-03-31  0:42   ` Bob Rogers
2007-03-31 20:30     ` Stefan Monnier
2007-04-01 22:45       ` Bob Rogers

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=17925.49428.760951.346087@rgrjr.dyndns.org \
    --to=rogers-emacs@rgrjr.dyndns.org \
    --cc=emacs-devel@gnu.org \
    --cc=rudalics@gmx.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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).