Projects
This commit is contained in:
parent
2c8b03dfc6
commit
26c7418e33
3 changed files with 67 additions and 6 deletions
9
init.el
9
init.el
|
@ -63,6 +63,11 @@
|
|||
(load (concat user-emacs-directory "shared-packages.el"))
|
||||
;; UI and display related packages
|
||||
(load (concat user-emacs-directory "ui.el"))
|
||||
|
||||
;; Use a custom file instead of putting customisations in init.el
|
||||
(setq custom-file (concat user-emacs-directory "custom.el"))
|
||||
(when (file-exists-p custom-file) (load custom-file))
|
||||
|
||||
;; Writing behavior and packages
|
||||
(load (concat user-emacs-directory "writing.el"))
|
||||
;; Navigation behavior and packages
|
||||
|
@ -75,7 +80,3 @@
|
|||
(load-directory (concat user-emacs-directory "workflows"))
|
||||
;; Custom screens
|
||||
(load-directory (concat user-emacs-directory "screens"))
|
||||
|
||||
;; Use a custom file instead of putting customisations in init.el
|
||||
(setq custom-file (concat user-emacs-directory "custom.el"))
|
||||
(when (file-exists-p custom-file) (load custom-file))
|
||||
|
|
|
@ -115,8 +115,8 @@
|
|||
(grid-get-box `(:content ,(concat
|
||||
(enlight-menu
|
||||
'(("Projects"
|
||||
("Open" open-project "o")
|
||||
("Project List" open-inbox "p")))))
|
||||
("Switch To" theurgy-open-project "p")
|
||||
("Project List" theurgy-edit-projects-list "l")))))
|
||||
:align center
|
||||
:width 20))
|
||||
(grid-get-box `(:content ,(concat
|
||||
|
|
60
userland/projects.el
Normal file
60
userland/projects.el
Normal file
|
@ -0,0 +1,60 @@
|
|||
;;; projects.el --- Project management configuration with whaler -*- lexical-binding: t -*-
|
||||
|
||||
;; This file is not part of GNU Emacs
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;; commentary
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'subr-x)
|
||||
|
||||
(defcustom theurgy-project-default-file-alist '(("~/.emacs.d" . "init.el"))
|
||||
"This alist specifies which file (relative to the project root) to open in the main frame by default when opening a project."
|
||||
:group 'theurgy
|
||||
:group 'theurgy-projects
|
||||
:group 'whaler)
|
||||
|
||||
(use-package whaler
|
||||
:ensure t
|
||||
:config
|
||||
(whaler-populate-projects-directories)
|
||||
)
|
||||
|
||||
(defun get-project-default-file (dir)
|
||||
"Get the project default file for `DIR', regardless of whether either path is absolute or relative."
|
||||
(let ((absolute-project-dir (expand-file-name (string-remove-suffix "/" dir)))
|
||||
(absolute-project-default-file-alist (mapcar (lambda (x) `(,(string-remove-suffix "/" (expand-file-name (car x))) . ,(cdr x)))
|
||||
theurgy-project-default-file-alist)))
|
||||
(or (file-name-concat dir (cdr (assoc absolute-project-dir absolute-project-default-file-alist))) dir)))
|
||||
|
||||
(defun theurgy-open-project ()
|
||||
"Select a project and update neotree to use it as root."
|
||||
(interactive)
|
||||
(whaler :action (lambda (dir)
|
||||
(find-file (get-project-default-file dir))
|
||||
(neotree-dir dir))))
|
||||
|
||||
(defun theurgy-edit-projects-list ()
|
||||
"Open list of projects in customize."
|
||||
(interactive)
|
||||
(customize-group 'whaler))
|
||||
|
||||
(provide 'projects)
|
||||
|
||||
;;; projects.el ends here
|
Loading…
Add table
Add a link
Reference in a new issue