texts: Is there a way to connect to a REPL without comint?

texts:
The performance of comint is not good when handling outputs of some REPL. Is there a way to connect to some REPL outside Emacs and let result display there, like in a terminal/browser/something else?

(I also tried to eval Python code in vscode, their REPL 'running inside the editor' is handling outputs much more efficiently. Maybe they use something like comint in vscode or maybe not.)


texts: How does Emacs manage to start instantaneously with many el-files?

texts:
As every Emacs'er will know, I'm currently suffering from my extensive dot-Emacs configuration. All my packages are within the containers of use-package, and I bytecompiled all of my .el-files.
Even with that, Emacs starts in 6.4 seconds, and then loads the rest of the packages (around 40 of them) afterwards.

I was thinking about another ways to solve the long startup time, then I noticed something. The default Emacs (without user configuration) uses many .el libraries, which are included with every Emacs. They're located in \shares\emacs\version number\lisp\.

Even with many lisp files, it manages to get started in one second. When I was inspecting the files of many packages that are included with the default Emacs, I found nothing extraordinairy that could explain why Emacs manage to start within one second. Could anyone tell me how Emacs manages that, even with thousands .el-files?


texts: How to make a certain column number the first one shown

texts:
If I want a certain row to be the first that is shown, I press C-l C-l. Now I'm looking for the same thing with columns.
I imagine it like this:
I move the cursor to the desired column, do "blank", and said column becomes the first column visible. Changing rows does not change that first column.


texts: getting a process buffer for an eshell buffer

texts:
To get a process buffer an eshell buffer I thought I used to be able to run:

(get-buffer-process (current-buffer))

In Emacs 25 this no longer works. Specifically "GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2015-11-30"

Here is what I do. I start an eshell with M-x eshell. Then with that as the only window or buffer around I run

M-x eval

Eval: (get-buffer-process (current-buffer))

And the result is nil.

I am using this in the code for realgud, an emacs front-end to various debuggers. It needs to interact with the debugger like see if the debugger is running or has terminated, send commands to it and run hooks when output appears.

How would I do this?


texts: How to add a suffix to every line of a text?

texts:
Windows 10, Emacs 25.1

Suppose I have the following text (about 100 rows):

   ic_m_sales
   ic_m_activity_report
   ic_m_messanges
   ic_m_products_name
   ic_m_change_store
   ic_m_faq
   ...

How to add the same suffix (_inactive) to every line of the text ?
The result must be like this:

   ic_m_sales_inactive
   ic_m_activity_report_inactive
   ic_m_messanges_inactive
   ic_m_products_name_inactive
   ic_m_change_store_inactive
   ic_m_faq_inactive
   ...


texts: Flycheck-Haskell - "Opening Directory" "Not a directory"

texts:
I'm trying to get flycheck working in Haskell, however, when I try to do anything to do with flycheck, even running stuff like flycheck-verify-setup, I get an error "Not a directory".

Does anyone have any idea why this might be happening? Flycheck works in every other language, it's just Haskell.


texts: How to add complex syntax highlighting in a minor mode?

texts:
I'd like to highlight code with various faces in a minor mode.

Here's a screenshot that's close to what I want:

One thing that I'm missing is having the comment chars # in
font-lock-comment-face.  The idea is to have comments that "belong"
to an outline highlighted as plain text, so it's easier to read. While
having regular comments with their usual less prominent face.

Here's the code that I used:

(setq-local font-lock-defaults
            '(python-font-lock-keywords
              nil nil nil nil
              (font-lock-syntactic-face-function
               . lpy-font-lock-syntactic-face-function)))

