unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Continuation of comments in f90-mode with auto-fill
@ 2015-01-14 12:39 Nicolas Bock
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Bock @ 2015-01-14 12:39 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

When in f90-mode with auto-fill-mode, emacs continues a comment by
indenting the new line and inserting a single '!' character at the
beginning. How do I change this string, say to "!! "?

Thanks already,

nick


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

* Re: Continuation of comments in f90-mode with auto-fill
@ 2015-01-14 21:38 Bernardo
  2015-01-15  1:15 ` Nicolas Bock
  0 siblings, 1 reply; 6+ messages in thread
From: Bernardo @ 2015-01-14 21:38 UTC (permalink / raw)
  To: help-gnu-emacs


> When in f90-mode with auto-fill-mode, emacs continues a comment by
> indenting the new line and inserting a single '!' character at the
> beginning. How do I change this string, say to "!! "?

completely untested but may give you an idea:

(add-hook 'f90-hook
  (lambda ()
    (setq comment-start "!! ")))



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

* Re: Continuation of comments in f90-mode with auto-fill
  2015-01-14 21:38 Continuation of comments in f90-mode with auto-fill Bernardo
@ 2015-01-15  1:15 ` Nicolas Bock
  2015-01-15 18:43   ` Nicolas Bock
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Bock @ 2015-01-15  1:15 UTC (permalink / raw)
  To: Bernardo; +Cc: help-gnu-emacs

Hi Bernardo,

that's awesome! Thanks! However, it's not quite working, although it's
almost there. I added this to my ~/.emacs file:

(add-hook 'f90-mode-hook
 (lambda ()
   (setq comment-start "!> ")
   (setq comment-continue "!! ")))

Hoping to be able to type something like this with the right indentation:

  !> A subroutine.
  !!
  !! @param a Parameter a.

However, what is happening is the following. I start the first line
and hit enter at the end. The cursor is positioned underneath the
"!>", so all is good. But no "!! " is inserted. Then I type "!!
@param..." and hit enter, and the line is moved all the way to the
left, so not aligned anymore with the comments above it. Could you
suggest some other variable(s) I could change?

Thanks already,

nick

On Wed, Jan 14, 2015 at 2:38 PM, Bernardo <bernardo.bacic@pobox.com> wrote:
>
>> When in f90-mode with auto-fill-mode, emacs continues a comment by
>> indenting the new line and inserting a single '!' character at the
>> beginning. How do I change this string, say to "!! "?
>
> completely untested but may give you an idea:
>
> (add-hook 'f90-hook
>   (lambda ()
>     (setq comment-start "!! ")))
>



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

* Re: Continuation of comments in f90-mode with auto-fill
  2015-01-15  1:15 ` Nicolas Bock
@ 2015-01-15 18:43   ` Nicolas Bock
  2015-01-15 19:34     ` John Mastro
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Bock @ 2015-01-15 18:43 UTC (permalink / raw)
  To: Bernardo; +Cc: help-gnu-emacs

Reading more in the manual I came across the key binding 'M-j'. When I type

!> beginning...

Press M-j, I get

!> beginning...
!

i.e. only a single '!' is inserted and not two as specified by
comment-continue. I read through the implementation in
newcomment.el::comment-indent-new-line() but I don't understand lisp
sufficiently to see where the single '! ' comes from. Could someone
give me a hint?

Thanks already,

nick

