diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ebuild-mode.el | 14 |
2 files changed, 13 insertions, 6 deletions
@@ -1,3 +1,8 @@ +2022-05-20 Ulrich Müller <ulm@gentoo.org> + + * ebuild-mode.el (ebuild-mode, ebuild-repo-mode-maybe-enable): + Protect against buffer-file-name being nil. Bug 846569. + 2022-05-10 Ulrich Müller <ulm@gentoo.org> * ebuild-mode-keywords.el (ebuild-mode-keywords-eclassdoc-warn): diff --git a/ebuild-mode.el b/ebuild-mode.el index 33c3dab..569c2de 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -348,11 +348,12 @@ Optional argument LIMIT restarts collection after that number of elements." (setq fill-column 72) (setq tab-width 4) (setq indent-tabs-mode t) - (if (let ((case-fold-search t)) - (string-match "\\.eclass\\'" - (file-name-sans-versions buffer-file-name))) - ;; Eclass documentation uses two spaces after sentence ends - (set (make-local-variable 'sentence-end-double-space) t))) + (and buffer-file-name + (let ((case-fold-search t)) + (string-match "\\.eclass\\'" + (file-name-sans-versions buffer-file-name))) + ;; Eclass documentation uses two spaces after sentence ends + (set (make-local-variable 'sentence-end-double-space) t))) (add-hook 'ebuild-mode-hook (lambda () (font-lock-add-keywords @@ -624,7 +625,8 @@ and `all-completions' for details." "Enable `ebuild-repo-mode' when the file is in an ebuild repository." ;; We assume that we are in an ebuild repository we find a file ;; "profiles/repo_name" in any (nth level) parent dir - (and (locate-dominating-file buffer-file-name "profiles/repo_name") + (and buffer-file-name + (locate-dominating-file buffer-file-name "profiles/repo_name") ;; Don't enable the mode for patches (not (string-match "\\.\\(diff\\|patch\\)\\'" buffer-file-name)) (not (derived-mode-p 'diff-mode)) |