texts: Add commands after custom LaTeX split window view

texts:
I use

(setq TeX-view-program-list (quote (("Emacs" "emacsclient -e '(split-window-horizontally 88) 'emacsclient -e '(other-window 1)'; emacsclient %o;"))))
(setq TeX-view-program-selection (quote (((output-dvi style-pstricks) "dvips and gv") (output-dvi "xdvi") (output-html "xdg-open") (output-pdf "Emacs"))))

to view the pdf files in a split window.

I would like to extend the first command a little bit (right now it splits the window, changes to the other window and opens the pdf file there)

The split command leaves the new (pdf) buffer active, but I would like to have the original one active.
I would like to sync the position in the source file with the pdf file.

I can do this by hand by calling other window and pdf-sync-forward-search right after the latex view command, but I am sure this can be done automatically.

I tried to add emacsclient -e '(other-window 1)', but it looks like I don't quite understand how the commands work.


texts: Why ido mode automatically change current folder when create new file?

texts:
I want to create file credenentials.txt in folder d:/dev/GoogleDrive/_IPTV/Playlists/OttClub/

M-x C-x C-f

Press "c"
result:

press "cr"
result:

As you can see Emacs change folder to d:/personal

I don't need this.
I only want to create file in folder d:/dev/GoogleDrive/_IPTV/Playlists/OttClub/

How I can do this?

P.S.
I also try by -Q mode and enable only ido-mode
I get same result:

Press "cr"

As you can see Emacs automatically change folder.


texts: How to get swiper to search for the last searched term , much like (default) isearch-forward does when pressing C-s twice?


texts: Export/compile multiple org-mode files from separate directories

texts:
I am writing my dissertation in Emacs org-mode and have a few questions that hopefully someone has faced before. Background info: I have each chapter in a separate directory organized in a .org file that is eventually exported into a PDF. In the chapter directory, there are appropriate subdirectories that have figures etc. In each chapter I have the appropriate LaTeX headers and Class declarations to obtain the export to my liking.
Problem: Each chapter has page numbers that start at 1,2,3, etc.
I would like to customize the page numbers in each chapter so that if CH 1 finishes on page 15, CH 2 begins on page 16. In an ideal world, the export of all .org files would result in a final pdf with sequential page numbers. Is this possible with multiple .org files in separate directories? I like organizing the .org files into separate directories as I can easily work on separate chapters where all the figures are self-contained. Any ideas would be greatly appreciated.


texts:
How can I create a keybinding for specific org-export commands?

E.g. I'd like to bind to F9 exporting to an html file. Currently I need to hit C-c C-e h h.

eety


texts:
For me it seems like a really ruff edge that default spacemacs comes without an option to give my lines a correct indentation, when they are wrapped. (Click the first link if you want to see the issue visualized.) I really need that feature, because I want to have a small org-mode window open at the side of my screen to organize my thoughts while working. (So far I have used workflowy for that, but orgmode seems much more tempting with the vimkeys and with more power). So this happens when I turn truncate-lines on.

Things I tried so far to fix this (sorry if I did things wrong, I just started using emacs):
I tried adding packages according to Make visual-line-mode more compatible with org-mode modifying the following variable:
dotspacemacs-additional-packages '(visual-line-mode adaptive-wrap)

Since it still did not work out I added the following code to my dotspacemacs/user-config according to Correct indentation for wrapped lines:

adaptive-wrap-extra-indent 2

add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode

global-visual-line-mode +1

But no change came to my wrapped lines... Any help sincerely appreciated!


texts:
I want to get rid of the C-e binding so I can bind C-e e, and C-e r to a command. How do I do this?

My .emacs is

