texts: How to achieve less zealous indentation in Python?

texts:
I'm experiencing frustrating behaviour with automatic Python indentation when ending a highly indented block. I've used pilcrows to indicate where I want newlines in the following example:

def f():
    if True:
        if True:
            if True:
                print ""
¶
¶
¶
def g():
    print ""

After finishing typing the first function, every subsequent line is automatically indented by 16 spaces, which all need to be deleted. I understand that the first time I hit return, indenting to that level makes sense. But I am surprised that when hitting return on an unindented line it would also be assumed that I wanted the maximum valid indentation.

This behaviour seems to occur in 24.4.1 with both the new python.el (Gallina) and python-mode.el. (It also appeared to happen when I tried to use the old python.el by Dave Love, but I could not work out how to verify which python.el had actually loaded). I note that with the new python.el I can use C-j to return without indenting, but that doesn't help much with a situation such as the following:

def f():
    if True:
        if True:
            if True:
                print ""
    ¶
    print ""

I don't want to disable automatic indentation, but is there a way to make it less aggressive and accept valid lower levels of indentation somehow?


texts: Printing a list of folders which has been modified today

texts: Is there any way to export a list of folder names which has been modified today using a dired mode or any other package on emacs


texts: How to write a basic org-babel-execute function for a new language?

texts:
What I'm trying to achieve is very simple: take a source block, write it to a temp file, pass the file name as an argument to an executable which will run it, and then include the output in the #RESULTS block. The snippet below seems close, but when I try to execute the code block the executable (nim) complains that it expected a file name so I guess it passes the block body via stdin instead of temp file:
(defun org-babel-execute:nim (body params)
 "Execute a block of Nim code with org-babel."
 (message "executing Nim source code block")
    (org-babel-eval "nim r " body))

Second attempt, based on @NickD's comment and org-babel-execute:dot:
  (defun org-babel-execute:nim (body params)
    "Execute a block of Nim code with org-babel."
    (message "executing Nim source code block")
    (let* (in-file (org-babel-temp-file "nim-")))
    (with-temp-file in-file
      (insert body))
    (org-babel-eval (format "nim r %s" (org-babel-process-file-name in-file))))

When trying to execute a code block, getting "Symbol's value as variable is void: in-file"


texts: How can I automatically close buffers when the underlying file is deleted?

texts:
I leave Emacs running all day, and will often will do a lot of file system manipulation on files that are open in Emacs buffers. For example, I might switch to a different branch in Git that has a very different directory structure.

Unfortunately this leaves me with a bunch of open buffers that Emacs now registers as "modified" buffers referring to "new" files. Unless I'm careful to manually close them each time I do this, it's easy to reflexively save those buffers which then results in spurious, probably duplicate files in my project. I can't even close emacs without answering the "save this buffer" question for each one.

Is there a way to automatically close unmodified buffers when the underlying file disappears? Similar in spirit to a global-auto-revert-mode that also handles when a file is removed entirely?


texts: Handle long lines while pasting from clipboard without freezing emacs

texts:
I have a lengthy xml output from a rest endpoint, I copied if from chrome dev tools to clipboard and on pasting it into an org mode buffer inside an xml source block freezes emacs for a while.

I guess this is because of emacs trying to syntax highlight the xml data.

Pasting the same data with mode changed to fundamental mode works without any issue.

How can I advice emacs to not parse long lines while pasting from clipboard.


texts: Using TAB key for indentation in Python REPL produces strange indentation problems

texts:
I'm using the Python REPL in a comint window via the run-python command, and I'm seeing bad behavior when I use the TAB key to do my indentation. For example:

>>> for i in range(3):
...     print(i)
  File "<stdin>", line 2
    print(i)
        ^
IndentationError: expected an indented block

Here, the indentation before print was created using TAB. I use TAB when editing normal Python buffers, and it inserts 4 spaces in those cases. Here it seems to be inserting an actual TAB and it results in an IndentationError.

I'd like it if TAB would just insert 4 spaces. I'm sure this is something really simple, but it's eluding me. Anyone know what I'm doing wrong?


texts:
I have autocomplete successfully working in auctex. It also works for included packages, so if I, for example, have \usepackage{url} in my preamble, I will get autocompletion while typing \url.

However, this is not the case for the physics package in latex.

One possible problem I can think of is that this package makes use of xparse, so there is no \def or \newcommand in physics.sty but instead commands like \DeclareDocumentCommand.

Is there a way to get autocomplete for physics.sty?


texts: How to create list of links to files in a folder and annotate them using org-mode?

texts:
I am trying to use org-mode to make a list of files to read, with links to pdfs and write the notes corresponding to it in one file.
Using org-fstree, I can get list of all links as headlines

#+BEGIN_FSTREE: ~/path/to/folder

and pressing C-c C-c.

This list can be updated if files are added and removed by C-c C-c again.
However the problem is that this removes all the notes written.

Is there a way to update this list while keeping all the annotations?

Or any other package or method to get list of all files with their annotations?

(I also tried org-annotate-file.el but that doesnt seem to work either.)


texts:
I'm fairly new to emacs. I'm using OS X 10.10. I have been learning to use helm. I was interested in its integration with surfraw. I installed surfraw from teh source tarball following the instructions at surfraw.alioth.debian.org.

However, when I use helm-surfraw, I originally got a file not found error. Following this discussion, I determined this was partly due to lack of a default browser.

I installed lynx as follows:

sudo mkdir /usr/local/src
cd /usr/local/src
sudo curl -O http://lynx.isc.org/lynx2.8.7/lynx2.8.7.tar.gz
sudo tar -xzvf lynx2.8.7.tar.gz
cd lynx2-8-7
sudo ./configure --mandir=/usr/share/man
sudo make
sudo make install

Then, I did the following:

$ mkdir -p ~/.config/surfraw
$ echo "SURFRAW_text_browser=/usr/local/bin/lynx" >> ~/.config/surfraw/conf
$ echo "SURFRAW_graphical=no" >> ~/.config/surfraw/conf

The good news is that I can now run surfraw from the terminal. However, helm-surfraw still doesn't work. I'm not given any options for a search engine (see screenshot).

I'm interested in helm-surfraw alternatives, but I'd also like to understand what I'm doing wrong.


texts:
Using Doom Emacs 2.0.9 on Emacs 26.3 on Manjaro.

I am writing some devanagari text in a file.

Every time I edit the file, I need to toggle-input-method and select 'devanagari'.

Is there a way to specify the 'default' input method for a file? I will then use toggle-input-method to switch back to normal input method, English.


texts: Saving to clipboard in a Python script running as shell command

texts:
The following python script successfully copies a given string into the clipboard when run from Ubuntu shell:

import os
text = 'The text to be copied to the clipboard.'
os.system("echo -n {s} | xsel -b".format(s=text))

However, when I execute the script from Emacs as follows, it does not work:

(call-process-shell-command "clipboard.py &" nil 0)

What is special about the script run with call-process-shell-command and how do I work around the problem so my Python script would be able to use the clipboard?

EDIT: In addition, (shell-command-to-string "python clipboard.py") freezes.


texts: regexp to find two consecutive and identical words not necessarily in the same line

texts:
According to  https://www.emacswiki.org/emacs/RegularExpression#regexp

 \(\w+\) +\1\>

finds two consecutive identical words. It works if the words are in the same line separated by an arbitrary number of white spaces.
How to find consecutive identical words not necessarily in the same line by a regexp? According to the link above

\(\<\w+\>\)\s-+\1

can do the job. But I don't know why it cannot find the duplicate words file file below

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file
file with C-x C-f,
;; then enter the text in in that file's own buffer.


texts: How to view unnamed branch in magit "log"?

texts:
We recently switched from CVS to GIT, performing the conversion with cvs2git.

I use magit, but I cannot find the combination of settings required to see all tags in the log view.  The closest that I have got is using l, adding -D and then b.

The tags are visible with the following command line:

> git log --oneline --decorate --graph --all
...
| * f7b6bbb (tag: X_Y_Z1, tag: X_Y_Z2) This commit was manufactured by cvs2git to create tag 'X_Y_Z2'.

One suggestion was that magit may not be able to handle the unnamed branches created by cvs2git.

Is there a way to show such tags in magit?


texts:
I'd like to see the inheritance tree for classes which I have currently open, similarly to how it ECB shows related files (e.g. I have a class B in my buffer, its parent A and child C are in different files - show me a tree with classes A, B, C).

I tried ebrowse and it sort of works, but I'd like to see only the relevant part of it and in a more user-friendly format. I'm using semantic and I'd guess that it should be able to figure out the hierarchy from its database, but I cannot find anything about it.

I found semantic-cb-speedbar-mode in a file semantic-cb.el in XEmacs,  which sounds like what I want, but my distribution of Emacs doesn't have it (I'm using GNU Emacs 24.4).

Similar question: Class Browsing in C++


texts: How to prevent single lines from disappearing when cycle with TAB key?

