help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using comment characters for specific major modes


From: Stefan Möding
Subject: Re: Using comment characters for specific major modes
Date: Sun, 06 Jun 2021 18:02:20 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)

martin-kemp@brusseler.com writes:

> What I need is to set "cm" to ";;" for 'emacs-lisp-mode, "@c" for
> texinfo-mode etc.

The value returned by the cond form is the value of the selected cond
clause.  You can use the literals without calling any additional code:

(let ((cm (cond ((eq major-mode 'emacs-lisp-mode) ";;")
                ((eq major-mode 'texinfo-mode)    "@c")
                ...

Remember that `cm' will be nil if nothing was matched.

-- 
Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]