[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing buffer mode
From: |
carlmarcos |
Subject: |
Re: Changing buffer mode |
Date: |
Fri, 22 Jul 2022 06:00:05 +0200 (CEST) |
Jul 22, 2022, 00:21 by incal@dataswamp.org:
> carlmarcos--- via Users list for the GNU Emacs text editor wrote:
>
>>>>>> With the following function I can change the mode of
>>>>>> a buffer. I would like to change it to use
>>>>>> `completing-read` using a list composed of a selection
>>>>>> of mode names. How can I go about doing that?
>>>>>>
>>>>>
>>>>> Use it?
>>>>>
>>>>> (completing-read "drop: " '(little boy fat man))
>>>>>
>>>>
>>>> Yes, but then how can I update the buffer with the
>>>> new mode?
>>>>
>>>
>>> The same way you always do it?
>>>
>>
>> I do not know the usual way.
>>
>
> (emacs-lisp-mode) from Lisp and M-x emacs-lisp-mode RET
> interactively ...
>
Have come up with the following instead
(defun mode-sweep (mode)
"Cycle the buffer through three major modes (text, org, normal)."
(interactive
(list
(let ( (cseq '("org-mode" "text-mode" "normal-mode")) )
(completing-read "Mode: " cseq nil t "normal"))))
(apply (list (intern mode))) )
- Changing buffer mode, carlmarcos, 2022/07/19
- Re: Changing buffer mode, Emanuel Berg, 2022/07/20
- Re: Changing buffer mode, carlmarcos, 2022/07/21
- Re: Changing buffer mode, Emanuel Berg, 2022/07/21
- Re: Changing buffer mode, carlmarcos, 2022/07/21
- Re: Changing buffer mode,
carlmarcos <=
- Re: Changing buffer mode, Emanuel Berg, 2022/07/22
- Re: Changing buffer mode, carlmarcos, 2022/07/22
- Re: Changing buffer mode, Emanuel Berg, 2022/07/22
- Re: Changing buffer mode, carlmarcos, 2022/07/22
Re: Changing buffer mode, Jean Louis, 2022/07/21