texts:
Sometimes my latex commands (with #+LATEX:) get buried within my org document. Can I disable the visibility cycle behavior for single lines?

A preferred behavior would be to leave non-indented lines always visible.


texts: Xref / xref-find-refernces / Windows 7 does not work

texts:
I'm struggling with Xref M-? finding references to symbols (C-code).
It doesn't work for (e)tags nor for any symbol even in the buffered file.
The Xref window/buffer with results is not opened instead an error-message ist displayed in the minibuffer 'No references found for: '
The strange thing is: M-. works perfectly!
emacs-version 26.3, Windows 7
(on Macintosh the same Emacs version has no such problem)
Is there anything missing under Windows, which is needed for Xref?
Output of functions:
(project-roots (project-current))
"Minbuffer: No applicable method: project-roots, nil"
(insert (format " >%s<" (semantic-symref-detect-symref-tool))) >grep<


texts:
I use use-package to defer package loading.
This is useful in emacs standalone mode.
I additional run emacs in daemon mode (emacs --daemon), then this behavior is not desired.

Is there a way to load all, in my init files defined, packages?
In a way like this:

(if (daemonp)
    (foo-for-all-till-now-known-definitions-load-package))

Notes:
My init file is distributed over multiple files and directories.

I do not want to keep an extra list of packages which I have defined using use-package.
Me doing this, is not wanted:

(if (daemonp)
    (require 'org)
    (require 'paredit)
    ... )

Edit: it seems, that it is not clear what should be achieved by this. So here it is more clearly:

Packages should be loaded on demand only , when I am using emacs (without daemon or server mode). This is already working by using keywords :defer, :commands and :bind
and
In server mode all packages should be loaded right at start of emacs --daemon, so that there is no waiting time later. This I hope to achieve by triggering a function, which triggers all packages (the ones defined using use-package) to be loaded.


texts: Export from Org Mode to LaTeX doesn't accept the option #+title:

texts:
When I try an export from Org Mode to LaTeX I get the following error message:

  apply: Wrong type argument: listp, #("Aufgabe 3" 0 9 (:parent (#0)))

The problem comes from the option

  #+title: title.

I don't have any special settings for LaTeX-Export.

Where does this error message come from?


texts: How kill all hidden (non-visible) buffers?

texts:
I looked around to be sure, that none had this issue earlier.

Okay, sometimes I'm having too many buffers to manage. So I would like to kill all these buffers, except the buffers that are currently opened in my windows and elscreen.

I suspect there should be an existing function for that, like in Vim but I couldn't found it inside Emacs and wiki pages.

Any suggestion would be greatly appreciated.


texts: Support to refactor/convert source into literate programming with org-mode/babel?

texts:
I'm thinking of using literate programming to investigate large amount, or hard to understand source code. For the purpose, I'd like refactor the source code into literate programming text with org-mode/babel, so that I can add annotations of my study, questions, and comments freely, while I can tangle back to get the original source code.

I just wondering if any kind soul has already done something similar? At the moment, it could be simple as:

Input the source code into org-mode/babel buffer, and wrap the whole source code into an initial code chunk;
Provide a command to extract a region, or a sub-expression into separate code chunk with proper arrangement in terms of chunk name, headers, etc. so that the relationship in the source code can be expressed, and preserved, such as having another code check to aggregate those separated code chunk. (the name of the extracted code chunk may be automated as the first expression in the region, or something semantically making sense, and feasible)
For more advance application, the tool can scan the source code directory, and generate an initial org-mode file with the source code being parsed into literate programming chunks for each major programming constructs, for each file, the header declaration, and each function/subroutine, etc., with proper arrangement to tangle back the original source code directories, and files.

The essence is to automate the manual operations in refactoring as much as possible.

I feel that this might be a tremendous help to study source code.

Please share pointers, thought, contributions.

Thanks, Yu


texts:
I was playing around with my .emacs, and I cannot figure out why the following does not work with .tex files:

(add-hook 'tex-mode-hook
  (lambda ()
    (show-paren-mode t)))

On the other hand, the following does work on elisp files.

(add-hook 'emacs-lisp-mode-hook
  (lambda ()
    (show-paren-mode t)))

Actually, just having the elisp hook is sufficient to enable paren mode on .tex files. I'm not sure what's going on.

Running 24.5.1 on OS X with auctex installed.


texts: Does emacs have font-lock for constant values?

texts:
I am trying to customize a theme for myself, and now I am finding a way to
change the highlight color of constant values such as 10 and 10.5677. For example, C mode in Vim highlights those constant values in blue, while c mode in Emacs does not highlight with any distinctive colors (the currently-highlighted color is black) compared with its counterpart. Based on the emacs document of font-lock-faces, there is no font-lock to change the highlight color for the constant values.

If you have a solution or have done it before, please let me know.


texts: Using `dired-do-compress-to` with `tramp`

texts:
Within a eamcs -q session and in a tramp dired buffer and call dired-do-compress-to on a file, I got this eror

zip I/O error: No such file or directory
zip error: Could not create output file (/ssh:user@192.168.0.99:/home/user/Downloads/a.zip)

However, calling dired-do-compress on the same file is just OK.

How can I fix this?


texts:
Whenever I use ssh over Tramp to get to my local server (either with dired or pointing directly to a file), another buffer is also created:

#<buffer *tramp/ssh user@local_server_address*>

When I finished my editing and close the buffer I was working on, the above mentioned buffer remains. Since it is not useful to me, is there a way to automatically kill it when I finished my editing?


texts: Merge Columns Together in Org-Mode Tables

texts:
Is there a way to merge columns together in an org-mode table?  Often when I auto-create a table it will split certain fields into unnecessary columns.  I would like a way to select those columns and then merge them together into one column.

Example
Input data:
Col1   Col2   Col3
a      b      longer data with spaces
a      b      another bit

What I get:
|Col1|Col2|Col3   |    |    |      |
|a   |b   |longer |data|with|spaces|
|a   |b   |another|bit |    |      |

Now imagine the same problem but with many rows that have extra columns on the end.  I want a way to select Col 3 and everything to the right and merge them together as one column.
Eg:
|Col1|Col2|Col3                   |
|a   |b   |longer data with spaces|
|a   |b   |another bit            |


texts: Org mode refiling gobbles a newline and absorbs the next heading

texts:
I often have this problem in Org mode: I write an item with org-capture, refile it, and days later I see a result like this:

*** TODO some task
some notes** StackExchange

I believe that the problem is that org capture inserts the text into the buffer, and if the item does not end with a newline, it gobbles the delimiter to the next heading and both get refiled together.

I already added two newlines to my capture template to minimize this problem. My capture template is:

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/org/gtd.org" "Reminders")
     "* TODO %?\n\n"))

If I try a new item with C-c c t and type something, I see it appear in the main buffer. If I delete the newline at the end, the newline is deleted in the buffer too and gobbles the next line. Deleting further characters in the capture buffer does not delete them from the main buffer.

I think I could add a hook such as (add-hook 'org-capture-before-finalize-hook ...) but I'm not sure how to include a newline and how to do it before refiling, to avoid the next item being refiled with the captured item.

How can I fix this problem?

Update: Following @Aquaactress's suggestions, I tried two methods. Both fail and the versions may be important:

Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)
GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02

In the first method, I added :empty-lines in the org-capture template:

(setq org-capture-before-finalize-hook nil)

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
     "* TODO %?\n" :empty-lines 1)))

The result in screenshots is below: I add a capture item, delete newlines from the end of the org-capture buffer, and refile. The heading next to the refiled item is gobbled:

In the second method, I added a function that inserts new lines at the beginning and end of the org capture buffer (for exposition, I also add hello world! to show that these insertions go at the beginning and end of the whole org buffer, not the org-capture buffer):

(setq org-capture-before-finalize-hook nil)

(defun +org|insert-newlines ()
  (beginning-of-buffer) (insert "\nhello world!\n")
  (end-of-buffer) (insert "\nhello world!\n"))

(add-hook 'org-capture-before-finalize-hook #'+org|insert-newlines)

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline "~/test.org" "heading 1")
     "* TODO %?\n" :empty-lines 1)))

The result in screenshots is below: I add a capture item, delete newlines from the end of the org-capture buffer, and refile. The heading next to the refiled item is gobbled and the lines inserted go at the beginning and end of the buffer, instead of the org-capture buffer.


texts:
I currently trying to remap my org mode agenda keymap in Spacemacs for org-agenda-next-item and org-agenda-previous-item. In the agenda view I like to map the functions to k for next-line and l for previous-line.

