emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cperl-mode: Eliminating references to obsolete packages


From: Stefan Monnier
Subject: Re: cperl-mode: Eliminating references to obsolete packages
Date: Wed, 23 Sep 2020 15:50:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> I guess Ilya has retired?

I assume he stopped using Emacs, but I have no idea, really.

> Should I try to contact him?

I don't see any need for it, but feel free to try.

> I want to keep it compatible with at least Emacs 26, since this is the

Sounds good.

> feedback so far.  As of now, I have found two commits which violate
> that, one of which I consider fairly irrelevant (timing font-locking:
> This was an issue 20 years ago, when computers where a bit slower).

It's usually pretty easy to tweak changes so they don't break
backward compatibility.

> I am unsure about the procedure: Should the backwards-compatible
> version live in a separate branch on Emacs?

I think we don't need a separate branch.  E.g. for format-prompt we can
use a patch like the one below.  If you can't think of a simple way to
preserve backward compatibility in a specific situation, feel free to
ask for help,


        Stefan


diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 468ffc949a..57bee5c4d7 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -6324,6 +6324,12 @@ cperl-word-at-point
                       (get major-mode 'find-tag-default-function)
                       'find-tag-default))))))
 
+(defalias 'cperl--format-prompt
+  (if (fboundp 'format-prompt) #'format-prompt ;New in Emacs≥28
+    (lambda (msg default)
+      (if default (format "%s (default %s): " msg default)
+        (concat msg ": ")))))
+
 (defun cperl-info-on-command (command)
   "Show documentation for Perl command COMMAND in other window.
 If perl-info buffer is shown in some frame, uses this frame.
@@ -6332,7 +6338,7 @@ cperl-info-on-command
   (interactive
    (let* ((default (cperl-word-at-point))
          (read (read-string
-                (format-prompt "Find doc for Perl function" default))))
+                (cperl--format-prompt "Find doc for Perl function" default))))
      (list (if (equal read "")
               default
             read))))
@@ -8291,7 +8297,7 @@ cperl-perldoc
   (interactive
    (list (let* ((default-entry (cperl-word-at-point))
                 (input (read-string
-                        (format-prompt "perldoc entry" default-entry))))
+                        (cperl--format-prompt "perldoc entry" default-entry))))
            (if (string= input "")
                (if (string= default-entry "")
                    (error "No perldoc args given")




reply via email to

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