Notes on emacs
(defun zoom-frm-in ()
(interactive)
(zoom-frm '+))
(defun zoom-frm-out ()
(interactive)
(zoom-frm '-))
(defun zoom-frm (op)
(let* ((frm (selected-frame))
(curr-height (face-attribute 'default :height frm))
(new-height (funcall op curr-height 10)))
(set-face-attribute 'default frm :height new-height)))
(global-set-key (kbd "<C-S-wheel-down>") 'zoom-frm-in)
(global-set-key (kbd "<C-S-wheel-up>") 'zoom-frm-out)
(global-set-key (kbd "<C-wheel-down>") 'text-scale-increase)
(global-set-key (kbd "<C-wheel-up>") 'text-scale-decrease)
(global-set-key (kbd "C-c i") 'my-jump-to-init)
(defun my-jump-to-init ()
(interactive)
(find-file "~/.emacs"))
(apply 'set-face-attribute 'default nil
(pcase system-type
('darwin '(:family "Menlo" :height 150))
('windows-nt '(:family "Consolas" :height 100))
(_ nil)))
(defun insdate-insert-date-from (&optional days)
"Insert date that is DAYS from current."
(interactive "P")
(let ((date (calendar-current-date))
(days (if days days 0)))
(insert
(calendar-date-string
(calendar-gregorian-from-absolute
(+ (calendar-absolute-from-gregorian date) days))))))
(global-set-key (kbd "C-c d") 'insdate-insert-date-from)
On macos, a convenient install is to take output of
as arguments to brew install emacs
.
One can use Automator.app
to create a convenient emacsclient.app
.
At the moment, I just have the contents,
in a “Run Shell Script” block. Seems to work.
This also seems to work with Hammerspoon for me at the moment, there I have items such as
hs.hotkey.bind(mash, 'c', emacsclient)
emacsclient = function()
hs.application.launchOrFocus("emacsclient.app")
hs.applescript("tell application \"Emacs\" to activate")
end
from http://article.gmane.org/gmane.emacs.vim-emulation/980 and https://github.com/emacs-evil/evil/issues/26
(define-key evil-insert-state-map "j" #'cofi/maybe-exit)
(evil-define-command cofi/maybe-exit ()
:repeat change
(interactive)
(let ((modified (buffer-modified-p)))
(insert "j")
(let ((evt (read-event (format "Insert %c to exit insert state" ?k)
nil 0.5)))
(cond
((null evt) (message ""))
((and (integerp evt) (char-equal evt ?k))
(delete-char -1)
(set-buffer-modified-p modified)
(push 'escape unread-command-events))
(t (setq unread-command-events (append unread-command-events
(list evt))))))))