### Install package with manual specification using package-vc-install Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Fetching-Package-Sources.html When the first argument is a package specification, you can install from a custom repository. This example specifies the URL, lisp directory, and documentation file for BBDB. ```emacs-lisp ;; Specifying information manually: (package-vc-install '(bbdb :url "https://git.savannah.nongnu.org/git/bbdb.git" :lisp-dir "lisp" :doc "doc/bbdb.texi")) ``` -------------------------------- ### Install package from archive specification with package-vc-install Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Fetching-Package-Sources.html When the first argument to package-vc-install is a symbol naming a package, Emacs downloads the package's specification from the archive. This example installs BBDB from GNU ELPA. ```emacs-lisp ;; Emacs will download BBDB's specification from GNU ELPA: (package-vc-install 'bbdb) ``` -------------------------------- ### Example outline with heading and body lines Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Format.html Shows a sample outline with heading lines starting with asterisks and body lines following. The number of asterisks determines the heading depth. ```plaintext * Food This is the body, which says something about the topic of food. ** Delicious Food This is the body of the second-level header. ** Distasteful Food This could have a body too, with several lines. *** Dormitory Food * Shelter Another first-level topic with its header line. ``` -------------------------------- ### Generate MIME database with update-mime-info Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Android-Software.html Commands to create a temporary directory, copy the default freedesktop.org MIME catalog, and run update-mime-info to generate the MIME database. Notices about the database not being in the search path are harmless. ```shell $ mkdir -p my-mime-database/packages $ cp /usr/share/mime/packages/freedesktop.org.xml my-mime-database/packages $ update-mime-info my-mime-database ``` -------------------------------- ### Diary entry for linewise export Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Diary-iCalendar-Export.html Example diary entry that, when `diary-icalendar-export-linewise` is set to non-nil, is exported as four separate events on the same day with different start times. The second event has no start time. ```plaintext 2025-05-03 9AM Lab meeting Günter to present on new assay Start experiment A 12:30-1:30PM Lunch with Phil 16:00 Experiment A finishes; move to freezer ``` -------------------------------- ### Add shortdoc examples to C-h f help buffers Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Name-Help.html Add this hook to your initialization file to make C-h f help buffers include examples of function usage. Requires the shortdoc package. ```emacs-lisp (add-hook 'help-fns-describe-function-functions #'shortdoc-help-fns-examples-function) ``` -------------------------------- ### uuencode each file using backquoted ? notation Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Shell-Commands-in-Dired.html Equivalent to the shell loop example, but uses Dired's `?` substitution to run the command once per file, replacing each `?` with the current file name. The backquoted `?` is also substituted. ```shell uuencode ? ? > `?`.uu ``` -------------------------------- ### C-h x auto-fill-mode RET Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Name-Help.html Invoke describe-command to display documentation for the named command. The example shows how to get documentation for auto-fill-mode, which is not bound to any key. ```text C-h x auto-fill-mode `RET` ``` -------------------------------- ### Bind C-c h to the string 'hello' using key-description Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-Rebinding.html Uses the convenience function key-description to convert the string 'hello' into the appropriate key sequence syntax, avoiding the cumbersome manual spacing. ```emacs-lisp (keymap-global-set "C-c h" (key-description "hello")) ``` -------------------------------- ### package-vc-install Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Fetching-Package-Sources.html Installs a package directly from its source repository. The first argument can be a package symbol or a package specification. When given a symbol, Emacs uses the specification from the package archive. When given a specification, it can install from any location. ```APIDOC ## package-vc-install ### Description Installs a package directly from its source repository. The first argument can be a package symbol or a package specification. When given a symbol, Emacs uses the specification from the package archive. When given a specification, it can install from any location. ### Method Command ### Arguments - **package** (symbol or package specification) - Required - The package to install. If a symbol, the specification is downloaded from the package archive. If a list of the form `(name . spec)`, it is used as the package specification. ### Package Specification Keys - **:url** (string) - Optional - URL of the repository from which to fetch the package's source code. - **:branch** (string) - Optional - Revision of the code to install. Not the package version number. - **:lisp-dir** (string) - Optional - Repository-relative directory for loading Lisp sources. Defaults to the repository root. - **:main-file** (string) - Optional - Main file of the project for gathering package metadata. Defaults to the package name with ".el" appended. - **:doc** (string) - Optional - Repository-relative documentation file for building an Info file. Can be Texinfo or Org. - **:make** (string or list of strings) - Optional - Makefile targets to run before building the Info file. Only effective when `package-vc-allow-build-commands` is non-nil. - **:shell-command** (string) - Optional - Shell command to run before building the Info file. Only effective when `package-vc-allow-build-commands` is non-nil. - **:vc-backend** (symbol) - Optional - VC backend to use for downloading the repository. If omitted, Emacs guesses from the URL or falls back to `package-vc-default-backend`. ### Examples ```elisp ;; Install using archive specification (package-vc-install 'bbdb) ;; Install using manual specification (package-vc-install '(bbdb :url "https://git.savannah.nongnu.org/git/bbdb.git" :lisp-dir "lisp" :doc "doc/bbdb.texi")) ``` ### Notes - Automatically byte-compiles and auto-loads files. - Installed packages behave like regular packages and can be upgraded or deleted. - Built-in packages cannot be upgraded using this command. ``` -------------------------------- ### systemd socket unit for Emacs server Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html Example ~/.config/systemd/user/emacs.socket file for socket activation. The ListenStream path is where Emacs listens for emacsclient connections; the emacs.service file must also be installed. ```ini [Socket] ListenStream=/path/to/.emacs.socket DirectoryMode=0700 [Install] WantedBy=sockets.target ``` -------------------------------- ### Example buffer list output from list-buffers Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/List-Buffers.html Example output of the *Buffer List* buffer after typing C-x C-b. The first column shows flags: '.' for the current buffer, '%' for read-only, and '*' for modified. The columns are Buffer, Size, Mode, and File. ```text CRM Buffer Size Mode File . * .emacs 3294 Elisp/l ~/.emacs % *Help* 101 Help search.c 86055 C ~/cvs/emacs/src/search.c % src 20959 Dired by name ~/cvs/emacs/src/ * *mail* 42 Mail % HELLO 1607 Fundamental ~/cvs/emacs/etc/HELLO % NEWS 481184 Outline ~/cvs/emacs/etc/NEWS *scratch* 191 Lisp Interaction * *Messages* 1554 Messages ``` -------------------------------- ### Example regex file emacs.tags Source: https://www.gnu.org/software/emacs/manual/html_node/emacs/Etags-Regexps.html Contents of a regex file for etags. Lines beginning with whitespace are ignored, and lines starting with '--' are comments. This file defines a regex for C DEFVAR macros. ```text -- This is for GNU Emacs C source files {c}/[ \t]*DEFVAR_[A-Z_ \t(]+"\([^"]+\)"/\1/ ```