unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* /* */ comments in asm-mode.el
@ 2003-01-22  5:10 Masatake YAMATO
  2003-01-27 17:45 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Masatake YAMATO @ 2003-01-22  5:10 UTC (permalink / raw)


gas supprots /* comment */ style comment. However, asm-mode supports only
; comment
style comment. Therefore the buffer coloring done by font-lock is not 
beautiful. Here I've added /* comment */ style comment support.

Regards,
Masatake YAMATO

2003-01-22  Masatake YAMATO  <jet@gyve.org>

	* progmodes/asm-mode.el (asm-mode): Added syntax table 
	entries for /* */ comments.

Index: asm-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/asm-mode.el,v
retrieving revision 1.21
diff -u -r1.21 asm-mode.el
--- asm-mode.el	29 Sep 2000 03:31:36 -0000	1.21
+++ asm-mode.el	22 Jan 2003 06:09:00 -0000
@@ -128,9 +128,13 @@
   (local-set-key (vector asm-comment-char) 'asm-comment)
 
   (modify-syntax-entry	asm-comment-char
-			"<" asm-mode-syntax-table)
+			"< b" asm-mode-syntax-table)
   (modify-syntax-entry	?\n
-			 ">" asm-mode-syntax-table)
+			 "> b" asm-mode-syntax-table)
+
+  (modify-syntax-entry ?/  ". 14" asm-mode-syntax-table)
+  (modify-syntax-entry ?*  ". 23"   asm-mode-syntax-table)
+  
   (let ((cs (regexp-quote (char-to-string asm-comment-char))))
     (make-local-variable 'comment-start)
     (setq comment-start (concat (char-to-string asm-comment-char) " "))

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

* Re: /* */ comments in asm-mode.el
  2003-01-22  5:10 /* */ comments in asm-mode.el Masatake YAMATO
@ 2003-01-27 17:45 ` Stefan Monnier
  2003-01-31  2:45   ` Masatake YAMATO
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2003-01-27 17:45 UTC (permalink / raw)
  Cc: emacs-devel

> gas supprots /* comment */ style comment. However, asm-mode supports only
> ; comment
> style comment. Therefore the buffer coloring done by font-lock is not 
> beautiful. Here I've added /* comment */ style comment support.

You'll also want to update comment-start, comment-start-skip,
comment-end (and maybe comment-end-skip) accordingly.


	Stefan

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

* Re: /* */ comments in asm-mode.el
  2003-01-27 17:45 ` Stefan Monnier
@ 2003-01-31  2:45   ` Masatake YAMATO
  2003-01-31 13:24     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Masatake YAMATO @ 2003-01-31  2:45 UTC (permalink / raw)
  Cc: emacs-devel

> > gas supprots /* comment */ style comment. However, asm-mode supports only
> > ; comment
> > style comment. Therefore the buffer coloring done by font-lock is not 
> > beautiful. Here I've added /* comment */ style comment support.
> 
> You'll also want to update comment-start, comment-start-skip,
> comment-end (and maybe comment-end-skip) accordingly.

I've tried. However, I don't know this is correct code or not.
How could I check the values of comment-start-skip and its friends 
are correct or not?

What I did is just copying code from cc-mode.el that supports
both comment style `/* */' and `// '.

Masatake YAMATO

Index: lisp/progmodes/asm-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/asm-mode.el,v
retrieving revision 1.22
diff -u -r1.22 asm-mode.el
--- lisp/progmodes/asm-mode.el	23 Jan 2003 09:11:46 -0000	1.22
+++ lisp/progmodes/asm-mode.el	31 Jan 2003 04:03:59 -0000
@@ -139,7 +154,8 @@
     (make-local-variable 'comment-start)
     (setq comment-start (concat (char-to-string asm-comment-char) " "))
     (make-local-variable 'comment-start-skip)
-    (setq comment-start-skip (concat cs "+[ \t]*"))
+    (setq comment-start-skip (concat cs "+[ \t]*" "\\|" "/\\*+ *"))
+    (setq comment-multi-line t)
     (setq asm-inline-empty-comment-pattern (concat "^.+" cs "+ *$"))
     (setq asm-code-level-empty-comment-pattern (concat "^[\t ]+" cs cs " *$"))
     (setq asm-flush-left-empty-comment-pattern (concat "^" cs cs cs " *$"))

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

* Re: /* */ comments in asm-mode.el
  2003-01-31  2:45   ` Masatake YAMATO
@ 2003-01-31 13:24     ` Stefan Monnier
  2003-03-30  9:38       ` Masatake YAMATO
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2003-01-31 13:24 UTC (permalink / raw)
  Cc: monnier+gnu/emacs

> > > gas supprots /* comment */ style comment. However, asm-mode supports only
> > > ; comment
> > > style comment. Therefore the buffer coloring done by font-lock is not 
> > > beautiful. Here I've added /* comment */ style comment support.
> > 
> > You'll also want to update comment-start, comment-start-skip,
> > comment-end (and maybe comment-end-skip) accordingly.
> 
> I've tried. However, I don't know this is correct code or not.
> How could I check the values of comment-start-skip and its friends
> are correct or not?

By reading their docstring: it describes what it should do.

Try uncomment-region or comment-kill or auto-fill-mode or ...
with various kinds of comments.

> -    (setq comment-start-skip (concat cs "+[ \t]*"))
> +    (setq comment-start-skip (concat cs "+[ \t]*" "\\|" "/\\*+ *"))

That looks OK.  You'll probably need to set comment-end-skip as well:

(set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\\*+/\\)")

> +    (setq comment-multi-line t)

This is one is not necessary.


	Stefan

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

* Re: /* */ comments in asm-mode.el
  2003-01-31 13:24     ` Stefan Monnier
@ 2003-03-30  9:38       ` Masatake YAMATO
  0 siblings, 0 replies; 5+ messages in thread
From: Masatake YAMATO @ 2003-03-30  9:38 UTC (permalink / raw)
  Cc: emacs-devel

Two month ago I posted a patch for asm-mode.el.
The patch is reviewed by Stefan Monnier and I got comments.
But I could not find time to reflect it to my patch.
Now I find time.

Masatake YAMATO

2003-03-30  Masatake YAMATO  <jet@gyve.org>

	* progmodes/asm-mode.el (asm-mode): supports
	skpping	c lang style comments.

Index: progmodes/asm-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/asm-mode.el,v
retrieving revision 1.23
diff -u -r1.23 asm-mode.el
--- progmodes/asm-mode.el	2 Feb 2003 17:34:19 -0000	1.23
+++ progmodes/asm-mode.el	30 Mar 2003 10:01:25 -0000
@@ -140,7 +140,9 @@
     (make-local-variable 'comment-start)
     (setq comment-start (concat (char-to-string asm-comment-char) " "))
     (make-local-variable 'comment-start-skip)
-    (setq comment-start-skip (concat cs "+[ \t]*"))
+    (setq comment-start-skip (concat cs "+[ \t]*" "\\|" "/\\*+ *"))
+    (make-local-variable 'comment-end-skip)
+    (setq comment-end-skip  "[ \t]*\\(\\s>\\|\\*+/\\)")
     (setq asm-inline-empty-comment-pattern (concat "^.+" cs "+ *$"))
     (setq asm-code-level-empty-comment-pattern (concat "^[\t ]+" cs cs " *$"))
     (setq asm-flush-left-empty-comment-pattern (concat "^" cs cs cs " *$"))
\f
> > > gas supprots /* comment */ style comment. However, asm-mode supports only
> > > ; comment
> > > style comment. Therefore the buffer coloring done by font-lock is not 
> > > beautiful. Here I've added /* comment */ style comment support.
> > 
> > You'll also want to update comment-start, comment-start-skip,
> > comment-end (and maybe comment-end-skip) accordingly.
> 
> I've tried. However, I don't know this is correct code or not.
> How could I check the values of comment-start-skip and its friends
> are correct or not?

By reading their docstring: it describes what it should do.

Try uncomment-region or comment-kill or auto-fill-mode or ...
with various kinds of comments.

> -    (setq comment-start-skip (concat cs "+[ \t]*"))
> +    (setq comment-start-skip (concat cs "+[ \t]*" "\\|" "/\\*+ *"))

That looks OK.  You'll probably need to set comment-end-skip as well:

(set (make-local-variable 'comment-end-skip) "[ \t]*\\(\\s>\\|\\*+/\\)")

> +    (setq comment-multi-line t)

This is one is not necessary.


	Stefan



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

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

end of thread, other threads:[~2003-03-30  9:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-22  5:10 /* */ comments in asm-mode.el Masatake YAMATO
2003-01-27 17:45 ` Stefan Monnier
2003-01-31  2:45   ` Masatake YAMATO
2003-01-31 13:24     ` Stefan Monnier
2003-03-30  9:38       ` Masatake YAMATO

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