|
From: | Jean Louis |
Subject: | Re: Using comment characters for specific major modes |
Date: | Sun, 6 Jun 2021 03:43:58 +0300 |
User-agent: | Mutt/2.0.7+183 (3d24855) (2021-05-28) |
* martin-kemp@brusseler.com <martin-kemp@brusseler.com> [2021-06-06 03:40]: > For emacs-lisp-mode I would like "s" to be > > (setq-local s (concat ";; " (make-string lena ?\;))) (defun my-whatever () (interactive) (let ((s (cond ((eq major-mode 'adoc-mode) (do something)) ((eq major-mode 'markdown-mode) (do something)) (t s)))) (insert s))) You may use `cond' function to test the variable `major-mode' and accordingly return the value for `s' which you then insert in the buffer. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns Sign an open letter in support of Richard M. Stallman https://stallmansupport.org/
[Prev in Thread] | Current Thread | [Next in Thread] |