texts:
I am using Emacs + ESS + Sweave to write a document.  When I do multiline copy of noweb commands using M-w, switch to R buffer and execute them (C-y, RET), Emacs will sometimes freeze, forcing me to kill Emacs and start over.  This also happens with C-c C-c'ing of a text block.

EDIT: I am using Emacs 24.3.1, ESS 14.09, R 3.1.2.

EDIT: After some testing, the following file will reproduce this problem.  Specifically, the first chunk will cause Emacs to hang.  The only resolution is to first C-g then switch to the R buffer and C-q C-c to return full control.

\documentclass[10pt]{article}
\usepackage{graphicx, verbatim, geometry,amsmath,amssymb, natbib, float, enumerate, courier, underscore}
\usepackage[utf8x]{inputenc}
\geometry{margin=1in}
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}

\begin{document}

<<>>=
library(ggplot2)
dat <- matrix(runif(100), nrow=10)
    cc <- apply(dat, 1, function(xx){
    sum(cos(xx))
})
@

The quick brown fox jumps over the lazy dog.

<<>>=
bcc <- sapply(cc, function(xx){
    fft(xx)
})
@

\end{document}


texts:
I have this
(setq org-agenda-files (directory-files-recursively "~/Dropbox/org/journal/" "\\.org$"))

but I don't know where to place it in order to make sure that on the event of a new daily org-journal file creation in my journal directory (e.g. ~Dropbox/org/journal/2021/02/) the agenda file list will immediately be updated. At the moment I have it placed early in my init.el, which thereafter calls a big, general config.org full of package initializations and tweaks, then a private custom-set-variables file. Does this sexp need to be part of some special trigger/hook/event code to know to update the org-agenda-files list when a new org-journal day file appears?


texts: org export: "no output was produced to write to file"

texts:
Sample file:

* hello
* goodbye
* some source
#+BEGIN_SRC ipython :session :file py224158lK.png :exports code
  print ("this will not work")
#+END_SRC

