Skip to content

Commit

Permalink
Ask for a file name on save if buffer provides none
Browse files Browse the repository at this point in the history
When visiting a PDF file downloaded by `eww`, `buffer-file-name` returns
nil so the file can't be saved. In such a case, we should ask the user
for a file name instead of failing the operation.

Closes: vedang#178
  • Loading branch information
akater authored and vedang committed Jan 16, 2023
1 parent 8ddf4c7 commit f427952
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lisp/pdf-view.el
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,10 @@ operating on a local copy of a remote file."
;; in the process), it may be immediately reopened due to
;; redisplay happening inside the pdf-info-close function
;; (while waiting for a response from the process.).
(copy-file tempfile (buffer-file-name) t)
(copy-file tempfile (or (buffer-file-name)
(read-file-name
"File name to save PDF to: "))
t)
(pdf-info-close pdf-view--server-file-name)

(when pdf-view--buffer-file-name
Expand Down

0 comments on commit f427952

Please sign in to comment.