texts:
I am looking for academic research about Emacs. Any disciplines are interesting; psychology, economics, design, computer science including subdisciplines such as HCI and software engineering, philosophy, anthropology, science and technology studies, political economy, theology, culinary sciences..., history, comparative literature, cultural studies, math; everything and anything is interesting.

The ones I found with a quick search were these two:

Twidale, Michael B.; Jones, M. Cameron. 2005. "Let them use emacs": the interaction of simplicity and appropriation, in International reports on socio-informatics 2(2) 66-71. Retrieved from https://www.ideals.illinois.edu/handle/2142/9607

Palmer, J.; Duffy, T.; Gomoll, K.; Gomoll, T; Richards-Palmquist, J. and Trumble, J. A. 1988. "The design and evaluation of online help for Unix EMACS: capturing the user in menu design," in IEEE Transactions on Professional Communication, vol. 31, no. 1, pp. 44-51, March 1988. doi: 10.1109/47.6920. Retrieved from https://ieeexplore.ieee.org/abstract/document/6920/references


texts: How to have yank visually flash the pasted text

texts: I'd like to be able to paste text into a buffer and have emacs give a visual confirmation by flashing the region (highlighting and unhighlighting) the text that was pasted in the buffer. Is there an example of how to do this?


texts: Replace expressions including variable text

texts:
I wish to create a function to put in my .emacs (but I am no Elisp expert) in order to perform a certain number of replacements within an Emacs buffer.  In particular, I want to:

replace any occurrence of \pnotes{*} (where * is some variable stuff, e.g. \pnotes{1.73}, \pnotes{1.41}...) with \notes followed by a line break

delete any occurrence of \ast{*} (where * is some variable stuff, e.g. \ast{0.03}, \ast{.70}...)

replace any occurrence of \nextvoice with the same string preceded by a line break

replace any occurrence of \ib with the same string preceded by a line break;

replace any occurrence of | with the same character preceded by a line break

replace any occurrence of & with the same character preceded by a line break

replace any occurrence of \en% with \en preceded by a line break

How can I achieve that?


texts: I started using (server-start) recently and only using emacs client (with -c -a emacs option). The expected behavior when opening a .gpg file is that epa automatically tries to decrypt the file but for some reason emacs client only gets to see the gibberish I would see with say geddit without any error message at all. How can I fix this?


texts: Aligning text in Org-mode after refactoring or making changes

texts:
I use org-mode mainly to write extensive notes, but I'm finding it difficult to "justify" while refactoring or making changes.

For example, suppose I have to make changes to the following text:

* Heading

  A line of nearly 80 characters that ends with newline character
  remaining part of the line

If I've to add few words in first line (after heading), then the text will look like

* Heading

  A line of nearly 80 characters (plus some random stuff in brackets)
  that ends with newline character
  remaining part of the line

But ideally, I want something like

* Heading

  A line of nearly 80 characters (plus some random stuff in brackets)
  that ends with newline character remaining part of the line

Is there some way in which I can automate this "justification" using org-mode?


texts: In emacs when I scroll right and beginning of lines are truncated emacs inserts dollar sign same as it insert \ at the end of truncated line. I wish it would not insert these two signs. Can I disable this behavior?


texts: AUCTeX: Turn on syntax highlighting for natbib commmands under BibLaTeX

texts:
I'm using natbib commands like \citep and \citealt under BibLaTeX thanks to the option natbib=true. Yet AUCTeX won't highlight them the way it highlights, for example, \cite (or \parencite, which is the BibLaTeX equivalent of \citep).

I'm using AUCTeX 11.89.7 on Emacs 24.5.1 (i686-pc-mingw32).

How can I change this?

Update:

Only files other than the master file seem to be affected.

master file (test.tex):

\documentclass{article}

\usepackage[natbib=true]{biblatex}

\begin{document}

\cite{}
\parencite{}
\citep{}
\citealt{}

\input{test2.tex}

\end{document}

test2.tex:

\cite{}
\parencite{}
\citep{}
\citealt{}

%%% Local Variables:
%%% mode: plain-tex
%%% TeX-master: "test"
%%% End:


texts:
Something turned hl-line-mode on, which is painful to look at with my color theme.

I've added this to my .emacs

(hl-line-mode -1)
(global-hl-line-mode -1)

to no avail.

I've tried commenting out everything in my .emacs, but the highlighting still happens.

I can disable it with

M-x hl-line-mode

but I need to do that every time I visit a file.

How can I find out what's enabling it, and how can i disable it for good?


texts: How to interpret buffer-display-time values?

texts:
I am trying to use buffer-display-time var, in order to come with a solution for this question.

Having a look at the documentation, I get this:

buffer-display-time is a variable defined in ‘buffer.c’.
Its value is (23883 19206 790941 600000)
Local in buffer buffer.c; global value is nil

  Automatically becomes permanently buffer-local when set.

Documentation:
Time stamp updated each time this buffer is displayed in a window.
The function ‘set-window-buffer’ updates this variable
to the value obtained by calling ‘current-time’.
If the buffer has never been shown in a window, the value is nil.

How do I interpret these values (23883 19206 790941 600000) as a timestamp?

NOTE: That variable is defined in buffer.c as:

  DEFVAR_PER_BUFFER ("buffer-display-time",
             &BVAR (current_buffer, display_time), Qnil,
             doc: /* Time stamp updated each time this buffer is displayed in a window.
The function `set-window-buffer' updates this variable
to the value obtained by calling `current-time'.
If the buffer has never been shown in a window, the value is nil.  */);


texts: Why are my compilations executed in the parent of `default-directory`?

texts:
When I run compile, I'm seeing a strange behavior where the shell command is being executed in the parent of default-directory rather than default-directory itself. Here's an example of what I'm doing:

(let ((default-directory "~/projects"))
  (compile "pwd"))

And here's what shows up in the *compilation* buffer:

-*-mode: compilation; default-directory: "~/projects/" -*-
Compilation started at Sun Jan 18 14:03:45
pwd
/Users/sixtynorth
Compilation finished at Sun Jan 18 14:03:45

As you can see, on the first line of *compilation* the default-directory is correct. But when pwd actually executes I've been changed to the parent directory. This behavior seems consistent across different directories, commands, etc.

Does anyone have any idea what might be going on? I've poked through the compile code, but nothing looks suspicious. I've also looked in my shell configuration for anything that might be causing problems, but again nothing jumped out at me. Any thoughts or ideas would be great.


texts:
I have an index of digital media (books, movies, etc.) containing name, author, year, pages, etc. which I maintain in an Org file as a table.

I preferred Org mode because I had a lot of stuff in my Org file, anyway -- around 200K 3,400 odd lines including the index. Moreover, cross-referencing, etc. could be quick and esay with everything in Org mode. Add to that the benefit of one-file-everything convenience.

Presently, there are around 400 rows and 10 columns in the index. I expect it to grow to a couple of thousand rows at most. No of columns will remain just the same. Most of the time, the data just enters in the index or gets modified. Occassionally, there is sorting and searching. Searching can be on the name, author, etc. But I have never noticed in lag in either of the operations. In any case, writes to searches are 10:1 or so.

But after a certain number of rows, around 300-350, operating the table becomes very slow. There is a significant lag between I entering the text or moving the cursor and it actually getting displayed on screen.

Is there a better way to manage such large volume tabular data?


texts: Disabling electric-indent-mode for one mode (latex mode) only

texts:
I don't like the way electric indent mode works in latex-mode. Everywhere else (at least everywhere I use), it's great.

How can I permanently disable electric indent mode for latex mode only, but keep it everywhere else?

I'm guessing it's a one-line lisp hack in my config file, or something like that, but I'm horrible at lisp, so I can't figure it out.


texts: How do I change the background highlight color for a selection I marked with C-Spacebar?

texts: I think that question explains it all. I tried changing highlight face but nothing happened.


texts: How to include org-mode easy templates into company-mode completions?

texts: Within org-mode, I use easy templates a lot. But I also use company-mode and easy templates are not listed there, even though I've managed to add support for some of the org-mode keywords (see here). Does anyone know how to achieve this?


texts:
While writing plain text (not code), I'd like a completion based on more context, an exmple would speak more so here it is:
Given the following buffer (a preloaded big text corpus would make more sense in reality):
foo bar baz
foo bar baz
foo bar boo
poo bar bot

and then typing:
foo bar

(followed by a space and M-/) I'd like dabbrev (or something else) to propose, in the following order:

baz, because it appears twice after foo bar, so it's the more probable one.
boo, because it appears after foo bar
bot, because it appears after bar

Currently dabbrev would propose bot first, as the nearest possible word following bar, if I understand correctly.
In other words, I'd like completion based on Markov chains. Does it already exists? Would it be hard to implement?


texts:
I moved .emacs.d folder from home directory to a folder called dot_files so that it will be easy to sync various dot files. From there I have linked it to home so that emacs can load that configuration files. But when I start emacs, it is throwing this warning and not loading it.

