>From b0bd0e796333f80a21c5d73d2cde97d7cf18b095 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Sun, 28 Nov 2021 00:48:35 +0100 Subject: [PATCH 3/3] * ada-mode.el (ada-find-file): Support future Emacs versions --- ada-mode.el | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/ada-mode.el b/ada-mode.el index fa2c4a4f7a..980fcb081e 100644 --- a/ada-mode.el +++ b/ada-mode.el @@ -1465,23 +1465,20 @@ Prompts with completion, defaults to filename at point." ;; In emacs 27, we can just set project-read-file-name-function to ;; tell 'project-find-file to use the uniquify-files alist ;; completion table. In emacs 26, we must do that ourselves. - (cl-ecase emacs-major-version - (27 - (let ((project-read-file-name-function #'uniq-file-read)) - (project-find-file))) - - (26 - (let* ((def (thing-at-point 'filename)) - (project (project-current)) - (all-files (project-files project nil)) - (alist (uniq-file-uniquify all-files)) - (table (apply-partially #'uniq-file-completion-table alist)) - (file (project--completing-read-strict - "Find file" table nil nil def))) - (if (string= file "") - (user-error "You didn't specify the file") - (find-file (cdr (assoc file alist)))))) - )) + (require 'project) + (if (boundp 'project-read-file-name-function) + (let ((project-read-file-name-function #'uniq-file-read)) + (project-find-file)) + (let* ((def (thing-at-point 'filename)) + (project (project-current)) + (all-files (project-files project nil)) + (alist (uniq-file-uniquify all-files)) + (table (apply-partially #'uniq-file-completion-table alist)) + (file (project--completing-read-strict + "Find file" table nil nil def))) + (if (string= file "") + (user-error "You didn't specify the file") + (find-file (cdr (assoc file alist))))))) ;;;; compatibility with previous ada-mode versions -- 2.34.0