5

I have the following in my .emacs: ;; date (global-set-key "\C-\M-d" (lambda (arg) (interactive "P") (let ((separator (pcase arg ('(4) "-") (0 "/") (_ "")))) (insert (format-time-string (concat "%Y" separator "%m&...


4

M-S-Z would mean Meta + Shift + Z. But Z (uppercase) is itself what Emacs uses for Shift> + z. There's likely no key on your keyboard corresponding to S-Z. That's why you say it doesn't work. If you use C-h b you'll find your key binding listed OK. And if you use C-h w zap-up-to-char-backward you'll see that it says it's bound to M-S-Z. The problem is ...


3

You can see what you've done with C-h l (aka M-x view-lossage). As for putting a kind of "safety fence", it should be fairly easy to do, by placing an appropriate function of pre-command-hook. You could start with something like: (defvar my-fence-let-pass '(self-insert-command next-line previous-line right-char left-char handle-select-...


2

You could create a minor mode that binds the arrow keys to the functions you want. Then your 'special' key only needs to toggle the minor mode on and off. You would bind the 'special' key in your major mode map, and make the minor mode buffer-local, so it would only change the behaviour in files in that major mode.


2

Here's a function that manufactures a filename out of today's time stamp and writes the file out: (defun write-file-timestamp () (interactive) (let ((fname (format-time-string "%Y-%m-%d.org"))) (write-file fname t))) The t argument in the write-file call asks for confirmation if the file exists already: you can omit it if you don't ...


1

The concat function takes a list of SEQs and returns a string. To get the string that describes your key sequence, you would simply write (concat "C-" keypress) Use the kbd function to return the actual key representation. I think you may end up with something like the following (defun my/keypress-definer (keypress) (define-key my-key-map (...


1

With a sun keyboard, for me, it works quite straight forward. (global-set-key (kbd "<XF86Paste>") 'yank) (global-set-key (kbd "<XF86Copy>") 'kill-ring-save) (global-set-key (kbd "<XF86Cut>") 'kill-region) For the terminal integration, that's related to the OS itself and how it manage the keyboard input, this ...


1

First: a variable can not have two different values at the same time. (setq smerge-command-prefix "\C-cv") (setq smerge-command-prefix "\C-c\C-v") Second: to use this prefix the above variable has to be set before smerge-mode is loaded. So either ensure that (setq smerge-command-prefix "\C-cv") is eval'd before you use (or ...


1

I figured out that I should add the following code to my .emacs file: (defvar in-xxx-message nil) (defun xxx-message (&rest args) (cond (args (let ((result (apply 'format args))) (if (and (not in-xxx-message) (or (string-match "<Scroll_Lock>" result) (string-match "is ...


1

The following setting makes the left alt/option key behave like a system default key (so that one may use special symbols, foreign language characters, and so forth), and the right alt/opion key behaves as the Meta key: (setq ns-alternate-modifier 'none ns-right-alternate-modifier 'meta)


1

The keybindings created with :bind expect a function name (not sure how lambdas are expanded) so you can define a named function in the :init clause of use-package which should work as expected... (use-package eshell :after esh-mode :init (defun my-clear-shell () (interactive) (message "I am some other function")) :bind (:map ...


1

I have adapted your answer and extend it to toggle Help window (helpful when we want it gone from the screen without leaving the minibuffer) and perform Ivy's native TAB (albeit with one more key stroke). ;;;###autoload (defun my-ivy-toggle-help/tab (&rest _args) "Either describe current symbol or perform partial complete. If last command is `self'...


Only top voted, non community-wiki answers of a minimum length are eligible