EmacsMacPluginModule
is a macOS plugin for Emacs that implements dynamic cursor effects and more, exclusively for macOS. This plugin leverages module-load
to load a .dylib
written in Swift, facilitating interaction between Emacs and Swift. It uses the implementation approach from SavchenkoValeriy/emacs-swift-module and draws on xenodium/EmacsMacOSModule for applying these techniques. The cursor animation effects are inspired by the manateelazycat/holo-layer project.
- Emacs
- Swift and Swift Package Manager
- macOS
-
Clone the repository to your Emacs
site-lisp
directory:git clone https://github.com/happyo/EmacsMacPluginModule.git ~/.emacs.d/site-lisp/EmacsMacPluginModule
-
Add the following code to your Emacs configuration file (
~/.emacs.d/init.el
or~/.emacs
):(add-to-list 'load-path "~/.emacs.d/site-lisp/EmacsMacPluginModule") (require 'mac-plugin) ;; Need disable tool-bar ;;(when (fboundp 'tool-bar-mode) ;; (tool-bar-mode -1)) ;; If the downloaded repository directory is different from the above, you can specify the actual directory of the repository with macos-project-root (mac-plugin-load-release) (atmosphere-enable) (mac-plugin-set-cursor-color "#fcc800") (mac-plugin-set-shadow-opacity 1.0)
-
Manually invoke M-x in Emacs and execute the command to build the dylib, which only needs to be done once:
(macos-module-build-release)
Alternatively, you can manually execute the following command after navigating to the repository directory:
swift build -c release
Load the module in Emacs:
(mac-plugin-load-release)
Enable cursor animation effects:
(atmosphere-enable)
Set the cursor color (e.g., set to #fcc800
):
(mac-plugin-set-cursor-color "#fcc800")
Set the shadow opacity (e.g., set to 1
):
(mac-plugin-set-shadow-opacity 1)
mac-plugin-cursor-block-commands
Customization
This option allows you to specify a list of Emacs commands during which cursor animations should be suppressed. This feature is especially useful for preventing animations triggered by routine commands, such as typing, which typically do not require visual feedback. The default configuration is as follows and generally does not need to be modified:
(setq mac-plugin-cursor-block-commands '("watch-other-window-up" "watch-other-window-down" "self-insert-command"))
We welcome issues and requests, as well as pull requests to contribute your code!
This project is licensed under the GPL License. See the LICENSE file for details.
We plan to add more macOS plugins to further enhance Emacs functionality. If you have any suggestions or features you would like to see, please let us know.