texts:
(This follows the answer to the  question: Completion of sentences stored in a file.)

Suppose I have a file, the content of which being organized thanks to org-mode:

* Dreams ≠ reality
Please, don't take your dreams for reality: (a + b)² ≠ a² + b².
Please, don't take your dreams for reality: cos(a + b) ≠ cos a + cos b.
No, √(a²) ≠ a.

* Derivatives
You should revise the derivatives.

* General remarks
This only works for a positive x.

Edit after @NickD comments:

AFAICS, the function used for reading this file, insert-file-contents, filters (I mean ignores) empty lines. Is it possible to ask it to filter lines starting with a * as well?

Is it possible to ask the function used for reading this file, insert-file-contents, or a consequent one, to filter some lines, e.g. those starting with a *


texts: Append to a list inside an alist for custom find-file behaviour

texts:
cc-other-file-alist is part of find-file that looks something like this.

(("\\.cc\\'"
  (".hh" ".h"))
 ("\\.hpp\\'"
  (".cpp"))
 ;; more such entries
)

This is an alist where I'd like to append an additional entry to the cdr of "\\.hpp\\'". I've done it but I feel it's too round about.

(with-eval-after-load 'find-file
  (setq my-cc-other-file-alist (copy-alist cc-other-file-alist))
  ;; create a new cons (key-value) pair in the alist
  (add-to-list 'my-cc-other-file-alist '("\\.mm\\'" (".h")))
  ;; Add: .h -> .mm, .hpp -> .inl
  ;; append to existing value (list) for a given key
  (setcdr (assoc "\\.h\\'" my-cc-other-file-alist)
          (list (append (car (cdr (assoc "\\.h\\'"
                                         my-cc-other-file-alist)))
                        '(".mm"))))
  (setcdr (assoc "\\.hpp\\'" my-cc-other-file-alist)
          (list (append (car (cdr (assoc "\\.hpp\\'"
                                         my-cc-other-file-alist)))
                        '(".inl"))))
  (setq-default ff-other-file-alist 'my-cc-other-file-alist))

I'm sure there would be an elegant way to reference the inner list (cdr) and simply append to it, instead of making copying and replacing. Please tell me there's a better way and show me how!


texts:
Is it possible to load .dir-locals.el file without prompting me, but also without adding values I am configuring in that file to my init.el in custom-set-variables? The reason I want it is that that file contains some sensitive data and I have a habit to share my init.el, so I want it to just load. I understand that in general .dir-locals.el might contain inappropriate code that I should not evaluate. So I was thinking that probably there is something like whitelist of .dir-locals.el.

Update

In general what I want to achieve is to have 'project'-wide emacs configurations file that is loaded without any additional hassle. So if it's not possible with .dir-locals.el - I am open to other solutions :D


texts: ob-ipython error message while evaluating SRC block

texts:
I am getting this error when executing any source ipython block such as this one:

#+BEGIN_SRC ipython :session :results output drawer

# Compute areas and colors
import numpy as np
import matplotlib.pyplot as plt

N = 150
r = 2 * np.random.rand(N)
theta = 2 * np.pi * np.random.rand(N)
area = 200 * r**2
colors = theta

ax = plt.subplot(111, projection='polar')
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)

#+END_SRC

  There was a fatal error trying to process the request. See ob-ipython-debug

ob-ipython-debug:

 File "/Users/USER/.emacs.d/elpa/ob-ipython-20180113.929/client.py", line 1, in <module>
    import jupyter_client as client
ImportError: No module named jupyter_client

I don't know what can be wrong (I have all the necessary dependencies requires like ipython, jupyter, python, and obviously ob-ipython). Any help appreciated.

Thanks,
EG


texts:
I would like to reference a specific table entry, or have it's value insert inline in an Org document. My motivation is to avoid having to change the text in case I recompute values. Dummy example:

#+name: table
|  Metric          | Value  |
|------------------+--------|
|  current         | 152.2  |
|  avg-to-date     | 130.3  |

As we see in [[table][this table]], the current value of something is link-to-value-within-table.

Is there a way to achieve that?


texts: Integrating jupyter notebook (ipython) into org-mode notebook

texts:
is there a way I can link in jupyter notebooks (ipython) into the org-mode notebook? The same way other files (images) can be brought in? If it is possible will the outputs are also seen in the note (and inputs are runnable?), or only code itself? A dummy's guide would be a lot more appreciated as I'm new to emacs and configuring things are not straightforward.

I spend most of my time in Jupyter notebooks and try to document the various steps as a tutorial for colleagues who may want to reproduce my methods (sometimes code snippets are included) as well as discussing the findings in org-mode notebook. It's purely because org-mode notebook has much nicer interface with automatic sections/subsections and easily accessible for anyone (e.g. HTML). If someone wanted to check sensitivity of some other parameters, it would've been much nicer to have the ability to change the code within org-mode (without the need to switch to Jupyter) and output figures are automatically generated (same as Jupyter) or any other outputs. A lot of the times, I have to export various charts from Jupyter to be able to bring into org-mode. I was hoping whether I can switch to org-mode entirely and do all the coding in there.  So there is an element of collaboration with colleagues who don't code and efficiency for myself so I can focus most of my time on emacs.

An example jupyter notebook with lots of outputs and graphs is given here, you would need to install seaborn as it doesn't come as a standard package if Anaconda is used.


texts: Set default branch (or revision) to diff against, in magit

texts:
I frequently diff against the "master" branch, and would like it to be easier in magit.

Right now, I can do one of these:

y, then scroll to master, then hit d d RET.
l l, then scroll to the commit, then d r RET
d r master RET
maybe other ways

What I'd like is something simpler, where I can hit say d m and it would show the diff against master (or even better, against the result of git merge-base master HEAD). How can I achieve that?


texts: Why doesn't my Norwegian ispell dictionary work on Emacs (Windows)?

texts:
I have installed the English ispell dictionary english.hash for using in Emacs, and placed it at C:\Users\espend\AppData\Roaming. When typing M-x ispell-change-dictionary, in Emacs, this English dictionary become available as an option to chose.

In contrast, I am not able to get the Norwegaian dictionary available within Emacs. This dictionary has another name format than the English one, and come in two files, respectively, nb_NO.dic and nb_NO.aff. When these two files are placed at the same location as the English dictionary, they are not available for Emacs by the M-x ispell-change-dictionary command. Hence, I cannot turn to Norwegian spell checking when I need it.

What have I done wrong?
Thanks in advance to those solving this problem for me :)


texts: What is the file local variable mangle-whitespace?

texts:
I see

;; Local Variables:
;; mangle-whitespace: t
;; End:

in many Elisp source files by various experienced Emacs programmers.

But when I describe-variable, Emacs 24.3 says no variable mangle-whitespace is defined.

Is mangle-whitespace provided by Emacs 24.4? Or by some popular package? (I don't see any on MELPA named "mangle".)

What does mangle-whitespace do?

Note: I searched for this both here and on SO under the emacs tag. I also tried both DuckDuckGo and Google, and the search results are just more examples of .el files using this. Ergo asking here.


texts: company-mode on Windows partially completes

texts:
I installed LLVM on my Windows machine. And now I want Emacs tools to use it. I changed company-clang-executable to "path/to/LLVM/bin/clang.exe". Now I think it finds Clang but somehow completions does not work. It only completes trivial things like main, double etc. I feel like I have to add some directories for company to look but I don't know how. I found ways of adding your own projet's directory but thats all.

EDIT: Here is what I did so far. I have;

(eval-after-load "company"
      (setq company-clang-arguments "-I/c/msys64/include"))

I also ofcourse did standard things from manual beforehand to enable company-clang. I also checked with Emacs M-! that Emacs recognize executable named clang. But still no completion.


texts: How can I debug random Emacs server crashes?

texts:
I generally have a long-running instance of emacs --daemon, which I connect to with various emacsclients. Recently I have started experiencing random crashes. I say "random" because I haven't been able to figure out what causes the crashes. Often it happens e.g. when I leave my work computer over the weekend. However, I also remember at least one time when I started Emacs again after a crash, and it crashed again after a couple hours, during the same session.

I started an instance with emacs -Q (and then did M-x server-start) on my unused laptop, and it has not crashed yet. (Currently it has been: about a week.) One day I had need to use Emacs on that laptop, so I started up a separate session by doing emacs from a terminal window, and did not start the server. I left that session running, and when I came back a day or two later, I found that it had crashed, giving Segmentation fault. Thus, it would seem that this is not related to running Emacs in daemon mode.

I would do a binary search of my init file, but due to the randomness of the crashes, it would be a pain to go without much of the functionality I'm used to for an extended amount of time. Also, I wouldn't have a good way to know when I had fixed it, and the crashes weren't occuring.

I use Emacs 24.4, on Debian GNU/Linux 8, and on Ubuntu. (I have used Emacs on Windows before, but didn't use the --daemon, and didn't experience any crashes.)

How else can I debug these random crashes?

Edit: I get the same result when I launch Emacs and then do M-x server-start, and also when I use the Lucid toolkit.

I ran gdb emacs, and then at the (gdb) prompt did run, and this was the output:

Starting program: /usr/bin/emacs
[Thread debugging using libthread_db_enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Warning: Cannot convert string "-*-courier-medium-r-*-*-*-120-*-*-*-*-io8859-*" to type FontStruct

(Note that the last line also appears as terminal output when I launch Emacs outside of GDB.)

In Emacs, I did M-x server-start, and started work. It didn't crash all day, so I left it running over the weekend. When I got back today, I found Emacs unresponsive, and this additional output in GDB:

Program received signal SIGSEGV, Segmentation fault.
mark_object (arg=42366066) at alloc.c:5601
5601    alloc.c: No such file or directory.

After that line, control returned to the GDB prompt.

Edit 2: After building Emacs from source, I again ran it from GDB and did M-x server-start. Today I again found it unresponsive, and this was the output in GDB:

Starting program: [snip]/emacs-24.5/src/emacs
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffee188700 (LWP 20124)]
[New Thread 0x7fffe7df2700 (LWP 20125)]
[New Thread 0x7fffe75f1700 (LWP 20126)]

Program received signal SIGSEGV, Segmentation fault.
mark_object (arg=47086818) at alloc.c:5973
5973    {


texts: How can I disable the " is undefined" error?

texts:
I use Windows 10's virtual desktop feature. The hotkey for switching between virtual desktops is Ctrl-Win-Left / Ctrl-Win-Right. When Emacs is focused and I want to switch dekstops, I get an error message in Emacs:
"<C-lwindow> is undefined" and an alarm sound is played. I don't mind the error message that much, but the sound is quite irritating. Is there a way to tell Emacs to ignore this key combination?


texts: Org Mode: Org-Meta-Newline removes excess newlines

texts:
When running emacs as emacs -nw -q and opening an org-file, insertion of headings goes as follows (X represents the cursor):
* Heading 1
* Heading 2

X

When running org-meta-return here, the next headline is inserted at line 3:
* Heading 1
* Heading 2
* X

As you can see, the whitespace was removed.
Is there a variable I can customize to make it such that running org-meta-return results in:
* Heading 1
* Heading 2

* X

I looked through customize-group org and was not able to find a variable that would control this.


texts:
I have emacs 25.2.2 on Ubuntu 18.04

I want to install vue-mode package. But I am getting this error message:

vue-mode is an incompatible package.

     Status: Incompatible because it depends on uninstallable packages.
    Archive: melpa

    Version: 20190415.231
    Summary: Major mode for vue component based on mmm-mode
   Requires: mmm-mode-0.5.5 (not available), vue-html-mode-0.2, ssass-mode-0.2, edit-indirect-0.1.4
   Keywords: [languages]

Screenshot:

But when I type M + x + package-refresh-contents, I do not see the packages complained about: vue-html-mode-0.2, ssass-mode-0.2 and edit-indirect-0.1.4.

How to fix this ?


texts: org-mode search in headline gives a three dots line

texts:
certainly something I misunderstand, but I cannot find an answer.

When I search in an org-mode file (with C-s) and find a result in a headline, if I press TAB to expand the headline where I found text,
it expands but I get below a line with just "..." . This line is impossible to expand with TAB, and a part of the file is hidden... Where am I wrong ?

Below is an example file, I do

C-s
found
TAB

And I get this :

*** text 1.2...
**** text to be found

blu blu
...         <---------- impossible to expand with TAB, and rest of the file is hidden

Full example file :

* test

** title 1

*** text 1.1

bla bla

*** text 1.2

**** text to be found

blu blu

*** text 1.3

bli bli

** title 2

*** text 2.1

blo blo

Thanks,

Greg


texts:
I want to clear the ghci screen of the haskell-mode,

I used erase-buffer in emacs shell, and I works, but when I do so with ghci inside emacs, This message appears:

Text is read-only


texts:
Is there a convenient way to restore the previous restriction? So after the following sequence of events:

Mark a region
Call narrow-to-region and do some work.
Call widen to jump around and look for something

I'd like to narrow to the original region again without having to go mark it again.


texts: Centered figures in org-mode LaTeX export

texts:
When org-mode exports figures to LaTeX, the figure shows up left justified.  Is there an easy way to have all the figures centered?

I want to avoid having to type #+ATTR_LATEX: :float t above each figure.

I would simply like each \includegraphics in the exported LaTeX code to be wrapped in a \begin{center} ... \end{center} block.


texts: Can't get grep search in helm-projectile working?

texts:
I got thankfully introduced to use helm and helm-projectile for all the goodies it has and especially the helm-projectile-grep-search. I must say, this supercharged Emacs by a long shot. I learned that from this great tutorial : http://tuhdo.github.io/helm-projectile.html.  Unfortunately, everyhting else was fine except grep search-related commands, they throwed this error by invoking them on my machine:

Error during redisplay: (eval (helm-show-candidate-number (car-safe helm-mode-line-string))) signaled (wrong-type-argument integer-or-marker-p nil) [6 times]
Error running timer helm-projectile-grep-or-ack: (wrong-type-argument stringp nil)

The same error was issued when I used C-s or C-u C-s recursive grep search while in helm-find-files bound to C-x C-f. I run this on marked files with C-SPC.

But rgrep works well which is built in Emacs (see image below). So I don't know what am I missing to get grep search work.

Notes
Machine: Windows 7 32bit.
Emacs 24.4
Helm/Projectile/Helm-projectile all updated from MELPA.

I have installed Cygwin and added to Path:


texts: How to set mouse left click and hold to copy in helm-mode

texts:
I'm using helm-mode in emacs to open files. However, when I try to copy the path of a file (say /home/user1/Documents/file1.txt) to paste it in terminal, I get a message saying

<down-mouse-1> is undefined

How can I defined the left-click and hold of mouse for copy in helm-mode?


texts: How can I highlight cursor or line in unselected frames?

texts:
Prelude

Let me start by mentioning the scenario where the problem arises.

I see that 2-3 variables are always used together in a system. I need to add yet another one that will be used along with them.

I decide it would be wise to refactor, extract them together into a class, before introducing the new variable.

But I need to choose the member functions for that class. I mark the set of files and search for the variable names to identify what operations might be needed.

And so I run recursive directory insert in Dired, call M-x dired-mark-files-regexp (% m) to mark the source files, and then call M-x dired-do-find-regexp (A). I flip through the xref buffer with xref-next-line (n) and look in-context at how the variables are used.

But I can barely see the cursor. The salient lines are not in the selected frame, and so the cursor appears as a hollow rectangle, and setting (global-hl-line-mode 1) does not help.

Question

How can I highlight the cursor or the line in unselected frames?

I'll gladly settle for a solution that makes the cursors in all unselected frames visible, not just those adjacent to *xref* buffers.

I'll even settle for an (eshell-based?) method that will let me see the few lines around each occurence, but in a recursive tree of source files, not just in one directory.

The question continues with a sequel here.


texts: Current week in org agenda (starting today and ending next Sunday)

texts:
I want my agenda to show the current week starting from today until the end of the week, Sunday. How do I go about achieving this?

The code

(setq org-agenda-custom-commands '(("w" "Current week"
                                  (agenda "" ((org-agenda-span 'week)
                                              (org-agenda-start-day "-0d")
                                              (org-agenda-start-on-weekday 1))))))

Shows the current week starting from Monday rather than the current day, if I set
org-agenda-start-on-weekday to nil then the agenda shows until next Tuesday (if today is Tuesday for example).

NOTE: I can compute the number of days from today until next Monday (though I am not 100% sure how to do it in elisp) and set org-agenda-span accordingly, but I don't think I can do it as part of org-agenda-custom-commands.


texts: Emacs freezes when minimizing frame on OSX

texts:
I have had the issue that emacs will lock up (and need to be force quit)
on occasion when I minimize it.  I am almost always in org-mode, but
otherwise I can see any pattern, except that it happens while it is minimized.

I have scoured the world for a fix to this.  Does anyone know how to fix this, or at least how to figure out why it is happening?

I'm on OSX 10.11 with Emacs 24.5


texts:
I'm looking to follow this other answer regarding linting inside org-mode source code block but I'm not able to figure out how to tell flymake to disable certain backends.

I'm using Emacs 27.x


texts: After upgrade: Wrong type argument: treemacs-workspace, nil

texts:
I have just upgraded Treemacs on my GNU Emacs 27.2, from an ELPA version from 2 years ago to 20210516.  But now when I try M-x treemacs, I get the following error:
Wrong type argument: treemacs-workspace, nil

I get the same if I M-x load-library <RET> treemacs <RET>, then M-: (treemacs--init) <RET>.  But if I do the following, then it works:

M-x load-library <RET> treemacs <RET>
M-x find-function <RET> treemacs--init <RET>, go right after it and C-x C-e
M-: (treemacs--init) <RET>

So re-evaluating the treemacs--init function from the source file, before invoking it, seems OK.  Any idea why, and how to solve it?
I upgraded the package by M-x list-packages <RET>, then i on the new version and d on the old, already installed version of Treemacs.
The complete stacktrace I got if I invoke M-x toggle-debug-on-error first:
Debugger entered--Lisp error: (wrong-type-argument treemacs-workspace nil)
  signal(wrong-type-argument (treemacs-workspace nil))
  treemacs--follow()
  (save-current-buffer (set-buffer origin-buffer) (treemacs--follow))
  (progn (save-current-buffer (set-buffer origin-buffer) (treemacs--follow)))
  (if (or treemacs-follow-after-init (with-no-warnings treemacs-follow-mode)) (progn (save-current-buffer (set-buffer origin-buffer) (treemacs--follow))))
  (let ((origin-buffer (current-buffer)) (current-workspace (treemacs-current-workspace)) (run-hook\? nil) (visibility (cond ((treemacs-get-local-window) 'visible) ((treemacs-get-local-buffer) 'exists) (t 'none)))) (cond ((eq visibility 'visible) (treemacs--select-visible-window)) ((eq visibility 'exists) (let ((buffer (current-buffer))) (treemacs--setup-buffer) (if (or treemacs-follow-after-init (with-no-warnings treemacs-follow-mode)) (progn (save-current-buffer (set-buffer buffer) (treemacs--follow)))) (run-hook-with-args 'treemacs-select-functions 'exists))) ((eq visibility 'none) (treemacs--setup-buffer) (treemacs-mode) (treemacs--render-projects (progn (progn (aref current-workspace 2)))) (if (null (let ((cl-x ...)) (progn (progn ...)))) (progn (let* ((path ...) (name ...)) (treemacs-do-add-project-to-workspace path name) (progn (if ... nil ...) (setq treemacs-eldoc-display nil) (if treemacs--no-messages nil ...) (add-hook ... ...))))) (goto-char 2) (setq run-hook\? t)) (t nil)) (if root (progn (treemacs-do-add-project-to-workspace (let (file-name-handler-alist) (let* ((path ...)) (if (and ... ...) (substring path 0 -1) path))) name))) (with-no-warnings (setq treemacs--ready-to-follow t)) (if (or treemacs-follow-after-init (with-no-warnings treemacs-follow-mode)) (progn (save-current-buffer (set-buffer origin-buffer) (treemacs--follow)))) (if run-hook\? (progn (run-hook-with-args 'treemacs-select-functions visibility))))
  treemacs--init()
  eval((treemacs--init) t)
  eval-expression((treemacs--init) nil nil 127)
  funcall-interactively(eval-expression (treemacs--init) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)


texts: Compare if the file content is changed on the buffer

texts:
I want to do something like if the "buffer-changed" but "content-not-changed", reverted the buffer.

When I work on the checking if the content changed, I tested the following code, but it can't work, it always return nil even if I just save the buffer.

(defun file-content-keep-same(BUFFER)
  (interactive)
  (save-restriction
  (widen)
  (let ((original-buffer BUFFER)
    (original-size (buffer-size BUFFER))
    (filename-on-disk (buffer-file-name (current-buffer))))
    (message "buffer size %d" original-size)
    (with-temp-buffer
      (insert-file-contents filename-on-disk)
      (message "%s %d" filename-on-disk (point-max))
      (zerop
       (compare-buffer-substrings original-buffer 1 original-size
                 (current-buffer) 1 (point-max))))
    )
  ))

where is it wrong for above code?


texts: Error when I try to re-install package after deleting it

texts:
I used package-install to install the pamparam package. It worked. But in playing with it, I got it into a weird state and decided to uninstall and re-install. I uninstalled by deleting its dir in .emacs.d/elpa.

Now when I try to re-install, I get the following compile log:

In pamparam-update-card:
pamparam.el:513:51:Warning: attempt to inline `pamparam-spit' before it was defined
pamparam.el:513:51:Warning: attempt to inline `pamparam-spit' before it was defined
pamparam.el:566:1:Error: Symbol's function definition is void: cl--do-arglist

Any idea what might be going on?


texts: Generate .bib local bbliography with all the bibtex entries cited in an org document

texts:
I have a large refs.bib file where I collect all my bibliography.
I'd like to export only the relevant bibtex entries cited in a org document.
So then I can email the document.bib and document.tex files to my collaborators.
I am pretty sure this piece of functionality already exists but I haven't been able to find it.


texts:
I recently installed an Ubuntu VM, and I'm working on getting all set up. I've run into a small issue, in that my configuration now takes nearly 30 seconds to start up, where it used to be nearly instant.

I've narrowed the issue down to the (require 'ess-site) line in my configuration, but I haven't figured out how to speed it up or replace it. I need to load ess there so that I can do my next customization, which is (ess-toggle-underscore nil). Without the require, I get errors on that next line. Do I just have to deal with the slow startup time, or is there something I can do to speed this up?


texts: In Org Mode, how do I link to internal documentation?

texts:
I want to create a clickable-link in my Org file directly to documentation built into Emacs. Is this possible to do? The documentation I want to link to are:

Emacs Lisp Intro
The GNU Emacs Lisp Reference Manual


texts: Show git log for the current file in Magit 2.1

texts: In 1.x Magit used to provide magit-file-log to list the Git log for the current file.  Unfortunately, this command seems to be gone from Magit 2.1?  How do I list the Git log for the current file now in Magit 2.1?


texts: describe-face character not under / unreachable by the cursor

texts:
I like using a combination of describe-face and customize-face to adjust the appearance of my working environment.  Sometime this workflow fails when I want to change the face of a location I can not reach with the cursor; mode-line, header-line, magit-blame headers etc.  Most of the time, I can trail and error my way to a solution but sometimes I get stuck (I didn't know the header-line existed until yesterday for instance).

Is there a convenient way to describe the face of a location in a frame which is not reachable by the cursor?  By means of a mouse for instance.


texts: I have a bash shell script that has a fairly sizable amount of perl code in it. Is there a why to get perl syntax highlighting instead of the normal here doc coloring? Thank you for any help, I'm new to emacs and still getting the hang of elisp and the terminology


texts: Jumping from a source block to the tangled file

texts: Is there an inverse of org-babel-tangle-jump-to-org allowing one to jump from a source block to the corresponding place in the tangled file?


texts:
This naive attempt did not work:

;; function_key = dict()
(setq function-key '())
;; function_key["evil-next-line"] = 108
(add-to-list function-key '(evil-next-line . 108))

It just exploded with a (setting-constant nil)


texts: How to turn off Latex/MathJax buffer symbol conversion in org-mode

texts: Whenever I write, say, \Rightarrow inside of $$, I immediately see the actual right-pointing arrow substituted in. Unfortunately, this does not travel well between GUI-based Emacs and Emacs started -nw in a terminal. Research tells me this is a latex-math-preview-* (or is it something with org-preview-latex-default-process?) feature, and this substitution is happening as Emacs (through imagemagick?) creates actual images to insert in-line when it sees Latex/MathJax blocks. My question is, How do I turn this feature completely off in the buffer? I'm on Emacs 26.3 and (elpa) org-mode latest.


texts:
I want to make a function that loops through the children of a tree breadth first.
So first, it will loop through first level of children, and then second level of children, and so on until it reaches the deepest children.
So if the function is applied to the following Parent tree:

Parent

L1_a
L1_b

L2_a
L2_b

L1_c

L2_c

L3_a

It will loop through (L1_a, L1_b, L1_c), then it will proceed to (L2_a, L2_b, L2_c), then finally to (L3_a)
How can I do this?


texts: How to set PDF export in polymode-mode to use xelatex engine?

texts:
Consider the below MWE of .Rmd file containing Arabic text which needs xelatex engine to be rendered by pandoc. As the documentation of the latter says putting this option would make it: --latex-engine=xelatex.

MWE

---
title: "Minimal Working Example `.Rmd` in Arabic"
author: "Author Name"
date: "Friday, July 08, 2016"
output: pdf_document
latex-engine: xelatex
---

----------

# مقدمة عن التقرير
# نتائج البحث
# الخلاصة

# Introduction of the Report

# Results

# Summary

So this how it appears in Emacs editor:

This is my setup:

Ubuntu 16.04
Emacs GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian
Pandoc 1.16.0.2
polymode-mode and markdown-mode from MELPA latest as of this date
init.el setup in relation to polymode-mode
ESS 16.04

init.el - polymode-mode

(require 'poly-R)
(require 'poly-markdown)
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))
(add-to-list 'auto-mode-alist '("\\.org" . poly-org-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd`enter code here`" . poly-markdown+r-mode))

init.el - customizataions

...
 '(ess-rutils-keys t)
 '(ess-swv-pdflatex-commands (quote ("xelatex" "pdflatex" "texi2pdf" "make")))
 '(ess-swv-processor (quote knitr))
...

Primary Issue
When I export the .Rmd buffer to pdf by M-n-e, I am prompted for 3 options: Rmarkdown-ESS, Rmarkdown, and pandoc. I picked Rmarkdown-ESS this was the error log:

/usr/bin/pandoc +RTS -K512m -RTS 4G_report.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output /home/username/.emacs.d/docs/rstat/4th_examCom_program_2015_2016/4G_report[exported].pdf --template /home/username/R/my_R_library/rmarkdown/rmd/latex/default-1.15.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in'
! Package inputenc Error: Unicode char س (U+633)
(inputenc)                not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.293 \end{verbatim}

Try running pandoc with --latex-engine=xelatex.
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
R>

so as you can see the error suggests using --latex-engine=xelatex in pandoc instead of the default pdflatex. So how to set xelatex engine as default in polymode export? I tried to set the engine to xelatex in the YAML header but it didn't work. Or is there a way to change the value of a variable like pm-exporter/pandoc?

Secondary Issue
When I export to html I want the Arabic text direction to be from right-to-left and the English part of the text to be from left-to-right. Although I enjoy this bidi-direction inside Emacs editor, well this is one of the good reasons to pick this editor, but unfortunately I dont' get the same effect in the html export, and I don't know whether the same issue will arise int the pdf. So what do I need to get that effect in the exported document?


texts: How do I use emacsclient as EDITOR or VISUAL?

texts:
Scenario: I'm in zsh and I want to edit a long shell command in an already open instance of Emacs. I've set $VISUALto emacsclient -n -c. When I run C-x C-e from zsh, a new Emacs frame opens, populated with contents of the zsh line. After editing and saving the buffer, I hit C-x k, and buffer closes. The zsh line remains unchanged. Why isn't zsh recognizing the changes made in Emacs?

Emacs 24.5.1, zsh 5.0.8, Mac OS X 10.10.4


texts: calling search-forward function with ^ and $ in the regexp pattern

texts:
I want to create a table in org-mode and use it in Ditaa
The following function is created to replace “^+-” to “|-”
and similarly, “^-+\s-*” to “-|”.

Surprisingly, this does not work.

(defun ditaa-to-table (begin end)
  "Replace “^\+-” to “|-” in region; Replace “-\+\s-*$” to “-|”"
  "I want to create a table in org-mode and use it in Ditaa"
  "org-mode uses |- and -| for the row/cell delimiter at the extremes of the     line, while Ditaa uses +- and -+"

  (interactive "r")
  (save-restriction
    (narrow-to-region begin end)

    (goto-char (point-min))
    (while (search-forward-regexp "^\s-*\+-" nil t) (replace-match "|-" nil t))

    (goto-char (point-min))
    (while (search-forward-regexp "-\+\s-*$" nil t) (replace-match "-|" nil t))

))

If I use,

(while (search-forward-regexp "\+-" nil t) (replace-match "|-" nil t)) ;; works

works, But once I add the "^\s-*" char to mark the start-of-line, it stops working.

Similarly, basic one works, but once the  "\s-*$" is added, it stops working

(while (search-forward-regexp "-\+" nil t) (replace-match "-|" nil t)) ;; works
(while (search-forward-regexp "-\+\s-*$" nil t) (replace-match "-|" nil t)) ;; does not work

I tried posix-search-forward also, and it does not work.


texts: How do I import __future__ in org-mode babel

texts:
Attempting to eval a babel source block that contains a __future__ import and also uses a :var causes Python to spit out

  File "<stdin>", line 2
SyntaxError: from __future__ imports must occur at the beginning of the file

Presumably babel is sticking the :var definitions before the first line of my code. How can I prevent babel from doing this?

Minimum failing example:

#+NAME: data
| Hi | 2 |

#+BEGIN_SRC python :var data=data
  from __future__ import print_function
  print(*data)
#+END_SRC


texts: Run org-store-link after renaming file with dired?

texts:
When in a dired buffer, I use R or dired-do-rename to move files from one directory to another (typically my "refile" directory to where the file(s) actually belong(s)).

When I do this I'd like to store an org-link using org-store-link to the "refiled" document(s) in it's/their new location preferable using th prefix argument, C-u.

Any idea how to accomplish this? Ideally it would work for a single or multiple files marked with m. If performing this action on multiple files, all links should be stored.

I imagine this is possible with defadvice since I can't find any obvious hooks but don't have the experience to implement it.


texts: Custom Bash prompt doesn't display correctly in shell mode

texts:
In my .bashrc file I've set the PS1 variable to this to customize my prompt:

export PS1='[\D{%Y-%d-%m} \t \u@\h \W]\n$ '

The format strings are explained in the Bash manual.
  This one gives me a prompt that looks like this (in OS X terminal):

[2016-10-06 11:15:16 username@host ~]
$ <command goes here>

But when I fire up M-x shell it doesn't display right:

[\D{-/Users/username/-hostname} \t \u@\h \W]\n$ <command here>

What's going on here?  Searching for similar issues I mostly run into cases where people had problems with colorized shell output, but I'm not using that.  And my prompt doesn't really have anything that Emacs shouldn't be able to display.

Environment info:

GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2015-04-10 on builder10-9.porkrind.org
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin14)
echo $TERM:

In OS X Terminal: xterm-256color
In Emacs shell: dumb

M-x terminal works fine, but I don't like M-x terminal...


texts: Both set mode and insert in auto-insert-alist lambda

texts:
I have the following as a member of auto-insert-alist:

(("/home/robin/.local/bin/.*[^/]\\'" . "Shell-Script mode magic number")
  lambda nil
  (if
      (eq major-mode
          (default-value 'major-mode))
      (progn
        (sh-mode)
        (insert "#! /bin/bash -peux
# "))))

The mode is set correctly, but the text is not inserted. And it doesn't seem to have been inserted into the wrong buffer, either, because C-x s says "(No files need saving)".


texts: flycheck "function is not known to be defined" warning after conditional definition

texts:
I was running into a flycheck warning about a function which may not be defined.

Since the function is a small optional dependency, I am inlining it in case the package that provides cannot be loaded.

I first tried I checking if the package failed to be required before filling in the function:

(unless (require 'selcand nil t)
  (defun selcand-select () ...))

This gave me

the function ‘selcand-select’ is not known to be defined.

Which makes sense since the compiler has no idea whether the selcand package
will define the function selcand-select.

So I added an explicit fboundp check:

(unless (and (require 'selcand nil t) (fboundp 'selcand-select))
  (defun selcand-select (cands &optional prompt stringify) ...))

which still gave me the same error.


texts:
I am new to emacs.
I want to install paredit mode on emacs 24. I am using Melpa.
When i do M-x package-install RET paredit RET or try to install it from package-list-package i see the error in the minibuffer:

Cannot open load file: no such file or directory, paredit

What should i do to get it?


texts: How to add -shell-escape option to latex compile command

texts:
Background story:
I have to compile my LaTeX document with the -shell-escape command line option because the pgfplots library I am using calls gnuplot. This was necessary to get a plot of a recursive function requiring double precision fpu.
Problem:
When I hit C-c C-C or C-c C-f in emacs (GNU Emacs 26.3) the document is compiled using pdflatex \\nonstopmode\\input mydoc.tex but the plot in the PDF output document stays empty, because of some restrictions. When I compile manually using pdflatex -shell-escape \\nonstopmode\\input mydoc.tex everything works just fine.
Failed attempts:
I have set tex-start-options variable in the 'tex run group' to "-shell-escape", but it did not appear in the tex-shell.
Update:
Meanwhile I have installed AUCTeX as suggested.
I am still curious to find out how the issue can be solved without it.


texts: Take path preceding cursor and run a shell command on it

texts:
Consider a buffer holding the following contents:

foo
...
some text /foo/bar/hello.csv
...
bar

where  represents the location of cursor.

I would like to have an interactive function that automatically calls <command> $PATH on the shell, where $PATH is the path immediately preceding  (it can do this by finding the first /).

How could I approach this problem in elisp?

I have seen packages like Helm being able to do something similar (e.g. C-x C-f on cursor above would openhelm-find-files on that location)


texts: How can I show a tabular list of variables and their values?

texts:
Is there a way to see the values of a list of variables? E.g., if I have var1, var2 and var3, is there a standard elisp function that shows me the values of these variables at the same time?
I mean something that returns an output like:
var1   nil
var2   t
var3   nil

I don't need the output to be a string. I just need to read it in a window.
Please note that I asked if is there an emacs standard function that already does it. Otherwise every help is welcome but I can also try to do it by myself.


texts:
By default, the results of running M-x ispell-buffer in org-mode are
very disappointing.

Ispell looks inside :PROPERTY: drawers, which commonly contain things like

:ID:       797495bd-581b-4a42-883b-c2a55a08f08a

It tries to correct org statements! For instance, it complains about the SRC in

#+BEGIN_SRC emacs-lisp

It goes inside org-blocks. I suppose this might be useful for
blocks like #+BEGIN_QUOTE, but in source code blocks that’s just
silly.

Is there a package that fixes all this?

I’d love to spell-check my writing but the amount of false-positives
I’m getting makes it unfeasible.

If it matters, the OS's spell checker is aspell.


texts: Whenever I type a caret in emacs, it waits for me to type another character. Can I disable that behaviour?

texts:
I'm a relatively new user to emacs, having just come over from many years of using vim. I'm mostly thrilled with evil mode and emacs in general, but there are a few annoyances still lingering. One of them has to do with the caret character (i.e. this: ^). In vim and evil mode (and most of unix), the caret means "beginning of line", and typing it gets you to the beginning of the line. However, in Emacs, whenever i type a caret, it waits for me to type another character before deciding what to do, because the caret can be used as a circumflex (i.e. to type a lot of French words like "Hôtel", you would first type the caret, then your letter, and they would be smooshed together to form the right glyph).

That is, when I'm in evil mode (in "normal" state), and type the caret, it actually inserts an underlined caret character in the document temporarily, waiting for me to respond. If i don't type an alphabetic character (but instead press something like space or enter), the caret disappears and I'm taken to the beginning of the line. This might sound like a small thing, but it's supremely annoying, and I wish to be rid of this behaviour.

To be clear, the caret also works exactly like this in every other single program on my mac, except for one, which is MacVim. In MacVim, the caret instantly takes me to the beginning of the line (only in the GUI though, in the terminal it doesn't work).

I know I can rebind the motion to some other key, but I'd really rather not. I'd just like this annoying behaviour to go away.

I'm using Mac OS X, and I have a Swedish keyboard with Swedish keyboard layout.


texts: How to remove second row of menu entries (or is it a toolbar)?

texts:
I have installed OpenSuse Tumbleweed and later Emacs.
If I start Emacs from the shell,
$ emacs -Q

I have a double row of menu entries
File - Edit - Options - ... - Help
New File - Open - Open Directory - ... - Search

In a sense, the buttons in the second row are not menus, because they directly invoke simple commands…
I'd like to get rid of the second menu row, maintaining the first one.
I checked the ~/.emacs that was automatically installed, apparently nothing relevant, and I've also tried emacs -q, to no avail.


texts: Go to specific character sequence if on line programmatically

texts: Is there a function that checks if a specific character sequence - "abc" - is on a line and puts point there if it is? And returning something (presumably nil) if "abc" isn't on the current line?


texts:
I want to bind loading a specific theme to a key-binding.

However, this does not work.

(global-set-key (kbd "C-<f1>") '(load-theme 'zenburn))

I would like Ctrl and the F1 key to apply the zenburn theme. But on executing the form I get

Wrong type argument: commandp, (load-theme (quote zenburn))


texts:
I have seen this thread but my problem is an order of magnitude larger. Also, a newbie, I did not understand much of what was being discussed there. So, this new question.

I am running Emacs 25.2.2 on Kubuntu 17.10 on a low-range laptop computer with 4GB RAM. Consider:

user:~/ $ time nvim +qall
nvim +qall  0.63s user 0.17s system 86% cpu 0.921 total
user:~/ $ time emacs -nw -kill
emacs -nw -kill  81.70s user 9.00s system 93% cpu 1:36.84 total
user:~/ $ time emacs -nw -q -kill
emacs -nw -q -kill  0.32s user 0.07s system 10% cpu 3.636 total

Something seems to be grossly wrong with my setup. But I do not know what is it.

So, what do I need to do to bring the start-up time for emacs down to a more reasonable number?

My ~/.emacs file contains several lines. I do not know which ones will be relevant here. So, please ask me and I will edit my question accordingly.


texts: Idiom to default a setting for most modes, except specific others?

texts:
I generally like show-trailing-whitespace. But it's distracting in shell/REPL modes, where for instance completion may leave a trailing space (e.g. ls foo TAB RET in shell-mode). Plus I'm not git- or diff-ing the contents.

What I came up with for my init.el:

;; Show trailing whitespace in most modes...
(setq-default show-trailing-whitespace t)
;; ...except I don't like that in comint-modes (shells/REPLs), because
;; completion sometimes leaving a trailing space that's distracting to
;; have highlighted, and anyway I'm not git- or diff-ing the contents.
(add-hook 'comint-mode-hook
          (lambda () (setq show-trailing-whitespace nil)))

As far as I can tell this is working fine. But I wonder if someone more-experienced might say, "The problem with doing it that way is X", or, "The idiomatic way to do that instead is Y"?

(I realize this might border on being an opinion or "best way" type of question. So I apologize in advance if it's not appropriate. But knowing the answer would help me, and maybe some other folks.)


texts:
I have used the mark to select regions of a buffer. For example, I know the sequence C-<space> C-s foo can be used to select all text between the current point and the point after a search for foo.

I recently discovered the existence of the mark ring, so I can C-<space> C-<space> to leave a mark, move the point in the buffer, and then C-u C-<space> to jump back.

Are there any suggestions, guides, or tips to effectively navigating using the mark ring?


texts:
I recently switched from Emacs to Spacemacs because of developing RSI, so I'm trying for Spacemacs keybindings for all common actions.
For creating a frame I now use SPC w F.
But the only keybinding I know for closing an Emacs "frame" (that is, a OS X Windows) is Cmd-Shift-w. Is there nothing better?


texts: Show effort and *all* clocked time for completed tasks within the last week

texts:
How can I show all the time spent on org-mode tasks completed within the last
week?

The clocktable doesn't include time logged outside the
block time.  For a task that's spread over many weeks, the total time is
misleadingly low.

If I make the block time larger, e.g. a month, I get too many tasks and I'm
still not guaranteed to show all the time spent on completed tasks.

In the example below, Task with work from more than a week ago doesn't include
the hour logged on December 2nd.

* DONE Task with work from more than a week ago
  CLOSED: [2016-12-12 Mon 22:47]
  :PROPERTIES:
  :Effort:   0:30
  :END:
  :LOGBOOK:
  CLOCK: [2016-12-02 Fri 21:49]--[2016-12-02 Fri 22:49] =>  1:00
  CLOCK: [2016-12-12 Mon 22:14]--[2016-12-12 Mon 22:47] =>  0:33
  :END:
** TODO Subtask 1
  :PROPERTIES:
  :Effort:   0:10
  :END:
  :LOGBOOK:
  CLOCK: [2016-12-12 Mon 21:37]--[2016-12-12 Mon 21:47] =>  0:10
  :END:
* DONE Task with all time within a week
  CLOSED: [2016-12-12 Mon 22:47]
  :PROPERTIES:
  :Effort:   0:05
  :END:
  :LOGBOOK:
  CLOCK: [2016-12-12 Mon 23:38]--[2016-12-12 Mon 23:48] =>  0:10
  :END:

#+BEGIN: clocktable :maxlevel 9 :scope file :block thisweek :fileskip0 t :tcolumns 1 :properties ("effort")
#+CAPTION: Clock summary at [2016-12-12 Mon 22:49], for week 2016-W50.
| effort | Headline           |   Time |
|--------+--------------------+--------|
|        | *Total time*       | *0:53* |
|--------+--------------------+--------|
|   0:30 | DONE Task 1        |   0:43 |
|   0:10 | \_  TODO Subtask 1 |   0:10 |
|   0:05 | DONE Task 2        |   0:10 |
#+END


texts: Calling org-update-statistics-cookies on the whole document

texts:
I have an org file like this

* Fun stuff [0/0]
** TODO Task 1
** TODO Task 2

If I run org-update-statistics-cookies inside [0/0] or press C-c C-# the text get updated to [0/2]. However, I would like to update all statistics in the document. Is there a way to do this? I found that if I call (org-update-checkbox-count t) the whole document gets updated to count checkboxes but not tasks.


texts: show-paren-mode only highlights when cursor is one character after closing parenthesis

texts:
Problem

I have show-paren-mode enabled, but the highlighting behavior unintuitive. In particular, the matching parentheses are only highlighted in two situations as shown below (the second of which is unintuitive):

Cursor on the opening parenthesis (which is expected behavior):

( some characters here ) some more characters here
^
cursor must be at the caret for highlighting to show

Cursor on the character after the closing parenthesis (which is unintuitive):

( some characters here ) some more characters here
                        ^
                        cursor must be at the caret for highlighting to show

Question

Is there a way for the matching parentheses to be highlighted when the cursor is on the closing parenthesis?

Like this:

( some characters here ) some more characters here
                       ^


texts: Is there any way to supress or prevent python-mypy `Suspicious state` message

texts:
When I open an empty Python file I get following warning message in the minibuffer. I added following into my init file: (require 'flycheck-mypy)
 // Flycheck version: 32snapshot (package: 20200610.1809)

Suspicious state from syntax checker python-mypy: Flycheck checker python-mypy returned 2, but its outpu\
t contained no errors: config.py: error: Source file found twice under different module names: 'eBlocBro\
ker.utils' and 'utils'
Found 1 error in 1 file (checked 1 source file)

Try installing a more recent version of python-mypy, and please open a bug report if the issue persists \
in the latest release.  Thanks!

$ flake8 --version
3.8.3 (flake8-mypy: 17.8.0, mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes:
2.2.0) CPython 3.7.5 on Linux

$ pip install -U mypy
$ pip freeze | grep mypy
flake8-mypy==17.8.0
mypy==0.780

[Q] Is there any way to prevent this message?


texts: I am trying to install package auto-complete. But when I typed M-x package-install [ret], then emacs showed "contacting host: elpa.gnu.org:80". After a while, it showed "Install package". Then I typed "auto-complete", it prompted "no match". Do I miss something here? thanks.


texts: How can I jump to a file and line number from a list in a buffer?

texts:
I have a buffer with content like:

src/file4.rs:9
src/file4.rs:33
src/file4.rs:64

I'd like to be able to put my cursor on a line and jump to the appropriate file / line in the other window, just like compilation-mode would. However, this buffer contains files/lines that I've generated via other means, it is not the output of a script.


texts:
If I write a command that calls (interactive "f"), Emacs will prompt the user to select a file when the command is run interactively. With Helm enabled, this selection is done through Helm with no additional effort -- this is great!

However, if I mark multiple files in the Helm selection window, it is not clear to me that this information is passed on to the command. Is there a way to get custom commands to cooperate with Helm and multiple selections?


texts: How to properly align org table with mixed English-Bengali script?

texts:
I am unable to tidy up this table, so that last column is properly aligned, as the other two:
|-----------+----------------+------------|
| English   | Bengali s.     | Bengali w. |
|-----------+----------------+------------|
| Monday    | Shōmbār        | সোমবার     |
| Tuesday   | Monggolbār     | মঙ্গলবার    |
| Wednesday | Budhbār        | বুধবার      |
| Thursday  | Brihoshpotibār | বৃহস্পতিবার  |
| Friday    | Shukrobār      | শুক্রবার     |
| Saturday  | Shonibār       | শনিবার     |
| Sunday    | Robibār        | রবিবার     |
|-----------+----------------+------------|

No matter what I do, I can't have Org-mode make it look proper.
Is there a command that help with mixed English-Bengali scripts?
I am using Emacs 27.1 with standard Org-mode, with fixed-width Hack font. Other fixed-width fonts also do not seem to help.
Is this possible at all, or shall I report this as a bug (or feature request)?


texts: How to make `ESC` key act like a real Meta modifier key?

texts:
I would like to make the ESC key act like a Meta (modifier) key.

For example, when I move backward by words by (M-b), I want to keep my pinky finger on ESC, not press it once for each backward move. I want to change the key behavior only for Emacs.

Also, is there any disadvantage to doing this (such as interfering with other commands)?


texts: How to use pdf-tools (pdf-view-mode) in emacs?

texts:
pdf-tools includes pdf-view-mode which offers several features not present in doc-view-mode (see end of question).

Can pdf-view-mode be used as a replacement for doc-view-mode generally, or does it have to be "tool" by tool?

In either case, is it necessary to edit emacs source to use pdf-tools in gnus, eww and orgmode or are their system-wide settings that can be employed?

--- Features of pdf-tools here for convenience; see github site for details ---

Seems faster than doc-view
Resolution usually better since not being rendered as a png
Nice search, and can even search for all occurrences of a phrase
Can add text annotations, and highlighting, underlining, and the like
Can create imenus for pdf parts
Can treat several pdfs as a single "virtual" pdf
Can integrate with latex to see latex source and pdf side by side and jump from one to the other at the equivalent locations (e.g. select \section{A section} in LaTeX and got that section in pdf.


texts: How to change the fontenc parameters in org-mode latex export

texts:
In the org-mode LaTeX-export the fontenc package is loaded by default with the T1 option. Since my document contains a few characters like ȩ or ĭ which are not contained in T1 I would like to load additional font encodings.

Which variables do I have to change in order to achieve this? Ideally I would like to do this in a local variable.

In addition, is there a way to guarantee that fontenc is loaded before inputenc?


texts: undo-tree tree manipulation/cherry picking?

texts:
Is it possible to cherrypick changes from different branches in undo tree?

For example say I make a change call it change1.

I then undo, and make a change, call it change2.

I then undo, and make a change, call it change3.

I then undo, and revert to change1. I then realize I infact also want the contents of change3. Is it possible to import it, similiar to gits cherry-pick?


texts: Can I send python code to an external terminal running ipython?

texts: Is there any way I can select some code in emacs and send it directly to, say, an xterm instance running an ipython kernel?


texts: How to append an argument to an external command in init.el?

texts:
I 1must append a config file to 2package command, required as -p
puppeteer-config.json. In my init.el, I tried changing the native command as
shown below:

From:

(setq ob-mermaid-cli-path "~/node_modules/.bin/mmdc")

To:

(setq ob-mermaid-cli-path "~/node_modules/.bin/mmdc -p puppeteer-config.json")

Evaluating the code block results in:

org-babel-execute:mermaid: could not find mermaid.cli executable at ~/node_modules/.bin/mmdc -p puppeteer-config.json

I'm aware of 3shell-quote-arguments, though couldn't figure out how to use them
to solve my problem.

Footnotes

1 https://github.com/mermaidjs/mermaid.cli#user-content-linux-sandbox-issue

2 https://github.com/arnm/ob-mermaid

3 https://www.gnu.org/software/emacs/manual/html_node/elisp/Shell-Arguments.html


texts:
I am trying to use the multiple websites search function in EWW. One example is the search box on wikipedia.org that you reach by pressing jump to search. When I confirm my search I get stuck on Contacting host: :80
I have tried adding (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") to my .emacs file, but it does not help. I have the same problem on Debian Buster running Emacs 26.1 and Fedora 32 running Emacs 26.3.
I can reach the Wikipedia articles by searching with duckduckgo in EWW, so the problem seems to be related to the multiple websites search function in EWW.
Does anyone know how to solve the issue of being stuck on contacting host?


texts: reload emacs package in current session after .el source recompilation

texts:
I have an emacs package installed from elpa in my ${HOME}/.emacs.d/elpa/ directory, and I am trying to fiddle with its .el source file. I would like to

recompile after modification
have those changes take effect in the current emacs session, without quitting.

This seems similar to another question, but nothing mentioned there that I've tried works:

M-x emacs-lisp-byte-compile-and-load
reloading my .emacs after byte-recompilation
load-library RET <library name>
eval-buffer
load-file RET <path to corresponding .elc file>
remove .elc file completely and  load-file RET <path to .el file>

None of these work as intended: the package does not reload, as I can confirm quite easily by breaking / unbreaking some of its functions.


texts: Why expression fails in init file, but works fine during session

texts:
I want to understand why an expression of the form

(load-theme 'my-kewl-theme t)

fails1 when run as the last expression in my init (~/.emacs) file, but works fine if I evaluate it as soon as soon as Emacs' startup is done.

How can I troubleshoot/debug this conundrum?

The only clue I have is that right before (load-theme 'my-kewl-theme t) is evaluated at the end of the loading of ~/.emacs, the variable custom-theme-load-path has the value

(custom-theme-load-directory t)

whereas after Emacs starts, it has the value

("/path/to/my-kewl-theme/" custom-theme-load-directory t)

I don't know what accounts for this difference.  (This variable is not referred to at all by ~/.emacs, at least explicitly.)  The variable custom-theme-load-directory has the value ~/.emacs.d throughout.

1error: Unable to find theme file for `my-kewl-theme`


texts: Hitting Return at start of line deletes leading whitespace. How to I prevent this?

texts:
If I have a line of text in a file with leading whitespace, and I move to the beginning of that line and hit enter, the whitespace is deleted such that the first non-whitespace character is the first character of the line.
For example:
                Here is a line with leading whitespace.

becomes:
Here is a line with leading whitespace.

if I hit enter at the start of the line (or actually anywhere within the whitespace).
Is there any way to stop Emacs from doing this?  I would like to maintain the leading whitespace and just insert a new line.


texts: Unexpected behavior when defining variable

texts:
I am trying to get the string value of a variable defined in a Python file and assign it to an elisp variable. The value is held in the variable org_file in a file config.py in the same directory as my elisp file. In the elisp file I have the following variable declaration (corgi is the name of the Python package):

(defvar corgi-org-file-path
    (shell-command-to-string "python -c \"from config import org_file; print org_file\"")
    "Path to org file retrieved from python config file")

Now if I evaluate the shell-command-to-string call alone, it returns the string path that I want. However, if I evaluate corgi-org-file-path after it is defined, I get a Python Traceback in the messages buffer:

Traceback (most recent call last):
  File \"<string>\", line 1, in <module>
ImportError: No module named config

I am not really sure what is happening here. What am I missing?


texts: Fetching email from multiple accounts via both Lieer (gmailieer) and isync with Notmuch

texts:
I was wondering if I can use both isync and Lieer (gmailieer) at the same time to pull email from multiple Gmail and multiple non-Gmail accounts (each account  being in a separate subdirectory in my mail directory which is where Notmuch resides)? I know I am asking this before trying but I have sensitive Email setup and I am worried I might mess things up. I really like having access to my Gmail tags, that's why I started using Lieer. I tried to fetching non-Gmail accounts through Lieer and it (maybe obviously) fails, that's why I am looking to use isync for other accounts. Is there anything I should be aware or careful about with regards to: a. Using both Lieer and isync at the same time? b. Having multiple accounts in such a setup (I am also using msmtp to send emails)? c. I am using Doom Emacs, is there anything to be done on that setup?
Thank you!


texts:
I have my own font locking that highlights quotes in comments eg.

/* Some comment 'this is quoted'
 * more 'text in an escaped \` quote'.
 * Plurals such as Moe's or Joe's should work too. */

Assuming the quotes don't need to span multiple lines.
And quotes can be escaped.

Currently I'm using

(concat "'" ".*?" "[^\\]" "'")

However it doesn't check spaces around the quotes.

Is there a convention to matching quotation?


texts: Let org-timestamp-up/down work on non-timestamp

texts:
So in org-mode, shift-up and shift-down works on timestamps. Is there a way to let it work on arbitrary dates in the text that is not a timestamp? For example if I write

The date is 2019-01-01.

Would it be possible to use shift-up/down on the date there to adjust it?


texts:
I just discovered undo-tree-mode and it's amazing.
My use case is finding changes that I've made before so that I can re-apply them. However I'm having difficulty finding the changes I've made.

Is there an easy way to get output like git log -p or better git log -p  --graph from this so that I could grep it? The existence of undo-tree-visualizer-toggle-diff suggests that most of the code to do this is already there.


texts: Extract file(s) to hard-drive from `archive-mode`

texts:
I'm looking for a means to extract individual and marked files from archives (e.g., *.zip; *.gz, etc.) to the hard-drive (without opening them in a buffer) using archive-mode.  A suggested modification of that major-mode (that would permit this new feature) will be greatly appreciated.

http://www.gnu.org/software/emacs/manual/html_node/emacs/File-Archives.html


texts: toggle-debug-on-error only works for the first error, how can i fix this?

texts:
when I enable debug on error it works perfectly the first time.

when I go and fix my error and rerun my function debug on error no longer triggers for new errors.

Is there a way to enable it so future debugs work as well instead of me having to quit and reload emacs to reset the functionality ?

This is an example of what i get, but only ever once.

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  file-name-directory(nil)
  (message "dc-compose-root %s" (file-name-directory buffer-file-name))
  dc-compose-root()
  (format "dc-compose-exits%s%s" (dc-compose-root) dc-docker-compose-file)
  (file-exists-p (format "dc-compose-exits%s%s" (dc-compose-root) dc-docker-compose-file))
  dc-compose-exists()
  (if (dc-compose-exists) t (error "Missing docker-compose.yml in project root aborting current command %s" (dc-compose-root)))
  dc-compose-exists-check()
  dc-docker-compose-process(#("[C-t] show common commands, [?] describe events, [C-h i] show manualps" 1 4 (face magit-popup-key) 29 30 (face magit-popup-key) 50 55 (face magit-popup-key)))
  dc-docker-compose-ps(#("[C-t] show common commands, [?] describe events, [C-h i] show manual" 1 4 (face magit-popup-key) 29 30 (face magit-popup-key) 50 55 (face magit-popup-key)))
  funcall-interactively(dc-docker-compose-ps #("[C-t] show common commands, [?] describe events, [C-h i] show manual" 1 4 (face magit-popup-key) 29 30 (face magit-popup-key) 50 55 (face magit-popup-key)))
  call-interactively(dc-docker-compose-ps)
  magit-invoke-popup-action(112)
  funcall-interactively(magit-invoke-popup-action 112)
  call-interactively(magit-invoke-popup-action nil nil)
  command-execute(magit-invoke-popup-action)


texts:
Do you know how whitespace mode turns on the visibility of certain normally non-visible characters, such as the space and the tab? Well, I'd like to be able to emulate this with Unicode bidirectional characters (e.g. Right-To-Left Mark U+200F, Pop Directional Isolate U+2069).

One way to make, say, the Right-To-Left Mark visible, is to put the following lines in the .emacs file:

(unless standard-display-table
  (setq standard-display-table (make-display-table)))
(unless
  (aref standard-display-table #x200F)
  (aset standard-display-table #x200F (vector (make-glyph-code #x22c9 'escape-glyph))))

The problem with this approach is that it keeps the mark visible all the time. I'd like a way to turn its visibility off, and then possibly on again later on.

This question is related to this one. The difference is that in the present question I'm not asking to turn the feature on only in whitespace mode, but rather to turn it off and on in the current mode, whatever it be. Hopefully this is an easier question to answer.


texts: In macOS, how to fix `command+option+key` changing `key` to a special character?

texts:
In macOS 10.13.5 running Emacs 26.1, key presses involving command+option are not producing the key sequences I expect. How can macOS and/or Emacs be configured to fix this?

Examples:

command+option+r produces M-s-® instead of M-s-r.
command+option+j produces M-s-∆ instead of M-s-j.

I'm using stock Emacs built with brew install emacs.

It's interesting to note that Mitsuharu Yamamoto's "Mac Port" Emacs produces the expected key sequences. Maybe a patch is required?


texts: Opening file after org-export in external program fails, but works with different invocation methods

texts:
I'm using emacs in Win10 WSL 2 Linux and call a custom script open in my $PATH to open files from WSL-Linux/emacs in Windows GUI. My .mailcap makes sure that the script is actually being used and the right program is being called, e.g. for a HTML file file.html in the current directory my browser should open the file. This successfully works

from terminal with open file.html
with ! in dired buffer and
with evil :! in buffer file.html
with M-! open file.html RET.

However, when I export and open the file via org-export mechanism, the script is being called, but nothing happens. The same happens when using eshell instead of shell. In both cases I can see the following processes:
emacs --daemon
├─ /bin/bash /home/username/bin/open /path/to/file.html
│  └─ /tools/init /mnt/c/Windows/explorer.exe \\wsl$\Ubuntu\path\to\file.html

I don't know about this process /tools/init and didn't find useful information online. I tried this solution and added (push "open" eshell-visual-commands) to my init.el. Now opening works from eshell, but it still fails with the org-export mechanism and the /tools/init child-process is visible. At this point I'm clueless how to fix it, as this is way beyond my scope. I guess it has to do with how emacs calls the script internally.
How can I make my open script being called correctly when exporting from org-mode?


texts: How do you prevent Meta (alt) in MS Windows 8 from opening the Windows start menu

texts: Trying to use Emacs in MS Windows (operating system), which I acknowledge is not ideal. However, whenever I attempt to use the Meta key the tiled start menu appears serves as a disruption and makes Emacs unusable. Is there a way of either disabling this feature or re-assigning the key?


texts: What is the proper MIME type for .el files?

texts: I'm uploading a .el file to my server, and I'd like to set my .htaccess so that the file gets downloaded rather than displayed in the browser.


texts: Best way to retrieve values in nested assoc-lists?

texts:
Suppose I've got an assoc-list like this:

(setq x '((foo . ((bar . "llama")
                  (baz . "monkey")))))

And I want the value at bar. I can do this:

(assoc-default 'bar (assoc-default 'foo x))

But what I'd really like is something that accepts multiple keys, like

(assoc-multi-key 'foo 'bar x)

Does such a thing exist, perhaps in a package somewhere? I'm sure I could write it, but I feel like my Google-fu is just failing and I can't find it.


texts: Use remote git executable for magit and git-gutter when file system is SSHFS

texts:
How can I use a remote git executable for all git operations when accessing a file
via SSHFS?

I mount a remote system's git repo via SSHFS on my local computer.  The git repo is medium-sized with about 1000 files and a few years of history.  My local git executable it is unusably slow for all operations on SSHFS.

Time for git status:

Executing git from the Remote system: 0.012s total
Local git on SSHFS: More than 2 minutes.

Constraints:

I'm not allowed to store source code on my laptop due to corporate policy so a normal push/pull git workflow isn't allowed.
I'd prefer to keep git functionality enabled over SSHFS rather than disabling git on SSHFS and performing git operations on the remote machine.
There's a number of Emacs tools that use git including magit, git-gutter, git-gutter+.


texts: How to get live preview in real time while editing latex source code using AUCTeX?

texts:
I'm using Emacs (26.1, build 1, i686-w64-mingw32) on the latest version of Windows 10. Im looking to turn my Emacs into a LaTeX IDE that has a 'live preview' functionality.

Ideally I would like my latex source code on one side of the screen and the compiled PDF output on the other side of the screen. When I make changes to my source code it will automatically compile and update the PDF output in real time. Here is an illustration of what I mean.

I have already installed AUCTeX, pdf-tools and Latex-preview-pane and I have successfully compiled and previewed a PDF output file from within Emacs. But compilation must be done manually using keybindings.

How would I go about implementing the live preview in real time aspect as described above?

*edit: Apologies. As I am new to Emacs and not a programmer so I was unaware that my question was not specific or narrow enough. I haven't tried anything else other than installing the packages I referred to above. I had naïvely assumed that "latex–preview–pane" had the features I was looking for but that doesn't seem to be the case.  I am not even sure what to ask to make this query more specific as I'm not too sure where to go from here. I will try asking the same question on Reddit and see how that goes. I will post back here if I find a solution


texts: How to schedule exclusively with the keyboard?

texts:
If you look a the screenshot the cursor is locked in the echo area. If want to select the date, I have to click on one with the mouse. Do I, or there is a way to do with the keyboard?

EDIT:

Also the navigation key bindings don't work as they're supposed to. If I do C-f, it does not move one day forward whether in conjunction with Shift or not.


texts:
I'm putting together an app, and want to be able to test the api end points. I figured Emacs would be a cool way to go - especially if JSON responses could be parsed and the return data used in subsequent tests.

Any ideas on how to go about this, or is this just crazy?


texts:
I have this in my init.el

(require 'package)
(setq package-enable-at-startup nil)

;;; Remove SC if you are not using sunrise commander and org if you like outdated packages
(setq package-archives '(("ELPA"  . "http://tromey.com/elpa/")
                         ("gnu"   . "http://elpa.gnu.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")
                         ("org"   . "https://orgmode.org/elpa/")))

(package-initialize)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;; Bootstrapping use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

Then this lower down inside of custom-set-variables:

'(package-selected-packages
   (quote
    (org-ref techela tuareg haskell-mode gnuplot gnuplot-mode helm-ispell ac-ispell paredit ox-tufte auctex json org-grep iedit wgrep helm geiser slime-company company-jedi zzz-to-char rainbow-delimiters avy ivy projectile twittering-mode zerodark-theme pretty-mode flycheck-clang-analyzer flycheck-irony flycheck yasnippet company-c-headers company-shell company-irony irony irony-mode company-lua mark-multiple expand-region popup-kill-ring dmenu ido-vertical-mode ido-vertical ox-html5slide centered-window-mode htmlize ox-twbs diminish erc-hl-nicks symon rainbow-mode switch-window dashboard smex company sudo-edit emms magit org-bullets hungry-delete beacon linum-relative spaceline fancy-battery exwm use-package)))

My problem is when I clear out everything from my .emacs.d/ but the init.el which calls config.org which does lots of configurations, (i.e., I'm forcing a complete reinstall of everything package-wise) I get errors such as

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "ox-tufte")
  require(ox-tufte)
  eval((require 'ox-tufte) nil)

That is, in my config.org a call is made, (require 'ox-tufte) and the error above happens. A clean startup (no existing elpa directory) should go and get ox-tufte should it not? It's included in the package-selected-packages list. My understanding is that this

;;; Bootstrapping use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

ensures anything listed in the package-selected-packages if not found, will be gotten from melpa etc. and setup. But then I don't see org-mode (latest from repo) specifically listed anywhere either. What am I missing here?


texts:
Can yasnippet be used to insert an org subtree of the same level as the last?  For example, if one often writes

***** $1
#+BEGIN_SRC latex
    \paragraph{$1.}
    $0
#+END_SRC

how might one avoid having to adjust the number of stars manually?


texts:
I am trying to modify a slot in a class (created with EIEIO library). I can access the slot with (oref-default 'helm-source-ffiles filtered-candidate-transformer) and that returns

(helm-ff-sort-candidates
 (lambda
  (candidates _source)
  (cl-loop for f in candidates for ff =
        (helm-ff-filter-candidate-one-by-one f)
        when ff collect ff)))

a list of two items. I am trying to add helm-adaptive-sort to the end of that list. However everything I have tried results in an error. Here is what I am trying to do.

(oset-default 'helm-source-ffiles
              filtered-candidate-transformer
              (helm-ff-sort-candidates
               (lambda
                 (candidates _source)
                 (cl-loop for f in candidates for ff =
                          (helm-ff-filter-candidate-one-by-one f)
                          when ff collect ff))
               helm-adaptive-sort))

that results in Symbol’s value as variable is void: helm-adaptive-sort. If I quote it I get the error Can’t set default to a sexp that gets evaluated again.  The only thing that I have found that doesn't give an error is storing my list in   a variable then calling it like this (oset-default 'helm-source-ffiles filtered-candidate-transformer (list foo)). However that wraps it in an extra set of quotes. How do I set a slot in a class?


texts: On emacs26, is it possible to halt initializing and attach to running emacs-server with init.el?

texts:
I'm using emacs26 on macOS and using server-client for the fast initialization.

However, it's a bit annoying that a new emacs instance is always spawning when I run "Emacs.app" with SpotLight instead of running 'emacsclient' in terminal. What I want is running emacs server as a background service when first emacs instance is created (when there is no running server), and other new instances are connected to the server without massive library loading.

To achieve that, I think these four functionalities are needed for the init.el.

Check running emacs server.
Run server as a background service.(For the first instance)
Attach to running server.
Skip rest of initialization.

Is there any example of init.el showing those functionalities?


texts:
The function org-toggle-heading is quite handy to convert existing text into an org heading.

Input:

pay rent

Output:

* pay rent

The function org-insert-heading has an analogous org-insert-todo-heading, but I don't see the function org-toggle-todo-heading as a counterpart to org-toggle-heading.

Desired output:

* TODO pay rent

Is there a function to convert existing text into org todo heading?


texts: How can I build/package Emacs so that the C source files are installed to a standard find-function-C-source-directory?

texts:
I want to be able to view C source code of Emacs functions. For example, I want to be able to do M-: (find-function 'message).

Emacs prompts me for directory the C sources, so it can set find-function-C-source-directory. However, my distro (Arch Linux) has just done the usual make; make install steps (see the package recipe here) so there are no C sources available without manually downloading them.

So, I want to fix the packaging. My questions are:

Are there configuration options Emacs' makefile that mean make install copies the C sources too? I can't see anything obvious.
What's the correct way to set find-function-C-source-directory in the package? Create a site-lisp?
Are there any distros or platforms that already do this?


texts:
I am using org-reveal for presentation
It has a #+BEGIN_NOTES for creating speaker notes
Tried to shorten with this macro n following this suggestion
 #+MACRO: n (eval "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n")

It works if I use {{{n(some notes)}}} in a single file
But if the file #+Include: some other file I get strange errors on export:
eval: Wrong number of arguments: eval, 5

This is org mode version 8.3beta
When I switched to 9.3.8 I got an eval error in the outside file itself
And org 9.4 doesnt load at all so I assumed its too bleeding edge and hurriedly went back
Yeah my emacs is a bit old: 24.5.1; can't afford an upgrade at this point

Added later in response to @NickD
I tried digging...
And found that
org-export-expand-as doesn't seem to be used in org-reveal.
So I did the following

Moved the macro out from the org into lisp and removed the eval

(setq org-export-global-macros '(("n" . "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n")))

Ran

M-:  (org-export-expand-include-keyword)
M-:  (org-macro-replace-all org-export-global-macros)

After this reveal exporter works
Unfortunately my simplistic try at automating the above doesnt work
(defun mymacro-expand ()
  (widen)
  (let ((c (buffer-substring-no-properties (point-min) (point-max))))
    (with-temp-file "ttt.org"
      (insert c)
      (org-export-expand-include-keyword)
      (org-macro-replace-all org-export-global-macros))
))

I guess I should file a org-reveal bug report

But if you can suggest an alternative to above using org-expand-as that'd be great!

Addition 2
Downloaded and compiled emacs
Now its at version 28.0.50
Org version 9.4
It now seems that the $1 inside the string breaks whereas the format version doesn't.
Error message is eval: Wrong number of arguments: eval, 4
Can you try with these two files?
$ cat foo.org
#+TITLE: Some title
#+MACRO: n (eval "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n")
* Outside heading
#+Include: bar.org

$ cat bar.org
* Inside heading
Some text
{{{n(internal note)}}}
Some more text


texts: Make opening clickable filenames from Help mode in same window

texts: When I'm in Help-mode buffer generated from describe-function or similar command - after placing cursor on clickable filename text I wish to open this file in the same window (ideally I wish I could also kill this help buffer the same time). How can I achieve that?


texts: web-mode not working inside of org-mode src block

texts:
I am trying to write code snippets inside org-mode and I am not able to get the same effect from web-mode.

If I write the code in a css file completely I get this:

But when I write the same code inside of org-mode and put the major mode as web, I get the following:

How can I fix this such that I get the same properties of web-mode inside of org-mode as well?


texts: Reference a variable in a 2nd org-babel code block

texts:
How can I define vars in one org-babel code block and use them in a second?  This closely follows the tutorial section block-to-block
variable passing linked in the first answer.

# file test.org
* try a session.
#+name: section1
#+begin_src R :results output both :session
x <- c(1:10)
y <- x^2
mat <- cbind(x,y)
mat
#+end_src

#this is outputted into the MWE after you press C-c C-c
#+RESULTS: section1
#+begin_example
       x   y
 [1,]  1   1
 [2,]  2   4
 [3,]  3   9
 [4,]  4  16
 [5,]  5  25
 [6,]  6  36
 [7,]  7  49
 [8,]  8  64
 [9,]  9  81
[10,] 10 100
#+end_example

#+name: section2
#+BEGIN_SRC R :file example2.png :results graphics mat=section1
plot(mat)
#+END_SRC

#this is outputted into the MWE after you press C-c C-c
#+RESULTS: section2
here is a white box with the phrase
object 'mat' not found
when it is named section 2 the white box appears in the first results
#+begin_example section and the matrix of numbers disappears.


texts: eval-when-compile statements not running in files required by compiled file

texts:
I've got one file including

(eval-when-compile (require 'cl))

Some other files require this file, and also need to have cl required when they are byte-compiled.  This is not happening - this first file does not appear to know it is getting byte compiled, when it is required by other files that are getting byte compiled.  Is there a way to craft an eval-when-compile statement in this first file, such that files that require it to also require cl when they are getting byte compiled?

EDIT: Context of the question:

When I download https://github.com/idris-hackers/idris-mode and run make build to byte compile, I get warnings in two separate files, idris-prover.el and idris-repl.el.  Both of these files require inferior-idris.el which contains the line (eval-when-compile (require 'cl)).  If I add that line to the two files, the warnings disappear.  I am wondering if that would be the best solution to fix the warnings.  Warnings include:

idris-prover.el:224:44:Warning: `:ok' called as a function
idris-prover.el:239:19:Warning: `:error' called as a function
idris-prover.el:253:67:Warning: `t' called as a function


texts: Return buffer from buffers list. For example, get the 5th buffer in the list, or check the name of every buffer in the list and return a match

texts:
A bit of a silly question here, but you know emacs is a lot of library. Is anyone familiar with extracting buffers by number from the buffers list?
In javascript or php this kind of thing is easy, just put an index next to the array. In emacs however, the lists have sometimes objects and sometimes strings, and getting the strings out of the objects seems sometimes a bit esoteric, given the sprawling and somewhat fragmented nature of the knowledge base.
Of course, this is really easy and I'm missing something obvious, but nonetheless, help me out if you know the answer!
To reiterate, I'd like to dolist the buffers list and extract a matching name if there or return the second, third, or fourth buffer from the list, as the case may be.


texts:
I want to expand else {|} (second parentheses generated by smartparens) into

else {
  |
}

which is the best sequence of keys or options?


texts: How do I prevent backups of scripts from being made executable?

texts:
If I edit an executable script, say foo.sh, then upon saving emacs makes the backup file foo.sh~. That's all well and good, but if the original file has the executable bit set, then so does the backup. This is a little annoying; is there a way to prevent this?

Or, at the very least, is there a way to save the executables in a different directory than the real one? That way I could put them somewhere not on PATH. Thanks!

$ emacs --version
GNU Emacs 25.3.1
[...]


texts: Why does this straightforward use of a closure fail?

texts:
Suppose you save the following code to some file test.el and then do load-file test.el

;;; -*- lexical-binding: t -*-

(let ((closure-vbl 0))
  (defun tst ()
    (eval 'closure-vbl)))

(tst)

You get the error tst: Symbol's value as variable is void: closure-vbl. (Replacing (eval 'closure-vbl) with (symbol-function 'closure-vbl) gives the same error.)

Why is this? I don't understand what is wrong with the above code? Am I miunderstanding some property of emacs closures? Or are they simply not developed enough to deal with non-trivial situations.


texts: How do I display links in a mu4E message at the end of the text

texts: I prefer reading plain text messages in Mu4E. However, I do not like its interface of mixing links with text on the same line. Is it possible to have Mu4E collect all links and list them at the end of the message, and only put numbers pointing to such links inside? for example, instead of "The great conference to take place http://onlineconferences.com/?c=1002&t=1400 had been rescheduled." It can be "The great conference (1) had been rescheduled" then before the message ends, we have: (1) http://www.conferences.com/c=1002&t=1400


texts: How to improve eldoc + lsp-mode output with C/C++ comments?

texts:
When using eldoc with lsp-mode, there are some irritations with the default output.

Various characters are backslash escaped, so:

/* This: isn't so -> "good", you see. */

Displays as:

This\: isn\'t so -\> \"good\"\, you see.
Blank lines are included so:

/**
 * This is a comment.
 */

Displays as:

This is a comment.

Has a blank lines above and below it.

Is there a convenient way to show eldoc as plain-text with blank lines stripped from the start & end, or does this require writing my own eldoc-message-function ?

Note while formatting for doxygen would be nice too, plain un-escaped text is fine.


texts: Org agenda - alias for file name in weekly view

texts:
Some of the org files I use have long filenames (at least longer than 11 characters ;)), this breaks the default weekly view:

elastic-oncall is longer than the space for filename and therefore breaks the format.

Is there a way to specify file name alias, or just make it truncate the filename?


texts: Unable to bind SPC as a prefix in general (evil mode)

texts:
My setup worked perfectly fine, however I recently reinstalled Emacs and therefore updated all packages as well when starting for the first time.

Since then I cant get rid of the warning/error:
Error (use-package): general/:config: Key sequence SPC x starts with non-prefix key SPC

Relevant part of my config:

(general-define-key
   :states '(normal emacs motion)
   :prefix "SPC"

   "x" 'counsel-M-x )

I already tried:

unbinding SPC before it is used as a prefix
have my keybindings load after everything else
using alternative definitions for using spacebar  to "SPC" for example with kbd

What is especially weird to me, is that the keybinding and all others that are prefixed with SPC work perfectly fine like they should (even SPC x). C-h k SPC also gives me the associated results.
I also know that this is related to general.el especially because manually copying and using an old copy of the package doesn't give me this error


texts: Org-mode deadline: Repeat certain number of times

texts:
I'm looking for a way to specify a deadline in org-mode that repeats at certain intervals but only a specified number of times.

For instance, if I want to have a deadline repeat twice one week apart, I can make it appear in the agenda using diary-date:

   DEADLINE: <%%(diary-date 4 '(19 26) 2018)>

But it throws a Could not find timestamp error when I try to mark it DONE in agenda view.

I can also make it repeat indefinitely with <4-19-2018 +1w> then manually mark it DONE after a certain number of weeks using the numeric prefix -1, but that increases cognitive load.

I'm looking for an out-of-the-box solution before trying any custom elisp.


texts: how to make evil-leader local in org-src-mode?

texts:
I use evil-mode and evil-leader, and I have the <SPC>s keybinding to save the buffer. But when I edit a src code block in org-mode (with C-'), I want <SPC>s to run org-edit-src-save instead of save-buffer. Some things I tried:

;; I think this one has no effect because `set-key-for-mode`
;; probably only works with major-modes.
(evil-leader/set-key-for-mode 'org-src-mode "s" 'org-edit-src-save)

;; This one works, but makes the binding global.
(defun my/org-src-conf ()
 (make-local-variable 'evil-leader--default-map)
 (make-local-variable 'evil-leader--mode-maps)
 (evil-leader/set-key "s" 'org-edit-src-save))

(add-hook 'org-src-mode-hook 'my/org-src-conf)

How can I achieve this local binding for evil-leader?


texts: How to automatically set marks on all of the edited lines?

texts: I would like to automatically set marks on all of the edited lines so that I can go back to any of my previous edited lines using helm-mark-ring.


texts: How to see preview of svg file I'm editing?

texts:
I'm editing a svg file and want to see how it looks like. I tried opening a window with the same buffer and change to image-mode but it change the mode in both windows. I tried opening the same file in a different buffer, but it didn't allow me.

So is there a way to have two windows with the same svg file, one with source and one with preview?


texts: Associate (and save) macro with current file (+/- evil spacemacs)

texts:
After edit :

I am using evil-mode. I often record macros very specific to the file I am editing with qq or qw. Is there a way to autosave those macros and the key associated to them when saving the file ? In order to make those macros working when the file is opened again.


texts: How do I move back to the previous page I was viewing, in Emacs Easy Customization buffer?

texts:
In the Info buffer, I can use the [ key to move the previous page, or the l key to move back through my personal viewing history.
How can I do something similar, in the Easy Customization buffer?
I'd like to just go back to the previous customization page I was viewing, before I clicked on a hyperlink, but I can't figure out how.


texts:
For this project, I cannot seem to get M-x gdb to work in Emacs 25.1 (on Ubuntu 14.04.5 64-bit if it matters - this should be the case for any Ubuntu-based Linux in general I imagine). Steps to reproduce:

sudo apt-get install subversion cmake libopencv-dev libeigen3-dev libv4l-dev
cd ~/Downloads/
svn co https://svn.csail.mit.edu/apriltags
cd apriltags
make BUILD_TYPE=Debug
./build/bin/apriltags_demo # run program to see that it works

Now fire up Emacs and go to the file located in examples/apriltags_demo.cpp of the downloaded directory. Running M-x gdb and accepting the default gdb -i=mi main as the gdb command, I cannot place breakpoints anywhere by mouse clicking in the left fringe of the gdb-many-windows view - like I can do for any other simple program that I create and compile with g++ -std=c++11 -g main.cpp -o main.

Can you please try to reproduce my steps/explain how to get this to work? Thank you!

Note: using realgud works flawlessly - but I want to see why it doesn't work with Emacs' built-in GDB functionality.


texts: Automatically saving the current file after typing a certain number of characters

texts:
Is there a way to force Emacs to automatically save the current file (if it is not already saved) after typing n characters (n is a number determined by the user).

Edit: After the comment of @Dan and the suggestion of @lawlist it seems that the solution below is less risky:

   (setq auto-save-interval 10) ;;; n=10

    (defun force-backup-of-buffer ()
      (setq buffer-backed-up nil))

    (add-hook 'before-save-hook  'force-backup-of-buffer)

I should mention that the above solution is based on http://www.emacswiki.org/emacs/ForceBackups.


texts:
In my coding style tabs used to indent and spaces for align. I've configure Emacs for this, but some times emacs places 4 spaces instead of tabulation in some blocks of code. If can be fixed by reindenting whole block (beetwin {}), but some times this way not work too.
How can I fix it?
PS .emacs here http://pastebin.com/c2pcD79k


texts: Unexpected indentation in backquoted list starting with comma function call

texts:
When I write a backquotedlist that starts with ,( emacs aligns the remaining items to the parenthesis and not to the comma; e.g.:

(defun kb-test1 ()
  `(,(hello)
     fdefef
     ,(fefesd)))

(defparameter *kb-test2*
  `(,@(hello)
      ,@(gkere)
      ,@(lkdsf)))

I would expected it to be aligned as:

(defparameter *kb-test2*
  `(,@(hello)
    ,@(gkere)
    ,@(lkdsf)))

When the first term does not start with ,@( or ,(; e.g.:

(defparameter *kb-test2*
  `((hello)
    ,@(gkere)
    ,@(lkdsf)))

The indentation is as I expect.

I experimented with enabling and disable various modes, I removed my .emacs and .emacs.d and customized my emacs step by step.  Using the following steps I could reproduce the indent behaviour:

Remove .emacs and .emacs.d
Plain emacs v.26.1
Indents as expected
Add https://melpa.org/packages to package-archives
Indents as expected
Install the package slime (version slime-20181106.1113)
Quit emacs
Start emacs
Visit a fresh file ~/tmp/test.lisp
This shows lisp-mode and slime-mode are active (e.g. my status line is U:---  test.lisp     All L1     (Lisp Slime))
type: (defun f()enter `(,@(hello) enter (In reality I did not type a space after the backquote).
Now point is at (3,6) (as shown by column-number-mode) aligned with the second parenthesis instead of at (3,4) aligned with ,.

Is this how lisp code ought to be aligned?  Is this a bug in Lisp-mode or one of the other minor modes?  Or is it a matter of personal taste?

Is this caused by slime-mode or does it have some other cause?

How can I correct it?
Should I send a bug report?


texts: Determining the string formats for datetime-timezone

texts:
When loading a .log file I get the message

Warning (emacs): Failed to determine system timezone; consider customizing ‘datetime-timezone’ variable

Going to the customization menu, the options are not evident:

Hide Datetime Timezone: nil
    State : STANDARD.
   Default timezone for date-time formatting and parsing. Hide
   Leave unset to let the library auto-determine it from your OS
   when necessary.
Groups: Datetime

Lines that also appear in the source

(defcustom datetime-timezone nil
  "Default timezone for date-time formatting and parsing.
Leave unset to let the library auto-determine it from your OS
when necessary."
  :group 'datetime
  :type  'symbol)

What is the appropriate way to set my timezone on macOS so that datetime-timezone would inherit it without a duplication in ~/.emacs.
Failing that, what is the format for this customization? (For some reason, C-h i does not include a menu for datetime in my installation.)


texts: How to browse through the gdb command history in gud?

texts:
From time to time I am using gdb through the gud Emacs interface to debug my C programs. Nevertheless, I find extremely annoying to not be able to browse the gdb command history by just using the Up and Down keys. In place of this behavior, the cursor can move anywhere in the emacs buffer even outside of the regular gdb prompt (which I find totally useless for my purpose).

Is there a way to force gud to take the Up and Down keys as get backward and forward in the command history. And, is there a way to prevent the cursor to move away from the gdb prompt ?

My idea would be to have a behavior similar to the M-x term terminal, but for gdb and having the benefit of gud.


texts:
I am trying to write a project proposal by using org-mode. And when I change the #+LATEX_CLASS variable to something different org can not export to pdf.

So, I wondered how can see list of latex classes that are seen by emacs in ielm ?

B.R.


texts: How to return the selected cons cell using completing-read?

texts:
I have a set of directories. For each directory I have a set of relative file names. I would like to select any of these relative filenames using completion, and then later reconstruct the absolute path of the filename. (The relative filenames can be assumed to be unique). The following code works:

(let ((lst '(("a/b" . "dir1") ("a/c" . "dir2")))
      (select nil))
  (setq select (completing-read "Enter file name: " lst  nil t ""))
  (cdr (assoc select lst)))

Here, the cdr of the cons cells represents (absolute) directory names (simplified to "dir1" and "dir2" for this question) for the given relative path. But it feels like I have missed something. It should be possible to avoid using assoc if completing-read just could return the whole cons cell instead of just the car of the cons cell, but I could not find information about how to achieve that in the manual.

Is it possible to tell completing-read to return more information (i.e. the cons cell)?


texts: Why can't 'org-clock-goto' find most recently clocked task in a fresh session?

texts: If I open emacs and do a C-c C-x C-k I get the message, No active or recent clock task. In such a case, where I have not yet clocked a task since I started emacs, can I instead get org-clock-goto to find the most recently clocked task from the files in my agenda list?


texts:
I would like to be able to execute M-x helm-gid and type in:

one two !three

But the "!" operator seems to be treated as if it is looking for id's that contain the "!" character. It works great in helm-occur and helm-find-files, but I can't see to get it to work in helm-gid.

Is this user error or simply something not implemented?

I'm using helm version 20190509.558 installed via the list-packages interface on Ubuntu 18.04.


texts: Magit extremely slow in Windows. How do I optimize?

texts:
I am forced to use Windows 10 for a project. Yes, I would rather use GNU/Linux. To keep my sanity, I've tried to regard Windows as a bootloader for Emacs :)

Unfortunately, Magit (one of my favorite parts of Emacs, which also makes up for the lack of a good command line on Windows) is unbearably slow. I have an SSD, 16 GB of RAM and a quad-core i7 but it takes eight seconds to execute magit-status on a small repository. Then, when I want to stage another change, it takes about 5 seconds per file.

Here's what I've tried:

$ git config --global core.preloadindex true
$ git config --global core.fscache true
$ git config --global gc.auto 256
Adding the entire project to the Windows Defender (my only AV) exclusion list
Setting the magit-git-executable to the regular msysgit one I downloaded (https://git-for-windows.github.io/). I checked and git status here takes < 1 second. I know that magit-status does way more, but this is too much.

Can anyone suggest ways to make this faster? I can't imagine anyone using Magit on Windows like this.

It was suggested that this question is a duplicate, but they asked:

  I'm struggling to understand why Emacs have noticeably shorter startup time on Ubuntu than Windows. Anyone knows the answer?

I know at least some reasons why Emacs, Git, and Magit are slower on Windows. I am asking how do I optimize Magit to do fewer things, or cache results, or something, even if it's at the expense of functionality.