{"id":13395264,"url":"https://github.com/zachcurry/emacs-anywhere","last_synced_at":"2025-04-12T17:40:51.293Z","repository":{"id":48911312,"uuid":"122137283","full_name":"zachcurry/emacs-anywhere","owner":"zachcurry","description":"Configurable automation + hooks called with application information","archived":false,"fork":false,"pushed_at":"2021-07-05T22:38:34.000Z","size":1391,"stargazers_count":1080,"open_issues_count":29,"forks_count":49,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-04-03T19:14:32.060Z","etag":null,"topics":["emacs","emacs-lisp","keyboard-shortcuts","linux","osx"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zachcurry.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-20T00:12:23.000Z","updated_at":"2025-03-24T04:43:32.000Z","dependencies_parsed_at":"2022-08-27T06:21:08.450Z","dependency_job_id":null,"html_url":"https://github.com/zachcurry/emacs-anywhere","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcurry%2Femacs-anywhere","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcurry%2Femacs-anywhere/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcurry%2Femacs-anywhere/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachcurry%2Femacs-anywhere/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachcurry","download_url":"https://codeload.github.com/zachcurry/emacs-anywhere/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248607568,"owners_count":21132565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs","emacs-lisp","keyboard-shortcuts","linux","osx"],"created_at":"2024-07-30T17:01:48.219Z","updated_at":"2025-04-12T17:40:51.269Z","avatar_url":"https://github.com/zachcurry.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://imgur.com/KEvaVTP.jpg\" width=\"250px\"\u003e\u003c/img\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eInspired by\u003c/em\u003e\n  \u003ca href=\"https://github.com/cknadler/vim-anywhere\"\u003ecknadler/vim-anywhere\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://thumbs.gfycat.com/HardtofindBelatedAtlanticsharpnosepuffer-size_restricted.gif\"\n  width=\"500px\"\u003e\n  \u003c/img\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eEmacs Anywhere\u003c/strong\u003e provides configurable automation and hooks containing window info, so you can bust moves anywhere in a quick, customizable fashion.\n\u003c/p\u003e\n\n**Table of Contents**\n- [Install](#install)\n    - [OS X](#os-x)\n    - [Linux](#install)\n- [Usage](#usage)\n    - [Try It](#try-it)\n    - [Environment](#environment)\n    - [Commands](#commands)\n    - [Variables](#variables)\n    - [Hooks](#hooks)\n    - [Examples](#examples)\n    - [Update](#update)\n    - [Uninstall](#uninstall)\n- [Todo](#todo)\n- [Contributing](#contributing)\n- [License](#license)\n\n# Install\n## OS X\n``` \ncurl -fsSL https://raw.github.com/zachcurry/emacs-anywhere/master/install | bash\n```\nOpen **System Preferences** and navigate to **keyboard \u003e shortcuts \u003e Services**.\nCheck the box beside \"Emacs Anywhere\", click \"Add Shortcut\" and key a shortcut.\n\n## Linux\n\u003eIn order to use **Emacs Anywhere**, you must use **Xorg** as your window manager. You can **switch** your window manager in **Ubuntu** by going to the login screen, clicking the cog icon, and selecting **Xorg**.\n\n### dependencies\nInstall these dependencies as needed\n- **xclip**\n- **xdotool**\n- **xwininfo**\n```\nsudo apt-get install \u003cdependency\u003e\n```\n\n### Install\n``` \ncurl -fsSL https://raw.github.com/zachcurry/emacs-anywhere/master/install | bash\n```\nCreate a keyboard shortcut to run `~/.emacs_anywhere/bin/run`.\n\n## Windows\nTBD\n\n# Usage\n## Try It\n1. Make sure your Emacs server is running. You can start the server like this\n```\nemacs --daemon\n```\n2. Focus an application window's text input. A text area in your browser will do.\n3. Key the keyboard shortcut you've chosen for **Emacs Anywhere** \n4. Write some text\n5. Delete the frame (`C-x 5 0`, or `:q` if you use evil-mode).\n**Emacs Anywhere** will copy the text from the buffer \"\\*Emacs Anywhere\\*\" to clipboard, delete the\nbuffer, switch focus to the window from step two and paste the buffers content into the text input.\n\n## Environment\nThe `EA_EDITOR` environment variable can be used to override the way\n**emacsclient** is run. For example, you could put the following statement into\nyour `.bash_profile`.\n```\nexport EA_EDITOR='emacsclient -a \"\" -c'\n```\nWith the environment variable set, the invocation will look like this under the\nhood\n```\nemacsclient -a \"\" -c -e \u003celisp code\u003e\n```\nYou can prefix **emacsclient** with it's path if **Emacs Anywhere** can't find\nit in your `PATH` environment variable.\n\n## Commands\n| Command       | Description                                                                                  |\n| ----          | -----------                                                                                  |\n| **toggle-ea** | If toggled to the \"off\" state, **Emacs Anywhere** will do nothing when the frame is deleted. |\n\n## Variables\n| Variable            | Description                                                                                                                 |\n| --------            | -----------                                                                                                                 |\n| **ea-on**           | Boolean where `t` and `nil` denote the \"on\" and \"off** states of **Emacs Anywhere**, respectively. The default value is `t` |\n| **ea-copy**         | If true, the \"\\*Emacs Anywhere\\*\" buffer will be copied to clipboard. The default value is `t` |\n| **ea-paste**        | If true, **Emacs Anywhere** will paste to the window from which it was launched. The default value is `t`                   |\n| **ea-app-name**     | The name of the application process for the window from which **Emacs Anywhere** was launched.                              |\n| **ea-window-title** | The title of the window from which **Emacs Anywhere** was launched.                                                         |\n| **ea-x**            | The x-coordinate of the upper-left corner of the window from which **Emacs Anywhere** was launched.                         |\n| **ea-y**            | The y-coordinate of the upper-left corner of the window from which **Emacs Anywhere** was launched.                         |\n| **ea-width**        | The width of the window from which **Emacs Anywhere** was launched.                                                         |\n| **ea-height**       | The height of the window from which **Emacs Anywhere** was launched.                                                        |\n\n\u003eNote: In OS X the window title, position and size information\n\u003eis only available if the application is has accessiblity permissions enabled.\n\n## Hooks\n| Hook              | Function Signature              | Description                                               |\n| ----              | ------------------              | -----------                                               |\n| **ea-popup-hook** | (app-name window-title x y w h) | Functions run after an **Emacs Anywhere** session starts. |\n\n## Examples\n```elisp\n;; Define a function or use a lambda of the same signature\n(defun popup-handler (app-name window-title x y w h)\n  ;; do stuff\n  )\n\n;; Hook your function\n(add-hook 'ea-popup-hook 'popup-handler)\n```\nIn your hook function you can do things like set the major mode based on the\napplication name or window title...\n```elisp\n(defun github-conversation-p (window-title)\n  (or (string-match-p \"Pull Request\" window-title)\n      (string-match-p \"Issue\" window-title)\n      ;; ...\n      ))\n\n(defun popup-handler (app-name window-title x y w h)\n  ;; set major mode\n  (cond\n    ((github-conversation-p window-title) (gfm-mode))\n    ;; ...\n    (t (markdown-mode)) ; default major mode\n    ))\n```\n...or set the frame size and position to fit the bottom 400px of the window...\n```elisp\n(defun popup-handler (app-name window-title x y w h)\n  (set-frame-position (selected-frame) x (+ y (- h 400)))\n  (unless (zerop w)\n    (set-frame-size (selected-frame) w 400 t))\n  ;; ...\n  )\n```\n...or configure automation settings\n```elisp\n(defun popup-handler (app-name window-title x y w h)\n  (when (equal app-name \"Terminal\")\n    ;; Tell Emacs Anywhere not to paste if launched from Terminal\n    (setq ea-paste nil))\n  ;; ...\n  )\n```\n\n## Update\n```\n~/.emacs_anywhere/update\n```\n\n## Uninstall\n```\n\n~/.emacs_anywhere/uninstall\n```\n\n# Todo\n- Windows\n\n# Contributing\nTBD\n\n# License\nMIT\n\nCopyright © 2018, Zach Curry, All rights reserved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachcurry%2Femacs-anywhere","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachcurry%2Femacs-anywhere","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachcurry%2Femacs-anywhere/lists"}