Skip to content
This repository has been archived by the owner on Jul 13, 2020. It is now read-only.

Commit

Permalink
Don't call function unnecessarily inside loop across all buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
purcell committed Sep 19, 2019
1 parent 61caa79 commit 7c60cf3
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions elisp/intero.el
Original file line number Diff line number Diff line change
Expand Up @@ -1702,14 +1702,15 @@ The path returned is canonicalized and stripped of any text properties."

(defun intero-temp-file-origin-buffer (temp-file)
"Get the original buffer that TEMP-FILE was created for."
(or
(gethash (intero-canonicalize-path temp-file)
intero-temp-file-buffer-mapping)
(cl-loop
for buffer in (buffer-list)
when (string= (intero-canonicalize-path temp-file)
(buffer-local-value 'intero-temp-file-name buffer))
return buffer)))
(let ((canonical-path (intero-canonicalize-path temp-file)))
(or
(gethash canonical-path
intero-temp-file-buffer-mapping)
(cl-loop
for buffer in (buffer-list)
when (string= canonical-path
(buffer-local-value 'intero-temp-file-name buffer))
return buffer))))

(defun intero-unmangle-file-path (file)
"If FILE is an intero temp file, return the original source path, otherwise FILE."
Expand Down

0 comments on commit 7c60cf3

Please sign in to comment.