### Compile and Install Org Mode from Source Source: https://emacsdocs.org/docs/org/Installation This shows example shell commands for compiling and potentially installing Org mode after cloning its Git repository. 'make' compiles the code, 'make doc' generates documentation, and 'make install' handles the installation process. 'make help' lists all available options. ```bash # Compile Org mode $ make # Generate documentation $ make doc # Create local configuration $ make config # Install Org mode $ make install # List all available options $ make help ``` -------------------------------- ### Load AUCTeX in Emacs Init File Source: https://emacsdocs.org/docs/auctex/Quick-Start This Emacs Lisp code snippet loads the AUCTeX package. It should be added to your user init file if AUCTeX was not installed via ELPA. Ensure you do not include this if using ELPA or if '(package-initialize)' is already present. ```emacs-lisp (load "auctex.el" nil t t) ``` -------------------------------- ### Magit: Push Changes Source: https://emacsdocs.org/docs/magit/Getting-Started Details how to push committed changes to a remote repository using Magit. The sequence involves accessing push commands with `P` and then executing a push with `p`. ```Emacs Lisp P ``` ```Emacs Lisp p ``` -------------------------------- ### Configure Emacs Installation for Non-Privileged Users Source: https://emacsdocs.org/docs/auctex/Advice-for-non_002dprivileged-users Example configure script options for installing Emacs in a user's home directory, specifying locations for Lisp and TeX files. This is useful for users without system administration rights. ```bash # Example configure script usage: ./configure --prefix="$HOME/emacs" --with-lispdir="$HOME/share/emacs/site-lisp" --with-texmf-dir="$HOME/texmf" ``` -------------------------------- ### Magit: Navigate and Refresh Status Buffer Source: https://emacsdocs.org/docs/magit/Getting-Started This describes how to interact with the Magit status buffer to view and refresh Git repository information. Key bindings like `C-x g` and `g` are used for navigation and updates. ```Emacs Lisp C-x g ``` ```Emacs Lisp g ``` -------------------------------- ### Emacs: Start Interactive Tutorial Source: https://emacsdocs.org/docs/emacs/Help-Summary Initiates the interactive Emacs tutorial, guiding new users through the fundamental concepts and commands of the editor. This function, `help-with-tutorial`, is a primary resource for learning Emacs. ```emacs-lisp (global-set-key (kbd "C-h t") 'help-with-tutorial) ``` -------------------------------- ### Starting Gnus in Emacs Source: https://emacsdocs.org/docs/emacs/Gnus-Startup This snippet shows the Emacs Lisp command to start the Gnus newsreader. It assumes Gnus has been installed and configured. ```emacs-lisp M-x gnus ``` -------------------------------- ### Magit: Commit Changes Source: https://emacsdocs.org/docs/magit/Getting-Started Explains the process of committing staged changes using Magit. This involves invoking the commit command (`c`), writing a commit message in a dedicated buffer, and finalizing the commit with `C-c C-c`. ```Emacs Lisp c ``` ```Emacs Lisp C-c C-c ``` -------------------------------- ### Clone Org Mode Git Repository and Generate Autoloads Source: https://emacsdocs.org/docs/org/Installation This shell command sequence clones the Org mode Git repository into a specified directory and then runs 'make autoloads'. The 'make autoloads' command is crucial for generating necessary definition files for Org mode when installed from source. ```bash $ cd ~/src/ $ git clone https://code.orgmode.org/bzg/org-mode.git $ cd org-mode/ $ make autoloads ``` -------------------------------- ### Magit: Accessing Menus and Commands Source: https://emacsdocs.org/docs/magit/Getting-Started Illustrates how to access Magit's transient menus and commands from various contexts. The main menu is accessed with `h`, and file-specific commands can be invoked with `C-c M-g` in file visiting buffers. ```Emacs Lisp h ``` ```Emacs Lisp C-c M-g ``` -------------------------------- ### Magit: Stage and Unstage Changes Source: https://emacsdocs.org/docs/magit/Getting-Started Demonstrates how to stage and unstage individual files or hunks within the Magit status buffer. Commands like `s` for staging and `u` for unstaging are used, along with `TAB` for expanding sections and `C-SPC` for region selection. ```Emacs Lisp s ``` ```Emacs Lisp u ``` ```Emacs Lisp TAB ``` ```Emacs Lisp C-SPC ``` -------------------------------- ### Install Magit Package in Emacs Source: https://emacsdocs.org/docs/magit/Installing-from-Melpa This command installs the Magit package and its dependencies within Emacs. After refreshing the package list, this command can be used to download and set up Magit for use as a Git interface. ```emacs-lisp M-x package-install RET magit RET ``` -------------------------------- ### Install AUCTeX from Source (Standard Installation) Source: https://emacsdocs.org/docs/auctex/Installation Installs AUCTeX from a release tarball or repository checkout using standard build commands. This method is suitable for site-wide installations and allows for custom prefixes. ```bash ./configure make make install ``` -------------------------------- ### Emacs TTY Setup Hook Source: https://emacsdocs.org/docs/elisp/Startup-Summary Details the execution of the `tty-setup-hook` when Emacs starts in a text terminal. This hook is used for terminal-specific configurations and is noted to be skipped in batch mode or when `term-file-prefix` is nil. ```Emacs Lisp ;; Step 20: Load terminal-specific Lisp library and run `tty-setup-hook`. ;; This occurs if Emacs is started on a text terminal. ;; It is skipped in '--batch' mode or if `term-file-prefix` is nil. (load "terminal-specific-library" nil t) (run-hooks 'tty-setup-hook) ``` -------------------------------- ### Numbered Source Code Blocks with Starting Line Source: https://emacsdocs.org/docs/org/Literal-Examples Illustrates adding line numbers to source code blocks using the '-n' switch. An optional numeric argument specifies the starting line number. The '+n' switch continues numbering from a previous block. ```Org Mode #+BEGIN_SRC emacs-lisp -n 20 ;; This exports with line number 20. (message "This is line 21") #+END_SRC #+BEGIN_SRC emacs-lisp +n 10 ;; This is listed as line 31. (message "This is line 32") #+END_SRC ``` -------------------------------- ### Install AUCTeX from Source (Custom Prefix) Source: https://emacsdocs.org/docs/auctex/Installation Installs AUCTeX from a release tarball or repository checkout with a specified installation prefix. This allows for non-standard installation locations. ```bash ./configure --prefix=... make make install ``` -------------------------------- ### Install AUCTeX Package Source: https://emacsdocs.org/docs/auctex/Build_002finstall-and-uninstall This command installs the built AUCTeX package into the pre-configured locations. Administrative privileges may be required if installing into system directories. ```shell make install ``` -------------------------------- ### Configure Emacs Package Archives (MELPA) Source: https://emacsdocs.org/docs/magit/Installing-from-Melpa This Lisp code snippet configures Emacs to use the MELPA package archive. It requires the 'package' module and adds the MELPA archive to the list of available package repositories. This is a prerequisite for installing packages from MELPA. ```emacs-lisp (require 'package) (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t) ``` -------------------------------- ### Configure AUCTeX Lisp Directory with --with-lispdir Source: https://emacsdocs.org/docs/auctex/Installation-under-MS-Windows The `--with-lispdir` option sets the directory where AUCTeX's Elisp files, such as 'auctex.el' and 'preview-latex.el', will be installed. If a 'site-start.d' subdirectory exists within this path, startup files will be placed there instead. Other AUCTeX files are installed in an 'auctex' subdirectory. ```shell --with-lispdir=drive:/path/to/site-lisp ``` -------------------------------- ### Configure AUCTeX for Multi-File Documents in Emacs Source: https://emacsdocs.org/docs/auctex/Quick-Start This Emacs Lisp configuration helps AUCTeX manage multi-file LaTeX documents that use \\include or \\input. Setting 'TeX-master' to nil prompts AUCTeX to ask for the master file each time a new file is opened. ```emacs-lisp (setq-default TeX-master nil) ``` -------------------------------- ### Start Emacs and Visit a File Source: https://emacsdocs.org/docs/emacs/Entering-Emacs Starts Emacs and immediately opens a specified file. This is useful for short editing sessions, similar to other editors. It splits the initial frame into the file buffer and the startup screen. ```shell emacs foo.txt ``` -------------------------------- ### Simple Literal Example with Colon Prefix Source: https://emacsdocs.org/docs/org/Literal-Examples Demonstrates a simplified way to include literal examples by prefixing lines with a colon and a space. This is suitable for short, inline examples. ```Org Mode Here is an example : Some example from a text file. ``` -------------------------------- ### Emacs Lisp: Get region start and end interactively with basic string input (incorrect) Source: https://emacsdocs.org/docs/elisp/Using-Interactive This Emacs Lisp snippet shows an example of what *not* to do when using a Lisp expression in `interactive`. It attempts to read a string and then get the region's beginning and end. However, it does not account for potential changes to point and mark between reading the string and evaluating `region-beginning` and `region-end`, which could lead to incorrect argument values. ```emacs-lisp (interactive (list (region-beginning) (region-end) (read-string "Foo: " nil 'my-history))) ``` -------------------------------- ### Emacs Lisp: Package Initialization Example Source: https://emacsdocs.org/docs/elisp/Antinews This snippet demonstrates the explicit call to `package-initialize` required in Emacs 26.3 and later versions to activate installed packages after loading init files. It ensures packages are only loaded when explicitly requested. ```emacs-lisp (defun my-init-hook () ;; Load packages after init files are loaded (package-initialize)) (add-hook 'after-init-hook 'my-init-hook) ``` -------------------------------- ### Emacs Quick Start Options Source: https://emacsdocs.org/docs/emacs/Initial-Options The -Q or --quick option initiates Emacs with minimal customizations, effectively disabling the loading of initialization files, site-start.el, site-lisp directories, X resources, and the splash screen. This provides a faster startup with a clean environment. ```shell emacs -Q ``` ```shell emacs --quick ``` -------------------------------- ### Configure AUCTeX Installation Script Source: https://emacsdocs.org/docs/auctex/Installation-under-MS-Windows This command initiates the AUCTeX installation process on Windows. It requires a shell environment like bash and allows for various options to customize the installation, such as specifying paths and features. ```shell ./configure ``` -------------------------------- ### Activate Emacs Packages After Startup Source: https://emacsdocs.org/docs/emacs/Package-Installation This snippet demonstrates how to activate all installed Emacs packages after startup using an interactive command. This is useful for deferring package loading until after the main Emacs session is ready. ```emacs-lisp M-: (package-activate-all) RET ``` -------------------------------- ### Emacs DEFUN Interactive Specification Example Source: https://emacsdocs.org/docs/elisp/Writing-Emacs-Primitives An example demonstrating the 'interactive' argument of the DEFUN macro. This specific example shows how to define an interactive function that reads a character, gets the prefix numeric argument, and returns true. ```c DEFUN ("foo", Ffoo, Sfoo, 0, 3, "(list (read-char-by-name \"Insert character: \")\ (prefix-numeric-value current-prefix-arg)\ t)", doc: /* … */) ``` -------------------------------- ### Minimal Org Mode Setup for Debugging Source: https://emacsdocs.org/docs/org/Feedback This Emacs Lisp snippet defines a minimal setup for Org mode, intended for debugging. It activates error debugging (`debug-on-error`), adds the Org mode Lisp directory to the load path, and includes contributions. This setup is useful when troubleshooting issues specific to Org mode development. ```emacs-lisp ;;; Minimal setup to load latest `org-mode'. ;; Activate debugging. (setq debug-on-error t debug-on-signal nil debug-on-quit nil) ;; Add latest Org mode to load path. (add-to-list 'load-path (expand-file-name "/path/to/org-mode/lisp")) (add-to-list 'load-path (expand-file-name "/path/to/org-mode/contrib/lisp" t)) ``` -------------------------------- ### Invoking Emacs via Run Dialog Source: https://emacsdocs.org/docs/emacs/Windows-Startup Start Emacs using the Windows Run dialog. Typing `runemacs` in the dialog initiates Emacs in the parent directory of the user's HOME directory. ```text runemacs RET ``` -------------------------------- ### Emacs Buffer List Example Source: https://emacsdocs.org/docs/emacs/List-Buffers An example output of the `*Buffer List*` buffer in Emacs, showing various buffers with indicators for their status. The example demonstrates how to interpret symbols like '.', '%', and '*' to understand buffer properties. ```Text CRM Buffer Size Mode File . * .emacs 3294 Emacs-Lisp ~/.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 Islamic Diary Entry Source: https://emacsdocs.org/docs/emacs/Non_002dGregorian-Diary Illustrates the format for an Islamic-date diary entry, which starts with an 'I' symbol. This example entry matches Dhu al-Qada 25 on the Islamic calendar. ```text IDhu al-Qada 25 Happy Islamic birthday! ``` -------------------------------- ### Initialize Magit and Info Documentation in Emacs Source: https://emacsdocs.org/docs/magit/Installing-from-the-Git-Repository Configures Emacs to load Magit and its documentation. It adds Magit's lisp directory to the load-path and registers the documentation directory for the info system. Requires `magit` to be loaded. ```emacs-lisp (add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp") (require 'magit) (with-eval-after-load 'info (info-initialize) (add-to-list 'Info-directory-list "~/.emacs.d/site-lisp/magit/Documentation/")) ``` -------------------------------- ### Org Mode Syntax: Basic Checkbox List Example Source: https://emacsdocs.org/docs/org/Checkboxes This example demonstrates the basic syntax for creating a hierarchical list with checkboxes in Org mode. Items starting with '[ ]' are checkboxes, and they can have nested sub-items. ```org * TODO Organize party [2/4] - [-] call people [1/3] - [ ] Peter - [X] Sarah - [ ] Sam - [X] order food - [ ] think about what music to play - [X] talk to the neighbors ``` -------------------------------- ### Enable AUCTeX Document Parsing in Emacs Source: https://emacsdocs.org/docs/auctex/Quick-Start These Emacs Lisp variables enable document parsing for AUCTeX, which is necessary for supporting many LaTeX packages. Add these lines to your init file to ensure AUCTeX can parse your LaTeX documents effectively. ```emacs-lisp (setq TeX-auto-save t) (setq TeX-parse-self t) ``` -------------------------------- ### Emacs Lisp: Customize Calendar Mode Week Start Day Source: https://emacsdocs.org/docs/emacs/Move-to-Beginning-or-End Set the `calendar-week-start-day` variable in Emacs Lisp to change the default start day of the week. For example, setting it to 1 makes Monday the start of the week. This affects how week navigation commands behave. ```Emacs Lisp (setq calendar-week-start-day 1) ``` -------------------------------- ### Get Window Display Start Position (Emacs Lisp) Source: https://emacsdocs.org/docs/elisp/Window-Start-and-End The `window-start` function returns the display-start position of a given window. If no window is specified, it defaults to the selected window. This position indicates where the buffer display begins in the window. The start position is typically set when a window is created or a new buffer is displayed. ```Emacs Lisp (window-start) ``` ```Emacs Lisp (window-start FRAME-OR-WINDOW) ``` -------------------------------- ### Emacs: Run Info Documentation Browser Source: https://emacsdocs.org/docs/emacs/Help-Summary Launches the Info documentation browser, the standard way to access GNU software manuals, including the Emacs manual. This command, `info`, provides a hyperlinked environment for reading documentation. ```emacs-lisp (global-set-key (kbd "C-h i") 'info) ``` -------------------------------- ### Literal Examples and Source Code in Emacs Source: https://emacsdocs.org/docs/org/Main-Index This entry describes how to handle literal examples and source code within Emacs documentation. It references 'BEGIN_SRC' for literal examples and code blocks, and 'BEGIN_COMMENT' for comment lines. It also touches upon extracting and evaluating source code. ```emacs-lisp ‘`BEGIN_COMMENT`’ ‘`BEGIN_EXAMPLE`’ ‘`BEGIN_SRC`’ ``` -------------------------------- ### Get overlay start position in Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Managing-Overlays The `overlay-start` function returns the starting buffer position of a given overlay. The position is returned as an integer. This function is useful for determining the beginning of the region managed by an overlay. ```emacs-lisp (overlay-start overlay) ``` -------------------------------- ### Emacs Window System Initialization Source: https://emacsdocs.org/docs/elisp/Startup-Summary Describes the process of initializing the Emacs window system based on the `initial-window-system` variable. It highlights that the actual implementation is generic and specific to each supported window system, with an example of how a specific system might be configured. ```Emacs Lisp ;; Step 8: Initialize the window system specified by `initial-window-system`. ;; The `window-system-initialization` function is generic and its implementation ;; varies per window system. For example, a 'windowsystem' might be configured in: ;; "term/windowsystem-win.el" (defun window-system-initialization () ;; Placeholder for actual window system initialization logic (message "Initializing window system...")) ;; If `initial-window-system` is set to a specific value, Emacs calls ;; the corresponding initialization function. ``` -------------------------------- ### Load AUCTeX and preview-latex.el in site-start.el Source: https://emacsdocs.org/docs/auctex/Advice-for-package-providers This code snippet demonstrates how to load the AUCTeX and preview-latex.el Emacs Lisp files system-wide by adding them to the 'site-start.el' file. This ensures AUCTeX is available for all users. It uses the 'load' function with arguments to control byte-compilation and feature loading. ```emacs-lisp (load "auctex.el" nil t t) (load "preview-latex.el" nil t t) ``` -------------------------------- ### Control Texinfo Ordered List Numbering and Lettering Source: https://emacsdocs.org/docs/org/Plain-lists-in-Texinfo-export This example shows how to control the numbering and lettering of ordered lists when exporting to Texinfo. The :enum attribute is used within ATTR_TEXINFO to specify the starting point or style of enumeration. 'A' starts the list with letters, but it can also be used to set a starting number. ```org #+ATTR_TEXINFO: :enum A 1. Alpha 2. Bravo 3. Charlie ``` -------------------------------- ### Run Configure Script Source: https://emacsdocs.org/docs/auctex/Configure This command initiates the configuration process for AUCTeX. It takes various options to customize the installation. Ensure you have followed `README.GIT` instructions if you fetched AUCTeX from Git. ```shell ./configure options ``` -------------------------------- ### Emacs Lisp: Example of fill-paragraph with a fill prefix Source: https://emacsdocs.org/docs/emacs/Fill-Prefix Demonstrates how the `fill-paragraph` command behaves with a specified fill prefix. The fill prefix is prepended to each line of the paragraph before filling and re-added after filling. Lines not starting with the prefix are treated as paragraph starts. ```emacs-lisp ;; This is an ;; example of a paragraph ;; inside a Lisp-style comment. ``` ```emacs-lisp ;; This is an example of a paragraph ;; inside a Lisp-style comment. ``` -------------------------------- ### Specify Installation Prefix Source: https://emacsdocs.org/docs/auctex/Configure The `--prefix` option defines the base directory for installing package components. Sensible subdirectories like `man`, `share`, and `bin` are expected under this prefix. Defaults to `/usr/local`. ```shell --prefix=‘/usr/local’ ``` -------------------------------- ### Build AUCTeX Package Source: https://emacsdocs.org/docs/auctex/Build_002finstall-and-uninstall This command compiles the Lisp files, extracts TeX files, and builds the documentation for the AUCTeX package. It should be run after the `configure` script has been executed. ```shell make ``` -------------------------------- ### Outline Mode Heading Structure Example Source: https://emacsdocs.org/docs/emacs/Outline-Format This example demonstrates the hierarchical structure of headings and body lines in Emacs Outline mode. Heading lines start with asterisks, and their count determines the depth. Body lines follow their preceding heading. ```text * 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. ``` -------------------------------- ### Load git-commit and Start Server in Emacs Lisp Source: https://emacsdocs.org/docs/magit/git_002dcommit_002dmode-isn_0027t-used-when-committing-from-the-command_002dline These Emacs Lisp snippets are used in your `init.el` file to ensure `git-commit` is loaded and the Emacs server is started, which is necessary for `git-commit-mode` to function correctly when committing from the command line. This setup allows `git-commit-mode` to be automatically invoked. ```emacs-lisp (require 'git-commit) (server-mode) ``` ```emacs-lisp (load "/path/to/magit-autoloads.el") ``` ```emacs-lisp (use-package server :config (or (server-running-p) (server-mode))) ``` -------------------------------- ### Emacs: View HELLO file Source: https://emacsdocs.org/docs/emacs/Help-Summary Displays the `HELLO` file, which provides examples of various character sets supported by Emacs. This is helpful for understanding character encoding and display in different contexts. ```emacs-lisp (global-set-key (kbd "C-h h") 'view-hello-file) ``` -------------------------------- ### Install AUCTeX (Shell) Source: https://emacsdocs.org/docs/auctex/Installation-under-MS-Windows Command to install AUCTeX after it has been built. This command places the compiled files into the directories specified during the configure step. This is the final step in the installation process. ```shell make install ``` -------------------------------- ### Emacs Lisp: Example Org Mode Outline with Tags Source: https://emacsdocs.org/docs/org/Tag-Inheritance Demonstrates how tags are applied to headings in an Org Mode outline. Subheadings inherit tags from parent headings, showcasing the inheritance mechanism. This example requires Emacs and Org Mode to be installed. ```emacs-lisp * Meeting with the French group :work: ** Summary by Frank :boss:notes: *** TODO Prepare slides for him :action: ``` -------------------------------- ### Emacs Startup Fontset Example Source: https://emacsdocs.org/docs/emacs/Defining-Fontsets Demonstrates how Emacs generates a 'fontset-startup' based on a provided command-line font argument. This fontset is used for the initial X window frame. ```shell emacs -fn "*courier-medium-r-normal--14-140-*-iso8859-1" ``` ```text -*-courier-medium-r-normal-*-14-140-*-*-*-*-fontset-startup ``` -------------------------------- ### Activate Emacs Packages During Startup Source: https://emacsdocs.org/docs/emacs/Package-Installation This snippet shows how to activate all installed Emacs packages during startup by calling the 'package-activate-all' function in the init file. This ensures all packages are available once Emacs has finished loading. ```emacs-lisp (package-activate-all) ``` -------------------------------- ### Emacs Lisp: Install a Package Source: https://emacsdocs.org/docs/emacs/Package-Installation Installs a specified package in Emacs. This command prompts for the package name and handles downloading and installing it, along with any required dependencies. It is a primary method for package management in Emacs. ```Emacs Lisp M-x package-install ``` -------------------------------- ### Emacs Lisp: Example of find-file-noselect Usage Source: https://emacsdocs.org/docs/elisp/Visiting-Functions This example shows how to use the `find-file-noselect` function in Emacs Lisp to open a file and get a buffer object. The function returns the buffer associated with the specified filename, creating a new one if it doesn't exist. ```emacs-lisp (find-file-noselect "/etc/fstab") ⇒ # ``` -------------------------------- ### Emacs Lisp: Package Initialization and Activation Source: https://emacsdocs.org/docs/elisp/Packaging-Basics Demonstrates how to initialize and activate Emacs packages. `package-initialize` updates the record of installed packages and then activates them, while `package-activate-all` makes installed packages available for the current session. The `no-activate` argument allows updating the record without activation. ```Emacs Lisp (package-initialize) ;; Or to update records without activating: ;; (package-initialize t) ``` ```Emacs Lisp (package-activate-all) ``` -------------------------------- ### Emacs Diary File Entry Examples Source: https://emacsdocs.org/docs/emacs/Format-of-Diary-File Demonstrates various formats for diary entries in Emacs. Entries begin with a date specification, followed by the event description. Continuation lines must start with whitespace. The examples show different date formats and multi-line entries. ```text 12/22/2015 Twentieth wedding anniversary! 10/22 Ruth's birthday. * 21, *: Payday Tuesday--weekly meeting with grad students at 10am Supowit, Shen, Bitner, and Kapoor to attend. 1/13/89 Friday the thirteenth!! thu 4pm squash game with Lloyd. mar 16 Dad's birthday April 15, 2016 Income tax due. * 15 time cards due. ``` ```text 02/11/2012 Bill B. visits Princeton today 2pm Cognitive Studies Committee meeting 2:30-5:30 Liz at Lawrenceville 4:00pm Dentist appt 7:30pm Dinner at George's 8:00-10:00pm concert ``` -------------------------------- ### Getting Locale Information on MS-Windows with Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Misc-Events This code example shows how to use the `w32-get-locale-info` function in Emacs Lisp to retrieve language and codepage information on MS-Windows. It illustrates how to get abbreviated language names, full English names, and full localized names. ```emacs-lisp ;; Get the abbreviated language name, such as "ENU" for English (w32-get-locale-info language-id) ;; Get the full English name of the language, ;; such as "English (United States)" (w32-get-locale-info language-id 4097) ;; Get the full localized name of the language (w32-get-locale-info language-id t) ``` -------------------------------- ### Running Emacs from Command Prompt Source: https://emacsdocs.org/docs/emacs/Windows-Startup Execute Emacs directly from the Command Prompt. This method, using either `emacs` or `runemacs`, starts Emacs in the current directory. Using `emacs` ties up the Command Prompt window until Emacs exits, while `runemacs` allows immediate use of the prompt. ```text emacs RET ``` ```text runemacs RET ``` -------------------------------- ### Add Org Contrib Directory to Emacs Load Path Source: https://emacsdocs.org/docs/org/Installation This Emacs Lisp code snippet is used when installing Org mode from an archive that includes contributed libraries. It adds the 'contrib/lisp' directory to Emacs's load path, enabling the use of these extra features. ```emacs-lisp (add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t) ``` -------------------------------- ### Compile Magit Libraries and Generate Manuals Source: https://emacsdocs.org/docs/magit/Installing-from-the-Git-Repository Compiles the Magit Emacs Lisp libraries and generates the necessary info manuals. This command is run from the Magit repository's root directory. ```shell $ make ``` -------------------------------- ### Specify AUCTeX Startup Files Source: https://emacsdocs.org/docs/auctex/Configure These options define the names of the startup files for AUCTeX and preview-latex. If `lispdir` contains `site-start.d`, these files are placed there and loaded automatically by `site-start.el`. Do not move these files after installation. ```shell --with-auctexstartfile=‘auctex.el’ ``` ```shell --with-previewstartfile=‘preview-latex.el’ ``` -------------------------------- ### Add Org Directory to Emacs Load Path Source: https://emacsdocs.org/docs/org/Installation This Emacs Lisp code snippet adds a specified directory to Emacs's load path, which is necessary when installing Org mode from a downloaded archive. It ensures that Emacs can find and load Org mode's Elisp files. ```emacs-lisp (add-to-list 'load-path "~/path/to/orgdir/lisp") ``` -------------------------------- ### Org Mode to Beamer Presentation Export Source: https://emacsdocs.org/docs/org/A-Beamer-example This snippet shows an Org mode document structured for export to a Beamer presentation. It includes essential LaTeX and Beamer specific configurations, as well as content for frames and elements like blocks and notes. No external dependencies are required beyond Emacs with Org mode and a LaTeX distribution with the Beamer package installed. ```org #+TITLE: Example Presentation #+AUTHOR: Carsten Dominik #+OPTIONS: H:2 toc:t num:t #+LATEX_CLASS: beamer #+LATEX_CLASS_OPTIONS: [presentation] #+BEAMER_THEME: Madrid #+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) * This is the first structural section ** Frame 1 *** Thanks to Eric Fraga :B_block: :PROPERTIES: :BEAMER_COL: 0.48 :BEAMER_ENV: block :END: for the first viable Beamer setup in Org *** Thanks to everyone else :B_block: :PROPERTIES: :BEAMER_COL: 0.48 :BEAMER_ACT: <2-> :BEAMER_ENV: block :END: for contributing to the discussion **** This will be formatted as a beamer note :B_note: :PROPERTIES: :BEAMER_env: note :END: ** Frame 2 (where we will not use columns) *** Request Please test this stuff! ``` -------------------------------- ### Get Window Group Display Start Position (Emacs Lisp) Source: https://emacsdocs.org/docs/elisp/Window-Start-and-End The `window-group-start` function retrieves the display-start position for a group of windows. It behaves like `window-start` but considers window groups. If a buffer-local variable `window-group-start-function` is defined, this function calls it with the window as an argument and returns its result. ```Emacs Lisp (window-group-start) ``` ```Emacs Lisp (window-group-start FRAME-OR-WINDOW) ``` -------------------------------- ### Access DOM Node Attribute Source: https://emacsdocs.org/docs/elisp/Document-Object-Model Retrieves the value of a specific attribute from a DOM node. For example, getting the 'href' attribute of an 'img' tag. ```Emacs Lisp (dom-attr node attribute) ``` ```Emacs Lisp (dom-attr img 'href) => "https://fsf.org/logo.png" ``` -------------------------------- ### Include X Resource File via Command Line Source: https://emacsdocs.org/docs/emacs/Resources This example shows how to include an entire file of X resource specifications using the '-xrm' option with the '#include' directive. This is a convenient way to manage a large number of resource settings centrally. ```shell emacs -xrm "#include \"~/.emacs_resources\"" ``` -------------------------------- ### Get Start Position of Match using match-beginning in Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Simple-Match-Data Returns the buffer position where the last regular expression search found a match. It can return the starting position of the entire match (count 0) or of a specific subexpression (count > 0). Returns `nil` for unused subexpressions. ```emacs-lisp (defun get-match-beginning (count) "Return the position of the start of the matching text or a subexpression. COUNT is 0 for the entire match, or a positive integer for a subexpression. Returns nil for unused subexpressions. " (match-beginning count)) ``` -------------------------------- ### Emacs Lisp Package Activation during Startup Source: https://emacsdocs.org/docs/elisp/Startup-Summary Demonstrates how Emacs activates installed Lisp packages automatically during startup, controlled by `package-activate-all`. It also notes conditions under which this might be skipped, such as specific command-line options or configuration variables. ```Emacs Lisp ;; Step 7: Activate all installed Emacs Lisp packages. ;; This is skipped if `package-enable-at-startup` is nil or if Emacs is started with ;; options like '-q', '-Q', or '--batch'. (package-activate-all) ;; To activate packages in batch mode, call `package-activate-all` explicitly, ;; for example, using the '--funcall' option. ``` -------------------------------- ### Emacs Initialization Hooks Execution Source: https://emacsdocs.org/docs/elisp/Startup-Summary Illustrates the execution of Emacs hooks during the startup sequence. Specifically, it shows the running of `before-init-hook` and `after-init-hook`, which allow users to customize Emacs behavior before and after initialization. ```Emacs Lisp ;; Step 9: Run the `before-init-hook`. ;; This hook is executed before most of the initialization is complete. (run-hooks 'before-init-hook) ;; ... (other initialization steps) ... ;; Step 18: Run the `after-init-hook`. ;; This hook is executed after all initialization is finished. (run-hooks 'after-init-hook) ``` -------------------------------- ### Get Days in Month in Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Time-Calculations Calculates the number of days in a specific month of a given year. For example, February 2020 has 29 days. ```Emacs Lisp (date-days-in-month year month) ``` -------------------------------- ### Specify Fontset with emacs -fn Option Source: https://emacsdocs.org/docs/emacs/Fontsets This command-line option allows you to start Emacs and immediately use a specific fontset. Ensure the fontset name is valid and supported by your Emacs installation and system. ```shell emacs -fn "fontset-standard" ``` -------------------------------- ### Emacs: Specify Characters by Hexadecimal Code Source: https://emacsdocs.org/docs/elisp/Character-Type Represents a character using its hexadecimal code. The sequence starts with `?\x` followed by any number of hex digits. Example: `?\x41` for `A`. ```Emacs Lisp ?\x41 ``` ```Emacs Lisp ?\x1 ``` ```Emacs Lisp ?\xe0 ``` -------------------------------- ### Conditional Emacs Configuration Source: https://emacsdocs.org/docs/emacs/Init-Examples Provides examples of how to conditionally apply Emacs customizations based on the availability of functions or variables. This ensures that configuration settings work across different platforms and Emacs versions by checking `fboundp` for functions and `boundp` for variables before applying changes. ```emacs-lisp (if (fboundp 'blink-cursor-mode) (blink-cursor-mode 0)) ``` ```emacs-lisp (if (boundp 'coding-category-utf-8) (set-coding-priority '(coding-category-utf-8))) ``` -------------------------------- ### Dumping Emacs Executable with Preloaded Lisp Data Source: https://emacsdocs.org/docs/elisp/Building-Emacs This command initiates the process of building a faster-starting Emacs executable. It runs 'temacs' in batch mode, loads the 'loadup' library, and uses a specified dump method ('pdump', 'pbootstrap', or 'dump') to record preloaded Lisp functions and variables. ```shell temacs -batch -l loadup --temacs=dump-method ``` -------------------------------- ### Org Mode Link Syntax Examples Source: https://emacsdocs.org/docs/org/Link-Format Demonstrates the basic syntax for creating links in Org mode, both with and without explicit descriptions. These are plain text representations. ```text [[LINK][DESCRIPTION]] ``` ```text [[LINK]] ``` -------------------------------- ### Get File Permissions Mode (Emacs Lisp) Source: https://emacsdocs.org/docs/elisp/File-Attributes This represents the file's access mode. For example, '-rw-rw-rw-' indicates read and write permissions for the owner, group, and others (world). ```Emacs Lisp ;; Example: File has read and write access for owner, group, and world. "-rw-rw-rw-" ``` -------------------------------- ### Load Magit Autoload Definitions in Emacs Source: https://emacsdocs.org/docs/magit/Installing-from-the-Git-Repository Loads only the autoload definitions for Magit from a specified file. This can be an alternative to loading the entire Magit package, potentially offering faster startup times. Assumes the `magit-autoloads.el` file is accessible via the Emacs load-path. ```emacs-lisp (load "/path/to/magit/lisp/magit-autoloads") ``` -------------------------------- ### Emacs Lisp: Setup SMIE Navigation and Indentation Source: https://emacsdocs.org/docs/elisp/SMIE Initializes SMIE navigation and indentation for a major mode. It requires a grammar table, an indentation rules function, and optionally accepts forward/backward token lexer functions and other keywords. This function enables commands like `forward-sexp`, `backward-sexp`, `transpose-sexps`, and `TAB` indentation. ```emacs-lisp smie-setup grammar rules-function &rest keywords ``` -------------------------------- ### Getting String Width with `string-width` Source: https://emacsdocs.org/docs/elisp/String-Basics Provides an example of using the `string-width` function to determine the display width of a string in Emacs Lisp. This is distinct from the `length` function and is necessary for accurate display calculations. ```emacs-lisp (string-width "hello") ``` -------------------------------- ### Start Emacs Server via Command Source: https://emacsdocs.org/docs/emacs/Emacs-Server Initiates an Emacs server process. This can be done by executing 'server-start' within an existing Emacs instance or by including '(server-start)' in the Emacs initialization file. The server runs as long as the Emacs process is active. ```emacs-lisp (server-start) ``` -------------------------------- ### Get Emacs Uptime (Lisp) Source: https://emacsdocs.org/docs/elisp/Processor-Run-Time Retrieves the elapsed wall-clock time since the Emacs instance started. Optionally formats the output using `format-seconds`. When called interactively, it displays the uptime in the echo area. ```emacs-lisp (emacs-uptime "&optional format") ``` -------------------------------- ### Configuring Gnus Select Method Source: https://emacsdocs.org/docs/emacs/Gnus-Startup This snippet illustrates how to configure the primary and secondary methods for Gnus to select news and mail servers. This is crucial for Gnus to connect to external services. ```emacs-lisp (setq gnus-select-method '(nnml "~/news")) (setq gnus-secondary-select-methods '((nnsp "news.example.com") (nnhony "support@example.com"))) ``` -------------------------------- ### Retrieving Invoking Key Sequence with Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Command-Loop-Info Shows how to get the key sequence that invoked the current command using the `this-command-keys` function. The example illustrates evaluating the function and its expected output. ```emacs-lisp (this-command-keys) ;; Now use C-u C-x C-e to evaluate that. ⇒ "^U^X^E" ``` -------------------------------- ### Move to Buffer Beginning (Emacs Lisp) Source: https://emacsdocs.org/docs/elisp/Buffer-End-Motion This Emacs Lisp code moves the cursor to the absolute beginning of the current buffer. It uses the `point-min` function to get the buffer's start position. ```Emacs Lisp (goto-char (point-min)) ``` -------------------------------- ### Start Emacs with Minimal Org Mode Configuration Source: https://emacsdocs.org/docs/org/Feedback This command launches Emacs with a minimal configuration, specified by `/path/to/minimal-org.el`. This is useful for isolating problems and determining if an issue lies within your customizations or Org mode itself. It's a practical step before reporting a bug. ```shell $ emacs -Q -l /path/to/minimal-org.el ``` -------------------------------- ### Emacs: Specify Characters by Octal Code Source: https://emacsdocs.org/docs/elisp/Character-Type Represents a character using its octal code. The sequence starts with `?\` followed by up to three octal digits. Characters up to octal code 777 can be specified. Example: `?\101` for `A`. ```Emacs Lisp ?\101 ``` ```Emacs Lisp ?\001 ``` ```Emacs Lisp ?\002 ``` -------------------------------- ### Emacs Lisp: Example of interactive-blink-matching-open function Source: https://emacsdocs.org/docs/elisp/Blinking This Lisp code defines an interactive function `interactive-blink-matching-open` that momentarily indicates the start of a parenthesized sexp before the current point. It temporarily modifies `blink-matching-paren-distance` and `blink-matching-paren` before calling `blink-matching-open`. ```emacs-lisp (defun interactive-blink-matching-open) "Indicate momentarily the start of parenthesized sexp before point." (interactive) (let ((blink-matching-paren-distance (buffer-size)) (blink-matching-paren t)) (blink-matching-open))) ``` -------------------------------- ### Load Emacs Lisp Library Source: https://emacsdocs.org/docs/emacs/Init-Examples Loads a specified Emacs Lisp library, typically named `foo`. Emacs searches for `foo.elc` or `foo.el` in directories listed in `load-path`. This is a fundamental way to include additional functionality into Emacs. The input is the library name. ```emacs-lisp (load "foo") ``` -------------------------------- ### Clone Magit Repository and Dependencies Source: https://emacsdocs.org/docs/magit/Installing-from-the-Git-Repository Clones the Magit repository into the specified Emacs site-lisp directory. Assumes dependencies like dash, transient, and with-editor are either installed via package manager or will be manually placed. ```shell $ git clone https://github.com/magit/magit.git ~/.emacs.d/site-lisp/magit $ cd ~/.emacs.d/site-lisp/magit ``` -------------------------------- ### Emacs Lisp: Split Window Example Source: https://emacsdocs.org/docs/elisp/Splitting-Windows Demonstrates splitting a live Emacs Lisp window and an internal window using the `split-window` function. Illustrates the creation of new live and internal windows and their arrangement. ```emacs-lisp ;; Initial frame with a single window W4 ;; (split-window W4) ;; This creates W5 below W4 and W3 as the parent. ;; Split the internal window W3 to the left ;; (split-window W3 nil 'left) ;; This creates a new window to the left of W3. ``` -------------------------------- ### Get Region Boundaries - Emacs Lisp Source: https://emacsdocs.org/docs/elisp/The-Region These functions return the start and end positions of the text region. `region-beginning` returns the smaller of point or mark, while `region-end` returns the larger. They signal errors if the mark is not set. ```emacs-lisp ;; Returns the position of the beginning of the region (as an integer). ;; This is the position of either point or the mark, whichever is smaller. (region-beginning) ;; Returns the position of the end of the region (as an integer). ;; This is the position of either point or the mark, whichever is larger. (region-end) ``` -------------------------------- ### Get Minimum Accessible Point in Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Point The `point-min` function returns the minimum accessible position for the point in the current buffer. Typically, this is 1, but it changes to the start of a narrowed region if narrowing is active. ```emacs-lisp (point-min) ``` -------------------------------- ### Emacs Lisp: Get Current Left Margin Source: https://emacsdocs.org/docs/elisp/Margins The `current-left-margin` function retrieves the effective left margin for filling text around the current point. It considers both the `left-margin` variable and the `left-margin` property of the character at the start of the line. ```emacs-lisp ;; Example: Print the current left margin value (message "Current left margin: %d" (current-left-margin)) ``` -------------------------------- ### Move Mouse to Point in Emacs Lisp Source: https://emacsdocs.org/docs/elisp/Coordinates-and-Windows Provides a concise example of moving the mouse pointer to the current point (cursor position) in the selected window. It utilizes `window-absolute-pixel-position` to get the coordinates and `set-mouse-absolute-pixel-position` to perform the move. ```Emacs Lisp (let ((position (window-absolute-pixel-position))) (set-mouse-absolute-pixel-position (car position) (cdr position))) ``` -------------------------------- ### Get Screen Width in Millimeters (Emacs Lisp) Source: https://emacsdocs.org/docs/elisp/Display-Feature-Testing Returns the physical width of the screen in millimeters. If the system cannot provide this information, it returns nil. For multi-monitor setups, this refers to the total width of all associated monitors. ```Emacs Lisp (display-mm-width &optional display) ``` -------------------------------- ### Emacs: Describe Package Documentation Source: https://emacsdocs.org/docs/emacs/Help-Summary Displays documentation for a specified Emacs package. This command, `describe-package`, is essential for understanding the functionality and usage of installed or available packages. ```emacs-lisp (global-set-key (kbd "C-h P") 'describe-package) ``` -------------------------------- ### Get Screen Height in Millimeters (Emacs Lisp) Source: https://emacsdocs.org/docs/elisp/Display-Feature-Testing Returns the physical height of the screen in millimeters. If the system cannot provide this information, it returns nil. For multi-monitor setups, this refers to the total height of all associated monitors. ```Emacs Lisp (display-mm-height &optional display) ``` -------------------------------- ### Emacs Site Startup and Default Init Files Source: https://emacsdocs.org/docs/emacs/Init-File Explains the roles of site startup files (site-start.el) and default init files (default.el). site-start.el is loaded before the user's init file, while default.el is loaded after, unless inhibited. ```Emacs Lisp ;; site-start.el is loaded before the user's init file. ;; default.el is loaded after the user's init file, unless inhibit-default-init is set. ;; To inhibit default.el loading: (setq inhibit-default-init t) ``` -------------------------------- ### Refresh Emacs Package List Source: https://emacsdocs.org/docs/magit/Installing-from-Melpa This command refreshes the local package list in Emacs. It ensures that Emacs is aware of the latest available packages from the configured archives. This step is necessary after modifying package archive configurations. ```emacs-lisp M-x package-refresh-contents RET ``` -------------------------------- ### Start Emacs with Default Configuration Source: https://emacsdocs.org/docs/emacs/Checklist This command-line option starts Emacs without loading any personal initialization files or customizations. This is recommended when reporting bugs to ensure the issue is reproducible in a standard environment, bypassing potential conflicts from user configurations. ```bash emacs -Q ``` -------------------------------- ### Email: Example 'To' Field with Continuation Line Source: https://emacsdocs.org/docs/emacs/Mail-Headers Illustrates the correct formatting for an email 'To' header field that spans multiple lines. Continuation lines start with whitespace and are treated as part of the field's content. ```text To: foo@example.net, this@example.net, bob@example.com ```