dev: merge branch 'master'
This commit is contained in:
commit
cf4462683f
5 changed files with 64 additions and 32 deletions
|
@ -55,27 +55,23 @@ and Emacs states, and for non-evil users.")
|
|||
(setq w32-lwindow-modifier 'super
|
||||
w32-rwindow-modifier 'super)))
|
||||
|
||||
;; HACK: Emacs cannot distinguish between C-i from TAB. This is largely a
|
||||
;; byproduct of its history in the terminal, which can't distinguish them
|
||||
;; either, however, when GUIs came about Emacs created separate input events
|
||||
;; for more contentious keys like TAB and RET. Therefore [return] != RET,
|
||||
;; [tab] != TAB, and [backspace] != DEL.
|
||||
;;
|
||||
;; In the same vein, this keybind adds a [C-i] event, so users can bind to it
|
||||
;; independently of TAB. Otherwise, it falls back to keys bound to C-i.
|
||||
(define-key key-translation-map [?\C-i]
|
||||
(cmd! (if (let ((keys (this-single-command-raw-keys)))
|
||||
(and keys
|
||||
(not (cl-position 'tab keys))
|
||||
(not (cl-position 'kp-tab keys))
|
||||
(display-graphic-p)
|
||||
;; Fall back if no <C-i> keybind can be found, otherwise
|
||||
;; we've broken all pre-existing C-i keybinds.
|
||||
(let ((key
|
||||
(doom-lookup-key
|
||||
(vconcat (cl-subseq keys 0 -1) [C-i]))))
|
||||
(not (or (numberp key) (null key))))))
|
||||
[C-i] [?\C-i])))
|
||||
;; HACK: Emacs can't distinguish C-i from TAB in either GUI or TTY frames. This
|
||||
;; is a byproduct of its history with the terminal, which can't distinguish
|
||||
;; them either, however, Emacs has separate input events for many contentious
|
||||
;; keys like TAB and RET (like [tab] and [return], aka "<tab>" and
|
||||
;; "<return>"), which are only triggered in GUI frames, so here, I create one
|
||||
;; for C-i. Won't work in TTY frames, though. Doom's :os tty module has a
|
||||
;; workaround for that though.
|
||||
(define-key input-decode-map
|
||||
[?\C-i] (cmd! (if (when-let ((keys (this-single-command-raw-keys)))
|
||||
(and (display-graphic-p)
|
||||
(not (cl-position 'tab keys))
|
||||
(not (cl-position 'kp-tab keys))
|
||||
;; Fall back if no <C-i> keybind can be found,
|
||||
;; otherwise we've broken all pre-existing C-i
|
||||
;; keybinds.
|
||||
(key-binding (vconcat (cl-subseq keys 0 -1) [C-i]) nil t)))
|
||||
[C-i] [?\C-i])))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -79,16 +79,21 @@ file will be created within it so that it will always be treated as one. This
|
|||
command will throw an error if a parent of DIR is a valid project (which would
|
||||
mask DIR)."
|
||||
(interactive "D")
|
||||
(when-let ((proj-dir (doom-project-root dir)))
|
||||
(if (file-equal-p proj-dir dir)
|
||||
(user-error "ERROR: Directory is already a project: %s" proj-dir)
|
||||
(user-error "ERROR: Directory is already inside another project: %s" proj-dir)))
|
||||
(let ((short-dir (abbreviate-file-name dir)))
|
||||
(unless (file-equal-p (doom-project-root dir) dir)
|
||||
(with-temp-file (doom-path dir ".project")))
|
||||
(let ((proj-dir (doom-project-root dir)))
|
||||
(unless (file-equal-p proj-dir dir)
|
||||
(user-error "Can't add %S as a project, because %S is already a project"
|
||||
short-dir (abbreviate-file-name proj-dir)))
|
||||
(message "%S was not a project; adding .project file to it"
|
||||
short-dir (abbreviate-file-name proj-dir))
|
||||
(projectile-add-known-project dir))))
|
||||
(when (projectile-ignored-project-p dir)
|
||||
(user-error "ERROR: Directory is in projectile's ignore list: %s" short-dir))
|
||||
(dolist (proj projectile-known-projects)
|
||||
(when (file-in-directory-p proj dir)
|
||||
(user-error "ERROR: Directory contains a known project: %s" short-dir))
|
||||
(when (file-equal-p proj dir)
|
||||
(user-error "ERROR: Directory is already a known project: %s" short-dir)))
|
||||
(with-temp-file (doom-path dir ".project"))
|
||||
(message "Added directory as a project: %s" short-dir)
|
||||
(projectile-add-known-project dir)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue