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

[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:53:46 +0200 (CEST)

I would not like to use the mini-buffer, but introduce the comment character 

according the the major mode being used on the buffer.



Is there a command that gets the current comment for the major mode used in the

working buffer ?



Would use the comment character twice  ";;"',  "cc", "!!", except for texinfo 
which

will use just "@c" as it is already composed of two characters.



From: Jean Louis <bugs@gnu.support>
To: martin-kemp@brusseler.com
Subject: Re: Using comment characters for specific major modes
Date: 06/06/2021 00:40:14 Europe/Paris
Cc: help-gnu-emacs@gnu.org

* martin-kemp@brusseler.com <martin-kemp@brusseler.com> [2021-06-06 01:06]:
> I only want to change the first two, the rest remains the same
> 
> Suppose lena is 8


OK and how do you propose to change the function?

Instead:

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

then:

(defun my-fancy-thing ()
(interactive)
(let* ((initial (completing-read "Comment: " '("1 ;;" "2 !!") nil t))
(comment (substring initial 2))
(lena 10)
(string (make-string lena 59)))
(insert (concat comment " " string))))

;; ;;;;;;;;;;

Adopt the function to your needs.



-- 
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/




reply via email to

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