texts: Open icons are not displaying in the tab of centaur-tab

texts:
I want to have my editor work with tabs and I'm using centaur-tabs for that purpose.
Below is my emacs config
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
            '("melpa-stable" . "https://stable.melpa.org/packages/") t)

(unless (package-installed-p 'doom-themes)
  (package-refresh-contents)
  (package-install 'doom-themes))

(unless (package-installed-p 'centaur-tabs)
  (package-refresh-contents)
  (package-install 'centaur-tabs))

(unless (package-installed-p 'all-the-icons)
  (package-refresh-contents)
  (package-install 'all-the-icons))

(load-theme 'doom-one t)

(unless (package-installed-p 'treemacs)
  (package-refresh-contents)
  (package-install 'treemacs))

(use-package centaur-tabs
  :demand
  :config
  (centaur-tabs-mode t)
  :bind
  ("C-<prior>" . centaur-tabs-backward)
  ("C-<next>" . centaur-tabs-forward))

;;    (centaur-tabs-headline-match)

(setq centaur-tabs-style "bar")
(setq centaur-tabs-height 24)
(setq centaur-tabs-set-icons t)
(setq centaur-tabs-gray-out-icons 'buffer)
(setq centaur-tabs-set-bar 'over)
;; Note: If you're not using Spacmeacs, in order for the underline to display
;; correctly you must add the following line:
;;    (setq x-underline-at-descent-line t)
(setq centaur-tabs-close-button "x")
(setq centaur-tabs-set-modified-marker t)
(setq centaur-tabs-modified-marker ".")
;;(centaur-tabs-change-fonts "arial" 100)
(add-hook 'dired-mode-hook 'centaur-tabs-local-mode)
(setq centaur-tabs-cycle-scope 'tabs)

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

 '(package-selected-packages
   '(treemacs use-package doom-themes centaur-tabs all-the-icons)))

The tabs are displayed like this. As you see the icons are not displayed in front of the tabs.
How can I fix this issue?


texts: Default argument for interactive function?

texts:
Using
(interactive "sPROMPT: ")

one can set a prompt for, e.g., a string function.
Question: Is it possible to also supplement a default argument to the function? Say
(interactive "sPROMPT: default")

so that the users can supply "default" as the default argument to the function, unless they change it manually?


texts: Magit deprecates `magit-popup`. Which of my packages depend on it?

texts:
How do I get Emacs to report which packages in my running Emacs depend on magit-popup?
Soon Magit will stop supporting magit-popup because it has transitioned to the replacement transient. Somehow Magit (in preparation for version 3.0.0) is detecting a dependency on magit-popup and warns about this repeatedly, to the point of making Magit unusable.
As described in this GitHub issue the message is written considerately and is well intentioned, but does not give any guidance on how to figure out which package has the dependency on magit-popup.
That GitHub issue resolves when the reporter finds a dependency in their local Emacs configuration. I've searched my local config, and I don't find any dependencies on magit-popup so I seem to be stuck.
Maybe I need to get Emacs itself to tell me at run-time what's causing this apparent dependency?
Assuming I know nothing about debugging Emacs Lisp, how do I track down exactly what is causing this magit-popup dependency to the precision where I know exactly what to remove and/or file bug reports against?


texts: How to make auto-complete work in AucTeX mode?

texts:
I want auto-complete (ac) to work when I am inside AucTeX mode.
I get all packages from MELPA by package installation.

This is my relevant code in init.el file:

(require 'package)
(package-initialize)
(require 'auto-complete-config)
(ac-config-default)
(global-auto-complete-mode t)

as you can see, although I am setting ac globally it does not appear in AucTeX. However, by following instructions in this emacswiki, ac mode was displayed in status bar in AucTeX but non-functioning, no auto-completion by typing characters.

Notes
Emacs 24.4 under Windows 7 32bit and packages were updated.


texts: How do you navigate documentation in Emacs?

texts:
There is some manual I have accessed before on Emacs that described how to navigate the documentation and also how it was constructed. However, I have forgotten how to get there.

From memory, the documentation outlines:

What 'Top', 'Next', 'Previous' mean and how to action them
What nodes and sub-nodes are
How using <SPC> will ensure you don't skip sub-nodes

Would anybody know how to get there again?


texts: How to open multiple files without automatically activating the "Buffer List" split?

texts:
Running emacs with multiple files automatically opens the "Buffer List" split-window.

eg:

emacs -Q *.txt

Opens a split window, one which contains a list of buffers.

How can multiple files be opened in a single window without any splits?


texts: binding a minor mode's function to already defined key in global-map

texts:
(use-package
  anaconda-mode
  :defer t
  :config
  (progn
    (unbind-key "M-." anaconda-mode-map)
    (unbind-key "C-_" global-map))
  :bind ((:map anaconda-mode-map
               ("C-_" . anaconda-mode-find-definitions))))

but when I do C-_, it is undefined. anaconda-mode-map doesn't have C-_.


texts: Getting Emacs to recognize analogous Unicode characters as equivalent when searching

texts:
In most contexts, like Firefox of MS Office, if I have text that says, "It’s my birthday" (where the apostrophe has Unicode decimal code 8217) and I search for "It's my birthday" (with a simple apostrophe, decimal code 39) the search matches despite the fact that the two apostrophes are different Unicode characters. However, in Emacs text-mode, the two don't match. Is there a way I can get Emacs's search to consider the two apostrophes the same?

I'm using GNU Emacs 24.3.1 (x86_64-apple-darwin, NS apple-appkit-1038.36) of 2013-03-13 on bob.porkrind.org on OS X Yosemite 10.10.5. I'm using a graphic display.


texts: C-c ' for editing all code blocks (to handle imports and variables)?

texts:
The Org manual says:

  C-c ' for editing the current code block. It opens a new major-mode edit buffer containing the body of the ‘src’ code block, ready for any edits.

This feature is sweet.

However, since only the current code block is edited, previous code blocks in the same session/tangle are not evaluated. Hence, imports and variables are missing and produce errors in e.g. flycheck.

Code completion does not work. Is there a way to change this? For example, include all code in the edit buffer?

For example:

#+BEGIN_SRC ipython +n :session :tangel yes :results output
previously_defined_axes.plot(previously_defined_list)

os.li<TAB>

This produces error messages because of undefined names previously_defined_axes and previously_defined_list, although they were defined in the previous code block.

Also, os is not treated as imported and tab completion fails.

Any ideas how to circumvent this?


texts: cuda .cu files indentation issue. How i can set indentation for cuda .cu files to 4 spaces?

texts:
In my .emacs i have put following for cuda highlighting:

(setq c-default-style '(("c++" . "linux")
                        (java-mode . "java")
                        (awk-mode . "awk")
                        (other . "gnu")))

(setq c-default-style "k&r"
      c-basic-offset 4)

;; Use C-Mode for CUDA
(add-to-list 'auto-mode-alist '("\\.cu\\'" . c-mode))

Indentation 4 spaces works for c-mode or c files but for cuda files indentation is set to 2 spaces.
Please help me in setting indentation for cuda files to 4 spaces. Thanks!


texts: Python interactive buffer showing completions of the empty string instead of regular output

texts:
I am working with python code, and I would like to be able to evaluate it in an emacs buffer, rather than using another terminal window. I am working with the python-mode from python.el, bundled with emacs.

This works just fine with emacs 24.3 on two different computers (windows and linux). However, I cannot get it to work on a 4rd computer with emacs 24.4: after spawning the buffer, it only shows completion candidates for an empty string (even though I didn't ask for any completion), and if I send a string, be it from a python-mode buffer or directly in the comint buffer, it just shows this list of completions again, and not the result of the command.

What's even more troubling is that according to google results, I am the only one with this issue, yet it is out-of-the-box experience!

Here are some screenshots with emacs -Q:

Bottom of the output:

Top of the output:

I am using emacs 24.4.1 on linux, and the problem appears with both python 2.7.9 and python 3.4.1.

Any clue?

Edit 1 Thanks to Ista's answer, I was able to check that there is nothing different in my *Messages* or in the content of variables python-shell-interpreter, python-shell-interpreter-args, python-shell-completion-setup-code, python-ffap-setup-code or python-eldoc-setup-code when compared to a working setup.

Edit 2 Thanks to a comment by Ista, I tried with a new user, and the problem didn't appear! I have tried restoring various settings to default (notably desktop-wide shortcuts), but without success for now.

Edit 3 I also tried with the ipython interpreter, the result is the same.

Edit 4 I tried starting python from eshell, shell and term (line-mode), it has the same problem: when I enter 2+2; and press RET, I see a list of completions instead of 4. term with char-mode works fine.

Overall, it looks like emacs sends a <TAB> to the inferior process whenever it tries to interact with it.


texts: Specify sidewaystable placement in Org-mode export

texts: I have an Org-mode document that I am exporting to PDF, and my document contains a table that I would like to rotate on export. I have been able to achieve the rotation with #+ATTR_LATEX: :float sideways. However, this places the table at the very end of the document, whereas I would like it closer to where it appears in the text. One solution I have tried is using #+LATEX: \begin{sidewaystable}[htbp] above the table and #+LATEX: \end{sidewaystable} below it, which is hacky and makes me lose my table caption and the ability to reference the table elsewhere in the text. It does, however, put the table where I want it. Is there a way to specify the location of a sidewaystable when exporting from Org-mode?


texts: How to properly change defcustom prefix key

texts:
In a library I use a prefix key defined like this:

(defcustom ensime-mode-key-prefix [?\C-c]
  "The prefix key for ensime-mode commands."
  :group 'ensime-mode
  :type 'sexp)

In my config file I've redefined it like the following:

(setq ensime-mode-key-prefix [?\C-c ?e])

Even though this has changed the prefix, all commands refuse to work with this error:

Symbol's function definition is void: ensime-mode-key-prefix

I've also tried to set it this way:

(customize-set-value 'ensime-mode-key-prefix [?\C-c ?e])

It also doesn't work, but with a different message - C-c e is undefined, which is strange cause in description it's set:

ensime-mode-key-prefix is a variable defined in `ensime-vars.el'.
Its value is [3 101]
Original value was [3]

I want to change the prefix to C-c e, tried to do that with std kbd, but that didn't help.


texts: How do I insert code block header :var in exported code block in org-mode

texts:
GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-10-06
Org-mode version 8.3.5 (release_8.3.5-1131-g7eecb2 @ ~/.emacs.d/el-get/org-mode/lisp/)

I have come to share my projects as html files where I include notes and codes so that others can follow my workflow and reproduce my results.

One thing is that I want to reuse code blocks with different input variables, and I do this with the :var header arg. The issue is that :vararguments are not included in the exported code block.

Is it possible to selectively choose code blocks where the :var arguments are included in the exported code block?
I noticed that when tangling the code block the variables are included in the file.

Note that I am asking for a language agnostic solution if possible.

Example use case:

cat ./export_var.org

* Export with variables
:PROPERTIES:
:header-args: :var status="not_finished"
:END:

 #+NAME: example-table
| 1 |
| 2 |
| 3 |
| 4 |

Here we import a table.
#+NAME: table-length
#+BEGIN_SRC R :var table=example-table :tangle "./export_var.R"
status <- "finished"
dim(table)
#+END_SRC

#+RESULTS: table-length
| 4 |
| 1 |

Here we think we import a table
#+NAME: table-str-length
#+BEGIN_SRC R :var table="./filename_example-table.tsv" :tangle "./export_var.R"
length(table)
print(status)
#+END_SRC

#+RESULTS: table-str-length
: not_finished

** Some subcase
If I run with the data in ="./other_data.tsv"=
#+call: table-str-length[ :var table="./other_data.tsv"]()

#+RESULTS:
: not_finished

Now this would tangle as the following ./export_var.R as

status <- "not_finished"
table <- local({
     con <- textConnection(
       "\"1\"
\"2\"
\"3\"
\"4\""
     )
     res <- utils::read.table(
       con,
       header    = FALSE,
       row.names = NULL,
       sep       = "\t",
       as.is     = TRUE
     )
     close(con)
     res
   })
status <- "finished"
dim(table)

status <- "not_finished"
table <- "./filename_example-table.tsv"
length(table)
print(status)

The desired result would be the same code as in the tangled file, although split up as usual in the html file.

The inheritance structure of :header-args can be somewhat complex.


texts: Link to password-protected FTP server in org-mode

texts:
I can't figure out the correct syntax for a link to a password-protected FTP site.  I want to insert a link in org-mode, which opens a remote FTP server at a given directory in dired.

When I try

/user:pass@host:/dir

I get the error unknown method user.

When I do

/ftp:user:pass@host:/dir

I get prompted for a Password for myusername@user

Finally, when I do

ftp://user:pass@host:/dir

the link gets opened externally (in Firefox)


texts: Ways to automatically insert a space after a LaTeX command (inserted by an AucTeX shortcut, e.g. `g) if the next keystroke is a letter

texts:
With AucTeX, one can insert many LaTeX commands using shortcuts.

For example in a math environment (e.g., between $ $), the shortcut `g insert \gamma. Normally right after \gamma if I would like to type a letter I should make a space, for example $\gamma a=1$, but if I would like to type a number, a symbol or another latex command, it is not necessary, for example $\gamma\alpha=1$ or $\gamma*1=\gamma$ or $\gamma1=\gamma$, or $\gamma^1=\gamma$.

Is there a way in AucTeX to insert a space right after a latex command (inserted by an AucTeX shortcut, e.g. `g) if the next keystroke is a letter?

I think this can significantly increase the speed of typing, because the space should be inserted anyway.

I have added the requirement inserted by an AucTeX shortcut to avoid the complicated situations like \leq and \leqslant.


texts: Emacs keybindings / invocation for Apple iMac keyboard, similar to LMI or Knight?

texts:
Does anyone have a HOWTO on creating efficient keybindings and invocation of Emacs for the iMac Bluetooth keyboard pictured here?

Specifically one or more of the following use cases:

Invocation of Emacs in ssh terminal session to VM with VT100 emulation within Terminal.app.
Invocation of Emacs with X-mode in terminal session to VM within Terminal.app.
Invocation of Emacs in Mac OS within Terminal.app
Invocation of XEmacs in Mac OS

As you can see from above, I'm trying to invoke Emacs from within a VM for security reasons.

I'm seeking similar meta and control keybindings as the LMI or Knight keyboard pictured and a way to switch back and forth without impact OSX keybindings.  For instance Meta should be Fn, Control or Option on the iMac Bluetooth keyboard.  Command should be Control on the iMac Bluetooth keyboard.

I'm hoping some hard core Emacs LISP / Scheme users have such keybindings.

Thank you


texts: What are the implications of working in multiple layers of recursive-edit?

texts:
I'm not sure if I fully understand the use-cases of recursive edit.

Nor am I sure if I worded this question correctly.

But every now and then when I'm doing something I'll look at the minibuffer and see that I'll be currently in a layer of recursive-edit, when I'm certain I didn't do anything explicitly to activate it.

(as shown in the screenshot below)

Since this seems rather harmless, I'm wondering what the implications would be (or any problems I might run into) if I were to work in multiple layers of recursive-edit over the course of an editing session?

(as shown in the screenshot below)

Obviously I would never do this, because it doesn't seem practical. But I'm wondering if any unexpected things would happen whilst editing?


texts: Move point to beginning of file name in WDired

texts:
Example:

-rw-rw-r-- 1 bs bs 20598 Jul 28 14:55 I-am-a-file.txt
                                              ^(cursor here)

A magic shortcut key is pressed, then:

-rw-rw-r-- 1 bs bs 20598 Jul 28 14:55 I-am-a-file.txt
                                      ^(cursor here)

Does this magic shortcut key exist?

Reference:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Wdired.html


texts:
I often find myself in the following situation:

Look at some code in a project (e.g. string-trim in subr-x.el in Emacs)
magit-blame to see which commit added that code
Wonder which tags of the project comes after that commit

Immediate use case is to find a version of Emacs that contains string-trim, so as to specify the dependency in a package header

It's not clear how best to achieve step 3. I can get the commit hash from step 2--then what?


texts: Is there a way to change the font associated with the variable-pitch-mode? On my emacs installation enabling variable-pitch-mode changes the font to a sans-serif font; I would like to use a serif font instead.


texts: How do I spell check directly from the magit-status buffer

texts:
Question:

Is it possible to run ispell on a region (or the whole diff and nothing else) directly from the magit-status buffer?

Motivation:

I am writing varying amounts of text and often keep it under version control.
I also use magit as a front-end for git.
After adding chunks of text here and there and then checking the magit-status I catch myself wanting to spell check newly edited regions without the hassle of diving in to the text and find it or spell-check the whole document.


texts: How can I set different font sizes for buffers and for the mode-line?

texts:
I have this line in my init.el file to set the size of the font in all frames:

(push '(font . "DejaVu Sans Mono-10") default-frame-alist)

It works but i'd like to have a bigger font in all buffers while keeping a smaller one for the mode line (so it could fit more information and be less distracting). The idea is to have this set automatically without having to change the font size with C-x C-+ for every open buffer.

I'm using Emacs 25.0.50.1 compiled from trunk on a GNU/Linux system.

Edit: just added an answer showing how it can be done.


texts:
Mock is a utility used by Fedora to build packages in chroots.  For debugging, it would be nice to access files inside those chroots with all the amenities Emacs has to offer.

Calling mock -r fedora-26-i386 --shell yields a shell inside the fedora-26-i386 chroot:

[tim@passepartout ~]$ mock -r fedora-26-i386 --shell
INFO: mock.py version 1.4.8 starting (python version = 3.6.4)...
Start: init plugins
INFO: selinux disabled
Finish: init plugins
Start: run
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled dnf cache
Start: cleaning dnf metadata
Finish: cleaning dnf metadata
INFO: enabled HW Info plugin
Finish: chroot init
Start: shell
<mock-chroot> sh-4.4#

How would a TRAMP method look like for that so that (for example, I assume treating fedora-26-i386 as a host name is fitting) /mock:fedora-26-i386:/etc/passwd would access /etc/passwd in the shell brought up by mock -r fedora-26-i386 --shell?


texts: What is the difference between a function and a command?

texts:
When posting questions and answers here, people sometimes use the terms "function" and "command" interchangeably. In other cases, people only use one of the two terms to discuss specific pieces of code. As their posts usually focus on other topics, they don't explain why they are using one term but not the other. So:

Q: In Emacs Lisp, what is the difference between a function and a command?


texts: Aligning the colon in multi-line tertiary expressions in C and C++

texts:
Suppose I have the following line
double dx = r1 < 1 ? sqrt(r1) - 1 : 1 - sqrt(2 - r1);

I press enter and tab at the colon causing Emacs to align like this:
double dx = r1 < 1 ? sqrt(r1) - 1
               : 1 - sqrt(2 - r1);

How can I configure Emacs so that it insteads aligns like this:
double dx = r1 < 1 ? sqrt(r1) - 1
                   : 1 - sqrt(2 - r1);

That is, the colon should be placed at the same column as the question mark.
I want the same alignment in all languages with this syntactic construct; C, C++, Java, JavaScript etc.


texts: Automatically prompt for comment character and apply it in older versions of emacs

texts:
When I try to comment a block of code using comment-region in a file type emacs doesn't know the proper comment type for, then it prompts me No comment syntax is defined.  Use: so I can specify the comment character and it works.

However this only happens on modern versions of emacs. In older version that I have to use on our servers, e.g. 21.4.1 It doesn't prompt me for a character. It only says No comment syntax is defined.

Right now my solution to this is that when I see this message, I run my own function e.g.

M-x setcomchar RET
# RET

and this sets the comment character to #, or whatever else I want (90% of the time it will be #, but could also be //, -- etc) My function is as follows:

(defun setcomchar (cc)
  "Sets the default comment characted in the current mode"
  (interactive "sCharacter::")
  (setq comment-start cc)
)

Once I've set this, I can run comment-region again and it works.

However, what I would like to achieve is effectively to replicate the behaviour seen in newer versions of emacs. Whereby if no comment is set or known about then it automatically prompts me for one. And in fact, once I enter it, it automatically does the commenting for me without a need for another M-x comment-region.

So

I do M-x comment-region, if there is a comment set then apply it.
Otherwise prompt me for a comment, (it would be nice for this to be pre-filled with the "#" character as it will be this one 90% of the time), then apply it without any further M-x ing from me. Any thoughts on how to proceed with this one?

Also as a general point, how can I detect the status of a function in emacs, e.g. is there a concept of return code for something like comment-region. And since comment-region returns the string No comment syntax is defined, how can I get access to this string?

Thanks a lot

Joey


texts: How to display plain text attachments inline with mu4e?

texts:
I'm using mu4e as my email client and it works fine for the most part.  However, I'm working with patches sent via email very often and mu4e won't display inlined attachments as part of the email body, which is very inconvenient.  Instead it lists them as attachments that I can awkwardly open in Emacs with a little too many steps.

Is there a way to let mu4e display certain attachments inline with the email text?

(I would also like attachments of type text/plain or text/x-patch to be displayed inline, even when their Content-Disposition is attachment, but that's optional.)

It is especially annoying when I get an email with an embedded short patch snippet, with the body text continuing afterward.  The snippet is cut out of context and having to do A-e 2 RET is taking me out of the email.


texts: Problem execution scope org-babel in shell on windows 8

texts:
I just discovered that in order to run a sequence of shell commands under the same scope (same shell session) I have to add a hash at the end of the line.

Example

When I try to run the following two lines I get the wrong list of files. I get the files located in the directory of the org file from where this code block is executed.

#+BEGIN_SRC sh
cd /cygdrive/c/Users/path
ls
#+END_SRC

However, everything works fine if I pack a hash symbol at the end of the first line.

#+BEGIN_SRC sh
cd /cygdrive/c/Users/path #
ls
#+END_SRC

I find this really annoying since this could be very dangerous in case a writing operation is performed and the hash is forgotten.

Questions

1- Am I overinterpreting the effect of the (lack of the) hash?

2- Is there something I can do to avoid the necessity of putting the hash at the end of each line of code?

Note

I am using Emacs 25.3.1 (x86_64-w64-mingw32) with built-in org (v 8.2.10). on windows 8.1. PathToUser/libexec/emacs/25.3/x86_64-w64-mingw32/cmdproxy.exe

I am almost new to emacs in windows since I have been mainly working with linux before and never encounter such a problem.


texts: How to change the face of org-display-outline-path in echo area?

texts:
In org-mode, I set all the outlines to be displayed in one face size (regardless of their hierarchy) by setting (setq org-level-color-stars-only t).

However, when I select an outline, org-mode displays the outline path in the echo area (minibuffer) in different face sizes based on their hierarchy.

What I would like to achieve is to either 1) turn off displaying any outline path in the echo area, or 2) set the face of the path to be one size regardless of the outline hierarchy.

macOS Sierra
Spacemacs 0.200.9@25.1.1
Org 9.0.5


texts: How can I automatically confirm the default value to a function call?

texts:
Apologies if this is poorly described, my emacs vocabulary is pretty limited.

I've set the following in my config:

(define-key evil-normal-state-map (kbd "C-=") 'cider-find-var))

cider-find-var always wants confirmation though. For example if I press C-= on the symbol usage I see this in the bottom left corner:

I have to press enter to confirm. How can I automatically confirm this every time? A generic solution that works with other function calls is preferred.

This is the help message for the function in question:

  cider-find-var is an interactive compiled Lisp function in
  `cider-client.el'.

  It is bound to C-=.

  (cider-find-var &optional ARG VAR LINE)

  Find definition for VAR at LINE.

  Prompt according to prefix ARG and cider-prompt-for-symbol.
  A single or double prefix argument inverts the meaning of
  cider-prompt-for-symbol.  A prefix of - or a double prefix argument causes
  the results to be displayed in a different window.  The default value is
  thing at point.


texts: Org-mode list with a mix of unordered and description list items?

texts:
It seems that all items in plain text unordered list have to contain descriptions, otherwise the HTML export is incorrect.

Example:

- item1 :: item1 description bla bla bla
- item2
- item3

then I export it to HTML, the result is

item1
  item1 description bla bla bla
(no terms)
  item2
(no terms)
  item3

I see that item2 and item3 are exported incorrectly as if the original test was no terms :: item2?


texts: Avoid to create a new window in sql mode

texts:
I use a monitor and a laptop screen as my multimonitor setup.

Unfortunately the monitor and the laptop differs in resolution.
So I use 2 frames, one frame on the monitor and one frame on the laptop screen.

Both frames are connected to one Emacs instance.

MONITOR:
I will call the frame that's opened on monitor as frame 1.
In the frame 1 on the monitor, I have a buffer opened with the default SQL-mode that's shipped with Emacs.

LAPTOP:
On the laptop screen, there is a SQL-process being displayed in the Emacs frame 2.

SITUATION:
In the frame 1, in the buffer with SQL-mode, I call M-x sql-send-region to send a SQL-statement to the SQL-process.

I see the result on the laptop screen in frame 2. But in the meanwhile, the SQL-mode propably have detected there is no window in the Emacs frame 1, so Emacs opens a new window with the same buffer of the SQL-process.

As the result, there are two windows on two screens, viewing the same buffer (the SQL-process).

I would prevent that the SQL-mode opens a new window when sending a SQL-statement to the SQL-process. How could I 'tell' Emacs to prevent that?

EDIT as answered below, this question is solved by now. See the second option from the user bmag.


texts: Changing the background of line number column (linum) to the same color of line highlighting background color

texts:
Is there a way to set the background color of the line numbering to the same color of the line highlighting background color?

So far I have to put the line numbering background color manually and of course that works really bad when I change my color theme. The code is:

    (custom-set-faces
      '(linum ((t (:inherit (shadow default) :background "#073642" :foreground "#586e75")))))

The idea is to get something like this from my old Vim setup that works consistently across different color themes in Emacs: vim setup


texts: How to prevent realgud:pdb with arbitrary command absolutizing paths

texts:
realgud seems to want to guess the path of the second argument of the command supplied to M-x pdb (or M-x realgud:pdb).  When I'm visiting a buffer in /some/path/foo.py, without realgud:

(hiding the long docker command here -- the ... should be understood to mean the rest of the middle of that long command)

M-x pdb
Run pdb (like this): docker run ... some_test
# Command supplied is run

with realgud:

M-x pdb
Run pdb (like this): docker run ... some_test
# Output:
Current directory: /some/path/
Command: docker /some/path/run ... some_test
docker: '/some/path/run' is not a docker command.
See 'docker --help'.

Process pdb exited abnormally with code 127

That of course immediately fails, because run here is not the path of some program, but an argument to docker.  Why does realgud think it knows this, and how can I prevent it from doing that?

realgud:trepan2 doesn't suffer from this problem, and neither does plain old M-x pdb when realgud is not installed, so it seems it's not fundamantal.


texts: How to get more control over starting and ending itemize and description sections in LaTeX export?

texts:
I'm wondering if there are some ways to control where org-mode decides to end itemize and description environments in LaTeX export.  For example, the following org-mode file:
- Likelihood methods :: missing data are latent variables, find or estimate MLE
- Imputation methods :: use $X$ to impute $Y$, then proceed as with full data
- Inverse propensity weighting (IPW) :: just use complete cases, but weight by propensity
- Likelihood methods are general and elegant, but often difficult to apply
- We will focus on the latter two methods
- Here's another bullet
\[
x+y
\]
- I want this to be in the same itemize block as the previous item

exports to
\begin{description}
\item[{Likelihood methods}] missing data are latent variables, find or estimate MLE
\item[{Imputation methods}] use \(X\) to impute \(Y\), then proceed as with full data
\item[{Inverse propensity weighting (IPW)}] just use complete cases, but weight by propensity
\item Likelihood methods are general and elegant, but often difficult to apply
\item We will focus on the latter two methods
\item Here's another bullet
\end{description}
\[
x+y
\]
\begin{itemize}
\item I want this to be in the same itemize block as the previous item
\end{itemize}

How can I end the description environment after the first 3 items, and then start an itemize environment after that.
How can I get the display equation to be part of the item, without ending the itemize environment and then starting a new one immediately after the displayed equation. (It messes up the spacing when I do this in Beamer.)


texts:
I'm currently seeing a display problem in Magit. For a while I've seen that when I do magit-status, the diffs are no longer highlighted. I didn't care for a while, thinking it was the theme I've been using, but today I tried other themes and in all of them there's no highlighting. I installed solarized-dark-theme which is used in the screenshots shown here, but I don't have the highlighting:

Is there any setting I need to turn on? When searching I couldn't find any references to a similar problem.

P.S. I'm using: GNU Emacs 25.3.1 (x86_64-apple-darwin17.4.0, NS appkit-1561.20 Version 10.13.3 (Build 17D47)) of 2018-02-08

and magit-version is: Magit 2.11.0-510-g1c4fa9b1, Git 2.13.6 (Apple Git-96), Emacs 25.3.1, darwin.

Update

Thanks @tarsius, now I know this is an issue specific to my configuration and not an issue with magit or the themes themselves, it works just fine when using magit-emacs-Q-command. I will try to "bisect" my configuration to find the issue but if someone can easily point what's wrong with my configuration will be helpful. This is my init.el.

Update #2

Seem's that the conflicting setting is (add-hook 'font-lock-mode-hook 'hc-highlight-tabs), I use this to see the tab character in files. Is there any workaround to make it co-exist with magit?

Thanks!


texts: How can I know which built-in emacs package needs to be 'require'd?

texts:
I was reading through the Changelog for emacs 24.4 (C-hn) and was trying to see what the File Notification feature is. I tried doing C-hv of a related variable auto-revert-use-notify but nothing showed up.

I then grepped for that variable name in the emacs source code and found that it was used in lisp/autorevert.el. After doing (require 'autorevert), all the underlying functions and variables got defined.

Question: How do I know if and what I need to require if I want to use a then-inactive emacs built-in feature? Is there a list of such packages available?


texts: Insert the same item in multiple rows in orgmode

texts:
I would like to be able to insert the same string in consecutive rows of some column of an org-table. I am using spacemacs and there is a vim way to insert the same instances in all visually selected areas, but is their maybe a more elegant way to insert the same string into multiple selected rows of a specified column in an org-table using spacemacs?

kind regards


texts: How to write a list literal with conditional items?

texts:
Given a list literal '(1 2 3)

is it possible to conditionally include parts of the list?

eg:

'(1 2 3
  (when thing-is-true '(10 11 12)))
  4 5 6)

Which would result in

'(1 2 3 4 5 6) or '(1 2 3 10 11 12 4 5 6) dependent on thing-is-true.

Python for example supports:

[1, 2, 3, *([10, 11, 12] if thing_is_true else []), 4, 5, 6]

What is the most straightforward way to achieve this using a single expression, without defining a list variable and manipulating it?


texts: org-mode code block parentheses mismatch

texts:
Here's some emacs-lisp code in a babel block:

#+begin_src emacs-lisp
(defun factor (number)
  (labels
      ((*factor (divisor number)
        (if (> (* divisor divisor) number)
            (list number)
          (if (= (mod number divisor) 0)
              (cons divisor (*factor divisor (/ number divisor)))
            (*factor (+ divisor 1) number)))))
    (*factor 2 number)))
#+end_src

So in the org buffer I get a parentheses matching problem, i.e., that very last ) at the bottom is flagged as one too many. It flashes red and check-parens flags it as well. Trouble is, this is not an error, i.e., the same code in scratch is perfectly paren-matched, likewise when I bring it up in the Org Source C-c ' window. BTW, this code compiles and runs giving good output. Any ideas what org-mode is doing here? I've got (show-paren-mode 1). When I turn it off, obviously, no problem because no highlighting matching parens.


texts: How to enable "Entering Directory" matching in grep output?

texts:
I have a grep-like script that I run via M-x grep, that changes its working directory, but outputs make-like "Entering directory `/a/b/c/d'" messages (to keep emacs informed).

This has worked fine for many years, but I recently (finally) upgraded to a new Emacs, and grep-mode no longer supports matching these magic strings in the output of the grep command (see http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8895).

(This manifests as hitting next-error to go to the fine and line of the hit, and getting prompted by emacs about where to find the file since its confused about what the relative path is relative to.)

How can I get my "Entering directory" messages to be honored again?


texts: Checkboxes: change bullet points to letters

texts:
I'd like to have an org file with 3 checkboxes listed with letters, instead of bullets, but they should remain fully functional.
Instead of:

[ ] Foo
[ ] Bar
[ ] Baz

This:

A [ ] Foo

B [ ] Bar

C [ ] Baz

Is this possible?


texts: Symbol's function definition is void: pdf-tools-install after succesfull Installation with nor error messages

texts:
I tried to install pdf-tools under emacs 24 and Ubunt 16.04, like I did it several times succesfully.

But now I get the error messages:

Symbol's function definition is void: pdf-tools-install

PDFs are still opened with the docview mode.

When I use M-x pdf-tools-install after Downloading from Melpa I get the message "Sever build succesfully".

Any ideas what's gone wrong?


texts: How to move point with mousepointer on shift-click in emacs

texts:
I want to write some functionality that fires whenever I shift-click a point in an emacs buffer.  Problem is that when shift is pressed, the point is not changing when clicking.  To make things more clear :

(defun mouse-test()  (interactive)  (message (thing-at-point 'word)))

(global-set-key [mouse-1] 'mouse-test)
(global-set-key [S-mouse-1] 'mouse-test)

When clicking on a word, the word is displayed, when shift-clicking it's not..


texts: How to get bash source code blocks to execute .profile / .bashrc

texts:
I don't understand how the source code blocks work exactly.

There are some variables, definitions and aliases in my .bashrc that I think I should be able to use in the source code blocks. However, when I run something like the following, the output suggests that my .bashrc is not being run.

#+BEGIN_SRC bash :results output
echo $0
echo $VAR_DEFINED_IN_BASHRC
#+END_SRC

#+RESULTS:
: bash
:

Is this expected behaviour? How do I use the things in my bashrc file in source code blocks?


texts:
generating python tags with

for file in $(find -type f -regex ".+\\.\(py\)"); do etags -a $file; done

doesn't load at emacs with error

  path/TAGS is not a valid tags file

although other language i.e c works just fine,
and syntax of generated TAGS doesn't look odd!


texts:
I am using emacs 25.3 and I observe that one indentation function that I wrote loop mysteriously. My function goes following:

(defun aut-indent-func ()
  (interactive)

  (defun loop (begin)
    (goto-char begin)
    (let* ((end (line-end-position 1))
           (substr (buffer-substring-no-properties begin end)))
      (if (string-match-p (regexp-quote "=") substr)
          ; then we are in a definition line
          (let ((field (string-trim
                        (substring-no-properties
                         substr
                         0
                         (string-match (regexp-quote "=") substr)))))
            (string-equal field "transitions"))
        ; then we need to call recursively
        (if (/= begin (line-beginning-position 0))
            (loop (line-beginning-position 0))))))

  (if (save-excursion
        (loop (line-beginning-position 0)))
      (progn
        (indent-to-left-margin)
        (back-to-indentation)
        (indent-to-column (+ 2 (aut-eq-line-offset))))
    (indent-relative)))

Essentially, it tries to loop over each line and try to identify a lines comes with transitions = and put the indentation at the same column as the equal sign there.

However, this functions loops.

It's impossible, since it keep scanning up and stop when it hits the top. What's even more mysterious is, if I evaluate the function definition again, it stops looping, until the next time I open up emacs again(and the file containing this function got reloaded). So I do M-x toggle-debug-on-quit, and it shows following:

Debugger entered--Lisp error: (quit)
  (while t (line-beginning-position 0))
  (save-excursion (while t (line-beginning-position 0)))
  (if (save-excursion (while t (line-beginning-position 0))) (progn (indent-to-left-margin) (back-to-indentation) (indent-to-column (+ 2 (aut-eq-line-offset)))) (indent-relative))
  aut-indent-func()
  indent-according-to-mode()
  electric-indent-post-self-insert-function()
  self-insert-command(1)
  newline(nil 1)
  funcall-interactively(newline nil 1)
  call-interactively(newline nil nil)
  command-execute(newline)

well, this trace shows something seriously insane. As you can tell from the code, there isn't (while t ...), so who adds those? Is it a bug that emacs add while automatically in some occasion?


texts: How can make emacs immediately compile a file I load?

texts:
Usually when I load a project, I want to compile it once right away, be it to again see the compilation error I was working on or just to build the dependencies of the checkout, so I don't have to wait for the entire build when I've actually done some changes.

Of course I can simply press C-c m (which I've mapped to recompile), but is there a way to achieve the build without any extra cue?


texts: How to protect LaTeX comment lines from indentation?

texts:
When I type <TAB> in a LaTeX file anywhere on a comment line, the comment symbol is moved to the beginning of the previous non-blank line. This also occurs with M-x indent-region.

Is there a way to protect comment lines from indentation and to keep them exactly as I type them? I have tried to set comment-style to plain, to no avail...

I had the same problem in the past with Fortran 90 files. For some reason, it disappeared in more recent versions of Emacs (I use GNU Emacs 24.3.1), so I hope it should be possible with LaTeX files too.


texts: From File Manager, open file in specific instance of Emacs

texts:
Here's my intended use case:

Emacs Instance 1: I have an emacs instance containing open buffers of the project I'm working on.  All directly related.

Emacs Instance 2: I'm in the Windows explorer, and I'm looking at a bunch of local files (for reference) that are not directly related to my project.  I'd like to double click on these files and have all of the files open on Emacs Instance 2.  This way, these reference files don't clutter up my other instance, and all referenced files are grouped together in a single frame (think Notepad++, when you double click a file, it uses the same instance and creates a tab for all open files).

The flow would be something along the lines of

Emacs is already open with a buffer list of just buffers related to project ("Emacs Instance 1")
Open up a file manager (repository, Windows Explorer, or Mac OS X Finder), browse to a file, and double click
Check for instance of "Emacs Instance 2".  If not available, then create a new instance and open the file there.  If it is, then open the buffer on this existing instance.

Is the above behavior possible?

Note: I call out a separate instance of Emacs because as far as I can tell, that's the only way to keep the buffer list filtered.  If there's a way to use the same instance, but keep the buffer list filtered to that specific frame, that works just as well for me!


texts:
So I know that I can put at the first or second line of a file a line such as:

# -*- mode: conf -*-

to tell Emacs what major mode I want the file to be opened with.

But if that mode isn't installed I wish Emacs to fallback to a different mode.
For example I wish to use the apache-mode, but if it doesn't exist I wish to fallback to conf-mode.

Is this possible, and if so how?


texts: How would one configure emacs to interpret holding the space bar plus a rapid CPU temperature rise as holding down the Control key?

texts: I'm surprised this question hasn't been asked here already. Is such configuration possible in emacs?


texts: Narrowing on Tramp Buffers Only When Using helm-buffers-list

texts: I'd like to close all Tramp buffers in one fell swoop. Is it possible to narrow on Tramp buffers only when invoking helm-buffers-list? I've tried various suggestions offered in Helm Help, but cannot narrow in on all Tramp buffers only.


texts: How to include specific lines from latex file for org-export

texts:
I am writing a text in orgmode that I want to export to pdf. I want to include specific lines from a latex file using #+include:. In fact, I want to include multiple text sections from a single latex file at specific locations in an org file.
Following the documentation I should be able to do so using the :lines argument with export latex. This, however, seems not to be working.
An org file with the following content:
#+TITLE: Some File

* Heading

#+include: "another-file.tex" export latex :lines 3-5

Does not include anything from the latex file.
I also tested whether the order of arguments had an effect, i.e., with #+include: "another-file.tex" :lines 3-5 export latex. This results in the whole .tex-file being included in the exported PDF.
What am I missing here?


texts: How to see the implementation of the auto-indent procedure?

texts:
I want to inspect the lisp code that handle auto-indentation.
By "auto-indent" I mean the indentation that automatically puts the beginning of a line at the right position in files such as .c, .cpp, and .java.

How do I find the code?


texts: ein + ipython non-responsive with python 'raw_input'

texts:
I am using Emacs with the ein package to edit ipython files. Everything works fine except when I have a line like:

fhandle = raw_input('enter your file name: ')

to prompt for a file name. The ipython subprocess that is running inside Emacs stops responding. (there is a little star at In[] that indicates this).

When I run the same command in the usual jupyter notebook web interface it works fine as usual. (there is a little box where it prompts me for the file name). I am thinking emacs + ein somehow doesn't have this capability?. What am I doing wrong here?. I am using python 2.7.


texts:
I'm using the ada-mode 5.2.1, gnat GPL 2017. I've built and installed gnatcoll successfully.

However, when I try to build gpr_query, I get  the following error:

$ gprbuild -p -P gpr_query.gpr
gprbuild: raised SYSTEM.ASSERTIONS.ASSERT_FAILURE : gpr-tree.adb:1246
[/opt/gnatGPL/bin/gprbuild]
System.Assertions.Raise_Assert_Failure at s-assert.adb:46
Gpr.Tree.Location_Of at gpr-tree.adb:1246
Gpr.Proc.Expression at gpr-proc.adb:616
Gpr.Proc.Expression at gpr-proc.adb:747
Gpr.Proc.Process_Declarative_Items at gpr-proc.adb:2406
Gpr.Proc.Recursive_Process at gpr-proc.adb:3276
Gpr.Proc.Process_Project_Tree_Phase_1 at gpr-proc.adb:2681
Gpr.Conf.Parse_Project_And_Apply_Config at gpr-conf.adb:1746
Gprbuild.Main at gprbuild-main.adb:2404
Main at b__gprbuild-main.adb:907
[/lib64/libc.so.6]
0x7fa2de9c4c03
[/opt/gnatGPL/bin/gprbuild]
0x000000000041279F at ???

I'm a bit stuck here. At first I couldn't get anywhere with gpr_query because of missing gnatcoll files in the GPL 2017 distro of Ada, but once I pointed the gpr file at the up-to-date version of gnatcoll, it built as far as the above error. If anyone could help, or if this is not relevant here and would be better on an ada forum then let me know.


texts: How to automatically refill at every character I type?

texts: refill-mode refills automatically if I type certain characters, e.g. space.  However, I want to do that at every character I type.  Apparently, there is a maniac-mode written by Per Abrahamsson (maniac.el) that does this, but it has vanished from the net. Moreover, the set of triggering characters does not seem to be configurable.  How can this be achieved nevertheless?


texts: dvisvgm baseline in org-mode HTML export

texts: When using #+OPTIONS: tex:dvisvgm and exporting to HTML with org-mode, the baseline of the latex exported images does not match the baseline of the text (when using subscripts, for instance). Is there any way to correct this behavior?


texts: New buffers of the same name don't inherit default major mode?

texts:
I'm using the following to create a new buffer "untitled" with the keyboard map C-n. This works fine for a new buffer but additional buffers of the same name where <num> gets applied seem to inherit the Fundamental major mode rather than Text. Why is this?

(setq major-mode 'text-mode)

(defun new-buffer-by-name (arg)
   "Creates a new buffer by name"
   (generate-new-buffer arg)
   (set-buffer-major-mode (get-buffer arg))
   (switch-to-buffer arg))

(global-set-key (kbd "C-n")
   (lambda () (interactive)
      (new-buffer-by-name "untitled")))


texts:
I am trying to change the default prefix key C-c @ to C-c for outline-minor-mode:

      (define-key outline-minor-mode-map (kbd "C-c")
        (lookup-key outline-minor-mode-map (kbd "C-c @")))

This works fine if outline-minor-mode is already loaded. But I cannot find a way to put this into .emacs so that it is run whenever outline-minor-mode is activated.

I have tried:

(add-hook 'outline-minor-mode-hook
      (define-key outline-minor-mode-map (kbd "C-c")
        (lookup-key outline-minor-mode-map (kbd "C-c @"))))

Which gives:

Symbol's value as variable is void: outline-minor-mode-map


texts: How to org-refile-targets to an file+olp+datetree?

texts:
I have an org-capture that writes a timestamp
(setq org-capture-templates
  `(("a" "Agenda" entry (file+olp+datetree "agenda.org" "Calendar Agenda")
    ,(concat "* TODO %? :agenda:"))

Which produces this entry in agenda.org
* Calendar Agenda
  * 2020
    * 2020-01 January
      * TODO Item 1 :agenda:

I have tried The solution here How to refile into a datetree however, it files to 2nd level which is not what I want, what I want is to file it under 3rd level.
How do I write a refile to file+olp+datetree?


texts: Why does this function stub not work using cl-letf?

texts:
I have written this simple function and I want to stub out the last functions so I don't actually launch a process.

(defun dc-test-stub-process (command &rest params)
  (interactive)
  (let ((commands (append (list dc-buffer-name dc-docker-cmd command) params)))
    (apply #'dc-process commands)))

I have been playing around with this expecting it to fail because it returns "test" how ever it just passes and it looks like dc-process is actually called and not stubbed out.

(ert-deftest pp-test-process-function ()
  (setq dc-current-buffer "/")
  (cl-letf (((symbol-function 'dc-process)
             (lambda (&rest _) "test"))
    (should (equal (dc-test-stub-process "a" "d" "c") "test2")))))

I have also tried doing the same but stubbing out apply with the same results.

Anyone able to spot what's wrong? There is not much info on using cl-letf but most likely I am doing something wrong as I am still learning lisp.


texts:
I'm currently using (vc-root-diff nil) however, I'd like to spesify a branch.

Calling (vc-root-diff t) prompts for the revision, and the path.

Is there a way to diff against a branch without, manually entering it in every time?


texts:
diff-mode allows to move (by C-c C-c) or to apply hunk and to move (by C-c C-a) to position of original source file where hunk is placed.

How can I do that in Magit Rev mode? On RET it opens buffer unrelated to file with corresponding content for file version.


texts: trouble with flycheck-gcc-language-standard variable

texts:
I am attempting to use Directory-Variables in order to set the flycheck-gcc-language-standard variable. I used: M-x add-dir-local-variable RET c++-mode RET flycheck-gcc-language-standard RET "c++11" to create the .dir-local.el file in the project root directory. Which results in the following code:

((c++-mode
  (flycheck-gcc-language-standard . "c++11")))

the above creates a warning that this is a "malformed function". I've tried several variations: without quotes, c++0x instead of c++11, among others. Flycheck.el doesn't list what are acceptable variables. I'm stuck.

Any suggestions would be very much appreciated.

If it helps below is the debugger output:

Debugger entered--Lisp error:
  (invalid-function (c++-mode (flycheck-gcc-language-standard . c++11)))
  ((c++-mode (flycheck-gcc-language-standard . c++11)))
  eval(((c++-mode (flycheck-gcc-language-standard . c++11))) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

It seems to me that I'm missing something but I don't know it might be. I new to emacs.


texts: What's the difference between push and add-to-list?

texts: I've found that different packages in their installation instructions use either push or add-to-list (For example adding a directory to load-path) and I was wondering what the difference is and what the use case for each would be.


texts: How can I get the mode line to look like the one used in this screen shot?

texts:
I've been using powerline, but this doesn't look anything like it.

and just in case anyone is curious the theme in the picture is this one: https://github.com/emacsfodder/emacs-soothe-theme


texts: Show tooltip even if there is only one candidate in company-mode

texts:
As the topic says, I don't want to see a preview, because it confuses me big time. Instead, I want to see tooltip regardless of candidates count. So I hacked it like this an it works:

;; I hate in place previews,
;; So I just redefine it to show tooltip even if there is only one candidate
(defun company-preview-if-just-one-frontend (COMMAND)
  (company-pseudo-tooltip-frontend COMMAND))

To clarify, instead of this:

I want this:

I'm new to elisp, but I think there is something not right with this approach. Is there a better way?


texts: How to display org time segment in mini-buffer when logging time into a logbook drawer?

texts:
I use org-mode and log time into a drawer ((setq org-clock-into-drawer t)). I often clock in and out in succession and have to go into the LOGBOOK drawer to see how much time I spent.

How can I display that time in the mini-buffer after clocking out?


texts: How to change org-mode settings to always include a certain preamble

texts:
So currently I have this preamble for all my org files. Does anyone know how to make org-mode default to the above settings whenever I open a .org file?

#+STARTUP: latexpreview
#+LATEX_HEADER: \usepackage{tcolorbox}
#+LATEX_HEADER: \usepackage{amsmath}
#+LATEX_HEADER: \newcommand{\vsp}{\vspace{4mm}}
#+LATEX_HEADER: \newcommand{\la}{\leftarrow}
#+LATEX_HEADER: \newcommand{\ra}{\rightarrow}
#+LATEX_HEADER: \newcommand{\ua}{\uparrow}
#+LATEX_HEADER: \newcommand{\da}{\downarrow}


texts: Get actual buffer name from backtrace buffer?

texts:
I have a buffer foo.el with some invalid code

(bar)

If i run M-x eval-buffer, with debug on, it show this in backtrace buffer

Debugger entered--Lisp error: (void-function bar)
  (bar)
  eval-buffer()  ; Reading at buffer position 49
  call-interactively(eval-buffer nil nil)
  command-execute(eval-buffer)

I am trying to hyperlink

(bar)

to origial location which is foo.el at some position.

Here is what i have done so far.

(defun hyperlink-error-location ()
  "Hyperlink errors in backtrace."
  (interactive)
  (when (search-forward-regexp "Reading at buffer position " nil 'noerror)
    (goto-char (match-end 0))
    (let ((num (symbol-at-point)))
      (forward-line -1)
      (make-button (line-beginning-position) (line-end-position)
                   'action (lambda (x)
                             (find-file "/path/to/file")
                             (goto-char num))))))

(add-hook 'debugger-mode-hook 'hyperlink-error-location)

However i need original buffer name foo.el in backtrace buffer. How can  i get it?


texts: Update Org Header if SRC Block has :tangle no

texts:
I organize my init.el in a single org-file as many do. Often times I remove code from my config to test things out. I typically do this by changing the src-block to have a :tangle no setting. In many cases, I forget about it and eventually realize large portions of my config are not tangled.

I'm not quite sure if I need to craft some type of watcher or hook function.

* This is a heading

    #+BEGIN_SRC emacs-lisp
    ...
    #+END_SRC

would become

* TODO This is a heading

    #+BEGIN_SRC emacs-lisp :tangle no
    ...
    #+END_SRC

I was thinking about adding something like this to an on-save hook and then modifying the code blocks section header if :tangle no.

(org-element-map (org-element-parse-buffer) 'src-block #'identity nil nil 'src-block)

But it takes a really long time just to run this function.


texts: Why is emacs indenting with tabs even though indent-tabs-mode is nil?

texts:
In C/l-mode F1 v indent-tabs-mode prints:

indent-tabs-mode is a variable defined in `C source code'.
Its value is nil
Original value was t
Local in buffer nir_types.cpp; global value is t

But pressing the tab key still replaces the spaces used for indentation with tabs.


texts: Creating a macro to change dictionary and run ispell

texts:
I would like to create a simple key binding (e.g. C-c s e) to spell check the (mu4e) email message I am composing using English (and use other bindings for other languages).  I thought I'd simply record a macro, save it and then bind the key to it.  However, this doesn't work, probably because at the end of the macro, I should be in an interactive ispell session.

What I did to record the macro was

M-x ( M-x ispell-change-dictionary RET en_GB RET M-x ispell-message x M-x )

I had to press the x to exit the ispell session and be able to end recording using M-x ), but removed this x after saving the macro to my init.el.  The lines in that file now looks like

(fset 'ispell-message-en
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([escape 120 105 115 112 101 108 108 45 99 104 97 110 103 101 45 100 105 99 116 105 111 110 97 114 121 return 101 110 95 71 66 return escape 120 105 115 112 101 108 108 45 109 101 115 115 97 103 101 return] 0 "%d")) arg)))

When running M-x ispell-message-en I get:

ispell-command-loop: Args out of range: [], 0

I think I understand why this goes wrong (though I'd hoped the macro would just get me to the first misspelled word) but I don't know how to do this properly.  So my question is, how can I set up a macro that drops me in an interactive ispell-message session?  Or, if that is not possible, how can I otherwise assign the changing of the dictionary to en_GB and starting ispell-message using the keybinding C-c s e?


texts: Emacs as JavaScript IDE. What is the best package for this?

texts:
Windows 10, Emacs 25.1

I want to write many JavaScript files on Emacs. And as result I need comfortable mode to work with javascript.

So as result I want to use Emacs as JavaScript IDE. The question is: What is a good  package for this (with highlighting, context help, and so on)?


texts:
I would like to sort some lines, ignoring a leading part of them.

Here's an example from my .spacemacs file:

'(
     better-defaults
     elixir
     emacs-lisp
     erlang
     evil-commentary
     finance
     git
     haskell
     html
     ivy
     javascript
     lua
     markdown
     my-eshell
     my-org
     nginx
     nixos
     (org :variables org-projectile-file "TODO.org")
     python
     (ruby :variables ruby-test-runner 'rspec)
     shell-scripts
     spell-checking
     (syntax-checking :variables syntax-checking-enable-tooltips nil)
     vinegar
     yaml
)

I would like to sort these, but I need to ignore the leading ( for that.

Similarly, here's an excerpt from my configuration.nix:

packages = with pkgs; [
      ## Basics
      atool
      bashInteractive
      entr
      ethtool
      fasd
      fd
      file
      fzf
      git
      git-crypt
      gitAndTools.hub
      google-cloud-sdk
      gparted
      hdparm
      htop
      i7z
      inotify-tools
      iperf
      lm_sensors
      neovim
      p7zip
      parted
      pwgen
      ripgrep
      sshfs
      # tarsnap
      tmux
      tree
      unzip
      wget
      xclip
      zip
];

Here, I would like to sort the lines, ignoring the leading # part.

How would I do this in Emacs?


texts: Trouble while using string-match with rx expression

texts:
I'm trying to write a function that takes a string and returns non-nil if it's the word do not followed by the character :. Something like this:

(string-match (rx "do[^:]") input)

but I get the following result:

(string-match (rx "do[^:]") "do") ;; => nil

Am I doing something wrong here? Or is there any other way to compare a string with a Regex?


texts: What is the runtime complexity of using beginning-of-line?

texts: I did a test where going to from the end to the beginning of a 50 million length line happens instantly when using beginning-of-line. I wonder if this is because it is a C primitive or because Emacs implements this and related functions in an efficient way. For example, it could keep a mapping from line numbers to the positions of those lines within the buffer (this is just a guess). Why is it so fast? Does the runtime depend on the number of characters on the line, or is it constant?


texts: How to display atime, ctime and mtime of a file in the modeline?

texts:
The modeline at the bottom already displays valuable information about the current buffer, like the EOL type (LF), the encoding (UTF-8)…
Now when I open a file, I would find it very handy to also display its date-time info (atime, ctime, mtime), preferably in a human format to know at a glimpse if I'm about to edit an old or a recent document.


texts: how to run a shell script that initialises the elpa directory?

texts: I'm creating a container for emacs and I'd like to add a call to the dockerfile running a script to pre-download all the elpa packages it needs from a clean .emacs.d taken from github. Is there a way to do this?


texts: Modify emacs calendar starting week number

texts:
I want to change emacs default calendar week number so that it starts at a manually preset date.
Normally the year is broken into 52 weeks and week 1 is the one that contains the 1st of January. I'd like to be able to either change this date to another, 20 of July (say), or to have a second week number that gets displayed when org-agenda is called. Like so

Week-agenda (W01):
Monday     20 July 2020 W01
Tuesday    21 July 2020
Wednesday  22 July 2020
Thursday   23 July 2020
Friday     24 July 2020
Saturday   25 July 2020
Sunday     26 July 2020

or

Week-agenda (W30 | W01):
Monday     20 July 2020 W30 | W01
Tuesday    21 July 2020
Wednesday  22 July 2020
Thursday   23 July 2020
Friday     24 July 2020
Saturday   25 July 2020
Sunday     26 July 2020

These are the closest posts that I could find so far link1 link2. I am using emacs 26.3 and org 9.2.6. This question is relevant because at my work place the week system is offset from the normal week system, and it would be great to be able to adjust emacs to it.


texts:
Look at this:
Undefined color: "WINDOW_FOREGROUND"

Jesus. What can i do?
Edit: Im a Manjaro user.


texts:
When I try to preview my markdown files I get this aggressive funny response:

What’s wrong with you???! Don’t flyit if you are not viewing a markdown file.

But I am! ;-) It's just that I use .txt as extension for them. I'm even in markdown-mode.

Could I tell flymd that it's ok to try and preview these files?


texts: I'm pasting a lot of youtube links in my org-mode files. My procedure is - copy link from youtube and then manually copy the title of the video. I was thinking is this can be automated - just paste link & description will be downloaded.


texts: Bind a modifier key (like right shift) to a command?

texts:
I often use the M-x command. Is it possible to bind it to my right shift (just the right shift, because I like my left shift the way it is)?

Alright, big thanks to the chosen answer. I solved the problem this way:

# Issued whenever the keyboard layout is changed.
xmodmap -e "keycode 62 = F13"

Then, in my Emacs config, I bind #'smex to <f13>.  If you use the standard #'execute-extended-command, use the first (commented) line.

;; (global-set-key (kbd "<f13>") (function execute-extended-command))
(global-set-key (kbd "<f13>") (function smex))


texts: Data structure for ELPA archive use of dotted pair

texts:
As a belated follow-up to this, can someone enlighten me why the data structure used in the ELPA archive-contents files is a dotted pair of a name (symbol) and a vector that contains a great many things?

What is the advantage of doing it this way? It seems too intentional to just be a random stab. What precedent is this building on?

(1
 (ace-window .
         [(0 9 0)
          ((avy (0 2 0)))
          "Quickly switch windows." single
          ((:url . "https://github.com/abo-abo/ace-window")
           (:keywords "window" "location"))])


texts: Customising the increments in an org-mode timestamp

texts: When I create an appointment in org-agenda I make use of timestamps. The item is created with today's date and time and I then place my cursor on the date and time respectively and use S-up or S-down to increase or decrease the time until I get to the time I need. I see that time increments by default are 5 minutes. I would prefer it to be 30 minutes. Can can I achieve this?


texts: How to conditionally reuse the current window to display a buffer?

texts:
M-x view-echo-area-messages (bound to C-h e by default) is used to see the *Messages* buffer.

I would like to get the following behavior when I press C-h e:

If the frame has just 1 window, split the frame to create a new window and show *Messages* in that new window.
If the frame already has 2 or more windows, display *Messages* in the other window (not the current one).
If the current window is already displaying *Messages* buffer, do NOT do anything (I tend to press C-h e by mistake even when I am in the *Messages* buffer).

I am able to achieve points 1 and 2 above using the below:

;; Control where the *Messages* buffer opens
(add-to-list 'display-buffer-alist
             '("\\*Messages\\*" . ((display-buffer-reuse-window
                                    display-buffer-pop-up-window)
                                   . ((inhibit-same-window . t)))))

But with the above elisp snippet, if I am already in a window with *Messages* and if I do C-h e, it pops up another window displaying the same buffer.

I basically need emacs to ignore (inhibit-same-window . t) if the current buffer matches "\\*Messages\\*". How do I do it?


texts: Forwarding emacs server TCP connection works, but cannot create local frame

texts:
I'm trying to connect to a remote Emacs server. I created the server with server-use-tcp set to t so a connection file was created. I inspected the connection file and found out that it contains the IP and address socket port, the PID and an auth token

127.0.0.1:41507 6843
<SECRET>

and then I

copied (via scp) the connection file to my local pc
forwarded the server port vie ssh -L ssh -L 41507:127.0.0.1:41507 remote

and now when I do

emacsclient  -f ~/.emacs.d/server/server test-buffer

The buffer is really opened in the remote server process.

However, I cannot find a way to make emacsclient create a frame. If I use -c I get

Waiting for Emacs...
*ERROR*: Display :0 can't be opened

and with -t it just hangs, does not even print Waiting for Emacs.

I know similar questions have been asked, but I'm trying to do this without TRAMP, because I'm mostly interested in the fast access time and processing resources on the remote server.


texts: How can I get regexp-opt (or similar) not apply on the word with added underscore?

texts:
See excerpt below for code used in emacs Cadence SKILL mode:

(cons (concat "\\<" (regexp-opt '("nil" "t") t)  "\\>")  'font-lock-constant-face)

it does a brilliant job at highlighting nil and t.The issue is that if I have the string " nil_finder " anywhere  within the code, it would highlight the part of the word which is "nil", and keep the _finder not highlighted. I want none of the " nil_finder " highlighted.
I have tried replacing the t with 'symbols or with 'words, and it did not work. I can generate my own (many/ 1 huge) regular expression(s) to get the behavior that I need, but I read the regexp-opt returns a much more efficient regexp.Thanks.


texts: how to direct an elisp defun to continue despite errors?

texts:
I'm new to emacs-lisp. I wrote a function that kills the buffer of my main work document work.org and opens specific project files.

(defun load-current-files ()
  (interactive)
  (kill-buffer "work.org")
  (find-file "~/file-1.txt")
  (find-file "~/file-2.txt")
  (find-file "~/file-3.txt"))

The function works perfectly when work.org is open. However, if I've already killed that buffer, the function, very naturally throws an error saying Lisp error: (error "No buffer named work.org").

That makes perfect sense. But how do I tell a defun to just keep chugging along even if it encounters an error? Can I wrap a command in an (ignore-errors) layer or something?

(ignore-errors (kill-buffer "work.org"))

Something like that?


texts: Is there a package to search in history of changes?

texts:
While editing files, time to time I regret deleting some redundant parts which afterwards become necessary.

Let's say you are writing a letter and first you explained your thoughts with redundantly very long sentences.
Later on, you come up with an on-spot phrase for them and rephrase with them.
But later again, on 2nd thought, you think the words weren't right phrasing.

To go back to original sentences, in my knowledge, is to use undo, or undo-tree, to go back in history.
But you have to keep pressing the key til it hits that version.

Is there any easy way to search in undo-history to get back to the version?
I'm looking for something along the line of helm-occur functionality, which searches your word in current buffer and lists all the matching lines with line number, but works for the undo-history.


texts: Is it possible to make calc autocomplete units?

texts:
Is there some extension that can make calc autocomplete units while value entered as algebraic input?
e.g.

' 1 kn<tab>

should be completed to "1 knot".


texts:
In my org file, I have the following lines:

#+STARTUP: logdone logrepeat logreschedule logredeadline logrefile logdrawer
#+ARCHIVE: ::datetree/

When I mark a repeat task done, I want to:

Continue doing everything that is happening now (the task gets a new scheduled date, an entry is added in the :LOGBOOK: drawer, etc.) and additionally,
Make an entry in the datetree with DONE as the state for the task

How do I achieve this?


texts: How to enable control character (e.g. carriage return) handling in emacs shell

texts:
I run compilation processes that, in a terminal, list what was built all on the same line. In emacs shell they are all on separate lines, filling my shell buffer with unwanted output. I realize I could run the terminal emulator in emacs, but there are lots of reasons why I prefer to use emacs shell. If I could get emacs shell to handle the control sequences correctly (that is, in this case, handle \r by going to the beginning of the same line and erase the line on further output) that would be fantastic.

Any idea if this is possible?


texts:
Although it is convenient how org-mode shows hyperlinks, there are times when I want to see the underlying plain text, e.g. [[./file.org][Title]]. How can I do this?

I know about org-insert-link, but it is not what I want:

  C-c C-l runs the command org-insert-link, which is an interactive compiled Lisp
  function in `org.el'.

  ...

  If there is already a link at point, this command will allow you to edit link
  and description parts.


texts: Emacs window configuration like awesome wm

texts: Does there exist anything like awesomewm window configurations in emacs? For example, having custom layouts for two windows, maybe 1, 2, and 3, the first being even vertical split, the second even horizontal split, and the third being something like 1/3-2/3 vertical split. And so on for three windows and above. I've looked but have yet to find anything having this functionality.


texts:
Goal:

When dired is opened by default hidden files should be hidden.
When the user clicks "M-q" hidden files must be shown except for "." and ".."

I tried the following:

;don't show hidden files
(setq dired-omit-files "^\\..*$")
(defun swap-omit-files ()
      "Show/hide hidden files except . and .."
      (interactive)
      (if (string= dired-omit-files "^\\..*$")
            (setq dired-omit-files "^\\.\\.?$")
            (setq dired-omit-files "^\\..*$")
            )
      )

(add-hook 'dired-mode-hook
      (lambda ()
            (setq dired-omit-mode t)
            (define-key dired-mode-map (kbd "M-q") 'swap-omit-files)
            ))

Hidden file are indeed hidden by default, but something is wrong with swap-omit-files --- the hidden files are not shown.

How to fix?


texts: Exit from Total Algebraic mode in Spacemacs

texts:
I started following Calc-mode tutorial in Spacemacs and I noticed that,
once we get in Total Algebraic mode(C-x * c, to start calc-mode, then m t to enable total algebraic mode) the way we should exit from this mode should be by using M-m t.

But it turns out that this key combo, in Spacemacs, has other meaning, calling other functions.

How can I exit from Total Algebraic mode(calc-total-algebraic-mode)?


texts:
When I call describe-key and enter … (Alt Gr + .), it says M-b runs the command backward-word […] and async-shell-command (bound to M-&) is called.
I'm on Linux with Xorg, the terminal emulator is Alacritty, keyboard layout is German. I can enter … just fine in nano.
showkey -a shows this when I enter …:
$ LC_ALL=C showkey -a

Press any keys - Ctrl-D will terminate this program

…       226 0342 0xe2
        128 0200 0x80
        166 0246 0xa6
^D        4 0004 0x04

Edit: Additional information ↓
This is what view-lossage reports:
 M-b                    ;; backward-word
 C-M-@                  ;; mark-sexp
 M-&                    ;; async-shell-command

Interestingly, this happens only if I open the file with emacsclient without options. When I open the same file with emacsclient --tty, … is correctly inserted.


texts: Understanding why two apparently different overlay strings are `equal`


texts: are there conflicts between use-package and a package's autoloads?

texts: Do I have to worry about a package's built-in autoloads somehow conflicting with those implicitly defined by use-package? For example if I do :commands some-cmd but the package already had an autoload created for some-cmd, will there be any problems?


texts: How to make directed-subtree-cycle ignore the specified file?

texts: I'm using dired harks https://github.com/Fuco1/dired-hacks. I've used directed omit to ignore files. But when I use dired-subtree, dired-subtree-cycle expansion can't ignore omit files in real time. Can anyone give an example for dired-subtree to ignore the specified file.


texts: "not in compilation buffer" error using compilation-next-error in elisp function

texts:
I am getting an elisp error that fails at lisp/progmodes/compile.el within compilation-next-error function that reads "Not in a compilation buffer". The elisp function I am writing attempts to automatically jump to the first error within the compilation buffer, then copies the error and writes it to file. Here is the function. I've tried a few things so I've left the tried stuff commented while the function itself will produce the error. Perhaps the error is an obvious one for trained eyes.
(defun write-first-error-to-file()
  "function copies first error in compilation buffer and writes it to specified file"
  (interactive)
;;;  (select-window (previous-window))
;;;  (switch-to-buffer "*compilation*")
;;;  (goto-char (compilation-next-error))
  (let ((display-buffer-overriding-action '(display-buffer-same-window)))
   (compilation-next-error))
;;;  (set-mark-command nil)
;;;  (goto-char (compilation-next-error))
;;;  (setq deactivate-mark nil)
  (kill-ring-save (region-beginning) (region-end))
  (write-region (region-beginning) (region-end) "~/copybuffer.txt"))

The function attempts to do the following:

Declares the function as an interactive form
Display the compilation buffer and within it go to the next error within compilation buffer. Note, it should be the first error if this is the first command executed. This is where I am getting the aforementioned error.
Commented, set mark to select region
Commented, Advance cursor to next compilation-next-error
Commented, deactivate mark. At this point, the region should have been selected programmatically perhaps??
Save region to kill-ring
Write region to file! :D

As you can see there are quite a few issues with this function, perhaps someone can see what I am missing. Thanks for any help anyone can provide.
For reference, the above function produces the following error with strange error output. You can see the "Not in compilation buffer" within the error output.
×H^N%W\204s^A^N&\203þ^A^M×
ÌH^K>\204ô^AÈÍÎÏ#\210
ÐH8\211^U=\204s^A^N'\203^Y^BÞ
ÌH^K>\204^R^BÈÍÎÏ#\210
ÐH\233\204s^A^N(\2034^B
ÌH^K>\204,^BÈÍÎÏ#\210
ÐH^L=\204s^A^N\"T\211^V\"\202u^A)       b\210
\206J^BÈá^N$\"+\207" [buffer pt msg cl-struct-compilation--message-tags loc last local-variable-p compilation-locs error "Not in a compila\
tion buffer" ...] 7 ("/usr/share/emacs/24.5/lisp/progmodes/compile.elc" . 69981) "p"], 0


texts: Setting org-babel-load-languages in .dir-locals.el

texts:
As per the title, I'd like to set the org-babel-load-languages (to contain ditaa and calc languages) for a specific project only.

The only solution I found so far is this one

(
 (org-mode .
           ((eval . (org-babel-do-load-languages
            'org-babel-load-languages
            '((emacs-lisp . nil)
              (calc . t)
              (ditaa . t)))))))

The main drawback is that in this way the variable changes its value globally, while I'd like to have the different value only for the project.

So, I tried using

(
 (org-mode .
           (
            (org-babel-load-languages . ((ditaa . t) (calc . t)))
            )))

and a lot of different flavors of it, without any success.

So, is it possible to assign this variable on a per-project basis?

Notes

The variable documentations says the following after using the second method

  org-babel-load-languages is a variable defined in ‘org.el’. Its value
  is ((ditaa . t) (calc . t)) Original value was ((emacs-lisp . t))

  Local in buffer LAB.org; global value is  ((python . t)  (shell . t)
  (emacs-lisp . t))

  This variable’s value is directory-local, ...

which seems fine, but still org-mode emacs is unable to execute functions for calc or ditaa.

The first method (with eval), instead, works fine.


texts:
I would light to highlight where prettify-symbols-mode has prettified a symbol. For example, if Emacs displays lambda as λ it could be displayed with a gray background, but if a literal λ occurs in the text, the background would remain white.

How can I achieve this?


texts: Stopping pdf-tools from resetting to the beginning of an open PDF when I eval-buffer my config file

texts:
I'm using pdf-tools to read PDFs in Emacs, and am pretty happy so far. However, I've found when I modify, and then eval-buffer my configuration file, the PDFs I opened earlier with pdf-tools get put back to their first page! This is highly annoying behaviour, and I'm not sure how to fix it.

For reference, all the config file contains that relates to pdf-tools is the necessary (pdf-tools-install) to ensure that it becomes operational.


texts:
I'm trying to map F5 to compile from a parent directory of the current buffer.

Emacs compile-command find makefile in superior directory
 provides an excellent answer to achieve this:

(defun compile-project ()
  (interactive)
  (let* ((make-directory (locate-dominating-file (buffer-file-name)
                                                  "Makefile"))
          (command (concat "make -k -C "
                           (shell-quote-argument make-directory))))
  (compile command)))

(global-set-key (kbd "<f5>") 'compile-project)

Besides, C/C++ Development Environment for Emacs describes a way such that F5 does not prompt for the compile command every time, but if a prefix argument C-u is provided, then compile prompts for a compile command:

(global-set-key (kbd "<f5>") (lambda ()
                               (interactive)
                               (setq-local compilation-read-command nil)
                               (call-interactively 'compile)))

Question: How can I modify the compile-project function, so that when a prefix command C-u is provided, it shows the compilation command in the mini-buffer, including a default command of make -k -C ... generated by the body of let*?


texts:
I have defined an org-link as follows:

(org-link-set-parameters my-link
 :follow (lambda (path) (message "This my link"))
 :export (lambda (path desc backend) "") ; I need to remove the space before the link.
)

In my case, this type of a link is always preceded by a space which should not appear in the exported file. How can I cause the character immediately preceding the link to be deleted during export?

For example, when exporting the following:

Some text my-link:path more text.

if the link is simply replaced by an empty string two spaces would result in the output. I want to avoid the extra space.


texts: How to set FTP TRAMP/ANGE connection configuration

texts:
With SSH I can add connections to my SSH config file at /.ssh/config Once added to the config file emacs will auto-complete these connections when using tramp integrations like find-file /ssh:

I would like emacs to auto-complete FTP connection addresses In the same manner. Where can I specify them?


texts:
In various programming modes, assuming I have a few lines of code like this :

foo()
bar()

And I want to turn it into a block (say, and if of some sort)

if (something) {
  foo()
  bar()
}

Is there, in general, a more clever way than :

selecting the region
yaking it
typing the if... line
pasting the region

I'm probably just missing the name of something ("wrapping" ?)


texts:
I'd like to have org-mode do what OmniFocus does; when the bottom task in a sequential list is completed, the next task in the list becomes visible in an Agenda. Any thoughts on how I might try to tackle this problem?

I'd essentially like to write a tree with the leaves and only the leaves visible in some Agenda.

I'd be willing to try something like

* PENDING buy milk
** PENDING go to store
*** PENDING get in car
**** TODO find car keys
**** TODO put on pants

Where "get in car" automatically goes from PENDING to TODO when "find car keys" and "put on pants" are marked DONE in some Agenda. Ideally, though, I'd just create a special list of items all at the same level and mark the bottom one TODO.


texts: How to use multiple backends in priority for company-mode

texts:
If I do
(setq company-backends '(company-tabnine company-capf company-yasnippet))

Then company will try company-tabnine to give me completions. If tabnine fails, it will try capf.
If instead I do
(setq company-backends '((company-tabnine company-capf company-yasnippet)))

Then company will yield completions from all of the backends at once, which is what I want. I think it has some internal guidelines for how to order the completions: which appear at the top.
But I want completions from tabnine always to be prioritized; at the top. Any way to achieve that?


texts: How to enable python-pylint for the all files by default?

texts:
I can enable python-pylint for a opened Python file doing:

M-x flycheck-select-checker and enter python-pylint

It think it says C-c ! s to enable it on all Python files.(the message hides itself so I couldn't read it).

=> Is it possible to do this in .emacs for all the Python files by default?

My setup:

(require 'flycheck)
(require 'flycheck-mypy)

(add-hook 'python-mode-hook 'flycheck-mode) ;(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'python-mode-hook
          (lambda ()
            (setq flycheck-python-pylint-executable "~/venv/bin/pylint")
            (setq flycheck-pylintrc "~/.pylintrc")))


texts: Disable loop completion when programming perl

texts: When I type a loop keyword (for, while, do) in perl program, emacs automatically inserts brackets and parenthesizes to complete the loop structure. I would like to disable this but I'm not sure what is actually doing it. I have CPerl, Flymake, AC, Outl, and Abbrev modes loaded.


texts: How do I debug an "Invalid face reference: quote" message?

texts:
After using Emacs for some time, the message Invalid face reference: quote starts popping up in my message buffer. I'm not sure what causes it to start appearing.

debug-on-message doesn't do anything (this is an error in the redisplay code)
debug-on-error doesn't work either (for the same reason)
grepping my .emacs.d for quote or ' returns way too many results
The problem is probably caused by a specific mode, but I don't know which, so debugging with -Q is tricky

What tricks could I use to locate the issue? Would a carefully crafted grep command work? Can I make font-lock output more information? Can I edit part of the Emacs C sources to get a backtrace if that message appears?


texts: Cleanup org-mode export intermediary directories

texts:
I am trying to delete extraneous files and directories generated during the export of a latex file from orgmode. I followed the instructions in a similarly named stackexchange post to delete extra files generated by the compilation step:

Cleanup org-mode export intermediary file

The code was:

(setq org-latex-logfiles-extensions (quote ("lof" "lot" "tex~" "aux" "idx" "log" "out" "toc" "nav" "synctex.gz" "el" "w18" "snm" "vrb" "dvi" "fdb_latexmk" "blg" "brf" "fls" "entoc" "ps" "spl" "bbl")))

This worked as expected for me. However, I have a couple of directories generated during the compile step that are not getting deleted. The directories are "auto" and "_minted_[org-filename]". When I say org-filename I mean the name of the org file is included in the intermediate directory name. So if a file is named forexport.org the directory would be "_minted-forexport".

The "auto" directory contains "el" files and the minted directories are empty.

Can anyone suggest how to delete the actual directories and any files in them? Is there an amendment I can make to the code above, or do I need something separate.


texts: documentation/specfication for emacs variant of ctags format

texts:
Where can I find some thorough documentation / a specification for the Emacs ctags format? The ultimate goal here is to make it easier to generate a tags file in parallel (preferably using a tool like xargs or GNU Parallel).

Somewhat confusingly, there are two very different formats commonly called "ctags". One of which is used by vi and its workalikes.

example (from Perl 5 source code using ctags -f- op.c | head -n 3):

AAS_DANGEROUS   op.c    /^    AAS_DANGEROUS       = 0x080, \/* an op (other than the above)$/;" e   enum:__anon1file:
AAS_DEFAV   op.c    /^    AAS_DEFAV           = 0x200  \/* contains just a single '@_' on RHS *\/$/;"   e   enum:__anon1    file:
AAS_LEX_AGG op.c    /^    AAS_LEX_AGG         = 0x008, \/* @lexical or %lexical aggregate *\/$/;"   e   enum:__anon1    file:

This format has the advantage of being line-oriented and storing the symbol first, so work can be efficiently parallelized

find . -name '*.c' -o -name '*.h' \
   | xargs -I% -n100 -P8 ctags -f- % \
   | env LC_ALL=C sort > tags

By contrast, the Emacs variant of the ctags format is a little bit harder to decipher since, among other things, it uses non-printable characters internally.

File Edit Options Buffers Tools Hexl Help
87654321  0011 2233 4455 6677 8899 aabb ccdd eeff  0123456789abcdef
00000000: 0c0a 6f70 2e63 2c31 3935 3131 0a23 6465  ..op.c,19511.#de
00000010: 6669 6e65 2050 4552 4c5f 494e 5f4f 505f  fine PERL_IN_OP_
00000020: 437f 5045 524c 5f49 4e5f 4f50 5f43 0131  C.PERL_IN_OP_C.1

It also uses byte offsets instead of a search string. It also mentions the file name once at the start of a "stanza" corresponding to each file rather than having each line stand on its own.

The closest I was able to find to documentation of the internal format (rather than the kinds of pattern in source codes that emacs recognizes) was https://stackoverflow.com/q/1990579/931154 .


texts: Org-babel's `call` functionality wraps all results in quotes

texts:
Using org-babel source blocks, I can name a block and call it later. When I evaluate the block itself, I get a bare value:

#+name: demo
#+BEGIN_SRC python
return 5
#+END_SRC

#+RESULTS: demo
: 5

But if I call the block, the result is always in quotes:

#+call: demo()

#+RESULTS:
: "5"

How on earth do you change this behavior? I've messed with org-babel-inline-results-wrap, to no avail.


texts: Does magit when using ediff have a means for moving on the next file when there are multiple files to be diffed?

texts:
I am using ediff to get side by side diffs with magit and there seems to be no way to move to the next pair of files, after diffing the current file.

For instance if I use vimdiff for git diff, after using :qa to close the diffs on the current file the next change file is brought up to be diffed.

Does the ediff have a method of doing that?

Currently it looks like have to close the current window, return to the magit status window and select the next file to be diffed.


texts: Is there a similar command to comment-kill that kills all comments in a given region and saves them to the kill ring?


texts: mu4e conversation view: Left right alignment like in whatsapp

texts: Is it possible to show the emails of one person in mu4e-conversation view indented by a defined amount of whitespace/tabs to get a view similar to what you know from some messenger apps like whatsapp:


texts: How to programmatically walk along string and add text properties

texts:
I have a function that gathers strings that looks like these:

Example #1:   :event:lawlist:HIGH:misc:
Example #2:  :LOW:
Example #3:  :MEDIUM:task:george:

I created a monstrosity of a snippet that breaks the string down into various sub-components, adds text properties to each component, and then reconstructs the new string.

Q:  Is there a more sophisticated way to do this project?

  (let* (
    new-list
    (string ":event:lawlist:HIGH:misc:")
    (lst (delete "" (split-string string ":")))
    (separator (propertize ":" 'face '(:foreground "cyan"))) )
  (dolist (e lst)
    (put-text-property 0 (length e) 'face
      (cond
        ((string= e "event")
          '(:foreground "red"))
        ((string= e "lawlist")
          '(:foreground "blue"))
        ((string= e "HIGH")
          '(:foreground "yellow"))
        (t
          'default))
      e)
    (push e new-list))
  (concat separator (mapconcat 'identity (reverse new-list) separator) separator))


texts: Access document title, author, date with elisp

texts:
The beginning of my document looks like this

#+TITLE: this is the document title
#+AUTHOR: R. Wiggum
#+DATE: 2018-09-12

How can I access these properties with LISP?


texts: how to find number of arguments expected by an elisp function in emacs

texts:
I have some code that I use in my .emacs file that works with version 25.5 where the definition of windows--sanitize-window-sizes looks something like this:
(defun window--sanitize-window-sizes (frame horizontal) ;; emacs 25.5

That I want to make work both there and in emacs 27.1 where the definition of windows--sanitize-window-sizes looks something like this:
(defun window--sanitize-window-sizes (horizontal) ;; emacs 27.1

So, how do I check in my calling function how many arguments the function expects, what do I write to ask this question, as in:
   (cond
     ((not (fboundp 'window--sanitize-window-sizes))
      t ; no function to call, assume sizes ok
      )
      ((= (max-number-of-arguments 'window--sanitize-window-sizes) 1)
       ;; probably something like (cdr (arguments-accepted 'window--sanitize-window-sizes))
       (window--sanitize-window-sizes size) ; 27.1 expects only size
       )
      (t
       (window--sanitize-window-sizes frame size) ; 25.5 expects only size
       )
      )

I presume there is a function I can apply to a symbol that tells me how many
arguments are expected (min max) or maybe something more complex to handle &optional and &rest cases.


texts: Configuring lsp-mode to run elm-language-server

texts:
I'm trying to run lsp-mode for elm development and according to lsp-mode elm is supported. Also according to that link, I should only have to clone the elm-language-server repository, run npm install and then tsc, all of which I did, without any errors.

After configuring emacs with the following from here

(require 'lsp-mode)
(add-hook 'elm-mode-hook #'lsp)
(setq lsp-elm-server-install-dir "~/Projects/elm-language-server")

everything should be set to go.

When I do this, everything seems to work. lsp-mode starts when I open an elm file and it starts the elm-language-server. I end up with an *lsp-log* buffer, an *elm-ls* buffer and an *elm-ls::stderr* buffer.

The output from the *lsp-log* buffer doesn't look too suspicious:

Command "node /home/chris/Projects/elm-language-server/out/index.js --stdio" is present on the path.
Found the following clients for /home/chris/Projects/select-elm/src/Main.elm: (server-id elm-ls, priority -1)
The following clients were selected based on priority: (server-id elm-ls, priority -1)
Rebuilding tree-sitter for local Electron version
Fetching tree-sitter
Downloading from https://github.com/tree-sitter/node-tree-sitter/releases/download/v0.14.0/tree-sitter-v0.14.0-node-v57-linux-x64.tar.gz
Fetching tree-sitter-elm
Downloading from https://github.com/razzeee/tree-sitter-elm/releases/download/v2.2.4/tree-sitter-elm-v2.2.4-node-v57-linux-x64.tar.gz
Rebuild succeeded!
initializing - folder: "file:///home/chris/Projects/select-elm/"
Reading elm.json from /home/chris/Projects/select-elm/elm.json
2 source-dirs found
Found 39 files to add to the project
Adding /home/chris/Projects/select-elm/src/01-button.elm
Received new elm-analyse report with 1 messages
Received new elm-analyse report with 1 messages
Adding /home/chris/Projects/select-elm/src/form.elm
Adding /home/chris/Projects/select-elm/src/Main.elm
Adding /home/chris/Projects/select-elm/src/select.elm
Adding /home/chris/Projects/select-elm/src/text.elm
....

although the "-1" in (server-id elm-ls, priority -1) might be an indicator something is wrong.

The *elm-ls* buffer is empty and the *elm-ls::stderr* is where there is a definite problem:

(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: "file" argument must be a non-empty string
(node:30435) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: ENOENT: no such file or directory, open 'file:///home/chris/Projects/select-elm/src/Main.elm'
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: "file" argument must be a non-empty string
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): Error: ENOENT: no such file or directory, open 'file:///home/chris/Projects/select-elm/src/Main.elm'
(node:30435) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 8): TypeError: "file" argument must be a non-empty string

Unfortunately I haven't been able to find anything on the web about this. In my elm buffer I simply get an error message on the very first line "Error parsing file". The file does compile using elm make though.

Anyone have any idea how to debug this? I'm using elm 0.19.0 and unfortunately the normal elm-mode isn't an option for me because elm 0.19.0 has created a lot of breaking changes that the maintainers of elm-mode are having a hard time fixing.


texts: How pass arguments for ctags / projectile-regenate-tags?

texts:
With the package projectile, I use projectile-regenate-tags. At the name already says, it regenates the TAGS-table of the current project on the project root.

It works likke a charm. However, I noticed not all files are included, the files with .inc-extension. I would make it so.

A good command for this could be the following:

ctags -f TAGS -e -R --langmap=php:+.inc.foo.bar --list-maps=php

I would like that projectile-regenate-tags use these parameters. When looking up the source code of projectile-regenate-tags, I found the following:

(defun projectile-regenerate-tags ()
"Regenerate the project's [e|g]tags."
(interactive)
(if (boundp 'ggtags-mode)
    (progn
        (let* ((ggtags-project-root (projectile-project-root))
            (default-directory ggtags-project-root))
        (ggtags-ensure-project)
        (ggtags-update-tags t)))
    (let* ((project-root (projectile-project-root))
        (tags-exclude (projectile-tags-exclude-patterns))
        (default-directory project-root)
        (tags-file (expand-file-name projectile-tags-file-name))
        (command (format projectile-tags-command tags-file tags-exclude))
        shell-output exit-code)
    (with-temp-buffer
        (setq exit-code
            (call-process-shell-command command nil (current-buffer))
            shell-output (projectile-trim-string
                            (buffer-substring (point-min) (point-max)))))
    (unless (zerop exit-code)
        (error shell-output))
    (visit-tags-table tags-file))))

Aha, then look up what projectile-tags-command consists of.

(defcustom projectile-tags-command "ctags -Re -f \"%s\" %s"
"The command Projectile's going to use to generate a TAGS file."
:group 'projectile
:type 'string)

So in my init.el, I setted the variable projectile-tags-command to the following:

(setq projectile-tags-command "ctags -Re -f \"%s\" %s --langmap=php:+.inc.foo.bar --list-maps=php")

Evaluated it, and calling projectile-regenate-tags, I still don't get any relevant files with the extension .inc.
I still don`t get any relevant files. So perhaps I'm wrong somehwere.

Any good suggestion?


texts: Replacing every empty line with a string, i.e. inserting strings to empty lines

texts:
Given that I have a file such as

Lorem

Ipsum

Dolor

I want to insert strings (here, the % character) to those empty lines to obtain

Lorem
%
%
Ipsum
%
Dolor

How can I do this? I tried to follow a way similar to the methods defined here without success.