I have the following in my .emacs:
(lambda (arg) (interactive "P")
(let ((separator (pcase arg
(format-time-string (concat "%Y" separator "%m&...
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 ...
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:
'(self-insert-command next-line previous-line right-char left-char
I think it's a bug.
If you don't use that alist as the KEYMAP arg, but instead you create a keymap, assign it to a variable, use define-key with (kbd "C-n") etc., and use that variable as the KEYMAP arg, then it works.
Please consider using M-x report-emacs-bug, to report this.
(setq toto-map (make-sparse-keymap))
(defun foo () "..." (...
C-u invokes the function universal-argument, and you want
to ensure that eval-last-sexp is called as if you invoked it
interactively, which is done with call-interactively. You can
simulate universal-argument by let-binding current-prefix-arg.
Putting that all together:
(global-set-key (kbd "C-c c") (lambda ()
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.
Here's a function that manufactures a filename out of today's time stamp and writes the file out:
(defun write-file-timestamp ()
(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 ...
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 ...
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 ...
I figured out that I should add the following code to my .emacs file:
(defvar in-xxx-message nil)
(defun xxx-message (&rest args)
(let ((result (apply 'format args)))
(if (and (not in-xxx-message)
(or (string-match "<Scroll_Lock>" result)
(string-match "is ...
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
One solution could be to advise the define-key function and check which key is being bound against a block list:
(defun define-key-filter (define-key &rest args)
(if (cl-member (nth 1 args) define-key-block-list :key 'kbd :test 'equal)
(message "Blocked %s from being bound" (key-...
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...
(defun my-clear-shell ()
(message "I am some other function"))
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).
(defun my-ivy-toggle-help/tab (&rest _args)
"Either describe current symbol or perform partial complete.
If last command is `self'...