[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Using comment characters for specific major modes
From: |
martin-kemp |
Subject: |
Using comment characters for specific major modes |
Date: |
Sun, 6 Jun 2021 00:05:36 +0200 (CEST) |
I only want to change the first two, the rest remains the same
Suppose lena is 8
emacs-lisp-mode
;; ;;;;;;;;
f90-mode
!! ;;;;;;;;
fortran-mode
cc ;;;;;;;;
texinfo-mode
@c ;;;;;;;;
From: Jean Louis <bugs@gnu.support>
To: martin-kemp@brusseler.com
Subject: Re: Using comment characters for specific major modes
Date: 05/06/2021 23:50:25 Europe/Paris
Cc: help-gnu-emacs@gnu.org
* martin-kemp@brusseler.com <martin-kemp@brusseler.com> [2021-06-05 23:52]:
> Am using the following expression to make a line composed of ";" of length
> lena.
>
> The first two semicolons ";;" are for when I use elisp code.
>
> (setq-local s (concat ";; " (make-string lena ?\;)))
>
> But I want to change the starting ";;" to be the comment character
> of the major mode I am working with.
>
> For texinfo I want "@c", and for fortran-mode I want "c", and "!!"
> for f90-mode.
Those things I would always use as a function. Possibility is
great that I misunderstand you due to short description of what
you want.
(defun my-fancy-thing ()
(interactive)
(let* ((initial (completing-read "Comment: " '("1 ;;" "2 !!") nil t))
(comment (substring initial 2))
(lena 10)
(string (make-string lena (string-to-char (substring initial 2)))))
(insert (concat comment " " string))))
;; ;;;;;;;;;;
!! !!!!!!!!!!
--
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/
- Using comment characters for specific major modes, martin-kemp, 2021/06/05
- Re: Using comment characters for specific major modes, Jean Louis, 2021/06/05
- Using comment characters for specific major modes,
martin-kemp <=
- Re: Using comment characters for specific major modes, Jean Louis, 2021/06/05
- Using comment characters for specific major modes, martin-kemp, 2021/06/05
- Re: Using comment characters for specific major modes, Jean Louis, 2021/06/05
- Using comment characters for specific major modes, martin-kemp, 2021/06/05
- Re: Using comment characters for specific major modes, Jean Louis, 2021/06/05
- Using comment characters for specific major modes, martin-kemp, 2021/06/05
- Re: Using comment characters for specific major modes, Jean Louis, 2021/06/05
- Using comment characters for specific major modes, martin-kemp, 2021/06/05
- Re: Using comment characters for specific major modes, Jean Louis, 2021/06/05
- Using comment characters for specific major modes, martin-kemp, 2021/06/05