texts: org-mode: Remove loading message when exporting HTML and then converting to PDF

texts:
My goal is to export an HTML document and convert it to a PDF so I can have some of the advanced syntax highlighting and source code background coloring options in a PDF file.

It seems to be working well except for I get the following message at the bottom of the converted PDF document:

Loading [Contrib]/a11y/accessibility-menu.js

Is there a way I can remove this from the PDF document?  I have tried setting html-postamble to nil but that did not help. Also, I am using wkhtmltopdf to convert the HTML to PDF. However, I have also tried several online converters and they all turn out the same. Here is what the message looks like on the PDF

Here are the contents of the org file when the loading message appears:

#+TITLE: Questions
#+AUTHOR: author
#+OPTIONS: \n:t toc:nil html-postamble:nil
#+LATEX_HEADER: \usepackage[margin=1in]{geometry}
#+LATEX_HEADER: \setlength\parindent{0pt}

+ *Question 1*

stuff

*Reference:* Chapters 4 and 8 from /An Introduction to Statistical Learning with Applications in R/ which can be found at [[http://faculty.marshall.usc.edu/gareth-james/ISL/ISLR%2520Seventh%2520Printing.pdf]]

\pagebreak

+ *Q 2*
#+begin_src R :results output :exports both
x <- 1
x
#+end_src

#+RESULTS:
: [1] 1

+ *Q3*

answer

*References:* I used the following databases to think of the most important input features
<https://stats.nba.com/players/shooting/?Season=2018-19&SeasonType=Regular%20Season&sort=Corner%203%20FGM&dir=1&DistanceRange=By%20Zone&PerMode=Totals>

<http://www.pbpstats.com/totals/nba/player?Season=2018-19&SeasonType=Regular%2BSeason>

And here is the output(outputed as HTML then converted to PDF)

Here are the contents of the org file when the loading message does not appear:

#+TITLE: Questions
#+AUTHOR: author
#+OPTIONS: \n:t toc:nil html-postamble:nil
#+LATEX_HEADER: \usepackage[margin=1in]{geometry}
#+LATEX_HEADER: \setlength\parindent{0pt}

+ *Question 1*

stuff

*Reference:* Chapters 4 and 8 from /An Introduction to Statistical Learning with Applications in R/ which can be found at [[http://faculty.marshall.usc.edu/gareth-james/ISL/ISLR%2520Seventh%2520Printing.pdf]]

#+BEGIN_SRC latex
\pagebreak
#+END_SRC

+ *Q 2*
#+begin_src R :results output :exports both
x <- 1
x
#+end_src

#+RESULTS:
: [1] 1

+ *Q3*

answer

*References:* I used the following databases to think of the most important input features
<https://stats.nba.com/players/shooting/?Season=2018-19&SeasonType=Regular%20Season&sort=Corner%203%20FGM&dir=1&DistanceRange=By%20Zone&PerMode=Totals>

<http://www.pbpstats.com/totals/nba/player?Season=2018-19&SeasonType=Regular%2BSeason>

And here is the output it produces:


texts: org-mode has the variable org-pretty-entities that allows for the display of LaTeX math as unicode characters. How could one get the same result in markdown-mode? It seems like this should be a default option, and yet I can't find anything in the documentation for markdown-mode or from googling around.


texts: emacs-25: mailcap settings for dired-view-file

texts:
I like to view pdf file in a dired buffer using xpdf. The following code in my ~/.emacs works fine for emacs-24. Just hitting "v" launches the xpdf with file (I stipulated xpdf in my ~/.mailcap file).

(autoload 'mailcap-parse-mailcaps "mailcap" nil t)
(autoload 'mm-mailcap-command "mm-decode")
(defadvice dired-view-file (around use-mailcap-mime-data activate)
"Use an external viewer to view a file according to `mailcap-mime-data'."
(unless (let ((file (dired-get-file-for-visit))
extension type command)
(and (not (file-directory-p file))
(progn
(mailcap-parse-mailcaps)
(setq extension (file-name-extension file)))
(setq type (mailcap-extension-to-mime extension))
(setq command (mailcap-mime-info type))
(setq command (mm-mailcap-command command file nil))
(prog1
t
(shell-command command))))
ad-do-it))

However it stopped working with emacs-25 (emacs-25.0.5.11) with the error

mm-mailcap-command: Wrong type argument: stringp, doc-view-mode

Of course I can run xpdf via a shell command, but I am curious why emacs-25 does not seem to parse mailcaps. I haven't found any answers on the emacs-devel forums.


texts: lsp mode does not recognize standard library

texts:
Today I did two things:

I upgraded some emacs packages (don't know which ones)
I installed in addition to emacs 27.1, emacs 28 with native compilation

I built the "gccemacs" in a separate folder but started with the same config I use for emacs 27.
But then I realized, lsp-mode (I am using it with ccls) does not recognize libraries like iostream or cstdint. So I wanted to use emacs 27.1 again but emacs 27.1 shows now the same behavior.
Things like lsp-diagnose look fine. When I switch to a new project the echo area shows LSP :: CCLS:XXXX initialized successfully
Now when installing gccmacs I also installed gcc-9 and g++-9 and used the following commands:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 90 --slave /usr/bin/g++ g++ /usr/bin/g++-9 --slave /usr/bin/gcov gcov /usr/bin/gcov-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7 --slave /usr/bin/gcov gcov /usr/bin/gcov-7

What weird is, is that I can use lsp-find-definition for libraries that get included via the compiler flags like e.g. armadillo library. If I use the command, I jump to /usr/include/armadillo but iostream or cmath can not be found. So this shows at least some minimal amount of functionality is there. Everything else looks fine, I don't get errors only a couple of warnings from other packages after the first byte compilations but that was the case before and it did work this morning. For some reason lsp-mode is not recognizing the standard library. Maybe I setup the new compiler version wrong? I switched back to gcc-7 anyways and gcc --version also tells that this is the case (same with g++). And yes, I can compile my programs and I use bear to execute a make file and generate the necessary .json file.
Any ideas of what could be the cause of this issue?
EDIT1: Ok, some times when moving around in the buffer I get the echo message LSP :: Error from Language Server: not indexed (Invalid Request) I think this error also showed when it was working, but just in case.
EDIT2:  I commented everything ccls related and used clangd instead but the issue persists. I then delete my .emacs.d folder and installed all packages from scratch with lsp-mode using only melpa-stable but the issue persists.
EDIT 3: I think I have come closer to a solution. It seems like lsp-mode or ccls/clangd does not recognize that I want to code c++ but c. I can include math.h but not cmath (without an error). Same behavior with iostream and stdio.h can I somehow tell lsp-mode to recognize c++?
EDIT 4: In the ccls faq is written, that the header file issue might occur if you e.g. have installed gcc-9 but not g++-9. But for me this is not the case. I have installed gcc-9, g++-9 and libstdc++-9 is installed as well. What I also realized is, that I can do: include <c++/7/iostream> without error because g++-7 is installed. Unfortunately, the ccls or lsp-mode does still complain about std:: (undeclared identifiert).


texts: How to throttle or debounce an elisp method?

texts:
I have a very file system intensive function that's being called many times a second. Wish to slow things down a little, anyone knows a way to throttle that function call in elisp?

[EDIT - 04/12/20]:

More info:

My Refreshing function calls projectile-project-p and it's half of my CPU use. As of profiler-report:

- tabbar-buffer-update-groups             156923  55%
 - let                                    156923  55%
  - sort                                  156923  55%
   - mapcar                               156922  55%
    - #<lambda 0xcae81b99>                156894  55%
     - save-current-buffer                156893  55%
      - list                              156756  55%
       - if                               156600  55%
        - funcall                         156600  55%
         - tabbar-buffer-groups           156599  55%
          - list                          156592  55%
           - if                           156592  55%
            - cond                        155466  54%
             - projectile-project-p       138487  48%
              - projectile-project-root   138481  48%
               - cl-some                  138347  48%

While Idle my implementation of the function tabbar-buffer-update-group is called multiple times a second (like using (message 'here'):

> here [210 times]
... 1s
> here [247 times]
... 2s
> here [293 times]
... 3s

It gets higher when interacting with the interface (cursor moving, tab change, etc).

If i turn off my modifications in Tabbar everything gets so fast...

So: no bug in tabbar or emacs, I did it by myself.

Conslusions:

projectile-project-p is too slow for a UI element to call this often.
     Or is it a bug in projectile?
I totally should tinker with tabbar hooks and make it refresh only when
     file is saved of buffer changes. But  code isn't that straightforward.
I totataly should try to customize a more modern implementation, like
     Centaur Tabs, or I could stop being silly and just stop trying to
     reimplement perspectives into a tab bar implementation, dunno,
Now thinking on throttling, it may not work as it does in javascript
  and I can have a flicker or lock in my UI, will I?
The best aproach could be a cached return with a time to expire as now
     it looks a stalled version won't happen.


texts:
today, using magit, I've started getting the following error message when I hit c to commit :

  Terminal is dumb, but EDITOR unset

In the *Messages* buffer, I also get:

  magit-run-git-with-editor: Invalid function: with-editor*

Of course, I have the with-editor package installed and up-to-date...
Any idea ?
Thanks !


texts: How to force a package to upgrade, even if it's not needed?

texts:
I'm trying to debug a failure when a package is upgraded.
The error only happens on update, not on re-installation.
How could I upgrade a single package (e.g. package-utils-upgrade-by-name) and force it to behave as if the current version is outdated?


texts:
The default of key binding C-a/C-e is only for one thing, move to the beginning/end of the line, is there any package that can make Emacs act like this:

If I'm not at the end of a line, C-e will go to the end of the line, otherwise, go the end of next line
If I'm not at the beginning of a line, C-a will go to beginning of the line, otherwise go to the beginning of the next line.

The point is you can just keep hitting C-a/e to go to beginning/end of every line without moving your finger to reach C-n/p.

And with a prefix(C-u) they will go to the beginning/end of line in the opposite direction.


texts: how to display target of an org-mode link in the echo area or as tooltip?

texts:
In org mode when I hover over a link, I get a tooltip that shows the target of the link. But I'd like to see the target when I just move point onto a link, either as a tooltip or in the echo area. For example, with:

* a headline
and a [[https://orgmode.org/][link to orgmode.org]]. And an internal link
[[id:20191211T100231.972516][to a headline in this file]].

* another headline with an ID property
  :PROPERTIES:
  :ID:       20191211T100231.972516
  :END:
content

If point is somewhere in the "link to orgmode.org" text, I'd like to see  something like LINK: https://orgmode.org displayed in the echo area, or as a tooltip. Similarly for the internal link: it would be cool if the displayed text actually went and looked up the headline title and displayed LINK: "another headline with an ID property"

Is there a way to do this?


texts: Org Mode: Using table formula outside of a table?

texts:
I'm wondering whether it's possible to display the result of calculations performed on table data, outside of a table.

For example, suppose I have a table of with a list of names. Is it possible to have plain text that says something like "This below list contains [ ] names." and have [ ] contain the result of counting the table?


texts: Make flycheck's "reference to free variable" work with macros

texts:
The use-package is a useful and popular macro for installing packages, but flycheck always complains about it since it hides variable definitions. For example, if I attempt (use-package org), Flycheck will warn of a reference to free variable 'org.

I also have a defcom macro that simplifies command definitions for me, but which hides variable definitions in the same way. Flycheck chokes on these too.

How can I advise Flycheck that these instances are okay? Alternatively, how can I selectively disable this warning? Getting Flycheck to ignore unknown macros also seems like a safe bet, since macros redefine syntax and will usually require new rules.


texts:
How can I select the last pasted text with regular Emacs?

I would like to do the same thing as this Q&A, but I don't use evil mode.


texts:
* TODO fix this bug asap
:PROPERTIES:
:UPDATE: writing test cases almost there!
:LASTUPDATED: 2019-11-25
:DEADLINE: 2019-11-30
:END:

* TODO update that documentation
:PROPERTIES:
:UPDATE: updating my awesome documentation!
:LASTUPDATED: 2019-11-20
:DEADLINE: 2019-11-30
:END:

Assuming today is 2019-11-27, when I press C-c C-x C-c i.e invoke org column view, I would like to see:

| Item                      | TODO | Days since lastupdate | Days to deadline |
|---------------------------+------+-----------------------+------------------|
| fix this bug asap         | TODO |                     2 |                3 |
| update that documentation | TODO |                     7 |                3 |

It's easy to get the first two columns, I need help to get the next two columns that involve date calculations.
It will be nice to auto-update the LASTUPDATED property every time I change the UPDATE.

So far did some googling and arrived at date subtraction snippet

(-
 (org-time-string-to-absolute (format-time-string "%Y-%m-%d"))
 (org-time-string-to-absolute "2019-11-01")
 )

but need help to put together these things!

Essentially I am trying to track my tasks based on dates, I  want to know how long a task has been left unattended and how far I am from deadlines, please let me know if there are other workflows/solutions to achieve this.


texts: elpy flymake does not recognize local .pylintrc

texts:
I have the following in the project root for my .pylintrc:
[FORMAT]

# Maximum number of characters on a single line.
max-line-length=1000

# String used as indentation unit. This is usually "    " (4 spaces) or "\t" (1
# tab).
# Use 2 spaces consistent with TensorFlow style.
indent-string='  '

I am using elpy and while I see my syntax checker is correctly recognized as my project's flake8 binary within its environment, the .pylintrc is not being picked up, with the result that long lines and indents are still being highlighted.
How can I tell elpy/flymake/flake8/flycheck to recognize my directory local .pylintrc in my project?


texts:
I tried to compile, this error message appears.

ERROR: AUCTeX cannot find a working TeX distribution.
Make sure you have one and that TeX binaries are in PATH environment variable

I have installed texlive 2016 manually and installed emacs by package.
and added texlive to .bashrc. so directory of texlive shown in emacs shell by typing echo $PATH.
My OS is ubuntu 16.04


texts:
I have this org-mode table, which apparently is a table.el table:
+-----+------+
| Test|Foobar|
+-----+------+
|     |      |
+-----+------+

When I hit Tab in any cell, emacs tells me: Use ‘C-c '’ to edit table.el tables . Hitting C-c ' opens a buffer in Table-mode, in which I can edit that table. However, calling org-move-table-row-down in that buffer, with the cursor on the cell containing 'Test', only results in the message user-error: Cannot move row further. C-h b does not list any key binding to any function that sounds like it moves a row down.
When I leave Table-mode (by hitting C-c ' again) and then in plain org-mode call org-move-table-row-down again, I get the same error.
Is there a way of moving rows of table.el tables? Alternatively: Can I somehow convert that table to a plain org-mode table, on which I can use the usual org-mode table editing functions?


texts: Poor's man way to debug font-lock matcher functions?

texts:
I was told on Reddit that font-lock-studio will help me debug a matcher I was working on, however, I find myself with one more problem than before as I need to learn edebug and also grasp how to debug my font-lock keywords with font-lock-studio.

Thus, I thought maybe setting up something like behavioral tests on the matcher function to help me with the debugging and testing of the matcher itself as I don't exactly know what am I doing (doing right or wrong, to be honest).

At some point, the matcher use set-match-data for the resulting matches, I was wondering if there was a way to get that data in order to compare it with the results I'm looking (match-data is the way to go? Because I eval it after executing manually the matcher function and the values I see makes no sense to me), and also a way to setup a test for the matcher function that can be run at a command.


texts: org-mode/babel and zsh: Getting shell sessions to work

texts:
I've been trying to get shell code blocks with sessions to work, but not entirely succeeding.

My setup:
emacs 26.1 (spacemacs)
org-mode 9.2.2
default shell: zsh 5.7.1

Everything seems to work fine with sh but it fails with shell.

Ordinary, non-session execution works:

#+begin_src shell
  echo ${TERM}
  echo ${0}
#+end_src

#+RESULTS:
| dumb         |
| /usr/bin/zsh |

However, when I try to add a session I don't get the result I expect

#+begin_src shell :session s1
  FOO=bar
  echo ${TERM}
  echo ${0}
#+end_src

#+RESULTS:
|                                                       |
| magthecomp%

[?2004hmagthecomp% FOO=bar[?2004l |

and on further use of that session emacs freezes up and I have to interrupt it (<Ctrl-g>), for instance if I try to execute

#+begin_src shell :session s1
  echo ${FOO}
#+end_src

When I take a look at the session buffer I see the following after running those blocks

FOO=bar
magthecomp% echo ${TERM}
magthecomp% FOO=bar
echo ${0}
echo ${0}
echo 'org_babel_sh_eoe'
echo 'org_babel_sh_eoe'
magthecomp% echo ${TERM}echo ${0}
dumbecho /usr/bin/zsh
            echo 'org_babel_sh_eoe'
org_babel_sh_eoe
magthecomp% echo ${FOO}
echo ${FOO}echo 'org_babel_sh_eoe'
            echo ${FOO}echo 'org_babel_sh_eoe'

(some colour is lost when copying it)

I already toned down the theme for my shell prompt when ${TERM} == "dumb", but apparently that isn't enough. Any pointers on how to adjust my zsh config to make it work would be much appreciated.


texts: Does orgmode have the option to restrict the task states or categories in the editing page?

texts:
Is there a way to restrict the TODO types or categories in the editing page?

I know about filtering the agenda view, but I need the option to see only some tasks states in the editing page, such as PENDING, CANCELLED etc, or categories such as :computing:emacs:vim:node: etc


texts: How to open a folder as project in emacs?

texts:
VSCode (and other graphical editors) allow you to open any folder, and all source files in that folder are already tagged such that you can jump to definitions of functions/objects as long as the definitions exist in that same folder (as well as other features like finding all references in the entire project folder)

I'm trying to explore emacs for my day-to-day tasks and would like to understand the best way to achieve the above. The official GNU Emacs documentation talks about EDE mode, but that required each subfolder to be manually assigned as a project (i.e. the .ede files will exist in all folders in the directory). Is there a better way to do this?

The reason I need this is that all of our official code is maintained as Visual Studio solutions and if I'm using any other editor/IDE, then I can open the project folder as a project and still be able to read/understand the code outside of Visual Studio.

Thanks!


texts: Delete all spaces+newlines but the first

texts:
Given the following buffer:

foo bar

    nee nope

If I place point on the 2nd line and execute

(just-one-space -1)

the result will be:

foo bar nee nope

Is there a way to modify the behavior such that the newline after 'bar' will be kept, e.g. with this result:

foo bar
neee nope

?

Or do I have to write my own function for this?

Thanks in advance,
Tom


texts: how to advance one whole virtual window in follow-mode?

texts:
Is there a command for Emacs's follow-mode that will advance the text by a whole 'virtual window' rather than just the height of a column?
Desired effect:
Upon reaching the end of column 4, press PgDn (aka next), continue reading the next lines at the start of column one.
Compare with and without follow-mode:
When not in follow-mode I would use PgDn, but in follow-mode this only advances the text by the height of one column rather than the full height of the  'virtual window'
Is there a command other than PgDn that will manage this in follow-mode?

Follow mode is a minor mode that makes two windows, both showing the same buffer, scroll as a single tall virtual window.

update
individually pressing PgDn four times
OR
individually pressing C-v four times
does scroll the column of text 4 times and so the whole virtual window (assuming there are 4 columns in follow-mode).
manually counting the lines tells me that
the text has been scrolled forward by 57 lines.
C-u 57 C-v
scrolls the same number of lines
still seeking
a single command that will, regardless of column height or number of columns, scroll a full 'virtual window'.


texts: Sort ripgrep results based on proximity to current buffer

texts:
I use counsel-projectile-rg to search within the project I work on. But there is my sub-project inside this big repo that most of my development is in.

Is there a way to sort ripgrep results based on the proximity to the current buffer that is open? Since I usually work in my sub-project directory I like to see matches in it's files first before the rest of the project.


texts: How can I recreate this keybinding in Spacemacs?

texts:
My .vimrc contains this snippet:

nnoremap S :%s//g<LEFT><LEFT>

It creates a key binding which means that when I'm in normal mode, I can:

type the character S
type the string find/replace
hit Enter, which replaces all occurrences of find in the current buffer with replace
return to normal mode

I'd like similar functionality in Spacemacs.  Prefixing the command with Space is fine.  How do I do it?


texts: Org-mode ellipsis arrow is not using my defined encoding (utf-8)

texts:
First, some info on my system/version:
Windows 10
Emacs 26.1
(I'm new to Emacs, so let me know if there is more information I should provide)

This is what is happening:

The image above shows that the UTF-8 arrow is being correctly displayed within quotes in the line that sets the variable for the org-ellipsis; however, the actual ellipsis that is being displayed (in cyan) looks to be Latin-1 (I think) instead of UTF-8.

I have explicitly set my coding systems to UTF-8 with the following lines:

(prefer-coding-system 'utf-8)
(set-language-environment 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)

Note: I realize that the functions prefer-coding-system and set-default-coding-systems already include code that sets the terminal and keyboard coding systems; however, I don't know much about coding systems and wanted to see if, for some reason, calling them explicitly would solve my problem.

When I run the command, describe-current-coding-system, this is what I get:

Coding system for saving this buffer:
  U -- utf-8-dos (alias: mule-utf-8-dos)

Default coding system (for new files):
  U -- utf-8 (alias: mule-utf-8)

Coding system for keyboard input:
  U -- utf-8-unix (alias: mule-utf-8-unix)

Coding system for terminal output:
  U -- utf-8 (alias: mule-utf-8)

Coding system for inter-client cut and paste:
  U -- utf-16le-dos

Defaults for subprocess I/O:
  decoding: U -- utf-8-dos (alias: mule-utf-8-dos)

  encoding: U -- utf-8-unix (alias: mule-utf-8-unix)

Priority order for recognizing coding systems when reading files:
  1. utf-8 (alias: mule-utf-8)
  2. iso-2022-7bit
  3. iso-latin-1 (alias: iso-8859-1 latin-1)
  4. iso-2022-7bit-lock (alias: iso-2022-int-1)
  5. iso-2022-8bit-ss2
  6. emacs-mule
  7. raw-text
  8. iso-2022-jp (alias: junet)
  9. in-is13194-devanagari (alias: devanagari)
  10. chinese-iso-8bit (alias: cn-gb-2312 euc-china euc-cn cn-gb gb2312)
  11. utf-8-auto
  12. utf-8-with-signature
  13. utf-16
  14. utf-16be-with-signature (alias: utf-16-be)
  15. utf-16le-with-signature (alias: utf-16-le)
  16. utf-16be
  17. utf-16le
  18. japanese-shift-jis (alias: shift_jis sjis)
  19. chinese-big5 (alias: big5 cn-big5 cp950)
  20. undecided

  Other coding systems cannot be distinguished automatically
  from these, and therefore cannot be recognized automatically
  with the present coding system priorities.

Is there some coding system variable I'm missing?

Is this happening because I'm on Windows?

Can someone please shed some light on why this might be happening and a possible solution?

EDIT (with more information that could indicate what may be happening):

What is particularly frustrating is that when I make an irrelevant change to my config file (like setting an unrelated variable or even simply adding a comment), upon saving and reloading my config file, my UTF-8 arrows appear as they should.

This is frustrating because, if I'm making a change in an attempt to solve the issue, when I save and reload, the problem is gone, which leads me to believe that I've solved the problem with that change. However, when I load my Emacs config on a new machine, the arrows are gone and my org-mode outlines appear as they do in the image near the top of this post.

EDIT 2:

After modifying and reloading my config with an arbitrary change completely unrelated to this issue and the ellipsis loading correctly, sometimes I can restart Emacs and it will still display the arrows as intended, but other times, it will revert back to displaying what is in the screenshot near the top of this post.


texts: Custom function to apply bold face to a region

texts:
I know there is a function called: facemenu-set-bold, which is bound to M-o b, but I'm trying to write my own as an exercise. Here is my code:

(defun my-function()
  "this is my function"
  (interactive)
  (facemenu-set-face 'bold))

When I select a region and call this function using M-x my-function, the region itself is not affected, only the newly inserted text is bold, can someone please, explain to me why.


texts: How to save a desktop with narrowed indirect buffers?

texts:
I am unable to figure out a way to save my narrowed indirect buffer window, and restore it as it was.

Say I have a frame with several windows containing several indirect buffers, each narrowed to a different subtree (org mode) or region. What I want to achieve is to save the layout including the frame, all window, and all narrowed indirect buffers as well as their positions.

I installed desktop+, and used desktop-save-mode. Later I also used bookmark+, which provides commands such as bmkp-set-desktop-bookmark, and bmkp-desktop-jump. Both give unsatisfactory results when it comes to narrowed indirect buffers: The windows with indirect buffers will only show the complete file/buffer, instead of the narrowed one when I reopen and restore after C-x C-c.

I noticed that bookmark+ does provide a way to save regions and late allow you to jump to an clone indirect buffer with that region (along with narrow indirect package installed). However, it does not provide solutions at the desktop or even file level.

It's easy if you want to reproduce the results. Set desktop-save-mode to t in your init.el. Then open a file, split the window and create a narrowed indirect buffer (the easiest way is use an org-file, and narrow to a subtree using C-c C-x b. Exit emacs C-x C-c, then reopen it. You'll see your indirect buffer shows the full copy instead of the narrowed subtree in your previous desktop.

I really appreciate if someone can help me figure it out.


texts: Applying major-mode font locking to exported org-babel snippets

texts:
Currently I have a bunch of code snippets in my Org-based presentation. I'm exporting them with ox-reveal, but the exported code doesn't have any syntax highlighting. Is there any way to:

have syntax highlighting in code blocks in org-mode?
ensure that the syntax highlighting is carried through to the exported HTML?


texts:
What tools are you using for

setting Breakpoints
visualize Variables

within Spacemacs? I had a look at gdb but it felt awkward to set the breakpoints separated from the source files. I would like to set the breakpoints in the source file and then just run the debugger. What options do I have for achieving this?


texts: Org-mode Babel: Evaluating code in header of code block for tangling

texts:
Is there a straightforward way to use a variable for the tangle file? For example, I want to tanlge my file into the directory files. For multiple files I could do

#+begin_src python :tangle files/fileA.py
some code
#+end_src

#+begin_src python :tangle files/fileB.py
some code
#+end_src

But that would mean repeating the file path every time. So ideally I would do something like

#+name: mydir
: files/

#+name: combine
#+begin_src python :var filename=""
return files+filename
#+end_src

#+begin_src python :tangle combine(fileA.py)
some code
#+end_src

#+begin_src python :tangle combine(fileB.py)
some code
#+end_src

But that doesn't work.

I tried using :dir instead but that doesn't work either, as it seems to apply to the execution directory, not the tangle directory.

I have found this post that shows how to use elisp variables but that requires the use of setq and doesn't seem like a good idea.


texts: `rx` form, that is partially compiled, partially variable?

texts:
Is it possible to obtain an (rx ...) form, that is expanded at compile time for performance, but partially variable?

rx-to-string may be slow

For instance I want an expression that behaves equivalent to

(rx-to-string `(: "PREFIX"
                  (or "hello" "world" ,@user-defined-words)
                  "SUFFIX))

Written this way, it works, but does an unnecessary amount of work at runtime (especially in more complex real-world examples). In some places, this can become a potential performance issue.

What I want to produce at compile time is essentially a partial compile-time expansion, such as

(concat "PREFIX\\(?:hello\\|world\\|"
        (mapconcat #'regexp-quote user-defined-words "\\|")
        "\\)SUFFIX")

eval form does not work

I already know that the (rx ... (eval ...) ...) form does not work:

;; INCORRECT RESULT; VARIABLE EXPANDED AT COMPILE TIME:
(rx "PREFIX"
    (eval `(or "hello" "world" ,@user-defined-words)
    "SUFFIX))

;; When loading from source and user-defined-words is initialized to nil:
=> "PREFIX\\(?:hello\\|world\\)SUFFIX"

;; When compiling:
=> Error: Symbol's value as variable is void: user-defined-words


texts: How can I compare two commit diffs in magit?

texts:
I want to directly compare the diffs of two commits in emacs (rather than seeing the diff of two trees at given commit points).

A bonus would be being able to use ediff mode to compare the two buffers.

However there seems to be no way to have two *magit-revision* buffers open at once. Even if I rename the first, (magit-visit-ref) still updates that buffer.

I've looked through the manuals but couldn't find a reference to what controls the new buffer creation. Any ideas?


texts: Spacemacs change line background color when has comment

texts:
I currently have a strange behave when my code has comment on Spacemacs. Making it bad to read a file with a lot of comments

Anyone knows how to change this behave? I tried to search about it and I failed.

Thanks a lot


texts: Set indentation for shell script function

texts:
I am trying to set the number of spaces per indent for starting a new function in sh-mode (bash sub-mode). I have tried setting:

'(sh-basic-offset 2)
'(sh-indentation 2)
'(smie-indent-basic 2)

(as shown in custom-set-variables in .emacs) and some others as well, but none of them have had any effect!


texts: Emacs Popup with text and picture a la wikipedia suggestion

texts:
I'm looking for a way to display both text and a picture in Emacs in a
pop-up, as it is done in Wikipedia. Is there already a solution for
this?


texts:
C-h v
user-init-file

shows

~/.emacs

but I want this user-init-file point to ~/emacs.d/init.el

Requirement is to be able to switch between .emacs and .emacs.d/init.el and .emacs.el anytime, without deleting/replacing these init files

I do not see any options here

Question:

Without deleting .emacs file from its place, What is the procedure for emacs user to pick different init file, for future emacs session?


texts: How can you move a sub menu -- for example: Search Documentation under Help -- to the main menu?


texts: How to extend magit's context-sensitive push menu?

texts:
I'm using git to maintain a web site located on a remote server.  My workflow has been as follows:

Stage and commit changes to the web site (can do with Magit)
ssh to the remote site and pull the changes into the repository that is located there, updating the working tree (cannot do with Magit)
Still in the script at the remote site, run make on the new working tree
Back in emacs, fetch from the remote repository, so that Magit knows things are up to date

Steps 2 and 3 are implemented by a single shell script, but now that I'm addicted to magit, leaving magit to run a shell script seems an enormous imposition.  My question is twofold:

How can I integrate steps 2, 3, and 4 into a single emacs command?  The magit documentation has a section entitled "Plumbing," and there are some hints there, so I might be able to make progress on my own.
How can I add the new command as an option to Magit's context-sensitive push menu, which pops up when I use the capital P?  This one I have no idea how to do.  Can anybody help?


texts: Building a list of strings with a regexp while loop

texts:
I'd like to perform a regexp search, capture part of a matched string, and save
that part to a list. (Eventually the plan is to save this list to a file in a
particular format, but for now a simple list will do.) I've tried the
following, but it doesn't seem to do anything when I M-x eval-region over the
whole document and M-x first-words-in-numbered-list.

(defun first-words-in-numbered-list ()
  "gets the first word in lines that start with numbered list and builds those
   words into a list, e.g. running the function on the following text:

   foo
   bar
   1. alpha zulu
   2. bravo tango
   quux schmucks
   3. charlie foxtrot
   10. kilo romeo

   should produce a list (\"kilo\" \"charlie\" \"bravo\" \"alpha\")"
  (interactive)
  (goto-char 1)
  (setq first-words '())
  (while (re-search-forward
          "^[[:space:]]*[[:digit:]]+[.)]?[[:space:]]+\([[:word:]]\)"
          nil t)
    ;; for debugging
    (message (match-string 1))
    (sleep-for 2)
    ;; for actually storing the list
    (setq first-words (cons (match-string 1) first-words))))

(defun print-list-elements (list)
  "Print each element of LIST on a line of its own."
  (while list
    (print (car list))
    (setq list (cdr list))))
(print-list-elements first-words)

foo
bar
1. alpha
2. bravo
quux
3. charlie
10. kilo

Edit: I've updated the file to look like this:

(defun first-words-in-numbered-list ()
  "gets the first word in lines that start with numbered list and builds those
   words into a list, e.g. running the function on the following text:

   foo
   bar
   1. alpha zulu
   2. bravo tango
   quux schmucks
   3. charlie foxtrot
   10. kilo romeo

   should produce a list (\"kilo\" \"charlie\" \"bravo\" \"alpha\")"
  (interactive)
  (goto-char 1)
  (setq first-words '())
  (while (re-search-forward
          "^[[:digit:]]+[.)]?[[:space:]]+\\([[:word:]]+\\)"
          nil t)
    (setq first-words (cons (match-string 1) first-words))))

foo
bar
1. alpha
2. bravo
quux
3. charlie
10. kilo

which is most of the way there! The problem is that when I C-h v first-words <RET>, I get the following:

first-words's value is (#("kilo" 0 4
   (fontified t))
 #("charlie" 0 7
   (fontified t))
 #("bravo" 0 5
   (fontified t))
 #("alpha" 0 5
   (fontified t)))

Documentation:
Not documented as a variable.

[back]

Why am I not getting plain strings like I wanted?


texts: Exporting JPG image from LaTeX SRC-block with :async header

texts:
I like to generate JPG images from my LaTeX/tikz drawings in my org files. For this, I use constructs like
#+NAME: my image
#+HEADER: :file my-image.jpg
#+BEGIN_SRC latex :results file raw :imagemagick t :iminoptions -trim -density 600
\begin{tikzpicture}
  \draw[] (0,0) {};
\end{tikzpicture}
#+END_SRC

This works fine, but the evaluation takes some time and I like to do it asynchronously. Therefore, I tried adding :async with ob-async to my SRC block header. But then, I get an JPG image of my typed tikz code instead of the drawing. Why is that and how can I export my images asynchronously?


texts: Use org-contacts in mu4e email auto completion

texts:
I have a contacts.org with following structure:
* Family
** Person 1
:PROPERTIES:
:TITLE:
:ALIAS:
:COMPANY:
:ROLE:
:EMAIL:
:MOBILE:
:WORK_PHONE:
:ADDRESS:
:URL:
:BIRTHDAY:
:ITOLD_THEM_EMAIL:
:ITOLD_THEM_PHONE:
:NOTES:
:CREATED:
:END:
** Person 2
* Friends
** Person 1
** Person 2
* Clients
** Person 1
** Person 2
* Acquaintances
** Person 1
** Person 2

I try to use these information to compose email address completion, probably by using mu4e-contact-process-function, mu4e-contacts-func, mu4e-org-contacts-file, but I have no idea how to glue these things together. The documentation
Does anyone know how to do it?


texts: Define and load a local keymap without defining a minor mode

texts:
Can I define and load a local keymap without defining a minor mode?
I need to define some keybinding in latex-mode and access/list them with
(describe-variable 'mycustom-map)

but I don't want to define a minor mode.


texts: Is there a way to view the man pages in color in emacs?

texts:
I am trying to read the man pages in color. So far I have been using eshell and just typing man <program> However this does not use color to highlight the options etc.

I have read that M-x woman mode will render the man pages in color.

However not only does this fail to render the pages in color, usually it does not work at all or it shows the pages not in color (which is what the M-x man command does).

Is there a way to render the man pages in color?


texts: How to use Dired in multiple directories when open a project?

texts:
I'm using spacemacs on macOS.
When I open a project with Dired, the first time it can list a target directory. But if I change the dired directory by using C-x d again, whenever I switch to an another path, it can't show a window as the first dired list, but needs to use a real file under the path as a target dired window. Why?


texts: Dired: only one buffer when input/exit in directory

texts:
Windows 10, Emacs 25.1, Dired, Dired+

When , in dired mode, I enter (by press RET) to directory the dired create many buffers. Something like this:

As you can see was crated 4 buffers: Temp, test, test2, test3

But I need the next:

Input in directory by press key RET
Create always only one buffer when I input in directory and exist/up from directory (by ^)


texts:
After using emacs routinely for a long time, today I suddenly have problems starting emacs:  When I type emacs in a terminal window, nothing at all happens, emacs seems to be running, but does not display anything, does not open a window, and does not react to any input.  This phase takes 30 seconds (nearly exactly!), and then emacs suddenly starts up.  Restarting the machine made emacs work again once, but 2 minutes later the problem was back again.  Details are below.  My questions: How can I make emacs start again without a 30 second delay?  How can I debug such problems?

Operating System: Mac OS X, version 10.11.6 (on a MacBook Air)

Emacs version: The problem occurs both with emacs 22.1.1 (system provided) and emacs 24.5.1 (installed via homebrew).  I can interrupt emacs 24.5.1 (in the non-working, hanging state) using Ctrl-C.  Emacs 22.1.1 seems not to react to Ctrl-C, but if I press Ctrl-G twice it suspends itself.

Illustration of the problem:

>>> time emacs --batch

real    0m30.039s
user    0m0.013s
sys 0m0.010s

Things that still work:

emacs --version and emacs --help work for both versions
The computer seems otherwise happy, for example I still can start vi

Things that don't work ("hangs" below means that the 30 second wait is present):

emacs -Q hangs, as does emacs -q
emacs -nw hangs
emacs --debug-init hangs
Emacs seems to not complain about invalid command line options, for example emacs --tri-tra-tralala just hangs with no message
The problem is not fixed by changing terminal emulators: emacs hangs both using the system-provided Terminal application, and using iTerm2.


texts: How to scroll to the beginning of the line in Emacs

texts:
I have buffer and I end up at 1616 column (I have one very long line, bug string). Is there a way to scroll the beginning of the line with a single commands. Is there a way to reset the buffer without killing it and opening again?
EDIT:
If fixed itself when I opened help screen and then close it. But from time to time I end up with state like this.
To reproduce the state, press CTRL+X < when truncate-lines is set to nil.


texts: Is there a decent log viewing mode for large log files?

texts:
Some of the log files I'm working with are fairly large (>200Mb) but it would be nice to browse them in Emacs. At the moment by default Emacs attempts to enable log4j mode which just slows everything down. What I really need is a lightweight viewer that:

disabled undo mode
can auto-revert when the log file is updated
can follow the tail of the log when it updates

Ideally it would be nice just to map in a small portion of the log file as you browse through. Do any such log modes exist?


texts: have which-function-mode show @media query in css-mode?

texts: I'd like to know which @media query I'm in (those blocks are several pages long, so can't see them in a screenful), without going 2 C-M-u C-u C-SPC  etc. each time I want to check. There is which-function-mode, but it only shows the selector, not the surrounding @media query. Anyone got a trick for this?


texts: Automatic radio targets from org-mode headings

texts:
Is there a way to have headings in org-mode automatically behave as radio targets? Basically, I am looking for each line starting with *  get turned into a radio target.
For example:
* My Heading
And this is some text that auto-links to My Heading.

which behaves the same as if I had written:
* <<<My Heading>>>
And this is some text that auto-links to My Heading.

As suggested in the comments, I tried overriding org-radio-target-regexp as follows:
(defconst org-radio-target-regexp (format "<%s>\\|^\\*\s\\(.+\\)" org-target-regexp)
  "Regular expression matching a radio target.")

but this does not seem to do anything... any ideas?


texts:
How should one indent text in org-mode with org-indent-mode disabled?
I expect something like this:

* A
  Some text.
  - item 1
  - item 2

** B
   More text.

EDIT: This seems to depend on the variable org-adapt-indentation. I have it set to t.

Incorrect indentation of babel output

But then this output of the evaluation below (using org-babel) is incorrectly indented:

* Headline showing result indentation

  Some text aligned with the headline.
  Evaluate lisp expression ~(require 'ob-python)~ and then run the code
  block below.

  #+BEGIN_SRC python :results output
    for i in range(10):
        print(str(i))
  #+END_SRC

  #+RESULTS:
  #+begin_example
  0
  1
  2
  3
  4
  5
  6
  7
  8
  9
#+end_example

  After running the output on the previous line is incorrectly indented.

How do can I use org-mode in such a way that evaluated output (more than 10 lines long) is correctly indented?
I suspect there is an option to fix this or, if not, this may be a bug but my experience with emacs and org-mode is limited.
I used emacs 24.5.1 with the -q option and an empty home directory just to make sure it is not a misconfiguration.


texts: How to turn off mac os specific keyboard shortcuts in emacs?

texts:
I'm trying to quit the habit of using s-v, s-c and similar keyboard shortcuts for copy paste in Emacs on mac os/osx. I'd like to turn them off but can't find any information on how to do this.

There's a chance this was turned on at some point and it does not come as a standard as the .elisp file is unwieldy and old. It doesn't seem like there's something doing this in it though.

Of course manually remapping all the keys would be possible if there's no easy way to do this.


texts: How can I use emacs with git within the terminal?

texts:
I've used git config --global core.editor emacs to set my git editor as emacs but when I do that and commit something the editor opens up a new window instead of opening emacs within the terminal. I want to use emacs as if -nw were given to it but writing this -> git config --global core.editor emacs -nw is not the solution.

I do need to use basic git for now.


texts: How do I check if two regions have identical content?

texts: How do i check if two regions have identical content?  Is it possible to do so while ignoring language-specific whitespace?


texts: How can I get 'face' functions in emacs to show a gradient colour?

texts:
I want to change the emacs fringe to a gradient of two colours.

(set-face-background 'fringe <gradient>)

As set-face-background requires a colour name or hex, I'm unsure of how I can get it to show a gradient colour.

I believe the color.el function color-gradient could help with the interim step of determining the  different shades of colours:

(color-gradient START STOP STEP-NUMBER)

(color-gradient '(255 192 203) '(250 128 114) 3)

But I'm unsure of how to take this list of colours and create the gradient colour along the fringe. I suspect I will need to advise the set-face-background function, or perhaps a function responsible for displaying the fringe itself, but not sure where to start / how best to approach. Could anyone point me in the right direction?


texts: Place images in page center in epresent-mode

texts:
I am using the display inline images code from this org-display-inline-images link.`

But when i run epresent-run to present it, the images are placed in top left corner. How can i place them in the page's center (i mean, centering image both horizontally & vertically)

Css code might be like this,

.centered {
 position: absolute
  top: 50%;
  left: 50%;
}


texts: pdf-tools: View multiple pages in one buffer - like evince's continous mode

texts: pdf-tools shows by default just one page in the buffer at once. How can it be configured, that it displays multiple pages below each other just like evince does in "continuous" mode, if the zoom factor is small enough such that (parts) of multiple pages fit on one page?


texts: haskell-mode emacs not finding modules when using stack

texts:
Haskell mode doesn't seem to be resolving the modules in emacs when I use the stack command to build my project.

Is there a file that I have to edit to tell haskell-mode where to find the packages that stack installs from stackage?


texts: How to avoid double M-y with system clipboard integration in the terminal

texts:
I added Mac clipboard integration to my emacs -nw using the following code, adapted from here:

(defun copy-from-osx ()
  (shell-command-to-string "pbpaste"))

(defun paste-to-osx (text &optional push)
  (let ((process-connection-type nil))
    (let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
      (process-send-string proc text)
      (process-send-eof proc))))

(setq interprogram-cut-function 'paste-to-osx)
(setq interprogram-paste-function 'copy-from-osx)

However, this creates some undesirable behavior in step 4 of the following situation:

I kill the text abc.
I kill the text def.
I press C-y, which brings back def.
I press M-y, which should replace def with abc but instead does nothing.
I press M-y again, which now properly replaces def with abc.
Further invocations of M-y will function as expected, yanking kills from earlier on the kill ring.

(Having just the above code as my init.el reproduces the problem.)

Here is what I think is happening:

When I kill some text, it's saved to the Emacs kill ring but also (via interprogram-cut-function) to the system clipboard. Then, when I yank with C-y, I first get the contents of the system clipboard (via interprogram-paste-function). Pressing M-y after that gets me the first entry in the Emacs kill ring, which is the same thing. Only by pressing M-y a second time can I get to older entries in the kill ring.

I'm not sure what the best resolution to this problem is. Can Emacs be told to skip yanking from the system clipboard if its contents are identical to the first entry in the kill ring? Or is there another way to be able to C-y M-y instead of C-y M-y M-y to get the second-most-recent thing I killed?


texts: How to get babel code blocks to evaluate parameters when called from a noweb ref?

texts:
I have an interesting problem that I am sure there must be a simple answer to if I can find the right syntax.

Essentially, as outlined below, I have a simple sh code block that prints a variable that is declared as part of #+begin_src.

#+name: test-fn
#+begin_src sh :var testvar="This is a test"
echo testvar=$testvar
#+end_src

#+RESULTS: test-fn
: testvar=This is a test

#+begin_src sh :noweb yes
<<test-fn>>
#+end_src

#+RESULTS:
: testvar=

When I execute the code block directly, the parameter is evaluated.  When it is called from a noweb reference in a different code block, the parameter is not evaluated.

How can I get the called code block to evaluate it's parameters?

EDIT1: I am using GNU Emacs 25.0.94.2 (x86_64-w64-mingw32) of 2016-05-26 running on Windows 10

EDIT2: Including the actual problem in detail

#+name: test-harness-running?
#+begin_src ruby :results value
...
#+end_src

#+name: start-fw-test-harness
#+begin_src sh :noweb yes :var running=test-harness-running? :results output
...
#+end_src

#+name: remove-fw-flash
#+begin_src sh :results output
...
#+end_src

#+name: stop-fw-test-harness-if-running
#+begin_src sh :var running=test-harness-running? :noweb yes :results output
...
#+end_src

#+begin_src sh :noweb yes :results output
    <<stop-fw-test-harness-if-running>>
    <<remove-fw-flash>>
    <<start-fw-test-harness>>
#+end_src

The reason I've been doing it like this is I re-use stop-fw-test-harness-if-running, remove-fw-flash and start-fw-test-harness in many different scenarios (I used to use command line for it but I find babel gives me greater flexibility).

The problem is that start-fw-test-harness and stop-fw-test harness should only do their thing if the test harness is already started/stopped. However when called from a noweb reference, "running" never gets set as test-harness-running? is not called and so neither of these ever do anything.  They work just fine when called directly.

EDIT3: Applying mutbuerger's solution to my problem, I get:

#+begin_src sh :noweb yes :results output :var dummy1=stop-fw-test-harness-if-running :var dummy2=remove-fw-flash :var dummy3=start-fw-test-harness
    echo $dummy1
    echo $dummy2
    echo $dummy3
#+end_src

#+RESULTS:
: nil
: 22 Sep 2016 09:50:30 Deleting 351277001993561_STORE.prps 351277001993561_STORE.prps has been deleted
: nil

While this clearly works, I am reluctant to Accept the answer on account of the copious use of dummy variables and that I am not 100% sure the order in which the functions are called is clearly defined.

EDIT4:

Following mutbuerger's revised solution, this fixes my problem perfectly:

#+begin_src sh :results output :noweb yes
    <<stop-fw-test-harness-if-running()>>
    <<remove-fw-flash()>>
    <<start-fw-test-harness()>>
#+end_src


texts: How to remove all text properties in a buffer

texts:
The function remove-text-properties requires a list for the third argument props -- e.g., (remove-text-properties start end '(face nil))

How can I remove all text properties in a buffer in one fell swoop, without necessarily knowing what all of those properties are?


texts: tramp -- open shell prompt for existing connection

texts:
i started using the eldritch and mysterious tramp again because a user on here helped me fix it. (thanks michael: tramp runs on odt export --).

i create org mode links to my commonly-used remote conf files. when i click on them my tramp session starts up successfully.

it's possibly a no-brainer, but my question is how can i drop to a shell after i'm done finishing editing my conf file? to like restart a service or similar.

i know i can run shell or eshell and run ssh, but that starts a new connection which is really no different to reaching for the terminal emulator. surely i can magically just shell within my existing tramp connection?


texts: How to perform query-replace inside mathematical expressions in latex

texts:
Inspired by this answer, I have written the following function to perform a query-replace inside a math environment, but it does not work.

Edit. If you execute the function, the query-search tries to find all occurrences of string1, not necessarily those in math expressions, in other words texmathp is ignored.

Any hint to correct the code is welcomed.

(defun my-query-replace-in-math (string1 string2)
  (interactive "Mfrom-string: \nMto-string: ")
  (while (and (query-replace string1 string2) (texmathp))))


texts: fill-paragraph marks file as changed, even if it didn't do anything

texts: Whenever I call fill-paragraph, the buffer is always marked as modified, even if the command had no effect (i.e. if the paragraph was already filled).  It also creates an empty undoable action (easily detected with undo-tree-mode).  Other commands which have the potential to make changes, such as the indentation commands, don't mark the buffer as modified or create an undoable action if nothing was changed.  Is there any way to make fill-paragraph mark the buffer modified and create an undoable action only if it actually changed something?


texts: Start two separate emacs daemons for console and GUI

texts:
Typically I start emacs with the GUI, and start a server right away with (server-start).  Now I can easily open documents into my existing emacs session from terminal via emacsclient -n <file>, or from the File Browser.

From time to time, however, I want to run emacs inside my terminal using emacsclient -t.  This happens most often when writing git commit logs or performing other very small tasks. In those instances, the fact that my init file was loaded in a GUI instance of emacs means that I don't get any of my customizations that are specific to TTY emacs.

I know that I can run

emacs -nw -q -l "some-custom-init-file.el"

but that will reload all of the packages every time. Can I have the best of both worlds? Is there a way to set up a "TTY daemon" so that I can use separate customizations for running inside the terminal versus visiting the file in an existing emacs window?


texts:
After 5 hours of googling and trying out different configurations i give up.
How do i setup dap-mode for debugging nodejs with nodemon so that the debugger restarts when nodemon restarts?
Non-solution 1:
//  .vscode/launch.json

 {
    "version": "0.2.0",
    "configurations": [{
            "type": "node",
            "request": "attach",
            "name": "Node: Nodemon",
            "processId": "${command:PickProcess}",
            "restart": true,
            "port": 9229,
            "protocol": "inspector",
        },
]}

starting nodemon with npm run nodemon --inspect app.js. Nodemon restarts on code changes, but the debugger does not stop at breakpoints (seems not to run at all, cant find proceses to connect to neither).
Non-solution 2:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch app.js via nodemon",
            "type": "node",
            "request": "launch",
            "runtimeExecutable": "nodemon",
            "program": "${workspaceFolder}/app.js",
            "console": "integratedTerminal",
            "internalConsoleOptions": "neverOpen"
}
    ]
}

Debugger runs, but does not restart on code changes.
Anyone that can confirm that this works for emacs/spacemacs?


texts: Complete path numbering of org-mode headlines and plain lists

texts:
I would like to get the complete hierarchy numbers in the plain lists of org-mode

Instead of this:

1. something
   1. something
   2. something
      1. something
2. something
   1. something
   2. something
   3. something

I'm looking for something like this:

1. something
1.1. something
1.2. something
1.2.1. something
2. something
2.1. something
2.2. something
2.3. something

And the same thing in headlines. Instead of this:

* chapter
** section A
** section B
*** subsection
* chapter
** section A
** section B

this:

* 1. chapter
** 1.1. section A
** 1.2. section B
*** 1.2.1. subsection
* 2. chapter
** 2.1. section A
** 2.2. section B

This helps me to see how many children a headline has and where I am.

EDIT:
Is it at least possible to get the table of contents with the complete numbering of the headlines (for easier navigating in the org document)?

New EDIT:
I mean a new buffer with just these lines (the items are empty):

* 1. chapter
** 1.1. section A
** 1.2. section B
*** 1.2.1. subsection
* 2. chapter
** 2.1. section A
** 2.2. section B

Of course every line of the "new buffer" should be linked with the corresponding headline of the org document: So by clicking or typing "RETURN" I can go to the headline directly.

I know that by exporting to txt I can get the TOC but there aren't the links to the headlines. What I'm looking for (meanwhile) is a function that construct the toc with numbers and with links.


texts: How to recursively search / grep file contents in a directory / subdirectories in Emacs?

texts: I'm using Emacs for quite some time and I still somehow fail to understand what is the best way to (recursively) grep for a string within a (project) directory and get the results presented either as a dired buffer or in some even more useful way. Please enlighten me.


texts: How to add hline and column sum to bottom of table using a src block?

texts:
I want to (non-interactively) add (one hline and) a last line to a table in which the last column is summed.

Like so:

#+name: mytable
| p | q |
|---+---|
| a | 5 |
| b | 2 |

#+begin_src emacs-lisp :var table=mytable
  (append table ?)
#+end_src

#+RESULTS:
| p | q |
|---+---|
| a | 5 |
| b | 2 |
|---+---|
|   | 7 |

I suspect org-table-sum can help, but I am unsure how.


texts: Bash Environmental Variable Not Recognized

texts:
I use Bash for my terminal on Debian. In my .bashrc, I've defined an environmental variable like so:
SSH_VAULT_VM="ssh-vault"

if [ "$SSH_VAULT_VM" != "" ]; then
    export SSH_AUTH_SOCK=~user/.SSH_AGENT_$SSH_VAULT_VM
fi

This is to facilitate separating my SSH private/public keys on my bare metal host OS (Qubes OS) as described in this repo. The way split SSH works in Qubes OS is by hosting the private key in a VM, and the public key in another VM (from which I'm running Emacs). Whenever I use SSH then, a dialog box pop-up appears to confirm accessing the private key.
When I open Emacs from a Bash terminal, the SSH_AUTH_SOCK variable is properly defined (as observed in the initial-environment variable), and attempts to use the SSH key (e.g., in the magit package) succeed with the pop-up confirmation box. However, when I open the Emacs GUI (using X?), the SSH_AUTH_SOCK variable is incorrect (instead set to something like: /tmp/ssh-[some random name]/agent.[3 digit number]) and attempts to use the SSH key fail.
How can I make Emacs use my .bashrc settings such that this split SSH feature will work? I'd be happy to either correct some config to make Emacs load this variable correctly, or overwrite it with the correct value in my .emacs.d file. I've tried including something like: (setenv "SSH_AUTH_SOCK" "/home/user/.SSH_AGENT_ssh-vault") in my Emacs config, but that doesn't seem to work.


texts: Automatically Increase and Decrease Window Size

texts:
How do I automatically increase the size of the window when I switch into it and reduce it back to its normal size when I switch out of it?
I have a small window at the bottom of my screen. While editing a buffer in this window, I want to see it in a larger size and once I switch into a different window I want the bottom buffer return back to its original size.


texts:
I've been reading various tutorials on alist/plist access but can't figure this out. Let's say i have this file, test.txt:

oranges 1
apples 2
grapes 3

I want to iterate this file line by line, and push it's elements as pairs into a plist or alist. So later when requesting "2" from that plist, I get apples etc. I was thinking something in the line of this:

(defun testRead ()
(interactive)
 (setq myList
    (split-string
     (with-temp-buffer
       (insert-file-contents "test.txt")
       (buffer-substring-no-properties
        (point-min)
        (point-max)))
     "\n" t))
(dolist
  (temp myList)
  (split-string temp " ")
  (plist-put testlist temp)))

Of course above does not work because the dolist part is messed up. First i read the file into myList and split the lines based on newline, then the idea is to iterate this myList and split each element with empty space and push it into a plist. I'm pretty new in lisp and functional programming but I suspect there are more elegant and faster ways to do such thing (parse the file directly into plist) but how?


texts: Creating permalinks for sections in HTML exported from org-mode

texts:
By default when org-mode documents are exported to HTML, the section and sub-section links look like

file:///path/to/export/location/doc.html#sec-1-1

The problem is that the above link won't point to the correct section if I rearrange the sections.

How can we have permalinks for each section auto-generated that look like below?

file:///path/to/export/location/doc.html#introduction


texts:
I like electric pairing for things like...

someJavascript(function() {  });

Where it automatically pairs { with {) etc.

However, it infuriates me when I have

someFunction();

and I want to turn that into

wrapped(someFunction());

It comes out as:

wrapped()someFunction();

so I have to break my rhythm and delete the ).


texts:
I almost never manually save files; I rely on auto-save.

In the past few months I have noticed some of my edits mysteriously disappearing.
The disappearances seem to be related to Linux crashes (about 2/month) or Emacs crashes (about 10/month).
Today I found that my Emacs auto-save sometimes fails, but I don't know how to reproduce the auto-save failure.

Here is the time line of the last edit disappearance:

4/29/18  7:20:33  My login screen suddenly appeared.
         When I logged back in, all applications that where open on desktop are now closed.
         Messages say that Xorg and Emacs crashed.
4/29/18  About 20:00, edited tasks.org file: archived tasks and added new tasks.
5/01/18  6:13:14  My login screen suddenly appeared.
         When I logged back in, all applications that where open on desktop are now closed.
         Messages say that Xorg and Emacs crashed.
5/01/18  6:16:47  I rebooted.
         I opened tasks.org and saw edits from 4/29/18 20:00 are missing (tasks.org is old version modified on 29 Apr 2018 09∶33).
         From terminal:
             $ ls -l -A ~/Documents/tasks
             -rw-r--r--. 1 wolfv wolfv 35148 Apr 29 09:33 tasks.org
             -rw-rw-r--. 1 wolfv wolfv 39936 Apr 29 09:40 tasks.org_archive
         In my hourly backup folder, the last backup of tasks.org is tasks.org_2018-04-29_10:00:01.

So apparently the tasks.org buffer was not auto-saved for at least 10 hours.

This time I know the edit disappearance is not my imagination because both tasks.org and tasks.org_archive contain the archived tasks.

All other emacs files during this time span where auto-saved and in my hourly backup folder.
The tasks.org file size is only 35 kB.
The computer is always on.
I am the only one with access to this computer.

System Info:

- OS: gnu/linux
- Emacs: 25.3.1
- Spacemacs: 0.200.10
- Spacemacs branch: master (rev. 4bb4cb46)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: ivy
- Layers:
elisp
(c-c++ emacs-lisp evil-snipe git ivy org shell spell-checking)
- System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS

On my Spacemacs, auto-save saves to 'original, not the default 'cache.
And create-lockfiles is turned off.

From my .spacemacs file:

(defun dotspacemacs/init ()
  "Initialization function.
This function is called at the very startup of Spacemacs initialization
before layers configuration.
You should not put any user code in there besides modifying the variable
values."
  ;; This setq-default sexp is an exhaustive list of all the supported
  ;; spacemacs settings.
  (setq-default
...
   ;; Location where to auto-save files. Possible values are `original' to
   ;; auto-save the file in-place, `cache' to auto-save the file to another
   ;; file stored in the cache directory and `nil' to disable auto-saving.
   ;; (default 'cache)
   dotspacemacs-auto-save-file-location 'original
...
   ))
...
(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  )
...
(setq create-lockfiles nil)
...

There is no #tasks.org# auto-save file as expected.

There is no .#tasks.org lock file as expected.

~/.emacs.d/.cache/auto-save/site/  is empty as expected.

Can disabling lock mess up auto-save after a crash?

Any ideas on how to troubleshoot or reproduce the auto-save failure?


texts: I use the ess, polymode, and poly-R packages together to work with RMarkdown files. I have also installed the R packages rmarkdown and tufte in my R library. While these R packages provide ".Rmd" templates, the RMarkdown menu generated by poly-R in Emacs remains empty; I would expect it to list the templates provided by rmarkdown and tufte. Is there a variable I must customize to fix this?


texts: Gdb: run a hook when the program is being started

texts:
I'm using M-x gdb to debug a program that produces some output. The output appears in the buffer *input/output of a.out*.

I often run the same program multiple times during a session, often after having killed the previous instance prematurely. This often results in a partial output line from the previous instance, immediately followed on the same line by the first line from the next instance. This makes the output hard to read.

I'd like Emacs to figure out when the program is being started and to insert a line break in the output buffer. Sometimes I'd like to clear the output buffer but usually I do want to keep the previous output; in any case, if I know how to run code when the program is being started, I can figure out what to run. I want this to happen automatically. Manually going to the output buffer and inserting a newline before restarting the program is not a solution.

For example, I have the following C program.

#include <stdio.h>
int main(void) {
    printf("Hello ");
    fflush(stdout);
    printf("world\n");
}

In Gdb, I put a breakpoint on the second call to printf, run the program until this breakpoint, then re-run it from the start.

break 5
r
r
c

The output buffer contains this:

Hello Hello world

I want it to contain this instead:

Hello
Hello world

How do I make Emacs do something when the program is being started? Doing something when the program is being killed would also work.


texts:
ibuffer uses / as a prefix key for filter commands, like ibuffer-filter-by-name (/n).

As an evil user, I wanted to use a different prefix, since evil uses / for searching.

I use space as a leader-key, so I decided to put the filter commands behind space/.

The ibuffer / prefix is an anonymous keymap, so I had to bind my new key to the result of a lookup-key call:

(bind-map-for-mode-inherit ivan/ibuffer-leader-map ivan/leader-map
  :major-modes (ibuffer-mode)
  :bindings
  ("/" (lookup-key ibuffer-mode-map "/")))  ; <= here

It works, but is there a cleaner way to do it?

I say it's an anonymous keymap because I wasn't able to find any variable bound to it. Running (lookup-key ibuffer-mode-map "/") just prints out the keymap body:

(keymap
 (92 . ibuffer-clear-filter-groups)
 ...
 (109 . ibuffer-filter-by-used-mode))


texts:
I've noticed an annoying behavior in my installation of emacs on my Mac.  If the emacs window has the focus and I want to select something from the menu bar at the top of the screen (which says 'Emacs', by the way), I actually have to click the menu twice to get it to pull down.  It's as if the first click shifts focus to the menu bar and the second one selects the particular menu item.

I tried updating my emacs version, but that didn't help.  I now have 26.3.

Does anyone have a fix for this behavior?


texts:
Can AUCTeX be configured to fold the entire LaTeX preamble (i.e., hide everything before \begin{document})?

For example, it would be nice if the the following document:

\documentclass[letter,11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage{setspace} \doublespacing
\begin{document}
\section{Introduction}
Test document.
\end{document}

could be folded as:

[preamble]
\begin{document}
Introduction
Test document.
\end{document}

Is there a way to do this?


texts: The property-search in org-mode is too slow - and slower than keyword search

texts:
I've noticed something strange: the keyword-search (C-c a s) is much faster than the search of property-search (C-c a m, with prop="blah").
Example:
A property-search C-c a m: Match: PROP1="value1" takes about 20 seconds.
The keyword-search C-c a s: Phrase or [+-]Word/{Regexp} ...: value1 takes 3 seconds!
And the property "PROP1" occurs only one time in my agenda.
(I have about 30 agenda files.)
And of course the value of the variable org-use-property-inheritance is nil.
I thought the property-search must be much faster, because org must only search the text of the PROPERTIES block of each entry and not the whole body text of each entry. Or am I wrong?
Also strange: I've tested a normal tag-search (C-c a m): Match: value1 (with the tag: value1). It was also very fast (about 3 seconds). I thought this must be slower because the value of the variable org-agenda-use-tag-inheritance isn't nil (it is: (todo search agenda)).
Any ideas to understand the problem, or to solve it?
(I have the latest version of org-mode: 9.4 and of emacs: 27.1)


texts: preventing indenting to open paren when creating a new block in react-mode

texts:
I'm using spacemacs for react development.  i like it mostly but I have one issue that is annoying.  Currently emacs will try to align certain lines with the last opening paren, so something like this:

return React.createElement('div',
                          { class = "className" }

I would rather the second line not be aligned with the opening paren and instead be indented only one extra 'tab' deep.  So something like this:

return React.createElement('div',
    { class = "className" }

I believe my problem is only if I'm stating a new block on the next line, ie I have an opening brace/bracket/paren as the first character on my second line.  For instance I get the indentation I expect if I do this:

return React.createElement('div', {
    class = "className",
    style = "whatever",
    ...

I'm not very experienced with eclipse configuration, I've stolen a mostly configured version for a peer so far.  I have tried following these instructions: https://stackoverflow.com/questions/1475279/how-to-control-indentation-after-an-open-parenthesis-in-emacs but they didn't change anything, presumably because I should be setting a different argument to control indentation for opening brackets, though I'm not sure what argument I need.

React-mode seems to use mostly default settings for indentation, I used standard-indent for instance to control indent size, so presumably it's using whatever the default settings are for controlling indentation as well.


texts:
Ive set up remote lsp-mode with tramp and pylsp server. While the server does start when I open a remote py file, many server features such as auto completions, code format, references dont work.
Here is my setup
(eval-when-compile
  (require 'use-package))

(use-package lsp-mode
    :hook (python-mode . lsp)
    :config
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-tramp-connection "pylsp")
                    :major-modes '(python-mode)
                    :remote? t
                    :server-id 'pyls-remote)))

;; Set tramp remote path
(add-to-list 'load-path "/usrlocal/share/emacs/site-lisp/")
(require 'tramp)
(add-to-list 'Info-directory-list "/usr/local/share/info/")
(add-to-list 'tramp-remote-path "~/envs/general/bin")
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)

(use-package company
  :ensure t
  :diminish company-mode
  :hook (prog-mode . global-company-mode)
  :commands (company-mode company-indent-or-complete-common)
  :init)


texts: How can I replace all instances of a mispelled word during ispell?

texts:
I can be remarkably consistent with my misspellings some times; in these instances while running ispell, I'd like to be able to hit something like C-u <correction number> (for instance) to replace all instances of the mispelling at once.

Is there a way to tell ispell to not only replace the current word with a suggestion, but all future instances of that word with the same correction?

(As if I were to exit, then run query-replace and then hit ! to replace all occurrences.)

Thanks in advance.


texts: Spacemacs - disable last ex command repeat on empty input

texts:
On vim, an empty ex command (:) leads to a noop upon pressing enter.

On Spacemacs (or Evil in general maybe), it re-runs the last command.

Is there a variable I can tweak in my configuration to make Spacemacs behave like Vim in that regard?


texts: Turn on noweb references for all org buffers

texts:
I want to use the noweb style references in Emacs org for literate programming.

Consider the following working code.

#+NAME:Header
#+BEGIN_SRC c++
#include <iostream>
#+END_SRC

Blah blah

#+BEGIN_SRC c++ :tangle test.cpp :noweb yes
<<Header>>
int main (void)
{
   std::cout << "Hello World" << std::endl;
}
#+END_SRC

I don't want to have to specify :noweb yes every time to expand noweb references since I will always be expanding them by default. How do I change my .emacs file to tell org mode this?


texts: Org babel caching for R when using session

texts:
I have an file which is a research paper (here); it contains numerous R blocks which produce tables and figures. Since these share common data and preliminary calculations, they are run as a org-babel session.

However, some of these tables and figures are reasonably time-consuming (a few seconds each), such that export becomes a somewhat lengthy proposition. A lot of the time at the end I am not changing the figures at all, just making minor amendments and corrections to the text, yet each re-render still takes a long time.

Caching is what I would seem to want, but the org mode manual address this specifically:

  Note that the :cache header argument will not attempt to cache results when the :session header argument is used, because the results of the code block execution may be stored in the session outside of the Org mode buffer.

My question is - what does the second half of this sentence mean? Is this "may be stored" as in "might be stored" (so babel shouldn't) or as in "can be stored" (so babel needn't). Does anyone know if there's a technical org-internal reason that caching won't work with session?

And above all - any solutions to caching long-ish R operations when using org-babel? And ideally, without writing a lot of unnatural code in the R blocks. I already do some thigns like if ( ! exists(foo) ) foo <- read.delim(...) to avoid repeating the longest data-loading operations but this can be a bit error prone and muddies the R code.


texts: How to determine if the current character is a letter

texts:
How I can determine if the current character is a letter (an alphabetic character) (i.e., belongs to the syntax class [:alpha:] in regexp notions).
I would like to write a simple function like below:

(defun test-letter () (interactive)
(if char-after-is-a-letter
    (message "This is a letter")
    (message "This is not a letter")
    )
)

Update
Unfortunately my assumption about the equivalence of the class of the letters and the syntax class [:alpha:] seems to be false.


texts:
I have some lines of code in a python script opened under Py Outl mode:

last=-1
for i in range(len(page_nos)-1, -1, -1):
    if page_nos[i] != 'NULL':
        last = i
        break

if last == -1:
    page_nos[0] = 1
    last = 0

I want to put them into a function, so I add a line of function definition in front of them:

def fillnull(page_nos):

last=-1
for i in range(len(page_nos)-1, -1, -1):
    if page_nos[i] != 'NULL':
        last = i
        break

if last == -1:
    page_nos[0] = 1
    last = 0

I then want to indent the original lines so that they can become the body of the function. By selecting the region and M-x indent-region, the region becomes:

def fillnull(page_nos):

    last=-1
    for i in range(len(page_nos)-1, -1, -1):
        if page_nos[i] != 'NULL':
            last = i
            break

        if last == -1:
            page_nos[0] = 1
            last = 0

Why does it put extra indents in front of the second if block?

How can I indent the original lines correctly? Thanks.


texts:
iTerm2 has the ability to use "old-school" (non-Lion) style fullscreen. Emacs can do this too: (setq ns-use-native-fullscreen nil). iTerm2, however, allows you to keep the native OSX menu bar (the one that's glued to the top of the screen) visible while in this fullscreen mode. To be as explicit as possible, this configuration differs from a simply maximized iTerm2 because the title bar of the window (the one with the red, yellow, and green buttons) is not there.

Can this setup be replicated in Emacs? I'm using the homebrew version of Emacs, but open to other solutions.


texts:
I tried to create a new task from the Capture with C-c t,
but it prompt me with

* NEXT
[2019-01-12 Sat 18:17]

I assume it should be

** TODO

How could I change the default behavior?


texts: Need double c-g to quit from a minibuffer

texts:
On one of my devices I need double pressing C-g to quit from a minibuffer, even when no initialization file is loaded.

More specifically, after pressing C-x C-f, if I do not realease the control botton, I only need one C-g to quit the minibuffer. But if I realease, I need two.

If I only press C-g once, the minibuffer shows the text quit, but the cursor is still focused on the minibufer, and I have to press C-g again within 3 seconds, otherwise the Find-File minibuffer reappears after the text quit fades in 3 seconds. And in that case, I will need to double-press again to quit.

GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.6) of 2016-06-04 on juergen

EDIT:

I solved this by switching off the option of Show position of pointer when the Control key is pressed in Linux mouse setting.
I guess there is some conflict between Emacs and this option.


texts: Need all the help i can get to figure out why mu4e isnt updating for me

texts:
in the spirit of Xmas maybe this year ill finally get this working. so ive been trying to get mu4e working for me for a year or so switching between offline imap to mbsybc etc and always it the same old issue. i cant get mu4e to reliably get new messages to show up in my inbox view. this is what i expect to work. i open mu4e, i use j > i and i get my inbox header view. i know mbsync is working (i call it from within mu4e via

(setq mu4e-get-mail-command "/usr/bin/mbsync -a")

and i can see its indexing every X minutes ([mu4e] Found 500 matching messages)

the issue is i never get the inbox view to show (auto refresh) the headers and show me the new mail like in every other email application. i try to use g sometimes to refresh yet this is hit or miss. sometimes it does show the new mails after g and sometimes it dosent.

i can use `C-S-u' to start manually retrieving mail (this opens a buffer that shows the mu4e process working) and that usually fixes the issues and the new mail are presented in the header view.

I would appreciate any help to try and finally debug this. my mu4e config is here if this helps: https://paste.xinu.at/1JZv/


texts: Make emacsclient open multiple files in separate windows

texts: When I open multiple files at once with emacs, like emacs file1 file2, it opens the two files side-by-side (in different windows in the same frame). But when I do the same with emacsclient, it only shows the first one. The others are also opened but not visible. How do I get the emacs behavior with emacsclient?


texts: converting c-mode hooks to use-package fails in non-obvious ways

texts:
Emacs version 26.3 on a mac

I have this (simplified) c(c)-mode config:

(add-hook 'c-mode-common-hook
      '(lambda ()
         (c-set-style "bsd")))

which works when I visit a c file.

When I convert to

(use-package cc-mode
   :config
   (c-set-style "bsd")
  )

and restart emacs, this snippet gets applied to the scratch buffer and I get this odd error:

  Debugger entered--Lisp error: (error "Buffer *scratch* is not a CC Mode buffer (c-set-style)")

The scratch buffer is shown as a Fundamental buffer, not an interactive-lisp buffer.
Strangely, any added config, even a :bind  (("C-c t" . tags-search)) fixes this.

So, with this,

(use-package cc-mode
  :bind  (("C-c t"         . tags-search))
  :config
  (c-set-style "bsd")
)

when I visit a c file, say foo.c, I now get

  Debugger entered--Lisp error: (error "Buffer foo.c is not a CC Mode buffer (c-set-style)")
  The buffer/file is loaded, but the mode is Fundamental.

Is there a good way to use use-package with cc-mode, given that it supports modes for many different types of code and separable hooks for a lot of these?

Thanks,

Kannan


texts:
I think company-mode is a great package.
Though I would like to change some keybinding it has assigned by default.

For example, I would prefer not to use M-n and M-p in order to move in the different complete result list.
How can I change that?


texts: How can I make ANSI color codes inside the prompt show up in shell-mode?

texts:
I have shell-mode set up to work with ANSI colors. In older versions of Emacs, this extended to the prompt but now it doesn't and the prompt remains uncolored.

PS1 is set with ANSI color codes which work when it's printed out but don't work in the actual prompt itself:

I tried following the advice from an old StackOverflow answer and setting the comint-highlight-prompt face to not inherit:

(set-face-attribute 'comint-highlight-prompt nil
                    :inherit nil)

This made the prompt the same color as normal text, still ignoring ANSI codes:

It seems like versions of comint.el had a custom-set variable comint-highlight-prompt which could be set to nil, but the variable doesn't seem to exist on my version of Emacs. (Actually, I'm not sure exactly where that file came from, but I found it on a Google search :).)


texts:
Using kmacro-exec-ring-item, is it possible to wrap this in an elisp macro or function so its much less verbose?

In this example the only unique part is ds( and the function name.

(fset
 'delete-surround-parens
 (lambda (&optional arg) "" (interactive "p")
   (kmacro-exec-ring-item (quote ([?d ?s ?( ] 0 %d)) arg)))

Could this be wrapped so it could be written as something more simple, for eg:

(fset 'delete-surround-parens (my-kmacro-wrapper "ds("))

I'm not sure how to convert the literal string into an array to pass to kmacro-exec-ring-item, but interested to know if its possible.


texts: My left alt key (OS X) does not work as Meta key in Emacs (terminal)

texts:
I have an Italian keyboard layout. My left Alt/Option key does not behave as the Meta key in Emacs terminal (OS X), but it behaves as the Meta key in GNU Emacs (GUI) downloaded from https://emacsformacosx.com

How can I get my left Alt/Option key to act as Meta?  It prints †.


texts: hippie - complete file name with shell environment variables

texts:
I use this code snippet taken from some forum to complete the file path at point on pressing, C-M-/.

(defun my-expand-file-name-at-point ()
  "Use hippie-expand to expand the filename"
  (interactive)
  (let ((hippie-expand-try-functions-list '(try-complete-file-name-partially try-complete-file-name)))
    (call-interactively 'hippie-expand)))

It works good most of the time. On occassions, i use bash environment variables like $WS_HOME, $PROJ inside my shell scripts to keep the path concise.

Is there a way hippie-file-name-complete can understand the environment variables, that contain file paths and list out possible completions from there?


texts:
I'm using the emacs package on debian 10 and the dead keys for typing accents on characters (for instance, á) are no longer working. WHen I type the dead key, some kind of tiny window or artifact gets displayed, and then when I type the character itself the artifact disappears but nothing gets typed.
I think I must have unwittingly toggled some option, because I haven't changed anything in locale,etc and all other applications except emacs work well re typing of accents.
What can I do to get dead keys working again?
Thanks


texts: What are some built-in packages with nice source code?

texts: I'm trying to get familiar with Emacs Lisp, its syntax, data structures etc, so I was wondering what are some built-in packages whose source could help me better understand how to use the language and learn its idioms?


texts: How to make C-c C-e to not add a new line at the end in AUCTeX

texts: I do not like how a newline is added when I add a new environment using C-c C-e in AUCTeX. This is especially annoying when I use C-c C-e to insert an environment within math mode (e.g. cases environment) within an align environment because then I have to delete that newline to avoid getting a compile error. Is there a way I can turn off "add new line after C-c C-e" when in math mode?


texts: How to do backend-dependent actions in org-mode export?

texts:
How do I specify different actions for different export backends in org-mode?

To be more specific, I would like to export an pdf figure in latex export, while using a png in html export (in fact, a png thumbnail linking to the pdf, if that is of relevance):

#+CAPTION: cation of figure
#+NAME:    myfig
# case export to latex: [[file:./figure.pdf]]
# case export to html:  [[file:./figure.pdf][file:./figure.png]]

I tried macros and this answer, which did not work. There are also answers on similar cases for tikz pdf/svg/png export like this thread, which do not seem to be transferable to my case.

Note: I initially posted this question on stackoverflow. It occured to me later that emacs stackexchange is a more appropriate site for this question. So I deleted it on stackoverflow (there were no answers) to repost it here.


texts: How can I dynamically filter links from org-export

texts:
I've got a handle on how to use :filter functions but this doesn't work:

(defun my-filter-links (s backend info)
  "Filter out links from lines ending in :ignore"
  (let*
    ((props (nth 1 (get-text-property 1 :parent s)))
     (begin (plist-get props :begin)))
     (save-excursion
       (goto-char begin)
       (if (re-search-forward (rx ":ignore") (line-end-position) t)
           (progn
             (message "hit: %s" (buffer-substring-no-properties begin (point)))
             "flibble")
         s))))

(org-export-define-derived-backend 'my-test-export 'ascii
  :filters-alist
  '((:filter-link . my-filter-links)))

;; Export everyting from * Exporting

(save-excursion
  (goto-char (point-min))
  (when (re-search-forward "* Exporting")
    (goto-char (match-beginning 0))
    (org-export-as 'my-test-export t nil t '(:num nil :p nil))))

I can see the message when I hit a link but the link still appears in the export.


texts: How can I format the results of a code block in Org-mode?

texts:
Consider for the sake of an example the following code block:

#+BEGIN_SRC scheme :exports both
  (atan 0.0 -1.0)
#+END_SRC

When I export this file, Org inserts the result (which is the number Pi) into the output.  So far, so good.  I would like to format this result (e.g. typeset it in italics).  How can I achieve this?


texts: Directory Variable: .dirs-local.el with regexp

texts:
We can specify modes :

(c-mode . ((c-file-style . "BSD")
            (subdirs . nil)))

Or directories :

("src/imported"
       . ((nil . ((change-log-default-name . "ChangeLog.local")))))

Is there a way to specify a regexp matching files (or even directories) ? i.e:

(".*_test.go" . . ((nil . ((change-log-default-name . "ChangeLog.local")))))


texts: Use projectile-find-file after switching to a notes file that's not in the project directory

texts:
I have a "home file" with a keyboard shortcut of C-c h
(used for writing quick notes, org style)

How can I still use projectile-find-file, after switching to my notes file?

The issue is the notes reside in a non project git repo at ~/notes/,
and on any given day I might be working on ~/project1/
~/project2 or ~/project3

So when I invoke projectile-find-file, I am shown files in my notes folders,
when what I really want to see is the app/models, app/controllers, Gemfile, etc in the ~/projectN folder of the "project of the day"

The "project of the day" is the "primary project I'm focussing on for that day". It's a constant for any given day.


texts: Disable multi frame images from "playing" by default

texts:
How can one globally disable multi-frame animated graphic files (gif, tiff, etc.) from playing?

Multi-frame images, for example animated GIFs, play by default. I would like to globally disable that function in my config while retaining the ability to use in-line images in ERC, org-mode, etc.

The desired effect of disabling such images' auto-play function is to show the file's first frame only.

I found image-toggle-animation, but it doesn't seem to do what I want.

I use Emacs 24.4.1.


texts: Mouse pointer between characters and the text cursor misplacement

texts:
Mouse cursor position interpretation in emacs drives me nuts.

Why draw the mouse cursor in emacs window with vertical thin bar if you cannot effectively position it between characters?

Selecting text with mouse in emacs is drastically different from all other editors in both X Window and MS Windows.

I mean when the mouse cursor is exactly between two consequent characters, clicking mouse puts the point one character back from the mouse position.

In other words, to put the point somewhere in the text with the mouse you need to click on the character to the right of the place of expected point appearance.

If you, by muscle memory acquired from years of work in other editors, click exactly between two characters (or just a single pixel to the left for that matter) you end up with the point one character back from what was intended for it.

In my opinion the correct behavior would be to position the point to the left of the character only when the mouse cursor is over the left half of the character, and put it to the right otherwise.

An obvious solution to this would be to draw the mouse cursor offset by half a character width to the left from what it is in emacs by default. Or, to shift the mouse cursor hot point to the right for the emacs windows.

Is there an easy way to achieve that?

I suppose I need to clarify that I use a thin cursor of 2-pixel-wide vertical bar (i.e. (setq-default cursor-type '(bar . 2))). With a cursor in a traditional terminal style of a full-character rectangle this issue would not be so evident.


texts: How can I disable "q" in normal state in evil for some modes?

texts:
I'm using Spacemacs. I noticed that in help-mode, q quits, which is exactly what I want. However, in certain other modes, customize-mode, for example, q is bound to evil-record-macro. (I set it to start in normal state rather than in emacs state because I like the vim navigation keybindings.) I tried (evil-define-key 'normal custom-mode-map "q" nil), but it didn't rebind.

How can I modify the keybinding so that q quits as expected?


texts: Magit git diff between two specific SHAs

texts:
Using git cli I would execute

git diff SHA#1 SHA#2

How does one do the equivalent in magit?


texts: Standard Mac/Windows Keybindings for Italics, Bold, and Underline in Org-Mode

texts:
Is there a simple way to get command-i, command-b, and command-u to operate in emacs org-mode on Mac in exactly the way that they operate in a typical word processor on Mac (for example, Microsoft Word for Mac)?

[Edit (Mar 14 '21)]:
To be more precise, I think I want typing 'command-i', for example, to do something like the following:
For every chunk of selected text (counting a cursor with no text selected as a selection with zero length):

Adding emphasis markers:

If no '/' immediately precedes the selection and no '/' begins the selection, then add a '/' immediately before the selection;
If no '/' immediately follows the selection and no '/' ends the selection, then add a '/' immediately after the selection;

Deleting emphasis markers:

Deleting emphasis markers at the start of the selection:

If a '/' immediately precedes the selection if and only if no '/' begins the selection, then delete the '/' that precedes or begins the selection;
If a '/' immediately precedes the selection and a '/' begins the selection, then delete the '/' that begins the selection;

Deleting emphasis markers at the end of the selection:

If a '/' immediately follows the selection if and only if no '/' ends the selection, then delete the '/' that follows or ends the selection;
If a '/' immediately follows the selection and a '/' ends the selection, then delete the '/' that ends the selection.

I’m a writer/academic, and I’ve been looking for a new text editor. It looks like it should be possible to set up emacs org-mode in a way that meets almost all of my requirements, so I'm thinking of making the switch from writing markdown in Visual Studio Code. My main concern regards the keybindings. I would like to be able to keep as many of the standard Mac/Windows keybindings as possible so that I’m not constantly getting tripped up whenever I switch between different applications and computers, which I will need to do regularly. I’m aware that there’s a mode called ‘cua-mode’ which allows the use of C-c, C-x, C-v, and C-z for copy, cut, paste, undo, etc., and I’ve downloaded Aquamacs which appears to use most of the standard Mac keybindings (using the more standard command key rather than the control key).
The main thing I would like to be able to do is to use the standard (on Mac) command-i, command-b, and command-u to toggle italics, bold, and underline, respectively, in org-mode, inserting or removing the relevant emphasis marks around the selected region (or point, if nothing is selected). The closest solution I’ve found so far is a configuration called emacs-org-mode-for-the-laity, but its keybindings for removing italics, bold, or underline from a selection are non-standard, requiring the use of the shift key.
I'm surprised not to have found an existing simple way of implementing this (I'm currently using an extension that does exactly this for markdown syntax in Visual Studio Code). This makes me think that it may be trickier to set this up in org-mode than one might think. Would it be particularly difficult to set this up in org-mode? Is there an existing package that I've overlooked that allows for this functionality?


texts:
In normal mode I can't jump to definition with ternjs or cider modes.  I have to go to insert then hit M-.

Is that the evil way?  Should I have M-. bound to another function that checks what mode you are in and does the proper thing accordingly?


texts:
In Ubuntu, AucTeX has an addon called catdvi. What is its use by AucTeX? Some other questions I have include:

How can I invoke catdvi in my gnome-terminal? C-c C-c will invoke a GUI viewer.
For TeX-PDF-mode, what command to view pdf files in terminal?


texts: How to automatically select *interpretation* buffer window

texts:
When I am writing a shell script in sh-mode and decide to run it, I hit C-cC-x (executable-interpret). An *interpretation* buffer is displayed, showing the script's output.

Is there a robust way to automatically make this *interpretation* buffer current after it pops up, instead of having to type C-xo (other-window)?


texts: Delete multiple branches in using magit from `helm-mode-magit-branch-delete`

texts:
From the magit-status buffer, if I hit b k it will bring up a list of branches with helm-mode-magit-branch-delete. If I select a branch and hit RET, it will delete that branch (sometimes prompting to make sure that is what I want to do if the branch is unmerged).

What I am looking for is a way to delete multiple branches.

The documentation from magit-branch-delete says

  Delete one or multiple branches.
  If the region marks multiple branches, then offer to delete
  those, otherwise prompt for a single branch to be deleted,
  defaulting to the branch at point.

However, from helm-mode-magit-branch-delete, I am not sure how to select multiple branches. I have tried using C-SPC (helm-toggle-visual-mark), which visually marks the branches I wan't, but when I hit RET with multiple branches marked, it only deletes the branch at point. I can't seem to find documentation for helm-mode-magit-branch-delete, and am out of ideas as to how to delete multiple branches. Any suggestions?

Also, as suggested in the comments below, I am not sure thathelm-mode-magit-branch-delete is an actual command since I can't find it documented or referenced anywhere else, but it is the name of the buffer when I try to call magit-delete-branch from the magit-status-buffer, so this was the only way I new to reference it. From my modeline: