From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Newsgroups: gmane.emacs.help Subject: how to deal with comment in a new lang mode Date: Thu, 30 Oct 2008 13:59:50 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1225402844 10507 80.91.229.12 (30 Oct 2008 21:40:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Oct 2008 21:40:44 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 30 22:41:47 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KvfH0-00072j-KW for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Oct 2008 22:41:46 +0100 Original-Received: from localhost ([127.0.0.1]:41831 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KvfFu-000515-Bh for geh-help-gnu-emacs@m.gmane.org; Thu, 30 Oct 2008 17:40:38 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!r36g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs Original-Lines: 53 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1225400390 31248 127.0.0.1 (30 Oct 2008 20:59:50 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Thu, 30 Oct 2008 20:59:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r36g2000prf.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.2 Safari/525.22, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:163926 comp.emacs:97294 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59271 Archived-At: when writing a new language mode, how can one make comment-dwim work? i can of course code my own functions dealing with comments, but i think it is better to use the facilities provided in newcomment.el? right now i have: (defun xlsl-comment-dwim (arg) (interactive "*P") (let ((comment-start-orig comment-start) (comment-end-orig comment-end)) (setq comment-start "// ") (setq comment-end "") (comment-dwim arg) (setq comment-start comment-start-orig) (setq comment-end comment-end-orig) )) and (define-key xlsl-mode-map [remap comment-dwim] 'xlsl-comment-dwim) this works fine when typing the shortcut for comment-dwim on a empty line to insert comment. But doesnt work as expected when the line is already a comment. (it does nothing) any advice apprecated for dealing with comments in a new lang mode. Thanks. PS if it matters, i also have my syntax table defined: (defvar xlsl-mode-syntax-table (let ((synTable (make-syntax-table))) (modify-syntax-entry ?\/ ". 12b" synTable) (modify-syntax-entry ?\n "> b" synTable) (modify-syntax-entry ?< "()" synTable) (modify-syntax-entry ?> ")(" synTable) synTable ) "Syntax table for `xlsl-mode'." ) The lsl has =E2=80=9C// ...=E2=80=9D as comment but not =E2=80=9C/* ... */= =E2=80=9D. I dont want it to be derived mode of c-mode though atm ... Xah =E2=88=91 http://xahlee.org/ =E2=98=84