Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Configurable automation + hooks called with application information

License

NotificationsYou must be signed in to change notification settings

zachcurry/emacs-anywhere

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inspired bycknadler/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

OpenSystem Preferences and navigate tokeyboard > shortcuts > Services.Check the box beside "Emacs Anywhere", click "Add Shortcut" and key a shortcut.

Linux

In order to useEmacs Anywhere, you must useXorg as your window manager. You canswitch your window manager inUbuntu by going to the login screen, clicking the cog icon, and selectingXorg.

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 forEmacs 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 thebuffer, switch focus to the window from step two and paste the buffers content into the text input.

Environment

TheEA_EDITOR environment variable can be used to override the wayemacsclient is run. For example, you could put the following statement intoyour.bash_profile.

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

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

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

You can prefixemacsclient with it's path ifEmacs Anywhere can't findit in yourPATH environment variable.

Commands

CommandDescription
toggle-eaIf toggled to the "off" state,Emacs Anywhere will do nothing when the frame is deleted.

Variables

VariableDescription
ea-onBoolean wheret andnil denote the "on" and "off** states ofEmacs Anywhere, respectively. The default value ist
ea-copyIf true, the "*Emacs Anywhere*" buffer will be copied to clipboard. The default value ist
ea-pasteIf true,Emacs Anywhere will paste to the window from which it was launched. The default value ist
ea-app-nameThe name of the application process for the window from whichEmacs Anywhere was launched.
ea-window-titleThe title of the window from whichEmacs Anywhere was launched.
ea-xThe x-coordinate of the upper-left corner of the window from whichEmacs Anywhere was launched.
ea-yThe y-coordinate of the upper-left corner of the window from whichEmacs Anywhere was launched.
ea-widthThe width of the window from whichEmacs Anywhere was launched.
ea-heightThe height of the window from whichEmacs Anywhere was launched.

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

Hooks

HookFunction SignatureDescription
ea-popup-hook(app-name window-title x y w h)Functions run after anEmacs Anywhere session starts.

Examples

;; Define a function or use a lambda of the same signature(defunpopup-handler (app-namewindow-titlexywh);; 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 theapplication name or window title...

(defungithub-conversation-p (window-title)  (or (string-match-p"Pull Request" window-title)      (string-match-p"Issue" window-title);; ...      ))(defunpopup-handler (app-namewindow-titlexywh);; 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...

(defunpopup-handler (app-namewindow-titlexywh)  (set-frame-position (selected-frame) x (+ y (- h400)))  (unless (zerop w)    (set-frame-size (selected-frame) w400t));; ...  )

...or configure automation settings

(defunpopup-handler (app-namewindow-titlexywh)  (when (equal app-name"Terminal");; Tell Emacs Anywhere not to paste if launched from Terminal    (setq ea-pastenil));; ...  )

Update

~/.emacs_anywhere/update

Uninstall

~/.emacs_anywhere/uninstall

Todo

  • Windows

Contributing

TBD

License

MIT

Copyright © 2018, Zach Curry, All rights reserved.

About

Configurable automation + hooks called with application information

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors9


[8]ページ先頭

©2009-2025 Movatter.jp