[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Smarter M-x that filters on major-mode
From: |
Lars Ingebrigtsen |
Subject: |
Re: Smarter M-x that filters on major-mode |
Date: |
Sun, 14 Feb 2021 16:20:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Now go fortheth and marketh uppeth.
This little command may be helpful.
(global-set-key [(hyper l)] 'int-fix-command)
(defvar int-prev-mode nil)
(defun int-fix-command ()
(interactive)
(let ((mode nil)
(regexp "(define-derived-mode \\([^ \t\n]+\\)\\|(defun \\([^
\t\n]+-mode\\) ")
change)
(if (not (re-search-forward "^ *\\((interactive\\)" nil t))
(message "No more interactive in this file")
(recenter nil t)
(save-match-data
(save-excursion
(when (or (re-search-backward regexp nil t)
(re-search-forward regexp nil t))
(setq mode (or (match-string 1) (match-string 2)))))
(setq change (read-string "Change to: " (or mode int-prev-mode))))
(when (plusp (length change))
(setq mode change)
(goto-char (match-beginning 1))
(let ((form (read (current-buffer))))
(goto-char (match-beginning 1))
(forward-char 1)
(if (> (length form) 1)
(progn
(forward-sexp 2)
(insert " " mode))
(forward-sexp 1)
(insert " nil " mode)))
(setq int-prev-mode mode)))))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
- RE: [External] : Re: Smarter M-x that filters on major-mode, (continued)
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/15
- Re: Smarter M-x that filters on major-mode, Eric S Fraga, 2021/02/15
- Re: Smarter M-x that filters on major-mode, Óscar Fuentes, 2021/02/14
- Re: Smarter M-x that filters on major-mode, Eli Zaretskii, 2021/02/14
- Re: Smarter M-x that filters on major-mode, Juri Linkov, 2021/02/14
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/14
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/14
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/14
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/14
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/14
- Re: Smarter M-x that filters on major-mode,
Lars Ingebrigtsen <=
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/13
- RE: [External] : Re: Smarter M-x that filters on major-mode, Drew Adams, 2021/02/12
- Re: [External] : Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/13
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Lars Ingebrigtsen, 2021/02/11
- Re: Smarter M-x that filters on major-mode, Stefan Monnier, 2021/02/11