texts: How to launch projectile mode with default configuration

texts:
I looked at the quickstart here:

https://github.com/bbatsov/projectile#installation
https://projectile.readthedocs.io/en/latest/usage/

And have this in my init.el:

(require 'projectile)
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
(projectile-mode +1)

I can launch with C-c p but what is s-p ?  Is that the "windows" button + p? Shift?


texts: Highlight a buffer with custom programming language syntax

texts: I have files which are not .py but they are python code. I want to highlight them as if they were python files. How can I do that.


texts:
How can I match – in, for example, a group of files from a Dired buffer – all files that have one or more blank lines at the end of the file?

The specific need that prompts this question is to remove those trailing blank lines, but with a manual prompt; so I want to search and replace. So I'm looking for a match as a separate step, maybe with an Emacs regexp pattern.


texts: Orgmode + Mac (el capitan): can't find latex

texts:
I'm running Orgmode 8.2.10 on a Mac (El Capitan) and I'm trying to use C-c C-x C-l to preview some latex formulas. However, using the mentioned shortcut produces the error:

Can't find "latex" (needed to convert LaTeX fragments to images)

I have the following on my .emacs:

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin/gs:/Library/TeX/texbin/"))

and I even tried adding :/Library/TeX/texbin/latex, which is where my "latex" is.


texts:
I would like to have a workflow where I could make my F9 key open up a shell in a split pane, and then have the same key effectively do a C-x 0 on it. That way I could split, run a command, do some stuff, and go back to the file I was editing.

My attempt at this has some problems:

(defun split-shell-toggle ()
  (interactive)
  (split-window-below)
  (eshell))

(global-set-key (kbd "<f9>") 'split-shell-toggle)

In particular, I need to modify the function to check if the pane is visible, and then close the pane if it is. Right now I get this kind of thing:

It keeps splitting again and again. How can I check if the pane is already open, and close it if it is?


texts: Does emacs have some kind of customized popup creator?

texts:
Is there some kind of popup creator package which enables me to create some customized cheat sheets to help me with commands I need or haven't yet memorized?

I want to create some simple text files, get them to popup when I need them, cancel the popup after seeing the command I need, or select and execute the command it.

It must be something like the helm-descbinds but one whose information I create myself, so I can tab to the command I want and execute it.


texts: How can I improve ansi-color rendering performance?

texts:
Previously I posted this question to Stack Overflow regarding rendering ansi-colors. The tip worked but performance very bad; when I open a 15 MB log file, emacs just locks up.

I decided to try installing tty-format.el. This had the same result (i.e. poor performance).

Then I tried to install xterm-color.el but I couldn't figure out how to make it work; the lisp file loaded but it's not clear to me how to make ANSI codes colorize.

Is there a solution for poor performance in rendering ANSI colors? Thanks!


texts: Punctuation abbrevs for writing prose, and automatic full stops at the end of line?

texts:
I'm a beginner Emacs user, and English isn't my first language so please bear with me.

I use Emacs for writing prose, and I need help with punctuation.

To put it short, I want to turn this:
--hello strangerRET

into this:
–Hello stranger.

I want to use dashes instead of quotations to write dialogue, either an en-dash and an em-dash. With other software, I have simply made an auto correction from two short dashes -- to a longer dash. But with Emacs an abbrev needs a space in the end, which I don't want to put there, also I haven't figured out how to make abbrevs with punctuation only.

I also need this to work with some form of automatic capitalization mode so that the mode understands the dash as the beginning of a word like it does with a quotation mark.

The reason I do it like this is the keyboard I use and the fact I have this method in my muscle memory from using it elsewhere.

Also, I'd like to get a fullstop at the end of a line if no other punctuation exists there.

One more thing, I know there is some key command that you can use to delete a selected block of text where it just sends it to the bottom of the buffer rather than killing it. Can somebody point me to it?


texts: Emacs daemon hangs on first run on Emacs 25.2

texts:
I've installed Emacs 25.2 on Mac High Sierra Beta. I used it together with bbatsov's prelude.

When I first run emacs --daemon, it hangs showing this output:

m15:~ g$ emacs --daemon
Prelude is powering up... Be patient, Master g!
Loading personal configuration files in
/Users/g/.emacs.d/personal/preload...
Loading Prelude’s core...
Emacs Prelude is now refreshing its package database...
ad-handle-definition: ‘ido-completing-read’ got redefined
Contacting host: elpa.gnu.org:80
Type C-x 1 to delete the help window, C-M-v to scroll help.
Continue connecting? (No, Session only, Always) Always

Any idea how to debug this further? What is going on?

I've tried a few times and no matter what I enter as answer, it does the same. Nothing is taking CPU, nothing is being downloaded...

NOTE: I've installed Emacs via brew cask install emacs


texts: suppress command echoes from menu-bar items

texts:
When selecting items from the menu-bar, then the echo area echoes the selected menu item.

Test this by selecting menu-bar -> file -> new window below, when you clicked this menu-bar item, then the echo area states: menu-bar file new-window-below.
(I will call this echoes in the text below)

This is unfortunate because sometimes a menu-bar item puts a prompt at the minibuffer. The prompt gets overwritten by this silly echoes. And I scratch my head why nothing is happening.

I could disable those echoes by setting echo-keystrokes to zero (setq echo-keystrokes 0). But then I can't see started but unfinished keystrokes messages (like C-x-) anymore.

Is there any solution to this dilemma?

Note: this filter aproach did not help.

Reproduction:

The following Elisp snippet adds a menu item Menu Bar Fun to the Help menu.

If echo-keystrokes is set to 0 the prompt is shown when the user is expected to input a character.

If echo-keystrokes is set to 1 the prompt Character: is overwritten by the echo of the menu key sequence.

(defun my-menu-bar-fun (something)
  "Simulating a menu-bar function reading something."
  (interactive "cCharacter: ")
  (message "The thing was: %s" something))

(require 'easymenu)
(easy-menu-add-item menu-bar-help-menu nil ["Menu Bar Fun" my-menu-bar-fun t])


texts: Wrong type argument: symbolp, possible mismatched parenteses in .spacemacs

texts:
I am trying to apply a fix to make it easier to change todo status in org mode. The code is the following:

'(
     (org :variables org-want-todo-bindings t)
)

from https://github.com/syl20bnr/spacemacs/issues/8640.

I put it under the dotspacemacs/user-config function like the instructions showed. However, when I reload the .spacemacs file, I get the following error: Error in dotspacemacs/user-config: Wrong type argument: symbolp, (quote ((org :variables =org-want-todo-bindings= t)))

There's another configuration line in that function, and that works properly, but adding the org mode configuration causes an error. Using edebug-defun shows Invalid read syntax: "Failed matching", (&rest symbolp form), but the parentheses look like they're matching to me.

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  (setq-default dotspacemacs-configuration-layers
                '((spell-checking :variables =enable-flyspell-auto-completion= t))
                '(
                  (org :variables =org-want-todo-bindings= t)))
  )

What am I doing wrong here?


texts:
How to do the following in org-mode:

define a constant in the beginning of file, and
than use it in the text or even compute on it.

Following methods didn't work for me:

Method 1:

#+CONSTANTS: t=10

The temperature is `$t`, and twice of that is `2*$t`.

How to do both of these?

Method 2:

The temperature is src_R{t=10; 2*t}, and twice of that is scr_R{4*t}.

Here value of t is defined in the first R code block (src_R{t=10; 2*t}), and the second  block (scr_R{4*t}) is trying to compute on the definition of t. First block is replaced by 20 as expected, but the second block is not even interpreted as an R code. How can these two be connected?


texts: How color ~code~ on export from org-mode to latex (pdf)?

texts:
I am trying to export an org file to latex (to pdf via latex) and to make latex color the inline ~code~ parts.

According to the manual (see [1] "Defining filters for individual files") this should be possible with the following:

#+BIND: org-export-filter-code-functions (tmp-latex-code-filter)
#+BEGIN_SRC emacs-lisp :exports results :results none
  (defun tmp-latex-code-filter (text backend info)
    "red inline code"
    (when (org-export-derived-backend-p backend 'latex)
        (format "{\color{red} %s }" text)))
#+END_SRC
#+latex_header: \usepackage{xcolor}

~this is a test~

However, it does not work at all and I cannot seem to pin down the problem.

I have tried to c/p the example from the manual (again see [1]) but this does not work either (it should remove the striked out text).

#+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
#+BEGIN_SRC emacs-lisp :exports results :results none
  (defun tmp-f-strike-through (s backend info) "")
#+END_SRC

~this is a test~

+this is a test+

Does anyone have an idea of how to achieve coloring ~code~ when exporting to latex?

Thank you

Edit:
Using the fixed example from your answer, the produced .tex file (minus personal information):

% Created 2020-06-10 Wed 00:27
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage{xcolor}

\hypersetup{
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 26.3 (Org mode 9.1.9)},
 pdflang={English}}
\begin{document}

\tableofcontents

\texttt{this is a test}

\sout{this is a test}
\end{document}

It is interesting to me, that it simply works for you. I have tried reinstalling emacs. My emacs was at version 25 before, however, there was no change in the output.

I have also tried it with a clean init.el and just org mode enabled and it still does not work for me.

Edit2:
Here the Emacs and Org mode version outputs

GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-09-16
Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.3/lisp/org/)

Edit3:
That did the trick, Thank you very much.
I added

# -*- org-export-allow-bind-keywords: t -*-

