Minor refactors & comment revision

This commit is contained in:
Henrik Lissner 2020-11-29 14:37:32 -05:00
parent 0285dd5e0e
commit b49c40bbb3
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
5 changed files with 20 additions and 18 deletions

View file

@ -18,8 +18,8 @@
;; Ensure Doom runs out of this file's parent directory, where Doom is
;; presumably installed. Use the EMACSDIR envvar to change this.
(setq user-emacs-directory
(if (getenv "EMACSDIR")
(file-name-as-directory (expand-file-name (getenv "EMACSDIR")))
(if (getenv-internal "EMACSDIR")
(file-name-as-directory (expand-file-name (getenv-internal "EMACSDIR")))
(expand-file-name
"../" (file-name-directory (file-truename load-file-name)))))

View file

@ -37,9 +37,8 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
,filevar)))))
(defun doom--path (&rest segments)
(let ((dir (pop segments)))
(unless segments
(setq dir (expand-file-name dir)))
(let ((segments (delq nil segments))
dir)
(while segments
(setq dir (expand-file-name (car segments) dir)
segments (cdr segments)))
@ -48,7 +47,8 @@ This is used by `file-exists-p!' and `project-file-exists-p!'."
;;;###autoload
(defun doom-glob (&rest segments)
"Construct a path from SEGMENTS and expand glob patterns.
Returns nil if the path doesn't exist."
Returns nil if the path doesn't exist.
Ignores `nil' elements in SEGMENTS."
(let* (case-fold-search
(dir (apply #'doom--path segments)))
(if (string-match-p "[[*?]" dir)
@ -58,7 +58,8 @@ Returns nil if the path doesn't exist."
;;;###autoload
(defun doom-path (&rest segments)
"Constructs a file path from SEGMENTS."
"Constructs a file path from SEGMENTS.
Ignores `nil' elements in SEGMENTS."
(if segments
(apply #'doom--path segments)
(file!)))
@ -66,7 +67,8 @@ Returns nil if the path doesn't exist."
;;;###autoload
(defun doom-dir (&rest segments)
"Constructs a path from SEGMENTS.
See `doom-path'."
See `doom-path'.
Ignores `nil' elements in SEGMENTS."
(when-let (path (apply #'doom-path segments))
(directory-file-name (file-name-directory path))))
@ -137,7 +139,8 @@ MATCH is a string regexp. Only entries that match it will be included."
"Returns the evaluated result of FORM in a ;;;###COOKIE FORM at the top of
FILE.
If COOKIE doesn't exist, return NULL-VALUE."
If COOKIE doesn't exist, or cookie isn't within the first 256 bytes of FILE,
return NULL-VALUE."
(unless (file-exists-p file)
(signal 'file-missing file))
(unless (file-readable-p file)

View file

@ -285,7 +285,7 @@ config.el instead."
(when (boundp 'comp-eln-load-path)
(add-to-list 'comp-eln-load-path (concat doom-cache-dir "eln/")))
(after! comp
(with-eval-after-load 'comp
;; HACK Disable native-compilation for some troublesome packages
(dolist (entry (list (concat "\\`" (regexp-quote doom-local-dir) ".*/evil-collection-vterm\\.el\\'")
;; https://github.com/nnicandro/emacs-jupyter/issues/297

View file

@ -44,7 +44,7 @@
#'yas-expand
(and (featurep! :completion company +tng)
(+company-has-completion-p))
#'+company/complete)
#'company-complete-common)
:v [tab] (cmds! (and (bound-and-true-p yas-minor-mode)
(or (eq evil-visual-selection 'line)
(not (memq (char-after) (list ?\( ?\[ ?\{ ?\} ?\] ?\))))))

View file

@ -1,20 +1,19 @@
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
(when IS-WINDOWS
(setenv "GIT_ASKPASS" "git-gui--askpass"))
;; Don't complain when these variables are set in file/local vars
(put 'git-commit-major-mode 'safe-local-variable 'symbolp)
(put 'git-commit-summary-max-length 'safe-local-variable 'symbolp)
;; In case the user is using `bug-reference-mode'
(map! :when (fboundp 'bug-reference-mode)
:map bug-reference-map
"RET" (cmds! (and (bound-and-true-p evil-mode)
(evil-normal-state-p))
#'bug-reference-push-button))
(when IS-WINDOWS
(setenv "GIT_ASKPASS" "git-gui--askpass"))
(after! log-view
(set-evil-initial-state!
'(log-view-mode
@ -52,7 +51,7 @@
"Show revision details in the header-line, instead of the minibuffer.
Sometimes I forget `git-timemachine' is enabled in a buffer. Putting revision
info in the `header-line-format' is a good indication."
info in the `header-line-format' is a more visible indicator."
:override #'git-timemachine--show-minibuffer-details
(let* ((date-relative (nth 3 revision))
(date-full (nth 4 revision))
@ -65,7 +64,7 @@ info in the `header-line-format' is a good indication."
date-full date-relative))))
(after! evil
;; rehash evil keybindings so they are recognized
;; Rehash evil keybindings so they are recognized
(add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps))
(when (featurep! :tools magit)