Avoid deprecated ELisp features

Activate `lexical-binding` in a few more files.
Use `advice-add` rather than `defadvice`.
Fix some compilation warnings.
Prefer #' to quote function names.
Adjust `Package-Requires:` accordingly.
This commit is contained in:
Stefan Monnier
2025-03-06 17:10:53 -05:00
parent 2cd802b1f7
commit ddd677091a
10 changed files with 93 additions and 83 deletions

View File

@@ -1,4 +1,6 @@
(require 'cl) ;; For lexical-let
;; -*- lexical-binding: t; -*-
(require 'multiple-cursors-core)
(When "^I mark next like this$"
(lambda () (call-interactively 'mc/mark-next-like-this)))
@@ -109,26 +111,22 @@
(When "^I copy \"\\(.+\\)\" in another program$"
(lambda (text)
(lexical-let ((text text))
(setq interprogram-paste-function
#'(lambda () (let ((r text)) (setq text nil) r))))))
(setq interprogram-paste-function
#'(lambda () (let ((r text)) (setq text nil) r)))))
(Given "^I have bound C-! to a lambda that inserts \"\\(.+\\)\"$"
(lambda (ins)
(lexical-let ((ins ins))
(global-set-key (kbd "C-!") #'(lambda () (interactive) (insert ins))))))
(global-set-key (kbd "C-!") #'(lambda () (interactive) (insert ins)))))
(Given "^I have bound C-! to a new command that inserts \"\\(.+\\)\"$"
(lambda (ins)
(lexical-let ((ins ins))
(defun mc-test-temp-command () (interactive) (insert ins))
(global-set-key (kbd "C-!") 'mc-test-temp-command))))
(defun mc-test-temp-command () (interactive) (insert ins))
(global-set-key (kbd "C-!") 'mc-test-temp-command)))
(Given "^I have bound C-! to another new command that inserts \"\\(.+\\)\"$"
(lambda (ins)
(lexical-let ((ins ins))
(defun mc-test-temp-command-2 () (interactive) (insert ins))
(global-set-key (kbd "C-!") 'mc-test-temp-command-2))))
(defun mc-test-temp-command-2 () (interactive) (insert ins))
(global-set-key (kbd "C-!") 'mc-test-temp-command-2)))
(Given "^I have bound C-! to a new command that inserts two read-chars$"
(lambda ()
@@ -171,7 +169,7 @@
(When "^I mark all \\(.+\\)$"
(lambda (rest)
(let ((func (intern (mapconcat 'identity
(let ((func (intern (mapconcat #'identity
(cons "mc/mark-all"
(split-string rest))
"-"))))