as first line in my org file (allowing the #+BIND keyword for this file only) and now it works perfectly.

[1] https://orgmode.org/manual/Advanced-Export-Configuration.html


texts: Problem with org-mode odt exporter for styling exported src code blocks

texts:
I try to change the style of src code blocks export with odt exporter but it does not work as expected.

I first exported my file to an odt document. Then I changed the style of OrgSrcBlock and saved my document as a template file (let's say mystyle.odt).

Finally I added #+ODT_STYLES_FILE: "mystyle.odt" in the org file and re-exported but nothing changed in the resulting  odt document.

I tried the same procedure for the OrgTile style and it works as expected (the style is correctly applied in the resulting odt document).

I'm using Org mode version 9.2.4.


texts:
I have make a macro that creates dynamic functions:

(defmacro tjb-make-register-macro (func-name out-string)
   (list 'defun func-name () '(interactive) (list 'insert out-string)))

;; This call succeeds [note abc1 is not defined]:
(tjb-make-register-macro abc1 "hello1")

;; These fail:
(tjb-make-register-macro (make-symbol "abc2") "hello2")
(tjb-make-register-macro (intern "abc2") "hello2")

;; I'm trying to write a function like this to call this macro dynamically
;; but this doesn't work:
(defun tjb-make-register (func-name out-string)
  (interactive "sFunc-name:\nsfunc-out")
  (tjb-make-register-macro ((intern func-name) out-string)))

How can I make an interactive function that correctly calls my macro.


texts: In a new shell, move to directory of other current buffer being edited?

texts:
I am using emacs to edit Latex. My work flow is to open the latex file, open a new buffer in a separate window via C-x 2. Then moving the context into the new windowbuffer via C-x o, I type M x shell to open a terminal.

This is all fine but I then need to type in the changing of directories to get to the Latex file, and I do this frequently. So I would like to know if there is a quick way to open the shell in the current directory of the Latex file?


texts: How to truly unbind ALL global keybinds?

texts:
I've just tried

(set 'global-map (make-sparse-keymap))

but issuing C-hb still shows tons of crap, especially in the Global Bindings section:

Global Bindings:
key             binding
---             -------

C-@             set-mark-command
C-a             move-beginning-of-line
C-b             backward-char
C-d             delete-char
C-e             move-end-of-line
C-f             forward-char
C-g             keyboard-quit
C-h             help-command
TAB             indent-for-tab-command
C-k             kill-line
C-l             recenter-top-bottom
RET             newline
C-n             next-line
C-o             open-line
...             ...

and there are so many more to come.

I would like to get rid of these completely. How can I possibly do that in one simple function call? I would like the solution to be a total wipeout, rather than a loop which is setting all of these maps to nil. Thank you in advance.

NOTE: Please, no teaching answers or spam comments like "These keys are essential for productivity, don't do that!". I have highly customized emulation layer for modal text editing here, so I don't need these default bindings at all.


texts: How can I match "snake_case" automatically when I search for "snake-case" by mistake?

texts:
I frequently mistype "_" as "-" when doing a quick isearch-forward.

E.g. I'm looking for snake_case and accidentally type C-s snake-case and get no results. Best case I notice quickly enough and don't have to delete too much of the search term, worst case I basically have to type it over again.

Is there some way to hook into isearch-forward to change my query into a isearch-forward-regexp like snake[-_]case?

I need to actually search for lisp-case often enough that simply changing "-" to "_" is going to cause more problems than it solves.


texts: I have a file with xml all on one line. Does the functionality already exist to reformat this buffer to be somewhat user-readable?


texts:
I realize there are a number of questions surrounding this topic, but I'm trying use a global function that I've written inside a project .dir-locals.el.

Specifically, I wrote a function to add a series of include paths to the company-clang-arguments variable. I simply want to call this function (which returns a list of strings), and add it to company-clang-arguments.

This is what I am attempting to do:

((nil . ((company-clang-arguments . (eval (company-clang-header-paths "/path/to/compile_commands.json"))))))

I know that company-clang-header-paths correctly returns a list ("-I/path/one -I/path/two") when I evaluate it in another buffer.

I also know that I am able to use dir-locals.el manually like so:

((nil . ((company-clang-arguments . ("-I/a/b" "-I/c/d")))))

I realize this may be a newbie question, but I'm struggling to understand the evaluation context. The . operator cons the list together, but I'm a bit lost on how to evaluate this function and return the list.

I keep running into errors that tell me I'm providing the wrong type:

Wrong type argument: stringp, eval

Obviously, I've tried playing around, but I always get Wrong type argument: stringp, <something>, where <something> is the thing I tried.

If anyone could help me out, I'd appreciate it. Thanks.


texts:
I am using web-mode 20161003.1327

At the moment when I comment  a region in web-mode, it comments like this;

/* import chai from 'chai';
 * import 'babel-polyfill';
 * import configureMockStore from 'redux-mock-store';
 * import thunk from 'redux-thunk';
 * import * as ActionTypes from '../actions/ForecastActions';
 *
 * const expect = chai.expect;
 *
 * const middlewares = [ thunk ];
 * const mockStore = configureMockStore(middlewares);
 *
 * /

This is not good for uncommenting only a section.

Can I change the commenting to use double forward slash?

I've tried using (setq web-mode-comment-style 2) but this appears to do nothing.

I have also tried web-mode-comment-formats but it also does not appear to work:

(require 'web-mode)

(add-to-list 'web-mode-comment-formats '("javascript" . "//"))

(defun my-web-mode-hook ()
  "web-mode settings"
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-code-indent-offset 2))

(add-hook 'web-mode-hook  'my-web-mode-hook)

(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.js?$" . web-mode))


texts:
I am trying to replicate
http://endlessparentheses.com/improving-latex-equations-with-font-lock.html
with no success, I get a "defface for ‘endless/unimportant-latex-face’ fails to specify containing group" error when I compile my init.el and it does nothing nevertheless.

I cite here the elisp code from http://endlessparentheses.com/improving-latex-equations-with-font-lock.html for reconstruction:

(defface endless/unimportant-latex-face
  '((t :height 0.7
       :inherit font-lock-comment-face))
  "Face used on less relevant math commands.")

(font-lock-add-keywords
 'latex-mode
 `((,(rx (or (and "\\" (or (any ",.!;")
                           (and (or "left" "right"
                                    "big" "Big")
                                symbol-end)))
             (any "_^")))
    0 'endless/unimportant-latex-face prepend))
 'end)


texts: Good elisp tutorial for thorough Lisp understanding?

texts: I've been in this catch-22 for a while now: I don't have time to learn Common Lisp first, then elisp, but I don't want to learn elisp without understanding the basic capabilities of Lisp. People have said Paul Graham's ANSI Lisp is a thorough CL tutorial. Is there a way (tutorial(s)) to learn elisp and have a good grounding in the capabilities of Lisp in general? From just nosing around on the Internet, it seems elisp can cover nearly everything (at least from my novice buzzword understanding) that CL has to offer. Conversely, what I'm deathly afraid of is diving into elisp, getting reasonably good at it, but being totally blind to some of the really slick things CL can do.


texts:
the code block I copy outside emacs, which is not auto-indent when yanking in org

type org-return-indent -> yank code block -> indent manually:

*** headline
    |

v

*** headline
    {
    code block
}

v

*** headline
    {
      code block
    }

expecting the yank and indent in a one step


texts: Run a helm command from a running helm session?

texts:
It seems by default this can't be done. For example, if I try to activate helm-mini, and then from there activate helm-M-x, I get the error message: Error: Trying to run helm within a running helm session. Is there a good way around this constraint when writing a custom function?

My use case is this: I am trying to write my own function that will try to call helm-mini, but if helm is already running (i.e., if helm-alive-p evaluates to t) it will run helm-projectile-find-file instead. What I have so far is:

(defun es/helm-mini-or-projectile-find-file ()
  (interactive)
  (if (not (helm-alive-p))
      (helm-mini)
    (progn (helm-keyboard-quit)
           (helm-projectile-find-file))))

I am trying to kill helm if it is running before calling helm-projectile-find-file, because, as mentioned above, I can't run a helm command if I am already in the middle of another helm command. However, it seems like helm-keyboard-quit breaks out of the function before helm-projectile-find-file is executed. Or perhaps there is something else wrong with my code. I am still not very proficient at all with emacs lisp. Is there a good way to get around the constraint of no helm commands during a running helm session?


texts: Evil Mode, how to rebind the caps-lock key to go into normal mode

texts:
In addition to the Escape key, I would like to go into Normal mode while editing by pressing the caps-lock key. How do I achieve that?

Thus far I have been able to disable the Caps-lock key using
https://www.cyberciti.biz/faq/linux-deactivate-caps-lock/

specifically with the command setxkbmap -option ctrl:nocaps as mentioned on that website.


texts:
When I am typing in the scratch buffer, I type certain functions such as defun and while and they are recognized by the buffer and appear in purple. However, with other Lisp functions such as set or +, they do not appear in any color and I was wondering why that is.

Thanks


texts:
I just configured my emacs to display PDFs using doc view. But the problem is that the display flickers continuously. It seems that doc view is constantly refreshing the frame leading to an unpleasant display. How do I stop it from doing this?

Also, I haven't done any customization to doc view in my .emacs yet.

I'm using emacs 24.4 on Windows 8.1 64 bit.


texts: OS X: collapse all emacs process icons into one dock entry?

texts:
I normally have many Emacs instances open (emacs 27.1 in Mac OS X Catalina), each opened from iterm2, based on different environment variable setups (they refer to different source control snapshots in a company custom source control).
I end up with many individual icons in the dock, each looking exactly the same and each having the exact same name when you hover over them ("Emacs").
Is there a way to collapse all of these icons under one, and pop up a list of the windows by hovering over it, as happens in MS Windows?


texts: German input method: missing ' (single quote)

texts:
I am typing with a German ISO keyboard that I've set to US English in X:

setxkbmap -layout us -model pc102

For entering German characters in Emacs, I do:

(set-input-method 'german)

Some special characters are in unusual locations, but that's fine. All characters for writing texts are in the correct location, except for one, the single quote. If I type S-# on a German ISO keyboard, then instead I get ^, the caret.

How do I fix that?

PS: I know that I could change keyboard layouts using setxkbmap and even toggle between several layouts. However, switching layout in Emacs seems at least interesting. I could of course define keyboard shortcuts to call setxkbmap from within Emacs, and perhaps I'll do just that.


texts: How to use new version of a mode instead of the default built version?

texts:
I am getting this error "defconst: Symbol's value as variable is void: org-list-allow-alphabetical" while starting org2blog. I see the issue is that the builtin org-mode which is installed with emacs is org mode version 7.9.3, while I installed the org2blog mode from mepla and it installed a newer org mode version.

My question is how I can use the newer installed version instead of the inbuild org-mode.


texts: How to remove elements from the spacemacs mode-line

texts:
I'd like to remove certain elements from the mode-line:

To the left, the 802 is the buffer size in bytes, if I'm not mistaken. I could not care less about that.

To the right, it tells me the buffer uses unix linebreaks, and I have no idea what the 2.2.3 is, but it doesn't go away when toggling the "new version" element via SPC t m V.

I'd also like to remove the rightmost buffer progress indicator, and replace it with an x/y element in the point position field.


texts: highlight-regexp groups for syntax highlighting

texts:
I want to highlight certain words to a color using highlight-regexp. The words I want to highlight are "fn", "let", "mut", etc. for rust development.

The code I have so far is this:

(add-hook 'rust-mode-hook '(lambda ()
    (highlight-regexp "\(let\|fn\|mut\)" font-lock-constant-face)))

Which does not give me any highlighting. However, when I regex for only a single word it does work:

(add-hook 'rust-mode-hook '(lambda ()
    (highlight-regexp "let" font-lock-constant-face)))

So I figure it must be something wrong with my regex. How do I regex for any of these groups?


texts: Can you generate a tags table for CMD scripting?

texts:
I am working on an elaborate script for Windows using CMD.EXE scripting.

It walks a tree of files and folders and uses our specialized file transfer program to send the tree to a remote location. Successfully transmitted files (and empty folders) are moved to a SENT folder leaving behind only this that did not get transmitted in this pass.

In case you are wondering, it is a customer requirement to do it this way. This is actually a replacement for a Python version that is completely unacceptable for certification in this environment (military).

This has grown to a set of twenty *.cmd files and includes both CALL to other scripts and CALL to :LABEL "subroutines".

I am mostly editing this with Emacs (on Windows) and got to wondering if I could generate a usable TAGS table.

Meta-. navigation would be nice but so would Meta-x tags-query-replace

Has anyone generated a TAGS table for this sort of thing?


texts:
following the tutorial http://orgmode.org/worg/org-tutorials/org-R/org-R.html, I get stuck because I can't find the function org-R-apply.

I have R installed on my computer and the package ess has been installed with usepackage ((use-package ess :ensure t)) which automatically does the require, and added the entry (R . t) to babel suppported languages.

I also have tried to require ess-site manually as it has a different name from the package, but the function is still not here.


texts: Is it possible to include text in the extracted menus in `helm-imenu`?

texts:
I try to use helm-imenu to construct a custom menu of headings, where the menu
items are slightly different to what is shown in the headings.

Say I have an ordinary org file with some headings

* Heading 1
* Heading 2

Upon calling to helm-imenu I will get

Heading 1
Heading 2

Now, using previous example, how can I achieve a menu with the following
contents ?

+ Heading 1
+ Heading 2

That’s to say, is it possible to alter helm-imenu (imenu) default behaviour, so that
it makes possible to add some text (plus sign, in this example) to the
extracted headings, without modifying the heading itself ?


texts: How can i make Emacs use the System input method and Language?

texts:
Problem :
  I am using Emacs for general text typing and editing outside my Programming. This requires me to type in local languages of India ( specifically Hindi, Malayalam and Tamil ).
  I am on Fedora 27 that conveniently provides TypingBooster to all these languages in Input Methods. This works fine for all the applications, except Emacs.
  Emacs 25.3 however ignores system input method and forces me to use its input method. For example, when i try to type in Malayalam it only gives me two options : InScript and ITRANS . Both of which are less satisfactory to me than the Mozhi Input method which System provides. Unfortuately there seems to be no way for me to make Emacs just obey system input method /language and ignore its own language and input method setting.

Is there a way to do this ? I have tried change values in settings with no effect.
  Any guidance would be deeply appreciated as I would like to keep Emacs as my only text editor.


texts:
I use helm-M-x and helm-descbinds to show functions and keybindings I can execute. I would like to be able to see the help for a function without having to ESC, C-h f, retype function. (Like this answer for smex).

Defining a key as part of helm-map (even after emacs has loaded) doesn't work for me:

(define-key helm-map (kbd "C-u") 'describe-function)

I get this:

helm: Error: Trying to run helm within a running helm session

(Running describe-function from M-x opens helm.)

This helm intro says:

  If helm-mode is activated... C-h f, which runs describe-function, automatically takes the symbol at point as default for searching function.

Does that mean C-h f should work in the helm minibuffer? Or is it referring to other functionality?

How can I invoke other commands on the helm results?

(I use spacemacs on Emacs 24, but I don't think that matters?


texts: How to make the cursor go to the beginning of the line by default when I hit return?

texts: When I hit Enter/Return on my keyboard, the cursor goes to position of character 82 instead of the beginning of the line. This behavior is very confusing to me. Do I need to add something to the configuration file to make sure that the cursor goes to the beginning of the line?


texts: When should I use autoload instead of require?

texts:
From what I understand require is used to load large chunks of code (something like modules) although it can also load individual functions.

Autoload on the other side, only registers functions and defers the loading to execution time.

I've recently read an article which advocates the usage of autoload exclusively.

Is it better to autoload than to require? What are some typical use cases for each of these?


texts:
I would like to write a function that scrapes the current buffer for any comments with the word "TODO" and runs org-capture, saving a link to that TODO comment in a file.  The end goal would be sort of a one-stop location for TODO items like some modern IDEs have:

Ideally, I want the link to show the text of the todo comment.  So the following buffer:

int main(/* TODO argc, argv */) {
    // TODO Implement me
}

Would produce the following links in my org file (or something similar):

* TODO main.cpp:1: "argc, argv"
* TODO main.cpp:2: "Implement me"

I might be able to add a custom org-capture-template to handle this, something like:

(setq org-capture-templates
      '(("t" "TODO" entry (file "~/notes/todo.org")
         "* TODO [[%l][<text of link>]]"
         :immediate-finish t)))

And my scraping function could look like:

(defun org-add-todos-list-from-buffer ()
  "Look for TODO comments in current buffer, and add them to org"
  (interactive)
  (dolist (match (matches-in-buffer (format "%s *TODO.*%s?"
                                            (comment-string-strip comment-start nil nil)
                                            (comment-string-strip comment-end nil nil))))
    (org-capture nil "t"))) ;; Somehow pass the desired description to the capture template here?

(matches-in-buffer comes from https://emacs.stackexchange.com/a/7156/11719)

The problem is that I'm not sure how to get from org-capture to my formatted link.  I haven't found a template format option that does what I want (the closest thing I think would be to un-mangle the content of %l).  I could create the formatted text in my scrape function, but then I don't think I can pass that to the template (unless there is a way to programmatically fill in a prompt?).  I suppose I could use something other than org-capture but I don't want to reinvent the wheel.  (Maybe there is already a package out there that does exactly what I want?)

Anyone have any tips?


texts: writing emacs extensions in common lisp or other languages

texts:
Some years ago, I was working on a personal project that seemed to work best with Emacs as the user interface, and Common Lisp (SBCL) as the back-end.  The accepted answer on How to use SLIME as a proxy between Common Lisp program and Emacs Lisp? talks about how to move code from Common Lisp to Emacs, but I needed to work in the other direction, which the macro below accomplishes.  At the time when I wrote this, clsql seemed more mature and usable than any existing Emacs database system.  I was also interested in experimenting with elephant.  If I was to rewrite the code these days I might use EmacSQL directly within Emacs to connect to the database.  Or if I felt like being fancy I might try to bridge to Clojure rather than Common Lisp, and make use of the interesting ideas of software transactional memory, and then try to persist that.

These comments serve to underscore the point that it is potentially useful to bridge to different programming languages for different purposes.

The question I'd like to ask is: Are other people currently doing this sort of bridging, getting Emacs to interoperate programmatically at run time with other platforms (not just over a web API, comint buffer, or shell-command) and if so, how are you going about it?  What kind of Emacs-centric applications are you building?

I include the outline of my CL bridge for context.

(defmacro Defun (name arglist &rest body)
  (declare (indent defun))
  `(defun ,name ,arglist
     (let* ((outbound-string
             (translate-emacs-syntax-to-common-syntax
              (format "%S"
                      (append
                       (list
                        (append (list 'lambda ',arglist)
                                ',body))
                       (mapcar
                        (lambda (arg) `',arg)
                        (list
                         ,@(remove-if
                                 (lambda (testelt)
                                   (eq testelt
                                 '&optional))
                                 arglist)))))))
            (returned-string
             (second
              ;; we now specify the right package!
              (slime-eval
               (list 'swank:eval-and-grab-output
                     outbound-string)
               :arxana))))
       (process-slime-output returned-string))))

