Stefan
  • Member for 7 years, 3 months
  • Last seen more than a month ago
Strange elisp byte-compiler warning about unused variables
Accepted answer
10 votes

You don't use i and that's what the byte-compiler tells you. To let the byte-compiler know that you're aware of the fact that the variable is unused, give it a name that starts with an underscore. E....

View answer
Using package.el to install and update but use-package for loading and configuring
Accepted answer
10 votes

IIUC what you want to do is: (package-initialize t) Note the t argument, which is the key to your happiness here since it will (or should, at least) initialize package.el without activating all the ...

View answer
Three-characters comment syntax
Accepted answer
10 votes

AFAIK the example you give are actually 2-char comment delimiters, except that depending on the 3rd character, these comments are treated in different ways (but always as comments in the sense that ...

View answer
How to use while-no-input?
Accepted answer
10 votes

Indeed, there is no support for resumption. Of course, the body of while-no-input can do regular "checkpoints" so as to know where to start next time. But the original motivation for this ...

View answer
How to automatically remove a hook provided by a minor mode after disabling that mode?
Accepted answer
9 votes

The minor mode's hook is called both when activating and deactivating the minor mode, so how 'bout (add-hook 'my-minor-mode-name-hook (lambda () (if my-minor-mode-name ...

View answer
Are local nested functions possible in elisp?
Accepted answer
9 votes

You can also do it without resorting to cl-lib as follows: (defun my-fn (x y) (let ((my-local-fn (lambda (a b) (message "%S" (- a b))))) (funcall my-local-fn x y) (funcall my-local-fn y x))...

View answer
Copy text from Emacs to OS X clipboard
9 votes

If you use Emacs "the normal way" (i.e. as a GUI application), then it should already do that by default. If you use Emacs inside a terminal emulator, then indeed it doesn't know how to do that by ...

View answer
How to debug errors in sentinels and during font-lock
Accepted answer
9 votes

For process sentinels, I don't think there's a good reason. IOW I think it's just a missing feature, so I suggest you M-x report-emacs-bug. For font-lock, the issue is more tricky because what ...

View answer
Defun inside let with lexical binding gives byte-compile warning "the function is not known to be defined"
Accepted answer
9 votes

The byte-compiler's way to decide whether a function will be defined or not is very "naive" and gets fooled even in your "obvious" case. But you can write it in a way that lets the compiler understand ...

View answer
Most performant matching of "any char"
Accepted answer
9 votes

In Emacs's regexps, . does not match all characters. It is a synonym of [^\n]. So the reason for using [\0-\377[:nonascii:]] is when you want to match "any char, even a newline". W.r.t overflowing ...

View answer
How to associate more than one file extension with a given mode in `use-package`
Accepted answer
9 votes

Use :mode "\\.jsx?\\'" Remember: all those backslashes are there because it's a regexp, so you really want to take advantage of it when you can, otherwise you're just suffering through those ...

View answer
Remember permission to execute "risky" local variables
9 votes

Emacs should offer (and normally does offer) the option to accept and remember the choice for later sessions. I suggest you M-x report-emacs-bug about this missing choice in your case. In the mean ...

View answer
How to insert invalid UTF-8 sequence
9 votes

C-q 377 RET inserts the character with octal code 377 (aka LATIN SMALL LETTER Y WITH DIAERESIS). If you want to insert a byte instead of a character, you can do it with: M-: (insert (unibyte-string #...

View answer
How is the variable scoping for macros determined?
Accepted answer
9 votes

The kind of scoping active for the (let ((some-variable ..)) ...) in your example, is the one active at the site of the macro call (i.e. the one that applies to some-function). A macro can know which ...

View answer
Portability of bytecode between Emacs versions
Accepted answer
9 votes

As maintainer, I strive to preserve the following: Backward compatibility of byte-code. I.e. you should be able to take your .elc file compiled with Emacs-19 and run it in Emacs-27 successfully. Of ...

View answer
Is there a standard mode for .ini files?
8 votes

conf-mode.el says: This mode is designed to edit many similar varieties of Conf/Ini files and Java properties. It started out from Aurélien Tisné's ini-mode. conf-space-keywords were inspired ...

View answer
Line numbering: stick with linum or nlinum?
Accepted answer
8 votes

The intention behind nlinum.el was to obsolete linum.el but it turns out that some customizations of linum.el can't really be adapted to nlinum.el (mostly the "relative line numbers"). Also the new ...

View answer
Why does defvar scoping work differently without an initvalue?
Accepted answer
8 votes

Why the two are treated differently is mostly "because that's what we needed". More specifically, the single-argument form of defvar appeared a long time ago, but later than the other and was ...

View answer
Why is the star before some menus in Info are red?
Accepted answer
8 votes

IIRC the red highlight was introduced to help you count entries so you can jump directly to menu entries by number (the red stars correspond to entries 3, 6, and 9 respectively). I've never made use ...

View answer
Copy text as rectangle
Accepted answer
8 votes

My crystal ball tells me you're using Emacs-24.5, which indeed had this limitation. This has been fixed in Emacs-25 where rectangle-mark-mode has been improved so you can move the cursor past the "...

View answer
`switch-to-buffer` vs. `pop-to-buffer-same-window`
Accepted answer
8 votes

The difference is that pop-to-buffer-same-window doesn't insist as much about using the same window. Historically, switch-to-buffer has been used for 2 purposes: change which buffer is shown in the ...

View answer
Changing the appearance of org-mode “hidden contents” ellipsis
8 votes

Personally, instead of setting it only for Org, I do it globally with: (unless standard-display-table (setq standard-display-table (make-display-table))) (when (fboundp 'make-glyph-code) (set-...

View answer
How can I read a single character from the minibuffer?
Accepted answer
8 votes

Rather than read-char I recommend read-key. The difference is that read-key obeys all the usual remappings such as input-decode-map and function-key-map, so it will work properly in a tty.

View answer
Difference between load-file and load
8 votes

load-file and load-library are commands for interactive use (where the main difference is in the initial content of the prompt). load is the underlying function to use when you write Elisp (such as ...

View answer
Warning: Unused lexical variable ‘xxxxx’ for clearly used variables
Accepted answer
7 votes

Here's the reason why you get those warnings when you don't byte-compile the file: My crystal ball tells me this Elisp code is within a file marked as -*- lexical-binding:t -*- (which is a good thing)...

View answer
Using case to compare with a variable
7 votes

BTW, I recommend the use of pcase, which is more powerful. The equivalent code to what you wrote, would be: (let ((x 1)) (pcase x ('x 'Yes) (_ 'No))) Making it clear that x is not ...

View answer
Looking for something like a `first-keypress-in-a-while-hook`
Accepted answer
7 votes

You could try: (defun my-run-fkpiawh () (remove-hook 'pre-command-hook #'my-run-fkpiawh) (run-hooks 'first-keypress-in-a-while-hook)) (run-with-idle-timer 1200 t (lambda () ...

View answer
How to turn off bracketed paste mode?
Accepted answer
7 votes

My crystal ball said you should remove (global-set-key (kbd "M-[") 'previous-multiframe-window) from your ~/.emacs. You might like to M-x report-emacs-bug and ask for global-set-key to complain ...

View answer
Deep eager macroexpansion
7 votes

(require <foo>) is treated specially when it's at top-level (it causes the compiler to require the file also, rather than only do the require at run-time). If the require is not performed at ...

View answer
How to track user changes in the buffer?
Accepted answer
7 votes

To react to buffer changes, you generally want to use after-change-functions (or sometimes before-change-functions). These hooks are run everytime some part of the buffer is modified, either by ...

View answer
1
2
3 4 5
22