all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* c-mask-paragraph
@ 2007-11-28 13:02 martin rudalics
  0 siblings, 0 replies; only message in thread
From: martin rudalics @ 2007-11-28 13:02 UTC (permalink / raw)
  To: emacs-devel; +Cc: bug-cc-mode, Alan Mackenzie

Good afternoon, Alan

In a recent attempt to violate the virginity of a comment I was told

Debugger entered--Lisp error: (error "Invalid search bound (wrong side of point)")
   search-forward-regexp("\\=[ 	]*\\(//+\\|\\**\\)" 19384 t)
   c-mask-paragraph(nil t do-auto-fill)
   c-do-auto-fill()
   self-insert-command(1)
   newline(nil)
   #[nil "..." [soft allow-auto-fill delete-horizontal-space insert-and-inherit 10 newline 1] 2]()
   c-indent-new-comment-line(nil t)
   c-context-line-break()
   (let ((go-back ...)) (when (and ... ...) (delete-overlay show-paren-overlay-1)) (c-context-line-break) (when go-back (forward-line -1) (indent-according-to-mode)))
   c-newline-and-indent-maybe()
   call-interactively(c-newline-and-indent-maybe)

Lack of vigour won't permit me to reproduce this soon, hence there's no
need telling me to "don't do that".

Now I surely appreciate Emacs' efforts to protect the innocence of that
poor thing.  However, I'd prefer C mode to not leave it to the debugger
to tell me the truth about my evil doing.  Rather, I propose to rewrite
the corresponding conjunct in `c-mask-paragraph' as

		    (and (> (- (cdr c-lit-limits) 2) (point))
			 (re-search-forward
			  (concat "\\=[ \t]*\\(" c-current-comment-prefix "\\)")
			  (- (cdr c-lit-limits) 2) t)
			 (not (re-search-forward
			       "\\(\\s \\|\\sw\\)"
			       (- (cdr c-lit-limits) 2) 'limit))
			     ;; The comment ender IS on its own line.  Exclude
			     ;; this line from the filling.
			 (set-marker end (c-point 'bol))))

but maybe the test should _not_ fail in that case and it would be more
appropriate to use (max (- (cdr c-lit-limits) 2) (point)) as second
argument.

I'll leave it to you to work out the gory details.  Thanks in advance.

martin




-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-28 13:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-28 13:02 c-mask-paragraph martin rudalics

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.