(global-set-key (kbd "C-e e) 'move-end-of-line)
(global-set-key (kbd "C-e r) 'end-of-buffer)


texts: How to remove bindings to the ESC prefix key

texts:
I'd like to use the ESC key instead of C-g for keyboard-quit. My naïve approach to just do

(define-key global-map (kbd "ESC") 'keyboard-quit)

does not work. ESC is still a prefix key and pressing it does not call keyboard-quit.


texts: make org "c-c c-c" actually do something useful on a simple line of text

texts:
how can one teach emacs to do something useful here?

for example if the current line contains the word "FOO" anywhere, change it to whatever the string returned by special-lisp-function-001


texts: Underlining in org-mode links with multiline descriptions?

texts:
Q: How can I stop underlining through the left "margin" in links that extend over more than one line?

The face org-link inherits from the face link, which has the underline attribute set to t (or at least it does by default).  Ordinarily, that's all well and good.  It gets ugly, however, if the description of the link is sufficiently long that it wraps onto more than one line, as in the following screenshot:

The screenshot shows the underlining extending from the left margin all the way to indentation.  That's a pretty ugly visual tick.  Is there any way to keep underlining for links, and yet not have the underlining extend from the margin in this way?


texts: How to quickly choose the option marked with [?] in helm

texts:
For example I want to rename a file hello1 to hello. In dired mode, after dired-rename (R), I typed hello, but the focus was on hello1, so I used C-p to get to the option hello and then enter to finish the renaming.

How do I do it with just one key binding like C-m or C-j?


texts:
I'm using evil mode (Spacemacs to be specific) and working with LaTeX projects. I use evil-make or :make command to compile the current LaTeX project to PDF file. I find it quite annoying that whenever I run the command, it opens up a new buffer showing the output, and I have to switch to the buffer the close it.

I'm wondering if there is a way to automatically close the evil-make command buffer if the make is successful?
If not, can how can I change the evil-make command behavior so that when it is called, the emacs can make the output buffer as the currently active buffer (so that I can close it immediately, without switch buffer).


texts: Problem with use-package and matlab-mode - cannot load

texts:
I am trying to use the matlab-mode package with use-package.

in my init.el:

(use-package matlab-mode
  :ensure t
  :config
  (add-to-list
   'auto-mode-alist
   '("\\.m\\'" . matlab-mode))
  (setq matlab-indent-function t)
  (setq matlab-shell-command "matlab"))

This seems to work - the package is downloaded and installed if necessary, the mode is automatically enabled in .m files, but everytime I launch Emacs I get the warning Error (use-package): Cannot load matlab-mode. Can anybody tell me why this happens?


texts: Projectile with caching doesn't like new files

texts:
I use projectile for my project browsing. I have seen that it's really slow, so I turned on caching. Now it's fast (not blazingly fast, sadly).

If I create a new file outside emacs itself, projectile doesn't find it. I can run cache invalidation but that takes a few minutes. How to fix this?


texts:
Emacs 26.1
In regexp help https://www.emacswiki.org/emacs/RegularExpression

has the next regexp:

[:space:]  a whitespace character

Is this a same as:

[ \t\r\n\v\f]

and same as

 \s-

?


texts:
I learned to review the jobs get done in the current week following the instruction:

The Org Manual: Weekly/daily agenda

Press C-c a and get

Continue to strike a, I get a single day's agenda of today rather than a week.

Tried M-x org-agenda-week-view and get the next week's agenda.

How could I get an agenda of this week starting from Monday.

The docs stats:

  For weekly agendas, the default is to start on the previous Monday (see org-agenda-start-on-weekday).

but it seems not the truth.


texts: How to see files of a particular tag in org-roam?

texts:
Before I installed org-roam I saw a screenshot or a video somewhere in which the tags of an org-roam note looked like links. I was under the impression that org-roam allows you to see all notes of a particular tag.
I added a tag to my test note, but I don't see a way to see all notes with that tag. I also could not find any hints on that in the org-roam User Guide.
How can I see a list of all notes with a particular tag (ideally as a list of links so that I can click on a note to navigate to it)?


texts: Isn't there a better way to recover a crashed session?

texts:
I have the misfortune of having been issued a Mac for work. It crashes regularly. To add insult to injury, Emacs doesn't seem to be very good
at recovering from these crashes.

There is a recover-session command, but Emacs considers itself to have many "sessions", each with a separate session-file with a name beginning with .saves-. To get all the files back that you had open before the ghost of Steve Jobs walked up and pressed the power button for you while working, you have to recover each of these separately.

But that isn't all. Then, you must answer a prompt asking if you want to recover each file:

Recover /Foo/bar/baz.txt? (y, n, !, ., q, or C-h)

to which you can answer "!" get rid of that particular prompt for the files in that particular saves file, but then you get prompted for each file's auto save file-- individually:

Recover auto save file /foo/bar/baz? (yes or no)

This time there is no "!" shortcut. You have to spell out yes for each one.

And even after all that, I only have a fraction of the files open that I had before the crash.

Isn't there a command that can just recover all the files you had open with no prompts, and a way to get Emacs to actually recover the whole session and not just a small part of it?


texts: orgmode : agenda AND todo-list on the same buffer (and restricted to current buffer)

texts:
I want to have in an unique buffer with agenda and todo list, and only for the current buffer (not for all my org mode files).

I found how to define two functions (org-agenda-list-current-file and org-todo-list-current-file) but I cannot manage to write a function calling both agenda and todo-list.

Thanks in advance.

;; org-agenda-current-file : agenda for current buffer
(defun org-agenda-list-current-file (&optional arg)
  "org-agenda-list, but using only the current buffer's file."
  (let ((org-agenda-files (list (buffer-file-name (current-buffer)))))
    (if (null (car org-agenda-files))
        (error "%s is not visiting a file" (buffer-name (current-buffer)))
      (org-agenda-list arg))))

;; org-todo-list-current-file : todo list for current buffer
(defun org-todo-list-current-file (&optional arg)
  "`org-todo-list', but using only the current buffer's file."
  (let ((org-agenda-files (list (buffer-file-name (current-buffer)))))
    (if (null (car org-agenda-files))
        (error "%s is not visiting a file" (buffer-name (current-buffer)))
      (org-todo-list arg))))

;; org-agenda-and-todo-list
    ;;  ???

(setq org-agenda-custom-commands
      '(
        ("a" "calendar" org-agenda-list-current-file )
        ("t" "todo" org-todo-list-current-file )
        ("z" "calendar + todo" org-agenda-and-todo-list )
        ))


texts: What does customize: Set for Current Session do?

texts:
I have a variable that I want to switch between two different values and have it apply for the whole session. I'm able to do this using M-x customize-variable and picking "Set for Current Session".

What functions is this calling? I'd love to be able to set a variable for the current session (NOT just for the current buffer, and NOT for future sessions) without using customize.


texts:
I have not found a good way to use ediff with Mercurial changsets. What I want is basically the functionality of vc-dir, but for committed changesets. The input should be a changeset identifier, and I want an overview of the changed files, and an easy way to invoke ediff on each file.

I have experimented with using a wrapper around ediff-directories as argument to hg extdiff but I don't get the overview for the changed files to work.

I use mq, but I don't think that should be an issue, as applied patches as far as I can tell are treated as other changesets.


texts: How can I constrain a predefined replacement-function to selected text?

texts:
When using replace-string from the M-x while having some text selected, it only operates on that selection (specifically, on an Evil visual selection, in my case). However, if I put the same replacement in a function in my init.el, like

(defun my-custom-replace ()
    "Replaces 'foo' with 'bar'."
    (interactive)
    (replace-string "foo" "bar") )

it always seems to modify the entire buffer instead. How can I get this to respect the selection?


texts: Change table of contents title in Org mode according to document language

texts:
Is there an option which changes default title of table of contents in Org mode?
My document is not in English so I want to translate table of content's title.

Answer

As JeanPierre said, It's about export settings. You can set LANGUAGE at the top of your org document this way:

#+LANGUAGE: fr

And French will be used as default language of all strings that org produces during export.
The constant responsible for translation mappings is org-export-dictionary in ox.el and if your language is not supported you can drop it there and then eval-defun to let change take place. In my case:

(defconst org-export-dictionary
    ...
    ("Table of Contents"
         ...
         ("sr" :html "Sadr&#382;aj" :utf-8 "Sadržaj")
         ...)
    ...)

I've wrote a naive function which can be useful in init.el:

(defun org-export-translate-to-lang (term-translations &optional lang)
  "Adds desired translations to `org-export-dictionary'.
   TERM-TRANSLATIONS is alist consisted of term you want to translate
   and its corresponding translation, first as :default then as :html and
   :utf-8. LANG is language you want to translate to."
  (dolist (term-translation term-translations)
    (let* ((term (car term-translation))
           (translation-default (nth 1 term-translation))
           (translation-html (nth 2 term-translation))
           (translation-utf-8 (nth 3 term-translation))
           (term-list (assoc term org-export-dictionary))
           (term-langs (cdr term-list)))
      (setcdr term-list (append term-langs
                                (list
                                 (list lang
                                       :default translation-default
                                       :html translation-html
                                       :utf-8 translation-utf-8)))))))

(org-export-translate-to-lang '(("Table of Contents"
                                 "Sadržaj"
                                 "Sadr&#382;aj"
                                 "Sadržaj")
                                ("Another term"
                                 "coilogji"))
                              "sr")

Disclaimer

It doesn't work if you want to export via Latex (Latex is used when Org exports to PDF). Look at Tyler's answer and comments.


texts:
I want to use nuspell as my spellchecker for emacs. I have installed dictionary and it works fine when I call the program from terminal. But I got the following msg in emacs:
Error enabling Flyspell mode:
(nuspell exited with code 1)

Here is my setting for flyspell;
(setq
  ispell-program-name
  "nuspell")
(setq ispell-hunspell-dict-paths-alist
      '(("en_US" "/usr/share/hunspell/en_US.aff")))
(setq ispell-local-dictionary "en_US")

nuspell -v is the version information. nuspell -vv isn't an valid argument.
~ ❱ nuspell -v
nuspell 4.2.0
Copyright (C) 2016-2020 Dimitrij Mijoski and Sander van Geloven
License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Dimitrij Mijoski and Sander van Geloven.
~ ❱ aspell -vv
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)


texts: Changing a mode's keymap for the duration of a command's execution

texts:
I would like to bind TAB to my company-mode back-end only for the duration of a command's execution. I am trying to achieve this by using dynamic scoping as follows (the irrelevant part of the function is not shown):

(defun my-function()
  (interactive)
  (let ((company-mode-map (copy-sequence company-mode-map)))
    (define-key company-mode-map (kbd "TAB") 'my-company-backend)
    MORE-CODE-HERE))

The new binding does not work (though it did work when I performed it outside of my-function). Why does this use of dynamic scoping not produce the result that I expected and how do I fix it?


texts: Display org-todo-list of entries with deadlines?

texts:
Is there a way to get a list of org-mode entries with deadlines?  Ideally with the deadlines displayed and ordered by deadline.

I haven't found anything like this. The closest thing I find is org-check-deadlines, which just let's me know about things that are due in the next fortnight or are already overdue.


texts: Changing the location of the emacs server socket

texts:
When I run emacs --daemon it creates a socket at /tmp/emacs1000/server

How can I tell it to use a different location?


texts: Magit, an easy way to see if there is more than one line of comments in Magit-Status

texts:
To clarify I know about magit-revision i.e. spacebar but there doesn't seem to be a clear way to tell if a commit has more than one line of comments or not.

What I'm talking about is this:

be93ed0 master origin/master Changed the code for foo.

But then if you press spacebar you can see more of the message:

be93ed0 master origin/master Changed the code for foo.

Changed it from bar to foo because of such and such.

Ideally I would like to hit "tab" and the message would expand, but I'm willing to settle for something that just indicates there is more then one line of comments.


texts: Why is latex preview and latex to html export via dvisvgm not working in org-mode?

texts:
I read this and this question along with the documentation of org-preview-latex-process-alist pulled up by C-h v org-preview-latex-process-alist RET. Alright, I have an idea about what to do. I put this in my init.el under (use-package org ... :init)
(setq org-latex-pdf-process
  '("xelatex -shell-escape -interaction nonstopmode %f"
    "xelatex -shell-escape -interaction nonstopmode %f"))
  (setq xdvsvgm
        '(xdvsvgm
          :programs ("xelatex" "dvisvgm")
          :description "xdv > svg"
          :message "you need to install the programs: xelatex and dvisvgm."
          :use-xcolor t
          :image-input-type "xdv"
          :image-output-type "svg"
          :image-size-adjust (1.7 . 1.5)
          :latex-compiler ("xelatex -no-pdf -interaction nonstopmode -output-directory %o %f")
          :image-converter ("dvisvgm %f -n -b min -c %S -o %O")))
  (with-eval-after-load 'org
    (add-to-list 'org-preview-latex-process-alist xdvsvgm)
    (setq org-preview-latex-default-process 'xdvsvgm))

Then I try C-c C-e h h to export to html but I get,
org-compile-file: File "/tmp/orgtexlUjxgz.xdv" wasn’t produced.  Please adjust ‘xdvsvgm’ part of ‘org-preview-latex-process-alist’.
I don't understand why the xdv file is not produced. My hunch is that there is something wrong with the command xelatex -no-pdf -interaction nonstopmode -output-directory %o %f.
Could someone help?
Here is a minimal document to test it,
#+TITLE: Title Here
#+AUTHOR: Author Name
#+OPTIONS: tex:xdvsvgm

#+BEGIN_export latex
\begin{align*}
    n &= \frac{n}{2} + \frac{n}{2} \\
      &= \sum_{i=1}^{n} 1
\end{align*}
#+END_export


texts: How use rgrep for only org AND java files?

texts:
Linux Mint 20
Emacs 27.2
I want to find text end in the org files in my folder (recursively).
So I use rgrep
M-x rgrep

*.org

Here steps:
step 1:

step 2:

step 3 (result):

Nice. As result I found text end only in the org files.
But... now I want to found text end in the org files AND java files.
How I can do this?
M-x rgrep

*.org, *.java not help


texts: How to identify the source of a recursive edit?

texts:
Every once in a while I notice that the mode name on the mode-line
says [Emacs-Lisp] instead of just Emacs-Lisp. I realise that this
indicates a recursive edit, and I can get rid of it with C-M-c, but
I never know what triggered it.

Is there a way to find out the cause of a current recursive-edit?


texts: Restoring Emacs desktops with daemon + clients

texts:
How to use Emacs desktop functionality with emacs daemon + emacsclient instances?

I've enabled (desktop-save-mode 1) in my init file, and when I start the daemon I see messages like this:

Desktop: 1 frame, 2 buffers restored.

However, it does not restart any of emacsclient instances I have. When I start an emacsclient instance it's blank.

Is there a way to restore the desktop manually once I open a new emacsclient instance? Or is there a way to make this work another way?


texts: Jump to definition of function or class in one of the include files?

texts:
Take the following sample code:

#include <cmath>

int main() {
    double a = -10;
    double b = std::abs(a);
    return 0;
}

When I place the cursor over abs, for example between b and s, I want to have a command which would make Emacs jump to where abs is defined in the cmath header. It's a ctags or gtags kind of functionality, but which allows to jump to definitions in header files that are outside of the project root directory. How can I do that?


texts:
I have lost my emacs config and I try to reconfigure my .init.el on my work station.

I have install helm and defined :

(global-set-key (kbd "C-x C-f") 'helm-find-files)

I have the good windows, but in my last configuration i was able to navigate through my project with the keyboard arrow.

example :

C-x C-f --> /home/foo/bar/

left arrow --> /home/foo/

right arrow --> /home/foo/bar/

In my emacs, actually, this behaviour is not reproducted. What should I do to have it ?


texts: How do I handle multiple string delimeters in a major mode?

texts:
I'm trying to write a major mode for a language that supports normal strings and triple-quoted strings ("foo" and """foo""").

(defconst my-string-mode-syntax-table
  (let ((table (make-syntax-table)))
    (modify-syntax-entry ?\" "\"" table)
    table))

(defconst my-string-mode-triple-quoted
  (rx "\"\"\"" (group (*? anything) "\"\"\"")))

(define-derived-mode my-string-mode prog-mode "My Mode"
  "testing"
  :syntax-table my-string-mode-syntax-table
  (set (make-local-variable 'font-lock-defaults)
       `(((,my-string-mode-triple-quoted 1 'font-lock-string-face t))))
  (font-lock-fontify-buffer))

I've marked " as a string delimiter, and highlighted triple-quoted strings.

This works in some cases:

"""foo "bar" baz"""

However, string highlighting is broken when I have an odd number of double quotes:

 """foo " bar"""

It also breaks parse-partial-sexp as it no longer returns strings in the correct places.

What's the correct emacs functionality to handle this?


texts: How can I stop keyboard-quit from ending macro definition?

texts: When I am defining keyboard macro with kmacro-start-macro and I press C-g (for example to deactivate mark or I press it accidentally), macro definition is aborted and I have to start over. Is there any way to disable this behavior?


texts: Org-babel 9 + Spacemacs: Unable to evaluate org-babel SRC Blocks

texts:
I followed every instruction I could here Org-mode 9: unable to eval code-blocks, and I am unable to get org-mode and org-babel to evaluate any code blocks in any language. I am dead in the water and I am throwing myself on the mercy of this community for help.  I've spent the entire morning googling and reading and fenceposting and hacking with zero progress. All my org-mode files are dead!

Here is an MVE:

I stripped everything back to a fresh installation of spacemacs, and here is the version info evaluated in the *scratch* buffer:

(emacs-version)
"GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
 of 2016-09-17"

(org-version)
"9.0.5"

0.200.9@25.1.1 (spacemacs)

and added

  (org-babel-do-load-languages
   'org-babel-load-languages
   '( (emacs-lisp  . t)
      ))

I also changed

'(safe-local-variable-values (quote ((org-confirm-babel-evaluate))))

into this

 '(safe-local-variable-values))

in an attempt to get anything at all to work.  It doesn't matter what the value of that expression is, I get the same negative results, with no clues about what to do to fix it.

I have copied the whole .spacemacs here.

I tried to run the emacs-lisp code block that looks like this

#+BEGIN_SRC emacs-lisp :results output :exports both
    (princ (concat (format "Emacs version: %s\n" (emacs-version))
                   (format "org version: %s\n" (org-version))))

#+END_SRC

and made sure that the prevention codes are commented out

# By default I do not want that source code blocks are evaluated on export. Usually
# I want to evaluate them interactively and retain the original results.
# #+PROPERTY: header-args :eval never-export

* COMMENT babel settings
# Local variables:
# org-confirm-babel-evaluate: nil
# End:

I copied the entire org-mode file here.

No matter what I do, I get

Evaluation of this emacs-lisp code block is disabled.


texts: How to force 'Ctrl-X, Ctrl-B' to always split vertically?

texts:
Once upon a time, Choose Window (invoked by C-x C-b) used to always split the window vertically.

Starting from a certain Emacs version (I can't recall which one), that split is now either vertical or horizontal, depending on the containing windows aspect ratio.

Is there a way to force C-x C-b to always split vertically?


texts: quickly duplicate line and increase number for lots of lines

texts:
I have a file like this:

1 = "go 1"
2 = "go 2"
3 = "go 3"

I want duplicate the last line and increase both numbers. The needed amount of lines is very high (approximately 90), so I want to automate a little.

The result should look like that:

1 = "go 1"
2 = "go 2"
3 = "go 3"
4 = "go 4"
5 = "go 5"
6 = "go 6"

[...]

88 = "go 88"
89 = "go 89"
90 = "go 90"

How can I achieve this?


texts: How can I have multiple *Help* buffers with different content?

texts:
Using C-h f and C-h v shows usefull help. Sometimes I want to compare information.  So it would be useful to have more than one *Help* buffer, with different content, visible at the same time.

But always when using the shortcuts the content of the *Help* buffer gets overwritten.

How to have more than one help (*Help*) buffer open at the same time?


texts: `htmlize` not taking CIDER font-locking into account

texts:
I'm using htmlize to give Org-mode code blocks syntax highlighting when exported as HTML, but the exported code only captures some of the font-locking.

In particular, for Clojure, it does not capture the extra font-locking from CIDER.

In my init.el, I have:

(with-eval-after-load 'clojure-mode
  (add-hook 'clojure-mode-hook #'cider-mode))

So when I have a CIDER connection open, all clojure-mode buffers should be getting CIDER font-locking.

When CIDER is off, I see:

When CIDER is on, I see:

But either way, the exported HTML only contains font-locking for the off case:

(when-let [s (seq coll)]
  (if (chunked-seq? s)
    (let [c (chunk-first s)
(when-let [s (seq coll)]
  (if (chunked-seq? s)
    (let [c (chunk-first s)
          size (int (count c))
          b (chunk-buffer size)]
      (dotimes [i size]
          (chunk-append b (f (.nth c i))))
      (dotimes [i size]

Why is this? I assume htmlize works by creating a clojure-mode buffer, then converting the font-locking to CSS properties, in which case it should capture CIDER's font-locking.


texts:
I have been having a problem where I want an up-sexp command that treats paired delimiters like $ in LaTeX-mode just as if they were pairs of balanced parentheses. There are hacks I can use that get me some useful information, but I'd much rather use a built-in command, if one exists.

My problem is that functions like syntax-ppss don't care about paired delimiters: for example (nth 0 syntax-ppss) returns 0 if I'm in paired delimiters but no parentheses, and there's no special part of the list for paired delimiters like there is for strings. Is there any standard way to get this information?

sp-up-sexp and similar commands don't help me, because they also ignore paired delimiters.

Of course, I can write a function to do something like count $s in my buffer up to the point, but the problem with this approach is that, for example, $$ is a separate paired delimiter in LaTeX. It's not a practical problem for me because I never use that notation (it's deprecated and very much not recommended), but I want to get this information from a syntax parser that understands the whole syntax table, not from a hack.


texts: How do I open an sqlite database from elisp?

texts:
I have a filepath for a sqlite database.  I want to open an sql client buffer.  I would like to know the best way to open that database from elisp. So far I can see that sql-sqlite will open it but it requires an interaction.

I'm calling (sql-sqlite "/path/to/some/database") and it then prompts me in the minibuffer to confirm the path before opening the database.  I can see from the docs that this is an interactive function.  Is there a non-interactive way to do this?


texts: Is it possible to create a way to toggle showing/hiding/changing text following a pattern? (org-mode or generally)

texts:
I'd like to create a way to toggle showing/hiding/changing text following a pattern in org-mode, but if it works generally, that's fine also.

A few examples of where this might be useful.

Hiding #+TITLE: and just leaving the actual title text in a larger font, or if there is no title text specified after the space, showing instead the text Insert Title Here:____. (the latter is an example of changing the text).
Hiding #OPTIONS:.* completely (would use other font changes to indicate heading).
Removing all headline *'s (simply having headlines in larger fonts), etc.
Highlighting text with a special character (e.g. @foo@ to highlight "foo").

Obviously, the underlying goal is to make a very clean org-mode environment for writing, but which you can easily toggle on and off to update the "metadata" and formatting info (perhaps just temporarily by entering shift-select-mode, but that's for another day!).

Based off of this answer: How to make my own org-mode text emphasis work again?, I am able to do some of this, but there isn't a clear way to toggle this on and off within a session without at least reloading org-mode (which loses lots of editor state). E.g.:

(defun org-add-my-extra-fonts ()
  (add-to-list 'org-font-lock-extra-keywords '("[^@\\w]\\(@\\)\\([^@\n\r\t]+\\)\\(@\\)[^@\\w]" (1 '(face irrelevant-face invisible t)) (2 'my-highlight-face t) (3 '(face irrelevant-face invisible t))) t))

(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-fonts)

So how can you bind this sort of behavior to a minor-mode in a way that plays nice with org? (assuming it's possible)

EDIT: I am not asking for how to do any of these individual things. I'm giving examples of where it is useful. I am asking for how to do the general thing of creating invisible/modified text in a way that can be toggled on and off. The ways I know how do this, as shown above, cannot be toggled. I provided the code above as a starting point, since that was where I got stuck (it doesn't appear toggle-able), and it might useful for those trying to help.

It's possible that org-font-lock-set-keywords-hook can somehow be toggled within a session without reloading org or other side effects, and would address all of these scenarios, in which case, showing how to do that would be a great answer!


texts: Dired: use dimmed face for file details (permissions, ownership, etc.)?

texts:
I'd like to customize dired so the non-filename details (permissions, ownership, etc.) are slightly dimmed, putting visual emphasis on the filenames themselves. I like having the details present (I know about dired-hide-details-mode), just not so prominent.

There are faces that dired uses to distinguish marked files, executables, directories, etc. but I don't see any I could use to distinguish the filename from its metadata. There is a dired-filename text property on the filenames, so maybe I could leverage that somehow, I'm not sure...

Is there a reasonable way to achieve this, or should I just move on to more important things?


texts: I'd like to set up agenda views with some logic. So example Todo state is NEXT with no schedule date. Can someone point me to some resources to make sense of this ?


texts: How do I prevent extremely long lines making Emacs slow?

texts:
I see hugely varied performance depending on how many newlines there are in the file I'm visiting.

Here's an example. I have two JSON files:

$ wget https://github.com/Wilfred/ReVo-utilities/blob/a4bdc40dd2656c496defc461fc19c403c8306d9f/revo-export/dictionary.json?raw=true -O one_line.json
$ python -m json.tool <one_line.json >pretty_printed.json

These are two JSON files with the same content. one_line.json is 18MiB of JSON without any newlines. pretty_printed.json has newlines and whitespace added, making it 41MiB.

However, the bigger file split over many lines is much faster to open in Emacs, both in Javascript mode and Fundamental mode.

Why does Emacs have such poor performance with long lines, since it's actually fewer bytes? Is there anything I can do to improve performance without reformatting the data outside of Emacs?


texts:
When using dynamic completion, rectangle-mark-mode is broken, in so far as C-w no longer respects just killing the rectangle but instead kills the usual full (non-rectangular) region.

M-w on the other hand works, because it is the original function, while C-w is overloaded with completion-kill-region.

To test: try C-w after C-x SPC once bound to kill-region and once bound to completion-kill-region (or simply M-x the two functions with an active rectangular region).

I have "fixed" it in my init.el in the following hackish way

(add-hook 'rectangle-mark-mode-hook
      (lambda ()
        (if rectangle-mark-mode ;; entering...
            (if (not dynamic-completion-mode)
                (setq restore--dyncomplete nil)
              (setq restore--dyncomplete t)
              (dynamic-completion-mode -1))
          ;; ...else leaving
          (if restore--dyncomplete
              (dynamic-completion-mode t)))))

What would be the right way to do it? Who to reach to have this fixed upstream? In the file it only says emacs-devel as the maintainer...


texts: How to delete numerals of a certain size from text

texts:
I'm pretty new to emacs, so I'm still learning all the functions.

I'm trying to remove certain metadata from each line of several large .txt files (Bible translations) and was wondering if if there was a way to search for and delete numerals above a certain value or to delete a specific column (the 4th) separated by TAB characters.

BOOK <TAB> CHAPTER# <TAB> VERSE# <TAB> VERSE-ID# <TAB> TEXT

The 4th field is a universal verse number starting at "10" and increases sequentially by 10s, so it becomes quite large - far larger than any other numeral in the file, which would otherwise be less than 300.

An example of what I'd like to do would be changing this:

PSALMS  150 5       164000  Praise him upon the loud cymbals: praise him upon the high sounding cymbals.
PSALMS  150 6       164010  Let every thing that hath breath praise the LORD. Praise ye the LORD.

to this:

PSALMS  150 5   Praise him upon the loud cymbals: praise him upon the high sounding cymbals.
PSALMS  150 6   Let every thing that hath breath praise the LORD. Praise ye the LORD.

The files also are divided into books by org-mode headings:

* THE NEW TESTAMENT
** The GOSPEL According to Matthew
MATTHEW 1   1       231460  The book of the generation of Jesus Christ, the son of David, the son of Abraham.

I suppose a delete-by-column function would have to be iterated, but that's not an issue for me as I can easily whip up a macro. Messing up the formatting (i.e. leaving an empty field) should be easy enough for me to clean up, so simply either deleting the column or an arbitrarily large numeral is acceptable.


texts: Smarter behaviour for "rename-uniquely"?

texts:
I am starting to use "rename-uniquely" for help buffers so I can see multiple function helps at the same time.

However, what I get is:

 *Help*
 *Help*<2>
 *Help*<3>

etc

What I would like is:

 *Help*
 *Help*<f>-<compilation-find-file>
 *Help*<v>-<compilation-search-path>

Does something similar exist?
Is there an easy way to get properties from the help buffer?  I am thinking the symbol that was requested, and the symbol type would be most useful.


texts: Why is this function not working properly, when added to a hook?

texts:
Situation
I would like to have a function, that when called, creates a new file/buffer in a specific directory, indepent of the current directory.
But with the same file name as the current file that the buffer is visiting.
So I created the following:
(defun change-to-foobar-directory ()
    (interactive)
    (setq buffer-temp-name (buffer-name))
    (kill-this-buffer)
    (find-file (concat "C:\\foobar\\" buffer-temp-name)))

This works great.
When I have the buffer foobar.el in directory C:\another-dir, and I call change-to-foobar-directory, then I get the buffer
C:\foobar\foobar.el. The difference is that I'm editing a buffer in another directory (C:\foobar).
Problem
This solution works great so far. When I add that function to a hook, for example:
(add-hook 'emacs-lisp-mode-hook 'change-to-foobar-directory)

And when I'm in the file another-file.c, I create a new buffer foobar.el with the Evil command :e foobar.el (which stands for edit the file foobar.el in the same directory of buffer, even when the file doesn't exist yet, then a new buffer will be created).
Because the emacs.lisp-mode gets activated, the function change-to-foobar-directory should be called.
But I get the same file another-file.c instead editing the file/buffer C:\foobar\foorbar.el. So it seems with the hook, change-to-foobar-directory will not work properly. I'm not sure what caused this. When I call that command interactively, it will work properly.
Any idea what caused this?


texts: How to move spacemacs neotree window position to the right?

texts:
I'm transitioning from emacs to spacemacs. In emacs I use neotree to have a nice sidebar where I can explore my files. I like it on the right side, so inside my custom-set-variables within my init file is:

'(neo-window-position (quote right))

which works perfectly.

BUT, with spacemacs things are different. I wrote that line inside my dotspacemacs/user-config() and nothing happens, when I hit SPC f t neotree still appears on the left side.

Can you help me to get it shown on the right? It's almost the only thing I need to feel comfortable working with spacemacs.

Thank you so much. :)


texts: Avoiding screen flickering when one theme is disabled and another enabled (inhibit redraw???)

texts:
Is it possible to temporarily disable buffer (and frame) redraws? I particuarly mean situation, when I disable some theme and enable another one, and would like to avoid a moment when emacs flashes with white background.

Illustration

To prepare, load any two dark themes in any way you like. For example eval the following snippet (I use twilight and molokai but any dark themes will do):

(load-theme 'twilight 't 't)
(load-theme 'molokai 't 't)
(enable-theme 'twilight)

Then simulate actual problem: try eval-ing that:

(disable-theme 'twilight)
(enable-theme 'molokai)

at least in my case Emacs redraws itself in white before picking new colors, what causes unpleasant screen flash. Before you ask: reversing the order (enabling new before disabling old) does not help, in fact it sometimes flashes twice.

Solution???

I look for tricks like

(let ((inhibit-something-to-keep-emacs-from-repainting))
   (disable-theme 'twilight)
   (enable-theme 'molokai))

or maybe for another way to reload themes.

PS inhibit-redisplay, whatever it is, does not seem to help.


texts: use native commands when emacs keystroke is not found

texts:
Using Emacs for Mac OSX

When I used Emacs on Ubuntu, if I used a keystroke that my Emacs did not define, it would bubble up to the operating system and execute the OS native command.

On OSX, it'll simply say "command not defined" even though I want to execute the Mac command. For example, if I customize option-f to open Firefox, and I un-define it on Emacs, I still cannot use option-f as intended because Emacs will simply complain "meta - f" not defined.

How can I accomplish this?


texts: How to force new `shell` to appear in current window?

texts:
Whenever I run M-x shell, a buffer appears almost randomly somewhere - splitting current windows as it sees fit. I cannot work out the logic behind it.
The docstring says:

(shell &optional BUFFER)
If BUFFER exists but shell process is not running, make new shell.
If BUFFER exists and shell process is running, just switch to BUFFER.

This just tells me it will open a shell if it already exists, otherwise start a new one.
I only care about the position of the buffer. If I have the window configuration set how I need it, running shell usually ruins that setup.
I did look into the source as far as I could, but am not familiar enough with the underlying eLisp.

I would like to have a function that splits the current window, opens a shell buffer - I perform some short operation - then I can close the newly created window, restoring the previous window configuration exactly as it was.
I have this working for eshell, which I stole from Howard Abrams. It looks like this:
(defun eshell-here ()
  "Opens up a new shell in the directory associated with the
current buffer's file. The eshell is renamed to match that
directory to make multiple eshell windows easier."
  (interactive)
  (let* ((parent (if (buffer-file-name)
                     (file-name-directory (buffer-file-name))
                   default-directory))
         (height (/ (window-total-height) 3))
         (name   (car (last (split-string parent "/" t)))))
    (split-window-vertically (- height))
    (other-window 1)
    (eshell "new")
    (rename-buffer (concat "*eshell: " name "*"))

    (insert (concat "ls"))
    (eshell-send-input)))

And the function to close the new buffer:
(defun eshell-close ()
  "Closes the window created by the function 'eshell-here'"
  (interactive)
  (insert "exit")
  (eshell-send-input)
  (delete-window))

I first tried simply putting replacing eshell with shell, but that led to the random buffer positions.


texts: colemak user :: spacemacs  key-chord f d [hit f then d really fast]

texts:
Following https://stackoverflow.com/questions/127591/using-caps-lock-as-esc-in-mac-os-x I remapped caps lock (51) to esc (53).

I think it was actually esc + :
(: is shift-; on qwerty but shift-p on colemak)

As a vim user,

I always hit caps lock to exit insert or append mode.

Save was caps lock w return

I would like  to send fd to exit from append or insert mode in evil-spacemacs.

Can you tell me what to stick in .spacemacs user-config or in a private layer.el to make this happen?

linked question - Recreating .vimrc in spacemacs more Vim Emulation
Why isn't there a nice webpage explaining how to rebind evil for all the vim to spacemacs migratory birds?


texts: Emacs flycheck add include directory, no flycheck-gcc-*

texts:
emacs version:

  GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of
  2014-03-07 on lamiak, modified by Debian

M-x flycheck version:

  Flycheck version: 0.25alpha (package: 20150821.47)

M-x flycheck-verify-setup:

  Syntax checkers for buffer file.c in c-mode:

  c/c++-clang
      - predicate:  nil
      - executable: Not found

  c/c++-gcc
      - predicate:  t
      - executable: Found at /usr/bin/gcc

  c/c++-cppcheck
      - predicate:  t
      - executable: Found at /usr/bin/cppcheck

  Flycheck Mode is enabled.

M-x flycheck-gcc-include

  [NO MATCH]

How can I enable flycheck-gcc-* commands to define inc dirs?


texts: Disable all keymaps for a specified buffer?

texts:
I am creating a new, special kind of buffer that I am using to display messages. I want to disable all keymaps within this new buffer.

This special buffer could be created at any time, and therefore, I don't know which keymaps may or may not currently active at the time of this buffer's creation.

Is there any way to disable each and every active keymap for a given buffer?

Thanks in advance.


texts: Is it a default keybinding to insert #+BEGIN_SRC [...] #+END_SRC?

texts:
I've searched the manual and I didn't find anything useful. It's annoying to write every time the tags to surround the code, and I'm surprised that org doesn't provide a macro to avoid a so boring task.

Any clue?
Thanks in advance.


texts: Exist an ob-erlang for src code block on org mode

texts:
I'm looking for an ob-erlang library in order to execute erlang in source code blocks in org-mode; I looked on
the language table, googled and on github and I didn't fin anything for erlang.

I know there is distel and edtgs for interacting with erlang. and also elixir has an ob-elixir. So maybe it should not be so difficult to write one for erlang. Models exist but exists any how to in order to write ob-anylanguage?


texts:
When looking at 'Face attributes' in emacs you have keywords like :family, :height, :weight etc.

When using use-package you have keywords like :ensure, :init, :config etc.

What are the terms for describing these symbols where you have a colon prepended to a name?
Where in info can I find out more? Please use the format: (info "(manual)DOCUMENT NODE") which can be searched for by using M-: e.g. (info "(elisp)Lisp Data Types")


texts: How to do a search that matches all todo's except a specific one?

texts:
I want to find all todo's except type TASK without having to list all the other types.

I tried the following but no luck:

(setq org-agenda-custom-commands '( ("h" "Everything not a task"
 ( (todo "-TASK")))))

Gives an empty list.

(setq org-agenda-custom-commands '( ("h" "Everything not a task"
 ( (todo ".*|-TASK")))))

Gives me everything, also TASK

(setq org-agenda-custom-commands '( ("h" "Everything not a task"
 ( (todo "TODO|-TASK")))))

Gives me all TODO, and not TASK but I don't want to also maintain the list of types here.


texts: How should I disable variable font sizes globally

texts: I'm aware of several answers regarding font sizes for org or auctex. However, is there a way to require all faces have the default font size for all modes? I'm new to emacs and currently using spacemacs. I'm happy with whatever solutions works, but I'd prefer a solution that only involves editing .spacemacsas I'm reluctant to poke around in other config files.


texts: Generate dynamic keybindings depending on keyboard layout

texts:
This is a bit of an esoteric request so I will try to phrase it clearly.

I am currently beginning to learn colemak and doing so through a series of transitional layouts that go by the group name of tarmak. On top of that, I use evil-mode so the spacial relationship between different keybindings is important. Since these tarmak layouts are only temporary, It would be nice to not have to rebind everything repeatedly as I get gradually closer and closer to full colemak.

Is there a emacs package or snippet of code that can remap keys depending on the current keyboard layout of the computer such that the spacial position of keybindings does not change?


texts: LSP sometimes working with Metals, sometimes spamming "the request has been cancelled"

texts:
I have Spacemacs configured to use Metals as an LSP backend for Scala development, i.e. my dotspacemacs-configuration-layers includes:

     (scala :variables
            scala-backend 'scala-metals
            scala-enable-eldoc t
            scala-use-unicode-arrows t
            scala-auto-start-backend t)

Sometimes I open a file, and everything works well. I get a rich development experience backed by whatever capabilities Metals exposes via LSP. Other times I open it up and it seems that nothing is working, and in the *Messages* buffer I see the likes of:

LSP :: Connected to [metals:38879 status:starting].
LSP :: metals:38879 initialized successfully
LSP :: The request (id: 2, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 4, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 6, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 9, method: 'textDocument/hover') has been cancelled
LSP :: The request (id: 11, method: 'textDocument/hover') has been cancelled

As I navigate around the Scala file, that message just spams again and again.

I'm on a Mac running Metals 0.8.0 (though this was also happening on the previous version) with Bloop 1.4.0-RC1 running as a service install installed by brew services start scalacenter/bloop/bloop. I've tried restarting Bloop and it doesn't fix it. I also haven't been able to figure out why it sometimes works, and other times does not.

Of course it is acceptable for requests to get occasionally cancelled, but this seems to be in some genuinely dysfunctional state. When things are working, the Scala experience in Spacemacs is good, but I would like to get that more consistently. How can I get that consistent experience?


texts: Disable '+' markup in org-mode on a by-file basis

texts:
How do you escape the + to not mean strikethrough in a single file?
  For example, when typing

  use += 1 instead of ++

how can this not-be-strikethrough'ed?

Escaping the + with \ as in \+ works well, but it is not by-file.


texts:
Emacs 26.1
I use ido mode with same.

It is work nice.
But I need ido interactively autocomplete for :

bookmarks
shell history commands

Is it possible?


texts: ivy preview buffer without buffer creation

texts:
When searching in a project using a counsel-ag, I want to implement a preview, similar to the counsel-grep.
Now I use copy-paste from counsel-ag with

:update-fn (lambda ()
            (counsel-grep-action (ivy-state-current ivy-last)))

But it opens too much buffers when I navigate in result buffer.
How I can implement result preview without opening buffer? I don't need to have buffer with result if it does not exists or before I open result manually.


texts: Org-Mode Archiving: Create containing headings

texts:
I've started using org-mode and am now at the point where I really need archiving. However, I often have sub-projects which are hard to understand without the containing project (i.e., the ancestors in the tree).

Is it possible to archive a subtree while creating the super-tree (if it does not exist yet)?

Concrete example. Say my gtd.org file looks like this:

* Private
** TODO Organize all my Todos
[…]

* Work
[…]
** TODO Awesome Project
*** DONE Organize all my Todos
**** DONE Do X
**** DONE Do Y
*** TODO Get Work Done

And my gtd.org_archive file is empty. Now, when I archive the "DONE Organize all my Todos" task, this is what I want my archive file to look like:

* Work
** Awesome Project
*** DONE Organize all my Todos
**** DONE Do X
**** DONE Do Y

Obviously, when later archiving other stuff, it should figure out whether the containing tree must be created or is already there. E.g., if I later set the "Get Work Done" to DONE and archive it, this is how the archive should look like:

* Work
** Awesome Project
*** DONE Organize all my Todos
**** DONE Do X
**** DONE Do Y
*** DONE Get Work Done

It should not create a new * Work / ** Awesome Project tree. However, when I later archive the "Organize all my Todos" under "Private", it should not be mixed up with the one under work, but look like this:

* Private
** DONE Organize all my Todos

* Work
** Awesome Project
*** DONE Organize all my Todos
**** DONE Do X
**** DONE Do Y
*** DONE Get Work Done

Is there any way of achieving this using org-mode?

Thanks in advance.


texts: Is it possible to force `markdown-mode` during git commit?

texts:
I was using following answer: https://emacs.stackexchange.com/a/57535/18414 to set markdown on the .git/COMMIT_EDITMSG file.
(add-to-list 'auto-mode-alist
             '("/\\.git/COMMIT_EDITMSG\\'" . markdown-mode))

My .gitconfig file, to open commit message with emacs:
[core]
    editor = TERM=xterm-256color emacsclient -t -q

On my emacs-daemon magit-git was enable.
Now during the commit (due to some squash operations in git), I see the commit messag along with the opened magit-diff: window.
Example image:

When I check the major-mode it became Local in buffer COMMIT_EDITMSG; global value is fundamental-mode.
Afterwards, when I added into COMMIT_EDITMSG file and do C-s C-x, commit fails and I get following message:
fatal: could not read commit message: No such file or directory
But instead if I re-enable markdown-mode, save and exit there would be no error.
[Q] Is it possible to force markdown-mode during git commit?


texts: Is there any way of disabling AUCTeX from auto-promping for optional overlay options in a Beamer document? I use global overlay options, and the prompting for local ones can be annoying when writing long documents.


texts: Make customize save lists newline separated

texts:
When saving changes using customize Emacs serializes lists space separated. This makes for example the package-selected-packages variable extremely long and hard to scan over.
Is it possible to make Emacs serialize lists more like it does with alists (like package-archives below)? That is, one element per line?
Basically, I want this:
;;;; Custom mode ;;;;
(custom-set-variables
 …
 '(package-archives
   '(("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "http://melpa.org/packages/")
     ("melpa-stable" . "http://stable.melpa.org/packages/")))
 '(package-quickstart t)
 '(package-selected-packages '(ace-jump-mode add-node-modules-path  …  yaml-mode yatemplate))
 '(projectile-keymap-prefix "p")
 …
)

… to turn into this:
;;;; Custom mode ;;;;
(custom-set-variables
 …
 '(package-archives
   '(("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "http://melpa.org/packages/")
     ("melpa-stable" . "http://stable.melpa.org/packages/")))
 '(package-quickstart t)
 '(package-selected-packages
   '(ace-jump-mode
     add-node-modules-path
     …
     yaml-mode
     yatemplate))
 '(projectile-keymap-prefix "p")
 …
)


texts: What's eshell's syntax for command substitution?

texts:
for pid in $(ps -ef | grep "chrome" | awk '{print $2}'); do kill -9 $pid; done

Invalid read syntax: ")"

What's the right way to run this script in Eshell?


texts: How to truncate buffer information in helm list

texts:
When I have a lot of buffers open and I use helm-mini to look through them, I notice that deeply-nested or tramp buffers take up too much horizontal space, causing them to wrap around, like this:

How can I get helm to truncate these lines so they don't wrap around? Toggling truncate-lines when the helm buffer is open doesn't take effect.


texts: How can I see a mini-picture or icon of the email sender in the headers view and email view in mu4e? Is there an easy way to achieve this using, say org-contacts?


texts: prog-mode-hook not recognizing .ex files in user-config

texts:
I'm trying to display prettify-symbols-mode to display for certain characters. I would like for this minor mode to be enabled across all programming languages - thus prog-mode. When I navigate to a .ex file it is not giving me the expected outcome (ie. => should display as ⇒). Code is below:

(defun dotspacemacs/user-config ()

      (exec-path-from-shell-initialize)

      (setq powerline-default-separator 'arrow)

      (defun mix-format-on-save ()
        (when (eq major-mode 'elixir-mode)
          (elixir-format)))

      ;; display full buffer path in title window

      ;;(setq frame-title-format
      ;;      (list (format "%s %%S: %%j " (system-name))
      ;;            '(buffer-file-name "%f" (dired-directory dired-directory "%b"))))

      (global-prettify-symbols-mode 0)
      (setq prettify-symbols-unprettify-at-point t)

      (setq prettify-symbols-alist
            '(
              ("lambda" . 955) ; λ
              ("->" . 8594)    ; →
              ("<-" . 8592)
              ("=>" . 8658)    ; ⇒
              ("<=" . 8656)
              ("|>" . 10503)
              ))

      (add-hook 'prog-mode-hook 'prettify-symbols-mode)
    )


texts:
Premise: I am not an expert of emacs-lisp, unfortunately.

I am handling all my emails with mu4e, and since it integrates well with org-contacts, I use the latter to handle my address book. However, I have not yet figured out how to handle mailing lists with org-contacts. I know I can use aliases :

    (setq mail-personal-alias-file (expand-file-name "/path/email-aliases.txt"))

but I find this rather unsatisfying. Is there any other way to specify a mailing list in org-contacts to use in mu4e? I am pretty sure someone has already cooked up a solution for himself, but could not find anything on the web.


texts: How to avoid window scrolling after completion list shows up in company-mode?

texts:
When I'm editing a file, if the completion list shows up, the text in the current window will always jump (sometime it will jump a few lines but mostly it will jump to the top of the window), after finishing typing or selecting the right candidate, it will jump back the original place, I got a gif to show what I mean.

NOTE: this problem cannot be replicated very easily, even by myself, even in the same file. But when I'm editing a source code file or org file, this happens a lot, it's really annoying.

I don't know if it is caused by company itself or not but it only happens in company completion list.

This is my company configuration:

(autoload 'company "company" t)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-global-modes t)
(setq company-tooltip-limit 30)
(setq company-minimum-prefix-length 3)
(setq company-show-numbers t)
(setq company-dabbrev-other-buffers t)
(setq company-transformers '(company-sort-by-occurrence))
(global-set-key (kbd "C-c <tab>") 'company-files)
(defalias 'ci 'company-ispell)
(add-hook 'org-mode-hook
          (lambda ()
            (company-mode)
            (set (make-local-variable 'company-backends)
                 '((
                    company-dabbrev
                    company-dabbrev-code
                    company-ispell
                    company-files
                    company-yasnippet)))))

Since the gif is about org-mode, so the last part(company-backends) of my configuration snippet here is about org-mode-hook

Update:

After analyzing my whole init.el, this problem is caused by sublimity, already posted an issue.


texts: How to hide frame environment in outline minor mode?

texts:
I am using AUCTex and outline-minor-mode to produce Latex presentations with beamer. I wonder how I could tell the outline-minor-mode to hide the content of a frame.  I am not into LISP by now, so this answer here might already give a hint to the answer, but I don't know how.

So my question is, how can I get outline-minor-mode -- may be even with a shortcut -- to change

\begin{frame}{frametitle_A}
   a lot of cool stuff
\end{frame}

\begin{frame}{frametitle_B}
   a lot of other cool stuff
\end{frame}

into

\begin{frame}{frametitle_A}...

\begin{frame}{frametitle_B}...

and vice versa?
S


texts: Prompt for command to reset variable to 1 or any other number

texts:
I have a command that semi-automates the insertion of numbered chapter headings in an org-mode file.

(defun reset-counter ()
  (interactive)
  (setq n 1))

(defun insert-numbered-chapter-headings ()
  "Insert **** 第x章 at cursor point."
  (interactive)
  (insert (format "**** 第%s章"
          n))
  (setq n (+ n 1)))

(define-key org-mode-map (kbd "<S-return>") 'insert-numbered-chapter-headings)
(define-key org-mode-map (kbd "C-c C-x r") 'reset-counter)

Currently, reset-counter just sets variable n back to 1.

How do I modify the function so that I can be prompted to enter any number other than 1, with 1 as the default when left blank?

(message "String is %s" (read-char "Enter number:")


texts: I use imenu in auctex. For beamer slides, it only offers me the \section-commands as entry points. How can I teach imenu to also offer all frames? (Which is an environment: \begin{frame}....\end{frame}?


texts: Org-ellipsis displayed inorrectly for some headlines only

texts:
So in order to customize my org mode files, I have

(setq org-ellipsis "⤵")

in my config, which seems to be a very popular customization (the arrow being U+2935). This works correctly for the most part. In some cases, the ellipsis character is displayed as a block as if I don't have the proper Unicode fonts set up; only I do because some headlines have the ellipsis displayed properly. Here's an example:

I tried to set up utf-8 encoding for my files according to this answer but it didn't help. I'm new to emacs so I don't even know how to go about debugging this issue.

EDIT

I forgot to mention that I noticed this behavior consistently on Debian Linux, Arch Linux and Mac OS X.

EDIT 2 (another symptom)

I have discovered the difference between the headlines that display properly and the ones that don't. It is so seemingly insignificant that I ignored it earlier. It seems any headlines that have a blank line before the start of the next headline cause the ellipsis to display improperly.
So for example in:

* Headline 1
  Contents

* Headline 2
  More contents
* Headline 3
  Last contents

The ellipsis for headlines 2 and 3 (when folded) displays correctly but a block is shown for headline 1. If I remove the blank line between headlines 1 and 2, the ellipsis for headline 1 is displayed correctly as well. What is going on here?

EDIT 3

If I remove the customization, the default ellipsis is displayed correctly for all headlines.


texts: orgmode - avoid duplicate tags in agenda view (inheritance)

texts:
Is there a way to avoid having tags of headlines show up twice in the agenda view, If they are inherited, as well as set for a specific headline?

e.g.:

* heading 1                :tag1:
** TODO heading 2          :tag1:

shows up in my agenda as:

TODO heading 2       :tag1::tag1:

I am specifically looking for a solution, which doesn't remove inheritance of tags from heading 1 , or from :tag1: itself, because I'd like for the inheritance to work for subheadings which do not carry the tag on their own.

Thanks for the help!


texts: how to add new UTF-8 words to Hunspell's user custom dictionary?

texts:
How do I set up Hunspell so that I can add new UTF-8 words (e.g. "Rúdi") to my user local dictionary?

I have a function that allows me to add new words to my local dictionary. It works for adding new words that don't contain UTF-8 characters. But if a word contains a UTF-8 character, Flyspell doesn't remember that the newly added word is correctly spelled.

Here's my setup:

(executable-find "hunspell")
(setq-default ispell-program-name "hunspell")
(setq ispell-really-hunspell t)
(setq flyspell-default-dictionary "en_US")

(setq ispell-dictionary "en_US")
(setq ispell-program-name "/usr/local/bin/hunspell")
(setenv "DICTIONARY" "en_US")

(setq ispell-program-name "hunspell")
(eval-after-load "ispell"
  '(progn (defun ispell-get-coding-system () 'utf-8)))

(setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))

(setq ispell-extra-args '("-d en_US"))

(flyspell-mode-on)

(defun add-word-to-personal-dictionary ()
  (interactive)
  (let ((current-location (point))
        (word (flyspell-get-word)))
    (when (consp word)
      (flyspell-do-correct 'save nil (car word) current-location (cadr word) (caddr word) current-location))))

If it matters, I'm running Hunspell 1.3.3 on OSX Yosemite.


texts:
Is there a good robust method to draw with colors in artist-mode or a similar mode?  By this I mean setting the foreground and background faces to colors such as red, green, blue, etc. for individual "pixels" (characters) when drawing with the mouse or programmatically.

I've concluded it's not supported out of the box as the only notion of "color" in artist.el corresponds to character weight (M is "darker" than -) and there is no mention of faces.  Since artist-mode relies on characters rather than strings (artist-fill-char-set, artist-line-char, etc.), the user can't propertize with a face.

My experiments adding face properties to inserted characters (in artist-replace-char and artist-replace-chars) are somewhat successful.  Before I dig into fixing the hygiene of inserted character faces I want to check be sure that I'm not duplicating existing work!


texts:
I'd like to always display one particular text file named "table.txt" in a monospaced font, while displaying all the other buffers in a variable-width font. How can I achieve this?

Edit: the suggested link doesn't have the code block solution in the answer below, and the code block seems to work best for this purpose (always displaying a particular buffer in some face), so I don't think this counts as a duplicate?


texts: How to commit a single staged file in magit?

texts:
When I type c-c (type c twice) in staged files, it will commit all the staged files, however i only want to commit a single file of the staged files.
How to do it? Thx.


texts: PHP no highlighting in org-mode code structure

texts: How I can turn on highilighting php code in org-mode structure block?


texts: How to make quick-calc output a result rounded with just 1 digit precision—1/7 = 0.1, not 0.142857142857?

texts:
The title basically already says it all. Just one addition. I need quick-calc to act like that for just 2 times a week. Usually I prefer the standard 12 digit precision.

I know how to achieve this format in org mode spreadsheets:
Simply attach ;%.1f at the end of a formula below the spreadsheet, and the result will be reformated to 1 decimal. But I really don't want to convert my whole calculation into an org mode spreadsheet just to get this one part of it rounded to 1 decimal.

I've searched GNU manual & searched with web search engine—in vein.

I've tried C-u 1 M-x quick-calc, but the result had the usual 12 digit precision.
C-u M-x quick-calc and C-u C-u M-x quick-calc also don't do the trick.
Inspired by GNU manual I looked shortly into calc mode, not quick-calc, although that's really not with what I want to work. I did so just to get some clues for how to achieve 1 digit rounded output format in quick-calc. In calc-mode I pressed p 1, but that just caused a prompt telling me that the digit precision must be at least 3.


texts:
I'm switching from vim and so far everything is going smoothly. One thing I'm sorely missing is ctrlp's functionality for opening the selected file in a horizontal split with C-x or vertical split with C-v. What's more, I was able to select multiple files with C-z and then use one of the aforementioned bindings to open them all in horizontal or vertical splits. It really defined my flow.

So to make it clearer, I would trigger ctrlp with ,f, type a short pattern, highlight the appropriate file, then press C-x to open it in a new horizontal split window.

I've scoured helm's documentation for something relevant to this but the only thing I found was some hint that it may be possible to select multiple files and do something with them, but I'm not sure if one of those actions could be opening the file(s) in a split. I imagine it would be something relevant to helm-find-files and the other similar commands, since those deal with files and not just general narrowing like helm-M-x.

Usually I just need to open a single file in a horizontal split, so if the "mark multiple for opening in their own splits" functionality is missing I won't mind too much.

However, it seems like I'm expected to first create the split, switch to the new window, then run helm so that the opened file populates that window. This is much slower for me in an environment that already feels slower to operate to me compared to vim, though I've been making progress on other fronts.

Is there any way at all that this may be possible? In the worst case, would it be possible to hack this on using the 'advice' functionality that I've heard about? I'd prefer not to hack on helm's source itself if possible, since I don't want to deal with the maintenance burden of doing that. If helm isn't capable of doing this, is there another package that offers similar narrowing functionality for finding files and buffers that does support this?


texts: Prevent mouse-3 on mode-line from closing the window

texts:
From https://www.gnu.org/software/emacs/manual/html_node/emacs/Mode-Line-Mouse.html :

  mouse-3 on a mode line deletes the window it belongs to. If the frame has only one window, it does nothing.

I want to disable this behavior. How do I do it?


texts: Apply different function to each element in list?

texts:
I have a time-stamp of a video formatted as "00:00:00,000" such that "%H:%M:%s,%3N".

I am want to eventually use this timestamp as part of an in-interval-p function where I take two timestamps and a current timestamp and check if I'm currently between the two. The best idea I have is to convert these timestamps to cumulative seconds.

I'm not sure if this is the best way to do it, but here is what I currently have

(require 'dash)
(require 's)

(defvar time-stamp "00:00:52,010")

(s-split "[:|,]" time-stamp)
;; ("00" "00" "52" "010")

What I would like to do, but not sure how, is something like

(map '((lambda (x) (* x 3600.0))
       (lambda (x) (* x 60.0))
       (lambda (x) (x))
       (lambda (x) (/ (float x) 1000.0)))
  (s-split "[:|,]" time-stamp))

;; (0.0 0.0 52 0.01)

Is it possible to apply a different function at each index of a list? I would then sum the list to get 52.01 seconds.


texts: Is there an equivalent for defparameter on emacs-lisp?

texts:
I know we have defvar and setq. defvar has a special meaning on defining global variables because the assignment only happens once. So I was thinking about use setq to get the desired behavior of defparameter from Common Lisp. However when I use setq without defvar (as replacement) I got a warning: reference to free-variable.

I saw on the table of hyperpolyglot lisp global-var section which relates defparameter with setq and set, so seems this is common. But I'm still wondering about the warnings...

There is another alternative to declare global variables as defparameter does? (declare and can change calling again)


texts: How can I make python3 the default in Emacs 25.2.1?

texts:
I do have python3 on my laptop.
$ sudo find / -name "python3" | python3-locations.org

(partial list of locations)

/usr/local/bin/python3
/usr/lib/python3
/usr/share/doc/python3
/usr/share/lintian/overrides/python3
/usr/share/bash-completion/completions/python3
/usr/share/python3
/usr/bin/python3
/etc/python3

When I
$ emacs 25.2.1
C-x C-f foo.py

apparently I enter major mode Python
C-c C-p ; start interpreter

I get:
Python 2.7.15+ (default, Nov 27 2018, 23:36:35)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded
>>>

Process Python finished
Python 2.7.15+ (default, Nov 27 2018, 23:36:35)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded
>>>

I expect that I need to add some expression in .emacs.d/init.el.
I have done some research into this, and found a recommendation to add this expression
(add-hook 'python-mode-hook #'(lambda () (setq py-python-command "python3")))

to that file. I restarted emecs with no errors, but I still get Python2.7.
What can I do?


texts: How to see *Messages* buffer in Spacemacs?

texts:
How to see *Messages* buffer as advised in this answer - https://emacs.stackexchange.com/a/32069/23367?

Why do I need this?

I am new to Spacemacs and I am trying to understand how it can help me writing Ansible roles and testing them. I found Ansible layer, added ansible to dotspacemacs-configuration-layers and restarted Spacemacs. Still I have no idea how to use that. SPC m h a doesn't work - resulting in SPC m is undefined. Spacemacs shows /YAML\ at the bottom near the filename. I don't see that Spacemacs detected YAML file as an Ansible playbook - I don't get any hints or errors displayed on the screen. Perhaps I need to change mode from YAML to Ansible somehow, but first I need to check if there are any errors why loading the layer for Ansible.


texts:
I use company for completion, and it's fast and efficient in OCaml, Tuareg, and Merlin.

However, it is very slow in my C project.  For example, it takes more than 10 seconds when it suggests completions for structure, during which I cannot do anything in Emacs.

An example of structure I use in my project :

typedef struct {
  char name[D_NAME_MAXLEN];      /**< name of the disk */
  uint32_t size;   /**< size of the disk */
  uint32_t npart;   /**< number of partitions */
  uint32_t part[D_PARTMAX];    /**< parition sizes */
} d_stat;

Then I have a d_stat pointer caled d_stat and after typing typing dstat-> it stops for a looong long time, even sometimes it bugs...

Same thing with the macros, I have some macros :

OPT_SIZE
OPT_LONG_SIZE
OPT_FORCE
OPT_LONG_FORCE
OPT_NAME
OPT_LONG_NAME
etc...

And when I type OPT_ it stops like above.

How can I speed up company completion when it gets this slow?  Right now, it is not usable.

I'm using (global-company-mode) in my init file.

tree of the project looks like :

syscp
├── bin
│   ├── disk.tfs
│   ├── libll.so
│   ├── libtfs.so
│   ├── tfs_analyze
│   ├── tfs_create
│   ├── tfs_format
│   └── tfs_partition
├── dev
│   └── device.tfs
├── disk.tfs
├── doc
│   └── config
├── ld
├── lib
│   ├── block0.h
│   ├── block.c
│   ├── block.h
│   ├── error.c
│   ├── error.h
│   ├── ll.c
│   ├── ll.h
│   ├── tfs.c
│   ├── tfs.h
│   ├── utils.c
│   └── utils.h
├── Makefile
├── obj
│   ├── block.o
│   ├── error.o
│   ├── libblock.o
│   ├── liberror.o
│   ├── libll.o
│   ├── libtfs.o
│   ├── ll.o
│   └── utils.o
├── README
├── setup.sh
└── src
    ├── default.h
    ├── tfs_analyze.c
    ├── tfs_create.c
    ├── tfs_format.c
    └── tfs_partition.c

7 directories, 39 files


texts:
Post title: Unwanted escape sequences in shell mode that are NOT due to colorizing-attempts
(see update below)

Any idea what can cause (unwanted) escape sequences to continue showing up in the Emacs shell prompt (i.e., M-x shell) despite:

(i) removing all color-related sequences from prompt definitions in the appropriate config files and

(ii) including the following in my init.el file:

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

For example, this is what my shell prompt looks like (in Emacs)...

^[[J%

...but this is how  I've defined the prompt in my .zshrc file (I could be wrong but I suspect the issue is shell agnostic, i.e., I don't think it's specific to zsh).

PROMPT='%% '

Similarly, this is what my GHCi interpreter prompt (i.e., Haskell REPL) looks like:

^[[?1h^[=λ:

...when this is the definition I've included in the ghci.conf file:

:set prompt "λ: "

Running Emacs 24.4 on Lubuntu 14.04 with zsh as default shell.  (All zsh features are working correctly in Emacs; this seems like a cosmetic issue.)

UPDATE: Solved
Shoddy attention to detail on my part; the following line in my .zshrc profile was responsible:

export TERM=xterm-256color


texts: What does "Making browse-url-browser-function local to *eww* while let-bound!" mean?

texts:
I am using SLIME (which includes hyperspec.el). I wanted to view the HyperSpec using Emacs' EWW instead of the desktop web browser (e.g. Firefox, Chromium, etc.). To do this, I added an advice to set the web browser to EWW for looking at the HyperSpec:
(advice-add 'hyperspec-lookup
            :around
            (lambda (orig-fun &rest args)
              (let ((browse-url-browser-function 'eww-browse-url))
                (apply orig-fun args))))

However, I always get the following message in the *Messages* buffer the first time I use hyperspec-lookup after starting Emacs.
Making browse-url-browser-function local to *eww* while let-bound!

Is this an error message? What does it mean? How do I fix it?


texts: Add additional function to cua-mode processing for `C-c`

texts:
I'm running cua-mode, and I'm trying to override the cua binding for C-c so that I can insert a function somefunc before passing the baton to the original cua binding which is cua-prefix-override-handler.

However, I find I can't override the original cua binding.  (And even if could, I'm still not sure it would work because cua-prefix-override-handler appears to be a tricky function based on timing in a loop.)

;; .emacs
...
(cua-mode t)
...
(defun somefunc--cua ()
  "Run `some-command' and `some-other-command' in sequence."
  (interactive)
  (somefunc))
  (cua-prefix-override-handler))

;; THIS FAILS TO OVERRIDE CUA BINDING FOR C-c
(global-set-key (kbd "C-c") 'somefunc--cua)

How can I achieve the desired effect of insert an extra function somefunct and then continuing on with the cua processing?

(Background information about the motivation for this question is here.)


texts: In Spacemacs, how can I enable snippets without having an autocomplete popup/completion?

texts:
I'm using the auto-completion layer in Spacemacs with the following configuration:

(auto-completion :variables
                 auto-completion-return-key-behavior nil
                 auto-completion-tab-key-behavior nil
                 auto-completion-complete-with-key-sequence nil)

I'd like to not have auto-completion at all and instead just have snippets. Is there a way to disable the popup and in-place completion that comes with the layer while keeping snippets? Examples of the popup and the completion follow.

It may not be clear from the completion pic but the "ass" part is added by the auto-completion layer.


texts: Disabling/ignoring GCC/Clang error in Flycheck

texts:
There is already a question on this but it's unanswered.

I'm writing a C++ header file that requires libxml, as seen below

#include <libxml2/libxml/xpath.h>

However Flycheck sees this as an error and consequently ignores any other potential error in the file.

In include /usr/include/libxml2/libxml/xpath.h (c/c++-gcc)

How do I disable this error in Flycheck or at least configure it to recognize the rest of the errors in the file?

Here's my code:

#ifndef PATH_T_HPP
#define PATH_T_HPP

#include <string>
#include <libxml2/libxml/xpath.h>

namespace tw_lmm
{

  class path_t
  {
  public:
    /* Constructors */
    explicit path_t(const xmlKey*); // path only
    explicit path_t(const xmlKey*, const xmlKey*); // path, name
    explicit path_t(const xmkKey*, const xmkKey*, const xmkKey*); // path, name, extension

    explicit path_t(const path_t&);

    inline path_t operator=(const std::string&); // path only

    /* Destructors */
    virtual ~path_t();

    /* Getters */
    const inline std::string& path() const;
    const inline std::string& name() const;

  protected:
    std::string __path, __name, __extension;

  };

  const inline std::string& path_t::path() const
  {
    return __path;
  }

}

#endif

Note I misspelt xmlKey by writing xmkKey, Flycheck doesn't seem to recognise this.


texts: How to get kill-buffer-hook to detach a screen session prior to kill-buffer?

texts:
I keep many screen session running in the backgroud, which I access with M-x eshell-command "screen -r <myscreen>".  Before I kill the *screen* buffer, I have to detach the session with C-a d.  It would be nice to have that integrated into kill-buffer via kill-buffer-hook, but I don't know how because the *screen* buffer is read-only, so insert doesn't work.

My non-working idea is:

(add-hook `term-mode-hook (add-hook 'kill-buffer-hook (insert (kbd "C-a d"))))

What's the proper elisp command to send control-sequence inputs to a terminal via a hook?


texts: Cannot connect to WSL using Tramp (all localhost)

texts:
this is my %USERPROFILE%\.ssh\config
Host wsl
 User daniele
 Port 2222
 HostName localhost

If I open a cmd and run ssh wsl everything works like a charm.
But when I try:
C-x C-f /ssh[x]:daniele@localhost#2222:

I get in return:
ssh -l daniele -p 2222 -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none                         localhost && exit || exit
Pseudo-terminal will not be allocated because stdin is not a terminal.
getsockname failed: Not a socket
packet_write_poll: Connection to UNKNOWN port -1: Permission denied

What's wrong?
Thanks in advance.


texts: Why does hook to set up C++ mode indentation not work?

texts:
This is my code

(defun my/set-c-mode ()
 (local-set-key (kbd "C-c C-c") 'compile)
 (setq compilation-finish-function 'compilation-exit-autoclose-clone)
 (setq c-default-style "linux")
 (setq c-indent-level 8)
 (setq c-brace-imaginary-offset 0)
 (setq c-brace-offset -8)
 (setq c-argdecl-indent 8)
 (setq c-label-offset -8)
 (setq c-continued-statement-offset 8))
(add-hook 'c++-mode-hook      'my/set-c-mode)

Yet it does not indent correctly. This should give me the linux style indentation, but what I get is this:

/* File: ast.cc
 *

 ------------
 */

#include "ast.h"
#include "ast_type.h"
#include "ast_decl.h"
#include <string.h> // strdup
#include <stdio.h>  // printf

Node::Node(yyltype loc) {
  location = new yyltype(loc);
  parent = NULL;
}

Node::Node() {
  location = NULL;
  parent = NULL;
}

Identifier::Identifier(yyltype loc, const char *n) : Node(loc) {
  name = strdup(n);
}

Any Idea why?


texts: Disable package refreshing when starting emacs

texts:
I have bad internet connection. Starting spacemacs takes a long time because of the "refreshing package archive melpa or gnu or others...".  or "installing package: ...".
When i put the computer on plane mode and start emacs this is not a problem since the actions are not executed. Nevertheless, when I forget to do so and the internet connection is bad emacs enters in a sort of "crashing state" trying to refresh or install the packages.
Is there a way to stop packages from automatically refreshing and installing on emacs start up?
Thanks in advanced.


texts: debug-ignored-errors --> suppress an annoying error/false-positives

texts:
In my emacs, i have set (debug-on-error t) to see the error's stacktrace. It is very helpful but for mundane errors, it becomes annoying...
One such error is,

Debugger entered--Lisp error: (error "Command attempted to use minibuffer while in minibuffer")
  read-from-minibuffer("Goto line: " nil nil nil nil ("1"))

Emacs has provided a way to suppress backtrace prints on such errors using the variable, debug-ignored-errors. It takes a list of error codes. Say for the error that the variable has no value - the code is '(void-variable).

Where do i find the error codes for all the other stacktrace messages?


texts: SMIE default syntax : First level of indentation

texts:
When you only do that in your major mode :

(require 'smie)
(smie-setup nil #'ignore)

That means SMIE but no grammar, and no rules. And it's great. It makes the point stay on col0 when you TAB and there's nothing on the line, it makes indentation basically sane and logic for a c-like major mode derived from fundamental-mode.

Except for this weird detail : The first indentation level is messed up :

plop = {
    plop;
        plop;
        plop;
        plop;
}

Is that a bug? It looks like a bug. And if it's not, how can I make it so that :

plop = {
    plop;
    plop;
    plop;
    plop;
}


texts: How to disable copy on selection with evil-mode (Mac/24.4)?

texts:
This only occurs when I turn evil-mode on!

Whenever I make a selection, either through evil or the mouse, the selection gets automatically copied into the clipboard. I have set

(setq select-active-regions nil)
(setq mouse-drag-copy-region nil)
(setq x-select-enable-primary nil)

but that doesn't seem to do anything.

Any help? Please?

Edit: I am using the GUI version of the the build found at emacsformacosx.com


texts: Can I read a macOS Extended Journaled Encrypted USB flash using Emacs 27 Dired?

texts:
Is there a way to browse a flash USB drive formatted in Mac OS Extended (Journaled, Encrypted) using Emacs 27 Dired?
After I Enter a password to unlock the disk “XYZ”. I can browse the folders and the files just fine using Finder, but I prefer to operate with Emacs rather than Finder.
When I try to look (through Emacs Dired-mode) at the Volume, I get Listing directory failed but ‘access-file’ worked.
I am the owner of the volume:
drwxrwxr-x   7 calaf    staff  306 Nov 18 12:14 XYZ

and so this does not seem to be a case of dr-xr-xr-x permissions (where the files are readable if their names and paths are, but a directory listing isn't).
Edit
This appears to be not related to the disk formatting, but to whether a folder is backed up to iCloud.
It also appears to be related to a recent upgrade to Catalina, rather than to Emacs 27 (or, for that matter, to using sudo port install gnupg2 rather than port install gnupg for Emacs ps-ccrypt). But I don't have either Desktop or Documents connected to iCloud, and yet the same issue arises with both.
Can you clarify what this is all about?


texts: Is there a way to speed up a speed of scrolling in pdf-tools (PDFView), or remove a delay when the scrolling button is continuously pressed?


texts: Highlight text based on condition on consecutive lines

texts:
How can we visually add separators in log files, based on conditions between consecutive lines?

Sample log file:

[DEBUG][2016-05-26 10:24:51,714][FileHelper] - [realContextPath]
[DEBUG][2016-05-26 10:24:52,369][DbConnectionImpl] - [DELETE FROM xct_log]
[DEBUG][2016-05-26 10:24:56,925][DSRestrictionConverter] - [parseRestrict]
[DEBUG][2016-05-26 10:24:56,976][DbConnectionImpl] - [UPDATE hd_log]

The goal is to have a visual separator when there is more than 2 seconds between consecutive timestamps. In the above case, it'd be between the 2nd and the 3rd line.

To make that separator visible, we could use overline or underline properties, for example. No need to physically add something to the buffer...

(This is a slightly rewritten version of question Format SQL code, with a MUCH better title.)


texts:
I am trying to setup emacs as server so that emacs (same instance) can be invoked from a file browser like nautilus

Results not satisfactory

Attempt 1

I have the foll. in ~/.local/share/applications/emacs.desktop

[Desktop Entry]
Name=EmacsClient
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;

Exec=emacsclient -n -a emacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

Along with (server-start) in my init

When I try that I get two icons for emacs in ubuntu launcher -- one is 'fake' ie it does not respond to click

So

Attempt 2

emacs started with --daemon
emacs.desktop as earlier described

However now closing a window with the 'X' does not prompt to save files
Nor at system shutdown time

Attempt 3

Following https://stackoverflow.com/questions/1167484/how-to-gracefully-shutdown-emacs-daemon

tried adding this to my init

 (defun shutdown-emacs-server () (interactive)
   (when (not (eq window-system 'x))
   (message "Initializing x windows system.")
   (x-initialize-window-system)
   (when (not x-display-name) (setq x-display-name (getenv "DISPLAY")))
   (select-frame (make-frame-on-display x-display-name '((window-system . x)))))
 (let ((last-nonmenu-event nil)(window-system "x"))(save-buffers-kill-emacs)))

And then an explicit shutdown command needs to be issued:

$ emacsclient -e '(shutdown-emacs-server)'

But this is unreliable -- sometimes it pops up the save dialog, sometimes not

So any suggestions on how to use emacs as a server?

[Ubuntu xenial running unity]


texts: Emacs newbie here using spacemacs. How to avoid entering visual mode when clicking a link while using evil? This is particularly problematic in org-mode.


texts: What coding system should I use for one Emacs configurations for both unix and Windows?

texts: I set the coding as utf-8, and I got many ^M from eshell on Windows. There's utf-8-dos and utf-8-unix. I would like to use the same configuration file on both unix and Windows. I guess there are many people work on the two system from time to time. How do you handle this?


texts: List all lines containing the word under the cursor in helm

texts: Helm is very powerful, how to implement the feature to create a helm list/buffer to highlight all the lines containing the word currently under the cursor?


texts: `eval-after-load` gets executed, but syntax-table is missing

texts:
In the course of using Emacs I got a dozen of lines that simply make underscore part of a word, and most of them upon byte-compilation are causing warnings like reference to free variable ‘php-mode-syntax-table’.

I asked on IRC how to deal with that, and it seems the most optimal way is to use eval-after-load to modify the syntax table. So I made up the code below:

(eval-after-load 'text-mode
  '(modify-syntax-entry ?_ "w" text-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'rust-mode
  '(modify-syntax-entry ?_ "w" rust-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'cc-mode
  '(modify-syntax-entry ?_ "w" c++-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'cc-mode
  '(modify-syntax-entry ?_ "w" c-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'python
  '(modify-syntax-entry ?_ "w" python-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'lisp-mode
  (modify-syntax-entry ?- "w" lisp-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'gud
  (modify-syntax-entry ?_ "w" gud-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'php-mode
  (modify-syntax-entry ?_ "w" php-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'haskell-mode
  (modify-syntax-entry ?_ "w" haskell-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'shell-mode
  (modify-syntax-entry ?_ "w")) ;; make underscore part of a word
(eval-after-load 'markdown-mode
  (modify-syntax-entry ?_ "w" markdown-mode-syntax-table)) ;; make underscore part of a word
(eval-after-load 'diff-mode
  (modify-syntax-entry ?_ "w" diff-mode-syntax-table)) ;; make underscore part of a word

For some reason, Emacs fails at runtime with error like

Warning (initialization): An error occurred while loading ‘/home/constantine/.emacs’:

Symbol's value as variable is void: php-mode-syntax-table

This error not only happens for php-mode, but also for gud-mode, haskell-mode. I can't understand what's causing it — if Emacs really loaded the file, it would clearly have the syntax table. What should I do?


texts: Possible to use grep in eshell without opening a *grep* buffer?

texts: When i use grep in eshell, like 'cat test.txt | grep test', grep opens it's own buffer with the result. Is it possible to capture the output of grep in the eshell buffer?


texts: More convenient auto-completion using ivy

texts:
I have the following lines in ~/.emacs:

(require 'counsel)
(with-eval-after-load 'org
  (define-key org-mode-map (kbd "C-c C-c") #'counsel-org-tag))
(with-eval-after-load 'org-agenda
  (define-key org-agenda-mode-map (kbd "C-c C-c") #'counsel-org-tag-agenda))

Now, C-c C-c provides ivy autocompletion. But the keys for selection are inconvenient C-M-m to select en entry and C-m to finalize the selection.

I would like to reassign TAB intsead of C-M-m to select an entry.

How do I do that?


texts: Limit number of files saved by emacs in desktop-save

texts:
I tend not to delete buffers in emacs, so over time, the number of buffers tends to grow to a hundred or more.  (At the moment, *Buffer List* has 144 lines.)

Many of these files are java files, and with my configuration, loading a Java file takes a second or two.  This means that starting emacs can take a few minutes.

Is there a way to limit the number of buffers that are saved by the desktop?  Ideally, I would like to drop buffers that I have not visited in a while.

I tried this:

(advice-add 'no-save-unseen-buffers :before-while 'desktop-save-buffer-p
              (lambda (buffer &optional rest)
                (let ((last-time (with-current-buffer buffer buffer-display-time)))
                  (when (and last-time
                             (< (time-to-seconds (time-subtract (current-time) last-time))
                                (* 2 7 24 60 60)))))))

but it does not seem to have an effect.

Advice on how to make the above code work, a completely different approach or package that does what I want are all fine answers.


texts: How to get auto-completion of Elisp function names?

texts:
I want to be able to get a drop-down list of partial matches to Elisp function names (installed or those already defined in the buffer) as shown in the
screen-shot below from the YouTube video: https://youtu.be/QaX3AaK3_Lk?t=332

How do I achieve this? Is there a standard library for this?


texts:
From some newer version of Emacs (I currently on 24.5.1) after some operation *vc-dir* buffer begin to show ignored files.

I specially craft .hgignore to make list of hg status short. But Emacs vc-mode doesn't respect my preference.

Is it possible to ignore ignored files?

To reproduce:

open *vc-dir*
modify file
undo changes on file from *vc-dir*
refresh *vc-dir* content

I made wrapper to diagnose problem:

#!/bin/sh
echo hg "$@" >> ~/tmp/hg.log
/usr/bin/hg "$@"

From above instruction steps I get log:

root       # here I press C-x v d
id -b
id -t
status -C ./   # below I edit and save file
hg --config alias.status=status --config defaults.status= status -A hg.rst
hg --config alias.status=status --config defaults.status= status -A hg.rst
hg parent --template {rev} hg.rst
hg --config alias.status=status --config defaults.status= status -A hg.rst
hg --config alias.status=status --config defaults.status= status -A hg.rst
hg diff hg.rst       # <== revert file in *vc-dir* by C-x v u
hg revert hg.rst
hg --config alias.status=status --config defaults.status= status -A hg.rst
hg root            # <== here I press g
hg id -b
hg id -t
hg status -C ./
hg status -mardui -C hg.rst ./

Last command include -i option which cause issue. Sources have:

$ grep -R -n mardu
lisp/vc/vc-hg.el:640:         (concat "-mardu" (if files "i"))

which is:

(defun vc-hg-dir-status-files (dir files update-function)
  (apply 'vc-hg-command (current-buffer) 'async dir "status"
         (concat "-mardu" (if files "i"))
         "-C" files)
  (vc-run-delayed
    (vc-hg-after-dir-status update-function)))

lisp/vc/vc.el state that:

;; - dir-status-files (dir files update-function)
;;   If FILES is non-nil, this function should report on all requested
;;   files, including up-to-date or ignored files.

UPDATE I open bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22003

I receive recommendation to type x to clear unnecessary entry.


texts: how to also export linked files in emacs org mode automatically?

texts:
If i have [[file:./test.org][test]] inside of example.org.

How can i achieve that i automatically export test.org to test.html, when i Export my Example.org to HTML?

Is there a Option i can enable to achieve this behavior?

I didn't find anything underneath Export-settings


texts:
I write academic articles with org mode. Sometimes I'd like to keep things clustered in no-op blocks, just so I can identify them later. An example would be reviewer comments or changes:

* Methods

We did a bit of this and that.

#+begin_revision
# Reviewer said our methods weren't clear enough
In this we collected data from N participants...
In that we analysed the data as described in X.
#+end_revision

I don't want drawers because I don't want to keep things hidden per default. I'd prefer to have a no-op block, whereby its content goes to export as if the block didn't exist at all. The advantage is that If I ever went back to the manuscript years later, I'd still have this "meta" block information in there.

I know I could use the :ignore: tag and have an extra heading, but I feel these comments don't really belong in the document hierarchy.

Are there NO-OP blocks? Or what would be the best way to implement them?


texts: What's the most concise way to make a hash table with data in it?

texts:
I'd like to create a hash table with data already in it. I know I can do so as follows:

(let ((my-table (make-hash-table)))
  (puthash 'k1 'v1 my-table)
  (puthash 'k2 'v2 my-table)
  (puthash 'k3 'v3 my-table)
  my-table)

But there's a lot of boilerplate here. Compare to creating the same table in, for example, Clojure:

{'k1 'v1 'k2 'v2 'k3 'v3}

Is there a more concise way to create a hash table with data in it?


texts: Dired; Is it possible, to show video duration as column in dired view?

texts:
i want to let dired show the duration of multimedia files as a column inside the dired buffer detail view.

Is it possible?
Any third-party extensions for dired?

Currently i use

exiftool -T -ImageSize -XResolution -YResolution -VideoFrameRate -AvgBitRate -Duration

as shell command run on marked files.
But this produce only output. I don't know how to insert this result as columns.


texts: How can I use magit to diff some text with my clipboard?

texts: I see others doing this in there IDEs is there a way to highlight a file or some text in a file and diff it with whats in my clipboard/kill-ring ?


texts: Autocompletion when creating Internal Links in Org-mode

texts:
In Org-mode, when creating internal links, we have to type full name of the section heading to which we want to link.

Is it possible that the heading name gets automatically filled in when we are creating a new internal link? When creating a new link, we type a few characters and headings matching the characters are shown, and then we can choose from the list.

Maybe some way using helm?