On Wed, Jan 14, 2015 at 6:15 PM, Nicolas Bock <nicolasbock@gmail.com> wrote:
> Hi Bernardo,
>
> that's awesome! Thanks! However, it's not quite working, although it's
> almost there. I added this to my ~/.emacs file:
>
> (add-hook 'f90-mode-hook
>  (lambda ()
>    (setq comment-start "!> ")
>    (setq comment-continue "!! ")))
>
> Hoping to be able to type something like this with the right indentation:
>
>   !> A subroutine.
>   !!
>   !! @param a Parameter a.
>
> However, what is happening is the following. I start the first line
> and hit enter at the end. The cursor is positioned underneath the
> "!>", so all is good. But no "!! " is inserted. Then I type "!!
> @param..." and hit enter, and the line is moved all the way to the
> left, so not aligned anymore with the comments above it. Could you
> suggest some other variable(s) I could change?
>
> Thanks already,
>
> nick
>
> On Wed, Jan 14, 2015 at 2:38 PM, Bernardo <bernardo.bacic@pobox.com> wrote:
>>
>>> When in f90-mode with auto-fill-mode, emacs continues a comment by
>>> indenting the new line and inserting a single '!' character at the
>>> beginning. How do I change this string, say to "!! "?
>>
>> completely untested but may give you an idea:
>>
>> (add-hook 'f90-hook
>>   (lambda ()
>>     (setq comment-start "!! ")))
>>



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

* Re: Continuation of comments in f90-mode with auto-fill
  2015-01-15 18:43   ` Nicolas Bock
@ 2015-01-15 19:34     ` John Mastro
  2015-01-15 21:25       ` Nicolas Bock
  0 siblings, 1 reply; 6+ messages in thread
From: John Mastro @ 2015-01-15 19:34 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org; +Cc: Nicolas Bock

Nicolas Bock <nicolasbock@gmail.com> wrote:
> Reading more in the manual I came across the key binding 'M-j'. When I type
>
> !> beginning...
>
> Press M-j, I get
>
> !> beginning...
> !
>
> i.e. only a single '!' is inserted and not two as specified by
> comment-continue. I read through the implementation in
> newcomment.el::comment-indent-new-line() but I don't understand lisp
> sufficiently to see where the single '! ' comes from. Could someone
> give me a hint?

I'm not familiar with Fortran or `f90-mode', so I could be missing
something, but this seems to work for me:

    (add-hook 'f90-mode-hook
              (lambda ()
                (setq-local adaptive-fill-mode nil)
                (setq-local fill-prefix "!! ")))

-- 
john



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

* Re: Continuation of comments in f90-mode with auto-fill
  2015-01-15 19:34     ` John Mastro
@ 2015-01-15 21:25       ` Nicolas Bock
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Bock @ 2015-01-15 21:25 UTC (permalink / raw)
  To: John Mastro; +Cc: help-gnu-emacs@gnu.org

On Thu, Jan 15, 2015 at 12:34 PM, John Mastro <john.b.mastro@gmail.com> wrote:
> Nicolas Bock <nicolasbock@gmail.com> wrote:
>> Reading more in the manual I came across the key binding 'M-j'. When I type
>>
>> !> beginning...
>>
>> Press M-j, I get
>>
>> !> beginning...
>> !
>>
>> i.e. only a single '!' is inserted and not two as specified by
>> comment-continue. I read through the implementation in
>> newcomment.el::comment-indent-new-line() but I don't understand lisp
>> sufficiently to see where the single '! ' comes from. Could someone
>> give me a hint?
>
> I'm not familiar with Fortran or `f90-mode', so I could be missing
> something, but this seems to work for me:
>
>     (add-hook 'f90-mode-hook
>               (lambda ()
>                 (setq-local adaptive-fill-mode nil)
>                 (setq-local fill-prefix "!! ")))
>
M-j is inserting "!! " now, but aligns it all the way to the left :(

> --
> john



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

end of thread, other threads:[~2015-01-15 21:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14 21:38 Continuation of comments in f90-mode with auto-fill Bernardo
2015-01-15  1:15 ` Nicolas Bock
2015-01-15 18:43   ` Nicolas Bock
2015-01-15 19:34     ` John Mastro
2015-01-15 21:25       ` Nicolas Bock
  -- strict thread matches above, loose matches on Subject: below --
2015-01-14 12:39 Nicolas Bock

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).