diff options
| -rw-r--r-- | oni/home/config/pop-os.scm | 5 | ||||
| -rw-r--r-- | oni/packages/emacs.scm | 56 |
2 files changed, 60 insertions, 1 deletions
diff --git a/oni/home/config/pop-os.scm b/oni/home/config/pop-os.scm index e4990e2..9352737 100644 --- a/oni/home/config/pop-os.scm +++ b/oni/home/config/pop-os.scm @@ -243,7 +243,10 @@ emacs-vue-ts-mode emacs-stillness-mode - shutdown-rofi))) + shutdown-rofi + + emacs-related-files + ))) (services (append home-zsh-services (list home-channels-service diff --git a/oni/packages/emacs.scm b/oni/packages/emacs.scm index 157e23f..002e2f6 100644 --- a/oni/packages/emacs.scm +++ b/oni/packages/emacs.scm @@ -1045,3 +1045,59 @@ enabled.") editing window when a multi-line minibuffer appears. It automatically adjusts point just enough so that Emacs doesn't force a jump in the visible buffer.") (license license:expat))) + +(define-public emacs-related-files + (package + (name "emacs-related-files") + (version "20230903.851") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/DamienCassou/related-files") + (commit "8020f375013d5e83c9b8117d118d2402c63e66bb"))) + (file-name (git-file-name name version)) + (sha256 + (base32 "09czvj7rcvcb8h6fh6f2i1fiwk0ghg7n0lx1xppnf9yvwpdxld1s")))) + (build-system emacs-build-system) + (arguments + '(#:tests? #f)) + (home-page "https://www.gnu.org/software/emacs/") + (synopsis "Easily find files related to the current one") + (description + "Thousands times a day you want to jump from a file to its test file (or to its +CSS file, or to its header file, or any other related file) and just as many +times you want to go back to the initial file. Jumping to related files is what +this package is about. The question is: how does a user specify that a file is +related to a set of other files? One way is to create a function that takes a +file as argument and returns a list of related filenames: (defun +my/related-files-jumper (file) (let ((without-ext (file-name-sans-extension +file))) (list (concat without-ext \".js\") (concat without-ext \".css\")))) (setq +related-files-jumpers (list #'my/related-files-jumper)) `my/related-files-jumper +is called a jumper. With this setup, `related-files-jump will let the user jump +from Foo.js to Foo.css and back. This is working good but has several +limitations: 1. If Foo.css is not in the same directory as Foo.js or if you +want to include test files which end with \"-tests.js\", `my/related-files-jumper +has to be modified in a non-obvious way or a complicated new jumper must be +written and added to `related-files-jumpers'; 2. The function +`my/related-files-jumper has to be shared with all Emacs users working on the +same project So related-files recommends another approach that is less powerful +but much simpler. Here is another way to define the same jumper: (recipe +:remove-suffix \".js\" :add-suffix \".css\") This list must replace +`my/related-files-jumper in `related-files-jumpers'. This jumper lets the user +go from Foo.js to Foo.css. related-files will automatically inverse the meaning +of :remove-suffix and :add-suffix arguments so the user can also go from Foo.css +to Foo.js with this jumper. See `related-files-jumpers and THE MANUAL (TODO) +for more information. This kind of jumper can easily be shared with the members +of a team through a .dir-locals.el file. See (info \"(Emacs) Directory +Variables\"). `related-files-make also makes it easy to create a related file and +fill it with some content. If the content is always the same, a string can be +used to specify it: (recipe :remove-suffix \".js\" :add-suffix \".css\" :filler +\"Fill the CSS file\") There is also an `auto-insert'-based way to fill new files +and new kinds of fillers can easily be implemented. See the manual for more +information. If you want to add a new kind of jump, override +`related-files-apply and optionally `related-files-get-filler', call +`related-files-add-jumper-type and add a function to +`related-files-jumper-safety-functions'. If you want to add a new kind of +filler, override `related-files-fill and call `related-files-add-filler-type'.") + (license license:gpl3+))) |