Warning (initialization): Unable to create user-emacs-directory' (~/.emacs.d/).
Any data that would normally be written there may be lost!
If you never want to see this message again,
customize the variable `user-emacs-directory-warning'.

How can I link emacs config so that it works normally?


texts:
Q: How does one create and use :keywords?

Consider a (naive, apparently) attempt to access the following toy alist:

(setf alist '((:key-1 "Key no. 1")
              (:key-2 "Key no. 2")))

(assq :key-1 alist)                 ; => (:key-1 "Key no. 1")
(assq (make-symbol ":key-1") alist) ; => nil

The first key works as expected, but the second key does not.  Insofar as there is no obvious make-keyword function, how does one create and use a keyword?

Original motivation: I need to transform a string into a lookup key that is a symbol onto which I can put properties.

In the process of formulating this question, I've gotten to at least part of the answer, which I'm posting separately.  I'm hoping brighter minds than mine can improve upon it.


texts: What is the equivalent of Ruby's "rake test" for project elfeed?

texts:
In a ruby/rails project, the "standard" way to run "the test suite" is

rake # alias for rake test

Some projects will mention (when there's a deviation)how to run tests in their README.

How do you run the test suite for this project?
https://github.com/skeeto/elfeed


texts: Global minor mode that requires another during its lifetime

texts:
Say I'm developing a minor mode A that happens to need minor mode B enabled during its lifetime.

The most straightforward way is to do something like:

(define-minor-mode A-mode
  :global t
  :lighter " A"
  (if A-mode
      (B-mode 1)
    (B-mode 0))) ; hooks here are added/removed...

Or alternatively:

(add-hook 'A-mode-hook 'B-mode)

The problem with these approaches is that the original status is not preserved. I could simply use a global variable to keep track of it but I was hoping to find a more elegant solution.

For example I can solve a similar issue involving variables like this:

(progn
  (setq foo 10)
  (print foo)     ; 10
  (let ((foo 42))
    (print foo))  ; 42
  (print foo))    ; 10

There is one more problem: the user could manually disable minor mode B while minor mode A is still on; and this shouldn't happen.

Probably is just bad practice to even require this behavior...

(FYI in my case minor mode B is temp-buffer-resize-mode.)


texts: Use org-ref to add citations in theorem titles

texts:
I am experimenting with writing a manuscript in org-mode and wondering if this is something org-ref can do

In org-mode I have

#+ATTR_LATEX: :options [Homeslice's Theorem]
#+BEGIN_theorem latex
blah blah
+END_theorem

which produces the following correct TeX

\begin{theorem}[Homeslice's Theorem]
blah blah
\end{theorem}

I would like to add a citation to the theorem's title which I can do in TeX like

\begin{theorem}[(\cite{homeslice_bib_entry}) Homeslice's Theorem]
blah
\end{theorem}

But using org-ref to accomplish the same goal does not work

#+ATTR_LATEX: :options [(cite:homeslice_bib_entry) Homeslice's Theorem]
#+BEGIN_theorem latex
blah blah
+END_theorem

Is there a way to do this in org-mode using org-ref or should I use the TeX citation?


texts: how to resolve Symbol's value as variable is void when using ledger-mode

texts:
I am trying to setup a workflow wherein I generate Ledger files from different record files.  Typically I like to view them in ledger mode after cleaning but if I make a change to the conversion, then I have to revert the file, reenable ledger mode and then run the clean operation.  I tried making a function to do this for me, but I am encountering an error that I don't understand.  Below is the function as written in my initialize code:

(use-package ledger-mode
  :init
  :config
  (defun ledger-revert ()
    (interactive)
    (if not (eq major-mode 'ledger-mode)
      (ledger-mode))
    (revert-buffer t t t)
    (ledger-mode-clean-buffer)))

when I try to run the function to revert a ledger journal file I get:

>>> Symbol's value as variable is void: not

Any thoughts?


texts: How to count number of times a recurring task is marked done after logging is enabled?

texts:
I had a task in my org file for which I wanted to keep track of the number of times a task is marked as DONE when it's recurring.
I am logging my change to the drawer and thus it should be possible to get the count.
Currently, I count the number of times the task was executed manually but want to automate this effort. This option would help me keep track of the number of times the task was marked DONE. It would also be amazing if we could reset the count after getting it done a fixed number of times.
I am not a programmer so I'm struggling with implementing a solution in elisp to do the same.
Thanks for all your help.


texts: Emacs displays some characters as squares

texts:
For example this:

Emacs displays it like this:

I have noticed this just after a Windows update this morning (now version is 1903). I remember it was working well a few days ago. I tried emacs -Q to not load any of my init files and the problem is still there.
I have another PC which is runninig Windows 1809, and on that PC it works correctly even if I run emacs -Q. And on that PC if I place cursor at the 1st char of my example and do C-u C-x = I can see the font is  uniscribe:-outline-Cambria-normal-normal-normal-serif-13-*-*-*-p-*-iso10646-1 (#x967), so how does emacs know to use that font? and how come emacs on my new PC doesn't do that?
I'm using emacs 26.2 on both PCs.
What could be the problem?


texts: How to prompt user for tags and use the result in a org-ql-search function?

texts:
Is there a way to read tags with completion from the user in the same way read-number or read-string allows?

I would like to have a custom function defined where I ask the user for a tag (or list of tags) and use that in a org-ql-search query.


texts: Can't use .bashrc file on remote server from ssh within emacs

texts:
Login to remote server with ssh in Emacs, general commands run well. Such as ls, docker ls, etc.

C-x C-f /ssh:...

But when I tried to run a command which alias to another which set in the .bashrc file. It doesn't work.

When I check cat ~/.bashrc, it returned the content of local .bashrc. Why?


texts: Using two programming languages with the same file extension

texts:
I am just starting to set up a perl environment in emacs but the problem is that I already program with prolog and both languages use the .pl file extension. I have two directory ~/src/prolog and ~/src/perl where I store code for the respective languages. Currently I only have this line in my init:
(setq auto-mode-alist (append '(("\\.pl$" . prolog-mode))
                               auto-mode-alist))

How can I tell emacs that .pl files in the ~/src/prolog directory should use prolog-mode while the .pl files in ~/src/perl should use cperl-mode?


texts:
If we have org file with datetree and repeating actions, how can I capture under last heading of some level.
Let's say we have this:

* 2018
** 2018-W47
*** 2018-11-21 Wednesday
**** Gym Session
** 2018-W48
*** 2018-12-01 Saturday
**** Running
*** 2018-12-02 Sunday
**** Gym Session

I want to create org-capture template which would put entry under last "Gym Session" from Sunday. This means I can't use heading, because it's not guaranteed to be unique. Is there some function like "org-last-heading-of-level-4" or something similar maybe?
Thanks!


texts: How do I splat the arguments to the `or` function?

texts:
I would like to evaluate a list of booleans like
(nil nil t)

into a single boolean, such that if any element is true, then the expression evaluates to true.
I first looked at the (or) function in elisp, but it does not take a list of booleans as an argument. Instead it requires its arguments to be "un-wrapped" outside of a list. In other words,
(or (nil nil t))

simply evaluates to the entire list (nil nil t) because it treats the it as a single argument. I would like something that instead evaluates exactly to t. - I understand that (nil nil t) is truthy, but that's beside the point.
How can I convert (or (nil nil t)) into just (or nil nil t) or just t?
After some thought, I can think of
(eval (cons 'or '(nil nil t)))

but is there some other more idiomatic way that I'm missing?


texts: scale text in eww with proportional fonts enabled

texts:
when i use eww, which is v often, coz i love reading the web by just text in a format i choose,

i can scale the text (with C-x +/-) until i enable "proportional fonts" with F. it changes my display text to be the same as my settings for variable-pitch-mode, but when enabled the text doesn't scale (although some other objects do).

scaling works fine in other buffers that have variable-pitch-mode enabled.


texts: How to use unbound keys as “non-sticky” modifier keys

texts:
I would like to setup keyboard shortcuts with other keys that traditional modifier keys, as modifier keys.

example : bind "f1-left" ( so F1+←) to a command.

But not bind the sequence F1 ← to the command like explained in this answer :
Using function keys as "sticky" modifier keys

is that something possible in emacs ?

I see commands such as

(define-key function-key-map [f8] 'event-apply-super-modifier)
but is there a command binding on press and on release events ? like a "define-key-press" "define-key-release" ?
If so we could bind a command event-apply-super-modifier when f1 is pressed and event-release-super-modifier when f1 is released.


texts:
I am setting up Wanderlust, and have an older "Maildir" folder created by Offlineimap. Am wondering how I can import these emails in Wanderlust and/or combine this folder with my new WL folder?

Can I just move the files in each subdir?


texts:
Due to a bug, I want to execute LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.6 gnuplot instead of just gnuplot to create plots with gnuplot. I already put an alias in my zsh source file, so that when I run gnuplot from a terminal the correct version is loaded.

However, emacs's org-mode seems to be still using the old gnuplot version. How can I specify the correct version to be used? I already looked into ob-gnuplot.el trying to find the place where the command to execute gnuplot is saved, without luck.


texts:
Okay, so I just observed a weird thing with my org document. The source blocks are fine if I go from top to bottom, however, when I directly jump to bottom and then move towards the top, the source blocks don't get highlighted untill the languge name of the source block comes in the visible buffer. Like in the image:

They do stay highlighted after being highlighted once though, so I was just wondering if this is a bug or that's just how it is? It's not really a huge problem but I would like to fix it if possible as it is a little annoying in files where I have a little bugger source blocks like my qtile config.
I am Using emacs version: 27.0.91


texts: make * in Spacemacs work like it does in vim

texts:
In Spacemacs, is there an easy way to make * (which calls the function spacemacs/enter-ahs-forward) work like it does in Vim?

That is, I want * to perform forward searching like in Vim, without opening up the "Symbol Highlight Transient State".


texts: Does anyone know of a javascript editing mode that supports the es6 syntax additions (arrow functions, extends, imports, generators, etc.)? I've done some quick searching but it looks like so far everyone just uses js2-mode and ignores the syntax errors.


texts: how can I programatically transition between those 2 window layouts?

texts:
I am trying to implement this window transition

a/             b/
---------      -------------
| 1 | 2 |      |   | 1 | 2 |
---------  ->  | 0 |-------|
| 3 | 4 |      |   | 3 | 4 |
---------      -------------

More precisely, I'm trying to implement something similar to neotree, that opens in some sort of sidebar.


texts: What's the correct replacement for flet on new emacsen?

texts:
I have some code that uses flet to temporarily change the behaviour of functions.

;; prevent changing the window
(flet ((pop-to-buffer (buffer &rest args)
                      (switch-to-buffer buffer)))
   (compilation-next-error-function n reset))

However, Emacs' byte compiler gives a warning:

In ag/next-error-function:
ag.el:103:7:Warning: `flet' is an obsolete macro (as of 24.3); use either
    `cl-flet' or `cl-letf'.

However, cl-flet works differently and doesn't suit some use cases, and I believe this is one of those cases.

The options I can see are:

Tell Emacs to ignore the warning somehow.
Roll my own flet.
Use noflet or dflet.

What is the best approach?


texts: How to pass the result of yank to find-file?

texts:
So I wanted to basically copy the current selection, then yanking it into find-file, as when using:

C-SPC: set-mark-command
M-w: kill-ring-save
C-x C-f: find-file
C-y: yank

While that works great, I wanted to make it into a command if possible, so I tried and came up with this so far:
(define-advice kill-ring-save (:around (old-fun &rest args) highlight)
  "Save the text selection and keep the selection highlight."
  (let (deactivate-mark)
    (apply old-fun args)))

