A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/jamescherti/pathaction.el below:

jamescherti/pathaction.el: Emacs: Execute pathaction.yaml rules using pathaction

pathaction.el - Execute the pathaction command-line tool from Emacs

Execute pathaction.yaml rules using the pathaction command-line tool.

(The pathaction command-line tool enables the execution of specific commands on targeted files or directories. Its key advantage lies in its flexibility, allowing users to handle various types of files simply by passing the file or directory as an argument to the pathaction tool. The tool uses a .pathaction.yaml rule-set file to determine which command to execute. Additionally, Jinja2 templating can be employed in the rule-set file to further customize the commands.)

Install with straight (Emacs version < 30)

To install pathaction with straight.el:

  1. It if hasn't already been done, add the straight.el bootstrap code to your init file.
  2. Add the following code to the Emacs init file:
(use-package pathaction
  :ensure t
  :straight (pathaction
             :type git
             :host github
             :repo "jamescherti/pathaction.el")
  :config
  (add-to-list 'display-buffer-alist '("\\*pathaction:"
                                       (display-buffer-at-bottom)
                                       (window-height . 0.33))))
Installing with use-package and :vc (Built-in feature in Emacs version >= 30)

To install pathaction with use-package and :vc (Emacs >= 30):

(use-package pathaction
  :ensure t
  :vc (:url "https://github.com/jamescherti/pathaction.el"
       :rev :newest)
  :config
  (add-to-list 'display-buffer-alist '("\\*pathaction:"
                                         (display-buffer-at-bottom)
                                         (window-height . 0.33))))

To execute the pathaction action that is tagged with main, you can call the following Emacs function:

Edit the pathaction.yaml file

To edit the pathaction.yaml file, use the following function, which will prompt you to select one of the pathaction.yaml files in the parent directories:

Making pathaction open a window under the current one?

To configure pathaction to open its window under the current one, you can use the display-buffer-alist variable to customize how the pathaction buffer is displayed. Specifically, you can use the display-buffer-at-bottom action, which will display the buffer in a new window at the bottom of the current frame.

Here's the code to do this:

(add-to-list 'display-buffer-alist '("\\*pathaction:"
                                     (display-buffer-at-bottom)
                                     (window-height . 0.33)))
Saving all buffers before executing pathaction

By default, pathaction-before-run-hook only calls a function to save the current buffer before executing actions or commands that affect the current or any other edited buffer.

To make pathaction save all buffers, use the following configuration:

(defun my-save-some-buffers ()
  "Prevent `save-some-buffers' from prompting by passing 1 to it."
  (save-some-buffers))

(add-hook 'pathaction-before-run-hook #'my-save-some-buffers)

(If you want to prevent save-some-buffers from prompting the user before saving, replace (save-some-buffers) with (save-some-buffers t).)

The pathaction Emacs package has been written by James Cherti and is distributed under terms of the GNU General Public License version 3, or, at your choice, any later version.

Copyright (C) 2025 James Cherti

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.

Other Emacs packages by the same author:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4