all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Filling Block Comment
@ 2006-03-17  4:43 August Karlstrom
  2006-03-17 19:16 ` Andreas Röhler
  2006-03-21 16:53 ` Stefan Monnier
  0 siblings, 2 replies; 7+ messages in thread
From: August Karlstrom @ 2006-03-17  4:43 UTC (permalink / raw)


Hi everyone,

With

(require 'newcomment)
(setq comment-start "/*")
(setq comment-end "*/")
(set (make-local-variable 'fill-paragraph-function) 		
'fill-comment-paragraph)

the block comment

/* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz */

is filled as (something like)

/* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz
/* xyz xyz xyz */

instead of

/* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz
xyz xyz xyz */

How do I make `fill-comment-paragraph' work with block comments?


August

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling Block Comment
  2006-03-17  4:43 Filling Block Comment August Karlstrom
@ 2006-03-17 19:16 ` Andreas Röhler
  2006-03-18 23:42   ` August Karlstrom
  2006-03-21 16:53 ` Stefan Monnier
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2006-03-17 19:16 UTC (permalink / raw)


August Karlstrom wrote:

> Hi everyone,
> 
> With
> 
> (require 'newcomment)

> (setq comment-start "/*")
> (setq comment-end "*/")
Probably you don't need this explicit settings.

toggle c-mode

with active region and transient-mark-mode

call comment-dwim. It's at M-;


> How do I make `fill-comment-paragraph' work with block
> comments?
> 
> 
> August
There is a var `comment-style' via customize, change that appropriatly.

I'm just writing a func, which will allow you to switch between // and /* */.
Send a mail, if you need that.

Andreas Roehler
andreas.roehler@online.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling Block Comment
  2006-03-17 19:16 ` Andreas Röhler
@ 2006-03-18 23:42   ` August Karlstrom
  2006-03-19 20:06     ` Andreas Röhler
  0 siblings, 1 reply; 7+ messages in thread
From: August Karlstrom @ 2006-03-18 23:42 UTC (permalink / raw)


Andreas Röhler wrote:
> August Karlstrom wrote:
>>With
>>
>>(require 'newcomment)
> 
>>(setq comment-start "/*")
>>(setq comment-end "*/")
> 
> Probably you don't need this explicit settings.
> 
> toggle c-mode

Well, the thing is I'm writing my own major mode for a C-like language.

> with active region and transient-mark-mode
> 
> call comment-dwim. It's at M-;

Yes, I know. The function `comment-dwim' (and `dabbrev-expand') is one 
of the most useful Emacs commands.

>>How do I make `fill-comment-paragraph' work with block
>>comments?
> 
> There is a var `comment-style' via customize, change that appropriatly.

I tried setting `comment-style' to `multi-line'

    (set (make-local-variable 'comment-style) 'multi-line)

but that doesn't solve the problem, block-comments are still filled as

    /* blah blah blah
    /* blah blah blah */

rather than

    /* blah blah blah
    blah blah blah */

> I'm just writing a func, which will allow you to switch between // and /* */.
> Send a mail, if you need that.

Thanks, but that is not what I'm looking for.


August

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling Block Comment
  2006-03-18 23:42   ` August Karlstrom
@ 2006-03-19 20:06     ` Andreas Röhler
  2006-03-28 23:37       ` August Karlstrom
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2006-03-19 20:06 UTC (permalink / raw)


August Karlstrom wrote:

> I tried setting `comment-style' to `multi-line'
> 
>     (set (make-local-variable 'comment-style) 'multi-line)
> 
> but that doesn't solve the problem, block-comments are still
> filled as
> 
>     /* blah blah blah
>     /* blah blah blah */
> 
> rather than
> 
>     /* blah blah blah
>     blah blah blah */

That's strange. If you think its worthwile: Please send
a copy of newcomment.el you use, the emacs-version
and your C-Mode-Code.

I will check it here.

Andreas Roehler
andreas.roehler@online.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling Block Comment
  2006-03-17  4:43 Filling Block Comment August Karlstrom
  2006-03-17 19:16 ` Andreas Röhler
@ 2006-03-21 16:53 ` Stefan Monnier
  2006-03-28 17:52   ` August Karlstrom
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2006-03-21 16:53 UTC (permalink / raw)


> (require 'newcomment)
> (setq comment-start "/*")
> (setq comment-end "*/")
> (set (make-local-variable 'fill-paragraph-function) 		
> 'fill-comment-paragraph)

> the block comment

> /* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz */

> is filled as (something like)

> /* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz
> /* xyz xyz xyz */

> instead of

> /* xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz xyz
> xyz xyz xyz */

Indeed, the filling code doesn't know much about comments and often gets
it wrong.

> How do I make `fill-comment-paragraph' work with block comments?

You don't?
Instead, write your own function that will try to find the beginning/end of
the enclosing comment and then calls fill-region-as-paragraph.

I had started to work on extending fill.el so that it used syntax-tables to
correctly respect comment and string boundaries when filling, but never got
far enough to get something really usable.


        Stefan

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling Block Comment
  2006-03-21 16:53 ` Stefan Monnier
@ 2006-03-28 17:52   ` August Karlstrom
  0 siblings, 0 replies; 7+ messages in thread
From: August Karlstrom @ 2006-03-28 17:52 UTC (permalink / raw)


Stefan Monnier wrote:
 > August Karlstrom wrote:
>>How do I make `fill-comment-paragraph' work with block comments?
> 
> 
> You don't?
> Instead, write your own function that will try to find the beginning/end of
> the enclosing comment and then calls fill-region-as-paragraph.
> 
> I had started to work on extending fill.el so that it used syntax-tables to
> correctly respect comment and string boundaries when filling, but never got
> far enough to get something really usable.

Sounds like an excellent idea though.


August

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Filling Block Comment
  2006-03-19 20:06     ` Andreas Röhler
@ 2006-03-28 23:37       ` August Karlstrom
  0 siblings, 0 replies; 7+ messages in thread
From: August Karlstrom @ 2006-03-28 23:37 UTC (permalink / raw)


Andreas Röhler wrote:
[snip]
> If you think its worthwile: Please send
> a copy of newcomment.el you use, the emacs-version
> and your C-Mode-Code.
> 
> I will check it here.

Thanks for your offer, but I have now implemented the comment filling 
myself.


Regards,

August

-- 
I am the "ILOVEGNU" signature virus. Just copy me to your
signature.  This email was infected under the terms of the GNU
General Public License.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-03-28 23:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-17  4:43 Filling Block Comment August Karlstrom
2006-03-17 19:16 ` Andreas Röhler
2006-03-18 23:42   ` August Karlstrom
2006-03-19 20:06     ` Andreas Röhler
2006-03-28 23:37       ` August Karlstrom
2006-03-21 16:53 ` Stefan Monnier
2006-03-28 17:52   ` August Karlstrom

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.