(defun find-file-region ()
  (interactive)
  (execute-extended-command nil "kill-ring-save" nil)
  (call-interactively 'find-file)
  (yank nil))

Now, I'm using this particular kill-ring-save function, mostly because I found it work better than the default one, but that's just what I noticed in my workflow. And also because i didn't know how to use the default one in this particular endeavor
So this doesn't obviously work, my guess being is that it doesn't run yank after running (call-interactively 'find-file)
I've tried:

using default find-file but since it require a filename and doesn't just "open with current directory of the buffer/file" like it usually do if used in the keybinding, that didn't work either.

was replacing (call-interactively 'find-file) with (execute-extended-command nil "find-file" nil) but it did the same thing as far as I'm aware (that is, it didn't work either).

Question
How could I pass the current selection/region (from C-SPC) to find-file and open the file whether it exists or not? (since usually, I recall find-file creates the file if it doesn't exist, which is what I want too).
Don't really care if it's done interactively or in the background, as I just did that to tinker around and see if it'll work.


texts: ANSI escape sequences in compilation-mode

texts:
When you run various "modern" compilation or test tools you get ANSI codes in the output. I'd like to either render them correctly (ideally) or otherwise strip them. I've tried applying either term-mode-hook to the compilation-minor-mode as suggested in this superuser post, and also a similar approach using shell-mode as per this stackoverflow post, to no avail.

Does anyone have this working?


texts: How to run shell command in function and intercept standard output

texts:
Tell me how to use the trans command of the trans-shell package for
translation. I need to write a function that will intercept the output
translated text.


texts:
When working on projects which use multiple kinds of build-systems, sometimes I want to run a make command based on the project, without having to manually setup project spesific hooks.

Is there a good way to perform this in Emacs?

To expand on this question to give some context,

I might have many projects on my computer and load a C file from a project that uses GNUMakefiles, then another project that uses CMake, and a third project that uses Meson.

Along with this, I might also have some documentation in reStructuredText or Markdown that has a GNUMakefile, which is useful to run to build the documentation.

Neither major-modes have anything to do with GNU Make, it's just convenient to use a GNUMakefile sometimes.

By knowing the language is C or the document is reStructuredText doesn't give me a hint as to the build system, so I would like a way to detect this.


texts:
I'm relatively new to emacs and currently working through the introduction to elisp. In chapter 4 I came across the find-tag which should display the source code of its argument. I typed M-x find-tag RET followed by the argument copy-to-buffer. The echo-area shows the following message:

Visit tags table (default TAGS): ~/

but there is no TAGS file. But somewhere must be the tag tabled (default one) be installed. I run a find for TAGS on all directories but no file was found. Where is this file located?

My setup is: Debian 8.2 and emacs 24.4.1


texts: Flycheck stopped checking after the installation of rtags and cmake-ide

texts:
First I had flycheck and it worked just fine for my C projects. At the time, I was having a problem with my init file. I even posted about it. I was using an org file as my config file (using org-babel) and I accidentally used #+END_SRC emacs-lisp and it confused the interpreter.

After correcting that problem, I have decided to install cmake-ide and wrote some basic configs that can be found here. After that, my flycheck began to  prompt an error that said

  Error while checking syntax automatically: (wrong-type-argument stringp nil)

Then I read some parts of the documentations for cmake-ide and rtags and I discovered that I had to compile some parts of rtags that were not written in lisp. After the compilation, that flycheck error just magically disappears but it does not check for errors. I don't know if cmake-ide is configuring it the wrong way or if it is something else I'm missing.

Edit: I was using my config file on another computer and I just couldn't install rtags, so I removed it (and also cmake-ide). After that, flycheck just works normally. I wonder what configs I'm missing.

Does cmake-ide create some wrong configs for flycheck if I'm not on a cmake project?


texts:
Having previously set emacs-user-directory thus:

(setq user-emacs-directory "~/Dropbox/emacs")

I would now want to set desktop-path and desktop-dirname in this manner:

(setq
  desktop-path user-emacs-directory
  desktop-dirname user-emacs-directory
  )

However, when I start Emacs and it runs that code (by loading the desktop package) I get this error:

Wrong type argument: listp, "~/Dropbox/emacs_x"

How can I solve this problem?


texts:
Windows 10, Emacs 25.1, Magit

I want auto refresh buffer "magit-status" when was some change on files in my project.
So I set variable magit-refresh-status-buffer to on non nil. But it not help.


texts:
I am looking for a way to export the html/text body part generated by org-mime-htmlize without the header.

I use notmuch mail for most of my mailing and threading is very important to me, so I want to stay within one thread when replying.
When I send code snippets I use org-mime-htmlize for quick editing.
But currently I have to open an org-mode buffer, htmlize it, select and copy the body part from it and paste it in to my reply mail.

I was wondering if it is possible to only export the body part to speed up copying and pasting?

Before doing something with within text searches, I wanted to ask, if there is maybe already a solution out there?


texts: finding git conflict in the same buffer if cursor is at end of the buffer

texts:
I am using next-conflict to detect is there any git conflict, using following answer:
Jump to next merge conflict in project using Magit and Smerge. I experience that if I am at the end of the file/buffer and if there is a conflict in the same buffer/file, the conflict is not found. But if I switch into another buffer, or go to top of the buffer it iss found.
Is there any workaround to fix this issue?

setup:
(defun smerge-try-smerge ()
  (save-excursion
    (goto-char (point-min))
    (when (re-search-forward "^<<<<<<< " nil t)
      (require 'smerge-mode)
      (smerge-mode 1))))
(add-hook 'find-file-hook 'smerge-try-smerge t)
(add-hook 'after-revert-hook 'smerge-try-smerge t)

(defun smerge-next-safe ()
    "returns t on success, nil otherwise"
  (condition-case err
      (not (smerge-next))
    ('error
     nil)))

(require 'vc)
(defun next-conflict ()  ;; key-binding
  (interactive)
  (let ((buffer (current-buffer)))
    (when (not (smerge-next-safe))
      (vc-find-conflicted-file)
      (if (eq buffer (current-buffer))
          (message "No conflicts found")
        (goto-char 0)
        (smerge-next-safe)))))


texts: EMACS, MacOS Sierra, and Mission Control work badly together

texts:
Since upgrading to MacOS a/k/a OS/X 10.12, I've noticed an annoying behavior. I have several spaces open. If I use [CMD][TAB] to move to EMACS from another program, the display switches to EMACS, it becomes visible, but then is immediately sent to the back and another application comes up. If I [CMD][TAB] again, it brings EMACS to the front.

I have no idea if this is an EMACS issue or a MacOX issue, but it's annoying and I'd appreciate any suggestions to make it stop.

I'm using

GNU Emacs 25.1.1 (x86_64-apple-darwin15.6.0, Carbon Version 157 AppKit 1404.47) of 2016-09-08

and

System Version: macOS 10.12.1 (16B2555)


texts: How to make `truncate-lines` nil and `auto-fill-mode` off in magit buffers

texts:
I got

(setq-default fill-column 80)
(setq-default truncate-lines nil) ;; which is default

When using magit in Emacs, I know that I should avoid long commit messages, but sometimes they just cannot be avoid.

The problem is: (setq-default truncate-lines nil) which is default setting does not work in magit: project buffer(there is a straight right arrow at the end of line), the (setq-default fill-column 80) does not work in COMMIT_EDITMSG buffer, and the fill-column value in it is 72 not 80.

But what I really want is: make the truncate-lines to nil in magit: project buffer as well so I can see long lines in one window but not break it into several different lines, AND turn on auto-fill-mode in COMMIT_EDITMSG buffer, so long commit messages won't be broken into several different lines while I'm typing.

NOTE: DO NOT affect other buffers like magit-log buffer


texts: Org-mode export to HTML filter: Replace LaTeX commands

texts:
I am trying to export org-mode file to HTML. Because I am exportig the same file also to LaTeX format, I am having in the org-mode file a few LaTeX commands, for example \LaTeX command.
For HTML export I would like to replace this command with its transcript in normal letters, simply "LaTeX." I am also using Doom Emacs and running org-mode export in --batch mode (or with -nv flag), to run emacs export commands non-interactively (and via makefile).
Using this filter function written in exportConfig.el file:
(with-eval-after-load 'ox
  (with-eval-after-load 'ox-html
    (with-eval-after-load 'htmlize

      (defun my-latex-filter-example (text backend info)
        "Replace \LaTeX with \"LaTeX\" in HTML output."
        (when (org-export-derived-backend-p backend 'html)
          (replace-regexp-in-string "\\\\LaTeX" "LaTeX" text)))

      (add-to-list 'org-export-filter-latex-fragment-functions
                   'my-latex-filter-example))
    ))

(those with-eval-after-load functions might be redundant because of -nw emacs start flag.)
But in the resulting exported HTML I still get \LaTeX sequences converted to regular strings. I also tried to add the filter function to org-export-filter-plain-tex-functions alist, but that did not work either.
How can I correctly replace simple LaTeX commands like this for org-mode export to HTML?
EDIT:
Command I am using is:
emacs main.org -nw -l exportConfig.el -f org-html-export-to-html --kill

Previously I have misspelled the emacs start flag to -nv, I have corrected that. I am using approach recommended here: Using htmlize in batch mode
Yes, I want to replace "\LaTeX" command in org-mode source with simple "LaTeX" string for HTML export.
Currently, my-latex-filter-example function doesnt replace it, so the exported HTML contains string "\LaTeX" in multiple places.


texts:
I cannot find a shortcut for the command \neq (not equal) in AUCTeX by the answers provided to my previous question A comprehensive list of shortcuts provided by AUCTeX

I would be great if it would be possible to associate the shortcut `= to \neq when working with emacs+auctex just in LaTeX-mode. Is is possible?


texts: *-readme.txt files in ELPA root, what do they do?

texts:
I see a lot of *-readme.txt files in my ELPA root. They seem to describe some of the packages that I
had installed at some point. A few related questions follow:

why do some packages have them while others do not?
why aren't they deleted automatically when a package is removed?
is it possible to disable them? I would prefer to save screen space in the dired buffer.


texts: Dired / Wdired: How to test whether a filename is relative / absolute

texts:
I am creating a dired-mode buffer with:

(dired (directory-files-recursively default-directory ""))

This gives me absolute paths for each file, which is great.  I am still unsure how the default-directory in the resulting new dired-mode buffer is chosen.

Example, my dired- heading is:  /Users/HOME/Desktop/0.r_d_w_1/Chase Checking/2015:.  The file list, however, was recursively generated from /Users/HOME/Desktop/0.r_d_w_1/ with many sub-directories -- i.e., not just "Chase Checking/2015".

The problem that I am trying to solve is that wdired-get-filename assumes that the filenames are relative.  When wdired-get-filename gets the NEW filename (i.e., after the wdired-mode buffer has been edited), it is incorrect.  What happens is that the absolute path of the NEW filename is concatenated to the end of the default-directory.  The problematic code looks like this:  (concat (dired-current-directory) file), where FILE is the absolute path.

I would like to make wdired-get-filename play nice with absolute paths in addition to the default behavior which uses the default-directory and the modified relative-name for the NEW filename.

My initial thinking was to come up with a test to see if the the filename is absolute or relative, and then only concatenate if the latter.  However, I would certainly be amenable to a better solution.


texts: How to color specific keywords in python-mode?

texts:
My goal is to color specific keywords as function definition such as log in Python-mode to a spefic color or color of functions.
Example, pattern for log("...."): coloring only log.
from utils import log  # no color for log
logging.info("hello")  # no color for log
log("hello world")  # color for log

I have tried follows answer for shell-mode alias keyword is not recognized as font-lock-builtin-face type but it colors all the log string.

(font-lock-add-keywords 'python-mode
                        '(("log" . font-lock-builtin-face)))


texts: Emacs makes a lot of spaces for a new line

texts:
I do not know what I did, but emacs creates a lot of spaces for new lines. There's a demo:

How to fix this?


texts: Spacemacs orgmode: How to regenerate the `custom-set-variables` values in `.spacemacs` file

texts:
At the bottom of the standard .spacemacs file, there is a section for custom configuration generated variables. The sections looks like:

(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.
'(org-agenda-files ...)
...
)

Spacemacs had automatically populated this custom variable with the locations of my org-agenda files when I initially set it up. However, I had to move my org-agenda files to a new directory, so the file paths in that variable are now invalid.

After moving the files, Spacemacs kept asking if I wanted to remove the old file paths from the org-agenda-files, but then it just left me with the setting '(org-agenda-files nil)

Is there a command or key shortcut that will force Spacemacs to update the paths in this custom-set-variables section. I see that Spacemacs periodically does change some of these setting, however I have not found a consistent activity that forces this regeneration. I tried to add and remove packages from the config, but that did not seem to work.

Any ideas?


texts:
Being an old timer used to Plain TeX, I'd like to be able to add Plain TeX portions to an org-mode file and have them be nicely displayed when exported.  Is it possible to configure org-mode for this to happen?

In defense of using Plain TeX within an org-mode file, I would say that Plain TeX is better suited to situations in which one just wants to add a few greek letters and/or formulas, without worriyng about the structure of the document (documentstyle and all that which standard LaTeX usually requires)


texts: Is there a way to daisy chain .dir-locals.el files?

texts:
Suppose I have a directory with these files.

/foo/bar/baz/.dir-locals.el
/foo/bar/.dir-locals.el
/foo/.dir-locals.el

When I go to create a file in /foo/bar/baz/, I'd like to daisy chain them together such that /foo/.dir-locals.el applies first, and then /foo/bar/.dir-locals.el, and then /foo/bar/baz/.dir-locals.el


texts: Tramp is a built in and does not seem to be in melpa, where can I install it from and is it a good idea to update to a newer version ?


texts: Jedi popup window: how to make it larger than its parent frame

texts:
I am using jedi and auto-complete to provide some help during my Python coding session. As advertised in the jedi's website, completion and documentation are shown correctly as:

However, when the frame is barely larger than the function's name and basic info (the first popup, in gray), then the documentation popup (the second one, in yellow) is crammed so it's not larger than the frame that contained the code. For example:

This behavior also happens when you have several nested scopes in your code and your function is near the left border of the frame.

Is it possible for the popup to be bigger than the containing frame? Does anyone know another solution for this behavior?


texts: Using ido completion for selecting a repository for magit

texts:
I like to use ido for completing file paths and helm for all other things. I have tried setting magit-completing-read-function to magit-ido-completing-read. This doesn't change magit-status behaviour which calls read-directory-name. Here is what I have set for ido and helm:

(use-package ido
  :doc "I like `ido' for file paths' completion. Currently, the
  vector syntax [remap ..] is broken and using strings there is a
  workaround: https://github.com/jwiegley/use-package/issues/166"
  :ensure t
  :bind (("<remap> <read-file-name>" . ido-read-file-name)
         ("<remap> <read-directory-name>" . ido-read-directory-name))
  :config
  (ido-mode 1)
  (setq ido-enable-flex-matching t
        ido-auto-merge-work-directories-length -1
        ido-save-directory-list-file (expand-file-name "ido.last"
                                                       temp-files-directory)
        ido-ignore-buffers '("\\` "  "^#.*" ".*freenode\.net.*"
                             ".*irc\.slack\.com.*" "\\*helm.*")
        ido-decorations '("\n-> " "" "\n   " "\n   ..." "[" "]" " [No match]"
                          " [Matched]" " [Not readable]" " [Too big]"
                          " [Confirm]")))

(use-package helm
  :doc "Helm for everything except file paths."
  :ensure t
  :diminish helm-mode
  :bind (("M-x" . helm-M-x)
         ("M-y" . helm-show-kill-ring)
         ("C-. C-r" . helm-grep-it))

  :config
  (helm-mode 1)

  ;; For some reason, this doesn't work. For example, `magit-status'
  ;; always uses `helm' for `read-file-name'.
  (add-to-list 'helm-completing-read-handlers-alist
               '(find-file . ido))
  (add-to-list 'helm-completing-read-handlers-alist
               '(dired . ido))
  (add-to-list 'helm-completing-read-handlers-alist
               '(read-file-name . ido-read-file-name)))


texts: Adding another column of information to dired (text snippets by Gnome Tracker)

texts:
I have a small Emacs Lisp function which calls Gnome Tracker's FTS Search via D-Bus and display results in a dired buffer.

[ https://gist.github.com/vishalbelsare/4f78722856a6bca7faf1f73353892025 ]

I pass the array (list) of filepaths (file URIs) returned by Gnome Tracker to emacs dired, to make inspection easier i.e. using the set of functions which dired provides.

One thing I miss in this setup is that Gnome Tracker can also return snippets of the text, with a few words before and after   the matching terms. Say I search for the string 'emacs lisp', then the snippets would show for each file 'n' words before the searched string and 'n' words after. It helps in seeing whether the result is relevant beyond simple matching.

[ https://wiki.gnome.org/Projects/Tracker/Documentation/Examples/SPARQL/FTS ]

Now to come to the question :
Can another column of information be added to dired to also show the text snippets returned by Gnome Tracker?

p.s: original question about using Gnome Tracker from Emacs : [ Gnome Tracker integration with emacs ]


texts: What's the difference between after-init-hook and emacs-startup-hook

texts: Seems there are several hooks about actions on Emacs initialization. However I'm not sure what their differences are, and a brief Googling yields little information. Is it like emacs-startup-hook is executed instantly after Emacs is fired up, but it doesn't necessarily wait for initialization to finish?


texts: Helm's kill-buffer leaves marked files open

texts:
When I hit C-x k, a Helm buffer opens listing buffers that can be killed, and the mini-buffer at the bottom asks me to specify a buffer to be killed (a default is provided, in this case *GNU Emacs*).

Suppose I now mark one of the items in the kill-buffer, say *GNU Emacs*, by hitting C-<space> while standing on the corresponding line, and then move the highlight to a different line, say to *scratch*.

If I now hit <return>, what's supposed to happen? As I understand it, the file that was marked, namely *GNU Emacs*, should be deleted, and that is all. What actually happens is that the highlighted file, namely *scratch*, gets deleted, and the other two remain in tact, as shown by executing C-x C-b.

Why does Helm behave this way? And, by the way, why does the helm-mode-kill buffer remain open, as seen in the last screenshot?


texts: How to get the "number prefix" to be used in a function? (evil mode)

texts: With emacs evil-mode, you can use number prefixes before commands (like in vim).  For example 10j goes 10 lines down.  I am trying to define a custom function which can make use of these "number prefixes" (if that's the right terminology).  How do I capture that prefix in the form of an elisp variable?


texts: Is there a way to disable automatic indentation when editing an existing line?

texts:
There are cases where my indentation style does not follow what Emacs thinks it should be. (I believe that coding standards should be guidelines, not strict rules, and that deviations should be acceptable if there's good justification for them.)

For example, I might want to format code in C like:

if (   test_some_condition()
    && test_another_condition()
    && test_yet_another_condition())
{
    // ...
}

So I type:

if (   test_some_condition()
    && test_another_condition

but when I press (, Emacs will aggressively reindent my current line to:

if (   test_some_condition()
       && test_another_condition(

Is there any way disable that?  That is:

I do want new lines to be automatically indented based on the previous line.
Once I start typing, I've already indented the current line the way I want it, and I don't want it to be reformatted when I press (, ), RET, etc.


texts: Writing bytes to a file using library f.el

texts:
I'm trying to do something very simple, write bytes to a file using the f library:

(require 'f)

And I create a list of bytes:

(setq random-data (loop for i from 0 to 40 collect (random 150)))

So far, so good.  However, the unibyte-string function seemingly expects separate arguments so the following doesn't work:

(f-write-bytes (unibyte-string random-data) "file.dat")

This seems painfully easy but I can't get it working, is there a standard way of doing this?


texts:
I am trying to highlight particular chars for use in C++ in emacs. I have found the package highlight-chars works very easily. I can use hc-highlight-chars command, it then prompts me for a set of chars and then asks for a face.

However, it expires when I restart emacs. I am very new to emacs so I can't figure out a way to achieve this permanently. Maybe some command I can put in .emacs?


texts: How to disable flycheck fringe markers for warnings?

texts:
I find the question mark fringe markers for flycheck warnings slightly distracting.  Is there a way to hide them?

I'd like to keep the error fringe markers.

I tried M-x customize-face <RET> flycheck-fringe-warning <RET>, unchecking all the attributes, and setting the state to 'Save for future sessions'.  That had no effect I observed.


texts: Is there a standard function that applies a list of predicates to a value until success?

texts:
I look for compacting expression like:

(let ( (val (complex-expr ...)) )
  (or (pred1 val) (pred2 val) ...(predN val)))

Instead I like something:

(apply-some (complex-expr ...) '(pred1 pred2 ... predN))


texts: How do I run multiple versions of Emacs with the same .emacs.d

texts:
I alternatively run 24.5 and 25.0.50. Unfortunately, packages installed and compiled from 25.0.50 don't work with Emacs 24.5 (cl-struct-define is a common culprit).

One trivial solution is to not byte-compile anything. That makes things pretty slow, though.

How can I use compiled packages (for performance) while using the same .emacs.d for both 24.5 and 25.0.50? I'd also be ok with 24.5 ignoring the compiled files.


texts:
I am reading SICP to learn Lisp, the book uses Scheme dialect. I want accommodate it to emacs lisp, I find something weird in 3.1.1 and cannot figure it out, say I have a test.el file:

(defun make-account ()
  (defun withdraw (amount)
    (print "in withdraw"))
  (lambda () 'withdraw))

(setq a (make-account))
(withdraw 10)

Execute this file with command emacs -batch -l test.el yields "in withdraw". Why is not function withdraw local in make-account?

And if I comment out (setq a (make-account)), it complains about Symbol’s function definition is void: withdraw.

What am I missing here? Thanks for any help!


texts: org-mode how to obtain header hierarchy for current position

texts:
I am trying to customize export behavior for emacs org-mode.  A task I am getting stuck on is obtaining the element hierarchy for a given location in the document.

I am using emacs 24.5.1 with org-mode 8.2.10.

I have found the function "org-export-get-genealogy", which is supposed to return the hierarchy of an element in org-mode 8.2, but I cannot figure out how to initialize the environment correctly for it to work.  Specifically, it seems like you need to initialize the parse tree for the buffer before you can invoke org-export-get-genealogy, and I cannot figure out how to do this correctly.  I am fairly new to emacs lisp, and am not very familiar with the ways dynamic scope is used.

This is my current code

(setq *myvar* (org-element-parse-buffer)) ;how can I link this to the next line?
(org-export-get-genealogy (org-element-at-point))

Org-export-get-genealogy invoked as above always returns nil.  How can I change the code so that org-export-get-genealogy returns the hierarchy for the element?

Thanks!


texts: How to troubleshoot a key binding prompting for more key presses?

texts:
I have a function bound to Ctrl-b, this runs a command immediately, however after some time running emacs, pressing this binding shows text C-b in the message bar, prompting for other keys to be pressed.

If I press Enter, it runs the command, otherwise it keeps accepting key and mouse input.

C-h k still shows up this key binding as being associated with the function I expect it to run.

How to troubleshoot emacs expecting further input for a key binding?

Edit: the command (which I wasn't sure if it was important) is to build.

(defun generic-build ()
  (interactive)
  (cond
    ((string= major-mode "c-mode")
      (call-interactively 'cmake-ide-compile))
    ((string= major-mode "c++-mode")
      (call-interactively 'cmake-ide-compile))
    )
  )

(global-set-key (kbd "C-b") 'generic-build)
(eval-after-load "evil-maps"
  (define-key evil-motion-state-map "\C-b" nil))

Update 1:

This happens if I try to exit too, Pressing Ctrk-b, Ctrl-h shows this message.

This would have to be related to my configuration, the issue just never came up until recently.

Type SPC or ‘y’ to save the current buffer;
DEL or ‘n’ to skip the current buffer;
RET or ‘q’ to give up on the save (skip all remaining buffers);
C-g to quit (cancel the whole command);
! to save all remaining buffers;
C-r to view this buffer;
d to view changes in this buffer;
or . (period) to save the current buffer and exit.

I'm using:

(setq use-dialog-box nil)

Which has been working up until now.

Using emacs -Q, then setting (setq use-dialog-box nil) still prompts for file save.

Update 2:

Found the root cause, posting in answer since its confusing to include here.


texts: forward/backward/next/previous element against YAML?

texts:
The lisp program is structured language, and one can execute C-M-f(forward-sexp) to pick the next sibling element.  Similarly, C-M-b, C-M-u, C-M-d are defined; they can be used to move the cursor to backward/upward/down the current lisp element.

Nowadays, there are many occasions to edit YAML files.  Since YAML file is also a structured language, I thought it would be nice if we could similar operation for moving around, against these files.

Question

When editing YAML files, can I move the cursor according to the current YAML element being pointed by the cursor, just like we'd go up/down/next/previous element in the lisp snippet?


texts:
Q: is there an image-dired analog to make thumbnails in pdf-tools?

image-dired provides
facilities to browse images in a directory by thumbnail.  Is there
analogous functionality
for pdf-tools?

The use case I see is in jumping to different pages.  pdf-tools
allows us to select pages by number, but blindly.  I often don't
remember which page I want by number, but could easier figure it
out if I had thumbnails.


texts:
I'm trying get Spacemacs (i.e., Emacs) to use the Windows subsystem for Linux bash shell as the shell.

I've added (setq explicit-shell-file-name "c:/Windows/System32/bash.exe") to my .spacemacs configuration file, but when I enter:

SPC SPC ansi-term

and answer yes, it returns:

Spawning child process: invalid argument.

Is there a way to get Emacs to run bash (i.e., the Windows subsystem for Linux) as the shell?


texts:
So, for variety's sake I'd like lists and sublists to have different styles.  In emacs, I've enabled org-list-allow-alphabetical, but this doesn't work with export (not a bug).  However, there doesn't seem to be any simple way to change styles without adding extensive latex or html code to the file.

For example, with a list like this,

1. Parent
   1. child

I'd like to use a different marker for the sublist, to avoid confusion,  eg

1. Parent
   a) child

Latex seems to do this rather well by default.  Is there a way to specify it for other exporters?


texts: How to automatically create neat C comment blocks while typing?

texts:
Some code editors such as eclipse automatically form neat blocks when you start typing a multi-line comment:

Is there some package or another way to do this in emacs too?

Edit: To clarify: I do not want a key-combination that inserts a comment block. I want a comment block to be automatically created when I press RET after /*.


texts: some set-face-attribute not being applied when I create a new frame using C-x 5 2

texts:
I've a few set-face-attribute statements inside eval-after-load blocks inside my zenburn theme configuration. These are working fine when I startup emacs using emacsclient. But, when I create a new frame using C-x 5 2, the statements inside eval-after-load are not applied for the new frame.

My theme config for reference. As a workaround, I create new frames using emacsclient command on the terminal. But I'd not like to do this. Is there any way I fix this problem?

Install zenburn-theme and golden-ratio-scroll-screen and open emacs -Q and run the below steps to reproduce the problem:

(package-initialize)
(require 'zenburn-theme)
(require 'golden-ratio-scroll-screen)
(load-theme 'zenburn t)
(set-face-attribute 'golden-ratio-scroll-highlight-line-face nil
                         :background nil :foreground nil)

Now open any file, and run golden-ratio-scroll-screen-up or golden-ratio-scroll-screen-down and observe the face of the current line as it moves up/down. Now enter C-x 5 2 to create a new frame and run golden-ratio-scroll-screen-up and now you can see that the face settings you applied previously are gone and it has reverted back to its default face settings.

My emacs environment:

Emacs version: GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin17.6.0, NS appkit-1561.40 Version 10.13.5 (Build 17F77))
 of 2018-06-21, built using commit 5583e6460c38c5d613e732934b066421349a5259.

./configure options:
  --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=/usr/local/share/emacs/site-lisp --infodir=/usr/local/Cellar/emacs/HEAD-5583e64_1/share/info/emacs --prefix=/usr/local/Cellar/emacs/HEAD-5583e64_1 --with-gnutls --without-x --with-xml2 --with-dbus --with-imagemagick --with-modules --with-rsvg --without-pop --with-ns --disable-ns-self-contained

Features:
  RSVG IMAGEMAGICK DBUS NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS


texts:
Every time I use the command helm-list-elisp-packages it downloads all the index files from melpa, gnu etc. Is there a way to make it rely on the previous cache of the index files ?

I know there is package-list-packages-no-fetch which does what I want but it doesn't have the nice helm interface.


texts:
How can i get current programming language at current cursor.
For example, if my cursor is inside script tag, then it should return js or javascript and if it is inside style tag, then it should be css and if it is outside both of this tag, then it should be inside html so it should also return html.

<html>
    <script>
    ...
    </script>

    <style>
    ...
    </style>
</html>


texts: Show only the real matches in clock table - without their parent headlines

texts:
The clock table of org mode has so many great features but I couldn't find this:
I'd like to have only the headlines with a specific tag without their parents.

Example

#+BEGIN: clocktable :scope file  :match "thisTag" :tags t
#+CAPTION: Clock summary at [2020-04-28 Tue 14:04]
| Tags    | Headline           | Time   |      |
|---------+--------------------+--------+------|
|         | *Total time*       | *0:05* |      |
|---------+--------------------+--------+------|
|         | parent headline    | 0:05   |      |
| thisTag | \_  child headline |        | 0:05 |
#+END:

* parent headline
** child headline  :thisTag:
:LOGBOOK:
CLOCK: [2020-04-28 Tue 12:00]--[2020-04-28 Tue 12:05] =>  0:05
:END:

Only the 'child' has the tag 'thisTag' but the table mentions also the parent. This could be helpful but I'd like to keep the table small: to show only the headlines with the tag 'thisTag', so without 'parent headline' -- something like this:

| Tags    | Headline           | Time   |
|---------+--------------------+--------|
|         | *Total time*       | *0:05* |
|---------+--------------------+--------|
| thisTag | child headline     | 0:05   |

How to get it?


texts: How do I do the key strokes `C-M-c` in spacemacs?

texts:
I'm using spacemacs but trying to use ediff-regions-linewise to compare a couple regions of text. In order to confirm the selection, I need to do C-M-c.

This is probably a silly question, but how do I actually do C-M-c? I assume M is meta, but when I hold control and escape I get a <c-escape> is undefined. As a sanity check, holding control and the character M doesn't work either (selects the next line). Maybe this is a spacemacs issue because of remapped keybindings, but how do I do this in spacemacs?


texts: How can I identify all changes to match-data?

texts:
I have a sporadic error when running query-replace:

Args out of range: #<buffer lib.rs>, 0, 1

There are similar questions:

Match data clobbered by buffer modification hooks
(RegEx-)Replace: Sporadic Match data clobbered by buffer modification hooks

These point towards the problem being that something is overriding the match-data during the find-and-replace operation, but it's difficult to identify exactly what.

Is it possible to log to a buffer or enter the debugger any time that the match-data is modified? Is there another technique to identify what is clobbering the match-data, before I resort to line-by-line printf style debugging? Bisecting my init file would tell me what package I'm using is misbehaving, but not where the misbehavior occurs.

I've seen Tracking down a write to a variable, but that doesn't appear to apply to match-data, which is a function, not a variable. I've also seen How do I debug when match-data is not getting set?, which appears to be the opposite problem from mine.


texts:
When i press C-c C-x C-d (org-clock-display) emacs expands links in headers. How to prevent this?

Sample file:

* h1
** [[http://duckduckgo.com/?q%3Dvery%20long%20search%20term%20blabla][DuckDuckGo]]
   CLOCK: [2015-07-03 Pt 11:18]--[2015-07-03 Pt 11:30] =>  0:12

before:

after running org-clock-display:

Links is expanded and i don't see the time near second headline.


texts: How to insert a new same-level headline after current one?

texts:
Suppose I have an org-mode buffer that contains the outline shown below, and that point is at the position indicated by the ▮ character.

* foo
** bar
*** baz
    - eenie
      - yabba
      - dabba▮
      - doo
    - meenie
    - minie
* frobozz
** quux

Call this particular configuration (buffer content + point position) the initial state.

If I now run org-insert-heading (IOW, I type M-<RET>), I get a new list item:

* foo
** bar
*** baz
    - eenie
      - yabba
      - dabba
      - ▮
      - doo
    - meenie
    - minie
* frobozz
** quux

Now, I think of a "heading" in an org-mode outline as a line beginning with *'s.  Therefore, if I interpret the name of the command org-insert-heading literally, I would have expected that running org-insert-heading from the initial state would have produced the following, which I'll refer to as the desired state:

* foo
** bar
*** baz
    - eenie
      - yabba
      - dabba
      - doo
    - meenie
    - minie
*** ▮
* frobozz
** quux

My question is:

  does the org-mode interface already provides a more direct way1 to achieve the desired state starting from the initial state?

(In case that the answer to this question is "no", then a distant second-best would be a way to override org-insert-heading so that it behaves the way I think it should (i.e. always inserting a heading, namely a line starting with *s, and thus producing the desired state from the initial state), together with a new custom command that preserves the default behavior of org-insert-heading in the initial state.  I'd appreciate any help I can get with this too.)

1 I stress that my question does not ask for any way, by hook or crook, to get to the desired state from the initial state.  I realize that, if nothing else, I can always "revert to plain Emacs", so to speak: for example, I can move point as shown below

* foo
** bar
*** baz
    - eenie
      - yabba
      - dabba
      - doo
    - meenie
    - minie▮
* frobozz
** quux

...and then type the sequence RET***SPC, to arrive at the desired state.


texts: How can I automatically insert a prototype in foo.h from foo.c?

texts:
Suppose I'm writing a C program in a file foo.c:

int add_numbers(int x, int y, int z) {
    // Very complex implementation here.
    return x + y + z;
}

I want a command that will insert a corresponding function prototype in foo.h:

int add_numbers(int x, int y, int z);

Are there any existing Emacs solutions for this?


texts: Is there a command for opening emacs in shell mode?

texts: Suppose I want to open emacs with a file and shell mode together. If there were two files I would do emacs file1 file2 and emacs opens them both. Is there a command to do this with emacs file [shell]?


texts: Prevent org source block face from bleeding out in fold

texts:
The problem is that when there is one line in between folded headings with source blocks the text properties of the #end-src line bleeds out. You can see the lines bleeding on the right in the image.

Update Progress So Far
step 1
To do this I have taken two steps.
The first is to unfontify the end of the last line of a subtree when hiding it if that line is the end of a source block. That's the line responsible for the bleeding. This will ensure that the font face doesn't bleed out when a block is hidden with outline-hide-subtree.
(defun dwim-unfontify-last-line-of-subtree (&rest _)
  "Unfontify last line of subtree if it's a source block."
  (save-excursion
    (org-end-of-subtree)
    (beginning-of-line)
    (when (looking-at-p (rx "#+end_src"))
      (font-lock-unfontify-region
       (line-end-position) (1+ (line-end-position))))))

(advice-add #'outline-hide-subtree :after #'dwim-unfontify-last-line-of-subtree)

step 2
The second step is the hard one. I determined that outline-show-heading is the fundamental function for showing headings. This function checks if the heading being shown has
(defun dwim-fontify-last-line-of-block (&rest _)
  "Do what I mean: fontify last line of source block.
When the heading has a source block as the last item (in the subtree) do one of the
  following:
If the source block is now visible, fontify the end its last line.
If it's invisible, unfontify its last line."
  (let (font-lock-fn invisible-p heading-name)
    (save-excursion
      ;; Debugging
      ;; (save-match-data
      ;;   (beginning-of-line)
      ;;   (looking-at
      ;;    (rx bol (+ "*") "\s" (submatch (+ (not (any "\n"))))))
      ;;   (setq heading-name (match-string-np 1)))
      (org-end-of-subtree)
      (beginning-of-line)
      (when (looking-at-p (rx "#+end_src"))
        (setq invisible-p (outline-invisible-p (line-end-position)))
        (setq font-lock-fn
              (if invisible-p
                  #'font-lock-unfontify-region
                #'font-lock-fontify-region))
        ;; Debugging
        ;; (message "-%s-’s end_src is %svisible"
        ;;          heading-name
        ;;          (if invisible-p "in" ""))
        (funcall font-lock-fn
                 (line-end-position)
                 (1+ (line-end-position)))))))

(advice-add #'outline-show-heading :after #'dwim-fontify-last-line-of-block)

problem
This is extremely close to working. If you use outline-toggle-children to display the children of a subtree and every child is a subtree (in other words each is displayed as a folded headline), the last source block of every headline should be invisible. That's because all the headings are folded. But (outline-invisible-p (line-end-position)) says the last child of that subtree remains visible.
The picture below shows what I mean. You can see the last child of the Top level headings is bleeding out. And the last child of the level Completion heading is bleeding. This is what happens when I displayed them with outline-toggle-fold.
]


texts: How can I make dired display .tbz2 files

texts:
When using dired and I see a .tar.xz file I can visit this file in other window (<mouse-1>) and the file is a browsable tar archive.
How do I get .tbz2 files to behave in the same way?
I am using emacs versions 25 and 27


texts: emacsclient exits unexpectedly without any error

texts:
I've built GNU Emacs 27.0.50 from source in Ubuntu 18.10. Then started the daemon as a systemd unit:

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=notify
ExecStart=/home/marcanuy/local/bin/emacs --fg-daemon
ExecStop=/home/marcanuy/local/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

When I start emacsclient running emacsclient -c it quits after a while without any errors.

Even running it with gdb doesn't shows anything:

(gdb) exec-file emacsclient
(gdb) set args -c
(gdb) run
Starting program: /home/marcanuy/local/bin/emacsclient -c
Waiting for Emacs...
[Inferior 1 (process 2858) exited normally]
(gdb) bt
No stack.

It happened configuring it with and without x-lucid:

./configure --prefix=$HOME/local

and

./configure --prefix=$HOME/local --with-x-toolkit=lucid

both have the same problem.

Also, the daemon is running without problems:

$ systemctl --user status emacs.service
● emacs.service - Emacs text editor
   Loaded: loaded (/home/marcanuy/.config/systemd/user/emacs.service; enabled; vendor preset: enabled)
   Active: activating (start) since Tue 2019-01-15 06:13:47 -03; 1min 16s ago
     Docs: info:emacs
           man:emacs(1)
           https://gnu.org/software/emacs/
 Main PID: 3138 (emacs)
   CGroup: /user.slice/user-1000.slice/user@1000.service/emacs.service
           └─3138 /home/marcanuy/local/bin/emacs --fg-daemon

ene 15 06:13:47 scarone systemd[1383]: Stopped Emacs text editor.
ene 15 06:13:47 scarone systemd[1383]: Starting Emacs text editor...
ene 15 06:13:54 scarone emacs[3138]: Loading /home/marcanuy/.emacs.d/helm-adaptive-history...
ene 15 06:13:54 scarone emacs[3138]: Loading /home/marcanuy/.emacs.d/helm-adaptive-history...done
ene 15 06:13:57 scarone emacs[3138]: [yas] Prepared just-in-time loading of snippets (but no snippets found).
ene 15 06:13:58 scarone emacs[3138]: [yas] Prepared just-in-time loading of snippets (but no snippets found).
ene 15 06:13:59 scarone emacs[3138]: Turning on magit-auto-revert-mode...
ene 15 06:13:59 scarone emacs[3138]: Turning on magit-auto-revert-mode...done
ene 15 06:13:59 scarone emacs[3138]: Starting Emacs daemon.

Any idea?


texts: Org-mode: scheduling time to work on tasks

texts:
I'm still trying to wrap my head around how the agenda can work, and I'd like to get a few other people's approaches to it.  What I'd like is to be able to take a task, say writing a paper.  I know that will take about 6-8 hours, and I'm not going to write it in one sitting.  So, I need to set aside three or four 2 hour blocks to work on it.

According to the manual, Deadlines are for the time something must be done by.

DEADLINE: <2016-03-16 Wed>

Simple enough.  Scheduling allows you to set a time to start, so I can schedule the paper two weeks before it's due to start it.

SCHEDULED: <2016-03-02>

So far so good, but it hasn't actually given me specific times to work on the task.  This question suggests scheduling an item, and letting it appear on the agenda until it's done, but that still leaves the problem that a large task can only be scheduled once.

I could assign several timestamps to it, one for every day I want to work on it.

<2016-03-04
<2016-03-06 7pm>
<2016-03-08>

This seems to be a popular solution, but the agenda and todo views don't seem to have an easy way to manipulate timestamps, as they do for deadlines and scheduled dates, with C-c C-d and C-c C-s.

The other option is to break up the task into a number of subtasks (e.g., research paper, write body, write conclusion, write intro), and schedule those individually.  But, there seem to be many tasks that breaking it up just wouldn't make sense, or where the smallest subtask will still take several hours.

So, have I misunderstood how to schedule things?  Is there a simple way to manipulate timestamps in agenda view, or do I just need to plan my projects out to the point every scheduled item can be done in a few hours?  What approaches are have worked for you?


texts:
How can I apply M-; to comments out blocks in matlab-mode? Currently it only adds comments at the end of line.

Thanks!


texts: How could "C-x 4 b "which pop-up-window but display to the right?

texts:
In emacs -Q, I strike C-x 4 b which invoke (switch-to-buffer-other-window) and display the other window vertically as

I reference it's source code

(defun switch-to-buffer-other-window (buffer-or-name &optional norecord)
  (interactive
   (list (read-buffer-to-switch "Switch to buffer in other window: ")))
  (let ((pop-up-windows t))
    (pop-to-buffer buffer-or-name t norecord)))

It apply the procedure of pop-up-window.

How could  use "C-x 4 b" pop up the other window which display horizontally instead of vertically?


texts: redirect stderr to a file in call-process-region

texts:
I have been reading the documentation for call-process-region here and I am trying to redirect stderr to a file. from the the documentation, this looks correct

(call-process-region beg end perltidy-executable t '(t (:file "/tmp/tidy")))

however when I try to run it I get the following error

Wrong type argument: stringp, (:file "/tmp/tidy")

it works without errors if I use

(call-process-region beg end perltidy-executable t '(t nil))

but that causes stderr to be lost.

What am I doing wrong here?


texts: Emacsclient: One single emacs process all the time from start up & never close & better hide GUI

texts:
Since emacsclient can handle long package loading time proerly, I really want to keep at least one emacs process, and most of the time only one emacs process, open as a background process and better hide GUI.

Right now I defined the following function in .bashrc:

emc ()
{
    if [[ $# -eq 0 ]]; then
        emacs --eval "(suspend-frame)" &
        return
    fi
    args=($*);
    setsid emacsclient -c -e "(find-file \"${args[*]}\")"
}

And also have the following line in .bashrc:

emc

So everytime I open up a shell, I will end up having a new emacs process.

The problem is I will have many additional unnecessary emacs process after opening up many shells. However, I only want to maintain one single emacs process all the time from startup better hide GUI.


texts: Emacs company-css, where is the completion of css values?

texts:
Company-mode completion seems a little weak in emacs. Is it my configuration?
Property completion seems simple enough:
strong {
  color: red;  /* <= color is the property */
}

Where red is the value in above, value completion is seemingly entirely absent? Comparatively, browser console gives every possible completion for a css value in the dropdown, while company-css suggests nothing?
Am I missing a backend? I'm using company-css and company-capf?
Does anyone have any suggested configuration for working css value completion in company?
Thanks


texts: Bring Emacs frame to front when running emacsclient on WSL

texts:
Currently using Emacs on Windows Subsystem for Linux (WSL).
I have this alias for emacsclient executable:

alias e='emacsclient -n'

Which I run very often when I am on the terminal (I use ConEmu or terminator).

The problem is that whenever I execute it, Emacs windows is not brought to front.
So I have to search for it with Alt+TAB...
Which I find a bit annoying when I have a bunch of windows opened.

Is there a way to bring Emacs to front when running emacsclient ?


texts: How do I insert multiple line breaks in org-mode when exporting to html?

texts:
I want to emphasize a particular bit of text that contains a poem. The way I'm trying to do that is by inserting multiple line breaks

something \\ \\ \\ poem

However in html it renders the same way

  something \ \ \ poem

How do I insert multiple line breaks to emphasize a piece of text in org mode


texts:
I'm running emacs 25.0.50.1 on Mac OS X 10.10.2

I want to use image magick, do I need to rebuild this version of emacs?

Is there an easy solution?

All best,


texts: Why does a certain file always gets opened on startup?

texts: I'm using desktop-save-mode to automatically open the files that I had opened in the last session. This mode should also remember the files that I closed so that it no longer opens them in the next session. However, there is one file, say a.tex, that gets opened every time I start emacs regardless of having closed it in the last session. Interestingly, if I run emacs with the --no-desktop flag, the file a.tex doesn't get opened automatically. Why is desktop-mode opening the file? How can I debug this issue?


texts:
How do I modify an existing overlay, more specifically, in spacemacs I have

and the overlays are covering the all the parenthesis. Note that the overlays move depending on what inner set of parenthesis point is in. I would like to be able to tweaks the look of the overlays but I haven't seen any way of doing this. I tried modifying rainbow-delimiters-depth-.. faces but as this is an overlay there is no change. The manual seems to require you to know the beginning and end of the overlay to change it. But since this is always changing, I do not see an easy way of doing that.


texts: How do I specify a different folder for .spacemacs file?

texts: I want to put my .spacemacs into Github, so I cloned it to a local directory. How to let Emacs use the .spacemacs in that directory instead of from the default ~/.spacemacs?


texts: How do I use epa-sign-file and not disrupt functionality of the file with the ASCII-armored signature

texts:
I want to be able to gpg sign specific files, specifically org-mode file.

However, doing M-x epa-sign-file RET filename.org will create the file filename.org.asc and introduce new text in that file that might disrupt functionality of the file if used as the original file.
It seems cumbersome to publish both files.

Is there a way to make sure that the file filename.org.asc can be used as the original file.

Minimal working example

example filename.org:

* Should be loaded

#+begin_src emacs-lisp
(message "hello world")
#+end_src

This will be after M-x epa-sign-file RET filename.org -> filename.org.asc

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

* Should be loaded

#+begin_src emacs-lisp
(message "hello world boom")
#+end_src
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJWTNPCAAoJED51s3ZWaq4/D5cH/3ztdd3YZxOu/XCG7bOEZuQa
jcxKrXiwhmLhKoC4a9tmgCJVDryy4tdSci2WUHoIxJ0vN3BFI2txFm7aoxGpIQCk
Dxjczy2RtHeN1+N+wBsxeQq5EeZ0A/7c9+eJQmub2GopAWe6D7rggCAEvnFNFcdN
LcZTo1o/jrKa63Q/KPmN+Y2E2nC4KjICn+SvaVUy2noZzS7c6ofw2dsY7YP915Ng
hs/38aITDMOpapzphQ0/VkJRDAard8U5jGmCIOMGwXyC7NIYVYB69Cdruo8uz/HA
xzl8QpMz/tv7qOLyQJLZYCPAglrt5ZGA19XAuKHqMgfvS563UCmRJdcLuGZaj58=
=3jbG
-----END PGP SIGNATURE-----


texts: Evil Org-Mode set L and H to tabbar movements

texts:
I can toggle org-mode TODO status with L and H when the pointer rests at a org heading. I wish I could bind those keys to tabbar-"movements" to mimic the behaviour I get in all othem mode with this simple snippet while the pointer is not above an org heading.

  (define-key evil-normal-state-map "L" 'tabbar-forward-tab)
  (define-key evil-normal-state-map "H" 'tabbar-backward-tab)

When I hit L or H I get this currently:

user-error: To use shift-selection with Org mode, customize ‘org-support-shift-select’

How can I customize the org-support-shift-select so I get the behaviour I want?


texts: Set text-property a buffer text automatically

texts:
I use Julia REPL, Singular or some other math software in my emacs.
In every case, I have a buffer (*julia* or *Singular*,...) synchronise with some running process.
The last line of this buffer is where I introduce the commands to execute.
This last line is something like

julia >

or

>

So, I would like to add the property cursor-intangible to this text, since I will never edit it and it would be much more similar to an actual terminal.
I know the commands add-text-property and so on, but I would like something that works automatically every time that the buffer changes.
Does it exists? It would be something similar to font-lock but for properties.


texts: Table cell alignment breaks when using latex inside org table

texts:
Let's assume we have a table that looks like this:

After running org-preview-latex-fragment command I get this:

As you can see the top row is not aligned with the other rows.

How can one view latex formulas inside org-mode tables without breaking table alignment?


texts:
I would like to backup buffers before they are (auto) reverted.

This is nontrivial because the file a buffer is visiting isn't current, and the backup system normally works by duplicating the file the buffer visits.


texts: I would like to install mspyls language server on my work machine that does not have access to an internet. I am able to transfer files over to the work machine via thumb drive. Is there a way for me to download the files on another machine and thumb it over?


texts:
I am trying to learn Elisp and just found  this line that I don't understand, in a package that I use to send code from buffer to a terminal:

 (let* ((region-active (region-active-p))

        ;; The region to be sent
        (bds   (isend--region-boundaries)) ; <<-- *** LINE OF INTEREST ***
        (begin (car bds))
        (end   (cdr bds))

What does that command do? isend--region-boundaries is a function defined elsewhere), but bds isn't. So what's bds here?

Maybe it's just coincidence, but I have found the same keyword used elsewhere.


texts: Can I safely clean up the .emacs-mail-crash-box and how not to store mail localy?

texts:
I've just discovered that this file (written by Gnus) is almost 50 MB big.  I don't need my mail archived locally.  How can I tell Gnus not to save it there? (Or, maybe, if possible, for only a very short time, like a week or so).

I've looked here: http://www.gnu.org/software/emacs/manual/html_node/gnus/Mail-Source-Customization.html but this doesn't answer the question.  From this I can't understand what exactly is stored in this file, and whether it's ok to delete it.

PS. I also don't want to store outgoing mail there, in case it's stored there.  I.e. I don't want Gnus to ever store any mail on my computer for longer than a few days (but would chose not to store it at all if I had to).

Here's an update: I tried, at first, to truncate the file (i.e. echo '' > ./.emacs-mail-crash-box), which caused some bizarre problems, and Gnus wouldn't connect. But completely removing this file let Gnus connect to my GMail account. I didn't investigate the problem though. The symptoms were these: after starting Gnus it would hang for a while, and when interrupted it would give a message related to missing '*nnir-something* but grepping the source code I couldn't find where the message was coming from.


texts:
I am new to Emacs and I am trying to search for all words entered one by one using 'occur'. I am trying following code:

(defun occurlist (ss)
    (interactive "s\Enter list of search items: ")
    (let (lst (split-string ss))
        (message "In let block; lst=%s" lst)
        (while lst
            (occur (pop lst)))))

I enter the search words, e.g.: world bank report. It should search for these words one by one sequentially.

However, it is not working. There is no error message. Starting emacs with command "emacs --debug-init" also does not show any error message.

Where is the error and how can it be solved? Thanks for your help.

Edit: I added message in let block. It reveals that lst=nil at that location. Hence it is not entering the while loop. Why is lst not getting value of (split-string ss) in let block?

Correcting (let (lst (split-string ss)) to (let ((lst (split-string ss))) leads to function showing search for last word only.


texts: How to supply ispell program with dictionaries?

texts:
I have the following environment on my machine: Windows 7, emacs and aspell built with mingw. I am trying to use aspell for spell-checking in buffer.

After i change language to russian (i have russian language files, with names such as ru.multi, ru-ye.multi etc.), i get the following error when running ispell-buffer:

  ispell-init-process: Error: The file
  ""c:/mingw_mine"/lib/aspell-0.60/"c:/mingw_mine"/lib/aspell-0.60/russian"
  can not be opened for reading

My only configuration for ispell is:

ispell command program name set to correct full path
ispell-extra-args set to have "--prefix=\"c:/mingw_mine\"" in it

Dictionaries are located under abovementioned prefix in "lib/aspell-0.60" subfolder. When invoked from command line with that prefix, aspell correctly finds and loads them (ex.: aspell --prefix="c:/mingw_mine" -d ru.multi check c:/text.txt).

How can i ensure aspell, invoked from emacs, can do that as well?


texts: Activate doom mode line theme on non doom theme

texts:
I would like to use a non doom theme on Emacs but I like the doom mode line.  The problem is if I use a non doom dark theme, say Charcoal-Black, and activate doom mode line, then doom mode line is always in light color, very hard to see.

It seems that doom themes are made for doom mode line.  So if I have Doom Dracula, then doom mode line will automatically adjust to have theme similar to Doom Dracula.

So, I would like to know if:

Can we customize doom mode line face if we are using a non doom theme? Eg, background, foreground.
On the other hand, can I use a non doom theme like Charcoal Black, then somehow tells doom mode line to use say Doom Dracula as its theme for the mode line?

This is an example of what I meant

As you can see, the doom modeline background is always white on non doom theme.


texts: C++ "std::cin >> " is not pausing to read input from Emacs shell

texts:
The following program is from https://www.cs.bu.edu/teaching/tool/emacs/programming/

#include <iostream>

int main()
{
  int howmany;

  std::cout << "Enter a number: ";
  std::cin >> howmany;
  std::cout << "howmany=" << howmany << std::endl;

  return 0;
}

It compiled and ran in Emacs shell:

SPC c C  (compile)
SPC !    (shell-command)
Shell command: ./total

The program did not stop and prompt for input.
The program just blows by the "std::cin >> howmany;" and assigns 0 to howmany.
I did not enter any input.
For one second the mini buffer said:

Enter a number: 0

The *Messages* buffer says:

user-error: Minibuffer window is not active
Enter a number: howmany=0

The executable works fine when run from Bash shell:

$ ./total
Enter a number: 2
howmany=2

Why does std::cin work in Bash shell, but not in Emacs shell?

https://www.gnu.org/software/emacs/manual/html_node/efaq-w32/Subprocess-buffering.html
says:

having an explicit flag to control their buffering behavior,
typically -i for interactive, or by a special environment variable.

Would that fix it?  Where does the -i flag go?

I am using Emacs 25.2.1 with Evil Spacemacs and Ivy on Linux.

UPDATE_1

The interactive program works when shell-commend is called with asynchronously option:

SPC SPC (counsel-M-x) async-shell-command

Enter a number: 2
howmany=2

From Emacs help describe-function shell-command:

shell-command is an interactive compiled Lisp function in ‘simple.el’.

...

If COMMAND ends in ‘&’, execute it asynchronously.
The output appears in the buffer ‘*Async Shell Command*’.
That buffer is in shell mode.  You can also use
‘async-shell-command’ that automatically adds ‘&’.

Otherwise, COMMAND is executed synchronously.  The output appears in
the buffer ‘*Shell Command Output*’.

Why would interactive program not work on a synchronous system?
https://en.wikipedia.org/wiki/Asynchronous_system

I am thinking of binding async-shell-command to SPC !.
Is there a disadvantage to always running async-shell-command instead of the default shell-command?


texts: Why does visiting a file cause my to lose me custom faces?

texts:
Every time I start emacs and visit my first reStructuredText file, I discover that I once again have the default colors for the section headings, which are illegible to me.

If I have the customizer open in another window while I open the first reStructuredText file, I can see the colors revert to their defaults right before my eyes.

Then, if I open my ~/.emacs file and re-execute this statement with C-x C-e, the colors right themselves:

(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(rst-level-1-face ((t (:background "blue1"))) t)
 '(rst-level-2-face ((t (:background "blue2"))) t)
 '(rst-level-3-face ((t (:background "blue3"))) t)
 '(rst-level-4-face ((t (:background "blue4"))) t)
 '(rst-level-5-face ((t (:background "navy"))) t))

How would I hunt down the thing that is causing my colors to change?


texts: Moving one item in Org Table from col 1 to col 2 problem

texts:
Given the following structure:

| A |  |  |  |
| B |  |  |  |

I want the following:

|A |  |   |  |
|  |  | B |  |

Question:
Is there a way to move single elements between columns?
What I know right now I can only move whole columns.


texts: Warning (flycheck): Syntax checker javascript-eslint reported too many errors (494) and is disable

texts: I switched to a new linter and on big files it causes flycheck to disable because it reports too many errors. I don't believe this is an issue with the linter as when I check the output in the terminal it seems to be legitimate flags. How can I increase the number of errors thrown by the linter before flycheck disables?


texts: How to turn typopunct minor mode on globally

texts:
I want to be able to use typopunct minor mode globally.

I have tried to add (global-typopunct-mode 1) to my init file, like so

;; Typopunct mode
(require 'typopunct)
(typopunct-change-language 'english t)
(global-typopunct-mode 1)

but I get this error: Symbol's function definition is void: global-typopunct-mode.
Then I thought that the problem could be something similar to this post, but I have package-initalize on my init.el file (as shown below)

;; MELPA controls
(when (>= emacs-major-version 24)
  (require 'package)
  (setq package-enable-at-startup nil)
  ;; (add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
  (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/")) ;; install it manually
  ;;(add-to-list 'package-archives '("ox-odt" . "https://kjambunathan.github.io/elpa/"))
  (package-initialize))

which makes me believe that typopunct was not meant to be activated globally... Thanks in advance for any help.


texts: Uninstalling a package and all of its dependencies

texts: Magit doesn't work on my system. I'd like to remove it and everything that came with it when I installed the package. How can I do this? What packages, beside Magit, were installed on my emacs when I installed Magit?


texts:
I'm editting CQL(Cassandra Query Language) on emacs and came to wonder if there's any dedicated major mode for editting CQLs.

Is there such one?


texts:
I'm trying to use org-mode to do almost everything. In my scientific writing activity, I would like to sketch a whole paper in an .org file and then export in LaTeX. I don't want to load the .bib bibtex file in the init.el as I could have multiple ones. For now, I've added this at the head of my .org file:

#+BEGIN_SRC elisp
(setq reftex-default-bibliography '("./references.bib"))
#+END_SRC

But I have to execute it manually every time. Is there any way to make it automatic? The optimal would be to have a directive at the beginning of each .org file saying emacs: "ok, now you should load this .bib file". Any hint? Thanks.


texts: How to open all the opened files from a previous session?

texts:
Whenever I open my spacemacs I see the recentf buffer which lists 5 files I had open in my previous session. There is only an option to open them one by one, and only five of them, because others are listed later in the same buffer, separately (sort of history). Is there a way to make emacs open all the files I opened in the previous session, in one click?

I can only see the recentf-open-most-recent-file-X (X: [0; 9]) function, however, it is unclear, are the files listed there from the previous session or the session before previous.

Or are there any functions I could use to write my own function to do all of this?


texts:
I have just started using emacs, after coming from using Xcode.
I would like to get code completion for C++, however there are a whole bunch of things that don't really explain what they do (at least not to someone who is used to things just working)

I've looked at irony-mode and company but can't seem to get them to work, and the documentation seems to be awful for irony-mode, I'm not even sure what it does. Company-mode seems to be responsible for displaying the small popup rather than jarringly opening a new frame.

I'm not sure what backend I need for company, I'd have though clang would be enough, but while I'm not sure if I enabled that correctly, no matter what I did I couldn't get the completion popup to show.

I also found helm, and have no idea what that does differently to eithe rof the two above.

Is there a simply guide, or just any documentation for irony-mode that will help me. I really feel like I'm missing something obvious because it can't be this complicated to get code completion when every IDE has it out of the box.


texts:
Some of my modes use overlays for contextual information.

However, I have a face that I'd like to always be shown despite any overlays on top of it. Is there any way to have such a "super face"?


texts: ESS: display-buffer-alist reusable-frames does not work as expected

texts:
I'm trying to use the display-buffer-alist variable to control how Emacs displays spawned inferior shells (ess-r in particular).

I'm using the display-buffer-alist value from ess doc:

(setq display-buffer-alist
      '(("*R"
         (display-buffer-reuse-window display-buffer-pop-up-frame)
         (reusable-frames . 0))))

However, when I start an R shell from some ess-r-mode buffer, the reusable-frames option does not seem to work: after creating a new frame displaying the R shell, Emacs displays a second instance of the ess-r-mode buffer in this new frame instead of returning to the old instance.
Everything works correctly when I set reusable-frames globally:

(setq display-buffer-reuse-frames 0)

but this should not be necessary.

How can I make display-buffer-alist work properly without touching global settings?

Versions:

GNU Emacs 26.1
Linux 5.4.0-3-amd64 #1 SMP Debian 5.4.13-1 (2020-01-19) x86_64 GNU/Linux
Debian bullseye


texts: Emacs won’t access Documents directory on MacOS Big Sur

texts:
I am running Emacs 26.3 on MacOS 11.2.1 “Big Sur”.  When I try to open the directory ~/Documents, it fails with the message “Listing directory failed but ‘access-file’ worked.”   Emacs.app is given Full Disk Access in my System Preferences.  I can open other directories, but not Documents, Downloads, or Desktop.
However, the problem does not occur if I start Emacs not by launching it from the Dock but by opening it from the Terminal with:
/Applications/Emacs.app/Contents/MacOS
./Emacs
Any ideas about why this is happening and how to fix it?  If I launch it from the terminal I get a couple of error messages:
2021-03-07 16:49:59.308 Emacs-x86_64-10_14[5820:4969143] Failed to initialize color list unarchiver: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver}
2021-03-07 16:50:24.499 Emacs-x86_64-10_14[5820:4969143] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
but Emacs seems to work just fine.
My folders are not synched to the Cloud.


texts:
I have a simple file looking like this,
#+TITLE: Title Here
#+AUTHOR: Author Name

Citation here [[cite:key_name]]

#+BIBLIOGRAPHY: refs plain

In the same directory I have refs.bib,
@MISC {key_name,
    TITLE = {Informal derivation (and interpretation) of Substitution Rule from Chain Rule?},
    AUTHOR = {user1180576 (https://math.stackexchange.com/users/629687/user1180576)},
    HOWPUBLISHED = {Mathematics Stack Exchange},
    NOTE = {URL:https://math.stackexchange.com/q/3354744 (version: 2019-09-13)},
    EPRINT = {https://math.stackexchange.com/q/3354744},
    URL = {https://math.stackexchange.com/q/3354744}
}

Now when I run org-latex-export-to-pdf, I don't get the references and looking at the Tex file produced,
% Created 2020-06-23 Tue 02:55
% Intended LaTeX compiler: xelatex
\documentclass[11pt]{article}
[snip]
\begin{document}

\maketitle
Citation here \cite{key_name}
\end{document}

The \bibliographystyle{plain} and \bibliography{refs} are missing. What am I doing wrong?
If I put \bibliographystyle{plain} and \bibliography{refs} in my org file than everything works fine.
Edit:
Following are my org-ref configurations,
;; org-ref
(use-package org-ref
  :ensure t
  :custom
  (org-ref-completion-library 'org-ref-ivy-cite))

And my org-latex-pdf-process is indeed set to (list "latexmk -xelatex -shell-escape -bibtex -f -pdf %f").


texts: How can I customize the LaTeX export of org babel #+RESULTS?

texts:
I regularly use org-mode and org-babel to create e.g. exercises or proof-of-principle documents which I export to PDF via the LaTeX exporter. I noticed that the #RESULTS generated by a #+begin_src-#+end_src block are put in a #+begin_example-#+end_example block, which is exported to LaTeX's verbatim environment.

I would like to customize this LaTeX export. I could try and add some #+LATEX_HEADER lines customizing the verbatim environment (e.g. using the fancyvrb package), however, ideally I would like to use the listings environment for the output. Is this possible?

EDIT:
I currently use the listings package to format the src blocks, so ideally I would like to use the same formatting for both.


texts: How can a use-package stanza be configured a setting depending on another package's existence?

texts:
I have this magit configuration which automatically sets the magit commit message buffer to evil INSERT mode, but it assumes that evil is installed and active which may not be the case. How can I configure it so that it will only apply if evil is installed and active?

(use-package magit
  :ensure t
  :bind (("C-x g" . magit-status))
  :config
  (setq magit-ediff-dwim-show-on-hunks t)
  (add-hook 'git-commit-setup-hook #'evil-insert-state)
  )


texts: Flycheck: How to disable c++11 Warnings?

texts:
I am using flycheck with its defaults to write modern C++ code.  I frequently get warnings such as:

extended initializer lists only available with -std=c++11 or -std=gnu++11

when using modern features.

Can somebody tell me the best way to disable the warnings related to c++11 or c++14?


texts: don't allow modification if there is autosave

texts: is it possible to disallow modification if there is an autosave version? I sometimes save a file only to find out that it has an autosave version but I am unable to recover because I saved.


texts: set org-mode as a source-language in an org-mode document

texts:
I want to export an org-mode document to markdown.  My document contains some content like this:

#+BEGIN_SRC
* User-defined Markers
** MARKER_1
#+END_SRC

I would like to demonstrate how someone could write something in an org-mode document, but when this is exported to markdown, it is interpreted as org-mode text, i.e. instead of seeing a gray code field, the export tries to structure the markdown using 'User-defined Markers' as a headline.  Is there any way of exporting so that what's inside of #BEGIN_SRC is not evaluated?


texts: How to make the natural language for Emacs be English?

texts:
My computer's default language is Portuguese, and I don't want to change that. But, for some usages (especially programming) it's better to have English output, for example to copy/paste an error message on a search engine.

I would like to have emacs in English only, to have for example eshell or built-in gdb output in English.

It sounds easy but I didn't find out how to do. Is there a simple way to do that?


texts: Can Ibuffer show buffers last viewing time?

texts:
I was wondering if it is possible to have a column in Ibuffer that shows the last viewing time.

In the default view I can see these columns:

MR Name                    Size Mode             Filename/Process
-- ----                    ---- ----             ----------------

And with s v the buffers are sorted by last viewing time.
I would be interested in having a column with the value of last viewing/editing time, for example: 20secs, 14min, 1h 23min, 1day 2h 34min, etc...