Skip to content

Commit d94248c

Browse files
committed
Fix Ruby formatting unsaved temp buffers
format-all--ruby-gem-bundled-p incorrectly assumed that (buffer-file-name) cannot be nil.
1 parent aa238d8 commit d94248c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

format-all.el

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,8 @@ need to be shell-quoted."
526526
Returns t if GEM-NAME is listed in the current project's
527527
Gemfile.lock, nil otherwise."
528528
(let* ((lockfile "Gemfile.lock")
529-
(dir (locate-dominating-file (buffer-file-name) lockfile)))
529+
(file (buffer-file-name))
530+
(dir (and file (locate-dominating-file file lockfile))))
530531
(and dir
531532
(with-temp-buffer
532533
(insert-file-contents (expand-file-name lockfile dir))

0 commit comments

Comments
 (0)