Skip to content
This repository was archived by the owner on Sep 21, 2025. It is now read-only.
/ TrAPT Public archive

Interact with the APT (Advanced Package Tool) with Emacs Transient menus. tablists, and Org mode

License

Notifications You must be signed in to change notification settings

TheTimeTombs/TrAPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrAPT

NOTE: Future updates to TrAPT will be done through Codeberg.org at this link: https://codeberg.org/TheTimeTombs/TrAPT. This repository will be archived indefinitely.

https://liberapay.com/assets/widgets/donate.svg

New updated demo GIFs coming soon!

1 Overview

Use transient menus to interact with the APT package manager.

2 Version 2.0 - Breaking Changes!

Version 2.0 of TrAPT has been updated with breaking changes! The following critical updates have been made:

  • All APT commands now rely on the shelly for commands that access a shell or remote host.
  • All list interfaces have been rewritten using Emacs BUI. This applies to trapt-apt-list-mode and trapt-exec-report.
  • Keybindings have changed slightly to avoid conflict with BUI default keybindings.
  • trapt-utils.el has be removed and any required functionality has been merged into the other package files.
  • trapt-apt-show removed with plans to add this functionality as part of trapt-apt-list-info-mode in a subsequent version.
  • APT statistics are no longer stored in a separate file, but are recalculated every time trapt is called. They are no longer determined when apt list is run.

3 Why TrAPT?

TrAPT was designed to fit some niche needs:

  1. To make it faster and simpler to call APT commands
  2. To be able to view apt list output in a sortable, serachable, and markable list
  3. To make it easy to export the output of apt list to plain text (Org mode)
  4. To be able to run APT commands on a remote host
  5. To view statistics on your packages

4 Features

  • Use a tranisent menu to inteact with the following APT commands or directly through and interative function call:
    • install
    • remove
    • purge
    • autoremove
    • list
  • Install and remove programs with APT using Org mode
  • Use trapt-exec-find in your Emacs configuration to create a report or required executables that your configuration depends on
  • Supports sending commands to eshell or vterm
  • Run APT commands on a remote host
  • View statistics on your packages including:
    • Number of installed packages
    • Numer of upgradable packages
    • Number of residual configuration files
    • Number of automatically installed packages

5 Requirements

This package requires the bui package be installed. You can install the tablist package with packages-list-packages or with use-package:

(use-package tablist
  :ensure t
  :defer t)

6 Installation

Clone this repo into your Emacs load path and load with the following :

(require 'trapt)

If you your version of Emacs supports use-package with the :vc keyword, you can install TrAPT using the following:

(use-package trapt
  :vc (:url "https://github.com/TheTimeTombs/TrAPT"
       :rev :newest
       :branch "main")
:init
(require 'trapt-exec-find) ; Load early if you wish to check your config
:commands (trapt trapt-exec-find-report))

Alternatively, using use-package you can put this package outside of your load path and load it with:

(use-package trapt
  :load-path "/path/to/trapt"
  :init
  (require 'trapt-exec-find) ; Load early if you wish to check your config
  :commands (trapt trapt-exec-find-report))

7 Usage

7.1 Using a Tranisent Mentu

Call the transient menu with M-x trapt. This will open the transient menu.

7.2 Call Individual Functions Directly

You can also run the following commands directly. Calling these functions will prompt the user for input.

Emacs FunctionAPT Command
trapt-apt-build-depapt build-dep
trapt-apt-full-upgradeapt full-upgrade
trapt-apt-installapt install
trapt-apt-listapt list
trapt-apt-mooapt moo
trapt-apt-purgeapt purge
trapt-apt-removeapt remove
trapt-apt-updateapt update

7.3 Manage Packages with APT List Mode

Running trapt-apt-list will direct output to a tablist buffer. From this buffer, packages can be marked usinng the m key. Once packages can be marked, users can execute APT operations on the selected packages with the x key to call up the TrAPT menu, M-x trapt, or by calling the functions M-x trapt-apt-*.

From the apt list buffer, the following commands can be run:

KeyCommandDescription
atrapt-org-export-allExport all items to an Org mode buffer
etrapt-org-export-markedExport marked items to an Org mode buffer
xtraptOpen trapt transient menu

7.4 Using Org Mode

Headings in Org mode that are simply package names can be marked with customized TODO keywords corresponding to the APT commands. The defaults are below:

APT CommandDefault Org TODO Keyword
build-depBUILD-DEP
full-upgradeFULL-UPGRADE
installINSTALL
purgePURGE
reinstallREINSTALL
removeREMOVE
upgradeUPGRADE

7.5 trapt-exec-find

In your Emacs configuration, wrap any strings contating shell commands like the example below:

(setq inferior-lisp-program (trapt-exec-find
                             "sbcl --noinform --no-linedit"
                             :pkg-mgr "apt"))

Then, after Emacs has loaded, call a list of all required executables on you system and their path using trapt-exec-find-report. Any executables not found on your system will report “not found”.

From the report buffer, the following commands can be run:

KeyCommandDescription
ptrapt-exec-find-goto-pathGo to path where executable resides
ctrapt-exec-find-goto-callGo to .el file where trapt-exec-find called
xtraptOpen trapt transient menu

This package was inspired by the Whicher pacakge for Emacs. This is an intent to take that similar idea but to extend it with more features.

8 Running Commands On Remote Hosts

TrAPT can run commands on a remote host using ssh. This uses the built-in tramp pacakage to make remote connections. To configure TrAPT, tramp needs be configured. An example configuration for a remote tramp connection that uses the fish shell is given below:

;; Set configuration options for a fish shell profile remotely
(connection-local-set-profile-variables
 'remote-fish
 '((shell-file-name . "/bin/fish")
   (shell-command-switch . "-c")
   (shell-interactive-switch . "-i")
   (shell-login-switch . "-l")))
;; Tell tramp to connect to remote connection using ssh and 'remote-fish profile
(connection-local-set-profiles
 `(:application tramp :protocol "ssh" :machine "IPaddress or host name")
 'remote-fish)

When tramp is configured, you can then define a list of remote connections for TrAPT by customizing the variable shelly-remotes:

(add-to-list shelly-remotes "username@host1")

When the remote option is used on a TrAPT command, the user will then be prompted to select a host from trapt-remotes using completing-read.

9 Future Plans

  • [ ] Incorporate asynchronous processes to gather APT list data. Help Approceated
  • [ ] Add information from apt show command into the trapt-apt-info buffer

About

Interact with the APT (Advanced Package Tool) with Emacs Transient menus. tablists, and Org mode

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published