(defun lpy-font-lock-syntactic-face-function (state)
  "Return syntactic face given STATE.
Returns 'defalt face for comments that belong to an outline."
  (cond ((nth 3 state)
         (if (python-info-docstring-p state)
             font-lock-doc-face
           font-lock-string-face))
        ((save-excursion
           (while (and (> (point) (point-min))
                       (progn (move-beginning-of-line 0)
                              (eq (char-after) ?\#))))
           (forward-line 1)
           (looking-at "#\\*+ "))
         'default)
        (t
         font-lock-comment-face)))

The thing is, I have no clue about the interface on which
font-lock-syntactic-face-function operates, other than it receives a
complex data structure state, has different point state, and returns
a face.

Could someone explain this interface? Is there a better one perhaps?


texts: Wrong type argument: arrayp, nil in X mode

texts: I'm getting a strange error on Emacs 27. Only in GUI mode (not in terminal mode), typing / to open the Evil search functionality results in the error wrong type argument: arrayp, nil being displayed in the echo area.


texts: go module with subdirectory of git project is showing compilation errors in emacs using lsp-mode

texts:
I've my emacs setup for golang development. My golang config is github
If I have go mod in the same directory as git root directory then it is working fine in emacs. example project here
But If I've golang mod project in the sub directory of git project then the compiler is showing error . example project here
The error screenshot is here
Because of this error I couldn't do the code navigation. How can I fix this error?


texts: Copy/paste from Windows clipboard in WSL terminal

texts:
I know that question has been asked dozens of times now, but i have tried every possible suggestion i have found online - nothing worked.

I can't figure out how can I copy/paste from my Windows 10 to emacs(which is run through "Bash on Ubuntu on Windows"). If i copy text on my Windows i cant paste it to emacs by clicking right button of my mouse. I have tried pasting by using Shift+Insert, but it keeps toggling "overwrite mode" and not pasting anything. I have tried unbinding overwrite mode but i couldnt achieve it.

I have also tried simpleclip package and it shows me "Clipboard support not available" whenever I try running "M+x simpleclip-copy/paste/cut".

Can anyone please help me?


texts: Magit: Prevent commit message from being pre-populated with a bullet point and file name

texts:
Right now an example git commit message looks like below. It has the filename listed * emacs.d/robenkleene/config/robenkleene-config.el:. How do I not have the commit message pre-populated with that line? (Everything prefixed with a # is fine, it's just the one line listing the filename that will actually appear as part of the commit message that I want to never appear by default in commit messages.)

* emacs.d/robenkleene/config/robenkleene-config.el:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
#   modified:   emacs.d/robenkleene/config/robenkleene-config.el
#


texts:
AUCTeX manual says

Command: LaTeX-section arg
(C-c C-s) Insert a sectioning command.
• If arg is a list (selected by C-u), go downward one level.

What does it mean? I've tried C-u <several keys> C-c C-s but never got it to work.


texts: Writing "recall_score()" breaks org-mode export

texts:
After writing the expression recall_score() in one of my org-mode files I was no longer able to export into html (or other formats), and I got the following error

Reference ‘score’ not found in this buffer

Is there a reason for this to happen?

My Emacs version is

GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian

and my org-mode version is

Org-mode version 8.2.10 (release_8.2.10 @ /usr/share/emacs/25.2/lisp/org/)


texts: how can I get Emacs kill-ring to behave like a simple clipboard buffer?

texts:
How can I get Emacs to behave the same as other programs for copy/paste (i.e. OpenOffice, Microsoft Word, etc.)?

I want to simplify the kill-ring so that it behaves like a simple clipboard. I find it complex that the kill-ring contains multiple items.

In my understanding I don't lose any of my work by doing this, since I have undo-tree to help me keep a history.

Quote from Emacs tour:

  Recall that most commands which delete a large amount of text in fact
  kill it (i.e. place it in the kill ring) so you can restore it later.
  Emacs makes it very difficult to lose a lot of text permanently: in
  editors with only a single clipboard, one can easily accidentally
  delete a large chunk of text or clobber the contents of the clipboard
  (by cutting two items in succession). But in Emacs, in either of those
  cases, the lost text can easily be retrieved from the kill ring.

Please tell me how to do this. You can also add your reasoning why I shouldn't do this, or under what (infrequent) circumstances this scenario occurs.


texts: How can I edit the Helm results buffer and have the changes reflected in the original buffers?

texts:
I've seen this demonstrated before in various screencasts and can't find it searching through the docs. I do use helm-swoop-edit quite often in a single buffer but when I need to change all occurrences across a project it gets a bit tedious.

For bonus points if there is a utility function to build such a buffer from helm results? I'd be very interested as my general project searching methods are helm-git-grep, helm-do-grep and helm-do-ag.


texts:
In vim, all instances of an apple tree can be replaced by an orange tree with :%s/an \zsapple\ze tree/orange/g.
\zs and \ze mark the start and end of the passage to be operated on.
Is there something equivalent in emacs?
As far as I know, evil mode needs the much less elegant
:%s/\(an \)\(apple\)\( tree\)/\1orange\3/g


texts: Remove math fragments from buffer in org mode

texts: With org-latex-preview (should be used from version 9.3 on) I can generate math previews of latex fragments of a section in org mode, but how can I remove them?


texts: Doom Emacs: Flycheck showing warnings despite using check-paths

texts:
In python mode I have a project, which has a src directory. In that directory I import src.something from my root directory. That is shown as unresolved import.
I have found lsp-python-extrapaths set to ["." ".src"] but still they show as unresolved. Does anybody know lsp with python?
I have to get these errors resolved in order to see the "normal" errors. Is it possible to see all at once?


texts: Move point to just before end of a comment

texts:
Given that the point is right in front of a comment, how do I move it to the end of the comment, but before the comment end markers?

For example:

for a C++ // xxx comment, I would like to move the point to the end of the line
for C-style /* xxx */ comments I would like to move the point to right before the second *.

To complicate matters, I would like this to be mode independent. Also, I would like the solution to be based on the syntax table, as there are major modes that don't set up the comment-related regex variables properly.

Starting points:

The function forward-comment can move the point the after the comment end marker, but I want it to stop before the comment end marker
The syntax table can define three kinds of comments at the same time (where the b and c flags indicate that character is part of alternative comment kinds). When the point is inside a comment, the function syntax-ppss can tell which kind of comment it is.


texts: How to view and edit pdf files in emacs?

texts:
I heard that we can view pdf files in emacs. Is it done by converting pdf files to plain texts first?

Can we view pdf files at its fullness in emacs?

can we edit pdf files in emacs?

Thanks.


texts: In Dired, how can I color the names of files younger than 1 hour?

texts:
windows 10, Emacs 26.1 , Dired+

I install dired+ from here

https://www.emacswiki.org/emacs/DiredPlus

Here example of some dir in the dired+ mode

Is it possible to change color of file names that not older than one hour?

In this example this is a two files:

get_room_by_id_response.json

create_dummy_room_response.json


texts: Get process id (pid) for running python (jupyter-kernel)

texts: I've started a jupyter kernel form emacs-jupyter. I'd like to get the process id for the python process associated with the buffer so that I can attach a debugger to it. How can I do this in elisp?


texts: Why isn't the jch's "with-undo-collapse" macro an emacs built-in yet?

texts:
I wondered why the jch's with-undo-collapse macro (or something like that) isn't an emacs built-in yet.

Is it safe enough? Is there a built-in alternative?

I mean something that can be applied like in the jcs's example of usage:

(defun test-no-collapse ()
  (interactive)
  (insert "toto")
  (undo-boundary)
  (insert "titi"))

(defun test-collapse ()
  (interactive)
  (with-undo-collapse
    (insert "toto")
    (undo-boundary)
    (insert "titi")))


texts:
I am currently working on a document for which I use a custom index style file. When I type C-c C-c to compile my document, Emacs/AucTeX offers to run its Index command (which I assume runs makeindex). This works fine, except that the style is not applied. Is there a way to tell AucTeX that it should use a certain style file for this specific LaTeX file (i.e. that it should run makeindex -s mystile.ist)? I looked around in AucTeX's customizations, but couldn't find any commands related to indexing.

Edit
It seems that the index command is defined in TeX-command-list. Is there a way to overwrite this for a given file? For example, by adding something to the Local Variables at the bottom of my .tex file?


texts:
Running Spacemacs 0.300 on Emacs 27.2.
When my cursor is on a link in an org buffer, the link automatically expands. So, what appeared as 'Description' changes to something like [[id:xxxxxx][Description]] the moment my cursor touches 'D'
I do not want this behavior. So, even when I am on 'D', it continues to show 'Description'.
How do I achieve this? Also, in the new set-up, how do I expand the link in case if I want to edit it?


texts:
I found coloured headings disturbing so I (setq org-level-color-stars-only t).  But now the headings are too similar to regular text, and their face is default so they can't be formatted by changing a face.

Question: how can I display all headings in uppercase without actually upcasing them?

It would be nice to have a function for toggling uppercase(dly displayed) headings.


texts: How to test (programmatically) whether the current Emacs session (among several) is running the Emacs server?

texts:
The server-running-p predicate will evaluate to t if the Emacs server is running, irrespective of which Emacs session currently "owns" the server process.

Therefore, when there are two or more independent Emacs sessions running simultaneously, server-running-p does not really test whether the current Emacs session is running the server.

I'm looking for a more specific test, one that will evaluate to t if and only if the current session (i.e. the session performing the test) is running the Emacs server.


texts: File org-capture entry under current headline at point

texts:
Let's say that I have a tree of tasks like so:

* TODO Launch website
** TODO Get database running
*** TODO Select MySQL vs. PostgreSQL

Let's say I'm looking at the "Select MySQL vs. PostgreSQL" and I decide I want to file a task under that headline using my Org Capture template. Is there a way to directly tell org-capture to file the new headline under the current headline (i.e., the headline at (point))? I'm aware of the (clock) capture target, but I don't necessarily want to have to clock in at the current point.


texts: Is it possible to insert random numbers in an org table?


texts: Control vertical spacing between paragraphs in org-mode export?

texts: I want to export org-mode to PDF or preferably ODT format. How do I set arbitrarily vertical space, e.g space before paragraph 6pt, space after 12pt. Is there any global option for me to do this?


texts: How to reliably redefine scroll wheel in isearch? [I'm using Mitsuharu Yamamoto's Mac port]

texts:
I decided to define <wheel-up> and <wheel-down> to isearch-repeat-forward and isearch-repeat-backward in the isearch-mode-map.

This works, but if you scroll quickly, it reverts to ordinary scrolling behavior and cancels your isearch. It helped a lot to define <double-wheel-up> etc, but if you scroll very quickly, the problem still occurs.

How can I redefine scroll events independent of scrolling speed?


texts: Handling org properties when include files

texts:
I have a file a.org which contains

#+TITLE: a
#+DATE: <2017-01-07 Sat>
* b.org
  #+INCLUDE: b.org

and b.org which contains

#+TITLE: b
#+DATE: <2017-01-07 Sat>
* content in b

When I export a.org to html or latex, things like #+TITLE and #+DATE mess up.

Since I want to maintain each b*.org and a master a.org containing all the b*.org as subtrees.

So how can I tell org to ignore the properties in all the b*.org files and use the properties in a.org when exporting in a.org?


texts:
I am starting to build up a .emacs file to be used as a development environment within Docker containers.  I get this error when starting emacs-nox in a Docker container.

Warning (initialization): An error occurred while loading `/root/.emacs':

error: Package `use-package-' is unavailable

Here is the contents of my .emacs

;; require package
(require 'package)

;; add melpa stable
(add-to-list 'package-archives
         '("melpa-stable" . "https://stable.melpa.org/packages/"))

;; add melpa
(add-to-list 'package-archives
         '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Initialise packages
(package-initialize)

;; add use package
(package-install 'use-package)


texts:
How do I make it so tabs are used instead of spaces when TAB is pressed? I've tried setting indent-tabs-mode to t but no dice.

On my other modes, such as php-mode and c-mode, tabs are inserted. CSS mode seems to be ignoring.

God I hate spaces so much.


texts:
For a certain application, I would like to start up emacsclient, but with a slightly smaller font.  I can do it for a running emacs by eval'ing:

(set-face-attribute 'default nil :height 90)

But how to do it with command-line arguments just for the frame opened by emacsclient?  The -F flag looks promising, but I'm not sure of the syntax.


texts: Make org-mode table formulas use common arithmetic precedence

texts:
Given this org-mode document:

| 4 | ? |
#+TBLFM: $2=$1/2*2

Evaluating the formulas produces (in the second cell) the surprising result 1, instead of (4/2*2=) 4.

Apparently, multiplication has a higher precedence in org-mode formulas than division, which can (occasionally silently) produce unexpected results.

Is there a way to make org-mode formulas use common arithmetic operator precedence, as in most in-fix notations?


texts:
I have a weird problem. When I launch emacs GUI by double clicking the icon, or using open -a emacs in the terminal, or calling the application from alfred/spotlight it takes 4-8 seconds to launch. But when I launch GUI emacs from the terminal by calling /Applications/Emacs.app/Contents/MacOS/emacs it starts in about 1 second or a bit less. I haven't noticed this discrepancy before and I think it must be related to the way I'm building emacs but I can't see how.

So why would emacs start more quickly when calling /Applications/Emacs.app/Contents/MacOS/emacs than it does when calling /Applications/Emacs.app?

I'm running emacs 27.0.5, but the same problem occurs with emacs 26.2.

I'm on macOS running Mojave 10.14.5.
The build config is:

./autogen.sh
./configure \
    --build=x86_64-apple-darwin \
    --without-dbus \
    --with-ns \
    --with-imagemagick \
    --with-modules \
    --with-gnutls \
    --with-json \
    --disable-silent-rules \

make
make install
mv nextstep/Emacs.app /Applications


texts: Failed to update packages getting error "gnutls-error # -50" on Windows 10

texts:
When I run package-refresh-contents after running toggle-debug-on-error I get the following backtrace:

Debugger entered--Lisp error: (gnutls-error #<process elpa.gnu.org> -50)
  signal(gnutls-error (#<process elpa.gnu.org> -50))
  package--download-one-archive(("gnu" . "https://elpa.gnu.org/packages/") "archive-contents" nil)
  package--download-and-read-archives(nil)
  package-refresh-contents()
  funcall-interactively(package-refresh-contents)
  call-interactively(package-refresh-contents record nil)
  command-execute(package-refresh-contents record)
  execute-extended-command(nil "package-refresh-contents" "package-ref")
  funcall-interactively(execute-extended-command nil "package-refresh-contents" "package-ref")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Taking reference from the discussion found here I tried the following steps:

Running M-: (gnutls-available-p) produces:

(ClientHello\ Padding Session\ Ticket Extended\ Master\ Secret Encrypt-then-MAC ClientHello\ Padding ALPN Heartbeat SRTP Signature\ Algorithms SRP Supported\ ECC\ Point\ Formats Negotiated\ Groups ...)

Running shell command gnutls-cli -p 443 elpa.gnu.org from Emacs produces:

'gnutls-cli' is not recognized as an internal or external command, operable program or batch file.

Value of the variable gnutls-trustfiles is:

("/etc/ssl/certs/ca-certificates.crt" "/etc/pki/tls/certs/ca-bundle.crt" "/etc/ssl/ca-bundle.pem" "/usr/ssl/certs/ca-bundle.crt" "/usr/local/share/certs/ca-root-nss.crt" "/etc/ssl/cert.pem")

Added paths of ssl/cert.pem and ssl/certs/ca-bundle.crt in Emacs' installation directory to the gnutls-trustfiles variable. In my case they're c:/Program Files/emacs/ssl/cert.pem and c:/Program Files/emacs/ssl/certs/ca-bundle.crt. Running package-refresh-contents after saving from the variable customization menu and running eval-buffer still produces the same error. Restarting Emacs also produces the same error.

  On MS-Windows Emacs is supposed to use the system certificate store through MS-Windows native interfaces. No additional certificates in a separate bundle should be needed. So either your GnuTLS version has a bug of some kind, or your Windows system lacks some updates, or there's a genuine problem with ELPA's certificates.

Emacs version is "GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29"


texts: how to hide scratch buffer when starting emacs while opening a file?

texts:
emacs-25 GUI on Debian.

I set up emacs so that it shows the scratch buffer at startup. However, when I open a file via a file manager with right-click -> open with -> emacs, emacs starts up with a split screen and two buffers: on top the scratch buffer, at the bottom the file buffer. I would like that in this circumstance only the file buffer is shown and not the scratch one. How can I do that?


texts: If I know a keybinding/shortcut, how to get the corresponding function?

texts:
I want to use the function to switch to other window when there are only 2 windows in emacs.  I know that the shortcut is C-x o, but I don't know which function that shortcut calls.

How do I determine the mapping between shortcut and function?


texts: Where can I find the org source code for orgmode.org/manual/Installation.html

texts:
The title pretty much says it all: I'm looking for the "org source"1 for the page http://orgmode.org/manual/Installation.html.  (I want to replicate several aspects of that page's formatting.)

Many org-mode documentation pages (e.g. here) have a Show Org Source button, but the page I'm interested in is not one of them.

EDIT: To see what I mean by "org source", please click the Show Org Source in the page I cited.  Alternatively, you can see it here.

What I'm not after is the HTML source that one can view by, for example, pointing one's browser to view-source:http://orgmode.org/manual/Installation.html.

1 Assuming, of course, that the web page in question was generated from an org document.  This assumption could be incorrect; if so, please let me know.


texts:
I'm testing out emacs today and I'm trying to sync config and packages to my dropbox.

The solution I used with vim is what I'm planning for emacs

Create a .emacs.d directory on dropbox
Put an init.el file within that directory
Create a link from C:\Users\Simon\.emacs.d to the dropbox location
Possibly push that entire thing up to github for version control

My questions

Are there any problems with pushing the entire .emacs.d directory to github/dropbox?
Does any personal information get stored in that directory?
Where are packages typically stored for emacs? If its within the .emacs.d dir then that'd be ideal as I can ensure my entire config is in the cloud and available on all my machines
On a new machine, after I create a symlink to the dropbox location, is there anything else I need to do within emacs to get the entire config back?


texts:
I am debugging a very deep call stack. Unfortunately profiler reports (produced with M-x profiler-report) have a fixed width that obscures critical information when the stack gets deep.

Is there any way I can give myself some extra room?


texts: Referring to a different table's cell value in org-mode


texts: Killed buffer still shown by an earlier Ctrl-x Ctrl-b

texts: I found that a killed buffer is still shown by a buffer created earlier by C-x C-b. How can we get the up-to-date buffer list?


texts: Swap TAB and Escape in all modes including evil

texts:
Escape is too far away on modern keyboards and Tab could be easily typed as Ctrl+i in terminal applications. So I found it convenient to replace them in my alacritty terminal key bindings. I am used to these replacements and want them for Emacs also. What should I do, to replace Esc with Tab and vice versa in all buffers, modes, context etc allover Emacs(including evil-mode ofc)?
I've tried this in my init.el
(define-key input-decode-map [tab] [?\e])
(define-key input-decode-map [escape] [?\t])

But this doesn't trigger insert-to-normal transition in evil mode: I am pressing tab, I am seeng ESC ESC ESC in bottom bar, but evil state remains <I>.


texts: What sort of terminal did the guy who wrote emacs have?

texts: Prompted by this question about why hjkl are the keys used to move the cursor around in VIM, what did the keyboard / terminal look like that emacs was written on?


texts: org-mode datetree forward one day in the future

texts:
At work we do standups about what we did yesterday, I'm using datetree for my org-capture but the date recorded is by default today's date, I would like to change this so the date is of tomorrow instead of today.

Any pointers on how to change datetree default behavior.


texts: restclient errors "failed with code 111"

texts:
When I run GET http://localhost/ with restclient.el, I get the following error in the *Messages* buffer:

GET http://localhost:80/]
Contacting host: localhost:80
error in process sentinel: restclient-http-handle-response: peculiar error: "failed with code 111
", :host, "localhost", :service, 80
error in process sentinel: peculiar error: "failed with code 111
", :host, "localhost", :service, 80

Note the repeated error on the single invocation.

When I run (setq debug-on-message "failed with code 111") I get the following backtrace:

Debugger entered--Lisp error: "error in process sentinel: peculiar error: \"failed with code 111
\", :host, \"localhost\", :service, 80"
  recursive-edit()
  debug(error "error in process sentinel: peculiar error: \"failed with code 111\n\", :host, \"localhost\", :service, 80")

What is code 111, and how can I fix the failure?


texts: Make prelude C-a go to the absolute beginning of the line

texts:
Emacs prelude "smartens" C-a by rebinding it to "crux-move-beginning-of-line"

My muscle memory likes the vanilla emacs setting better, where
C-a moves point to the absolute beginning of the line.

How do turn off this specific prelude "smarts". ?


texts:
For some reason, I am unable to install helm. My configuration is:

(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)
(package-refresh-contents)

When installing helm, I get the message:

package-install-from-archive: http://melpa.milkbox.net/packages/helm-20181110.1615.tar: Not found

I am able to install other packages from MELPA, e.g. ac-helm.

Not sure if related, but Emacs asks me to select encoding when doing (package-refresh-contents).

Based on the reply, I tried using http://melpa.org/packages/ instead with the same result.

Interestingly, the version at melpa.org/#/ that I see in the browser is 20181112.1139, but the package manager keeps showing the one from two days earlier...


texts: Projectile indexing won't work on Windows

texts:
I can't get helm-projectile-find-file to work on Windows.

When I run it I get the error message "FIND: Parameter format not correct". Given how similar that is to the native windows find.exe default text I'm guessing that is what it is.

I have the git for windows folder at the very top of my path:

Running find and grep on a cmd.exe terminal do indeed show the the right executable files are being used:

Some other things I have tried:

Add find.exe and grep.exe to the Emacs bin directory

Set the executable path:

(setq exec-path (add-to-list 'exec-path "C:\\\"Program Files (x86)\"\\Git\\bin"))

Set the binary locations:

(setq find-program "C:\\\"Program Files (x86)\"\\Git\\bin\\find.exe"
  grep-program "C:\\\"Program Files (x86)\"\\Git\\bin\\grep.exe")

Same error message in all cases.


texts: LaTeX mode: How to select "pdflatex" instead of "latex" for a file automatically?

texts:
I have a LaTeX file using lots of PDF figures (mostly because converting figures to EPS is a waste of disk space), so it requires to use pdflatex.

I added there lines to the end of my main file:

%% Local Variables:
%% latex-run-command: pdflatex
%% End:

Whenever when I open the file, Emacs asks me whether to evaluate these settings, and I confirm.
However, C-c C-f still runs latex \\nonstopmode\\input input.tex.

Why doesn't it work? (this is the question I should point out clearly)

Also in Customize the setting of latex-run-command still is Standard.

After a significant waste of time, I wrote a Makefile that builds my document (keeping the PDF open in evince). So I use compile to build the file now.

Details:

When I run C-c C-f, the output starts like this:

latex \\nonstopmode\\input Farbe.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/TeX Live for SUSE Linux) (preloaded format=latex)

When I run pdflatex manually, the output starts like this:

pdflatex Farbe
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017/TeX Live for SUSE Linux) (preloaded format=pdflatex)

So the preloaded format is different, causing errors like

! LaTeX Error: Cannot determine size of graphic in RGB-Cube-3D.pdf (no Bounding
Box).

Also, using latex-run-command: "pdflatex" makes no difference: pdflatex is not being used.

More details:

When I load the file (having changed the settings to the following)

%% Local Variables:
%% latex-run-command: "pdflatex"
%% End:

and then do C-h v latex-run-command, I get:

latex-run-command’s value is "pdflatex"
Original value was "latex"
Local in buffer Farbe.tex; global value is "latex"

  This variable’s value is file-local.
  This variable may be risky if used as a file-local variable.

Documentation:
Command used to run LaTeX subjob.
LaTeX Mode sets ‘tex-command’ to this string.
See the documentation of that variable.

But still, the command run is not pdflatex, but latex!

More info (2019-11-28)

My Emacs is 25.3.1, and in loaddefs.el I have:

(defvar latex-run-command (purecopy "latex") "\
Command used to run LaTeX subjob.
LaTeX Mode sets `tex-command' to this string.
See the documentation of that variable.")

And tex-mode.el contains:

(setq-local tex-command latex-run-command)

Even when I tried this, it did nor work:

%% Local Variables:
%% latex--command: "pdflatex"
%% eval: (add-hook 'latex-mode-hook (lambda () \
%%  (setq latex-run-command "pdflatex")))
%% End:

I also had tried variants setq-local, tex-command instead of latex-run-command, but it all did not work.

Neither does it work after having used set-variable interactively to set latex-run-command, nor does it work after I had set the variable in "Customize Option: Latex Run Command".


texts: I'm curious about this. The author seems to talk about "processes" and whole buffers that hang around past their welcome. I'm hearing in this article that Emacs elisp can start a process, (this example uses system's ping?), but then the process stays live (where? on emacs' stack/heap?) until his finalize frees it. A simpler question might be, how can you intentionally free up anything else in a running (one namespace) Emacs session? For example, with org-mode's Library of Babel, "ingesting" a file of code blocks tangles said code, then with org-sbe attaches desired code blocks (by name) to a org-babel-library-of-babel a live variable. All right, I can set it to nil or redo it manually, but what about functions? Do you just set a function symbol to nil in your session? How can I get an overview of what's "live?"


texts:
I want my minibuffer prompt to be in bigger font, so I've added this to my .emacs:

(defun my-minibuffer-setup ()
  (set (make-local-variable 'face-remapping-alist)
       '((default :height 1.5))))

(add-hook 'minibuffer-setup-hook 'my-minibuffer-setup)

It looks like this:

However, when I press C-s, the font size is the default 1 for some reason.

How to make the i-search prompt also in larger size?


texts:
I have this in my init.el file:

(use-package dired
  :init
  (progn
    ;; Details toggling is bound to "(" in `dired-mode' by default
    (setq diredp-hide-details-initially-flag nil))
  :config
  (use-package dired+
    :ensure t)
  (add-hook 'dired-mode-hook 'auto-revert-mode)
  (add-hook 'dired-mode-hook  (lambda () (setq auto-revert-verbose nil)))
  )

Running Emacs with no window mode emacs -nw and when moving cursors I get "change ownership" instead when in directory view.
Removing the code related to Dired+ solved the problem.
Any pointers to why that happens? If no workaround, is there a way to disable Dired+ mode only when running emacs -nw


texts: How can I prevent GNU Emacs from splitting windows on startup?

texts: Whenever I try to open an existing file with GNU Emacs, the window always split horizontally so as to show two buffers: one buffer containing the file and the GNU Emacs buffer. How can I set up Emacs to not do that and show only the buffer that holds the file's text?


texts: Add timestamp to repeating task when marked DONE

texts:
Say I have this task:

* TODO Task
  SCHEDULED: <2019-12-21 Sat 13:00 +1w>

and I mark it done the day after. Then, the timestamp becomes <2019-12-28 Sat +1w> and I lose the previous entry, ie when looking at the agenda on Dec 20th, I will not see the task. Even with log-mode on, I will not see it on Dec 20th, but on Dec 21st (the day I marked it DONE).

In the manual for Repeated tasks, it says:

  As a consequence of shifting the base date, this entry will no longer
  be visible in the agenda when checking past dates, but all future
  instances will be visible.

Is there a way to get around this? Maybe an active timestamp of the current timestamp could be added automatically when marked DONE and the date is shifted into the future. Something like this:

* TODO Task
  <2019-11-30 Sat 13:00>
  <2019-12-07 Sat 13:00>
  <2019-12-14 Sat 13:00>
  SCHEDULED: <2019-12-21 Sat 13:00 +1w>


texts: Theming Emacs's mode-line like Mac version in Linux

texts:
How can I make Emacs24's mode-line to show like how its displayed in Mac version of Emacs?

Is there any package or script or config for this?

I mean like this image:

Note: I know this has nothing with Mac but the brew install version in there is like this & I just to explain myself;


texts: Fontify org quote blocks with font-locked markup

texts:
I have org-fontify-quote-and-verse-blocks set to t and '(org-block ((t (:foreground "#2E8B57")))) to make quote blocks stand out in a particular color. However, this also means that I cannot get markup like /emphasis/ or *bold* to display properly in such a fontified quote block.

So is there a way to have both of these together? In other words, have fontified quote blocks that display in a particular color and have them display text according to its markup (i.e. /emphasis/ looks like emphasis?

EDIT: On emacs 25.3.1 and org 9.1.3 this now works, though I'm not sure what the change was that allowed this to be so.


texts: Inserting before an after-string overlay

texts:
I'm using after-string overlays as in this question to put text on the right hand side of the buffer, like this:

(let ((overlay (make-overlay (point-max) (point-max) (current-buffer))))
  (overlay-put overlay 'intangible t)
  (overlay-put overlay 'before-string
               (concat
                (propertize " " 'display `(space :align-to (- right-fringe ,(1+ (length text)))))
                text))
  overlay))

This works well, but if I position the cursor at the end of the buffer at insert characters, I insert past the overlay.

In the image, the check mark is my overlay, and the x after it is something I inserted by typing an x after the word Type, which was previously the last word in the buffer.

How can I stop this from happening? I'd like the overlay to permanently sit past all the actual text in the buffer.


texts: Whether a item in org mode is a plain todo item

texts:
I am customizing org-clock-in-hook to do some action after a item is clocked in.But first I need to make sure whether the clocked-in item is a plain todo item or a agenda item (scheduled or deadlined).

I has dig through the org mode source,but related code is long and it's all regular expressions.

Any guy can provide a elegant solution?


texts: How do I run two simultaneous ediffs involving the same file? i.e., ediffs A, B and A, C

texts:
I would like to ediff files (or buffers) A and B, and also A and C.  The need arises from the fact that A and B were both forked from C, and I need to merge B into A while checking I'm not destroying any ideas in A\C.

I'm not an experienced diff-er, but I thought I would do this by viewing ediff A,C while merging bits of B in to A.

It seems that when I start the second ediff involving A, it takes over my emacs instance and I can't seem to see the other ediff.

My first thought is to just run two different instances of emacs, but how would you do this?


texts:
Sorry, I'm new to emacs and I'm sure this is a very basic question.

For my personal projects I prefer spaces for indentation, whereas work requires smart-tabs (tabs for indentation, spaces for alignment).

I would like to create a .dir-locals.el file in my work project root, so that whenever I open a C++ file it automatically switches to indent-tabs-mode and turns on smart-tabs.

This is what I have in my .dir-locals.el file, but it is not working.

(defun my-c++-mode-setup()
  (use-package smart-tabs
    :config
    (smart-tabs-default-insinuations '(c c++)))
  (setq indent-tabs-mode . t)
  )
(add-hook 'c++-mode-hook 'my-c++-mode-setup)


texts: Tangling fundamental source blocks with org-header like code

texts:
I have a code blocks for a domain specific input files that I want to have in a single org file and tangle them out to separate files (see Tangling non-code files to separate files). However, my source has things in it that look like org-mode headings, e.g.:

#+BEGIN_SRC fundamental :tangle test.inp
* minimize
*

open unit 10 read form name methanol.rtf
read rtf card unit 10
close unit 10
...
#+END_SRC

and these don't get tangled. Removing the * minimize line or putting any amount of text before it does not solve the problem. The "headers" aren't highlighted but they still have folding etc., and emacs won't let me put spaces in front of them.

Seems like a bug, but a workaround would be helpful.


texts: Deactivate subscripts and superscripts raising / lowering in latex mode

texts:
On a new install, I noticed that Emacs systematically lowers or raises what it identifies as subscripts or superscripts (sometimes correctly, sometimes incorrectly...) due to the presence of _ or ^ in latex-mode.
Syntax highlighting is enough for me, and I do not want Emacs to do any WYSIWYG mess, so I need to deactivate this.

I found several old notes that addressed other causes of this, and tried them all, but it seems my issue is a different one.

I have GNU emacs-25.2.1 (under Linux gentoo).
I am not using any of the "advanced modes" (yatex, auctex) as they do even more visual things that I do not like. I am just using the stock latex-mode, which used to be fine for my purpose.


texts: In Emacs Lisp, how to convert roman numerals to an integer?

texts:
In Emacs Lisp, how to write an Emacs Lisp function to convert a natural number from roman numerals representation to the equivalent Emacs Lisp integer value? The Emacs Lisp function should be callable from Emacs Lisp and return an Emacs Lisp integer object for further processing in an Emacs Lisp program. I would like to accomplish this with Emacs Lisp, so I'm not expecting answers written as keyboard macros, other Lisp dialects, or shell scripts. Answers written as one or more Emacs Lisp functions would be ideal, thanks!

Background:

I gather data from all kinds of sources, and occasionally people use numbers written as roman numerals. Such numbers are not very useful for sorting and comparing with numbers in other forms. I decided it should be doable in Lisp, but if Emacs contains any function to do the conversion, I could not find it. (Maybe it is in an external library?)

Here's the most applicable solution I found via a general web search:

https://www.rosettacode.org/wiki/Roman_numerals/Decode#Emacs_Lisp

Unfortunately this function expects the number to be encoded as one Emacs Lisp symbol per digit, or a list of such symbol encoded digits. When dealing with web data, file names, or most other sources the roman numerals will most likely be in an Emacs Lisp string object.

My solution: Write a wrapper function to convert a string into symbol or list of symbols as required for the funciton linked above. (Is this really the best way?)

(defun ro2ar (RN)
  "translate a roman number RN into arabic number.
    Its argument RN is wether a symbol, wether a list.
    Returns the arabic number. (ro2ar 'C) gives 100,
    (ro2ar '(X X I V)) gives 24"
  (cond
   ((eq RN 'M) 1000)
   ((eq RN 'D) 500)
   ((eq RN 'C) 100)
   ((eq RN 'L) 50)
   ((eq RN 'X) 10)
   ((eq RN 'V) 5)
   ((eq RN 'I) 1)
   ((null (cdr RN)) (ro2ar (car RN))) ;; stop recursion
   ((< (ro2ar (car RN)) (ro2ar (car (cdr RN)))) (- (ro2ar (cdr RN)) (ro2ar (car RN)))) ;; "IV" -> 5-1=4
   (t (+ (ro2ar (car RN)) (ro2ar (cdr RN)))))) ;; "VI" -> 5+1=6
=> ro2ar

(defun roman-numerals-to-integer (rn)
  "Return the integer value of the natural number represented by RN.
    RN may be a string, single digit symbol, or list of single digit
    symbols.
    URL `https://www.rosettacode.org/wiki/Roman_numerals/Decode#Emacs_Lisp'"

  (ro2ar
   (if (not (stringp rn))
       rn
     (mapcar
      (lambda (x)
    (intern (string x)))
      rn))))
=> roman-numerals-to-integer

(mapcar 'roman-numerals-to-integer
    '(M D C L X V I))
=> (1000 500 100 50 10 5 1)

(roman-numerals-to-integer '(M D C L X V I))
=> 1666

(roman-numerals-to-integer "MDCLXVI")
=> 1666


texts: spacemacs how to show the documentation of a function during autocomplete in c-c++ layer

texts:
I am looking for a good alternative ide for c++ and for that started to lern first vanilla emacs and now spacemacs. I have configured my .spacemacs now to be able to edit lisp code quite comfortably using company-mode.

The most important feature for me is that the function documentation of the candidates is shown in a help popup automatically as I was used to from "Netbeans" in java.

Today I have started to work on a c++ project using the c-c++ layer and company-clang. I have managed to get it running so that I get code completion of my c++ functions as well as my snippets, though the header completion seems to only finding the old c headers like "string.h" and not "string".

However I don't receive any help popup during completion. Did I do anything wrong or is this simply not supported by the layer? And more importantly is there an alternative layer/plugin available to get that working?

If anybody has a hint for the string header file issue I would also be happy to hear about it.


texts: Emacs term loses characters when using ps and grep

texts:
I'm trying to use different terminals on Emacs.
The one I'm currently trying is term.

When I execute a ps command and grep its output on Emacs, I don't get the same result as in gnome-terminal, xterm, etc...

This is what I get on Emacs:

etomort@elx306b6vv:~$ ps -ef | grep juniper
etomort  28860 28781  0 11:41 pts/2    00:00:00 grep --color=auto juniper
etomort@elx306b6vv:~$ ps -ef | grep 13109
etomort  13109     1  0 09:51 ?        00:00:04 /usr/lib/jvm/java-7-oracle/jre/bin/java -classpath /usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar:/home/etomo
etomort  28876 28781  0 11:41 pts/2    00:00:00 grep --color=auto 13109

Bear in mind that greping by process id does not either include juniper on its output.

And this is what I get on gnome-terminal:

etomort@elx306b6vv:~$ ps -ef | grep juniper
etomort  13109     1  0 09:51 ?        00:00:04 /usr/lib/jvm/java-7-oracle/jre/bin/java -classpath /usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar:/home/etomort/.juniper_networks/tncc.jar net.juniper.tnc.NARPlatform.linux.LinuxHttpNAR log_level 2 postRetries 6 ivehost www.myvpn.org Parameter0 interval=0;process_timeout=5;failurl=;cert_md5=1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j;hash_key=1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j;id=1a2b3c4d5e6f7g8h9i0j1a2b3c4d5e6f7g8h9i0j;logging=0 locale en home_dir /home/etomort user_agent Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
etomort  28775 22252  0 11:40 pts/11   00:00:00 grep --color=auto juniper

So it seems that Emacs term loses characters somewhere between the ps and the pipe before the grep.

Note: I'll check in Meta Stack Exchange how to present better the output of ps, since I would prefer them truncated.


texts: Emacs opens gpg file without asking for passphrase

texts: I have an ASCII-armored GPG file that I open with a bookmark, and lately emacs has taken to opening it without asking for the passphrase, even if I just started emacs. I can't remember if I used symmetric encoding or my key. epa-file-cache-passphrase-for-symmetric-encryption is set to nil, gpg-agent isn't installed, and I don't think Gnome is caching it. So what gives? Thanks in advance.


texts: How to get TODO sequence without exporting as a section?

texts:
I maintain an org file to organize my literature survey. The headline structure reflects the hierarchy of topics in my research area. Within each topic, there is a list of research articles. A TODO sequence helps me recall how deeply I have studied each article.

The problem is that, to use the TODO sequence, I need to have a headline for each article. During the export to latex, this results in a section created for each article, whereas I want to have a numbered list of articles within each topic. Setting org-export-headline-levels does not solve the problem, since topics can be nested a various levels.

Thus, it seems that I am looking to somehow associate TODO sequence with items rather than headlines. Is this possible? If not, is there an idiomatic solution to my problem?


texts: Org mode flashes indentation of lines with parentheses

texts:
I've been having some issues using org-mode with paren matching. Here are a few screenshots of the problem. In short, when my mouse isn't on a line, the line is shown correctly, but when parenthesis are being highlighted the line drops to the minimum indentation. W/o paren highlighting this problem isn't there, but I wanted to keep that in org mode.

Note, this happens only on the last line (but this is a problem, as that is the line i'm usually editing).


texts: Get filename of a message opened in mu4e

texts: How can I get the actual file name of a message (as it is stored on my disk) opened with mu4e?


texts: How to check, if a file is already visited?

texts:
I have the following code, which opens a file, inserts some text, saves the file and closes it.

(defun batch (file)
  (find-file file)
  (end-of-buffer)
  (insert "nix")
  (save-buffer)
  (kill-buffer))

If the file is already visited the buffer gets closed. How to prevent that? How to keep the buffer, if find-file does not created a new buffer? How to know, if a file has already been opened in a buffer?


texts:
Related:

https://stackoverflow.com/questions/7598433/how-to-remove-a-key-from-a-minor-mode-keymap-in-emacs
How can I find out in which keymap a key is bound?

There is a default keybinding in ESS that I accidentally trigger periodically: C-c C-e r calls inferior-ess-reload which kills and restarts my running R process. (It is close-enough to C-c C-e w ess-execute-screen-options that my finger might tap the R key.)

I know the map to which it is assigned (https://github.com/emacs-ess/ESS/blob/master/lisp/ess-mode.el#L115). I'm trying to add an unbind to a package hook, either of

(define-key ess-extra-map "\C-c\C-er" nil)
(define-key ess-extra-map (kbd "C-c C-e r") nil)

but after running those commands, C-h b and C-h C-k C-c C-e r confirm that it is still bound.

A third option would be to just comment-out those lines in ess-mode.el, but that won't survive updates.

Is there a better way to do it?

GNU Emacs 26.2 (build 1, x86_64-w64-mingw32) of 2019-04-13
ess-version: 18.10.3snapshot [elpa: 20190814.1054] (loaded from c:/Users/r2/.emacs.d/elpa/ess-20190814.1054/)

Update 1

From Drew's suggestion, here is the relevant portion of C-h b, filtering for C-c C-e:

Key translations:
key             binding
---             -------
...
C-c C-b         ess-eval-buffer
C-c C-c         ess-eval-region-or-function-or-paragraph-and-step
C-c C-d         ess-doc-map
C-c C-e         ess-extra-map
C-c C-f         ess-eval-function
...

C-c C-e C-c     Prefix Command
C-c C-e C-d     ess-dump-object-into-edit-buffer
C-c C-e C-e     ess-execute
C-c C-e TAB     ess-install-library
C-c C-e C-l     ess-load-library
C-c C-e C-r     inferior-ess-reload
C-c C-e C-s     ess-set-style
C-c C-e C-t     ess-build-tags-for-directory
C-c C-e C-w     ess-execute-screen-options
C-c C-e /       ess-set-working-directory
C-c C-e C       Prefix Command
C-c C-e d       ess-dump-object-into-edit-buffer
C-c C-e e       ess-execute
C-c C-e i       ess-install-library
C-c C-e l       ess-load-library
C-c C-e r       inferior-ess-reload
C-c C-e s       ess-set-style
C-c C-e t       ess-build-tags-for-directory
C-c C-e w       ess-execute-screen-options

...

Global Bindings:
key             binding
---             -------

...
C-c C-e         Prefix Command
...

I'm not certain why C-c C-e is shown in both "Key translations" and "Global Bindings", is that an issue?


texts: move file associated with open buffer to a specific folder

texts:
For a long time I've been using this function (originally made by Steve Yegge) to move files in emacs. This lets the user move the file associated with the currently open buffer to a different folder which is selected interactively. What I'd like to do now is to start using an additional version which always moves files to a specific "archive" folder rather than having the user select it. But looking at it for a while I'm not sure how to replace the user input with a default variable and have it always move files there. How could that be done?
(defun move-buffer-file (dir)
 "Moves both current buffer and file it's visiting to DIR."
 (interactive "DNew directory: ")
 (let* ((name (buffer-name))
     (filename (buffer-file-name))
     (dir
     (if (string-match dir "\\(?:/\\|\\\\)$")
     (substring dir 0 -1) dir))
     (newname (concat dir "/" name)))

 (if (not filename)
    (message "Buffer '%s' is not visiting a file!" name)
   (progn
     (copy-file filename newname 1)
     (delete-file filename)
     (set-visited-file-name newname)
     (set-buffer-modified-p nil)    t))))


texts: How to bind a key inside the completing-read prompt?

texts:
In one of my packages, I use a loop with completing-read to query the user for a list of words. Inside the prompt, I'd like to bind DEL to a different command.

How can I achieve that?

The solution also needs to work with ido-completing-read (possibly with small modifications of course).


texts: Now that emacs supports frames in terminal mode, I'm finding that the help commands open in a new frame. Is there a way to automatically switch to the new frame after it is created? I have seen the answer that forces the help buffers to open in the current frame, but since I have defined a special look for the help frames, I like that it creates them in a new frame. I would like to switch to it automatically. What is more annoying is that C-x 5 o doesn't even take me there but goes to *Messages* first. It took me a long time to figure out why I couldn't see the help information.


texts:
I am using
Auctex.
I found several useful shortcuts starting with C-c. But I could not find the keyboard shortcut to change content within {} if the cursor is within.

So, I am editing (| indicaties cursor position)

  \section{Some S|ection Name}

And I want to change this to

  \section{Completely different}

How do I do this quickly?


texts: Confused by property :ID: versus :CUSTOM_ID:

texts:
I use org-id to automatically create ID.

For instance in an org mode file:
File_A.org

* File_A section

I type C-c l that create an id

* File_A section
  :PROPERTIES:
  :ID:       21588817-03d2-4000-8d37-43649499eff6
  :END:

Then I want to include File_A section in another file, File_B.org,

(in File_B.org)

#+INCLUDE: ".file_A.org::#21588817-03d2-4000-8d37-43649499eff6"

However, this does not work (C-c ' does not follow the link).

To make it works I have to manually add a redundant "CUSTOM_ID" property.

* File_A section
  :PROPERTIES:
  :ID:       21588817-03d2-4000-8d37-43649499eff6
  :CUSTOM_ID: 21588817-03d2-4000-8d37-43649499eff6
  :END:

I am confused by the role of :ID: and :CUSTOM_ID:...

Why on one side Org-Mode's #+INCLUDE:s follow :CUSTOM_ID: (official doc) and on the other side, org-id's links (C-c l and C-c C-l) use :ID: (official org-mode/org-id.el file)?

Ideally I do not want to have a redundant and manually added:CUSTOM_ID: every time I use #+INCLUDE:.
My question: is there a clean way to #+INCLUDE: a section using :ID: and not :CUSTOM_ID:?


texts:
I'm using Firefox extention It's all text, with it I can edit stackoverflow form text in Emacs.

Therefore I often want to add four spaces before selected text to markdown codes.
indent-region only "indent" the region. Is there already function like this or should I write it myself?

I already installed markdown-mode.


texts: How to efficiently include a repository relative path in the mode-line?

texts:
Currently in the mode-line the filename %f, is absolute.

I would like to have the path relative to the version-control root, without having to find this every redraw.

How could this be cached, allowing for changes to the buffers filename to be refreshed?


texts: Org-babel: Notify if the result of execution differs from the previous recorded result

texts:
I want to use my org-mode documentation as a sort of quasi-unittest; I want to execute the whole buffer, and be notified if marked cells' new results differ from their previous results. E.g,
#+begin_src python :results verbatim :exports both :wrap example :notify_on_change
x3(10)
#+end_src

#+RESULTS:
#+begin_example
30
#+end_example

Suppose x3 is changed and now x3(10) returns 40. I want to be notified that this change has happened (and get a diff of the two results).
PS: If this should be possible for visual (image) results, it would be really awesome.
PPS: Is there any testing framework that works like this? I.e., it only reports change, and does not need you to manually hardcode values?


texts: ryo-modal defining keybind jump a word and insert character

texts:
I'm using the ryo-modal package that enables you to define your own keys in modal editing. I'm trying to makemf move the cursor to the end of the word, insert a whitespace and then exit the modal mode. This works fine without the :then '(insert " ") part. However, I would really like to see my original idea working. Thanks in advance.

(ryo-modal-key "f" 'forward-word :then '(insert " ") :exit t)


texts: As an example, let's use latex-mode, that inherits from tex-mode, that inherits from text-mode. Is there a command, that would take as input latex-mode and give me parent and grand-parent? Or, other way around, is there a command that would take text-mode as input, and give me children and grand-children?


texts:
One org-mode file started showing strange coding instead of spanish characters (á, é, ...). Instead of "Música" and "fotografía" it shows "M\303\272sica" and "fotograf\303\203\302\255a".

I'm using Spacemacs 0.200.13 on Emacs 26.3 in Linux Mint 19.2

I tried setting the coding in the file using:

  % -- coding: utf-8 --

and now "Música" appears correctly, but "fotografía" now reads "fotografÃa".

I'd like to know where to set the coding correctly, if globally in .spacemacs or somewhere else, or inside the problematic file (no problems with other org files). And which coding to use for spanish.


texts: Why does text surrounded by tildes in org mode turn grey

texts: I noticed that text surrounded by tildes in org-mode turns grey (as least in my colour theme, and I assume the colour changes in others as well).  What is that about?


texts:
I like using org-mode in my packages' Readme files, but I also like
writing instructions under the ;;; Commentary: header that goes in
the source file.

Whenever I change some part of the documentation, the best way I've
found to keep those in sync is to:

Edit the org file first.
Export to a plain text utf-8 buffer, with the body-only option (C-c e C-b t U).
Add ;; at the start of each line.
Copy that over to the package file.

Q: How can I best automate this?

I can write the necessary elisp for adding ;; and copying to the
kill-ring, but I'm not familiar enough with the org-export machinery
to know what's The Right Way to do an automated export using a
specific recipe.

Bonus points if there's a command I can invoke from a .el file which
automatically finds a Readme.org, does the whole export, and uses it
to replace the file's ;;; Commentary:.


texts: I am trying to track down a weird bug in my emacs configuration - the cursor, occasionally, jumps to a random location when I am scrolling using the arrow keys, in cc-mode. I don't see any accidental keystrokes registered in view-lossage. Is there a way to get a list of all functions called, instead of just the commands displayed by view-lossage?


texts: I've tried to install Emacs on Windows (7) with msys2, however, I'm not sure if it worked. In any event, I can't find it on my machine. The install (following these instructions seems to go fine -- but then no Emacs.


texts: Projectile indexes my home directory, how do I stop it from doing that?

texts:
Since I updated the whole of my emacs third party packages projectile has started to see my home folder (which emacs opens in) as a projectile project.

There is no .projectile file in my home folder, neither is my home folder under version control.

marcus@mri-tp:~ >>> cat ~/.projectile
cat: /home/marcus/.projectile: No such file or directory

My home folder is also not in my projectile-bookmarks.eld:

("~/.emacs.d/" "~/projects/pwb-ss15/" "~/projects/fhw-symmrecog/" "~/fhw/ss15/dbassistenz/" "~/projects/dsa-compendium/" "~/.zprezto/" "~/projects/pwb-ws13/" "~/fhw/ss15/db/" "~/fhw/ss15/ps2_00/" "~/projects/jekyll-school/" "~/projects/webIsoRogue/" "~/projects/spacerace/" "~/projects/marcusriemer.de/")

I am however using projectile together with helm and ecb. To sync the ecb file tree I use the snippet from the emacs wiki: ecb + projectile:

(defvar default-ecb-source-path ())

(add-hook 'ecb-basic-buffer-sync-hook
                (lambda ()
                        (when (functionp 'projectile-get-project-directories)
                        (when (projectile-project-p)
                                (dolist (path-dir (projectile-get-project-directories))
                                (unless (member (list path-dir path-dir) default-ecb-source-path)
                                        (push (list path-dir path-dir) default-ecb-source-path)
                                        (customize-set-variable 'ecb-source-path default-ecb-source-path)
                                        ))))))

As far as I can tell I have not set projectile-require-project-root(nil):

marcus@mri-tp:~/.emacs.d >>> find . -iname "*.el" | xargs grep "projectile-require-project-root"
./elpa/helm-projectile-20150610.253/helm-projectile.el:  (let ((projectile-require-project-root nil))
./elpa/helm-projectile-20150610.253/helm-projectile.el:  (let* ((projectile-require-project-root nil)
./elpa/helm-projectile-20150610.253/helm-projectile.el:                (let ((projectile-require-project-root nil))
./elpa/projectile-20150610.2247/projectile.el:(defcustom projectile-require-project-root t
./elpa/projectile-20150610.2247/projectile.el:        (if projectile-require-project-root
./elpa/projectile-20150610.2247/projectile.el:        (projectile-require-project-root nil))
./elpa/projectile-20150610.2247/projectile.el:  (let ((projectile-require-project-root nil))

Does anyone have an idea why projectile started to index my home directory? And how can I tell it to ignore my home folder once and for all?


texts:
I've got the following elisp:

(setq proc (start-process "powershell" "*powershell*" "powershell.exe"))

Unfortunately, I can't seem to get proc to do anything.  For instance, in an normal shell, I can say Get-Credential and be presented with a GUI popup asking for a username/password.  What I imagine as the analog simply doesn't work:

(process-send-string proc "Get-Credential\n")

How can I get my process to do something?

I essentially want a shell that I can manipulate programmatically.


texts:
I am trying to use Tramp with auto-revert-tail-mode to perform a tail of a remote log. Every time the log updates (which is often), the screen briefly jumps to the bottom of the file and then back to my current location in the file. Is there a way to prevent these frequent jumps? I simply want to be able to browse and search the most updated version of the file, but without being sent to the bottom of the file during every update.

Also, is there any way to quiet/silence the frequent updates in the status bar? "Tramp inserting:..." "Tramp encoding:...."


texts:
I want to be able to launch a new emacsclient and issue org-capture in it. I have created this simple function:

(defun make-orgcapture-frame ()
  "Create a new frame and run org-capture."
  (interactive)
  (make-frame '((name . "zorg") (width . 180) (height . 160)
                (top . 400) (left . 300)
                ))
(select-frame-by-name "zorg")
(delete-other-windows)
(org-capture)
)

i then launch it with this command

emacsclient -n -e '(make-capture-frame)'

while this works it always opens in a split view where an old buffer from any current emacs frame i have open appears.

is there anyway i can make the org-capture buffer take the whole frame?


texts: How to enable company-mode for some buffers only?

texts:
I would like company mode to lead automatically for some buffers like AucTex  for example but not on other buffers like Org-mode

global-company-mode

Enables comapny mode everywhere and I only want to set it locally


texts: Exporting LaTeX commands to HTML/MathJax

texts:
I am writing a document that is specifying a language with associated grammar and semantics. For this I have written the specification in Latex, using a method very similar to the one presented here.

That is: it heavily uses Latex's \newcommand macros. However, the contents of the commands themselves are nothing fancy and falls within the subset of Latex that MathJax supports.

I am slowly rewriting my documentation to Org mode, partially because of the HTML backend, allowing me to not only generate the original-ish PDF, but also a HTML page containing the same.

Now my question is: how can I export my (big list of) Latex \newcommand macros to Org such that they get compiled back to their originals on the Latex backend, but to their MathJax equivalent when exporting with the HTML backend?

Bonus question: Is it possible to redefine macros in MathJax? My original version contains several iterations of the same things, and overloads the macros by simply calling \renewcommand. Ideally, I would replicate this in MathJax, but it is not a dealbreaker: I can "simply" append some version id to each new iteration of the command, i.e. \somecommandA, \somecommandB etc.


texts:
This

* Charles's seminar
  <2018-08-21 Tue 10:00-12:00+1w>

is a seminar repeated every week.  But it doesn't go on forever.
How do I set an end date?


texts: Org Mode: exporting agenda with inherited tags

texts:
The manual says:

C-x C-w     (org-agenda-write)
Write the agenda view to a file. [...] only the body of original headlines are exported, not subtrees or inherited tags.

How to export inherited tags anyway?


texts: Portable way of setting the windows urgent hint?

texts:
I've seen links to X11 flag setting that sets the current windows urgent hint.

Is there a portable way to do this in Emacs? Or does it need to be handled per-platform?


texts:
After installing the browse-kill-ring package under Emacs 24.5.1, I get the following error when running the browse-kill-ring command:

  font-lock-set-defaults: Wrong type argument: symbolp, (font-lock-fontify-region-function . browse-kill-ring-fontify-region)

What is going wrong and how do I fix it?


texts: Styling the "sorting turned OFF" modeline message in *Bookmark List* buffer?

texts:
I'm using bookmarks+ and smart modeline and have gone some way to styling the modeline and the Bookmark List buffer.  I'd like to change the appearance of the modeline message "sorting turned OFF" in that buffer too.  Currently it looks like:

Which does not match the modeline faces. Looking through the list of display faces it seems to be similar to the bmkp-heading face?  Can anyone enlighten me on which faces or settings control the display of this text message?

Thanks,

Stu


texts: How to pass through variables through src blocks to other src blocks

texts:
I am using Emacs version 26.3 and Org Mode version 9.3.6.

My goal is to have several different #+CALL: lines, each using a different value of some header argument (in the example below, that is inarg).

Typing C-c C-c on the first #+CALL: line below:

#+NAME: sub_func1
#+BEGIN_SRC bash :results verbatim :var inarg=""
echo sub_func1 inarg $inarg
#+END_SRC

#+NAME: main_func1
#+BEGIN_SRC bash :results verbatim :var inarg="" :var sub_func1_result=sub_func1(inarg=inarg)
echo main_func1 inarg $inarg sub_func1_result $sub_func1_result
#+END_SRC

#+CALL: main_func1(inarg="hardcoded1")
#+CALL: main_func1(inarg="hardcoded2")

produces this error:

org-babel-ref-resolve: Reference ‘inarg’ not found in this buffer

How do I pass the inarg variable all the way down to sub_func1 without having to hardcode the value of it in both main_func1 and sub_func1?

The results I expect are from the following, which I do NOT want to have to do as it means I have to update both values of "hardcoded1" when that value changes:

#+NAME: sub_func2
#+BEGIN_SRC bash :results verbatim :var inarg=""
echo sub_func2 inarg $inarg
#+END_SRC

#+NAME: main_func2
#+BEGIN_SRC bash :results verbatim :var inarg="hardcoded2" :var sub_func2_result=sub_func2(inarg="hardcoded2")
echo main_func2 inarg $inarg sub_func2_result $sub_func2_result
#+END_SRC

#+CALL: main_func2()

#+RESULTS:
: main_func2 inarg hardcoded2 sub_func2_result sub_func2 inarg hardcoded2


texts: How to get the mode-specific help information or help files

texts:
No matter in which mode I am currently in,
is there a general way / key combination to open the help file related to the currently active mode?


texts:
I want to learn Elisp so I'm trying to solve perl6 weekly challenges. There is one on the week 48:

  Survivor

  There are 50 people standing in a circle in position 1 to 50. The
  person standing at position 1 has a sword. He kills the next person
  i.e. standing at position 2 and pass on the sword to the immediate
  next i.e. person standing at position 3. Now the person at position 3
  does the same and it goes on until only one survives.

  Write a script to find out the survivor.

I want to implement it using rings and see how the sequence is descending, but it seems that when it has two elements it is not working properly, or probably I do not get the point:

ELISP> (setf r (ring-convert-sequence-to-ring (number-sequence 1 5)))
(0 5 .
   [5 4 3 2 1])

ELISP> (princ-list (ring-remove r 1) r)
2(0 4 . [5 4 3 1 nil])

"
"
ELISP> (princ-list (ring-remove r 2) r)
4(0 3 . [5 3 1 nil nil])

"
"
ELISP> (princ-list (ring-remove r 3) r)
1(0 2 . [5 3 nil nil nil])

"
"
ELISP> (princ-list (ring-remove r 4) r)
3(0 1 . [5 nil nil nil nil])

"
"

Maybe at the end of each loop I need to change it but working in another way I get:

ELISP> (setf r (ring-convert-sequence-to-ring (number-sequence 5 1 -1)))
(0 5 .
   [1 2 3 4 5])

ELISP> (princ-list (setf (car r) 1) (ring-remove r) (ring-resize r 4) r)
120(0 4 . [3 4 5 1])

"
"
ELISP> (princ-list (setf (car r) 1) (ring-remove r) (ring-resize r 3) r)
140(0 3 . [5 1 3])

"
"
ELISP> (princ-list (setf (car r) 1) (ring-remove r) (ring-resize r 2) r)
110(0 2 . [3 5])

"
"
ELISP> (princ-list (setf (car r) 1) (ring-remove r) (ring-resize r 1) r)
150(0 1 . [nil])

"

"

But I do not understand the last step.

So firstly I want to know how ring works, and are there circular linked lists in EmacsLisp?

Or maybe I need to focus on the recursive solution of the problem, and not work with circular linked lists.


texts: Selecting punctuation, namely, periods, commas, question marks, exclamations, etc. in Emacs

texts:
I use Emacs mostly for writing text not code. This involves a great deal of selecting, deleting and editing, as one would expect. By default if I move forward by a word in Emacs, Emacs ignores basic punctuation such as . , ; ? ! ' ". This is especially problematic for me when I want to copy or delete text because it involves using both M-f and then C-f. What I would like is for Emacs to move forward to the empty space AFTER a punctuation mark, so that the punctuation mark after a word becomes part of the selection. If one moves forward by sentences, Emacs does this naturally, but not when one moves by words, and by implication by phrases.

For example, in the sentence,

Bob went to the store, in a joyful, happy mood.

If I wanted to delete the words "to the store," (including the comma) I would like to simply use the mark and press M-f 3 times without also having to then press C-f.

I have tried some solutions but none of them really worked for me, including,

evil-mode (I like Vim's behaviour when it comes to moving by words, but do not wish to change my whole workflow to evil)
forward-same-syntax (movements are too refined)
the package syntax-subword (changes the Emacs default too radically)

Please note that my default file mode is org-mode, not text-mode.


texts:
Been scouring the internet for a couple days now trying to figure out the solution to my question with no luck.  Hopefully someone here knows how to do this.

I'm currently trying to set up my EMACS to be able to run a .bat file on my Windows 7 machine through the "M-x shell" command.  If I open up a shell and navigate to my directory and run BuildDTO.bat it works just fine.  I've also got an odd kind of solution that runs the command but only opens the output of the command in a buffer once it's finished running.  The code in my .emacs file is shown below:

(defun compile ()
  "Runs a quick compile on the code.  Note this is specific to this work environment."
  (interactive)
  (with-current-buffer
    (shell-command "PATH_TO_BAT/BuildDTO.bat")))

Here I am binding the compile command to my "M-m":

(global-set-key (kbd "M-m") 'compile)

My issue is that I want to maven going through the steps of compiling.  Going through "M-x shell" and running the DTO creates a nice scrolling buffer with the output of each step but the compile() function does not.  Any suggestions about how I could get this work?  I'm kind of new to EMACS so I apologize if this is a rather dumb question but I can't figure out the solution.

Thanks,


texts: Export a docx file to org using pandoc but without the property drawers

texts:
If I export a docx file to org using Pandoc as follows

pandoc -s test.docx -o test.org

I get a nice org file with markup. However, I also get unwanted properties with each heading in the file, generated from the headings. For example:

* Heading One
  :PROPERTIES:
  :CUSTOM_ID: heading-one
  :END:

I don't want all these heading properties. Can I export without these drawers?

I found a similar article but this did not help me:

in org-mode, a function to delete all properties drawers?

Otherwise, I would like to be able to strip the exported org file of all of its property drawers. Is this possible?


texts:
I'm running Emacs on a linux system and the function user-full-name,
when called with no arguments, always returns an empty string.

How can I fix this?

I assume it's something I need to configure on my user account, maybe
an environment variable.

(The variable user-login-name works fine.)


texts: How to solve "Autoloading failed to define function sml-mode"?

texts:
I have just install a version of emacs (GNU Emacs 24.5.1 i686-pc-mingw32) on a Windows 8 Machine. On trying to open an example SML file (Standard ML Language). An error occurred:

  File mode specification error: (error "Autoloading failed to define function sml-mode")

On deeper inspection the debugger shows this:

  Debugger entered--Lisp error: (error "Autoloading failed to define function sml-mode")
    sml-mode()
    set-auto-mode-0(sml-mode nil)
    set-auto-mode()
    normal-mode(t)
    after-find-file(nil t)
    find-file-noselect-1(# "g:/example00.sml" nil nil "g:/example00.sml" ((512 4 . 8192) (48259 . 42323)))
    find-file-noselect("g:/example00.sml" nil nil nil)
    find-file("g:/example00.sml")
    find-file-existing("g:/example00.sml")
    menu-find-file-existing()
    call-interactively(menu-find-file-existing nil nil)
    command-execute(menu-find-file-existing)

How can I resolve this error?

Edit : I installed sml-mode via list-packages.


texts: How to store all links into a text file?

texts:
I have stored some links using org-store-link. I want to write a function which when called, would print all of them into an org file. Something like this:

(defun write-to-file()
 (interactive)
 (setq filename "test.org")
 (append-to-file   (org-insert-all-links 1)  nil filename))

How to make the above work?


texts: tramp hanging on remote fish shell despite tramp-remote-shell being /bin/sh

texts:
I can't connect via Tramp to a remote machine since switching to using fish as my default shell. However I have the tramp-remote-shell set for "/bin/sh" but this seems to be only used for interactive sessions. Annoyingly switch back to bash as my default-shell I still get failures:

09:39:17.904971 tramp-process-one-action (5) # Looking for regexp "\(^[^#$%>
]*[#$%>] *\)\'" from remote shell
09:39:17.905142 tramp-process-one-action (5) # Call ‘tramp-action-succeed’
09:39:17.905535 tramp-process-actions (3) # Waiting for prompts from remote shell...done
09:39:17.905931 tramp-maybe-open-connection (3) # Found remote shell prompt on ‘torrent’
09:39:17.907315 tramp-get-remote-stat (5) # Finding a suitable ‘stat’ command
09:45:50.841514 tramp-file-name-handler (1) # Interrupt received in operation (file-attributes /ssh:torrent:/files-x.elc string)
"/bin:/usr/bin"
tramp_exit_status 0
[~] $
09:45:50.842029 tramp-file-name-handler (1) # Interrupt received in operation (file-readable-p /ssh:torrent:/files-x.elc)
"/bin:/usr/bin"
tramp_exit_status 0
[~] $
09:45:50.842926 tramp-maybe-open-connection (3) # Opening connection for torrent using ssh...failed

Despite having a very simple prompt setup. This seems to be infuriatingly random as my tramp setup seems to vary from working to being broken with apparent randomness.


texts: mirror/auto populate a section of text in another location in the same buffer/other file

texts:
Im looking for a way to to mirror/auto populate a section of text in another location in the same buffer and/or other file.

for example, i manage my config files in org mode for multiple machines. i want to have a section like this

#+BEGIN_SRC conf :mkdirp yes :tangle ~/machine A
CODE
#+END_SRC

where the same content of CODE is mirroed/auto generated in another code block for machine B

#+BEGIN_SRC conf :mkdirp yes :tangle ~/machine B
CODE
#+END_SRC

is this in anyway possible?


texts: Rorg-roam not showing backlinks when files are open with Deft

texts:
I'm just starting with Emacs and Org-roam and I'm using the standard Gnu-Emacs. When I open my files (.org) through the OPEN button in the graphical interface, all the backlinks apear in the org-roam buffer. However, when I browse and open the files using Deft, I get the message "no backlinks" in org-roam buffer, even though the links are there.
Anyone had a situation like this and would be able to give me light on that?


texts: Changing text size doesn't work on all fonts in org-mode

texts:
I have the following in my config:
  ;; set a non programming font for text
  (when (member "Lucida Sans Unicode" (font-family-list))
    (set-face-attribute 'variable-pitch nil :font "Lucida Sans Unicode"))

  ;; set a default font
  (when (member "Cascadia Code" (font-family-list))
    (set-face-attribute 'default nil :font "Cascadia Code")
    (set-face-attribute 'fixed-pitch nil :font "Cascadia Code"))

  ;; specify font for all unicode characters
  (when (member "DejaVu Sans Mono" (font-family-list))
    (set-fontset-font t 'unicode "DejaVu Sans Mono" nil 'prepend))

  (add-hook 'org-mode-hook 'variable-pitch-mode)

  (custom-theme-set-faces
   'user
   '(org-code ((t (:inherit (shadow fixed-pitch))))))

This gives me the following result:

As you can see, under the header Fonts that is in the font Lucida Sans Unicode, there is a line
: ezaeaz

that is correctly displayed in Cascadia Code.
However, when I increase the font size with Ctrl + mouse wheel or by using C-x C-+, here is what happens:

Org-mode being in variable pitch, the default font for the mode is Lucida Sans Unicode, which scaled up correctly. However the Cascadia Code font didn't, I assume because of the custom-theme-set-faces call that forces it to be something.
How can I make it so that both fonts are always the same size, or a ratio of one another?


texts:
I'm reading the ido source and see:

(defgroup ido nil
 "Switch between files using substrings."
 :group 'extensions
 :group 'convenience
 :version "22.1"
 :link '(emacs-commentary-link :tag "Commentary" "ido.el")
 :link '(emacs-library-link :tag "Lisp File" "ido.el")
 :link '(custom-manual "(ido) Top")
 :link '(info-link "(ido) Customization"))

defgroup appears at the top of many large packages. I see it does this:

  Declare SYMBOL as a customization group containing MEMBERS.
  SYMBOL does not need to be quoted.

And the page on customization groups doesn't really answer when or how to use them. When or how do you use them?


texts:
I wrote a Python script to parse an org file that I keep my tasks in, reformat those tasks, and save them to a taskpaper file so that I can easily view and
process the tasks on my phone. The script works the way I want it to, but I have to
rememeber to run it every time I want my tasks to 'sync'. I
have been trying to use after-save-hook to run the script whenever I save changes
to my org file, but I haven't been able to get it to work. I am new to Emacs, and
don't know much about lisp. This is what I have come up with based mostly on the
answer to this question.

(defun sync-to-taskpaper ()
  "Sync org file to taskpaper file for mobile access"
  (when (eq buffer-file-name "~/path/to/org/file.org")
    (shell-command "python3 ~/path/to/python/script.py")))

(add-hook 'after-save-hook #'sync-to-taskpaper)

I am not getting any error messages when I save the file, it just is not running
my custom function. Is it possible to do it this way, and if so, what am I
missing? Thank you for your help!


texts: Elpher loads for Gopher but not Gemini using Doom Emacs

texts: I am using the most up to date version of Doom Emacs, and I am trying to use Elpher to access Gemini pages. While it loads up Gopher pages just fine, any time I try to pull up a Gemini page I get a "Connection time-out message." Other users have suggested that it may be a TLS related issue, but I can't confirm that. They have stated that when they try the package with vanilla Emacs it works fine. Any suggestions on how I might go about fixing this?


texts: Projectile not remembering remote projects

texts:
I'm using spacemacs and regularly use Tramp (via /sshx:) to open files, once I've opened a file in Tramp I can use projectile without any problems.

However, projectile doesn't remember these projects so I can't quickly reopen them with helm-projectile (e.g. using helm-persp-switch-project or helm-projectile-switch-project). local projects I've used are listed but not any remote ones.

I suspect this is an environment/configuration issue but can't seem to pin it down. Any suggestions on how to change this behaviour so remote projects are remembered?


texts:
I have the following custom implementation of insert-pair:

(defun *-insert-pair (&optional arg open close)
  "Wrap next ARG sexps in parentheses.

If there is no next sexp, insert a new pair of parentheses."
  (interactive "p")
  (let ((arg (or arg 1))
        (exists-next-sexp t))
    (save-excursion
      (condition-case nil
          (forward-sexp)
        (scan-error (setq exists-next-sexp nil))))
    (if exists-next-sexp
        (insert-pair arg open close)
      (insert-pair nil open close))))

However, I don't like the use of the boolean var exist-next-sexp. Is there a more idiomatic way to write this so I can get rid of it?


texts: Can syntax parsing recognize the SQL '' (escape apostrophe/single quote) construct within SQL strings?

texts:
I am trying to enhance SQL mode such that editing of files of SQL code becomes more convenient, especially as far as jumping around is concerned (e.g. things like sql-goto-end-of-string etc.). I have found syntax parsing to be very useful in that, but have stumbled across one curious thing:

SQL has the apostrophe as the string delimiter and the (as would seem to me) quirky idea of using, of all possibilities, a double apostrophe to denote a literal apostrophe within a string, i.e. the ' doubles as its own escape character when it occurs two times in a row, such that 'McDonald''s' in SQL means what would be written as e.g. "McDonald's" or 'McDonald\'s' in some other languages. It would seem to mean to me that any SQL parser, when encountering an apostrophe inside a string, must always read the next character before it can decide whether this is the end of the string or rather a literal apostrophe inside it.

As to Emacs in sql-mode, (nth 3 (parse-partial-sexp (point-min) pos)) in sql-mode returns the following when parsing over such a construct (^ denotes point):

'McDonald''s'
         ^    --> 39
'McDonald''s'
          ^   --> nil
'McDonald''s'
           ^  --> 39

In other words, it treats the sequence as two separate, abutting strings, 'McDonald' and 's' (which of course do not exist in valid SQL syntax), presumably because ' is simply the string terminator in sql-mode-syntax-table ((char-to-string (char-syntax ?')) returns "\"" and is simply described as "    which means: string by describe-syntax).

My question is whether Emacs is in principle capable of parsing this construct correctly, if, e.g., given a more complex syntax table entry for '.

I see it is capable of parsing two-character comment delimiters, such that / has a specific meaning when followed by *, and * is specific when inside a comment and followed by /. The provisions in syntax tables for such sequences, which AFAIU seem to be the syntax flags, seem to be specific to comments, however, and the exact problem also seems to be different (I cannot think of an example of a single "end comment" character that is escaped with itself in the languages that I am familiar with, at least), as far as I can tell (I have not looked into prefix characters, admittedly).

I would readily accept if this is simply a limitation of Emacs' syntax parsing (and would not think it too hard to come up with workarounds for my purposes), but my impression is that syntax parsing is the most efficient method, so it would be really cool to do it this way if it can be done.

(I do wonder whether using syntax-table properties would work, e.g. by assigning the punctuation syntax class to '' within strings, and if so, how substantial the overhead would be.)

I would greatly appreciate any pointers through the jungle! Thanks!


texts: Is there a tagged union/sum type in elisp? If not, what to use instead?

texts:
In many programming languages, if one wants a variable that can take a discrete number of values, one has the capacity to define the permissible values in advance, using something like an enum.
Does elisp have any functionality like that?
My use case: I'm using the same configuration file across multiple computers.  I'm reading an identifier from an environment variable, and I'd really like to store that in an elisp variable as a sum type, so that I can do something like
(cond ((eq which-computer home) (do-home-config))
      ((eq which-computer office) (do-office-config))
      (t (message "unknown computer")))

where which-computer is a variable that can only take the values home and office.
Is that a thing one can do in elisp?
(I don't really know what to tag this question, since apparently using the elisp tag is, like, verboten.)


texts: Get company completion without evaluation in ess

texts: Is it possible to do completion without evaluating the buffer in ess-mode/R-mode which uses company-R-objects and company-R-args as backends ? Backends like company-jedi can do completion without evaluating any statement of current buffer. Thanks in advance !


texts: Trying to get Doom to be available anywhere using vi

texts:
I am slowly getting used to emacs and have tinkered with my init.el in my ~.emacs.d/ directory.
I now have the doom distribution of emacs and have it installed in a new ~.emacs2.d/ directory as .emacs.d/ was already populated with my previous install. I had trouble launching the doom distribution, but figured it out by specifying -q --load.
I am sure that this is not best practise, so appreciate any pointers here.
Now I am attempting to have doom available anywhere in Terminal but cannot figure out how to arrange that. I have no experience with vi and cannot figure it out. Any pointers?


texts: How to extend the  => M- translation to non-character keys?

texts:
This question is a follow-up to this answer (q.v.).

I understand that Emacs interprets esc as M- only when the keystroke that follows it corresponds to a "character" (e.g. A, 5, ;, etc.), as opposed to, e.g., ←, F5, home, etc.

What can I add to my .emacs file to extend the esc ⇒ M- interpretation to the case where the following key is a "non-character" key?

OK, the following snippet takes care of my immediate problem, but it's not an answer to my question (see below):

(add-hook 'org-mode-hook
    (lambda ()
        (define-key org-mode-map [27 S-down] 'org-shiftmetadown)
        (define-key org-mode-map [27 S-up] 'org-shiftmetaup)
        (define-key org-mode-map [27 S-right] 'org-shiftmetaright)
        (define-key org-mode-map [27 S-left] 'org-shiftmetaleft)
        (define-key org-mode-map [27 down] 'org-metadown)
        (define-key org-mode-map [27 up] 'org-metaup)
        (define-key org-mode-map [27 right] 'org-metaright)
        (define-key org-mode-map [27 left] 'org-metaleft)
        (define-key org-mode-map [27 return] 'org-meta-return)
        (define-key org-mode-map [27 S-return] 'org-insert-todo-heading)))

To find the bindings I needed to define, I got a listing of org-mode-map (with C-h v), and searched for M- to get all the bindings beginning with M-:

  (M-S-down . org-shiftmetadown)
  (M-S-up . org-shiftmetaup)
  (M-S-right . org-shiftmetaright)
  (M-S-left . org-shiftmetaleft)
  (M-down . org-metadown)
  (M-up . org-metaup)
  (M-right . org-metaright)
  (M-left . org-metaleft)
  (M-return . org-meta-return)
  (M-S-return . org-insert-todo-heading)

Each one of these lines is the basis for a corresponding define-key expression in the mode-hook shown above.  The transformation should be pretty obvious.  (The 27 in the define-key expressions is the code for esc.)

One would need to do this sort of thing for every single mode X that defines a key binding of the form M- followed by a non-character key sequence.  Specifically, for every such binding, one would have to include a define-key expression in a mode-hook for mode X.  Therefore, this approach is obviously a very laborious, fragile, and hard-to-maintain hack.  It does not do what the question requests, but instead painstakingly simulates it for certain special cases.  For this reason I did not post it as an answer, in the hopes that someone will post an actual answer to the original question.


texts: Making `dj` delete two lines in evil mode

texts:
dj in vim deletes the current line as well as the next. It's a bit idiosyncratic (in that it doesn't really make sense as a motion) but I've come to rely on it.

In evil, however, dj deletes only the current line. How can I remap it so that it has vim's behaviour?

I've tried a few methods and all don't work:

(defun delete-two-lines ()
  (interactive)
  (kill-whole-line)
  (kill-whole-line))

using key-chord.el: (key-chord-define evil-normal-state-map "dj" 'delete-two-lines)
trying to remap the j motion in evil to jump two lines ((evil-line-move 2)). This works but affects every use of j.
dd is a linewise shortcut; it's not special-cased, so I can't hook into it (why is evil so elegant...)
(define-key evil-mode-normal-map (kbd "dj") 'delete-two-lines): d isn't a prefix key, and this seems like it would interfere with evil's d mapping anyway

I'm at my wit's end. Help would be appreciated.


texts: How to prevent the creation of an RCS directory?

texts: When I enable version control for a certain file using RCS, Emacs 27.0.50 creates an RCS subdirectory.  I remember that some former versions of Emacs just created a …,v sidecar file instead.  How can I re-active that old behaviour?


texts:
I'd like to copy part of a buffer including all images. The code below copies the text but not the image. How do I copy images and how do I search for images in a buffer?

(insert
 (with-current-buffer (get-buffer-create "buf")
   (insert "-->")
   (put-image (find-image '((:type jpeg :file "~/foo.jpg")))
              (point))
   (insert "<--")
   (buffer-substring (point-min) (point-max))))


texts: Eval Buffer works on .emacs but loading when emacs starts

texts:
I know there are some other questions like this on the site, but none of them seem to work.

I am trying to enable relative line numbers with a package, and when I do M-x eval-buffer, the mode is enabled, but when I just launch emacs it does not get enabled. I checked and made sure that the location of init.el is the one that emacs is using, and I know that it is at least partially working because I can install packages in it and use them through M-x.

Here is my init.el

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl
    (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  (add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)
(custom-set-variables
 '(package-selected-packages (quote (linum-relative markdown-mode))))
(setq linum-relative-backend 'display-line-numbers-mode)
(linum-relative-mode)

Specifically, (linum-relative-mode) doesn't work when launching emacs.

To recreate, set the file above as your init.el / .emacs file and launch emacs. Notice that there are no relative line numbers. Now run M-x eval-buffer and see that it adds the buffer just fine. My question is why launching emacs is not evaluating the .emacs file as it should?


texts:
Has anybody tried implementing (VC) branch specific undo's? It would have to be agnostic to changes both inside Emacs and from the outside when Emacs is running using file-notify-.*.
One solution would be to associate the end of a file history line with the (sha-xxx) hash of that file.


texts: How to control which window is opened as "other Window"?

texts:
I am new to Magit and Spacemacs.
I do not understand descriptions of other-window and next-window in the manual.

I have 4 windows open in a Spacemacs frame like this:

+--+--+
|  |  |
+--+--+
|  |  |
+--+--+

SPC g s opens Magit Status in another window.
But which window?  It seems so random, with Magit Status often opening in a window I want left as is.

Is there a way to control which window SPC g s will open Magit Status?

Is there a way to predict which window SPC g s will open Magit Status?


texts: How can I disable the M-h keybinding in org-mode with evil-mode?

texts: The problem seems to be that evil-mode translates the key chord M-<left> into M-h. Unsetting M-h by binding it to nil in the local, global or org-mode map in a org-mode hook does not help.


texts: Emacs elisp debugger: How do i make the debugger jump to source when i press s?

texts:
The builtin elisp debugger (i.e. the regular one, debug, not edebug) has a default binding of s to command backtrace-goto-source.
When I try to use it, it says: Source code location not known
You can see what I mean by doing this:

Set contents of /tmp/blah.el to be:

(defun abc ()
  (error "hello"))

Run the command emacs -Q --eval '(progn (setq debug-on-error t) (load-file "/tmp/blah.el") (abc))'

Highlight fourth line in buffer, the one that reads   abc()

Press s key, the error says Source code location not known

The docs for backtrace-goto-source say:
If its location is known, jump to the source code for the frame at point
I checked the builtin info documentation for section 18.1 The Lisp Debugger, but i couldn't really find a setting for what i want. How do I make a symbol's location known to the debugger so it jumps to the source location when I press s?
Interesting note: the behavior of pressing mouse-1 is completely different from pressing s, and sometimes navigates to bundled source location gzs for me, but also sometimes opens an "Open File" dialog (GUI).


texts: wrong-type-argument stringp nil when trying to run flycheck

texts:
I'm new to emacs (coming from vim) and wanted to try flycheck with jshint. I have jshint installed and available in my path.  However, when I try to check a buffer, I get the error:

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

I already set debug-on-error and got the following trace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  signal(wrong-type-argument (stringp nil))
  #[257 "\300 \210\301@A\"\207" [flycheck-report-failed-syntax-check signal] 4 "\n\n(fn ERR)"]((wrong-type-argument stringp nil))
  funcall(#[257 "\300 \210\301@A\"\207" [flycheck-report-failed-syntax-check signal] 4 "\n\n(fn ERR)"] (wrong-type-argument stringp nil))
  flycheck-buffer()
  #[0 "\300 \207" [flycheck-buffer] 1 "\n\n(fn)"]()
  funcall(#[0 "\300 \207" [flycheck-buffer] 1 "\n\n(fn)"])
  flycheck-buffer-automatically(idle-change)
  flycheck-handle-idle-change()
  apply(flycheck-handle-idle-change nil)
  byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
  timer-event-handler([t 22506 35301 253712 nil flycheck-handle-idle-change nil nil 115000])

But that's about far as I can go with my limited understanding of elisp...

I am able to run jshint from my terminal (and from emacs) without problems.