How can I change icicle-search-context-regexp variable in Emacs3 icicles - emacs

I'd like to use icicle-comint-search in shell-mode, but it used to be failed with error message like this
byte-code: No search contexts for `\^\[\^#\$%>
]\*\[#\$%>] \*\\S-\.\*'
Of course my shell prompt in zsh does not meet that regular expression. B
I tried to change icicle-search-context-regexp via setq to meet my zsh prompt. But when I issue icicle-comint-search the error message comes again. When I examine variable value of icicle-search-context-regexp, it was reset to its default value again.
How could I change it to meet my zsh prompt?

icicle-comint-search uses this regexp: (concat comint-prompt-regexp "\\S-.*").
So you can change the value of variable comint-prompt-regexp to change the search regexp. You can set that variable in a mode hook, for example (e.g., comint-mode-hook). Note that the doc string for comint-prompt-regexp says that it is used only if comint-use-prompt-regexp is non-nil, but for icicle-comint-search it is always used. I've updated the icicle-comint-search doc string to mention comint-prompt-regexp.

Related

Pass command line options to guile via geiser

Geiser can be configured to read ~/.guile when running Guile from within Emacs. I would like to append command line options to the argument list passed to guile.
Is there a variable that holds the command line options?
Customize geiser-guile-binary to a list of strings (change the "Value" button to "repeat"). The first one should be "guile" (or whatever the binary for guile is on your system) and the next entries should be strings each containing one argument.
You can double check it by putting (insert (pp (geiser-guile--parameters))) in a scheme file with geiser loaded and then running M-x eval-last-sexp.
I had the same problem, but when I disabled
;;(use-modules (ice-9 colorized))
;;(activate-colorized)
in my ~/.guile-geiser file the problem disappeared.
readline is also not needed within Emacs, just press C-up/down to see the history.
;;(use-modules (ice-9 readline))
;;(activate-readline)

How to inhibit 'etags completion' changes the value of 'tags-file-name'?

I'm using etags and found that:
Step 0. Set the 'tags-file-name' as buffer local to a specified TAGS file, and the global value is nil.
Step 1. Press M-. to find tags.
Step 2. Input some characters in the mini-buffer and press the TAB key for completion, then the mini-buffer will display "Making tags completion table for ...done".
After that, the global value of 'tags-file-name' is set to the same as its local value.
How can I keep the global value nil ?
This is related to a family of bugs that have been fixed in the current development tree, and available in Emacs 26 when it comes out.
Here's the closing message: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23164;msg=31

Call a command with arguments in Emacs minibuffer

I know that M-x (execute-extended-command) allows one to call a command in Emacs by typing its name. That however doesn't allow me to call command with arguments, e.g "backward-word 5"
I am aware that C-5 M-b produces the desired result but I am looking for a general method.
Does anyone know how to do this?
Thanks,
Danny
Eval it: M-: (backward-word 5) RET.
#abo-abo provided the general answer: use M-:.
However, if you are interested not only in obtaining the side effects of the evaluation, and not only in a cursory overview of the return value, but in the full return value (regardless of its size and complexity), then vanilla Emacs M-: is not what you want.
For that, I substitute pp-eval-expression for eval-expression wrt its key bindings (including M-:), and I recommend this practice for others too:
(substitute-key-definition 'eval-expression 'pp-eval-expression global-map)
That pretty-prints the return value, and you can make it print the complete value (no ellipses: ...).
In addition, I offer a modified version of pp-eval-expression in library pp+.el. It has these advantages:
Reads with completion, using pp-read-expression-map.
Emacs-Lisp mode indentation and completion key bindings are available during input.
With a prefix arg, inserts the resulting value into the current buffer at point.
With a negative prefix arg, if the return value is a string, inserts it into the buffer without double-quotes (").
Font-locks the return value (syntax highlighting) for Emacs-Lisp mode. (And during display emacs-lisp-mode-hook and change-major-mode-hook are inhibited.)
Respects new user options pp-eval-expression-print-length,
pp-eval-expression-print-level, and standard option eval-expression-debug-on-error. The former are separate from the similar, standard options eval-expression-print-length and
eval-expression-print-level because the use cases are typically different.
If you use library Icicles then you get the same advantages as library pp+.el -- no need to load pp+.el also.

New to Emacs. When I type ", \" is automatically inserted

As the title states, I'm relatively new to Emacs. I tried out several starter kits but went with Prelude and changed a lot of things around.
Anyway, I've been getting a good handle on everything...until this morning I was working and I typed double-quotes. Normally Emacs would insert a second double quotes right after ("") due to the auto-completion, but I must have accidentally changed something with a keystroke and now when I type ", I get \"\".
Thoughts?
Thank you.
This seems to be an issue with smartparens which prelude installs by default (see the file prelude-programming.el. This behavior is described in detail on smartparens wiki. To ensure that smartparens is causing problems you can can do C-h k" this would print about the command acutally run when " is pressed, if the command is sp--self-insert-command then the following should work
Paste this (setq sp-autoescape-string-quote nil) to your *scratch* buffer, go to the closing parenthesis and do C-xC-e, this will disable the behavior for current emacs session.
To disable the behavior for all future emacs session, assuming that you are using prelude, you will need to add the following to your personal config (basically some file inside /path/to/prelude/personal/).
(setq sp-autoescape-string-quote nil)
This will disable the auto-escaping of the string quotes, completely. If you like this behavior and do not want to disable it completely you can do what #steckerhalter suggests C-q" will insert just one parenthesis.
If the above does not solve the issue then try providing following info in your question which may help us debug the issue,
1) The list minor modes active (this can be obtained by doing C-hm).
2) Output of C-hk"
Hope that helps
this sounds a lot like smartparens (https://github.com/Fuco1/smartparens) which is included in Prelude. usually when you are inside "" then it will escape the quotes:
"hahah \"\" bah"
if you want to get a normal " inside quotes you have to use C-q " or disable smartparens with M-x smartparens-mode
If, as you say in a comment, " is bound to self-insert-command, then when you type " what happens is that a (single, unescaped) " character is inserted.
However, I suspect you have some mode turned on that does something additional whenever a " char is inserted. You mention automatic insertion of a second ", for example. That kind of behavior comes from a mode such as is provided by library smart-parens or electric-pair.
And you mention Prelude.
To find out what part of your init file (~/.emacs) is causing the behavior you see, bisect your init file recursively (first comment-out half, to see which half is responsible, then 3/4, to see which quarter is responsible,...). Then, if you still have a question about the responsible code, ask here, providing that info.
When you describe your problem here, it is important to be specific: what Emacs version, what mode(s), what libraries have you loaded,... Whatever might be pertinent. But first narrow down the problem by bisecting your init file to find the culprit.

Why do I start iswitchb-mode this way?

According to the emacs info page, here's how you enable iswitchb-mode:
To enable Iswitchb mode, type M-x iswitchb-mode, or customize the
variable iswitchb-mode to t
So I put the following in my .emacs:
(setq iswitchb-mode t)
However, this doesn't seem to work. After searching the emacs wiki, I found that I need to use this:
(iswitchb-mode 1)
Could someone explain why I need to enable it this way? I'd like to get a better understanding of elisp rather than just copying and pasting things from places.
Typically a mode will define both a variable and a function with the same name. The function will set the variable properly when it's called, but it's the function that turns on the mode, not just the variable (that only tracks the mode's state).
In your specific case, you were told told customize the variable, but you simply set it instead. The difference is that when the value of the variable changes, custom knows to do something and `setq' knows nothing of this. If you look at the help for this variable (C-h v iswitchb-mode) you'd get:
iswitchb-mode is a variable defined in `iswitchb.el'.
Its value is t
Documentation:
Non-nil if Iswitchb mode is enabled.
See the command `iswitchb-mode' for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node `Easy Customization')
or call the function `iswitchb-mode'.
You can customize this variable.