The text in this file will yield error `No output was produced to write to a file' when I attempt to export it to any format (org-export-as-html, org-export-to-markdown, etc).

This is incredibly frustrating, because, not only can I not figure out what I've done to cause this failure (this used to work), but this is the worst possible moment for this error. Why might this be failing here?

Relevant: If the *some source header is removed, the code does export to file successfully,. In fact, the file seemingly successfully exports so long as the :file specification is not included.


texts: Rename all files(from different folders) in one buffer?

texts:
In folder I have 5 subfolders:

drawable-hdpi\
drawable-mdpi\
drawable-xhdpi\
drawable-xxhdpi\
drawable-xxxhdpi\

In all of this 5 subfolders I have files with same names:

ic_m_brands_gray.png
ic_m_brands_orange.png
ic_m_favourites_gray.png
ic_m_favourites_orange.png
ic_m_home_gray.png

I need to rename all of this files in ALL (five) subfolders.

So I do this by dired mode and package iedit

My steps:

Go to folder drawable-hdpi
C-x C-q toogle edit mode
Go to file with same suffix (gray)
Select region then iedit-mode
Rename to desire suffix
Press C-c C-c
Repeat steps 1-6 for another 4 subfolders.

Here example:

OK. It's work. Fine.

But I think it's to slow (too many steps).

Is it possible to show ALL files (from 5 subfolders) in ONE buffer? And then in this ONE buffer rename all files?

It's will be a good solution.


texts: Different themes for terminal and graphical frames when using Emacs daemon

texts:
I'm trying to achieve the following behavior in Emacs24:

I like to use a different theme (solarized-dark vs. solarized-light) depending on whether I connect to the running
server with a terminal frame

% emacsclient -t

or with a gtk frame

% emacsclient -c

This seems to have worked in older Emacs, but the current Emacs I couldn't find a way.  I alreday checked SO (e.g., https://stackoverflow.com/q/18904529/152439 and answers) and the mailing lists (e.g., https://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/msg00227.html and https://lists.gnu.org/archive/html/help-gnu-emacs/2012-02/msg00237.html).

My current setup looks like this:

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/solarized")
(if (daemonp)
  (add-hook 'after-make-frame-functions
    (lambda (frame)
      (select-frame frame)
      (if (display-graphic-p frame)
        (load-theme 'solarized-light t)
        (load-theme 'solarized-dark t)
      )
    )
  )
  (load-theme 'solarized-light t)
)

The problem with this is that if I have a graphical frame open and then open a terminal frame with emacsclient -t, the theme solarized-dark gets applied to both the new terminal frame (which is correct) and the already open graphical frame (which should be left untouched, ideally).  The equivalent happens when a terminal frame is already open and I open a new graphical frame with emacsclient -c.

EDIT: In case this is not possible with current Emacs24, are there any plans to make it possible again?


texts:
I am looking for something like thing-at-point for a regexp. For example, I want a function called regexp-at-point-p  that will return the matched text if the text around the point matches the regexp with a looking back bound of the beginning of the current line. This seems tricky. I can't easily use re-search-backward, because it won't return a full match, it only matches up to the current point, and it doesn't always match a complicated regexp.

Here are the two regexps I tested for a #hashtag

simple regex: #[a-zA-Z]+

complicated regex: \(?:^\|[[:blank:]]\|[](),.:;[{}]\)#\{1\}\(?1:[^#[:digit:]]\(?:[^ #+[:punct:][:space:]]+[-_]?\)+\)\(?:[[:blank:]]\|$\|[[:punct:]]\)

with the point inside the #hashtag, I would expect regexp-at-point-p should return "#hashtag" for both of these regexps.

My current solution is this. It does not match multiline expressions before the current line, which is fine for me, but it works on both regexps above.

(defun regexp-at-point-p (regexp)
  "Return match if the text around point matches REGEXP."
  (save-excursion
    (let ((p (point))
      (lbp (line-beginning-position))
      (match))
      (while (and (not (setq match (looking-at regexp)))
          (>= (point) lbp))
    (backward-char))
      (when (and match
         (>= p (match-beginning 0))
         (<= p (match-end 0)))
    (message (match-string 0))))))

It works, but it doesn't seem like the right way to do this. I tried an alternate version that would go to the beginning of the line and use re-search-forward, but it had a similar form.

This version seems like it should work (and it does for the simple regexp, but not for the complicated one). A similar approach with looking-back has the same limitation.

(defun regexp-at-point-p (regexp)
  "Return match if the text around point matches REGEXP."
  (save-excursion
    (let* ((p (point))
       (lbp (line-beginning-position))
       (match (re-search-backward regexp lbp t 1)))
      (when match
    ;; re-search-backward can give partial matches up to point. This sets
    ;; match data to the whole pattern.
    (looking-at regexp))

      (when (and (>= p (match-beginning 0))
         (<= p (match-end 0)))
    (message (match-string 0))))))

Is there a more canonical way to do this? or is this just not a good way to check if point is on a regexp?


texts: How do you fix a large list of unknown files in Ebrowse?

texts:
I'm trying to use the emacs Ebrowse tool. The issue I'm having is a great majority of the C++ files, from my BROWSE file, are showing up as (unknown) file type, resulting in me being unable to open those actual files. I'm pretty unfamiliar with this codebase so it wouldn't be as simple as doing a C-x f and opening each (unknown) file in that manner.

This project has about 9300 classes.

What is an approach I can use to resolve this issue so that I can easily search for files throughout this project, and continue to have Ebrowse capabilities such as searching for the usages of functions, classes, and variables on a project wide scale?


texts: Emacs crash because of special utf-8 character

texts:
I am trying to open a file that contains the following utf-8 character: ⛺
Unfortunately, my emacs does really not appreciate, and immediately crashes.
I have tried to comment out all my init.el (and actually I've even renamed my .emacs_d folder to be sure that my local packages/functions have nothing to do with it).
The crash still occurs (it just closes the editor when attempting to open the file).

Any idea of what the problem might be/how to fix this ?
Using emacs 25.2.2 on Ubuntu 18.04.

Edit: here is the terminal output when running emacs -Q --debug-init.
No message on startup.
When trying to paste ⛺ in the scratch buffer:

X protocol error: BadLength (poly request too large or internal Xlib length error) on protocol request 139
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
Fatal error 6: Aborted
...  // long backtrace ending with a core dump


texts: git-stage the current file-visiting buffer?

texts:
I've never really used vc but it looks like it only supports add or commit actions.

I reckon magit must have some of the machinery to achieve this, but browsing its codebase didn't reveal anything obvious.


texts: Fill placeholders with dynamic values upon exporting a org document

texts:
I would like to create an invoice exported from an org document. At the moment I have a clock table which shows the total number of hours I want to bill.

I would like to have a part of the document which is static text, with some dynamic variables in it. Basically placeholders that should get filled with the current values upon export, where I can also do simple math to add the tax for instance.

Dummy code:

%subtotal = %number_of_hours * %hourly_rate
%total = %subtotal * 1.19  # add tax

Billing period: %clock_table_first_day - %clock_table_last_day

Units            |  Rate            | Total
%number_of_hours |  %hourly_rate    | %subtotal
...

In my document I have many time records:

** Some meeting
  :LOGBOOK:
  CLOCK: [2019-02-08 Fr 09:12]--[2019-02-08 Fr 09:33] =>  0:21
  :END:

I'm barely scratching the surface of Emacs and not sure what is the most appropriate solution. Templating, string expansion etc. I wonder what is the most lightweight way to...

a) e.g. get the total duration of my time records for further calculation

b) fill a static block of plaintext with some dynamic values

For b) Would it be https://orgmode.org/manual/Capture-templates.html#Capture-templates? Or rather a src block? Dynamic block?

Update:

What I've come up with so far:

#+name: print-hello
#+BEGIN_SRC python :var data=myclocktable :results value
from string import Template
template="Total hours $total_hours"
template = Template(template)
total_hours = data[2][1].strip("*")
output = template.substitute({"total_hours": total_hours})
return output
#+END_SRC

#+RESULTS: print-hello
: Total hours 87:38


texts:
How do you tell display-buffer-alist to not display a buffer whose name has a particular string in it? The "Display Action Functions" documentation mentions display-buffer-no-window. However, I don't see this in the list of available functions when trying to customize display-buffer-alist through M-x customize-variable. The options I see are:

0 = --
1 = display-buffer-reuse-window
2 = display-buffer-pop-up-window
3 = display-buffer-same-window
4 = display-buffer-pop-up-frame
5 = display-buffer-use-some-window
6 = Other function

Choosing "Other function" and manually specifying display-buffer-no-window doesn't work either - that function does not exist. I am using emacs 24.3.


texts: Diff of two buffers without creating temporary files

texts:
I need the diff of two buffers.  One way would be to create temporary files containing the contents of these buffers and to use the diff function.  However, the buffers contain sensitive information and I'd prefer not to have that information in clear text on disk.

I thought about using ediff which can compare buffers directly but ediff starts an interactive session and I want to use this in a script.


texts: Getting uninstall packages offer after package updates

texts:
Each time I call up list-package and update, I get this message after the updates
Operation finished.  Packages that are no longer needed: 43.  Type ‘M-x package-autoremove’ to remove them

Below is my init.el concerning use-package
(require 'package)
(setq package-enable-at-startup nil)

(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, i.e., if use-package isn't installed
;;; then install it
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;;;This will ensure all packages are installed if not already
(require 'use-package-ensure)
(setq use-package-always-ensure t)

;;;This will make sure packages are updated
(use-package auto-package-update
  :config
  (setq auto-package-update-delete-old-versions t)
  (setq auto-package-update-interval 1)
  (setq auto-package-update-hide-results t)
  (auto-package-update-maybe))

I obviously don't want to uninstall all the packages on my system. What have I done wrong? A critique, please.
Update
Here's the package-selected-packages in my custom-set-variables(which is huge BTW).
'(package-selected-packages
   '(org-journal deft org-roam abyss-theme hindent shm ob-sml sml-mode org-num rdf-prefix ediprolog sparql-mode emacsql-sqlite emacsql-mysql emacsql ess json-mode ac-slime cmake-mode gnuplot flymake-css ac-geiser quack geiser elcord erc-hl-nicks diminish htmlize sudo-edit magit company-shell company-lua company-jedi company-irony company-c-headers flycheck-clang-analyzer company flycheck yasnippet org ox-tufte ox-twbs org-bullets popup-kill-ring zzz-to-char hungry-delete expand-region rainbow-delimiters rainbow-mode beacon mark-multiple avy helm linum-relative swiper switch-window which-key ivy symon fancy-battery spaceline dashboard projectile async pretty-mode zerodark-theme use-package))


texts: No native completion with python3 in Emacs 25.2

texts:
On Emacs 25.2 and Python 3.5 on an Centos-like Oracle Linux I have the issue that invoking a python shell gives me no completion. To reproduce, start

$ emacs -Q --eval '(setq python-shell-interpreter "python3")'

then execute

M-x run-python

This produces the warning

Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native’ was t and "python3" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.

It is the same problem as Your ‘python-shell-interpreter’ doesn’t seem to support readline, but:

1) I am already on Emacs version 25.2, so the fixfrom one answer does not help (because 25.2 contains the proposed fix).

2) I am on bash 4.1 and have no ~/.inputrc file, so the fix from the other answer doesn't help either.

How can I fix this?

Update:

On my MacOS machine the initialisation works correctly. However on MacOS I use Emacs 25.3.  Therefore I installed 25.3 (from source ) on the Oracle Linux system, too - the Python completion still fails, because of same above mentioned issue!


texts:
I want to compile my LaTeX files with emacs28.0.50. I was receiving the same error that is described in this question. I followed the instructions given in the accepted answer and now my init.el file looks like this -
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(auctex org)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(setenv "PATH" (concat "/Library/TeX/texbin:"
                     (getenv "PATH")))
(add-to-list 'exec-path "/Library/TeX/texbin")

I still get the same error. Have I done something wrong? If yes please let me know what exactly is wrong. Also I need to change the default compiler to LuaLaTeX. If somebody knows how to do it, please tell me.


texts:
In org mode, how does one insert a quotation in a table cell?

I know that #+BEGIN_QUOTE ... #+END_QUOTE is the way to go outside a table, but I can't find a way to use it inside a table cell.


texts: Sort lines omitting a prefix of a certain length?

texts:
Many of my python files have an import section that looks like this:
from   datetime import datetime, timedelta
from   typing import Callable
import numpy as np
import pandas as pd

I'd like to sort those lines by the library names. I'd like to run sort-lines but somehow tell it to overlook the first seven characters when assigning the order to a line, but to of course include those seven characters when it actually moves the line. That is, I'd like to end up with this:
from   datetime import datetime, timedelta
import numpy as np
import pandas as pd
from   typing import Callable


texts: I have a regular expression and an path, e.g. ("[Bb]ackup" . "/home/user/backup.org").  Now I want every substring in the buffer that matches the regexp to look like an org-link and to be clickable so that a click opens the file.  (I can't use actual org-links because it needs to work in non-org buffers as well.)  I know about make-button but I'd like links to be created (or removed) dynamically as I type similar to syntax highlighting.  make-button can't do that as far as I can see since you don't specify a regexp but the start and end point of the button in the buffer and you'd have to recalculate these yourself on each button press.  highlight-regexp looks close to what I want but afaics it only allows me to apply faces, so it can't make clickable links.


texts: Change the default mode used when opening a new buffer

texts: For example, we can open a new buffer with C-x b <new-buffer-name>, and by default, this new buffer opens in fundamental-mode, which is not very useful to me. I would like to change this to open all new buffers in org-mode. How can I do this?


texts: How can I recursively delete all empty directories?

texts:
That is, if I have

-empty-dir-a/
-nonempty-dir-a/
  -empty-dir-a/
    -empty-dir-a/
  file-a
file-a
file-b

I would like

-nonempty-dir-a/
  file-a
file-a
file-b

I'm aware that there are many OS-specific solutions to this, but I'd like to stick to elisp, ideally :).


texts: How do I exit a serial terminal buffer using keyboard?

texts:
I am using emacs for Windows.

I start a new terminal using serial-term.  Once in that buffer, I cannot open a minibuffer or use meta keys to escape this shell. The only way I can navigate out is using the mouse to click on the buffer I would like to switch to. Is there a keyboard command that can escape from serial mode?


texts: How to make org-babel-load-file use umlauts (åäö) correctly?

texts:
I have this in my init.el

(defvar dropbox-d "C:/Dropbox")
(defvar dropbox-emacs-d (expand-file-name "emacs" dropbox-d))
(org-babel-load-file (expand-file-name "config.org" dropbox-emacs-d))

In config.org I have, among other things:

#+BEGIN_SRC emacs-lisp
(use-package perspective :load-path "packages/perspective"
  :bind-keymap ("C-ä" . perspective-map)
  :config
  (persp-mode))
#+END_SRC

When config.org is converted to config.el, config.el contains this:

(use-package perspective :load-path "packages/perspective"
  :bind-keymap ("C-Ã¤" . perspective-map)
  :config
  (persp-mode))

Does anyone know why this character conversion happen? Both init.el and config.org are saved in utf-8 format. I have also tried adding the code below before loading config.org, and I have tried it with both the org-mode version shipped with emacs and the latest org-mode version.

(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(setq default-buffer-file-coding-system 'utf-8)
(prefer-coding-system 'utf-8)


texts: How to make swiper-helm to use helm layout?

texts:
I set this in helm

(setq helm-split-window-in-side-p nil)

This forces helm to use selected window for helm session like this(When point is in right split, helm buffer popped in left split only).

Now when I use swiper-helm, it doesn't honor this. It will open helm session in different split.

How can I make swiper-helm and all other packages which use helm as frontend (like helm-recent-dirs, helm-github-stars), to use custom helm config?


texts: Org mode exam template with question and results in combination with latex

texts:
I would like to use Org mode for creating exam questions and including the templates for the corresponding results for each question.
A general template is shown here
#+TITLE:     Lecture
#+AUTHOR:
#+EMAIL:
#+DATE:      Jan 2020
#+INSTITUTE: UoW
#+DESCRIPTION:
#+KEYWORDS:

* Fire Modeling
   :PROPERTIES:
   :andere_VL: Fire Modeling
   :END:
** Calculation 1
Please add $1$ and $2$ together.

*** Results
#+BEGIN_SRC python :session results: value
res =  1 + 2
res
#+END_SRC

#+RESULTS:
: 3

The results is \(1 + 2 = 3\)

*** Results - Variables
#+BEGIN_SRC python :session results: value
res =  variable1 + variable2
res
#+END_SRC

#+RESULTS:
: 3

The results is \(variable1 + variable2 = variableResults\)

** Calculation 2

This looks as a screenshot like:

The above example includes two sections for "results". In the first one the plain numbers are displayed for clarity (I hope). In the second section "Results - Variables" I try to show how the variables need to be accessed.
The idea is now that I am able to set and use variables in the actual text, which is then used for the python calculation. This would be step one.
And the next step would be to include the python result inside the resulting latex equation.
Update
Maybe a macro approach is suitable and convenient; a simple example is shown below:
** Calculation 2 - Macros
#+MACRO: var1 16
#+MACRO: var2 16
Please add {{{var1}}} and ${{{var2}}}$ together.
*** Results - Variables - MACROS
This works without {{{var1}}}, but only without math...!?

#+BEGIN_SRC python :session :results
{{{var1}}}
#+END_SRC

The corresponding screenshot is

This results as final tex in something like:
\subsection{Calculation 2 - Macros}
Please add 16 and \({{{var2}}}\) together.
\subsubsection{Results - Variables - MACROS}
This works without 16, but only without math\ldots{}!?

So this could be a good approach, when I can use it for the latex math enviroment and also within python src region.
Update -end
Does anyone have an idea how to achieve this? Maybe there exists already another add-on for this or similar task!? I would be happy about any kind of suggestion!
With jupyter there seems to be the option for the second part...


texts: Let's say that I am looking at my agenda view (C-c c a), where I usually mark items as DONE from there (by pressing  't' several times to run through all statuses). The thing is, the fist status is TODO and the last DONE. But how to set a CANCELLED status, for those that have been cancelled without having to delete it or mark them as DONE (which is not true)? Thanks!


texts: Difference between .emacs and init.el and the point of (not) keeping multiple init files

texts:
The Emacs manual often talk about init.el and .emacs interchangeably, generally referring to them as "the Init File" like so:

  When you start Emacs, it normally attempts to load your init file. This is either a file named .emacs or .emacs.el in your home directory, or a file named init.el in a subdirectory named .emacs.d in your home directory.

I try to put all my customization code into init.el because, according to this site, it is 'modern' and 'preferred':

  On linux and Mac, by default, emacs look for init file at

~/.emacs
~/.emacs.el
~/.emacs.d/init.el (this is modern, preferred, since ~2010)

I also try not to manually edit .emacs too often because there are custom-set-variables sitting in the file and there is a warning that says:

 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.

Other advantages of using the init.el over .emacs can be found here.

But I recently realize that some of the code I put in init.el have been left unevaluated when Emacs is restarted. So I have to call up the file and M-x eval-buffer every time I restart.

Therefore, I'd like to ask:

What is the difference between init.el and .emacs as far as
customization is concerned? (question has been partly answered here.)
What is the point of keeping two (or more) Init files when having one would do? Some people even talked about splitting init.el into different files, quoting lunaryorn on Reddit:

  It makes version control easier, especially if you split your init.el into different files in ~/.emacs.d.

What to do when (some) code in one of them are persistently left unevaluated?

Updates:

I've deleted .emacs and moved all its contents into init.el, but part of the code in init.el ,such as the one below, is still unevaluated everytime emacs restarts.

;;set Chinese table alignment font size

(set-face-attribute
 'default nil
 :font (font-spec :name "-*-Menlo-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1"
                  :weight 'normal
                  :slant 'normal
                  :size 24))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font
   (frame-parameter nil 'font)
   charset
   (font-spec :name "-*-STFangsong-normal-normal-normal-*-*-*-*-*-p-0-iso10646-1"
              :weight 'normal
              :slant 'normal
              :size 28)))


texts: How do I open a .gpg file from the command line?

texts:
I have a file located in the directory ~/myfiles/list.txt.gpg.

In the terminal, I type emacs ~/myfiles/list.txt.gpg and I get something that looks like this,
which I'm guessing is the still encrypted form of the file.

In order to get it to display properly, I have to M-x revert-buffer, then it will prompt me for the password and load it the file properly.

My question is: How can I get Emacs to recognize it is encrypted and prompt me for the password immediately instead of having to go through the trouble of pressing M-x and selecting revert-buffer?


texts: Problem with file-exists-p function on Linux running as VirtualBox guest

texts:
Until this morning, my emacs setup (running on Arch Linux as a VirtualBox guest) was working absolutely fine. Then for no obvious reason I started experiencing the following issue:

If I opened an existing file for edit and immediately typed C-x C-s, I would receive the following message:

Wrote <filename>

and this would happen every time I typed C-x C-s, without actually editing the file. Whereas it should simply say

(No files need saving)

After wasting nearly the whole day trying to fix the problem, including upgrading VirtualBox related packages, I narrowed it down to the operation of the emacs function file-exists-p which is being called by save-buffer -> basic-save-buffer. The issue is that while file-exists-p works correctly in that it returns t for files which are on my Linux file system, it returns nil for files which are on my Windows 10 host which are shared through VirtualBox, mounted using VirtualBox's mount.vboxsf. This in turn is causing the following additional prompt to be displayed any time I actually modify a buffer of a file I have already opened:

<filename> has changed since visited or saved. Save anyway? (y or n)

which of course it hasn't, but the code believes it has since file-exists-p is returning nil.

My question is why is file-exists-p behaving in this way? Is it a problem with the function itself, or some other problem perhaps with the way the mounting is working? Is there some way to determine where the problem actually lies, and most important of all, how to fix it?

I am running:

Windows 10 (as host)

VirtualBox 5.2.18 (with Virtual Guest Additions installed on guest)

Arch Linux (as guest, Kernel 4.18.14)

Emacs 26.1


texts:
need a little help here, my emacs is so slow if while writing go code, it look like it is stuttering.

On my observation, it happens because I have "not that" a lot folders in my src directory, most of them is just source of the installed packages and a few sample projects that I clone.

Then when I remove all the packages and just keep one sample project, It runs so smooth.

Please help how I can resolve this, thanks.

P.S. I am using spacemacs config


texts: Show READY items from org header in agenda

texts:
I have a situation where I have a lot of similar tasks under a header like so:

* Header
** READY Task 1
** NREADY Task 2
** READY Task 3
** READY Task 4
** NREADY Task 5

and so on. What I would like is to have the next READY task (the highest READY task under Header) appear in my agenda every other day or so. Is that possible?

Thanks in advance!


texts: ORGMODE Exporting to text without wrapping

texts:
As simple as that. Everytime I export from orgmode to text the lines are wrapped. How to disable this?

Thank you,

E.


texts:
Could someone here write a small Elisp function for me?

What I would like Emacs to do is the following: I have a region like this:

[0.04579]    [0.06569]    [0.09507]
[0.12696]    [0.27929]    [0.51505]
[0.27959]    [0.60903]    [ 0.8672]
[0.55241]    [0.89048]    [0.93582]
[0.0399]    [0.05806]    [0.08848]

and I want to delete the square brackets and all spaces, and insert & between the columns and \\ at the end.

0.04579&0.06569&0.09507\\
0.12696&0.27929&0.51505\\
0.27959&0.60903&0.8672\\
0.55241&0.89048&0.93582\\
0.0399&0.05806&0.08848\\

I have no idea about programming in Elisp (yet) and this function would make my life a lot easier right now. I tried defining some kind of macro with forward-word but that didn't work.


texts: Babel + Python function definition with for loop causes IndentationError

texts:
I am using orgmode and Babel to run Python source code blocks.
I noticed that if I define a function that returns a value, and if this function has a for loop inside it, then evaluating it with Babel leads to an IdentationError: unexpected indent.

For example, in org-mode write the following:

#+BEGIN_SRC python :results silent :session pysession
  def foo():
      for _ in range(1):
          pass
      return 1

  print(foo())
#+END_SRC

Then calling C-c C-c sends the code to the pysession buffer running the Python session, and it results in the error IdentationError: unexpected indent.

However, if we remove the for loop from the function definition, then things just work (prints 1):

#+BEGIN_SRC python :results silent :session pysession
  def foo():
      return 1

  print(foo())
#+END_SRC

Question: How to fix this behavior so that I can define functions with loops and have them work with babel?

Edit 1: The print can be removed from the code and the error still arises. The :results silent option is necessary since I do not want results in my org-file.

Edit 2: I noticed that when :results silent is selected and C-c C-c, it appears that Babel is sending the code line by line to the session, but when the line that contains the pass is send, Babel for some reason sends another RET, which makes the python REPL finish defining the function foo without any return statement. Then, when the line containing return 1 is sent, it is evaluated out of the scope of the function and causes the indentation error!!!

At this doc page it says:

  Session mode in python is slightly different from non-session mode ... blank lines are special: they indicate the end of an indented block

But in this case it is not working at all: there is no line between pass and return 1, but Babel is treating as if there was, since it is thinking the indented block is ended after pass.
It seems there is some bug with the backend.

When we use :results output, Babel actually saves the contents of the code block as is in a temporary file. It then reads the file and evaluates it in Python with exec. Since Python gets the entire code at once it works.

Thanks for helping!


texts: Open Ibuffer selected buffer in other existing window

texts: I tried everything but again I'm hitting a wall here. I have one frame split in the middle with a vertical line giving me a window left and right. Now I have Ibuffer open in the left window and I just want to press a key and the selected buffer should open in the right window WITHOUT opening another window. Whatever I do I either get Ibuffer to open the selected buffer in it's own buffer (pressing Return for example) or getting it to open it new window or frame. It seems impossible for it to open it in the already opened window on the right. I'm not a coder so I can't help myself using some lisp.


texts: Mode-line not updated after checking out new branch using Magit

texts:
I create and checkout a new local branch via magit. Pressing

M-x magit-status then
b c for branch create

and in the magit buffer I see the new name of the branch that I am apparently on. However my file buffer still shows the former branch name. Only if I reload the buffer content via C-x C-f the new branch is shown in the mode-line. Is this intentional or how can I change that?


texts: Non integer powers of 10 in algebraic mode in calc

texts: How should one type numbers like 10^(-2.5) using the 1e... notation in calc using algebraic-mode ? ATM, 1e-2.5 is parsed as (1e-2)*0.5 and indeed evaluates to 5e-3 instead of 3.16e-3.


texts:
I'm using Org mode 9.2.3 and Emacs 26.2.

When I try to execute all source blocks of an org document with org-babel-execute-buffer (bound to C-C C-v b), I always get the following error message:

  Symbol's definition function is void: org-outline-overlay-data

I'm not sure I'm uderstanding. According to the release notes of Org mode 9.2, this function has been removed and replaced by org-save-outline-visibility.

Is this a bug I should report, or am I missing something?

Thanks!

EDIT: The org package has been installed through the Package Menu Buffer, using the GNU repository. I could indeed have two versions of org that are in conflict, since I can see that both org 9.1.9 ('built-in') and org 9.2.3 are displayed in the package menu buffer.


texts: Why does magit give so many "reverting buffer" messages?

texts:
I am still very much a beginner when it comes to version control, and am using magit.

It seems like committing changes (frequently but not always?) triggers "reverting buffer" messages, one for each open buffer in the relevant repository. I panic every time I see one of these messages, thinking I lost the changes I just reviewed and/or committed. I don't really understand why there would be anything to revert. As far as I can tell my buffer should not have changed simply because I made a commit. I didn't kill a hunk, checkout a different branch or anything like that.

Assuming this sounds like normal behavior and not a bug related to my configuration, can someone explain what is happening?
And assuming its safe and reliable, is there a way to turn those messages off except when the buffer really has been changed?


texts: Smart-mode-line: Different colors for active and non active windows

texts:
Windows 10, Emacs 25.1

Here my mode line with 3 windows.

As you can see the mode line for active window (text.html) has more lighter color. And two another non active windows has more darker color for mode line.

Now, I want to try package smart-mode-line: https://github.com/Malabarba/smart-mode-line

Is a possible to have different colors mode-lines for active and non active windows?
I want to set my custom colors for active and non active mode-lines.


texts:
I'm scratching my head on this problem, but I cannot seem to use magit on a project served over plink or plinkx on Windows.
What does work:

The windows client can use magit on a project stored locally (e.g. from C:\)
The windows client can connect fine to the remote project (dired works, as does find-file)
A WSL2 Emacs instance works fine from the same laptop, only using ssh instead of plink

What happens when I try using plink(x):

In a file in a git repository, I run magit-status
Instead of the normal buffer, I'm asked for the "Git repository:" in the mini-buffer. The value defaults to the current directory.
Whatever I try as a value for "Git repository", I'm presented with "Create repository in $FOO? (y or n)
If I select y I'm told "Not inside git repository"

Does anyone have any idea what's going on? I'm running GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21 according to (emacs-version).
It's not a deal-breaker to me as I'm using WSL2 and an X-Server, but I'm curious and hopefully this will help my understanding of both TRAMP and magit, so any tips appreciated.


texts: Ubuntu, Doom Emacs: fails to run /bin/doom

texts:
I am trying to install Doom Emacs. I have installed all dependencies but when I run installation command I get this:

~/.emacs.d/bin/doom install

Cannot open load file: No such file or directory, mule-util

Does anyone know why this happens and how to fix it?


texts:
My echo area blinks whenever I move the cursor up to end-of-buffer or beginning of buffer:

This happens even when I comment out everything in my .emacs file.  Where does this feature come from and how do I remove it?


texts:
I want to list all items with specified TODO and then export into html.
 C-c a T is used, but it only shows the headlines such as

TODO 1
TODO 2
...

How can I show that:

TODO 1
blablablabla
....
TODO 2
blablablabla
...

Also I use C-c / T, but when I export to html, it exports all items.


texts: Regular expression to match text within quotes

texts:
I have a text like this:

''Lorem ipsum'' dolor ''sit amet, '' consectetur adipiscing elit.

What I want is to get the sit amet correctly wrapped around with '', like this:

''Lorem ipsum'' dolor ''sit amet'', consectetur adipiscing elit.

The problem is that my regular expression selects this:

''Lorem ipsum'' dolor ''sit amet, ''

instead of just this:

''sit amet, ''

and, if that is the case, the text selected is not the text I want to correct. Any help?

EDIT

Sorry, yes, indeed I didn't provided any regexp. The thing is I'm using visual-regexp and visual-regexp-steroids, in other words I'm using the regular expression engine(?) that comes with Python. That's why I didn't provided any.

The regexp ''([^']+), '' works ok (I still have to check the entire 11MB of text) as suggested by mbork.


texts: How to get the error id of a given line in flycheck?

texts: I would like a function to return the flycheck error id for the piece of code my cursor is over. Pylint is my main interest.


texts:
I have a tree of deeply nested keymaps, with many possible leaves (commands), too many for a human to remember. For simplicity, let's say each command is associated with a given file name.

I would like to display a help tool-tip as the user is walking down these keymaps, indicating which files/commands are bound to which keys.

So, I would like to associate with certain keymaps a short documentation, and display it whenever the user is "on" the keymap (perhaps using help-fns+.el or some other custom docstring).

What is the best way of doing this?


texts: How do I preview latex math in org mode without generating image files?

texts:
So when I preview latex in emacs org, there will be a sub-folder itximg generated in the same folder as the .org, containing the image files.

My question is can org mode preview latex math without generating .png, .svg and alike? Those image files can be large and can clutter your folder.

For example, when atom (or many other text editors) preview markdown no extra image files are generated. Although I don't know the details of how that works behind the scenes.


texts: How can I let the cursor colour depend on the current input method?


texts: How to toggle company-mode with $ prefix?

texts:
When I write JavaScript code, company does not toggle when prefix is $, how to fix it?
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 0)
(setq company-auto-complete t)
(setq company-require-match nil)


texts:
How do I specify a quote in org-mode, so that it is rendered nicely in github? In markdown it is rendered like so:

  Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.
  - albert enstein

thanks in advance.


texts: How to use org headers as filenames in tangle

texts:
In org mode, how can I tangle to files equally named as the org header?

Referring to the examples below, I'd expect two files foo.sh and bar.sh as tangle result:

* foo
#+BEGIN_SRC sh :tangle yes
ls
#+END_SRC

* bar
#+BEGIN_SRC sh :tangle yes
ls
#+END_SRC


texts: Accessing properties in org-babel source code blocks

texts:
noweb expantion is a very nice tool but it generally allows one to refer to other src-code blocks:

#+NAME: hellomessage
#+BEGIN_SRC emacs-lisp
"hello"
#+END_SRC

#+BEGIN_SRC emacs-lisp :noweb yes
(message <<hellomessage>>)
#+END_SRC

works perfectly. But it is reasonable to want to do template expansion with properties. I would like something like this to work:

#+PROPERTY: hellomessage hello

#+BEGIN_SRC emacs-lisp :noweb yes
(message "<<hellomessage>>")
#+END_SRC

or

* Example
  :PROPERTIES:
  :hellomessage: hello
  :END:

#+BEGIN_SRC emacs-lisp :noweb yes
(message "<<hellomessage>>")
#+END_SRC

but it doesn't since noweb seems only to expand named source blocks.
Is there any way to do this?

I have thought of using header arguments with the var keyword but that seems somewhat artificial since the property then is "specific" to src blocks. I would like to avoid this since I would also want to use the property in the normal org-mode way.

Similarly to what Ixemad suggested I tried doing this

* Example
  :PROPERTIES:
  :hellomessage: hello
  :END:

  #+NAME: get_property
  #+BEGIN_SRC elisp :var prop=""
    (org-entry-get nil prop t)
  #+END_SRC
  #+RESULTS: get_property

  #+BEGIN_SRC emacs-lisp :noweb yes
    (message "<<get_property("hellomessage")>>")
  #+END_SRC

  #+RESULTS:
  : hello1

but the problem is that the org-entry-get gets evaluated where the get_property code block is defined, not where it is called as seen by the following example

* Example1
  :PROPERTIES:
  :hellomessage: hello1
  :END:

  #+NAME: get_property
  #+BEGIN_SRC elisp :var prop=""
    (org-entry-get nil prop t)
  #+END_SRC
  #+RESULTS: get_property

  #+BEGIN_SRC emacs-lisp :noweb yes
    (message "<<get_property("hellomessage")>>")
  #+END_SRC

  #+RESULTS:
  : hello1

* Example2
  :PROPERTIES:
  :hellomessage: hello2
  :END:
  #+BEGIN_SRC emacs-lisp :noweb yes
    (message "<<get_property("hellomessage")>>")
  #+END_SRC

  #+RESULTS:
  : hello1

The second result should have been hello2.


texts: How can I press a key combination including CTRL and ALT_GR on a Swedish keyboard?

texts:
I am running Emacs (26.1 - build 1, x86_64-w64-mingw32) on Windows 10 and I cannot type any key combination including CTRL and ALT_GR on my swedish keyboard.

I stumbled on this when I tried to use the C-M-\ (indent-region). But after some testing it seems the problem occurs with any combination including CTRL and ALT_GR.
Alot of characters on the Swedish keyboard is mapped to ALT_GR combinations, e.g. to type $ I press ALT_GR-4 and for \ I press ALT_GR-+.

So in Emacs CTRL-h k gives this result:

CTRL-$ (CTRL-ALT_GR-4) => "$ runs the command self-insert-command..."
CTRL-META-$ (CTRL-ALT-ALT_GR-4) => "M-$ runs the command ispell-word..."
CTRL-\ (CTRL-ALT_GR-+) => "\ runs the command self-insert-command..."
CTRL-META-\ (CTRL-ALT-ALT_GR-+)"M-\ runs the command delete-horizontal-space..."

So it seems like the CTRL key is lost when ALT_GR is also pressed.
How can I solve this?


texts: How to make Org lists show collapsed by default?

texts:
Simple question:  How to make list show collapsed by default?
It's very annoying to find the lists uncollapsed and visually not pleasing everytime I open a buffer full of lists.

Another thing is that lists must be collapsed one by one... so it'd be handy to know a function or a #+STARTUP property for the buffer in question that would fix this for the lists appearing in that buffer.


texts: How to make *Shell Command Output* buffer scroll to the end?

texts:
I often execute shell commands via M-! and their output is then shown in the buffer *Shell Command Output*. How can I make this buffer display the end (rather than the beginning) so that I can see whether the shell command successfully terminated?

I saw here that when compiling via M-x compile, one can use (setq compilation-scroll-output t) to display the end of the compilation buffer. That behaviour would be great for *Shell Command Output*.


texts: why does this function return integers instead of `t` or `nil`

texts:
Why does this function print non-zero integers on non-empty lines?

;; taken from https://emacs.stackexchange.com/a/16826/10896
(defun current-line-empty-p ()
  (interactive)
  (setq answer (string-match-p "^\\s-*$" (thing-at-point 'line)))
  (message "%s" answer)
  answer)

I would like the answer to be displayed as t or nil. But on a non-empty line, it prints 35 or some other non-zero integer depending on which line  I called it via M-x. On blank lines it prints 0.

Sure non-zero means false and zero means true but I am curious why this behaviour happens? I would have thought string-match-p already returned booleans.


texts: Using font-lock with custom faces in nXML mode

texts:
I am trying to view XML files in Emacs, but I am not seeing any font highlighting.  The entire document appears as white on black (which is my default font).  The following note appears on the EmacsWiki page for nXML:

  Note the colorization (font-lock) won’t work if you change the emacs
  colors.

But there is no additional explanation.  I verified that if I start emacs as emacs -Q somefile.xml, I will in fact get font-lock highlighting that works how I would expect.  That is, the element tags are displayed in a different color from the element text.  Why does font-lock seem to go away when I apply a custom theme?


texts: org babel eval with no confirmation is explicit: :eval yes

texts: According to fniessen's babel reference I should be able to set :eval yes on a babel header line to make a source block evaluate without confirmation. However, this doesn't seem to work for me on Emacs 24.4 and Org 8.2.10.  Is this capability only available in org version 8.3 and beyond? If not, what do I need to do to enable it?


texts:
I'm helping a visually impaired user make viewing documentation in Emacs easier. He sets his font size such that he has about 40 columns of text in a full-screen frame with no splits (and he has configured Emacs never to split the window). At that size, line-wrapping (either the default or visual-line-mode) results in awkward gaps that make the text more difficult to read. Setting and appropriate fill-column and running fill-paragraph results in much more readable formatting, and so I tried to write some functions to do this automatically.

;; function to set the fill
(defun my-auto-set-fill-column ()
  "Always set fill-column to window width."
  (let ((inhibit-message 1)
        (width (/ (window-body-width nil t)
                     (window-font-width))))
    (set-fill-column width)
    (set-default 'fill-column width)))

this utility seems pretty straight-forward, but I'm happy for any suggested improvements.

 Function to format help pages.
;; You can call this with `M-x
;; my-format-doc-width' if you find
;; a help page that has wrapped
;; badly. With the hook below this
;; should be automatic.
(defun my-format-doc-width ()
  "Format documentation to window width."
  (interactive)
  (with-selected-window
      (get-buffer-window "*Help*")
    (read-only-mode -1)
    (my-auto-set-fill-column)
    (mark-whole-buffer)
    (call-interactively 'fill-region)
    (read-only-mode 1)))

I think this is also straight-forward, but happy for any suggestions.

(add-hook 'help-mode-hook
          '(lambda()
             (run-at-time
              (if (get-buffer-window "*Help*")
                  0 0.5) nil
              'my-format-doc-width)))

This feels pretty bad. Since the hook apparently runs before the window is actually created I have to put it on a timer. But of course I don't want to wait if the *Help* window exists already... Again, suggestions are welcome.

As you can see, my Emacs lisp is not strong and I suspect there are some obvious improvements that could be made to the implementation. More fundamentally, is this a reasonable general approach, or is there a better way to go about it? Something like (setq help-buffer-reformat-automagic 1) that I missed?


texts: Exclude completed deadlines from orgmode's ical export

texts: I have enabled the inclusion of deadlines in the ical export of orgmode by setting the preference org-icalendar-use-deadline '(todo-due event-if-todo). How can I exclude an orgmode heading from exporting when it is marked as done? At the moment my calendar is cluttered with completed tasks.


texts:
Say that you have the following JavaScript map literal

{a: 1,
 aoeu: 2}

and want the values aligned for readability like

{a:    1,
 aoeu: 2}

Is this possible to do with emacs? I'm currently using js2-mode and M-x align does nothing. M-x align-regexp can in some cases be used when the values all begin with the same prefix or like in this case when they're all numbers, but I've yet to find a generally applicable regexp.


texts:
I'm editing an XML with nXML-mode. The file represents a document and has internal links of the form:

Follow <linktag docref="foo">this link</linktag> to
see <anchortag docref="foo">this text</anchortag>.

where linktag is one of toc1, toc2, toc 3, a, and anchortag is one of document, page (possibly others, I'd need to check).

What would be a good way to navigate between back and forth between an anchored text and the various links that point to it ?


texts:
§12 Skeleton Language lists, as an element of a skeleton input list,

skeleton
  Subskeletons are inserted recursively, not once, but as often as
  the user enters something at the subskeletons interactor. Thus there
  must be a `str` in the subskeleton. They can also be used
  non-interactively, when prompt is a lisp-expression that returns
  successive list-elements.

As seems to be common in the skeleton documentation, the terminology is obscure and self-contradictory.  I've tried various ways to realise the structure described, but none of my attempts have worked.  Here is one of them:
(define-skeleton _skel
  "Test skeleton"
  nil
  ('("Seventeen" "Nineteen") "Should be two values, 17 and 19:" str \n))

Invoking _skell results in "Should be two values, 17 and 19:" appearing in the buffer, and an error of setq: Wrong type argument: stringp, ("Seventeen" "Nineteen") appearing in the message buffer.
What am I missing to make this use of subskeletons non-interactively, with either static values or a dynamic lisp-expression returning the values?
Thanks!


texts: Customize org-mode state change logging text

texts:
How can I edit the format of the org-mode state change logging text? Specifically I'd like to be able to log with a timestamp excluding the time like

- State "DONE"       from "TODO"       [2019-05-14 Tue]

It currently writes something like

- State "DONE"       from "TODO"       [2019-05-14 Tue 12:00]


texts:
I need to indent my code with (add-hook 'php-mode-hook 'php-enable-symfony2-coding-style) but using tabs for indenting (and spaces for aligning, see https://www.emacswiki.org/emacs/SmartTabs). Apparently the coding styles of php-mode overrides emacs tab settings, because I have the next code in my emacs init file, but the spacebar indenting prevails nonetheless:

(setq tab-always-indent 'complete)
(setq-default indent-tabs-mode t)
(setq indent-tabs-mode t)
(setq tab-width 4)

Tabs were working before using php-mode.

Example of the indentation I use:

// Indenting with tabs
if (false
    || true
    || true
) {
    $hi = [
        'la',
        'do' => 5,
    ];

    $foo
        -> mi(
            54,
            57
        )

        -> fa()
    ;
} else {
    $lala =
        (new lala)
            -> hey()
            -> ho()
    ;

    $sup = work([
        'it' => 1,
        'faster' => 6,
    ]);

    // Aligning with spaces
    $a··· = 1;
    $ab·· = 2;
    $abcd = 4;
}

I am using (add-hook 'php-mode-hook 'php-enable-symfony2-coding-style) because it is the most similar amongst the php-mode available styles. Maybe I should turn off php-mode indentation and use other indentation?


texts:
I am viewing a large file (512 MB) with vlf-mode. How can I delete from a point of the file to the end?

The standard approach of selecting the text from a point to the end and then deleting it does not work.
In fact, the file is subdivided in many sub buffers, 512 in my case, and so I am not able to extend the selection between these sub buffers.

UPDATE: Actually, if I try to delete a single character and then I save the file, nothing will be saved! So I have got even a bigger problem


texts: Stuck projects: how to skip timestamps in the future?

texts:
I want to have a stuck projects list that shows me headlines that:

Do not have a child item that is either NEXT or WAIT
Do not have a child item with a timestamp that is in the future

The current definition for the stuck block in my org-agenda-custom-commands is this:
(stuck ""
       ((org-agenda-overriding-header "Stuck projects")
        (org-agenda-files (list "~/org/gtd/projects/"))
        (org-stuck-projects '("+LEVEL=1/-DONE" ("NEXT" "WAIT") nil nil))
        (org-agenda-skip-function '(org-agenda-skip-entry-if 'timestamp))))

There are 2 problems with my current definition:

The org-agenda-skip-function does not seem to do anything at all (changing from 'timestamp to 'nottimestamp for example does not seem to make a difference)
Were the skip function to do anything, it would probably also count dates in the past, not in the future

How do I get a list of stuck projects that do not have a NEXT, WAIT, or timestamp-in-the-future child?


texts: ERT: should-error doesn't catch failed assertions

texts:
Today I'm trying out ERT for the first time.

(should-error (/ 1 0))

This works and returns (arith-error) as expected.

(should-error (cl-assert nil))

The assertion escapes the should-error and causes a stack trace.

What's the appropriate thing to do if I want to test code that uses cl-assert?


texts: Designate a speficied day of 20 days later

texts:
Strike "C-u C-c ." to insert the current datetime,

  <2020-03-25 Wed 09:56>

How could I designate a accurate day of 20 days later,
Currently, I  invoke "Shift+ right-arrow" step-move the the day of 20 days later.

Is it possible to insert a future day with a method of "+20d"?


texts: How to programmatically surround a string with escaped double-quote

texts:
It seems that my question should be common knowledge, and I thought I knew it (at some point in the distant past), but the answer escapes me tonight.  I'd like to take a string like "foo" and programmatically convert it to "\"foo\"".  Is there a built-in function for that?

I realize I can (concat "\"" "foo" "\""), but I thought there is probably an existing function that does this.


texts: After modifying multiple files, how can I save all their buffers?


texts:
I am running emacs on Windows. I am trying to change the bullet face of org-bullet. Now it looks like this:

I did several search and changed my default font to several different types but the problem persists.
Now I have changed my emacs font to:
(set-frame-font "Inconsolata Regular" nil t)

Basically, "◉" gets displayed to the one showing on my screenshot. Any suggestions on how to fix it? Ideally I just to want to display better bullet without change my gloabal font.


texts:
I new with elpa/melpa, and can not understand:
should package (installed from melpa repository) be autoload by emacs during start or not?

I install 'company' from melpa repo, and (require 'company) in my ".emacs" failed:
LANG=C emacs --debug-init show such error:

  Debugger entered--Lisp error: (file-error "Cannot open load file" "No such file or directory" "company")
   require(company)
   eval-buffer(# nil "/home/user/.emacs" nil t)  ; Reading at
  buffer position 9609

position 9609 is exactly where (require 'company) ends.

At the same time, when I install "magit" from melpa, all work fine without ".emacs" modification.

So after I install something using M-x list-packages and restart emacs, should
installed package be autoload by default?
If they should be autoload, why company have different behavior?

I used GNU Emacs 24.5.1


texts: Is there a way Emacs can infer is running on WSL (Windows Subsystem for Linux)?

texts:
I would like to identify when Emacs is running on WSL (Windows Subsystem for Linux).
Normally I use system-type variable to check if Emacs is on Linux, Windows or MacOS X.
Though in this case it returns gnu/linux:

system-type is a variable defined in ‘C source code’.
Its value is ‘gnu/linux’

Documentation:
The value is a symbol indicating the type of operating system you are using.
Special values:
  ‘gnu’          compiled for a GNU Hurd system.
  ‘gnu/linux’    compiled for a GNU/Linux system.
  ‘gnu/kfreebsd’ compiled for a GNU system with a FreeBSD kernel.
  ‘darwin’       compiled for Darwin (GNU-Darwin, macOS, ...).
  ‘ms-dos’       compiled as an MS-DOS application.
  ‘windows-nt’   compiled as a native W32 application.
  ‘cygwin’       compiled using the Cygwin library.
Anything else (in Emacs 26, the possibilities are: aix, berkeley-unix,
hpux, usg-unix-v) indicates some sort of Unix system.

Which is what it is expected, though...
I want to add a specific check to use the Windows native browser, not the one on WSL.
I currently do that setting:

(setq browse-url-browser-function 'my-browse-url-function)

But I only want to do this in WSL, not in real Linux.
Is there a way to do it?


texts: Extracting TODO items from .org file for display

texts:
I'd like to extract open TODO items from my agenda so I can display them somewhere prominent. I'm thinking maybe Conky and put it on the desktop, or put a TODO counter on my task bar, something like that.

What are my options? Are there any useable parsers outside of Emacs? Has someone come up with a fancy incantation of grep?


texts: Manually installed pdf-tools breaks package handling because it is not recognized as a dependency

texts:
The situation is:

I install pdf-tools manually and load it with the following snippet:

(use-package pdf-tools
   :pin manual
   :load-path "my/load/path/to/the/git/repo/lisp"
   :config
    ....stuff...)

Everything works fine, and I am happy with this setup. But....

The problem is:

I cannot install any package which depends on pdf-tools, since the package manager does not recognize it as being installed. Thus, M-x package-list-packages lists me quite a bunch of packages which are "incompatible" because they depend on pdf-tools. But it is there!

How can I convince the package manager to install these packages?

EDIT:

I've tried the answer given to this very similar question and added pdf-tools to package--builtin-versions. Still not available for the package manager, the other package depending on it is still blocked.


texts: Shift times in org agenda by minutes or hours instead of days

texts:
In an org-mode agenda, how can I shift the time of an item by minutes or hours?

Shift - Right Arrow shifts by one day, but I want to shift by hours or minutes.


texts: Why can't Emacs get a font that it can list among the fonts?

texts:
When I list the fonts in my Emacs using the following code:

(dolist (font-name (x-list-fonts "*"))
  (let ((str font-name))
    (newline)
    (prin1 str)))

One of the fonts I get is:

"-outline-SimSun-ExtB-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1"

but when I try to evaluate the following, using font-spec and the above font specification:

(font-spec :name "-outline-SimSun-ExtB-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1")

Emacs gives the following error:

Debugger entered--Lisp error: (error "Invalid font name: -outline-SimSun-ExtB-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1")
  font-spec(:name "-outline-SimSun-ExtB-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1")
  eval((font-spec :name "-outline-SimSun-ExtB-normal-normal-normal-mono-*-*-*-*-c-*-iso10646-1") nil)
  elisp--eval-last-sexp(t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  funcall-interactively(eval-print-last-sexp nil)
  call-interactively(eval-print-last-sexp nil nil)
  command-execute(eval-print-last-sexp)

This is weird, because Emacs complains about a font name being invalid that is obviously in the list of (x-list-fonts "*").

I mean, I tested it with other values from that list and font-spec worked as expected, e.g.

(font-spec :name "-outline-SimSun-normal-normal-normal-*-*-*-*-*-p-*-iso10646-1")
#<font-spec nil outline SimSun nil iso10646-1 normal normal normal nil nil 0 nil ((:name . "-outline-SimSun-normal-normal-normal-*-*-*-*-*-p-*-iso10646-1"))>

Why is that?

My Emacs version is 27.0.50, and I'm trying these on MS Windows 10.


texts: How to get rvm to work with projectile-compile-project and shell-command (Emacs macOS GUI)

texts:
I'm using the exec-path-from-shell package to copy my environment variables, including PATH. But shell-command (M-! which ruby RET) only finds the system ruby, not my user-local rvm ruby.
Similarly, when I switch to a project using projectile and invoke  projectile-compile-project (C-p c), the usual compilation command to build my website doesn't work, e.g.: "bundle exec nanoc compile"
It tries to use the system ruby:
-*- mode: compilation; default-directory: "~/Sites/christiantietze.de/" -*-
Compilation started at Sun Aug  2 12:23:46

bundle exec nanoc compile
Traceback (most recent call last):
    2: from /usr/bin/bundle:23:in `<main>'
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /Users/ctm/Sites/christiantietze.de/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.1.4`

Compilation exited abnormally with code 1 at Sun Aug  2 12:23:46

The only way I found to use rvm from within emacs to do anything at all for me is to change the shell command to:
rvm default do bundle exec nanoc compile

So the rvm function is available and loaded in the shell; it's just that the PATH doesn't appear to be updated.

which ruby within shell returns /usr/bin/ruby
which ruby within eshell correctly returns /Users/ctm/.rvm/rubies/ruby-2.7.1/bin/ruby
(getenv "PATH") leads with "/Users/ctm/.rvm/rubies/ruby-2.7.1/bin", so the emacs environment should work
(getenv "SHELL") and shell-file-name report "/usr/local/bin/zsh"  (explicit-shell-file-name is nil, but changing it to the same path didn't help, either)

Is there a way to make the regular emacs shell commands (and thus projectile) aware of the stuff that eshell knows?


texts:
Does anyone know of a quick method to get hexadecimal line numbers in emacs?
I am using linum for line numbers. I suppose I could hack it, but just thought to ask first.


texts:
I have been using Emacs for one week, so all of it is really new for me.

I saw that there are two types of commands in order to navigate in emacs :
- Some "tabs" on the top
- Commands like shortcuts

Nevertheless, my tabs are missing.
Do you have a clue how to activate them ?


texts: View code with different indentation than saved to disk

texts:
I work on some projects with indentation styles that I find really irritating.  I'd like to view the code with a certain indentation style, but always save to disk with the prescribed indentation style.

Specifically,  I like emacs default style of indentation on multi-line function arguments...

void foo(int a, int b,
         string c)

But the project is tab-only, single indent on everything...

void foo(int a, int b,
    string c)

Can I see the first case, but share the second?


texts: Is there a way to set different background colors based on buffer name / file path?

texts:
I'd like to have a visual marker that is impossible to miss to show when I am viewing a file under a particular directory. Just having the path in the modeline is not enough to avoid confusion sometimes.
For example, if I use git worktree and am viewing two versions of the same file from different worktrees, I need to avoid confusion.
I'd like to have the background color set slightly differently based on the filepath - I'd be fine setting it manually.
I don't see a way to have the color different on a per-buffer basis, is there a way?


texts: Jupyter notebook, matplotlib visualization not showing up

texts:
I am a new Emacs user and proceeded to the install following the tutorial at: https://realpython.com/emacs-the-best-python-editor/#integration-with-jupyter-and-ipython. Now I am running a Jupyter Notebook, again as described in the link above, but I am getting the following error:
 ein:cel--append-mime-type no viewer found in mailcap

Do you have any idea what I should do? I tried to solve it using https://github.com/millejoh/emacs-ipython-notebook/issues/671 but couldn't find the recommended fix (customize-group-ein-image on) to run.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()
plt.show()

For information, I am running Emacs on Windows 10


texts:
How to insert and right-align text that is not of the default font size?
This doesn't work:
(let* ((text "abcd")
       (len (length text)))
  (insert
   "\n"
   (propertize " " 'display `((height 0.5) (space :align-to (- right (,len . width)))))
   (propertize "12345" 'font-lock-face 'error 'display '(height 0.5))
  "\n"))


texts: How to make sh-set-shell insert "#!/bin/sh" instead of "#!/usr/bin/sh"

texts: When I open a shell script (e.g. emacs myscript.sh) and do C-c : (M-x sh-set-shell), and select sh as the shell, Emacs will insert a #!/usr/bin/sh shebang instead of #!/bin/sh. I want Emacs to insert #!/bin/sh instead of #!/usr/bin/sh. I realize that Emacs is probably behaving like this because /usr/bin comes before /bin in my shell's PATH. What are some ways to prioritize the /bin directory only when running sh-set-shell?


texts: Disabling hanging indentations with fill-paragraph

texts:
I want to be able to fill a whole paragraph with fill-paragraph, first line included, between the left-margin and fill-column values (adaptive-fill-mode is disabled).

I am able to do this, but I noticed that if the first line has an hanging indentation (meaning it has a different indentation from the left-margin variable), I am unable to remove it, unless I manually go to the first line, removing it. I want to be able to remove the hanging indentation by just running fill-paragraph.

Example of hanging indentation, considering left-margin equal to 0:

  this is an example
of an hanging indentation
in a paragraph.

What I want to happen when I run fill-paragraph:

this is an example
of an hanging indentation
in a paragraph.

But I am unable to recreate such a behaviour. The documentation on the topic barely mentions hanging indentations, and is not helpful on how to disable them.


texts:
Is there a package that helps me to choose a predefined layout for an arbitrary number of windows in a frame? I would be perfect if it works in a similar way to the select-layout function in tmux.

EDIT

Here is a gif showing how tmux switches between different layouts


texts: Custom behaviour when exporting links (org-export)

texts:
When org-mode html export parses an .org file and encounters a link to an image, as for example [[file:/Users/user/nice_image.png]], it properly converts the link into an html figure.

I'd like to extend that behaviour to other image formats that aren't currently supported by org's publishing facilities.

To be more specific, if my .org file contains a link to medical images in, e.g., DICOM format, I'd like org-mode to

recognise that the link is pointing to a DICOM,
run a shell command that creates a PNG file from the DICOM,
export an html figure as if the link would've been pointing to the PNG file all along.

Does anyone know how to do that?


texts: how to convert emacs org outline with clock entries to csv file

texts:
Newbie Emacs org question.

Wanted to export my tasks into a CSV reading spreadsheet program. How would one do that? If it is in the manual, could please point me to it?

Sample:

* A
** A1
   CLOCK: [2015-08-01 Sat 19:33]--[2015-08-01 Sat 19:33] =>  0:00
* B
* C
** Ok something about C
   CLOCK: [2015-08-01 Sat 19:35]--[2015-08-01 Sat 19:36] =>  0:01

#+BEGIN: clocktable :maxlevel 2 :scope subtree
#+CAPTION: Clock summary at [2015-08-01 Sat 19:36]
| Headline                   | Time   |      |
|----------------------------+--------+------|
| *Total time*               | *0:01* |      |
|----------------------------+--------+------|
| \emsp Ok something about C |        | 0:01 |
#+END:


texts: What's the best API to use to interrogate the size of the underlying window system?

texts:
I'm currently working on using the crouton xiwi X windows target to run an Emacs session on a Chromebook. I've done this by starting Emacs as the last entry in .xinitrc making it effectively the window manager for the session. Despite having the frame configured to be fullsize it's not using the full width of the display (which can be resized dynamically).

Is there native support in Emacs for querying the host X session display size or do I need to resort to shell script calls to extract the data?


texts: Rename multiple files from a predefined directory to another directory

texts:
I want to have a function, which moves a file or optionally multiple marked files from one directory to a different directory in some parent folder.
I managed to design a script which does the main things:

(defun multiple-rename (candidate)
(loop for cand in (helm-marked-candidates)
      do
      (spacemacs/rename-file cand)))
(defun move-from-downloads ()
  "helm interface to copy files from downloads"
  (interactive)
  (helm :sources `(
                   ((name . "My org files")
                    (candidates . ,(f-entries "~/Dropbox/Documents"))
                    (action . (("Rename" . multiple-rename))))
                   )))

The feature which is not present yet, which I would like to have is having some specified parent folder path for a target directory of renaming.

In other words, spacemacs/rename-file takes the file to rename as an argument and if it is not getting an a second argument which is here the case put up the prompt to select a filename where the files should be moved, the path in this prompt is however the path of the current buffer. Instead I would like to have the default path, which pops up in the prompt for renaming to be something different, e.g. home/mydefaultrenamepath. Would be happy to hear some solution, it doesn't need to use spacemacs/rename file, only the flow of having helm candidates to select and then standard directory to move files into (which should be able to be altered).


texts: Why does `text-scale-increase` not affect `window-text-width`

texts:
I am trying to calculate how many characters are being displayed in a window, but the information I get from (window-text-width) isn't updated if I call (text-scale-increase). Why?

A typical session might be

(window-text-width) ; => 90
(text-scale-increase 1) ; => t
(window-text-width) ; => 90


texts: How can I make `string-rectangle` show the changes I'm about to make to the buffer?

texts:
For a while, I was building prerelease versions of 24.4. One of the features that I liked was that when I used string-rectangle (via C-x r t), the string that I was typing showed up live in the buffer. This let me see what I was changing in context.

However, when I upgraded to the release version of 24.4, that functionality disappeared. I gave a quick look at rect.el, but I didn't see any appropriate variables that might help. Is there a way of enabling this feature again?


texts: Switching Emacs server's socket without leaving existing emacs gui

texts:
I would like to switch between emacs socket without leaving the GUI. I am able to start two emacs daemon session by doing the following:

In xterm1:

emacs --daemon="one"

In xterm2:

emacs --daemon="two"

By doing this, I can group all the file buffers and ansi-term by projects in each emacs server. However, are there any way to switch between daemon one and daemon two (the help page use the term "socket") within the Emacs without leaving the GUI?


texts: How to show C/C++ doxygen section titles in the mode-line?

texts:
For C/C++ code that use doxygen sections, it would be useful to show these in the mode-line, without slowing down the mode-line display significantly.
Is there a good way to add context information to the mode-line?


texts:
How to walk through code blocks under a narrowed subtree?

Which function(s) should I use to achieve that?


texts:
I'm trying to customize the fill-column value for org-add-note when adding notes to an Org TODO (e.g., C-c C-z).

I have tried to add the following to the org-add-note function (this seems reasonable from the add-hook documentation).

(add-hook #'org-add-note (lambda () (setq fill-column 72)))

However, it doesn't seem to work, I get the following in the *Messages* buffer:

  Fill column set to 79 (was 70)

Since it was 70 and no other messages indicating otherwise, this tells me it was never 72, which means there's nothing else in my configuration overriding the hook value.

Setting the global org-mode fill-column won't work since this customization is to work around Org-mode indenting the notes in the drawers of the TODO, which takes off about 5 spaces already.  That is, setting a custom fill-column value for any buffer in Org mode doesn't solve the problem.

Perhaps the solution is have a function that checks the buffer name?  If the buffer name is "*Org Note*" in Org mode, set to fill-column to 72, otherwise, leave it alone or use the "default".

Any help is much appreciated!


texts: Fixed width font for sending mails - notmuch + gmailieer + emacs - How?

texts:
I have recently set-up my personal mail(gmail) for use through emacs, notmuch and gmailieer. For sending mails, I am relying on the inbuilt smtp mail package and the Message mode.

Earlier, when using the web interface I could set a font while composing the mail. Now, through emacs, when I send an email, it is received in some default variable width font. How do I make sure the mail is sent as fixed width?

Do I have to send a Html mail for that?


texts:
Here's my proxy setup:

(setq url-proxy-services '(("no_proxy" . "my-corp-proxy")
                           ("http" . "my-corp-proxy:8080")
                           ("https" . "my-port-proxy:8080")))

I can use eww to access HTTP sites, but when I try to access HTTPS sites I get this response:

I've installed gnutls as well; evaluating (gnutls-available-p) gives t.

How do I solve this issue?


texts: eww: error in process sentinel: url-cookie-generate-header-lines: Wrong type argument: listp, \.\.\

texts: I'm doing M-x eww with Emacs-24.5 -Q on Debian 8, for example with the address "http://google.com" (or just "google.com").  And receive the error message in the subject line, in other words: I can't use eww at all for internet addresses, what the heck is going on?


texts:
I use use-package in my init.el and use :ensure to make sure packages are installed. However after every package update via package.el, it tells me some packages are no longer needed and can be removed, even though those packages are actually needed. If I remove them via M-x package-autoremove, they get installed the next time I open Emacs. Does this have something to do with the order in which they are added in package.el?

For example, helm has been added to my init file like this:

;; helm-mode by default
(use-package helm
  :ensure t
  :diminish helm-mode
  :config
  (helm-mode 1)
  :bind (("M-x" . helm-M-x)
         ("C-x C-f" . helm-find-files)
         ("C-c f" . helm-recentf)
         ("C-x b" . helm-mini)
         ("C-x C-b" . helm-buffers-list)))

However it gets installed as a dependency. The same happens for company-mode, helm-ag etc.


texts: Extending word search selection in swiper

texts:
I have been using helm from some time and am now trying ivy, counsel and swiper.
Regarding swiper I am wondering if there is a way of extending the word search selection.

Just like hitting C-w after a normal incremental search command with C-s.
What it is called Isearch Yank in the Emacs manual.


texts: Troubleshooting a hanging `list-processes`

texts: Normally I'd use M-x list-processes to see what Emacs is running in the background. But in this case list-processes itself hangs. What is the right thing to do in this situation?


texts: Function to open my init file for editing or return its path

texts: Is there a function I can call that opens my init file for editing or returns its path?


texts: How can I make Emacs warn about calls to my pure functions?

texts:
Emacs' byte-compiler can tell me if I call pure functions without saving the result:

(defun foo-calls-add ()
  ;; value returned from (+ 1 2) is unused:
  (+ 1 2)
  12)

However, I don't get any warnings when I define my own pure functions:

(defun foo-pure (x)
  (declare (pure t) (side-effect-free error-free))
  x)

(defun foo-calls-pure ()
  ;; No warning here:
  (foo-pure 1)
  12)

What do I need to do in order for the byte compiler to warn about foo-calls-pure?

I've compared (symbol-plist '+) with (symbol-plist 'foo-pure) and I can't see any obvious missing properties.


texts: org-table to calc matrix and back again?

texts:
Is it possible to feed data from an org table into calc as a matrix, and then get it out again as a vector to fill in a column?

For example, if I have:

|           | Fund A | Fund B | Fund C | Combined |
| US        |     .1 |     .8 |     .5 |          |
| Europe    |     .2 |     .1 |     .4 |          |
| Pacific   |     .7 |     .1 |     .1 |          |
| Weighting |     .3 |     .5 |     .2 |          |

I would like to use a calc formula to matrix-multiply the data from the first three rows of numbers by the (transposed) weighting in the last row of numbers, and insert the result in the final column, like this:

|           | Fund A | Fund B | Fund C | Combined |
| US        |     .1 |     .8 |     .5 |      .53 |
| Europe    |     .2 |     .1 |     .4 |      .19 |
| Pacific   |     .7 |     .1 |     .1 |      .28 |
| Weighting |     .3 |     .5 |     .2 |          |

I was hoping maybe something like this would achieve that if inserted in the top cell of the last column -- but this is incorrect: no output is produced in the table:

=($2@2..$2@4) * trn($4@2..$4..@4)

If it's not possible using calc, is it possible using elisp?


texts: Change C indent style for specific project?

texts:
I have in my ~/.emacs.d/init.el:

(use-package google-c-style
  ;; provides the Google C/C++ coding style
  :ensure t
  :config
  (add-hook 'c-mode-common-hook 'google-set-c-style))

However, a particular C project I'm viewing uses

(setq c-default-style "linux"
      c-basic-offset 4)

How can I override the default google C style with this one for this specific project? Something along the lines of putting something inside of .dir-locals.el placed at the root of the project would be nice.


texts: Smartparens strict mode C-w kill line if no active region

texts:
I'm using smartparens-strict-mode and trying to get it so that C-w kills a region if selected and the whole line that point is on if not (like this but working with smartparens strict mode).

This is what I have so far:

(defun sp-kill-line-or-region (orig-fun &rest args)
    "Kill whole line if region not selected."
    (if (region-active-p)
        (apply orig-fun args)
      (kill-whole-line)))
  (advice-add 'sp-kill-region :around 'sp-kill-line-or-region)

But it doesn't work. If I just do C-w it gives me the error command-execute: The mark is not set now, so there is no region. However, if I mark something, then C-w, then I can use it like I want (i.e. I can then not mark anything and it will kill the whole line).

I can't figure this one out for whatever reason. Help? Thanks!


texts: Magit stage modified without confirmation

texts:
(magit-stage-modified 'all) stages all modified files, but only after confirming it with the user with the message Stage all changes? (y or n).

The function is defined as follows:

(defun magit-stage-modified (&optional all)
  "Stage all changes to files modified in the worktree.
Stage all new content of tracked files and remove tracked files
that no longer exist in the working tree from the index also.
With a prefix argument also stage previously untracked (but not
ignored) files."
  (interactive "P")
  (when (magit-anything-staged-p)
    (magit-confirm 'stage-all-changes))
  (magit-with-toplevel
    (magit-stage-1 (if all "--all" "-u"))))

There does not appear to be any guard that I can set that will allow me to stage all modified files without a confirmation.

Is there a way to achieve this otherwise?


texts: Compose key method fails when the sequence following  is just a single character

texts:
I have noticed Emacs does not produce the desired key unsing the compose key input method when the sequence defining the key to be input is only a single character. The desired key is inserted everywhere else: browser, terminal, gedit, GVim, etc. Composition of two characters—such as <Multi_key> <g> <a> : "α"—does work in Emacs. (I use Arch Linux and in the example I used the syntax of the .XCompose file).
I've tested setting .XCompose as simply:
include "%L"
<Multi_key> <k> : "^"
<Multi_key> <Multi_key> :"^"

The first line does not work on emacs. The second does.  I am at loss as to why this happens and I would very much like to dedicate a few letters (giving up on the numerous combinations started by them) to make insertion of certain useful symbols more confortable.


texts:
I have been using Org-mode for largely everything including for maths text.

Although I have gotten pretty good at writing LaTeX snippets, I have a lot of trouble reading it. I much prefer the syntax and conventions of AsciiMath.

AsciiMath is also supported by MathJax, but obviously doesn't render when placed inside slashbrackets (I export to HTML). I was wondering whether someone knew of any option or syntax that would let me use AsciiMath rather than LaTeX?


texts: .dir-locals for specific directory but not its children

texts:
How to set a directory local variable for a directory itself non-recursively? I don't want the variable set in .dir-locals.el affect the sub-directories.

Edited:
My use case is: I'd like to hide dot files under ~ by setting dired-omit-files since there are quite a lot of them in my home directory. But I do not want to hide dot files of any other subdirectory of ~. Though I think I can set it using some dired-mode-hook by comparing buffer-name or buffer-file-name, I guessed there may be simpler solution by using directory local variables.


texts: Do not auto-capitalize when editing an equation in AUCTeX or org-mode

texts:
I would like the auto-capitalize minor mode not to capitalize mathematical text in AUCTeX and org-mode.

To avoid this, when running in either of these modes, auto-capitalize should only capitalize when the function texmathp returns nil.

The auto-capitalize code is quite messy, so I don't know what is the best place to make this modification so that everything keeps running efficiently.

Many thanks!


texts: Folding custom regular expressions in emacs?

texts:
Consider a pattern/regular expression I will call reg which matches multiple times in an  emacs buffer.  I want emacs to recognize all matches for reg and replace (temporarily, like folding) each matching text match with the result of a custom elisp function applied to that particular match, which I call f(match). Furthermore the replaced text should be (customizable) highlighted (other color etc.) and if you move your cursor into an occurrence of f(match), it should display the original match as long as the cursor is inside match (if you move it outside, it just shows f(match) again).

To have a simple example in mind, let reg be say \[\[\!.*?\!\]\] and the elisp function f could just translate all lower case letters in the matched text to upper case and vice versa. So for example [[!HelloWorld1!]] should be folded to [[!hELLOwORLD1!]]

In my particular case I want it to replace in a more complex way results of mathematical python calculations with the results in a latex file using pythontex.

Is there any package which could do this? If there are multiple packages, what would be the "state of the art" for doing something like this?


texts: How to create agenda mode that will list all entries with time against them that have no tag?

texts:
As the title, trying to make an agenda item that will list all entries that have at least one minute clocked against them, but no tag.

I can get it to list entries with no tag easy, but I can't get it to list items with time clocked against them.

Looking at special properties on this page, it seems like CLOCKSUM should be exactly what I am looking for.

This is what I've got, but I can't make it work:

(setq org-agenda-custom-commands
  (quote
    (("t" "All items with time logged, but no tag" tags "+CLOCKSUM>=\"0:01\"" nil))))

The page says to run org-clock-sum first, but this doesn't seem to have helped. I tried org-super-agenda, but that wouldn't do it either.

I've been bashing my head against this for hours, couldn't find anything on the internet. Can anyone help?

Using Emacs 26.3 and Orgmode 9.4.


texts:
I quite like tmux and Aquamacs. I've recently been interested in how to integrate the two together. As far as I know, one cannot run Aquamacs within a terminal even with the Aquamacs CLI tool, so the next natural option is to run tmux in Aquamacs via something like Emacs' shell mode. Unfortunately, I've been running into some bottlenecks in doing this. Namely, running tmux from shell mode throws an error:

$ tmux attach -t 0 # same thing happens by just running `$ tmux`
tmux attach -t 0
open terminal failed: terminal does not support clear

I've been searching for Aquamacs / tmux integration, but haven't found much. It seems like most folks are content to just use Emacs in the shell within tmux, but unfortunately this isn't an option for Aquamacs as stated above.

EDIT:

It seems that the error stated below in the comments (open terminal failed: can't find terminfo database) also happens in vanilla Emacs, even on Linux.


texts: How to shift a selected area of text in Emacs by a certain number of spaces?

texts: I am writing python code so shifting/moving blocks of lines is important to avoid going through each line individually. How can I do this without an add-on? Is there a type of operation keystroke command to do this?


texts:
While writing latex I sometimes have to reference an equation. I do that using reftex-reference (bound to C-c (  by default). However, I sometimes want to copy some text from the equation text I just referenced.

Ideally, I would like to position my pointer at the equation label and hit some keys to jump to that equation text, or maybe show the equation text in some temporary buffer so that I can copy text from it.

Is there such a functionality in reftex or any other package?

Note: I know I can use reftex table of contents to navigate to the label, but I am hoping I can use the text I already have written to jump to that label.


texts:
I'm using Ubuntu 16.04 with Emacs 24.5

If I run:

M-x package-refresh-contents [RET]

I get back the message:

Contacting host: melpa.org:443

If I try to install this package with:

M-x package-install [RET] indium [RET]

I get back:

Package 'emacs-25' is unavailable


texts: Stringify a list to a string without truncation

texts:
I am working on improving the org babel racket mode and am running into issues with inserting longer vars
Whether I do
      (format "%S" '((2 0 0 4 2 0 0 3 0 0 4 0 0 7)))

or
      (with-output-to-string (princ '((2 0 0 4 2 0 0 3 0 0 4 0 0 7))))

I always get back the truncated
    ((2 0 0 4 2 0 0 3 0 0 ...))

not the full object in a string. How do I stringify the list without truncation?


texts: Font size control of LateX previews in Org files

texts:
I love the ability to preview LateX fragments in Org-mode. With two easy shortcuts one can turn them on and off on-demand:

Turning previewing ON: C-c C-x, C-l
Turning previewing OFF: C-c C-c

One problem I encounter often is that the preview has a small font size. Is there any way to control it?


texts: How to empty a buffer before it gets to0 large

texts: I'm browsing with erc to some channels which are mainly used by bot request. Therefore the buffer size will scale up very fast. Since It's a read-only buffer I cannot empty it by hand. Is there a way to tell Emacs to empty a buffer if it reaches a specific size?


texts:
I would like to have NeoTree automatically toggle-open upon Emacs start up. I have tried adding:

(neotree-mode t)

under my:

(require 'neotree)

line in ~/.spacemacs (and yes, I am using Spacemacs too, if that is somehow relevant) in order to get NeoTree to automatically toggle open upon startup, but it failed. It gives an error such that Spacemacs is not even loaded, see this screenshot for further details, if relevant (here is the ~/.spacemacs file I was using when I got this error). I know that adding:

(global-set-key [f8] 'neotree-toggle)

to my ~/.spacemacs file, after the require line will cause it so that if I press F8 after Emacs startup it will toggle the NeoTree open, but I would like to rewrite my ~/.spacemacs file such that it toggles the NeoTree open automatically on startup, is this possible?


texts:
So simple question, i'm not sure which function would be best to do this. How do you add a string to each item in a list? So example:

(setq list '("Sample Data" "More Fun"))

And then say I want to add " is great." to each item in my list so it reads:

(print list)
"Sample Data is great."
"More Fun is great."


texts: Spacemacs and Orgmode: Bulk unschedule a task from the Agenda view

texts: I was looking for a way to bulk unschedule tasks from the agenda view. There is a function included in org-mode for bulk-unschedule according to Carsten Dominik, but was not sure how to find this in Spacemacs.


texts: org-ref completion of labels inside latex blocks

texts:
I recently started using org-mode to take academic notes, so I use LaTeX blocks (#+BEGIN_LaTeX) to insert LaTeX code using the special buffer that gives me code completion via AuCTeX. I also insert labels inside these blocks in order to be able to reference them later. I discovered that org-ref can help me do this easily, but the thing is I want to be able to see a list of labels that I currently have on my file that I can choose from whenever I want to reference an equation.

When I do C-c C-l to call org-insert-link and choose eqref, I'm not able to see all my labels or get any sort of completion for my labels. When I have a large number of labels, I can't remember what I labeled a particular equation with and so I need some way to keep track of all these labels. Is there a solution for this?


texts:
I often find myself wanting to do something like this:
(if-let* ((foo (get-foo))
          (_ (conditionp foo))
          (bar (get-bar-from-foo foo)))
    ...)

As an alternative to:
(let ((foo (get-foo)))
  (when (and foo (conditionp foo))
    (if-let ((bar (get-bar-from-foo)))
      ...)))

The problem is, the underscore is not used so it gives the bytecomp warning: Warning: variable ‘_’ not left unused.
I think the first example is much easier to read than the second, is there something similar to the first example which gets around this warning?


texts: Why is org-table-calc-current-TBLFM throwing Wrong type argument: integer-or-marker-p Error?

texts:
Why does my code generate the error when used with org-table?

No error message when code used outside of org-table

#+NAME: get-country-or-area-name
#+HEADER: :var iso-alpha2-code="ca"
#+HEADER: :var dc-list='((US . "United States of America") (CA . "Canada") (BR . "Brazil"))
#+BEGIN_SRC elisp
  (setq s (upcase (substring iso-alpha2-code 0 2)))
  (cdr (assoc-string `,s dc-list))
#+END_SRC

#+NAME: Brazil
#+CALL: get-country-or-area-name(iso-alpha2-code="br")

#+RESULTS: Brazil
: Brazil

#+NAME: Canada
#+CALL: get-country-or-area-name(iso-alpha2-code="ca")

#+RESULTS: Canada
: Canada

#+NAME: United-States-of-America
#+CALL: get-country-or-area-name(iso-alpha2-code="us")

#+RESULTS: United-States-of-America
: United States of America

Error generated when called in #+TBLFM:

The error is generated when org-table-calc-current-TBLFM attempts to delete the temporary #+TBLFM: line.

Before:

| ISO Alpha 2 Code | Country or Area Name     |
|------------------+--------------------------|
| BR               |                          |
| CA               |                          |
| US               |                          |
#+TBLFM: $2='(org-sbe get-country-or-area-name (iso-alpha2-code $$1))

After:

| ISO Alpha 2 Code | Country or Area Name     |
|------------------+--------------------------|
| BR               | Brazil                   |
| CA               | Canada                   |
| US               | United States of America |
#+TBLFM: $2='(org-sbe get-country-or-area-name (iso-alpha2-code $$1))
#+TBLFM: $2='(org-sbe get-country-or-area-name (iso-alpha2-code $$1))

Excerpt from *Messages* buffer:

  Re-applying formulas to 3 lines… done
  Re-applying formulas… done
  org-table-calc-current-TBLFM: Wrong type argument: integer-or-marker-p, "US"

Thanks for your help!!

Version Info

  org-mode version: 8.3.5
  emacs version: GNU Emacs 24.5.1 (x86_64-unknown-cygwin, GTK+ Version 3.14.13)


texts: How to set a rule for the order of minor-mode-map-alist

texts: Suppose we have 3 mode, one such rule is like key map for mode 1 should always come before mode 2, and mode 3 should always come before mode 1, finally mode 3 should always come before other minor mode. Is there a easy way to do it? How is the order determined in emacs? Thank you for your help.


texts: rendering latex code inside #+BEGIN_LaTeX ... #+END_LaTeX in org-mode 8.3.1

texts:
C-u C-u C-c C-x C-l or (org-toggle-prefix-fragment) with the double prefix argument used to toggle the display of LaTeX fragments across the whole buffer whether they were inside of #+BEGIN_LaTeX blocks or not. Now that behavior seems to have changed, as only LaTeX snippets outside of blocks are rendered. This isn't that big of a deal since export works as expected. However, I did like the old behavior. Is there a variable I need to set to restore the previous behavior? Alternatively, I'd like to typeset the equation and then have it generate an image file which gets saved to the buffer and inserted inline in the same way as the babel source blocks allow. Is that possible?

Below I give an example of how it works now:


texts: exporting org-mode subtree to a tree of text files

texts:
Is it possible to export an org-mode subtree to a directory tree of plaintext files, so that after exporting a subtree which looks (in principle) something like this:

** directory A
*** textfile b
    lorem ipsum
** directory C
*** directory D
**** textfile e
     dolor sit amet,
     consectetur adipiscing elit
**** textfile f
     sed do eiusmod tempor incididunt
     ut labore et dolore magna aliqua.
**** directory G
***** textfile h
      Ut enim ad minim veniam,
      quis nostrud

there appear the corresponding files like this:

$ find .
./A
./A/b
./C
./C/D
./C/D/e
./C/D/f
./C/D/G
./C/D/G/h
$ cat C/D/f
sed do eiusmod tempor incididunt
ut labore et dolore magna aliqua.
$  # etc.


texts: Make flyspell avoid checking #includes in C++

texts:
Flyspell does a great job ignoring all the source code and only check comments, with one flaw: it still does check the text after #includes. So the iostream here does get highlighted:

#include <iostream>

I tried to add the includes to the skip regions, with no success:

(add-to-list 'ispell-skip-region-alist '("[^#include.*$]"))

Did I write it wrong? Or am I missing a different setting?


texts: Does slime-repl-ansi-color work at all these days?

texts:
I was unable to make it display ansi colorized output in Lisp REPL despite this project claims.

https://github.com/deadtrickster/slime-repl-ansi-color

The code seemingly doesn't do anything except setting a variable. However in my slime folder .emacs.d/elpa/slime-20170319.1601 doesn't seem to contain anything slime-repl-ansi-color could use.


texts:
I've not used Gnus in a long time, but, if my memory serves, simply opening a group would check for new emails and fetch them.  For some reason this doesn't happen anymore... I can, however, tell it to fetch old emails.  And, if I kill Gnus buffer and load it again, it does fetch the new emails.

So... how do I do this without killing the buffer and restarting Gnus?

PS. I'm connected to IMAP server, so, I'd expect this to be something really basic...


texts: Tab completion in minibuffer: case insensitive

texts:
When the minibuffer offers tab completion, how can I make that case-insensitive?

Preferably a global setting that makes any completion – a filename, a command, ido, etc. – obey that setting.


texts: Markdown equivalent of `org-indent-mode`?

texts:
What's the simplest way of ensuring that the text below a headline in a Markdown file is aligned with the headline? In org-mode you can accomplish this by calling org-indent-mode. Is there a similar function for Markdown?

At the moment, using markdown-mode, I get something like this:

# Heading 1
This is some text below the first heading.

## Heading 2
This is some text below the second heading.

I'd like instead to have something like this:

# Heading 1
  This is some text below the first heading.

## Heading 2.
   This is some text below the second heading.

Incidentally, and this may be related to this issue, if I just try to indent the text below a heading using TAB, I get a four space indentation, even though I have (setq-default tab-width 2) in my init file.