aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2022-10-28 02:26:44 +0200
committerStefan Kangas2022-10-28 22:23:08 +0200
commitdee3d93e73b2bb9b6805084fb784a536960c42e6 (patch)
treedef08123e1c70e4686796639b46d7e05ac20d220
parent943f95e03c4b9d790267c71b1b9addf55b1c4802 (diff)
downloademacs-dee3d93e73b2bb9b6805084fb784a536960c42e6.tar.gz
emacs-dee3d93e73b2bb9b6805084fb784a536960c42e6.zip
Ensure temp file is deleted in makefile overview
* lisp/progmodes/make-mode.el (makefile-create-up-to-date-overview): Ensure temp file is always deleted.
-rw-r--r--lisp/progmodes/make-mode.el65
1 files changed, 32 insertions, 33 deletions
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index 5f265212992..92d8a739a5f 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -1504,39 +1504,38 @@ dependency in the makefile."
1504 ;; writing the current contents of the makefile buffer. 1504 ;; writing the current contents of the makefile buffer.
1505 ;; 1505 ;;
1506 (let ((saved-target-table makefile-target-table) 1506 (let ((saved-target-table makefile-target-table)
1507 (this-buffer (current-buffer)) 1507 (this-buffer (current-buffer))
1508 (makefile-up-to-date-buffer 1508 (makefile-up-to-date-buffer
1509 (get-buffer-create makefile-up-to-date-buffer-name)) 1509 (get-buffer-create makefile-up-to-date-buffer-name))
1510 (filename (makefile-save-temporary)) 1510 (filename (makefile-save-temporary))
1511 ;; 1511 ;;
1512 ;; Forget the target table because it may contain picked-up filenames 1512 ;; Forget the target table because it may contain picked-up filenames
1513 ;; that are not really targets in the current makefile. 1513 ;; that are not really targets in the current makefile.
1514 ;; We don't want to query these, so get a new target-table with just the 1514 ;; We don't want to query these, so get a new target-table with just the
1515 ;; targets that can be found in the makefile buffer. 1515 ;; targets that can be found in the makefile buffer.
1516 ;; The 'old' target table will be restored later. 1516 ;; The 'old' target table will be restored later.
1517 ;; 1517 ;;
1518 (real-targets (progn 1518 (real-targets (progn
1519 (makefile-pickup-targets) 1519 (makefile-pickup-targets)
1520 makefile-target-table)) 1520 makefile-target-table))
1521 (prereqs makefile-has-prereqs) 1521 (prereqs makefile-has-prereqs))
1522 ) 1522 (unwind-protect
1523 1523 (progn
1524 (set-buffer makefile-up-to-date-buffer) 1524 (set-buffer makefile-up-to-date-buffer)
1525 (setq buffer-read-only nil) 1525 (setq buffer-read-only nil)
1526 (erase-buffer) 1526 (erase-buffer)
1527 (makefile-query-targets filename real-targets prereqs) 1527 (makefile-query-targets filename real-targets prereqs)
1528 (if (zerop (buffer-size)) ; if it did not get us anything 1528 (when (zerop (buffer-size)) ; if it did not get us anything
1529 (progn 1529 (kill-buffer (current-buffer))
1530 (kill-buffer (current-buffer)) 1530 (message "No overview created!"))
1531 (message "No overview created!"))) 1531 (set-buffer this-buffer)
1532 (set-buffer this-buffer) 1532 (setq makefile-target-table saved-target-table)
1533 (setq makefile-target-table saved-target-table) 1533 (when (get-buffer makefile-up-to-date-buffer-name)
1534 (if (get-buffer makefile-up-to-date-buffer-name) 1534 (pop-to-buffer (get-buffer makefile-up-to-date-buffer-name))
1535 (progn 1535 (shrink-window-if-larger-than-buffer)
1536 (pop-to-buffer (get-buffer makefile-up-to-date-buffer-name)) 1536 (sort-lines nil (point-min) (point-max))
1537 (shrink-window-if-larger-than-buffer) 1537 (setq buffer-read-only t)))
1538 (sort-lines nil (point-min) (point-max)) 1538 (ignore-errors (delete-file filename))))))
1539 (setq buffer-read-only t))))))
1540 1539
1541(defun makefile-save-temporary () 1540(defun makefile-save-temporary ()
1542 "Create a temporary file from the current makefile buffer." 1541 "Create a temporary file from the current makefile buffer."