With these helper functions:

(defun translate-emacs-syntax-to-common-syntax (str)
  (with-temp-buffer
    (insert str)
    (dolist (swap '(("(\\` " "`")
                    ("(\\\, " ",")))
      (goto-char (point-min))
      (while (search-forward (first swap) nil t)
        (goto-char (match-beginning 0))
        (forward-sexp)
        (delete-char -1)
        (goto-char (match-beginning 0))
        (delete-region (match-beginning 0)
                       (match-end 0))
        (insert (second swap))))
    (buffer-substring-no-properties (point-min)
                                    (point-max))))

(defun process-slime-output (str)
  (condition-case nil
      (let ((read-value (read str)))
        (if (symbolp read-value)
            (read (downcase str)))
        (nsubst nil 'NIL read-value))
    (error str)))

In the end, what is achieved is that I can write functions like this, defined in Emacs, but whose bodies are evaluated on Common Lisp:

(Defun article (name contents &optional heading)
  (let ((coordinates (add-triple name
                                 "has content"
                                 contents)))
    (when theory (add-triple coordinates "in" heading))
    (when place (if (numberp place)
                    (put-in-place coordinates place)
                  (put-in-place coordinates)))
    coordinates))


texts: Is there a possibility to close the right syntax for another languages?

texts:
When I was watching Emacs Rocks, there was a feature showed, called sgml-close-tag.
You can see an example here.
When called that command, he will close the tag for you if there is a tag missing.  I bounded it to C-l and was hooked with it.

Then I was wondering if I could apply this with another languages.

For example, like in PHP, you have the following

 public function Foobar(){

 echo "Foobar

I will get a syntax error, there is a double quote (") missing in order to close the string "Foobar", then a semicolon (;) to end the line, and then a bracket (}) to close the function Foobar.

I was wondering if I could develop the same functionality as in the screencast above, that you need to press only one key and he will close the syntax accordingly. Would be totally awesome and an immense productivity boost.

So I'm wondering if I could be able to develop a package with this feature. I couldn't figure out to which functions I need to look. Could anyone gives me a push in the right direction, or do another suggestion?

UPDATE: this issue got solved by Andreas: https://github.com/emacs-berlin/general-close


texts:
Is there a function somewhere in emacs already to parse RFC
2822-formatted email addresses? I don't particularly care for the
obsolete parts, but would like to be able to parse things like "John
Smith" <john.smith@example.com> into ("John Smith"
. "john.smith@example.com"). I've gotten the following regex working,
but I figured gnus or someone must have done this properly already.

(defconst fov-email-address-regex
  (let* ((cfws `(? (any space)))
         (atom `(any alpha digit "!#$%&*+/=?^_`{|}'~-"))
         (quoted-pair `(: "\"" (* (or (not (any "\"\\")) (: "\\" nonl))) "\""))
         (display-name `(* (or ,cfws ,atom ,quoted-pair)))
         (addr-spec `(group-n 1 (: (+ (any alpha digit ".!#$%&'*+-/=?\^_`{|}~-"))
                                   "@"
                                   (+ (any alpha digit "-")) (+ (: "." (+ (any alpha digit "-")))))))
         (angle-addr `(: ,cfws "<" ,addr-spec ">" ))
         (name-addr `(: (? ,display-name) ,angle-addr))
         (mailbox `(or ,addr-spec ,name-addr))
         (mailbox-list `(: ,mailbox (* (: "," ,mailbox))))
         (group `(: ,display-name ":" (or ,cfws ,mailbox-list) ";" ,cfws))
         (address `(or ,mailbox ,group)))
    (rx-to-string `(: string-start ,address string-end) t))
  "Regex used to parse an RFC 2822 email address.")


texts: Is there an advantage to learning ESC- instead of ALT- beyond "maybe you'll use a system someday ..."?

texts:
I've been recently persuaded and coached to take the jump from vi to emacs. But one question sits funny. Why would one prefer to use the ESC- sequence for Meta- commands rather than ALT-key combinations. The symmetry is compelling (to me) toward the ALT- side. In particular using ALT-{digits} for C-u {digit} seems really nice. Do ESC-apists use that shortcut?

Now I'm a deep retro-computing enthusiast. Difference Engine, ENIAC, pdp/1, 7904. But realistically, I expect be running in an xterm for the forseeable future. Is there advantage to using ESC in preference to ALT as a habit-forming decision beyond the (seemingly remote) possibility of having to use an ALT-deficient setup sometime somewhere?


texts:
I want to work easier with archives in Emacs dired-mode. And I think that my needs are not only mine.

What I want? Two things in Dired:

z to zip file or dir on cursor (or all marked files/dirs if marks are exists); the name of new archive should be changeable (but if one file/dir selected than name should be the same);
Z to unarchive any type of archives (zip or gz or tar) at cursor; by default content should be placed in new directory with the same name.

How can one achieve that?


texts:
I discovered that auctex's texmathp-match-switch does not check whether or not dollar signs are commented out or not, therefore i get wrong results when i all M-x `texmathp' in very specific contexts. So i wanted to redefine the function in a custom library that is loaded automatically as soon as LaTeX-Mode is invoked (by adding the library to the LaTeX-mode-hook). The relevant parts of my code are:

(require 'tex)
(require 'latex)

(defun texmathp-match-switch (bound)
  "Search backward for any of the math switches.
Limit searched to BOUND."
  ;; The return value is like ("\\(" . (point)).
  (save-excursion
    (if (and (re-search-backward texmathp-onoff-regexp bound t)
             ;; my addition (and the `and' above):
             (not (TeX-in-commented-line)))
        (cons (buffer-substring-no-properties (match-beginning 1) (match-end 1))
              (match-beginning 1))
      nil)))

Unfortunalety, this naive approach doesn't work.

Whenever I am in a tex file and do M-h 'texmathp-match-switch' it says "texmathp-match-switch is an autoloaded compiled Lisp function in `texmathp.el'.". Ho do I do this the right way?

EDIT: In case, it's relevant: AUCTeX-version is 11.87; emacs-version is 24.3.1. And no, I cannot update either: "Never change a running system".


texts: Adjust font weight for LaTeX fragment preview in Org-mode

texts:
The default font weight after rendered for LaTeX fragment is too thin compared to the body text. Is there any way to adjust this?
It seems org-format-latex-options does not have this option, I am newbie to LaTeX, tried to set org-format-latex-header but failed...


texts: Customising helm-mini to have filterd buffers

texts:
In my current setup, not having customised it, helm-mini shows me all the buffers in a single list, it then shows the recent files and a section to "Create buffer".

I am wondering if it's possible to have multiple lists of buffers with different filters. Namely, I would like to have a section showing normal buffers, a section showing temporary buffers (normally starting and ending with *), and a section for orphan buffers (not connected to a file).


texts:
I've started using the emacsclient more along with the daemon, and I'm a huge fan, but it's started giving me trouble when I reboot my computer. After reboot when I open up a new emacsclient, I don't get the usual daemon startup stuff in my terminal. Then once the window opens, I am unable to input anything to the minibuffer. Any time I try typing, for example M-x or C-x C-f, I get an error message reading Error reading from stdin.

Killing emacs with pkill emacs and restarting fixes the issue, but I'd rather not have it in the first place. How can I tell the daemon to die, or clean up after itself, when I'm rebooting my computer? If it makes any difference, I'm on OpenSUSE 13.2 with KDE.


texts:
How could we create macros for smart code generation. For example in intellij, if i write a type that does not exist, intellij would be able to automatically generate an entire class of that type. I would proceed to add a couple of attributes, and then again by smart code generation, intellij would create constructors, getters and setters for my class. What extensions or packages can we use for this? Or how how could we implement this?

An example with Java:

Lets say i fast want to create a new class in java, so i would press alt+insert -> "Animal" -> Enter and i get something like this:
public class Animal {..}
 This is not really hard or annoying to write myself, but the next step.. I will enter a couple of attributes for Animal

public class Animal{
   private String name;
   private int age;
}

Now if i were in intellij, i would once again by an easy command be able to create a default constructor and getters and setters for every attribute.

When im in emacs i have to do that myself, and it is probably the most boring and biggest time wasting thing to do.

Also other things like being able to by fast commands get an empty template for interfaces, xmldocs, you name it.

So how could i with a couple of keystrokes get the same effect in emacs?


texts: How do I set the header cell for a custom formula column in a clock report?

texts:
Suppose I have a report like this.

#+BEGIN: clocktable :maxlevel 2 :link nil :scope file :formula "$3='(random)::@1$3=string(\"fubar\")"
#+END:

And for completeness, I have an org buffer like this

* TODO Item
  CLOCK: [2015-02-15 Sun 06:20]--[2015-02-15 Sun 08:38] =>  2:18

When I invoke C-c C-x C-r, my table comes out like this.

| Headline     | Time   |
|--------------+--------|
| *Total time* | *2:18* |826342076441804571|
|--------------+--------|
| TODO Item    | 2:18   |121432529327701366|

But, I think it should look like this.

| Headline     | Time   | fubar            |
|--------------+--------|------------------|
| *Total time* | *2:18* |826342076441804571|
|--------------+--------|------------------|
| TODO Item    | 2:18   |121432529327701366|

Perhaps this is a bug in org-mode, but it looks like I can't set the top most cell in the column of a custom formula.


texts: Can I have org-mode export outline numbers as letters and/or roman numerals?

texts:
Supposing I have a document structure like:

* Heading 1
** Heading a
** Heading b
** Heading c
*** Heading i
*** Heading ii

When I do, say, M-xorg-export-as-html-and-open, I'd get HTML that shows things as:

1 Heading 1
1.1 Heading a
1.2 Heading b
1.3 Heading c
1.3.1 Heading i
1.3.2 Heading ii

I'd like this to instead be:

1 Heading 1
1.a Heading a
1.b Heading b
1.c Heading c
1.c.i Heading i
1.c.ii Heading ii

Or even something fancier like:

§ 1 Heading 1
§ 1(A) Heading a
§ 1(B) Heading b
§ 1(C) Heading c
§ 1(C)(i) Heading i
§ 1(C)(ii) Heading ii

Is there some way to do this?  I found org-export-number-to-roman in the source, but it's not clear to me whether or where it gets called, and I don't see an org-export-number-to-letter or similar.

Is there some configuration value that I'm missing, or perhaps a hook that I could create that might be called like (org-get-outline-numbering-string 1 3 2) that I could set up to return an arbitrary string of my design such as 1.c.ii or 1(C)(ii), which would then get used, creating HTML such as the following?

1.c.ii Heading ii

I'm open to writing some elisp, but I'm not sure where to start.


texts: How do I get Emacs to always remember the last compile-command? My compile-command (cc) in Emacs 24 settings is pure vanilla, no bells and whistles. I only changed the cc string itself ("python build.py"), and I sometimes type a different cc by hand and run it. But then Emacs tries to be helpful and remember a cc based on different buffers, it seems quite randomly. For example I change directory in dired and I get a compile command that is completely unrelated to what I am trying to do. Is there a way to disable compile-command helpfulness feature so it only remembers the last one? BTW, I usually get the last cc, but sometimes the feature freaks out.


texts:
For some reason I cannot view PDF files in doc-view-mode.
Supposedly if I open a PDF file in Emacs, it should automatically open in the doc-view major mode. If it can't be opened in doc-view, then there will at least be some error message.
But for me, opening a PDF file opens it in fundamental mode. If I use M-x doc-view-mode then the mode-line shows (fundamental docview) which indicates that the docview minor mode is used, as I understand it.
That minor mode claims I can use C-c C-c to view the document, but that does nothing, and leaves me in the "editor mode." I've checked the *Messages* buffer, and there are no error messages. Here is a screenshot:

Here's what I'm working with:

Emacs 27.1
macOS 11.2.3 (Big Sur)
auctex 13.0.4
latex-preview-pane-20181008.1822

The only discussion I've managed to find about this is specifically for Windows, such as here.


texts: Putting emacs .org file options in .emacs file

texts:
I use  a template for my work. It contains following options. Can I put those in .emacs file.

#+OPTIONS: num:nil; p:t
#+OPTIONS: toc:nil
#+LATEXCLASS_OPTIONS: {10pt}
#+LATEX_HEADER: \pagenumbering{}
#+LATEX_HEADER: \usepackage[a4paper, top=42mm, right=2cm, bottom=1.5cm]{geometry}
#+TITLE:


texts:
I've disabled my mode-line's boxy appearance with

    (set-face-attribute 'mode-line nil :box nil)
    (set-face-attribute 'mode-line-inactive nil :box nil))

Is it possible to do the same for the top bar that appears after M-x info?


texts:
I wrote a very simple function to properly restart ipython console with elpy when evaluating the buffer or region:

(defun my-restart-python-console ()
  "Restart python console before evaluate buffer or region to avoid various uncanny conflicts, like not reloding modules even when they are changed"
  (interactive)
  (kill-process "Python")
  (kill-buffer "*Python*")
  (elpy-shell-send-region-or-buffer))

Itt works but always ask confirmation, because "*Python*" has a running process, however I kill the process before killing the buffer.

The fun part:
If I evaluate the function body line by line it works...


texts: Elisp: How to exclude sensitive information from an init file? (ie login credentials)

texts:
I want to define a log in function in my init script, but I don't want to hardcode my login credentials. I think a good workaround is to have my init script read in my login credentials from a local file and save these values as variables. That way, I can exclude the file from my git index, which keeps my login credentials secure.

Are there any suggestions on this approach, or ways to set an argument to a value that is defined in a file?

For example, I would like to use the following in my init.el:

;; Set up our login variables here:
(setq file-location "~/.emacs.d/.login")
(setq erc-username "default-name")
(setq erc-password "default-password")
(setq erc-url "default-url")
(setq erc-port "default-port")
(defun read-lines (filePath)
  "Return a list of lines of a file at filePath."
  (with-temp-buffer
    (insert-file-contents filePath)
    (split-string (buffer-string) "\n" t)))
(if (file-exists-p file-location)
    (progn (setq login-credentials (read-lines file-location))
           (setq erc-username (nth 0 login-credentials))
           (setq erc-password (nth 1 login-credentials))
           (setq erc-url (nth 2 login-credentials))
           (setq erc-port (nth 3 login-credentials)))
    (message "No ERC login credentials provided. Please add login credentials as '<username>\n<password>\n<url>\n<port>' in ~/.emacs.d/.login to activate ERC mode."))

;; These message the values from my file correctly.
;; Everything up to this point works as expected
(message erc-username)
(message erc-password)
(message erc-url)
(message erc-port)

;; Use our login variables here
;; This doesn't work because the 'quote' function prevents evaluation of my variables, and a 'backquote' did not resolve it either
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(markdown-command "/usr/bin/pandoc")
 '(tls-program (quote ("openssl s_client -connect %h:%p -no_ssl2 -ign_eof -CAfile ~/.ssl/spi_ca.pem -cert ~/.ssl/znc.pem")))
 '(znc-servers (quote ((,erc-url ,erc-port t ((irc\.freenode\.net ,erc-username ,erc-password)))))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

Note that my example uses the znc.el module here. I am modifying the autogenerated code resulting from the Emacs configs in M-x customize-group RET znc RET and M-x customize-variable RET tls-program RET.

My issue with the above code is that the variables are not loading inside my custom-set-variables function above. Loading the proper values from a file seems to work fine, but I can't seem to use them as an argument. I believe this is related to the quote function, which prevents evaluation of its contents. I attempted a 'backquote' (,) to force evaluation, but it is not working either. Any suggestions to fix this bug or offering another approach would be very helpful.


texts:
I am new to emacs and I been trying to find how to tag multiple files with multiple tags and then filter or search based on the tags. If you are familiar with the way tags work in Evernote or TagSpaces that is pretty much the same idea.

is it possible to do that with emacs?

PS: I was reading about ctag and etag but those look more to be specific to code tags and for navigation within files instead.


texts: Default key binding is lost, how to restore it?

texts:
I have been recently fiddling a lot with Emacs org-mode. In this process suddenly my key-binding for showing the agenda menu is lost, so I have to access it with M-x org-agenda.  The error I get when I press C-c a is " C-c a is undefined".

How do I restore the original keybinding?

Please answer the question with the following points in mind as I am trying to learn few things out of this problems.

Where are these default key-bindings stored?
What could I have done to cause the problem (So that I am more aware when I am doing it next time)?
How do I restore it? I do not want to add a custom key binding in .emacs as C-c a usually there by default in org-more.


texts: How to turn on "helm-mode" for a specific function?

texts:
The context
I've defined a big set of yasnippet snippets and sometimes I forget
the shortcut for those snippets. I've found out recently that
the function yas-insert-snippet can be used to insert a snippet by
writing its name and the completion list of the function lists all the
existing snippets.
I would like to use helm only for selecting an item from the
completion list shown by yas-insert-snippet. However, I don't want
helm-mode to be enabled because that would change the behavior of
all functions that show a completion list (e.g. switch-to-buffer,
bookmark-jump, kill-buffer, etc.).
I just want helm-mode to be enabled when executing the function
yas-insert-snippet.
I've found that the variable helm-completing-read-handlers-alist can
only be used to turn off helm-mode for specific functions but I
would need to add all the functions to
helm-completing-read-handlers-alist using cons of the form
(FUNCTION . nil) if I want helm-mode to be disabled when executing
FUNCTION.
The question
How can I toggle helm-mode for an specific function? I assume that
helm-mode is disabled by default since helm is not used for all
functions.
Additional context
I've tried the following but it doesn't work. I wrote it
because I noticed that helm-mode is a variable.
(let ((previous-helm-mode helm-mode))
  (helm-mode 1)
  (call-interactively 'yas-insert-snippet)
  (helm-mode previous-helm-mode))


texts: Emacs link widget gives the error "gui-get-primary-selection: No selection is available"

texts:
I am reading the The Emacs Widget Library.
The library describes the widget properties in general and not per widget.  So I'd like some more insights about the link widget properties and use.

:notify property is  a "function called each called each time the widget or a nested widget is changed".
Does a widget click implies a call of this function?
:action property is a "function to handle user initiated events".  "Pressing RET invokes the function specified by :action".
Does this entail a widget click?

Do I have to set :follow-link 'mouse-face or is it the default value for the property?

If I run the following snippet immediately after starting Emacs:

(require 'widget)
(with-current-buffer (get-buffer-create "test")
  (kill-all-local-variables)
  (let ((inhibit-read-only t))
    (widget-create 'link
           :notify (lambda (&rest ignore) (message  "You clicked"))
           "my link")
    (widget-setup))
    (switch-to-buffer (current-buffer)))

I get the error:

gui-get-primary-selection: No selection is available

I am using GNU Emacs 25.0.94.2 (x86_64-w64-mingw32) with Windows 10 x64.


texts: How to open Spacemacs/emacsclient from Mac Spotlight

texts:
This is more of a Mac question, than emacs. I think, this is relevant to this site.

I have emacs (Spacemacs) installed via brew, and I can invoke it from a terminal. However, I wish to invoke emacs --daemon and emacsclient -nc from the spotlight of Mac, that I often use to launch programs.

Does anyone do it? How do you accomplish this?


texts: Tag cloud for org files - list all tags and count the occurrences

texts:
Is there something like a tag cloud feature for org files? Maybe something similar to the org clock table?

Or: How can I list/display all the tags used in an org document, next to the number of occurrences in the file?


texts: file-local-variables not evaluated on load

texts:
Here is my example
mwe-1.tex

local variable declaration from within this file is

%%% Local Variables:
%%% mode: latex
%%% mode: orgtbl
%%% End:

when I execute this command  in a shell:

emacs -q --eval '(load-library "org-table")' mwe-1.tex

The actual mode is latex but not orgtbl.

Did I miss something ?


texts: case-fold-search apparently not taking effect in re-search-forward

texts:
I wrote the following command to do a regexp replacement in a region.

(defun camel-case-to-underscore (a b &optional use-dash)
  (interactive "r")
  (save-excursion
    (let ((sep (if use-dash "-" "_"))
          (case-fold-search t))
      (goto-char a)
      (while (re-search-forward "\\([[a-z]\\)\\([A-Z]\\)" b t)
        (replace-match (concat (match-string 1) sep
                               (downcase (match-string 2))))
        (incf b (length sep))))))

However, case-fold-search appears to not be affecting re-search-forward, causing undesired results:

thisIsAnExampleInCamelCase => t_hi_sI_SA_NE_Xa_mp_le_in_ca_me_lC_As_e

What is wrong with my use of case-fold-search?

GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.10) of 2017-10-09


texts: Yank during yas-expand without aborting expansion

texts:
When expanding a yasnippet snippet and filling out completion fields yanking/pasting inserts text correctly among fields as expected, but interrupts the snippet expansion behavior (as if pressing C-g / calling yas-abort-snippet).

How can I yank content and continue with yasnippet expansion?

Edit:
This appears to be a problem with yasnippet itself and the order of placeholder fields.  According to the documentation I believe each of these forms are correct and should work.

Since this is exceptional behavior and not universally broken yanking:

Are these forms valid / Is this in fact a bug?

This works:

# -*- mode: snippet; require-final-newline: nil -*-
# name: work
# key: work_
# binding: direct-keybinding
# --
This works: ${1:someDefault}
$1

This doesn't:

# -*- mode: snippet; require-final-newline: nil -*-
# name: nowork
# key: nowork_
# binding: direct-keybinding
# --
This does not work: $1
${1:someDefault}

(emacs 24.5.1; yasnippet version 20160104.129)


texts: How should I dim the header line of inactive windows?

texts:
By analogy to the mode-line-inactive face, I'd like to dim the header line for inactive windows.  But I can't find a "header-line-inactive" face, nor can I find an appropriate hook to modify.

I have the following in my init file, so every window gets a header line.

(setq-default header-line-format
              '("%e"
                mode-line-front-space
                mode-line-buffer-identification
                (vc-mode vc-mode)
                mode-line-end-spaces))


texts: Expanding current column does not work as expected with a width cookie

texts:
From the manual:

  C-c TAB (org-table-toggle-column-width)

Shrink or expand current column.

If a width cookie specifies a width W for the column, shrinking it
displays the first W visible characters only. Otherwise, the column is
shrunk to a single character.

When called before the first column or after the last one, ask for a list of column ranges to operate on.

Example:

| foo                                     | bar         |
|-----------------------------------------+-------------|
| <10> |
| foooooooooooo                           | barrrrr     |
| fooo                                    | barrrrrrrrr |
| foooooooooooooooooooooooooooooooooooooo | barrr       |

If I do C-c TAB, it does not shrink and I get the message "Before first heading" in the echo area. But if I do TAB, the first column shrinks. If I do TAB again, the cursor moves the next cell. If I do C-c TAB, it does not expand and I get the message "Before first heading" in the echo area.

Bottom line: I can shrink, not expand.


texts: How well does evil work with all emacs modes?

texts: I heard about Evil-mode, but will it work in all windows? I mean, emacs is more than text editor, and every specialised window has it's own hotkeys. Are there hotkey conflicts between Evil-mode and these?


texts: Detect whether a package (AUCTeX) is installed from .emacs

texts:
In my .emacs, I distinguish between two scenarios:

AUCTeX is not available. Then I load my customizations for the basic TeX mode — let's call that (my-tex-mode-customizations).
AUCTeX is available. Then I load my AUCTeX customizations — let's call that (my-auctex-customizations).

I currently check this by testing whether (require 'tex-site) succeeds. This worked fine in the good old days, and still works when AUCTeX is installed system-wide or manually with tex-site somewhere in load-path, but it fails when AUCTeX is installed through Emacs's package mechanism, because then tex-site is loaded during package initialization which happens after the init file.

If AUCTeX is available as a package, I want to load my AUCTeX customizations. Furthermore, if AUCTeX is both available as a package and provided system-wide, then tex-site is already loaded by the time my init file runs, but I'd like to unload it and load the one available through the package mechanism instead. More precisely, ideally, I'd like to use the most recent AUCTeX version in this situation.

So my code might look like this:

(defun auctex-is-available ()
  (condition-case nil
      (progn
        (require 'tex-site)
        AUCTeX-version)
    nil))
(defun use-auctex-package-p ()
  ;; Test if AUCTeX is available as a package.
  ;; Preferably, if AUCTeX is also available by loading `tex-site'
  ;; from elsewhere, only use the package if it's more recent.
  ???)
(cond
 ((use-auctex-package-p)
  (if (featurep 'tex-site) (unload-feature 'tex-site))
  (eval-after-load 'tex-site '(my-auctex-customizations)))
 ((auctex-is-available)
  (my-auctex-customizations)
 (t
  (my-tex-mode-customizations)))

But in .emacs, how do I test for available package versions? If I do that in a post-init hook, which one, keeping in mind that:

if AUCTeX is both present as a package and installed system-wide then the package must be used (at least if it's more recent);
if AUCTeX is not present as a package then an attempt must be made to load tex-site;
if there's no AUCTeX anywhere then my-tex-mode-customizations must get executed;
if AUCTeX is loaded from anywhere then my-auctex-customizations must get executed after the final tex-site has been loaded;
all of this must happen before desktop loads my saved session;
this must work on all Emacs versions that have a package facility (I'll fill in the (fboundp 'package-…) to cope with older versions).


texts: Get a table of org-mode file from elisp to be passed to R

texts:
I am bad at elisp. I am trying to return to follow the idea of just getting everything from the orgfile, then pass it to R code to do easier analysis for me.
This works to generate only tags table
#+name: orgtable
#+begin_src emacs-lisp
(let (orgtable)
  (org-map-entries
   (lambda ()
     (dolist (tag (org-get-tags))
       (push (list tag) orgtable))))
  orgtable)
#+end_src

#+begin_src R :var orgtable=orgtable
table(orgtable)

#+end_src

The above snippet works good. But I am trying to make a full table of the following columns
* TODO Task 1  :tag1:
 deadline:1-9-2021
* Waiting Task2
** DONE subtask :tag2:
::LOGBOOK::
completed: 7-7-2020
clock: start time- endtime => 2hours

#+begin_src
;;some script
#+End_src

#+ results
todo:task name:tags: schedule:deadline: clock: completed:
-----------------------------------------------------------------------
todo: task1   : tag1:        :1-9-2021:     :
waiting: task2:     :        :        :     :
done: subtask : tag2:        :        : 2hrs: 7-7-2020

I just don't know how to nest all of that in elisp code something like:
#+begin_src emacs-lisp
(let (orgtable)
  (org-map-entries
   (lambda ()
     (dolist (tag '((org-get-tags)
                    (org-get-todo-state)
                    (org-get-property-block)
                    ))
       (push (list tag) orgtable))))
  orgtable)
#+end_src

This just fails and not evaluated. Also it would be nice if I can extract every property on it's  own column.


texts: How to edit elisp without getting lost in the parentheses

texts:
I'm modifying some elisp code from linum.el:

(custom-set-variables '(linum-format 'dynamic))
(defadvice linum-update-window (around linum-dynamic activate)
   (let* ((w (length (number-to-string
      (+ (count-lines (point-min) (point-max)) 1))))
         (linum-format (concat " %" (number-to-string w) "d ")))
            ad-do-it))

I was able to fix a bug where the indentation was off-by-one by modifying (count-lines (point-min) (point-max)) to (+ (count-lines (point-min) (point-max)) 1). That was easy.

But now I want to modify it so that the minimum width is 2 by adding an if-conditional where (concat " %" (number-to-string w) "2d ") if the line number count is < 10.

This should be easy! Add one conditional and copy/paste the concat. Piece of cake, right? I mean, I know what I'm supposed to do but I rarely touch elisp and I'm always daunted when I have to modify anything with lots of parenthesis.

The "correct" style, from what I understand, is to structure the code based on indentation and wrap the trailing parenthesis at the end of a line rather than on its own. Coming from other 'C' style languages, I struggle with both reading and writing code in this way. So my question is: what am I doing wrong? How am I supposed to edit elisp and navigate around the code such that I don't have to sit there and count every parenthesis?

When I work with something in elisp that gets too deep I have to shut my door, pull the blinds, and start positioning the parenthesis K&R-style so that I can not only read but modify the darn thing without freaking out.

Obviously I'm doing this all wrong. How can I touch elisp like this without fear?

Please note that my question is how to navigate and edit elisp not as a question on style. I am using the following as a style guide already:
https://github.com/bbatsov/emacs-lisp-style-guide

Updates:

How to properly format elisp before embarassing yourself on emacs.stackexchange:

Mark your elisp and perform M-x indent-region.

The Problem Solution:

For those wanting to know how to perform a right-justify for linum with a minimum width of two, here is the solution:

(defadvice linum-update-window (around linum-dynamic activate)
  (let* ((w (length (number-to-string
                     (+ (count-lines (point-min) (point-max)) 1))))
         (linum-format (if (> w 1)
                           (concat " %" (number-to-string w) "d ")
                         " %2d ")))
    ad-do-it))


texts: Launch an external command prompt (cmd.exe) in a specific folder

texts:
I'm trying to build a cmd interactive function in Emacs, which would open a Windows command prompt - exactly like Win+R cmd does. Within Emacs, it would be accessible with M-x cmd, and it would open the Windows terminal on the current folder.
The reason I want to build this function is that there are cases where the Emacs shell does not give the outputs properly (see this), and in these cases I'd like to open a Windows terminal quickly, and at the location I'm at.
I know how to get the current folder in Emacs, but I can't seem to find how to launch the Windows console from Emacs. call-process works for programs like firefox.exe or explorer.exe, yet when I try the following, nothing appears (it doesn't matter if I write the full path or not):
(call-process "cmd.exe")

TL;DR: So, what would be the command to launch, from Emacs, an external command prompt at a specific path?


texts: Resolving the conflict when the file on disk has been changed

texts: When a file changes on disk while you're editing in Emacs, how to merge both sets of changes into the file?


texts: How can I tell emacs to choose the 'right' link function from `org-store-link-functions` based on the mode it was triggered in

texts:
Whenever I want to capture a link from a PDFView buffer with org-store-link, I get prompted for the link type I wish to apply ("Which function for creating the link? "), with two choices: org-pdftools-store-link or org-git-store-link. I would like emacs to always choose the org-pdftools link type when I capture from a pdf buffer and the org-git link type when I capture from any other buffer that is not a pdf buffer (plain text etc.)
Is there a simple way to do this?
org-pdftools-store-link is defined in the org-pdftools package and org-git-store-link is defined in ol-git-link.el in org-plus-contrib.


texts: I'm not sure what I did, but I'm trying to use M-x whitespace-cleanup in a python file and nothing happens. How do I debug this?


texts: Asynchronously wait for output from a comint process

texts:
First of all, a disclaimer. I have researched this many times, and I
am pretty sure that I have already found the answer one way or
another, but I just don't understand it.

My problem is the following:

I have a process running through comint
I want to send a line of input, capture output and see when it is
over (when the last line of the output matches the regexp for a
prompt)
only when the process has finished sending output, I want to send
another line of input (for example).

For a bit of background, think of a major mode implementing
interaction with a program, which may return an arbitrary amount of
output, in arbitrarily long time. This should not be an unusual
situation, right? Okay, maybe the part where I need to wait between
inputs is unusual, but it has a few advantages over sending the input
as a whole:

the output buffer is nicely formatted: input output input
output...
more importantly, when sending a lot of text to a process, the text
is cut into pieces and the pieces are pasted back by the process;
the cutting points are arbitrary and this sometimes makes invalid
input (my process won't paste back correctly an input cut in
the middle of an identifier, for example)

Anyway, unusual or not, it turns out that it is complicated. Right now,
I am using something along the lines of

(defun mymode--wait-for-output ()
  (let ((buffer (mymode-get-buffer)))
    (with-current-buffer buffer
      (goto-char (point-max))
      (forward-line 0)
      (while (not (mymode-looking-at-prompt))
        (accept-process-output nil 0.001)
        (redisplay)
        (goto-char (point-max))
        (forward-line 0))
      (end-of-line))))

and I call this every time after sending an input line, and before
sending the next one. Well... it works, that's already something.

But it also makes emacs hang
while waiting for the output. The reason is obvious, and I figured
that if I included some kind of asynchronous sleep-for (for
example 1s) in the loop it would delay the output by 1s, but suppress
the hanging. Except that it seems that this kind of asynchronous
sleep-for doesn't exist.

Or does it? More generally, is there an idiomatic way of achieving
this with emacs? In other words:

How to send input to a process, wait for the output, then send more input, asynchronously?

When searching around (see the related questions), I have mainly seen
mentions of sentinels (but I don't think it applies in my case, since
the process doesn't finish) and of some comint hooks (but then what?
should I make the hook buffer-local, turn my "evaluate the remaining
lines" into a function, add this function to the hook and clean the
hook afterwards? that sounds really dirty, doesn't it?).

I am sorry if am not making myself clear, or if there is really an
obvious answer available somewhere, I am really confused by all the
intricaties of process interaction.

If needed, I can make this all a working example, but I am afraid that
it would just make one more "specific process question with specific
process answer" like all those I found earlier and didn't help me.

Some related questions on SO:

https://stackoverflow.com/q/16815598/1083706
https://stackoverflow.com/q/3572532/1083706
https://stackoverflow.com/q/6578373/1083706


texts:
Trying to debug a problem with debug-on-error. Backtrace appears for a second and then some other parts of the system make it disappear and emacs becomes dysfunctional so I can never read it.

Is there a way to get emacs to write the backtrace to a file when its generated?


texts:
I would like to change the behavior of fill-paragraph in certain modes (e.g. LaTeX-mode provided by AucTeX).

I could just rebind the key M-q, but I am also using evil-mode whose implementation of evil-fill-and-move uses fill-region. Ideally, my custom fill function to override both the functions fill-paragraph (so it works with M-q) and fill-region (so it works with evil).

Assuming that I have a standalone program format that takes in LaTeX code via stdin and output formatted code on stdout, how would I go about override the above two fill functions to use format?

(Note: this is similar to vim's formatprg option.)


texts: Set javascript mode indents to (1-based) columns 5, 9, 13, 17,

texts:
When setting the js-indent-level to 4, my code is aligned in (1-based) columns 4, 8, 12, 16, ...

To me this makes perfect sense, but unfortunately I'm sharing code with others whose editors interpret such an indentation level to mean the code should align  at (1-based) columns 5, 9, 13, 17, ...

Still more unfortunately, an automated style checker rejects code that is not aligned in those latter columns.

Can anyone help me configure javascript mode (or emacs in general) to align the code at (1-based) columns 5, 9, 13, 17, ... ?

EDIT

Some example code followed by the complaints from jshint:

/**
 * Foo header
 *
 * @module widgets/foo/views/foo-header-view
 */
define(["classes/layout",
        "services/foo-service",
        "utils/util",
        "hbs!widgets/foo/templates/foo-header"
       ],
       function (Layout, FooService, util, headerTmpl) {
           /**
            * Foo Header View
            */
           var FooHeaderView = Layout.extend({
               /**
                * Header template
                *
                * @property Template
                * @type {Template}
                */
               template: headerTmpl,

               hubEvents: {
                   "foo:list:change": "_reloadData"
               },

               initialize: function () {
                   this.foo = null;
                   this.fooService = FooService.getInstance();
               }
           });
           return FooHeaderView;
       });

[L15:C12] W015: Expected 'var' to have an indentation at 13 instead at 12.
           var FooHeaderView = Layout.extend({
[L22:C16] W015: Expected 'template' to have an indentation at 17 instead at 16.
               template: headerTmpl,
[L24:C16] W015: Expected 'hubEvents' to have an indentation at 17 instead at 16.
               hubEvents: {
[L25:C20] W015: Expected 'foo:list:change' to have an indentation at 21 instead at 20.
                   "foo:list:change": "_reloadData"
[L26:C16] W015: Expected '}' to have an indentation at 17 instead at 16.
               },
[L28:C16] W015: Expected 'initialize' to have an indentation at 17 instead at 16.
               initialize: function () {
[L29:C20] W015: Expected 'this' to have an indentation at 21 instead at 20.
                   this.foo = null;
[L30:C20] W015: Expected 'this' to have an indentation at 21 instead at 20.
                   this.fooService = FooService.getInstance();
[L31:C16] W015: Expected '}' to have an indentation at 17 instead at 16.
               }
[L32:C12] W015: Expected '}' to have an indentation at 13 instead at 12.
           });
[L33:C12] W015: Expected 'return' to have an indentation at 13 instead at 12.
           return FooHeaderView;
[L34:C8] W015: Expected '}' to have an indentation at 9 instead at 8.


texts: What is the command to transpose line from point till end of line?

texts:
Is there a emacs command to tranpose the line from the point till end of the line. For example:

quick brown fox jumps over **<point>** the lazy dog meaning

After transpose it should be

the lazy dog meaning **<point>** quick brown fox jumps over


texts: Let statement throws error on assigning a form to a variable

texts:
(let (lineStr (thing-at-point 'line t))
   (body-form......))

throws the error,

call-interactively: `let' bindings can have only one value-form: thing-at-point, (quote line), t [2 times]

Can't a let variable take a elisp form, and eval the form, get its value assigned?


texts: Does magit support interactive git hook?

texts: My git hook would prompt for answer yes/no when do the push. How could I get the prompt and enter my input when using Magit?


texts: What code is font locking quoted strings in my custom mode buffer?

texts:
I'm experimenting with making a major mode that does some simple syntax
highlighting.  My keywords are being highlighted just fine, but the
quoted string in the example below is also being highlighted (but not by
me).

Here is my code:

(defvar ct-mode-nset-keywords
  '("name" "type" "testme" "doc"))

(defvar ct-mode-nset-font-lock-defaults
      `((
         ;; highlight the second token on the name line
         ("^name:[ \t]*\\([-a-zA-Z][a-zA-Z0-9]+\\)"
          . (1 font-lock-function-name-face))
         ;; highlight all the other keywords
         ( ,(regexp-opt ct-mode-nset-keywords ) . font-lock-keyword-face)
         )))

(defun ct-nset-mode ()
  "Major mode for working with nameset files."
  (kill-all-local-variables)
  (setq major-mode 'ct-nset-mode)
  (setq mode-name "MyMode")
  (set (make-local-variable 'font-lock-defaults)
       ct-mode-nset-font-lock-defaults))

Here is my sample buffer. My keywords (name, type, doc) all highlight as
expected. The second token on the name line also highlights as expected.

The problem is that the quoted string on the third line is being
highlighted too (including the double quotes) by something.

name: wonky
type: string
doc : "this is a string"

In the sample buffer, if I evaluate the variable font-lock-defaults, I
get the expected value:

font-lock-defaults
((("^name:[     ]*\\([-a-zA-Z][a-zA-Z0-9]+\\)" 1
    font-lock-function-name-face)
("\\(?:doc\\|\\(?:nam\\|t\\(?:estm\\|yp\\)\\)e\\)"
    . font-lock-keyword-face)))

What code is font locking the quoted string?  (My mode line says "MyMode
Abbrev"), so I don't think any other modes are active. Thanks


texts:
I want to send multiple emails from Gnus. I have over 1000 addresses. I have found a great solution here: https://lists.gnu.org/archive/html/help-gnu-emacs/2014-04/msg00584.html

(defun message-send-and-exit-multiple ()
  (interactive)
  (let ((addresses
         (split-string
          (message-fetch-field "All")
          "," t)))
    (while addresses
      (let ((address (car addresses)))
        (setq addresses (cdr addresses))
        (message-remove-header "To")
        (message-add-header (format "To: %s" address))
        (if addresses
            (message-send)
          (message-send-and-exit))))))

But Emacs asks me for every email: "Already sent message via mail; resend? (y or n)". So how I can automate the process?
Also maybe it would be a good idea to add some sleep between sending emails? Like send 50 emails wait some time then send another?


texts: Is there a popup input dialogue box for Emacs, which returns the string that a user enters? Maybe something that can be launched through the mini-buffer? Or through an elisp command/function?


texts: Can Emacs provide a wide scrollbar (birds-eye view) of code?

texts:
Microsoft Visual Studio has a very useful wide scrollbar where you get to see the whole file scaled so it fits vertically.  Is there a way to do this in Emacs?

I've looked into having a 2nd frame and changing the zoom of the font in that frame, but the zoom affects any frame with the same buffer.


texts: Extending autocomplete for Go to insert function arguments

texts:
Autocomplete for Go code (fantastically) suggests functions and helpfully shows the documentation for the function, e.g. arguments and return types.

If I hit tab, the DialHTTP function is inserted.

My question: is it possible to insert a "template" of the argument call?  Since autocomplete shows the arguments, I would like to have this line inserted when I press tab:

client, err := rpc.DialHTTP(network, address)

Then I can replace the arguments with my arguments.


texts: org-mode clock sum to count 8h a day and not 24

texts:
I'm using effort estimate with specification as 1d or 4:00, and these are correctly collected with the 8h a day in mind, but these are summed up the section hierarchy to count 24 hours a day.

Here's a very confusing columnview:

#+COLUMNS: %80ITEM(Tâche) %7Effort(Est){:}
#+BEGIN: columnview :maxlevel 2
| Tâche     |     Est |
|-----------+---------|
| * Group 1 |   16:00 |
| ** Task A |      1d |
| ** Task B |      1d |
| * Group 2 | 1d 0:00 |
| ** Task C |      1d |
| ** Task D |      2d |
#+END:

I would expect that 1d + 2d would equal 3d.

How can I solve this ?


texts:
I want to use ivy-immediate-done in doom emacs, but I can't find the command with SPC-:. I have install counsel via package-install.
Does anyone know what the keybinding of this command is? I tried C-m-j with no success.


texts: Add last mistake to dictionary with flyspell and ispell

texts:
flyspell-auto-correct-previous-word is a great way to quickly correct mistakes in a buffer. I get a lot of false positives though, and I would like to quickly add them to my dictionary in an analogous way.

How can I make a command to do this? Confusingly, flyspell-auto-correct-previous-pos is always nil for me.


texts: helm-comint-input-ring - get error: shell-mode-map

texts:
windows 10, emacs 26.1, helm 3.0

I use C-c C-l (comint-dynamic-list-input-ring)
I get something like this:

But I don't like this. I want to use helm-comint-input-ring.
I want to get something like this:

So I set in my init.el the next keybinding

(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)

But when I start Emacs I get error:

Warning (initialization): An error occurred while loading ‘d:/Programs/emacs/.emacs.d/init.el’:

Symbol's value as variable is void: shell-mode-map

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

How I can fix this?


texts: Can I insert a prefix to Org Babel source code lines on export?

texts:
Like, say I have a shell script source code block.

#+BEGIN_SRC shell
  echo 'Hello World!'
#+END_SRC

On export, I want the code text to pick up a dollar sign, so $ echo 'Hello World!'.  But I only want this to happen to shell script blocks, not any other language blocks.

I know there are switches like -n that cause a code block to pick up line numbers on export, but it seems to me there’s no easy way to add a new switch or modify an old one to do what I want.

I hoped I could advise an appropriate function, but I can’t find the right function to hook into either.


texts: org-complete-tags-always-offer-all-agenda-tags does not provide all tags

texts:
Running emacs 25.2.2.

In my init.el, I have:

(org-complete-tags-always-offer-all-agenda-tags t)

So, when I C-c C-q on a headline in any org file, I expect it to show me tags from all agenda files. However, it does not.

I have a lot of tags defined using #+TAGS: some(s) thing(t) method. They all are shown. I can hit TAB and it will offer to complete tags. But that is only from that file.

How do I get the expected behaviour --- tags from all Org files are offered?


texts: Disable minor mode when keys not in it's keymap are pressed

texts:
I was using this to implement line duplication in emacs and decided to bind it to C-c d and it works without problems

What would be cooler though is if I can use C-c d do duplicate a line and then be able to make further duplications of this line by simply typing d. If I want 4 duplications, then the call would be C-c d, d, d, d.

What's the best way to achieve this? I assumed it would be activating a minor mode with C-c d that, when it starts, duplicates a line and then has the duplicate-line function bound to "d" in it's keymap.

The problem with this is that you have to disable the minor mode when a key is pressed that is not in it's keymap. Can this be done?

Or am I approaching this problem completely wrong?


texts: How to use ispell-word to correct a word immediately without prompting for multiple options?

texts: Since the first option is the right one when fixing a common misspelling. Is there a way to make ispell-word correct the spelling of a word to the first suggestion instead of prompting from a list of options?


texts: Specify default number of articles to fetch

texts:
When selecting a newsgroup to read, gnus prompts for the number of articles to fetch. The value it shows is the number of articles in the group.

I recall that there was a way to specify a default value, such that gnus would prompt to load only the most recent, say, 500 articles.

How do I achieve this?


texts: How can I make Org expand sections while searching?

texts: I search Org files with C-s or isearch-forward. However, when the match is hidden inside a code block in a child several levels deep, and everything is collapsed, it takes a lot of extra keystrokes to see the match. Can isearch-forward or Org be configured to expand sections where matches are found?


texts: org-mode: Use dvisvgm on HTML export of Babel LaTeX blocks

texts:
As far as I understand, there are two competing forces when exporting LaTeX  to HTML.

If it's in the text (including using \begin blocks), then the preview mode of org.el is used, relying on org-preview-latex-process-alist.  If #+OPTIONS: tex:dvisvgm is specified, then this goes through dvisvgm, and things are of beauty. (Especially since I can add --font-format=woff to the options of dvisvgm and have embedded fonts.)
If it's in a Babel #+BEGIN_SRC latex block, then ob-latex takes the lead.  Instead of using dvisvgm, it uses htlatex in a arguably cumbersome way.

My problem: I like using Babel, but I want my LaTeX to be executed by dvisvgm.  Is there an easy solution?


texts: How did some of my text get highlighted with a magenta background?

texts:
I pressed some combination of letters by mistake and part of my Python buffer got a purple background color (or magenta, fuschia, violet, orchid, depending on knowledge of colors).

The only way I found to undo it is to restart Emacs. How can I undo it otherwise?


texts:
I'd like to have diary entries/events with multiple lines. The usual diary format interprets newlines as delimiting events:
Monday
  event A every monday
  event B every monday
  event C every monday

Something like diary-list-entries gives you three entries. I want to have, say, multiple lines for event A:
Monday
  event A every monday
    some more stuff about event A
    yet more stuff about event A
  event B every monday
  event C every monday

...and to have diary-list-entries or similar make the event A string have newlines in it.
Is there a way to do this that doesn't involve making up my own format and writing lisp to handle that?
(The motivation here is to have org mode entries with a properties block, but this isn't strictly org-mode-specific.)


texts: Labels are not being shown in org-mode SVG output generated by TikZ?

texts:
When I execute (C-c C-c) the following code block in an org-mode file even though the SVG output is generated correctly the resulting inline image does not show the text labels (only the lines and curves are displayed).
#+LATEX_HEADER: \usepackage{tikz}

#+BEGIN_SRC latex :results raw :file "test.svg" :exports results
\begin{tikzpicture}
% \draw [help lines] (0,0) grid (5,5);
\draw [->, ultra thick] (0,0) -- (3,4);
\draw [->, ultra thick] (0,0) -- (5,0);
\draw (3,4) -- (5,0);
\draw (3,4) -- (3,0);
\node [left] at (2.5,4) {$v$};
\draw (1,0) arc [radius=1, start angle=0, end angle=55];
\node [right] at (1.2,0.5) {$\theta$};
\node [left] at (3,2) {$h$};
\draw [|-|] (0,-0.5) -- (3,-0.5);
\node [below] at (1.25,-0.75) {$||w|| \cos \theta$};
\node [above left] at (4.8,0) {$w$};
\node [right] at (4,2) {$v-w$};
\draw (2.8,0) -- (2.8,0.2) -- (3.0,0.2);
\end{tikzpicture}
#+END_SRC

Oddly enough if I just open (C-c C-f) the generated SVG file (test.svg) in an Emacs buffer the SVG is displayed correctly including all text labels.
What am I doing wrong ? How can I fix it ?


texts: Automate the removal of git-rebase-mode and git-commit-mode

texts:
From the Magit docs:

  Furthermore the old dependencies git-commit-mode and git-rebase-mode have to be removed because they are no longer used by the 2.1.0 release and later, and get in the way of their successors git-commit and git-rebase.

I have a lot of machines that have these old packages lying around. Is there any way I can teach magit to automatically clean them up?


texts: How to use `next-error` and `previous-error` without the compilation buffer visible

texts:
I want to be able to use grep to find matching lines and to be able to jump through them using next-error and previous-error however I don't feel the need to have the match list on screen and it takes up considerable space. I would like to find a way to get similar functionality without having to have the window visible.

I managed to avoid showing the window using (setq-default display-buffer-alist '(("\\*grep\\*" (display-buffer-no-window)))) however when the buffer is not in a visible window I get an error when using next-error.

Debugger entered--Lisp error: (wrong-type-argument window-live-p nil)
  #<subr select-window>(nil nil)
  ad-Advice-select-window(#<subr select-window> nil)
  apply(ad-Advice-select-window #<subr select-window> nil)
  select-window(nil)
  rustc-scroll-down-after-next-error()
  run-hooks(next-error-hook)
  next-error-found(#<buffer *grep*> #<buffer controller.rs>)
  next-error(nil)
  funcall-interactively(next-error nil)
  call-interactively(next-error nil nil)
  command-execute(next-error)

Manually making the window visible then running next-error works, so it isn't broken but something assumes the window is visible for some reason.


texts: Making custom shell command function have popup buffer showing std-out

texts:
I'm customizing spacemacs for my workflow.  I'm new to elisp and can't figure out how to do this after looking at other functions in .el files and other posts.

Basically, I wrote an elisp function that executes a shell script on the currently open file(the shell script compiles a special kind of LaTeX file that includes something called Lilypond code which is used for music typesetting).  The code for the function I wrote looks like this:

(defun lytex-to-pdf ()
    (interactive)
    (shell-command-to-string (format "bash ~/lytex-to-pdf.sh %s" buffer-file-name)))
  (evil-leader/set-key "cb" 'lytex-to-pdf)
  )

It works fine, but I'd like it to pop up a buffer with a terminal showing the std-out of the shell script.  That way I can debug in case it fails to compile.  How can I do this?  Is shell-command-to-string the right emacs command I should be executing?

As an aside, how do I change my custom keybinding to only show up in the LaTeX major mode?


texts:
I'm trying to write a function that exits isearch leaving the current match selected "transiently", so that the mark is deactivated by any unshifted movement command.

I've tried to modify this function,

(defun isearch-exit-mark-match ()
  "Exit isearch and mark the current match."
  (interactive)
  (isearch-exit)
  (push-mark isearch-other-end)
  (activate-mark))

[source] which does select the matching string, but doesn't do so with a transient mark. How can I fix it?


texts:
The way that I'm reloading the nrepl in Clojure seems too bulky.

When I load a Clojure project and nrepl, I:

Create a keyboard macro to input and return something like (use 'my-namespace.core :reload).
Next I bind the keyboard macro to something else, usually C-tab.
Finally, every time I switch into the nrepl, I execute C-tab, and the repl reloads.

This seems like a lot of unnecessary work. I've looked around at getting the namespace programmatically, or with C-c C-e, but nothing seems to fit quite right.

Isn't there an easier way?

Thanks.


texts: How can I display very large SVG files using `image-mode`?

texts:
I'm trying to use Emacs to visualise very large UML diagrams created by PlantUML [1]. In PNG form these diagrams have over 20000x1300 - in fact, the reason why I moved from PNG to SVG for their generation is that I could not find the right value for PLANTUML_LIMIT_SIZE. At any rate, they generate correctly in SVG and also open correctly using Google Chrome (see [2] for an example diagram from my git repo). However, when I try to visualise them in Emacs, after a long time, I get a 30x30 size and a blank square.
So my question is: are there any settings I need to toggle in order to display very large SVG files using image-mode, or did I perhaps hit some kind of limitation?
Update 1: Please note that I can display regular (small) SVG images correctly, including smaller PlantUML diagrams.
Update 2: I'm using Emacs 27.1 on Debian GNU/Linux testing.
Update 3: I have read through the code of image-mode [3] and I cannot see any obvious conditional handling for SVG based on size. However, I am not an elisp expert so I probably missed something.
Update 4: I ran emacs with -q to figure out if this was a problem of my config, and it supplied me with a much more informative message:
Invalid image size (see ‘max-image-size’)

I then subsequently set this variable to some very large values:
(setq max-image-size 162704)

However, this only changed the error:
Error parsing SVG image ‘(image :type svg :file PATH_TO_IMAGE/dogen.text.svg :scale 1 :max-width 643 :max-height 324)’

[1] https://plantuml.com/
[2] https://raw.githubusercontent.com/MASD-Project/dogen/master/projects/dogen.text/modeling/dogen.text.svg
[3] https://github.com/emacs-mirror/emacs/blob/master/lisp/image.el


texts: Unable to commit: There was a problem with the editor 'emacsclient -t' (dumb terminal)

texts:
I get the following error when trying to amend a commit (same if I try to make a new commit):

  1 git … commit --amend
*ERROR*: Terminal type "dumb" is not powerful enough to run Emacs
error: There was a problem with the editor 'emacsclient -t'.
Please supply the message using either -m or -F option.

It was working earlier, the only thing I remember changing was trying out magit-gerrit. I removed that since and still doesn't work.

emacsclient -t works from the command line.

Magit 20171015.2104, Git 2.13.0, Emacs 24.4.2, gnu/linux


texts: sh-script-mode: get [[ ... ]] pair expansion to automatically include whitespace?

texts:
Say you're coding a shell script and you want to write something like:

  if [[ "$out" =~ 'none' ]]; then
    return $err
  fi

If you're just typing it out and have any of the various electric/pair modules active, you'll likely get something like

if [[‸]]

(with the position of point indicated by ‸).

In most programming languages, this is great, but in POSIX/Korn-family shells like Bash or Zsh, you pretty much always should have a space after the [[ and before the ]].

Inserting this manually is a pain since you need a space before, and a space after, and still get the point back in the middle. I frequently have wild error messages the first time i test a script because one of those spaces is missing, or they both ended up before or after the double-brace contents.

Is there a good way to rectify this, so that, ideally, in sh-script-mode, typing [[ would result in

[[ ‸ ]]

so the necessary space is there and the point is correctly positioned?

Ideally, the answer would also let me select a region and press [[, and just as I can already today surround the region with brackets, parens, etc. this way, I'd get the same, just with [[ $region ]] instead of [[$region]]. Also, it would be useful if the Zsh (( ... )) form would  act in the same way.

(Note that I specifically do not want this behavior for square brackets in general; they're too-frequently used in other contexts when one doesn't want extraneous spaces, and the use of the single-bracket [ ... ] test construct is generally less preferable to the double-bracket one.)

p.s.

I'm setting aside YAS snippets and such for the moment—they could clearly solve this problem in many cases, and I even already use them to create entire if..elif..else..fi blocks with built-in [[ $0 ]]-type positioning code. And so, for writing entirely new shell code, this problem isn't that big of a deal.

But this issue tends to arise when I'm modifying existing logic, rather than entering in entirely new conditionals. One of the most common ways one might need to fix a wayward conditional is to change a simple conditional into a test, so introducing the [[ ... ]] test into an existing conditional is a frequent task.

An acceptable answer, but one I've tried to avoid, would be to make [[ a YAS snippet in its own right. The issue is that if I defined it such that invocation was [[⇥ (⇥ meaning the tab or other YAS invocation key), the doubling expansion will have already happened, so I'd have to have Elisp in the snippet to fix the characters after the snippet's environment, which is something of a pain.