* %-Comments in Emacs Octave-Mode
[not found] <20031024134043.78714d06.christoph.dalitz@hs-niederrhein.de>
@ 2003-10-24 17:54 ` John W. Eaton
2003-10-27 20:53 ` Christoph Dalitz
0 siblings, 1 reply; 3+ messages in thread
From: John W. Eaton @ 2003-10-24 17:54 UTC (permalink / raw)
Cc: bug-gnu-emacs, Octave Mailing List
On 24-Oct-2003, Christoph Dalitz <christoph.dalitz@hs-niederrhein.de> wrote:
| just observed that the Emacs octave-mode does not recognize lines
| beginning wiht % as comment lines.
|
| Does someone know how to teach emacs this additional comment sign?
| I guess I have to add some special octave-mode-hook, but what
| should this hook contain?
Please try the following patch. The problem that the deleted comment
refers to has apparently been fixed, so indenting and font locking
both appear to work properly now for things like
sprintf ("%s" "some string")
even when % is considered a comment character.
Thanks,
jwe
ChangeLog:
2003-10-24 John W. Eaton <jwe@bevo.che.wisc.edu>
* emacs/octave-mod.el (octave-mode-syntax-table): Allow % to be a
comment character.
Index: emacs/octave-mod.el
===================================================================
RCS file: /usr/local/cvsroot/octave/emacs/octave-mod.el,v
retrieving revision 1.26
diff -u -r1.26 octave-mod.el
--- emacs/octave-mod.el 30 Jul 2003 19:15:31 -0000 1.26
+++ emacs/octave-mod.el 24 Oct 2003 17:47:09 -0000
@@ -292,15 +292,6 @@
["Lookup Octave Index" octave-help t])
"Menu for Octave mode.")
-;; XXX FIXME XXX -- the syntax mode for `%' is punctuation instead of
-;; begin-comment because if it is begin-comment, then typing M-;
-;; (octave-indent-for-comment) on lines like
-;;
-;; sprintf ("%d", foobar);
-;;
-;; causes them to be improperly indented (the `%' is moved over to the
-;; comment-column).
-
(defvar octave-mode-syntax-table nil
"Syntax table in use in octave-mode buffers.")
(if octave-mode-syntax-table
@@ -323,7 +314,7 @@
(modify-syntax-entry ?\" "\"" table)
(modify-syntax-entry ?. "w" table)
(modify-syntax-entry ?_ "w" table)
- (modify-syntax-entry ?\% "." table) ; see above
+ (modify-syntax-entry ?\% "<" table)
(modify-syntax-entry ?\# "<" table)
(modify-syntax-entry ?\n ">" table)
(setq octave-mode-syntax-table table)))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: %-Comments in Emacs Octave-Mode
2003-10-24 17:54 ` %-Comments in Emacs Octave-Mode John W. Eaton
@ 2003-10-27 20:53 ` Christoph Dalitz
2003-10-27 21:12 ` John W. Eaton
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Dalitz @ 2003-10-27 20:53 UTC (permalink / raw)
Cc: help-octave, bug-gnu-emacs
On Fri, 24 Oct 2003 12:54:07 -0500
"John W. Eaton" <jwe@bevo.che.wisc.edu> wrote:
>
> | just observed that the Emacs octave-mode does not recognize lines
> | beginning wiht % as comment lines.
>
> Please try the following patch.
>
> - (modify-syntax-entry ?\% "." table) ; see above
> + (modify-syntax-entry ?\% "<" table)
>
Thanks for the hint. I could achieve the same with the entry
(add-hook 'octave-mode-hook '(lambda () (modify-syntax-entry ?\% "<")))
in my ~/.emacs file. There is one quibble yet: '%'-comments are indented
to end of the line rather than left were they are put. Is there a way
to make '%' comments behave like '##' comments?
> The problem that the deleted comment
> refers to has apparently been fixed, so indenting and font locking
> both appear to work properly now for things like
>
> sprintf ("%s" "some string")
>
This works correctly, but
sprintf ('%s', 'some string')
not. I am using emacs 20.7 which ships with the latest Debian.
Thanks,
Christoph
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: %-Comments in Emacs Octave-Mode
2003-10-27 20:53 ` Christoph Dalitz
@ 2003-10-27 21:12 ` John W. Eaton
0 siblings, 0 replies; 3+ messages in thread
From: John W. Eaton @ 2003-10-27 21:12 UTC (permalink / raw)
Cc: John W. Eaton, help-octave, bug-gnu-emacs
On 27-Oct-2003, Christoph Dalitz <christoph.dalitz@hs-niederrhein.de> wrote:
| Thanks for the hint. I could achieve the same with the entry
|
| (add-hook 'octave-mode-hook '(lambda () (modify-syntax-entry ?\% "<")))
|
| in my ~/.emacs file. There is one quibble yet: '%'-comments are indented
| to end of the line rather than left were they are put. Is there a way
| to make '%' comments behave like '##' comments?
Use %% comments, or modify the code so that it does what you want?
| > The problem that the deleted comment
| > refers to has apparently been fixed, so indenting and font locking
| > both appear to work properly now for things like
| >
| > sprintf ("%s" "some string")
| >
| This works correctly, but
|
| sprintf ('%s', 'some string')
|
| not. I am using emacs 20.7 which ships with the latest Debian.
What is your definition of latest? I think you can get 21.x with the
testing distribution.
the real problem here is that it is much more complicated to decide
whether ' should be a transpose operator or a string delimiter.
I don't really care whether octave-mode supports these features (I'm
happy with " for strings and # for comments) but I would be happy to
accept changes that would make this work better.
jwe
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-10-27 21:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20031024134043.78714d06.christoph.dalitz@hs-niederrhein.de>
2003-10-24 17:54 ` %-Comments in Emacs Octave-Mode John W. Eaton
2003-10-27 20:53 ` Christoph Dalitz
2003-10-27 21:12 ` John W. Eaton
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.