All Projects → zachcurry → Emacs Anywhere

zachcurry / Emacs Anywhere

Licence: mit
Configurable automation + hooks called with application information

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Emacs Anywhere

Dotfiles
👾 ~/
Stars: ✭ 91 (-90.08%)
Mutual labels:  osx, emacs
Emacs Everywhere
System-wide popup Emacs windows for quick edits
Stars: ✭ 108 (-88.22%)
Mutual labels:  keyboard-shortcuts, emacs
Paredit Cheatsheet
A new, scalable source document for the Paredit Cheatsheet available as a png on the Emacs wiki
Stars: ✭ 48 (-94.77%)
Mutual labels:  keyboard-shortcuts, emacs
Powerkey
Remap your Macbook's power key to Forward Delete
Stars: ✭ 212 (-76.88%)
Mutual labels:  keyboard-shortcuts, osx
Awesome Osx
📦 Awesome stuff for OSX
Stars: ✭ 54 (-94.11%)
Mutual labels:  keyboard-shortcuts, osx
Vim Anywhere
Use Vim everywhere you've always wanted to
Stars: ✭ 3,295 (+259.32%)
Mutual labels:  keyboard-shortcuts, osx
Clojure Mode
Emacs support for the Clojure(Script) programming language
Stars: ✭ 795 (-13.3%)
Mutual labels:  emacs
Traypingapp
📡 OSX tray application showing DNS and ping latency
Stars: ✭ 5 (-99.45%)
Mutual labels:  osx
Awesome Emacs
A community driven list of useful Emacs packages, libraries and others.
Stars: ✭ 6,732 (+634.13%)
Mutual labels:  emacs
Osx And Ios Security Awesome
OSX and iOS related security tools
Stars: ✭ 765 (-16.58%)
Mutual labels:  osx
Nepali Romanized Pro
Nepali Romanized Keyboard Layout with installer for macOS
Stars: ✭ 18 (-98.04%)
Mutual labels:  osx
Chronometer
A Chronometer for GNU Emacs
Stars: ✭ 6 (-99.35%)
Mutual labels:  emacs
Stronghold
Easily configure macOS security settings from the terminal.
Stars: ✭ 813 (-11.34%)
Mutual labels:  osx
Nswindowstyles
A showcase of the many different styles of windows possible with NSWindow on macOS
Stars: ✭ 801 (-12.65%)
Mutual labels:  osx
Starscream
Websockets in swift for iOS and OSX
Stars: ✭ 7,105 (+674.81%)
Mutual labels:  osx
Acejump
🅰️ single character search, select, and jump
Stars: ✭ 786 (-14.29%)
Mutual labels:  emacs
Yasnippet Snippets
a collection of yasnippet snippets for many languages
Stars: ✭ 831 (-9.38%)
Mutual labels:  emacs
Sly
Sylvester the Cat's Common Lisp IDE
Stars: ✭ 766 (-16.47%)
Mutual labels:  emacs
Liko 12
LIKO-12 is an open source fantasy computer made using LÖVE.
Stars: ✭ 811 (-11.56%)
Mutual labels:  osx
Org Super Agenda
Supercharge your Org daily/weekly agenda by grouping items
Stars: ✭ 829 (-9.6%)
Mutual labels:  emacs

Inspired by cknadler/vim-anywhere

Emacs Anywhere provides configurable automation and hooks containing window info, so you can bust moves anywhere in a quick, customizable fashion.

Table of Contents

Install

OS X

curl -fsSL https://raw.github.com/zachcurry/emacs-anywhere/master/install | bash

Open System Preferences and navigate to keyboard > shortcuts > Services. Check the box beside "Emacs Anywhere", click "Add Shortcut" and key a shortcut.

Linux

In 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.

dependencies

Install these dependencies as needed

  • xclip
  • xdotool
  • xwininfo
sudo apt-get install <dependency>

Install

curl -fsSL https://raw.github.com/zachcurry/emacs-anywhere/master/install | bash

Create a keyboard shortcut to run ~/.emacs_anywhere/bin/run.

Windows

TBD

Usage

Try It

  1. Make sure your Emacs server is running. You can start the server like this
emacs --daemon
  1. Focus an application window's text input. A text area in your browser will do.
  2. Key the keyboard shortcut you've chosen for Emacs Anywhere
  3. Write some text
  4. Delete the frame (C-x 5 0, or :q if you use evil-mode). Emacs Anywhere will copy the text from the buffer "*Emacs Anywhere*" to clipboard, delete the buffer, switch focus to the window from step two and paste the buffers content into the text input.

Environment

The EA_EDITOR environment variable can be used to override the way emacsclient is run. For example, you could put the following statement into your .bash_profile.

export EA_EDITOR='emacsclient -a "" -c'

With the environment variable set, the invocation will look like this under the hood

emacsclient -a "" -c -e <elisp code>

You can prefix emacsclient with it's path if Emacs Anywhere can't find it in your PATH environment variable.

Commands

Command Description
toggle-ea If toggled to the "off" state, Emacs Anywhere will do nothing when the frame is deleted.

Variables

Variable Description
ea-on Boolean where t and nil denote the "on" and "off** states of Emacs Anywhere, respectively. The default value is t
ea-copy If true, the "*Emacs Anywhere*" buffer will be copied to clipboard. The default value is t
ea-paste If true, Emacs Anywhere will paste to the window from which it was launched. The default value is t
ea-app-name The name of the application process for the window from which Emacs Anywhere was launched.
ea-window-title The title of the window from which Emacs Anywhere was launched.
ea-x The x-coordinate of the upper-left corner of the window from which Emacs Anywhere was launched.
ea-y The y-coordinate of the upper-left corner of the window from which Emacs Anywhere was launched.
ea-width The width of the window from which Emacs Anywhere was launched.
ea-height The height of the window from which Emacs Anywhere was launched.

Note: In OS X the window title, position and size information is only available if the application is has accessiblity permissions enabled.

Hooks

Hook Function Signature Description
ea-popup-hook (app-name window-title x y w h) Functions run after an Emacs Anywhere session starts.

Examples

;; Define a function or use a lambda of the same signature
(defun popup-handler (app-name window-title x y w h)
  ;; do stuff
  )

;; Hook your function
(add-hook 'ea-popup-hook 'popup-handler)

In your hook function you can do things like set the major mode based on the application name or window title...

(defun github-conversation-p (window-title)
  (or (string-match-p "Pull Request" window-title)
      (string-match-p "Issue" window-title)
      ;; ...
      ))

(defun popup-handler (app-name window-title x y w h)
  ;; set major mode
  (cond
    ((github-conversation-p window-title) (gfm-mode))
    ;; ...
    (t (markdown-mode)) ; default major mode
    ))

...or set the frame size and position to fit the bottom 400px of the window...

(defun popup-handler (app-name window-title x y w h)
  (set-frame-position (selected-frame) x (+ y (- h 400)))
  (unless (zerop w)
    (set-frame-size (selected-frame) w 400 t))
  ;; ...
  )

...or configure automation settings

(defun popup-handler (app-name window-title x y w h)
  (when (equal app-name "Terminal")
    ;; Tell Emacs Anywhere not to paste if launched from Terminal
    (setq ea-paste nil))
  ;; ...
  )

Update

~/.emacs_anywhere/update

Uninstall


~/.emacs_anywhere/uninstall

Todo

  • Windows

Contributing

TBD

License

MIT

Copyright © 2018, Zach Curry, All rights reserved.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].