I already tested different approaches like:

  (define-key org-agenda-mode-map (kbd "k") 'org-agenda-next-item)
  (define-key org-agenda-mode-map (kbd "l") 'org-agenda-previous-item)

The result of this one is:
Error in dotspacemacs/user-config: Symbol’s value as variable is void: org-agenda-mode-map. And it doesn't matter if I put the key mappings into (add-hook 'org-agenda-mode-hook or (with-eval-after-load 'org environments..

Or this one (source: How do I change key bindings for org-mode agenda view?):

(add-hook 'org-agenda-mode-hook
          (lambda ()
                  (local-set-key (kbd "k") 'org-agenda-next-item)))

This runs without an error, but the remapping of the key k does not take place.

I also checked the command describe-keymap to search for the correct keymap register. But it seems, that org-agenda-mode-map is the correct one.

Is there another approach, which might work? Or am I doing something wrong?


texts: Accept unmatched input in completing-read when using helm

texts:
In helm, when executing following code:

(let ((things (list "a" "aa" "aaaa")))
     (completing-read "Thing: " things))

... how can I exit the minibuffer and return "aaa"?


texts: Emacs 24 GUI on OXS turn off transparency

texts: I'm using GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2015-04-10 on builder10-9.porkrind.org (from emacsformacosx.com) and I've got this annoying transparency going on and I don't know how to disable it. See attached image (it's not easy to spot but it's there).


texts: Does emacs have an option to display build settings?

texts:
Does emacs have an option or some internal command that displays build time settings and whatever features it supports?

A good example is the nginx -V command which lists the ./configure options it was compiled with.


texts: How to specify multiple patch files to be applied by Magit?

texts:
The Magit user manual says in the description of `w w' (magit-am-apply-patches):

  w w     (magit-am-apply-patches)
  This command applies one or more patches. If the region marks files, then those are applied as patches. [...]

This raises the question:

How do I use the region to select the patch files to be applied? In particular, the region of which buffer is intended to be used for that?

Looking into the sources, I found that the command magit-am-apply-patches uses the function magit-region-values to evaluate the selection. The latter's description explains that the region should constitute a "valid section selection" for this and refers to the description of the function magit-region-sections for details. That in turn states:

  When the region is active and constitutes a valid section selection, [...].  This is the case when the region begins in the heading of a section and ends in the heading of a sibling of that first section.

To profit from this description, one should know:

Which sections in which buffer show plain patch files that lie anywhere in the local filesystem?


texts: Tell package.el that dependency is already taken care of

texts:
Let's say I'm following the master branch of Org mode.  So, I have it
under ~/src/org-mode add tell my Emacs to load it by adding
"~/src/org-mode/lisp" to load-path.

I use ELPA and MELPA to install some Org mode extensions from there.
Unfortunately, package.el installs another version of Org mode because
the extensions, obviously, depend on Org mode proper.

Is there any way to tell the package manager that I already have Org
mode so that it does't have to install another version of it?  Something like

(setq package-locally-installed '((package1 . version) (package2 . version))

BTW, I don't have any problem having multiple version of packages.  My setup seems to work fine; ~/src/org-mode shadows the other.  My question is to tell package.el not to install packages I have already.

There is kind of the same question package-install doesn't pick up dependencies that are already in site-lisp, but the discussion is more like fixing helm installation but not to tell.

Another related question: How to install package without install dependencies through "package"?, which handles the issue by using a local repo.  It seems to work but it'd be nice if package.el already have some variable I can set.


texts:
It seems like cc-mode indentation is working rather well, however I seem to have run into a minor issue when creating a few enums in C++.

Emacs seems to handle almost all kinds of enums rather well now, even the "enum class" types, however, for some reason the following one seems broken:

class Test
{
public:
    enum t1
    {
        T0 = 1,
            T1,   <----- ?
            T2 = 3
            };
};

Removing the "t1" identifier fixes the "incorrect" indentation, but the identifier is still desirable in some cases.

So, the the "correct" indentation would be:

class Test
{
public:
    enum t1
    {
        T0 = 1,
        T1,
        T2 = 3
    };
};

Is there any way of fixing this, and do anyone know if this is the intended behavior?

This occurs with GNU Emacs 25.0.50.4, with accompanying cc-mode. Running with --no-init-file produces the same results, although with gnu-style indentation.


texts:
On Linux/macOS, using omit-mode in Dired is there a way to omit executables? Executables are files which have the Unix executable flag set and are then listed via ls -lF with an * after the filename.
Note:
I do know how to colorise executables in Dired: Via the diredful package (install from melpa) it is easy to setup a rule for this. Diredful can colorioser dried entries according to the full ls line (including the * character for executables). - I am wondering whether something like this is possible for omitting as well.


texts: what's the difference between "revert commits" and "revert change" in magit?

texts: In the magit from spacemacs, when I press O on a commit, it shows several actions, two of them are "revert commit" and "revert change", what's the difference between them?


texts: How to Implement Popup Menu Similar to That Used in Magit

texts:
Question

I would like to create user interface in form of popup menu, popup menu
similar to that used in Magit.

Features

Definition of Popup

Popup in context of this question means little temporary window that
contains collection of menu items so that user can select one and only one
of these items.

Position on the Screen

The popup is allowed to appear in any part of the screen, but it's desirable
that it should be quite obvious and thus it should appear beside currently
active window.

Contents of Popup Buffer

Items should be displayed in form of pretty table. Pretty is context of
the question means visually appealing, this effect can be most easily
achieved by putting menu items into straight rows, see
complete--insert-string for example. This paragraph serves for additional
clarification, you can do it in your own way, this won't render your answer
incorrect.

Selection of Menu Item

The selection is expected to be performed by a single key-pressing or,
optionally with a mouse (although it's not that important so answers
containing propositions that don't support mouse are legal). If you propose
solution that supports mouse, please note that user should be able to select
a menu item in an intuitive way, that is, by left-button clicking on desired
choice.

N.B. mouse can be used in many ways and alternative ways to indicate
a choice are also welcomed.

Elimination of Popup

Once user has selected a menu item in a way described above, the buffer and
thus its window should be eliminated from view as well as killed. The window
that has been active before invocation of the popup menu should get focus
(that is, become active) again.

Returned Value and Arguments

Preferably, this consequence of actions should result in a Lisp object
returned. The Lisp object can be either:

nil — this indicates that user has aborted the popup menu either by
pressing C-g or in some other way †.
string — string (it's allowed to use a symbol) should be string-equal
to one of the strings supplied to the popup menu as collection of actual
items.

Alternative ways to let the rest of program know user's choice, or,
possibly, its absence, are acceptable. However, if it's not clear how else
it can be performed I ask all answerers improvise and don't ask me for
further clarification of this aspect.

This is all for returned value. As for input parameters, they should at
least include collection of strings which represent possible choices (that
is, menu items).

Acceptable Answers

Expected answer can be of the following forms:

Sufficient code snippet that allows educated reader to write function like
that described above; it's not expected or necessary to write entire
working function. However, to avoid uncertainty (can considerable parts of
code be omitted?), I should note that missing parts of the snippet should
be described in textual component of answer.
A link to existing library that implements similar functionality. To avoid
uncertainty, I should note that similar in our case means that the
library can be used to create popup (see definition above) that has at
least 2 or 3 features described above. If proposed library is different to
the point where the previously stated condition cannot be met, each such
case will be judged independently and will be always upvoted if OP deems
it useful.
Description of built-in Emacs functions or third-party ones that can be
used to implement any feature described in section «Features», see
above. To avoid uncertainty, please state clearly how your answer can be
useful for future readers who want to implement popup, popup menu
similar to that used in Magit.

† Alternative ways to abort the popup menu may include the following (but
not limited to these):

clicking outside of popup menu window;
killing of buffer containing the popup without making a choice.


texts: emacs regex with multiple match for text, in multi line buffer

texts:
Following is sample text.

Header
This is test, and
mid line adsf
bag a lot of many things
shoes>
shoes/
This line should not be affected.
Neither this line.
This is test, and
mid line
bag a lot of many things
shoes>
shoes/
Footer

Need to replace/remove lines where text starts with This is test and ends with

shoes>
shoes/

using Emacs 26.1

Newbie to RegEx (emacs), following were my trials, failed to select multiple instance.

(This is test).*(shoes/)
^This is test.*shoes/$

Expected output is

Header
This line should not be affected.
Neither this line.
Footer


texts: Exclude entries in custom agenda views based on Level

texts:
I'm trying to configure a custom agenda view. I'd like to search through an .org file by matching tags, but then only show the top-level headline. I.e., suppose my org-file looks like this.

* Heading 1 :Target:
** Subheading a
* Heading 2

If I match tags in my agenda view, it will list both Heading 1 and Subheading a. I'd like to only include the top-level headline in my agenda view.

I've looked at the org-mode documentation, and I've found the Level specification (see orgmode manual). But I can't figure out how to make it work. This may just be my being a novice when it comes to LISP programming.


texts: I'm using, at the terminal on my android device, an simple approach to show the path to my location (export PS1="(\w)$ "). However, the \w seems to not be working in emacs shell emulator running inside termux. That is not really a problem, because I know where I am any time I run shell inside emacs. Is there some way to change default bashrc running by emacs, or just set PS1 variable to be "$ " only for emacs?


texts: key-chord gives error when pressing chord

texts:
When I start to press keychord binding, after first char it flashes me an error:

symbols value as variable is void: eldoc-mode.

Here is my chord definition:

(key-chord-define-global "ss" 'other-window)

I installed key-chords via melpa with cask, I'm using emacs-nox 24.5.1. Any help will be appreciated, thx.


texts: Is there a way to easily see currently defined faces?

texts:
I often find that I need to define faces for custom commands. I prefer to inherit from faces defined by the current theme, to keep things visually consistent.

M-x list-faces-display lists the faces, but it doesn't display a preview. It's just a list of face names and then the alphabet, formatted with the default "link" face.

Is there a way for me to easily visualise what faces are defined by the current theme? Is there a way for me to easily visualise all currently defined faces across the board?

Edit: M-x list-faces-display is not giving me a preview. Here is what it looks like with the leuven theme:

And here is what it looks like with zenburn:

If I disable my init file, I can get previews working again. The previews do actually appear to be in the correct face, but they are displaying as buttons. Is there any reason having the button property set to t or being in the help-face-button category would override the underlying face?


texts: How to indent inline elements only once?

texts:
In this case the basic offset is 4 and tabs mode is enabled.

For example I am getting:

if (! (true // Problem when the value starts inline.
        && false)) {} // I get two tabs, one per '('.

if (! (
    true // No problem when value does not start inline.
    && false)) {} // I get one tab as wanted.

I get one tab per (, but since they are inline, I want just one tab:

if (! (true // Problem solved.
    && false)) {} // One tab.

if (! (
    true // No problem.
    && false)) {} // One tab.

This is how I style my code:

(c-add-style
 "MyStylePHP"
 `((c-basic-offset . 4)
   (c-offsets-alist . (
                       (arglist-close . php-lineup-arglist-close)
                       (arglist-cont . (first php-lineup-cascaded-calls 0))
                       (arglist-cont-nonempty . +)
                       (arglist-intro . php-lineup-arglist-intro)
                       (case-label . +)
                       (class-open . 0)
                       (comment-intro . 0)
                       (inlambda . 0)
                       (inline-open . 0)
                       (namespace-open . 0)
                       (lambda-intro-cont . +)
                       (label . +)
                       (statement-cont . (first
                                          php-lineup-cascaded-calls
                                          php-lineup-string-cont
                                          php-lineup-hanging-semicolon +))
                       (substatement-open . 0)
                       (topmost-intro-cont . (first
                                              php-lineup-cascaded-calls +))))
   (c-indent-comments-syntactically-p . t)
   (indent-tabs-mode . t)
   (tab-width . ,(default-value 'tab-width))
   (fill-column . ,(default-value 'fill-column))
   (show-trailing-whitespace . ,(default-value 'show-trailing-whitespace))
   (php-style-delete-trailing-whitespace . nil)))

(add-hook
 'php-mode-hook
 '(lambda ()
    (c-set-style "MyStylePHP")))


texts:
Q: how do I use dired to copy/move files without overwriting?

I'd like to use dired to copy (or move) files from directory A
to directory B.  However, I only want to copy files in A that
do not already exist in B.

Example:

Directory A contains file1.txt, file2.txt, and file3.txt.
Directory B contains file1.txt.

How do I tell dired to copy only file2.txt and file3.txt
from directory A to directory B?  I can tell which ones to
mark with just a few files, but I'm thinking about situations in
which there are potentially thousands of files in the two
directories.


texts: How to input '#' in Emacs with UK keyboard on Mac OS X?

texts:
I'm using Emacs 24.5.1 in Mac OS X.

Recently I had to input £ frequently so I changed my input source from U.S. to British. With British keyboard, Option+3 will yield # in other editors, however, this doesn't work in Emacs since M is special keystroke in Emacs.

How can I insert # in Emacs in Mac OS X with Brithsh keyboard?


texts: How to run an `after-save-hook` only when the buffer has been saved manually

texts:
This question is inspired by https://emacs.stackexchange.com/a/5947/.

Assume that I have a function like

(defun do-some-actions () ()
(..put a copy of the current file in a specific folder...)
  )

And I would like that the above function to be run after saving files. The following hook can do the job:

(add-hook 'after-save-hook 'do-some-actions)

But in this way Emacs runs the function do-some-action even for the files which have not been manually saved. For instance when I install the packages via Melpa, Emacs itself saves some files with the name package_name-autoloads.el in the directory ~/.emacs.d/elpa/package_name/ and even though these files have not been saved manually, the function do-some-actions is executed.

My question is about the possibility to prevent Emacs to this after-save-hook when the file has not been saved manually.


texts: Why isn't face-remapping-alist permanent-local by default?

texts:
text-scale-mode uses a buffer-local face-remapping-alist to scale the buffer's text, adding values like (:height 1.2). It stores a "cookie" with the scaling it has applied in another local variable, text-scale-mode-remapping, and uses this to locate and remove previous scalings whenever the height needs to be reset.

Neither face-remapping-alist nor text-scale-mode-remapping are marked as permanent-local, so any event that wipes out buffer-local variables (e.g. changing major-modes) will clear them both. From text-scale-mode's perspective, this is fine: clearing face-remapping-alist causes the height to be reset, so there's no need to preserve text-scale-mode-remapping.

I'm using face-remapping-alist to change the background color of certain buffers, and want this to persist even when buffer-local variables are cleared, so I've marked it as permanent-local. This causes problems for text-scale-mode when local variables are cleared: it's height adjustments survive, but its memory of having applied them is lost when text-scale-mode-remapping is cleared. I can increase/decrease the height, but attempting to reset it to its true default just resets it to the height it had last time local variables were cleared.

I've fixed this by marking text-scale-mode-remapping permanent-local as well. I considered submitting a bug-report for text-scale-mode, but it only makes sense to mark text-scale-mode-remapping permanent local if face-remapping-alist is permanent-local too, and I don't know if that's a desireable default. I prefer it that way, but maybe there are other use-cases where it's not?


texts: How can  I save the cursor position for every file I have opened? So, next time I open the file, the cursor will be at the position I last opened it.


texts: Packages with user-facing generators / generator logic?

texts:
Are there any popular Emacs packages that incorporate generators in any of their user-facing functions / API?  I'm thinking of the core Emacs lisp implementation (iter-defun, iter-yield, etc.), but package use of alternatives would be fair too.

Since generators are quite new to Emacs (only introduced in v25.1?) I'm curious about what patterns/practices have been followed in applying them on a package's surface.

Using elisp-refs I found that none of my installed packages use any Emacs core generators yet and a relatively thorough search on GitHub failed to find published package usages.


texts: How to control quoting of original message when replying?

texts: I'm trying to set up notmuch for sending and receiving my Gmail email, and I think notmuch uses message-mode for its reply function. I tried setting message-citation-line-function to nil, but replying still quotes the entire message with a > prefix on each line. But that didn't work. How do I set it so that when I reply to a message, the sender's original message doesn't get quoted at all, in standard Gmail style?


texts: How to see the code of a built-in function

texts:
How can I see the code of a built-in function?
I'd like to look at the code of functions such as upcase-region. I looked at the completion list that I pulled up by "find-library TAB", but the list is huge and couldn't figure out if what I'm looking for is included in it or not.

I also looked at the help of upcase-region, and it says

upcase-region is an interactive built-in function in `C source code'.

But when I click the link `C source code', it just brings up a file selecting window with the .emacs.d folder opened, but there doesn't seem to be any file with the .c extension?


texts: Re-arrange columns in agenda clockreport?

texts:
My Agenda clock-report is kinda wide and columns are all over the place.

My agenda clock report plist is as following:

 '(org-agenda-clockreport-parameter-plist
   (quote
    (:tcolumns 2 :level\  t :link t :maxlevel 5 :narrow 60 :formatter my-org-clocktable-notodo :properties
           ("Effort" "CLOCKSUM" "CLOCKSUM_T"))))

The Effort/clock columns are placed before headings:

| File      | Effort | CLOCKSUM | CLOCKSUM_T | ITEM | Headline  ..| Time |

Is it possible to put the effort/clock columns at the end, after the heading instead like so:

| File      | ITEM | Headline  ..| Time | Effort | CLOCKSUM | CLOCKSUM_T |


texts: Org table date arithmetic with Lisp expressions

texts:
It's easy to do date arithmetic using org-mode table formulas.  For example, if I enter this table:

| [2020-01-01] | |
| [2020-02-01] | |
| [2020-03-01] | |
#+TBLFM: $2=$1+1

...and then do C-c C-c on the formula, the table updates column 2, adding one day to the dates in column 1.

Can this be done using a Lisp formula instead of a calc formula?  If so, how?

I see in the org-mode manual that Lisp formulas support various trailing flags to interpret the table cells in different formats, but not datestamps.  I experimented with calc-eval, but calc datestamps differ in format from org datestamps.  It appears there's some invisible plumbing that connects the two.


texts:
I want a list of upcoming deadlines (like: the next 2 months). I found two solutions, but both have a disadvantage.

Solution 1: Build an agenda view which excludes all entries which are not deadlines. Set nspan to, say, 60 days. Works fine. BUT: I cannot filter the entries. Yet I have regular deadlines upcoming every week I want to filter. No way. The usual answer given is that I should use org-agenda-tag-filter-preset, but the list is part of a block agenda, and the documentation of that variable clearly says that this variable does not work in a block agenda. And it does not work. So I could filter it manually, but I want a separate list which does not require me to do manual filtering.

Solution 2: Create a tags search matching all entries between certain dates ("DEADLINE>=<today>&DEADLINE<=<+2m>"). Works fine again. But then the list does not display the date. So I am stuck with a list of items which I know are due, but I have to look at each item separately in order to find out when it is due. What is missing, then, is the scheduling information the first solution gave me. Tweaking org-agenda-prefix-format changes nothing, obviously the scheduling information is only provided in agenda views.

So any ideas how I can have all three -- a list of deadlines, with automatic exclusion of certain (inherited!) tags, showing directly when the item is due?

EDIT: I want to see the "calculated" deadline, not just the value of the deadline cookie. Informations like <2017-12-3 +1m> are not helpful, plus, I am German and I always have to translate it to the German format, mentally.


texts: Using extended glob quantifiers break Zsh mode indenting and highlight

texts:
This is a small issue, but annoying to deal with. Suppose I have the following function:
function zicompinit_fast () {
  setopt extended_glob local_options
  autoload -Uz compinit
  local zcompf="$ZINIT[ZCOMPDUMP_PATH]"
  local zcompf_a="${zcompf}.augur"

  if [[ -e "$zcompf_a" && -f "$zcompf_a"(#qN.mh+24) ]]; then
    compinit -d "$zcompf"
    touch "$zcompf_a"
  else
    compinit -C -d "$zcompf"
  fi
}

The line if [[ -e "$zcompf_a" && -f "$zcompf_a"(#qN.mh+24) ]]; is interpreting # as a comment and throwing everything off. Is there a simple way to handle this?


texts:
Say I have a snippets folder:

snippets/web-mode/
├── django
│   ├── else
│   ├── for
│   └── if
└── erb
    ├── else
    ├── for
    └── if

Both engines have different syntax ({% %} and {{ }} vs <% %> and <%= %>).

How do I load yasnippets of a certain web-mode engine when it's activated?

Versions:

GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05
Spacemacs v.0.300.0 (develop, commit b00767cd6ec718df969bb1b7f713e5030ecf3c3e)

web-mode           20190301.1700
yasnippet          20181015.1212


texts: Hippie doesn't use yasnippet and fallback to emmet with emacs-lisp-mode

texts:
I use hippie-expand with emmet and yasnippet.

(use-package emmet-mode
  :init
  (add-hook 'css-mode-hook 'emmet-mode)
  (add-hook 'sgml-mode-hook 'emmet-mode)
  :config (unbind-key "<C-return>" emmet-mode-keymap))

(use-package hippie-exp
  :bind ("<C-return>" . hippie-expand)
  :config
  (setq-default
   hippie-expand-try-functions-list '(yas-hippie-try-expand emmet-expand-line)))

(use-package yasnippet
  :init
  (add-hook 'emacs-lisp-mode 'yas-minor-mode)
  (add-hook 'js-mode-hook 'yas-minor-mode)
  (add-hook 'org-mode-hook 'yas-minor-mode)
  (add-hook 'sgml-mode-hook 'yas-minor-mode)
  :config (yas-reload-all))

It works fine with js-mode, org-mode and with html-mode. But with emacs-lisp-mode and with lisp-interaction-mode, hippie-expand always delegate completion to emmet-expand-line.
Emmet completion is still available in non-emmet'ified buffers after an emmet'ified one has been opened (css-mode-hook and sgml-mode-hook). Is the right way to fix this to change hippie-expand-try-functions-list on prog-mode-hook depending on the current major mode?

How can I setup hippie-expand with emmet and yasnippet to fix these 2 issues?


texts:
Does something already exist to do this?

(defun good (var)
     (and (boundp 'var) var))


texts: How to view outline with slide counts in org-beamer-mode?

texts:
While working on a presentation in org-beamer-mode today I accidentally hit some unintended sequence of keys. This produced an outline view of the presentation, where each item in the outline had numbers in parenthesis that appeared to represent the number of slides under that heading. I tried view-lossage as soon as I realized what I had done, but still could not figure it out.

What did I do?


texts: Will there be security updates to Emacs 24.3?

texts:
I am trying to make the case to my employer that updating from Emacs 24.3 to Emacs 24.5 is the right thing to do.  The (understandable) justification for sticking with version 24.3 is that it is supported and configured by the OS vendor (CentOS), and as such, it will receive security updates, etc.

My argument is that once 24.4 was released, 24.3 reached the end of its support, and all future updates would be updates to the latest version.  I found the following paragraph in the GNU Emacs FAQ, but I'm not sure that it clearly supports or refutes this claim.

  A version number with two components (e.g., ‘22.1’) indicates a released version; three components indicate a development version (e.g., ‘23.0.50’ is what will eventually become ‘23.1’).

My question then is this: Will Emacs 24.3 ever receive security updates in the future? (or updates of any kind for that matter.)


texts: How do I enable agda-mode's unicode input mode across all modes in Spacemacs?

texts:
I'd like to be able to type unicode characters like Π using agda-mode's "\Pi". In Emacs, I used to configure this like:

(load-file (let ((coding-system-for-read 'utf-8))
                (shell-command-to-string "agda-mode locate")))
(require 'agda-input); for unicode input via latex names like \forall.
(add-hook 'evil-insert-state-entry-hook (lambda () (set-input-method "Agda")))
(add-hook 'evil-insert-state-exit-hook (lambda () (set-input-method nil)))

In Spacemacs, I've enabled the agda layer (which has nicely found my Homebrew agda installation without addition configuration, thanks). I am able to type "\Pi" in .agda files an it works. However, it is not available in other modes.


texts: Right aligned relative numbering with separator space in Spacemacs using linum-relative

texts:
I've been using Vim for a while and now I've discovered Spacemacs and I found it great how it blends Vim ease of editing with Emacs superior power.

I really loved some parts of my Vim config, one of them was relative numbering.

In oder to have an idea, this is the Vim setup I'm trying to emulate (notice that relative numbering is off since Vim window doesn't have focus when taking the screen grab):
vim setup

Trying to get the line numbering right aligned with a separator space in Spacemacs was quite complicated. But I'm finding it impossible to do the same for relative numbering. This is my code taken from emacs wiki for right aligned line numbering with a separator space:

    (unless window-system
      (add-hook 'linum-before-numbering-hook
            (lambda ()
              (setq-local linum-format-fmt
                  (let ((w (length (number-to-string
                            (count-lines (point-min) (point-max))))))
                    (concat "%" (number-to-string w) "d"))))))

    (defun linum-format-func (line)
      (concat
       (propertize (format linum-format-fmt line) 'face 'linum)
       (propertize " " 'face 'mode-line)))

    (unless window-system
      (setq linum-format 'linum-format-func))

Any idea on how to achieve the same thing for linum-relative?

EDIT 1:
I've tried the following code:

  (defvar my-linum-relative-format-string "%4s")
  (defun my-linum-relative-get-format-string ()
    (let* ((width (length (number-to-string
                           (count-lines (point-min) (point-max)))))
           (format (concat "%" (number-to-string width) "s")))
      (setq my-linum-relative-format-string format)))

  (setq linum-relative-format 'my-linum-relative-format)

  (defun my-linum-relative-format (line-number)
       (propertize (format my-linum-relative-format-string line-number) 'face 'linum-relative))

But it fails with the error: Error in post-command-hook (linum-update-current): (wrong-type-argument stringp my-linum-relative-format)


texts: Generate (populate?) table in org-mode using org-lookup-all

texts:
In an otherwise empty *.org file I have a table like

#+TBLNAME: tbl1
|Name|Value|
|A   |    1|
|B   |    2|
|A   |    3|

and I want to somehow create a table that should look something like this:

#+TBLNAME: tbl2
|Name|Frequency|Sum|
|A   |2        |4  |
|B   |1        |2  |

In my real case tbl1 is 150 rows and changing, so it is only feasible if tbl2 is autogenerated somehow.

#+TBLFM: @2$2..@>$2='(length (org-lookup-all $1 '(remote(tbl1,@2$1..@>$1)) '(remote(tbl,@2$2..@>$2))))

Produces the desired content for column 2 in tbl2, but

#+TBLFM: @2$3..@>$3='(apply '+ (org-lookup-all $1 '(remote(tbl,@2$1..@>$1)) '(remote(tbl1,@2$2..@>$2))))

produces "#ERROR" with the following content in Substitution history:

Substitution history of formula
Orig:   '(apply '+ (org-lookup-all $1 '(remote(tbl,@2$1..@>$1)) '(remote(tbl,@2$2..@>$2))))
$xyz->  '(apply '+ (org-lookup-all $1 '(remote(tbl,@2$1..@>$1)) '(remote(tbl,@2$2..@>$2))))
@r$c->  '(apply '+ (org-lookup-all $1 '(#("A" 0 1 (fontified t face org-table)) #("B" 0 1 (fontified t face org-table)) #("A" 0 1 (fontified t face org-table))) '(#("1" 0 1 (fontified t face org-table)) #("2" 0 1 (fontified t face org-table)) #("3" 0 1 (fontified t face org-table)))))
$1->    '(apply '+ (org-lookup-all "B" '(#("A" 0 1 (fontified t face org-table)) #("B" 0 1 (fontified t face org-table)) #("A" 0 1 (fontified t face org-table))) '(#("1" 0 1 (fontified t face org-table)) #("2" 0 1 (fontified t face org-table)) #("3" 0 1 (fontified t face org-table)))))
Result: #ERROR
Format: NONE
Final:  #ERROR

When appending ";N" to the second TBLFM, both rows in tbl2 "Sum" is 6 (that is, the sum of all entries).

What is wrong with the second TBLFM?


texts: What is the correct way to unset :foreground color?

texts:
For better experience color-identifiers-mode recommends turning off colors for everything. The example in README does it by setting :foreground of faces to nil, which kinda works.

However doing it globally is unwanted for unsupported modes, e.g. for Markdown. So faces have to be set locally, which is the problem: setting :foreground to nil triggers an error:

(face-remap-add-relative 'font-lock-keyword-face '((:foreground nil)))
[*Messages* buffer ↓]
Invalid face attribute :foreground nil
Invalid face reference: font-lock-keyword-face

Setting to 'unspecified triggers:

(face-remap-add-relative 'font-lock-keyword-face '((:foreground 'unspecified)))
[*Messages* buffer ↓]
Invalid face attribute :foreground (quote unspecified)
Invalid face reference: font-lock-keyword-face

Using unspecified without ' changes nothing.

And, finally, using an empty string does work, but triggers a warning:

(face-remap-add-relative 'font-lock-keyword-face '((:foreground "")))
[*Messages* buffer ↓]
Unable to load color ""

I personally could settle down with an empty string, but I'm going to change the README recommendation about setting faces, and triggering warnings for users not a good user experience.

So, what is the correct way of unsetting the :foreground color?


texts: magit-status doesn't use the whole screen size in 2.3

texts:
In previous versions (before 2.3) M-x magit-status showed the status buffer taking the whole size of the current window.  However, now it instead pops up a half-sized buffer (like e.g. C-h f does).  This looked fine but only until I wanted to review a diff of changes, as then it became apparent I want a full-sized window with the status buffer.

Is it possible to return the previous behavior of M-x magit-status?


texts:
I need to call realgud from a certain directory, because my python cant be called from another directory. How do I do that?
I need to call it from a root directory and my python program where the main is in the source directory.


texts: How to generate TAGS tables for JavaScript with React?

texts:
I'd like to create TAGS tables for JavaScript ES6 code using React like the following:

import React from 'react'
import { observer } from 'mobx-react'
import { Formik, Form, Field } from 'formik'
import { Auth_context } from './auth-state-control'
import { Link, withSiteData } from 'react-static'

import '../../styles/login.css'

export const UserLogin_form = observer(() => (
  <Auth_context.Consumer>
    {auth_store => (
    // TODO: Formik is not used yet here.
      <Formik>

              <Link to='/'></Link>
              <form method="POST">

Login with email

                     <input type="email" name="email" required />
                     Email

                      <input type="password" name="password" required/>
                      Password

        <Link to='/profile'>
                    <button type="submit">Login</button>
                </Link>
              </form>
              <Link to='/forgotten_password'>Forgot your password?</Link>

      </Formik>
    )}
  </Auth_context.Consumer>
))

class UserLogin_page extends React.Component {
  render() {
    return (

        <UserLogin_form/>

    )
  }
}

export default withSiteData(UserLogin_page)

I've tried etags and exuberant-ctags, the former not understanding JavaScript and the latter giving me the following empty entry for this file:

  user_webapp/src/auth/login.js,0
  ^L

I'd like meta-. to work for HTML defined objects and regular JavaScript.

I saw mention of helm and ivy, but those appear to be for completion and not generation of tags tables.

How can I generate TAGS tables for my reactive JavaScript code that detects all the definitions?


texts: How do I keep special modes from overriding my keybindings?

texts:
I usually have multiple windows open and switch between them often, so I put this in my init file:

(global-set-key (kbd "C-o") 'other-window) ; Save a keystroke when switching windows
(global-set-key (kbd "C-x o") 'open-line)

This switches the two default commands C-o and C-x o.

Having done this, C-o doesn't work when the active window is Dired or Buffer Menu, since both of these have their own commands that override my keybindings: respectively, dired-display-file and Buffer-menu-switch-other-window. It seems to me that I don't really need these, since o alone does almost exactly the same thing.

How can I make C-o always run other-window and not something else?


texts: Emacs 24.4 no longer highlights keywords in `M-x run-python`

texts:
With Emacs 24.3 I get certain keywords highlighted in an inferior Python buffer:

This is no longer the case for Emacs 24.4:

What could possibly cause this? I've made sure it's not my configuration by running emacs -q and am not sure whether font-locking generally changed or the packaged python.el has regressed.


texts: Convert the first character to uppercase/capital letter using yasnippet

texts:
Q: I have the following Yasnippet, which looks like this:

 MYNAME - $1 (`(insert-mode-description)`).
 $2

When I insert the snippet, the cursor starts on $1. Then I begin with typing. I would like to convert the first character of the sentence that I'm typing to uppercase.

When I look in the documentation of Yasnippet, there is a transformer that converts your text to uppercase. I need only to capitalize the first character.

Then I figured out another option:

MYNAME - $1 $2 (`(insert-mode-description)`).
$3

So Everything in $1-place gets converted to uppercase. Then press tab, to jump to $2 and typing further in lowercase letters.
But I'm not looking for that. Then I need to press tab every time after I insert the first character.
                                                                                I would just convert the first character of $1 to be uppercase. Any suggestion?


texts: insert picture without replacing the word in artist mode

texts:
I want to add rectangle outside the text as follows:

+---------+
|why there|
+---------+

But what I get is

+--------+
|hy there|
+--------+

I use C-c C-a r at the beginning of line which just above the character "w"


texts:
How do I remove an existing hyperlink without having to wade in and manually delete a bunch of brackets? When I try to org-insert-link and just delete the existing link, I get Lisp error: (error "Empty link").

I want to remove the link and preserve the text (i.e. the description).


texts:
Is there a hook to execute stuff after I've run emacs --daemon? I'd like to keep load stuff only when running emacs --daemon and not when running emacs.

I know it sounds like using square wheels, but I do have my reasons.


texts: Line number (linum, nlinum) grow margin with increase in font size

texts: When I turn on linum-mode or nlinum-modeand increase the font size via C-x C-+ it does not increase the size of the "margin" where the line number is displayed, so only part of the line number is visible. Is there a way to configure either of these modes so that the entire line number is always visible regardless of font size? Tested using emacs 24.5 on OS X and emacs 24.3.1 on ubuntu 14.04


texts:
Say you would for instance define 5 variables with multiple cursors and you wanted to name them x_i where i ∈ {1,2,3,4,5}. Instead of writing 5 rows with x_ and then filling the rest manually, is there any way this could be done with multiple cursors?

I.e. like https://github.com/duydao/Text-Pastry for sublime.


texts: visual-line-mode-hook not runnng on mode exit

texts:
I would like to have whitespace-newline-mode enabled every time visual-line-mode is enabled, and disabled correspondingly.

The documentation on "visual-line-mode-hook" says "Hook run after entering or leaving `visual-line-mode'."

I put this in my .emacs :

(add-hook 'visual-line-mode-hook #'whitespace-newline-mode)

When I go into visual-line-mode, I can see the newlines as desired.  However, when I go out of visual-line-mode, the newlines are still there, and I have to manually run whitespace-newline-mode to disable it.

Is the visual-line-mode-hook documentation just wrong, or am I missing
something fundamental about add-hook here?

(As an aside: how do I configure the color of the newline characters
that are displayed when I run whitespace-newline-mode?)


texts:
I have used reftex-toc for a while without problem, but a while back it started to show the wrong numbering in the toc-buffer. I don't think I have changed any settings. The latex-output is not affected, so it seems to only be a problem in the parsing of the buffer.

tex-clean, refreshing the buffer or restart of Emacs does not help.


texts: Pasting text into Emacs 24 search command buffer

texts:
I recently installed Emacs 24 on my Ubuntu machine. I access this machine via SSH from a Mac. I am trying to search for some text and I am pasting the text in the search command's buffer. I.e I do C-s, then paste by doing ⌘+v on my mac keyboard.

The text gets pasted into the document instead of the search command's buffer.This wasn't the case with Emacs23 where the pasted text was in the search command and not in the document.

How do I get ⌘+v to paste text into the search buffer?


texts:
What is the difference between reftex-citation and org-reftex-citation?

And where can I find the documentation for org-reftex-citation referenced in this answer?

[1] Emacs manual: Creating citations


texts: How to define custom paragraph types in org mode with custom fontification?

texts:
How can I define custom paragraph blocks in org mode with a custom fontification, for example something like
#+BEGIN_MYPAR
Some text
#+END_MYPAR

Then I want for example that this block is displayed in orange font color, one point larger than the rest of the text, bold face and indented by one tab.
How can I do this?
Edit:
The question is about how things are displayed in the emacs buffer, not in exports (though this may have been a follow up question).


texts: What is the correct way to launch a long-running shell command from magit?

texts:
In response to a question about extending magit's push menu, I have successfully added a command that logs into a remote server, pulls from where I am, and runs make:

(defun magit-update-course-repo ()
  "Run pull-and-mk-repo remotely to update the course repo"
  (interactive)
  (let ((cc (course-number-and-update-command)))
    (when cc
      (let* ((command (cdr cc)))
        (shell-command command)
        (magit-fetch-all-no-prune)))))

But the command here is an ssh command which runs a script, and the whole thing takes many seconds to complete.  During that time, the user interface does not acknowledge that anything is happening, and indeed emacs seems to freeze.  Eventually, however, the magit status window updates, and a *Shell Command Output* is shown in another buffer.
In other words, the functionality is there, but the user experience is not good.

I know magit provides internal tools that can do better than shell-command, but I am having trouble understanding the documentation and reading the source code.  What magit functions should I use to achieve the  following goals?

The moment the command launches, magit's user interface acknowledges that something is happening, even if it takes a long time to complete.
The command's output goes into magit's "process buffer", just like the output from normal git commands.
Ideally, while the command is running, the user can get on with life and do other things inside emacs.

I have gotten as far as discovering the existence of command magit-start-process, but I have not figured out how to use it.


texts: Whats the correct structure and way to load libraries / packages?

texts:
I have create a quite large emacs package now its split over many files.
currently i am running an org block with multiple load calls to load them, this is not idea for redistribution.
How should I setup my project so loading the core file loads all other files ?

~/.emacs/folder/core.el
~/.emacs/folder/main.el

Currently i have a structure like the above, i have placed require calls in main.el but these do not find or load my files, seems it should invoke a load if not available this could be due to require not looking in the current folder ?
Any advice on how to setup this structure so that:

A I can load main.el should i use load or load library
B how to load the files that main.el requires.

Needed to add to load path with the below commands, then all files load via require correctly, thanks to tylor below.
  (add-to-list 'load-path "~/.emacs/dc/")
  (load "dc-popups")


texts:
Running emacs 25.2.2.

Here is something (apparently) simple I want to do, but am unable to:

I am editing an html document. I want to see the same document in the
internal browser in a vertically split window.
Now, if I make any changes to my html document and hit a key (may be, save buffer could be the trigger), the
browser buffer is updated to reflect the changes.
The scrolling between the two buffers is synchronized

I can C-c C-v (browse-url-of-buffer) but that does not help because there is no way of updating the browser buffer. Moreover, the scrolling is not synchronized.

How do I get this done?


texts: How to stop auto backup in some directory in Emacs

texts:
In general I want Emacs to save a backup file for me, except in some special directories.

I tried to define a Directory Local Variables, and add:

((nil . ((make-backup-files . nil))))

But it seem it won't take effect. I think it is because make-backup-files is a global variable.

Is there a equivalent local variable to control the backup creation function?


texts:
I created a bookmark-file bookmark, with Bookmark+. Now when I open it using C-u C-x j y I need to answer 3 questions:

Jump to bookmark-file bookmark (test): <enter>
SWITCH to new bookmark file, instead of just adding it? (y or n) y
Save current bookmarks before loading? (y or n) y

How to get rid of these questions and just silently load the file answering y everywhere?


texts: Customizing f6-key for fast "M-x imenu" + "Pr" + Enter

texts:
I wish to customize my f6key so it corresponds to a fast way of doing M-x imenu, then Pr RET. I've added the following to my ~/.emacs:
(global-set-key [f6] 'imenu)

Then I've tried to add different stuff after 'imenu, but all has failed and I've tried to google Emacs forums and google, but didn't find an obvious solution.

When M-x imenu is started it gives the user 4 possibilities:
  2: Rescan
  3: Procedures
  4: Types
  5: Modules

I always want to go into Procedures so it's enough to type Pr
followed by RET. And that explains the full key-sequence: M-x imenu, then Pr RET.

How can I proceed from the (global-set-key [f6] 'imenu) step and make the F6 key work as described above...

UPDATE: Thanks a lot so far (also for "pretty"-fying the question), however something new happened: Based on the answer from RichieHH I tried adding the following to my ~/.emacs file (although on a different system/computer, please bear over with that):

(fset 'lastMacro
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([120 31 escape 120 105 109 101 110 117] 0 "%d")) arg)))
(global-set-key [f5] 'lastMacro)

(fset 'yep
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([escape 120 105 109 101 110 117 return 109 97 105 110 return] 0 "%d")) arg)))
(global-set-key [f6] 'yep)

Thing thing is that now the F5-key works - but not the F6-key. If you want to use the same "test file" as I'm using, grab the example at https://raw.githubusercontent.com/orlp/pdqsort/master/bench/bench.cpp and then M-x imenu should allow to quickly jump to different sections in that file. The problem seems to be: I'm running the X11 version of emacs (didn't try terminal-only) and if I type M-x imenu a "text-menu" pops up. If I instead use the F5-key, a GUI/X11-menu pops up, at the mouse cursor location... And that's probably why the F6-key doesn't work... I appreciate if anyone could please explain that behaviour and if I'm doing something wrong (reading the answer incorrect)?


texts:
I'm using neotree and as you know it opens a file in the most recent window split you accessed before switching to neotree (window 0).

Sometimes this last accessed split is the ansi-term window I have below (see chart), in this case spacemacs open a file in the terminal split, which is not what I want.

How do I distinguish the terminal split to neotree so that it chooses a "regular" one?

Possibly, this issue is not specific to spacemacs but to emacs in general.


texts:
I followed instructions here:
https://github.com/leoliu/ggtags
I've enabled the following:
(add-hook 'c-mode-common-hook
          (lambda ()
            (when (derived-mode-p 'c-mode 'c++-mode 'python-mode)
              (ggtags-mode 1))))

However, when I activate ggtags-mode, and try to use M-. on an item, global always returns 0 matches.  I have pygments installed, and I have a GGTAGS file, but it doesn't seem to find any matches on even simple functions like open().
When I use elpy-mode, however, I can use M-. and get exactly the behavior I expect.  I am interested in getting exuberant tags to work rather than python because I understand it is designed to work multi-language: http://ctags.sourceforge.net/languages.html including python.


texts: Package lacks a "Version" or "Package-Version" error, even if the "Version" info exists

texts:
After upgrading cask the error message changed.

Wrong type argument: sequencep, pinyin-mode

Original Question

I want to use my elisp through cask.

But it failed with error:

Dependency pinyin-mode failed to install: Package lacks a "Version" or "Package-Version" header

There is a line ;; Version: 0.0.1 in my *.el file.
What am I doing wrong?

This is the file I want to load through cask.

https://github.com/ironsand/pinyin-mode/blob/master/pinyin-mode.el

Environment

I installed cask by brew install cask in MacOS.

$ cask --version
0.8.1
$ emacs --version
GNU Emacs 25.3.1
$ which emacs
emacs: aliased to env HOME=/Users/ironsand/spacemacs emacs
$ /Applications/Emacs.app/Contents/MacOS/Emacs --version
GNU Emacs 25.2.1


texts:
I'm on Windows, for what it's worth.  Just to make sure that it wasn't something that I did, I fired up emacs using -Q to avoid loading my init.el and attempted to run some python with a breakpoint set inside one of my unit tests.  For the record, this works perfectly fine from Command Prompt -- I can debug there to my heart's content.

As you can see, (I'm using emacs 24.5.1 32-bit in Windows 7 and) the breakpoint is hit and no output from pdb is displayed.  What on earth could the issue be?  My colleague is running emacs as well and he can debug from pdb without problems.  Any thoughts on how to rectify this?


texts: How do I protect command output in eshell and REPL buffers?

texts:
Since command outputs are easily mutable, I have to be careful when I work with eshell and REPL buffers.

Is there a way to protect them?


texts: Replace lines with ( with :( by regex-replace

texts:
I have such a snippets:

Exercise 2.32.  We can represent a set as a list of distinct elements, and we can represent the set of all subsets of the set as a list of lists. For example, if the set is (1 2 3), then the set of all subsets is (() (3) (2) (2 3) (1) (1 3) (1 2) (1 2 3)). Complete the following definition of a procedure that generates the set of subsets of a set and give a clear explanation of why it works:

(define (subsets s)
  (if (null? s)
      (list nil)
      (let ((rest (subsets (cdr s))))
        (append rest (map <??> rest)))))

Select them all and run regex-replace  ^\(.*(\) → : \1

The result I expected is

Nevertheless, it proved to be:

Whats' the problem with my usage?


texts: I just started using evil-mode after having used elscreen for a long time. evil-mode will bind the C-z key to evil-emacs-state but do you know how I can rebind either this function, or the elscreen emacs key?


texts:
I would like to bind M-S-up to C-u 7 S-up to move a timestamp a week forward (and down for back). A modification of this answer resulted in a "Symbol is void" error in Emacs.

I tried modifying the define-keys command, but was not successful, as Emacs then stated that "-up" could not follow after "M-S".

How can I configure a keybinding in my ~/.emacs file to execute C-u 7 S-up?

Update

I placed the following, modified from the answer linked above, in the scratch buffer and evaluated it:

(define-key my-map (kbd "C-u 7 S-up") (kbd "M-S-up"))

Emacs returned Symbol's value as variable is void: my-map.


texts: How to start a specific Firefox profile with browse-url?

texts:
In command line I can start a specific firefox profile doing someting like that:
firefox -P my_specific_profile

Is it possible to configure emacs for use a specific Firefox profile when using browse-url command?


texts: `company` completion with following text

texts:
When there is text immediately following point, company completion does not activate.

E.g. where | is point and [...] are completions:

;; Completion
foo.|
    [bar]
    [baz]
    [quux]

;; No completion
foo.|irrelevant-text

Is there a way to make completion always activate, even when there is text immediately following point?


texts: How to compile, view or preview using markdown-mode

texts:
I am using Emacs 25.1 on a Mac.
When I try to view, preview or live export a simple markdown file using markdown-mode in Emacs I obtain the following error: /bin/bash: markdown: command not found(in my browser or in a eww buffer).

Is it possible a result of a conflict between markdown-mode and pandoc-mode? What can I do to be able to view/preview markdown files using markdown-mode?


texts: How to change item to DONE in agenda view?

texts: I moved from Omnifocus to Org-mode. I liked the ability of Omnifocus to mark an item as DONE from the "due list", which corresponds to Agenda view in org-mode, by hitting SPACE. I tried S-RIGHT, which works to cycle the state of an item in the normal view, but in agenda view it changes a date. I could not find it in The Org Manual. I have to press RET, which brings the buffer, then change the state there. Does org-mode have a shortcut for this?


texts: Can't evaluate plantuml in org-mode blocks

texts:
I have this weird error I don't understand :
#+begin_src plantuml :file img/example-uml.png
@startuml
class Example {
- value : Integer
- other : Double
+ up()
+ down()
}
@enduml
#+end_src

This fails with a wrong type argument : char-or-string-p, nil. It seems to be a problem with the :file header arg as using other nonsensical values such as :file 1 outputs wrong type argument stringp, 1.  And :file "example.png" outputs wrong type argument : char-or-string-p, nil as well. If I remove it, the block complains it has to have a :file argument.
This is the relevant defun in ob-plantuml. But it never uses char-or-string-p to validate the arguments. So maybe it's something with the org block ?
I'll add that I have org-plantuml-jar-path set properly and that the creation of the image does work in plantuml-mode, which is all the more frustrating.
I use emacs 27.1 and org-mode version 9.3.
Can someone help me ?
Thanks
Edit : added the backtrace
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
  org-babel-execute:plantuml("@startuml\nclass Example {\n- value : Integer\n- othe..." ((:colname-names) (:rowname-names) (:result-params "replace" "file") (:result-type . value) (:results . "replace file") (:exports . "results") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no") (:file . "img/example-uml.png")))
  org-babel-execute-src-block(nil ("plantuml" "@startuml\nclass Example {\n- value : Integer\n- othe..." ((:colname-names) (:rowname-names) (:result-params "file" "replace") (:result-type . value) (:results . "file replace") (:exports . "results") (:file . "img/example-uml.png") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "none")) "" nil 4196 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)


texts: How do I carry over an entire column from one table to another?

texts:
I'm trying to set up a monthly budget in org mode, and carry over the balance for each category from month to month. So I'll have something like

|Category|Last |Budget|Actual|Balance|
|        |Month|      |      |       |
|--------+-----+------+------+-------+
|One     |5    |    25|    10|     20|

Where Balance is LastMonth+Budget-Actual, and LastMonth is Balance for Category from the previous table.

I know I can use remote references and have one per category, doing something like @2$2=remote(previous_table,@2$5), and just repeat it over and over for each category, but it seems wasteful and awkward, when I feel like I should be able to use $2=remote(previous_table,$5) to solve the entire problem, but that syntax seems to simply copy over the value in the current table, without using the remote at all.

Is there some way to do what want more effectively?


texts:
I would like to create a (read-only) popup window with some text in it, such that the user can close it by pressing 'q'. You know - the kind you see when you try compiling and get errors.

Any pointers to elisp functions I should look at?

Edit: I managed to get a popup buffer with the text I need, but I still need to make it read-only and respond to 'q' to kill the buffer.


texts: org-fill-paragraph in the presence of LaTeX Formula

texts:
Consider the following piece of text
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore
$$e^ix = cos(x) + i \dot sin(x)$$
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore

The text is overly long so want to org-fill-paragraph it. Unfortunately M-q yields
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
eiusmod tempor incididunt ut labore et dolore $$e^ix = cos(x) + i \dot
sin(x)$$ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
do eiusmod tempor incididunt ut labore et dolore

which puts the formula within the text making it hard to read.
What can I do to make Emacs fill the text but keep the formula between $$ on its own line?
I looked at this answer but couldn't make it work. I'm also hoping for a simpler solution for what I suspect is a common use case.


texts: How to write a function with an interactive choice of the value of the argument?

texts:
How to write a function in Emacs Lisp that interactively would give the opportunity to choose one of the options?

Choose your animal: Cow Rabbit Dog

You have to press 1 to select Cow, 2 to select Rabbit and 3 to select Dog


texts: server-edit vs kill-buffer to kill an emacsclient buffer

texts:
I use emacsclient to open files from my webrowser (pdfs, text files etc). When I'm done with the file, I know I need to close it with C-x # (server-edit); if I use C-x k (kill-buffer) I get a warning that the buffer still has a client. This happens frequently, and I'm tempted to advise kill-buffer to check for, and close, clients for the current buffer when called.

This seems obvious enough that there's probably a reason it's not the default - am I overlooking a problem this will create? What bad things could happen if I automatically close clients when killing a buffer?

(motivated by discussion of my answer to a related question on stack overflow)


texts: How to disable the / character prefix in Cyrillic input mode?

texts:
When I switch to Cyrillic input method (by pressing C-\), the / key starts to act as a prefix to enter extended characters.
For example:

/o -> њ
/a -> ќ
/y -> ї

etc...
Is there a way to disable this behavior? I'd prefer to switch it off permanently for all modes, so pressing the / always enters the same character independently of what I typed after it.


texts:
I started coding in vhdl and I'm currently using emacs with its vhdl mode as editor on Ubuntu 16.04 OS.
However i was wondering if its possible to start emacs already in vhdl mode, meaning I won't have to enable the vhdl mode every time after starting emacs (m-x vhdl-mode).


texts: Getting rid of plain text timestamp entry in agenda export

texts:
I am trying to create a weekly agenda that I can print out and use without having to be at the computer
To best explain my problem I will use some screenshots
This is the normal org file that I will export as an agenda

These are the settings I have in for exporting my agenda
(setq org-agenda-exporter-settings
       '((ps-number-of-columns 1)
         (ps-landscape-mode nil)
         (org-agenda-add-entry-text-maxlines 5)
         ))

(setq org-agenda-prefix-format "[ ] %t ")
(setq org-agenda-entry-text-mode t)
(setq org-agenda-entry-text-maxlines 5)
(setq org-agenda-skip-additional-timestamps-same-entry nil)
(setq org-agenda-use-time-grid nil)
(setq org-agenda-with-colors t)
(setq org-agenda-remove-tags nil)
(setq ps-print-header nil)

And a screen shot below shows the result of the export (as a pdf file)

The problem here is that I am interested in displaying extra information under each headline (for example ring exercise has a sub list of different exercises to do) however when I do this I am forced to print out the whole time stamp and its syntax as  well.
But I don't need this since I already formatted the prefix to display the time. This time stamp also takes up to much space.
I was wondering if there was any way that I can get rid of just the timestamp line but preserve the rest of the text under each headline?
I tried searching for ways to do this but to avail. I just continually found ways to edit, filter and organize specific agenda headings but not edit the info underneath.
If there is no function or variable that I can use, how can I structure my org file to avoid this problem?


texts: Attempt at remapping evil only remaps some of the keys

texts:
I'm attempting to change the mapping of evil mode, and I have placed the code below in my .emacs file.

When I start emacs some of the keys have been remapped, while others have not

These keys got remapped correctly:

e down
n back
s insert
t append
z undo
Z redo
c copy line
v paste
l previous word

These keys did not:

u up
i forward
y next word

I have changed more than what's listed here, but these are what I tested.
The relevant additions to .emacs

(define-key evil-motion-state-map "e" 'evil-next-line)
(define-key evil-motion-state-map "n" 'evil-backward-char)
(define-key evil-normal-state-map "z" 'undo)
(define-key evil-normal-state-map "Z" 'redo)
(define-key evil-normal-state-map "c" 'evil-yank)
(define-key evil-normal-state-map "v" 'evil-paste-after)
(define-key evil-motion-state-map "l" 'evil-backward-word-begin)

(define-key evil-motion-state-map "u" 'evil-previous-line)
(define-key evil-motion-state-map "i" 'evil-forward-char)
(define-key evil-motion-state-map "y" 'evil-forward-word-end)


texts: Add dotted line in org-mode for export to latex and ODT

texts:
I can get the desired result

consumable1........................................month/year

consumable2........................................month/year

consumable3........................................month/year

consumable4........................................month/year

into a latex export by replacing the dots with the \dotfill command in org-mode. However, the command is not recognized by the ODT export org-mode option, and I was wondering if there is a workaround? This is why I hate having to work with people that only use word :-(. Thanks in advance for any help.

Update:

The solution should also be able to cope with strings with different lengths. For example:

apple..................................month/year

banana..................................month/year

pear..................................month/year

is not ok, because it does not create the correct amount of dots in each line, so that the dates are all right aligned.


texts:
Why does the following sexp hang?

(let ((buf
          "*Async Shell Command*"))
     (async-shell-command "cat")
     (while (get-buffer-process buf)
       (message "still has proc")
       (kill-process (get-buffer-process buf))))


texts: How can I find the path of files in an (m)elpa package?

texts: I wrote a minor mode for automatically detecting the language in which the user is typing.  For this to work, I have to load some files containing language statistics.  These files are in a subdirectory of the (m)elpa package.  How can I determine the path to these files?  Is there a function that gives me the base directory of a package?


texts:
I use Spacemacs, and I often use SPC b b to list buffers so that I can kill the buffers I no longer want. Unfortunately, this process takes a while because I have to repeatedly press SPC b b, navigate to a buffer I want to kill, open it, and then hit SPC b d.

I was looking for something that allows me to open up a list of buffers, in a new buffer, and quickly navigate through them and delete them easily. Kind of like Dired (in Evil mode), which allows you to use j and k to navigate through the list of files and D to delete a file.

Does something like this currently exist in Spacemacs, or in some well-known package?


texts:
So here's a pretty weird issue. Sometimes, when I start my emacs and press a key combination, the message <t> is undefined` gets printed in the echo area, and I need to press the key combo again. I've been trying to track this problem down for a few months now without success.

A bit more info can be found here:

https://github.com/syl20bnr/spacemacs/issues/7855
https://github.com/PythonNut/emacs-config/issues/19

I would be glad to provide more information to aid in debugging.


texts: How to use abbrev for words with dollar-sign ($) as prefix?

texts:
My setup

GNU Emacs GUI (version 24.4.51.1 (x86_64-w64-mingw32)
                       compiled from Harroogan Emacs.)

Situation

I would like to type a word in PHP-mode, and it will automatically expand to a proper word.

For example, I would like to type $session and he will expand it to $_SESSION.

When reading the manual about Abbrev mode

Type the word you want to use as expansion, and then type ‘C-x a g’ and the abbreviation for it. Example:

    t h e C-x a g t e h RET

Unfortunately, if you wanted to abbreviate Read The Fine Manual with RTFM, you couldn’t just type C-x a g after “Read the Fine Manual

So I put the cursor behind the word $_SESSION, then C-x a g and type $session. But I notice it will only expand session to SESSION without the underhyphen or the dollar variable.

When I'm looking in the .abbrev_defs with M-x edit-abbrevs, then the following is mentioned:

(global-abbrev-table)

"session"    0    "SESSION"

Then I try to change it to

"session"      2    "$_SESSION"

And save it with M-x write-abbrev-file, it didn't help. Maybe the abbrev uses regexp (?), thuis excluding the dollar sign. Any another suggestion?


texts: Write `var0, var1, var2, ..., var10` in a buffer

texts:
Most of the times there is no need to write manually many variables with the same name and a different index, like

var0, var1, var2, var3, ..., var9

because one can use arrays, vectors or whatever the language offers.

Anyway, I just needed to write manually ten variables as shown above. What is the fastest way to do it with emacs?

I guess that the fastest way is to write some elisp code.
I tried doing it with this code

(setq i 0)
    (while (< i 10) (print (format "var%d, " i)) (setq i (+ 1 i))

followed by (insert-last-message) defined here.
It does not work (I get "(#o0, #x0, ?\C-@)").

What's wrong here? Is there any faster way?


texts:
I want to run newline command after whenever I run org-cut-subtree. I tried

(add-hook 'after-org-cut-subtree-hook 'newline)
(add-hook 'org-cut-subtree-hook 'newline)
(add-hook 'org-after-cut-subtree-hook 'newline)

but none of them worked. How can I add newline command to the post-command hook of org-cut-subtree?


texts: Despite commands working in Emacs shell or "M-!, still getting permission denied

texts:
I have Emacs 27.1 on Windows 10 using MSYS2 bash. I can successfully run bash from M-x shell:
# echo $0
/usr/bin/bash

Also, I can successfully run commands from `M-!". But some commands still fail.
As example, using RCS I can check-in a file via M-! just fine:
ci test.txt

Getting back the message:
RCS/test.txt,v  <--  test.txt
new revision: 1.2; previous revision: 1.1
done

Executing same VC commands from Emacs, such as "Check In/Out" ( C-x v v aka M-x vc-next-action), I get instead:
apply: Searching for program: Permission denied, ci

Could you please offer hints or pointers on how to fix this "permission denied" error, when those very commands are perfectly runnable from withing Emacs' shell?
I searched online, I read the manual looking for this error message, I even went to look at the code, lisp/vc/vc.el, but I cannot see where such error is defined.


texts: How to not let a shell to capture the space key in Spacemacs?

texts:
In spacemacs, the space key is used to trigger the command shortcut, and an extra space can lead to a input/search of emacs command.
Now I run into this situation:
I use SPC b n to switch to next buffer in spacemacs. However when it cycles to the shell window, it captures the space input and I cannot trigger spacemacs options anymore.
Is there any way I stop the shell from capturing the space input?


texts:
I want to use autoinsert with C and headers, the code from http://www.emacswiki.org/emacs/AutoInsertMode
works well so I made my own template for header in an elisp funtion, but the insertion repeat to time, asking me twice, it results in :

/**
 * test.h -- test
 *
 * Written on Saturday, 28 November 2015.
*/

#ifndef TEST_H
#define TEST_H

int main()
{
  /**
   * test.h --
   *
   * Written on Saturday, 28 November 2015.
   */

   #ifndef TEST_H
   #define TEST_H

   int main()
   {

   }

  #endif
}
#endif


texts: Convert HTML umlauts to corresponding characters

texts:
I have a list of strings containing german umlauts as their html representation, e.g. ü is &uuml; and so on. Is there an easy, maybe built-in, way to convert them within strings, i.e. "Pr&uuml;fung" should become "Prüfung"?

I found that xml.el does something similar but it depends on the entity code and does it the other way around, as far as I understood.


texts: Exported org file to pdf with content out of page

texts:
I'm writing a document with some long strings on it, then I export the org file to pdf with the classic C-c C-e l p . Then when I check the document, the long string are out of the page. How can I fix this?
My code is:
*** Setting up the environment setup to build
The code must be compiled in a docker container, this docker container can be generated from the image described in the file _Dockerfile_ which can be found in the repository thisis@a-very-long-line-which-will-be.at.doc/with/a/commit/that/will/not/gonna/appear/where/is/supposed at commit a59590ee2c2bc02d5e71b0a944d927e181d93aeb

As you can see the document run off of document. This happens in several places with large words, what must I do to prevent this?


texts:
I'm trying to prepend each substring of split-string with numbering (1.,2.,3.,..) then return all the substrings concatenated with a newline

(defun japanese-get-definition (dictentry)
  "Get a definition from a dictionary entry."
  (let* ((index 1)
         (definitions))
    (save-match-data
      (and (string-match "/\\(.*?\\)$" dictentry)
           (setq definitions (split-string (match-string 1 dictentry) "/" t))
           (dolist (definition definitions)
             (setq definition (concat (int-to-string index) ". " definition))
             (setq index (+ index 1)))
           (mapconcat 'identity
                      definitions
                      "\n"))
      )
    )
  )

(japanese-get-definition "職業 [しょくぎょう] /(n,adj-no) occupation/business/")

So the result would looks like

1. (n,adj-no) occupation
2. business

Currently though the function is returning nil. Is dolist the right function to use? This would probably be very easy if I just use a new list, but I'm hoping to use learn the best way to do this (which I think (could be wrong) is modifying the existing list so less memory is used)


texts: What face do I need to adjust to remove the gutters at the edges of my windows?

texts:
This is not urgent, but just wondering if an Emacs user could let me know which face I need to adjust to remove the faint gutters at the edge of my windows?

I am using GUI GNU Emacs 25.0.50.1 X86_64-apple-darwin14.1.0 (installed via Homebrew if that makes a difference) and using molokai theme installed via color-theme package

Thank you


texts: `M-%` is interpreted as `M-5` (prefix arg of 5)

texts:
On one of my machines the query replace key sequence (M-%) isn't recognized, and is instead recognized as M-5, which acts as a numeric prefix argument of 5 (e.g. inserts 5 copies of the next character I type).

How do I begin looking for what is interrupting this functionality? So far I have tried running emacs -q to see if my init file was broken, but no luck.


texts:
I'm trying to use directory local variables so my realgud:pdb invocation can be:
Run pdb (like this): /home/username/work/place/environments/default/bin/python -m pdb /home/username/work/place/scratch.py

Instead of :
Run pdb (like this): python -m pdb /home/username/work/place/scratch.py

as suggested here.
However, in order to transform the suggestion there to be compatible with .dir-locals.el, I understand I need to use nil and eval per this answer.
So I am left with this:
;; .dir-locals.el
;; set the test runner
((nil . ((eval . (add-hook 'python-mode-hook
  (function (lambda ()
              (let* ((conda-python (format "%/envs/default/bin/python -m pdb" (projectile-project-root))))
                (setq-local realgud:pdb-command-name conda-python))
              )))
         ))
      ))

This doesn't complain or fail, except for asking me whether I trust the eval parameters.  However, it doesn't seem to work, as my M-x realgud:pdb invocation is still:
Run pdb (like this): python -m pdb /home/username/work/place/scratch.py

My init.el contains:
(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.
 '(column-number-mode t)
 '(conda-anaconda-home (expand-file-name "~/anaconda3"))
 '(elpy-test-pytest-runner-command '("py.test"))
 '(elpy-test-runner 'elpy-test-pytest-runner)

...which I don't think interferes but include for completeness.
What should I change so that my .dir-local.el picks up the correct test runner for pdb?  Essentially, I am trying to combine the suggestion of the linked answer to modify my init.el, but in a per directory basis, using .dir-locals.el, as my projects have different environment names and I'm stuck having one per project.


texts: How to keep minibuffer height compact as possible?

texts:
I am using GNU Emacs 26.3 under iTerm2. My goal is to keep minibuffer size as compact/minimum as possible.
Default height view:

Sometimes minibuffer's height increases and remains as it is. The empty space is small but I cat detected it, since I spent hours in emacs.

I observe that when the iTerm2's size is changed (increased and decreased) it also affects the minibuffer's size.

When I restarted the emacs minibuffer size may still remain with the additional empty space. I am not sure this is result of iTerm or emacs's configuration.

Example of increased minibuffer height:


texts: Make/unmake a variable globally buffer-local depending on another variable

texts:
I have a package with the variable my-package--my-var that needs to be buffer-local when my-package-buffer-only is t but global if my-package-buffer-only is nil. This is what I have so far:

(defcustom my-package-buffer-only nil
  :type 'boolean
  :set (lambda (sym val)
         (when val
           (make-variable-buffer-local 'my-package--my-var))
         (set-default sym val)))

(defvar my-package--my-var nil)

The problem is that I can't find a way to make the variable global again if my-package-buffer-only is set to nil.


texts: How do I open a hyperlink in an mu4e message? I know I can click on it, but is there a keyboard shortcut I can press or a function I can call to open the link? I don't like using the mouse when I don't have to.


texts: How do I expand org sections that only contain properties?

texts:
Given the following org-mode text:

* Heading
  :PROPERTIES:
  :CATEGORY: demo
  :END:

If it's collapsed, I can cycle between these two states:

* Heading...

and

* Heading
  :PROPERTIES:...

However, I can't see any way of expanding PROPERTIES whilst point is on * Heading. I can only expand PROPERTIES when point is on that line. This is unlike subheadings, which I can expand even when point is on the toplevel heading.

I want visibility cycling to include PROPERTIES. How can I expand PROPERTIES here?


texts: Run a process synchronously and obtain stdout and stderr in different buffers?

texts:
I'm using emacs version 25.1.1.

I would like to run a process synchronously and have its stdout and stderr end up in two different buffers. I know I can use make-process to separate stdout and stderr in this way, but make-process runs the process asynchronously.

For synchronous process invocation, I know I could use call-process with DESTINATION being set to (list stdout-buffer stderr-file), but then I would have to manage a temporary file to catch the stderr output, and that is inefficient.

Is there any function in emacs 25.x which will allow me to run a process synchronously with its stdout and stderr ending up in different buffers?

I also see this question being raised within a comment that was posted at the end of Capturing stderr of subprocesses more than 2 years after the original query, but it isn't answered there. Perhaps that short comment was overlooked, and that's why I'm posting this as a full-fledged question here.

Thank you in advance.