Skip to content

Instantly share code, notes, and snippets.

@failable
Created August 31, 2022 08:25
Show Gist options
  • Save failable/012d5cacece556e6e9823cefac847ed5 to your computer and use it in GitHub Desktop.
Save failable/012d5cacece556e6e9823cefac847ed5 to your computer and use it in GitHub Desktop.
Observed outputs

Without evaluating the mentions two lines of script

What does Emacs report when you do C-h k Command+x?

;9u is inserted into the buffer.

What does Emacs report when you do C-h k Option+x?

“` M-x runs the command execute-extended-command (found in global-map), which is an interactive byte-compiled Lisp function in ‘simple.el’.

It is bound to <execute>, <menu> and M-x.

(execute-extended-command PREFIXARG &optional COMMAND-NAME TYPED)

Read a command name, then read the arguments and call the command. To pass a prefix argument to the command you are invoking, give a prefix argument to ‘execute-extended-command’.

This function is for interactive use only; in Lisp code use ‘command-execute’ instead. Probably introduced at or before Emacs version 28.1.

[back] “`

In scratch buffer, do C-q Command+x. What do you see?

`^[[120;9u` is inserted into the buffer.

In scratch buffer, do C-q Option+x. What do you see?

`^[x` is inserted into the buffer.

With evaluating the mentions two lines of script

What does Emacs report when you do C-h k Command+x?

;9u is inserted into the buffer.

What does Emacs report when you do C-h k Option+x?

s-x runs the command kill-region (found in global-map), which is an interactive byte-compiled Lisp function in ‘simple.el’.

It is bound to C-w, s-x and S-<delete>. It can also be invoked from the menu: Edit → Cut

(kill-region BEG END &optional REGION)

Kill (“cut”) text between point and mark. This deletes the text from the buffer and saves it in the kill ring. The command C-y can retrieve it from there. (If you want to save the region without killing it, use M-w.)

If you want to append the killed region to the last killed text, use C-M-w before C-w.

Any command that calls this function is a “kill command”. If the previous command was also a kill command, the text killed this time appends to the text killed last time to make one entry in the kill ring.

The killed text is filtered by ‘filter-buffer-substring’ before it is saved in the kill ring, so the actual saved text might be different from what was killed.

If the buffer is read-only, Emacs will beep and refrain from deleting the text, but put the text in the kill ring anyway. This means that you can use the killing commands to copy text from a read-only buffer.

Lisp programs should use this function for killing text. (To delete text, use ‘delete-region’.) Supply two arguments, character positions BEG and END indicating the stretch of text to be killed. If the optional argument REGION is non-nil, the function ignores BEG and END, and kills the current region instead. Interactively, REGION is always non-nil, and so this command always kills the current region.

Probably introduced at or before Emacs version 22.1.

[back]

In scratch buffer, do C-q Command+x. What do you see?

`^[[120;9u` is inserted into the buffer.

In scratch buffer, do C-q Option+x. What do you see?

`^[x` is inserted into the buffer.

@failable
Copy link
Author

  • Post-mortem

** C-h k command + x

M-[ 1 2 0 is undefined is output in *Messages*

** C-q command + x

^[[120;9u is inserted into the buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment