texts: How to change faces of org-mode links depending on the link type?

texts:
Org-mode offers a variety of different link types ([http], [file], [bibtex], [magit]...). However, they all get the same look defined by the face value for org-link.

Is it possible to e.g. change the background color depending on the type of link? So that http links would have a yellow background and file links a blue one?


texts:
I am using Emacs 25.1.1 with spacemacs. Everytime I run iESS, I get the warning about locale as,

During startup - Warning messages:
1: Setting LC_CTYPE failed, using "C"
2: Setting LC_COLLATE failed, using "C"
3: Setting LC_TIME failed, using "C"
4: Setting LC_MESSAGES failed, using "C"
5: Setting LC_MONETARY failed, using "C"

I have tried the solution from followings,

https://stackoverflow.com/questions/30264526/why-does-my-ess-r-session-fall-back-to-c-locale

https://stackoverflow.com/questions/9689104/installing-r-on-mac-warning-messages-setting-lc-ctype-failed-using-c

But the problem is still there. The strange this about this problem is that, when I run emacs with -nw switch (on terminal) I get no error, but when I open it with frame, I get the error.

Please help me with this!

My R session info when I run emacs with frame is,

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.3.2 tools_3.3.2

and in terminal without frame is,

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.3.2 tools_3.3.2


texts: How to debug / troubleshoot LSP "not in project or it is blacklisted." in lsp-mode?

texts:
Recently LSP has stopped working for me.

I'm getting this message for all files in my project.

LSP :: example_filename.c not in project or it is blacklisted.

How can I investigate this, if it's blacklisted, how can I reset the blacklist?


texts:
What I want is an easy-to-use hydra for macro execution.  Typically I execute a keyboard macro a few times (e), and then might want to repeat infinitely until the end of a buffer (u).  Sometimes I need to search forward or backward before continuing with keyboard macro execution.

What I have is a steaming pile of not-quite-working whats-it.

I have to use foreign-keys to search. This seems wrong.  Without foreign keys the searches don't accept any input.  Even with, if my search term contains a hydra key, then it does that instead.

I must be doing something wrong. Please help!

(defhydra hydra-keyboard-macros (:columns 6 :foreign-keys run)
  ("e" kmacro-end-or-call-macro-repeat "execute")
  ("u" (lambda()
         (interactive)
         (let ((current-prefix-arg 0))
           (call-interactively #'kmacro-end-or-call-macro)))
   "unlimited")
  ("s" isearch-forward-regexp "search")
  ("r" isearch-backward-regexp "reverse")
  ("'" edit-last-kbd-macro "edit")
  ("q" nil "quit"))

(global-set-key (kbd "C-x e") #'hydra-keyboard-macros/kmacro-end-or-call-macro-repeat)


texts: What would be the best way to configure Emacs to handle the above keybindings for vanilla Emacs? Specifically, I'd like to have SPC work as C-x and SPC SPC work as M-x.   I love Spacemacs for the bindings, but want to build up a vanilla install with a better understanding of the underpinnings.


texts: C-S-a doesn't select text to the line beginning

texts: The Key combination Ctrl + Shift + a doesn't work in my GUI-Emacs to select a region from the position of pointer to the line start. Doing C-h k and the above key combination shows no documentation.


texts: How to move multiple articles from one Gnus group to another?

texts: B m (gnus-summary-move-article) in Gnus summary mode allows to move an article from one group to another. But how do I move not a single, but tens or hundreds of articles from one group to another? Using keyboard macros seems unidiomatic and error-prone.


texts: How to set the mark using keybindings when C-SPC is unavailable to emacs

texts:
Suppose I have the following code block in an org file.

#+begin_src sql
SELECT id
FROM product
WHERE name = 'Apple'
#+end_src

I want to select this part:

SELECT id
FROM product
WHERE name = 'Apple'

I was taught to use C-SPC, but C-SPC was already used by my OS, is there any way to do this? For example, bind this function to another shortcut? By the way, I'm using spacemacs.


texts: How to make racket the default implementation for geiser mode

texts:
The geiser documentation suggests that setting geiser-default-implementation is one way to prevent run-geiser from prompting for a scheme implementation. Another approach suggested by the geiser docs is to set the geiser-implementations-alist to the following value:

(((regexp "\\.scm\\'") guile)
 ((regexp "\\.ss\\'") racket)
 ((regexp "\\.rkt\\'") racket))

In neither case do the docs give examples of how to set. I've tried various incantations involving setq, defcustom, etc., but I continue to be prompted for the desired scheme implementation whenever I run run-geiser. The alist doesn't even evaluate properly: for one thing, the regexp function seems not to exist; for another, I'm thinking some sort of quoting is needed to prevent errors on the undefined guile/racket symbols. Would be grateful if someone could give an example of exactly what would need to be added (e.g.) to .emacs in both cases.

Would also like to understand why something like...

(setq geiser-default-implementation 'racket)

...doesn't seem to work.


texts:
How to have two different headers for two different modes with header2?

For instance, to have a header like :

% ----------
% File-name :
% ----------

when I create a .el file and a header like :

# ----------
# Location :
# ----------

when I create a .R files.


texts: How to modify behavior of syntax highlighting without editing the original source?

texts:
There is a bug in C/C++ comment highlighting (bug 11865)

Where the fix appears to be to modify the value of c-font-lock-doc-comments

Is there a way to do this in my emacs config, instead of having to keep a modified version of the original emacs source?

In the patch makes this change:

- (c-font-lock-doc-comments "/**$" limit gtkdoc-font-lock-doc-comments)
+ (c-font-lock-doc-comments "/**([^*/].*)?$" limit gtkdoc-font-lock-doc-comments)

Is there a way to apply this change locally?


texts: How can I get files and links to open correctly in emacs?

texts:
This used to work, but since a recent update, it hasn't. I'm using spacemacs, with this configuration. Links and files don't open as usual. If I open ansi-term, and type xdg-open test.txt, then I see:

xdg-open: line 617: kde-open5: command not found.

Which makes sense, since I use GNOME, and not KDE. In a normal terminal (gnome-terminal), I don't have any $KDE_x variables, but in the emacs terminal, for some reason I have all kinds of variables set, like $KDE_FULL_SESSION=true. I thought this might be an issue with NixOS's packaging of emacs, but looking where the package is defined (I think), I don't see anything out of the ordinary.

Does anyone know what could be causing this, and/or how to fix it?


texts: How to open several shell buffers and rename them respectively?

texts:
I try to solve the problem like this in test.el:

(shell)
(rename-buffer "name1")
(shell)
(rename-buffer "name2")
(shell)
(rename-buffer "name3")

However, when I use (eval-buffer) to execute, it seems that the program stops at the 4th line and returns that

  Buffer name 'name1' is in use

I am not a pro of elisp, can't figure out what is happening here. Can any one help?


texts: What's the mode hook for dired's minibuffer?

texts: Starting dired with M-x dired and hitting M-x dired-create-directory I am now in a mini-buffer. Which mode-hook do I use to set a keybinding for the mini-buffer?


texts:
I tried to add this to my eslint global variable

"globals": {
    "document": false,
    "navigator": false,
    "window": false,
    "rndr": false,
    "shrd": false,
    "path": true,
    "$": false // <--- I also added this
}

but still I am getting undeclared variable or function.

Here is the flycheck verification.

But the error is still there.

Please, I need some guidance how to fix this.

Thanks


texts: How write begin_export html blocks in an inline fashion?

texts:
A code which takes up several lines of screen realestate can be written as

Inline code src_sh[:exports code]{echo -e "test"} foo

source: https://stackoverflow.com/a/16193498

Is is possible to write "inline", this kind of blocks:

https://stackoverflow.com/a/16193498

#+BEGIN_EXPORT html
the quick <b>brown</b> fox
#+END_EXPORT


texts:
Is there a way to get emacs with 256 colors in FbTerm?

I've seen some old posts on the topic but I haven't seen any confirmation that it will work.

EDIT:

If I start FbTerm with this command:

FBTERM=1 fbterm

... and with this in my .bashrc:

[ -n $FBTERM ] && export TERM=fbterm

(as described here)

... then I get 256 colors in fbterm (confirmed by running the perl script from here) but I still only get 8 colors in emacs.

In addition, I've tried this solution but with no succes.


texts: Retracing steps with emacs (When programming /exploring)

texts:
Often when fixing a bug or implementing a new feature in a code repository, I start off with an investigatory step.

For example, I would have a lead, a word such as "Article" and I would start by grepping the codebase for "Article".
Suppose there are 5 files that contain the word. I would open up one of these files with emacs. Reading the file, I would learn that the code in that file is just a "wrapper" function, and the real meat of the work happens in another place (the parent/caller function)
This step would repeat for about a dozen times until I found what I'm looking for. Sometimes I don't find what I'm looking for.
Sometimes on a 10 step exploration ( 10 files opened up consecutively)
I would decide to take 4 steps back, and branch off in another direction/idea.

Four days later I would be in the shower and have a thought flash, and
would want to revisit/retrace my steps but the emacs instance has long
been killed.

Is bookmarks.el the answer? Or are there better ways to wander down
rabbit holes with emacs.


texts: Can a transient suffix have a value like an infix?

texts: I'm writing a transient for invoking debchange. It has a number of regular options like --multimaint which I am adding infixes for, and then a handful of mutually exclusive options like --append of which one must be specified. I would like to make these suffixes without defining a whole pile of wrappers like (debchange-append); can I somehow give the suffix a value so that I can use the same (debchange-run) command for all of them?


texts: Organizing configuration for publishing images created via TikZ inline code

texts:
I use Emacs + org-mode to maintain my website.

Here some related parts of my configuration:

(defvar personal-website-remote-directory-prefix "/ssh:***:/srv/www/stefanorodighiero.net/")
(defun personal-website-remote-absolute-directory (directory)
  (concat personal-website-remote-directory-prefix directory))

(setq org-publish-project-alist
  `(
    ("website"
     :components ("website-pages" "website-images"))

    ("website-pages"
     :base-directory "/home/larsen/www/stefanorodighiero.net/"
     :base-extension "org"
     :exclude "posts"
     :publishing-function org-html-publish-to-html
     :publishing-directory ,(personal-website-remote-absolute-directory "/")
     :recursive t
     :html-preamble ,personal-website-navigation-header
     )

    ("website-images"
     :base-directory "/home/larsen/www/stefanorodighiero.net/images/"
     :base-extension "png\\|jpg\\|JPG\\|gif"
     :publishing-function org-publish-attachment
     :recursive t
     :publishing-directory ,(personal-website-remote-absolute-directory "images/")
     )

A couple of things in particular are important in the context of this
question:

website-pages is any org file that is found looking recursively in
my website directory tree. To publish them I use
org-html-publish-to-html
website-images have to in the images/ directory to be copied to the
production site. When I need to add a image in a page, I put the
file in images/, and I manually add a file:../images/... link in
the org file (with the appropriate number of ../ in front of it,
depending on where the org file is). This is not ideal but it worked
acceptably for the amount of content I produce.

Now, I'd like to use TikZ to produce graphics to be included in my pages.  After some experiments, I've settled on adding these instructions to the pages where I want to include inline TikZ snippets.

#+OPTIONS: tex:imagemagick
#+LaTeX_HEADER: \usepackage{tikz}

It works well when I ask a preview (C-c C-e h h): the image files
produced by TikZ + convert are put in the directory configured in
org-preview-latex-image-directory (default is ltximg, so a
relative path).

When I want to publish the page, on the other hand, the images
are ignored because they're not under images/, nor they are
org files to be considered for publication.

I could configure org-preview-latex-image-directory to put the
images in the images/ directory: I think publishing would work, but
local preview would not.

How could I organize the configuration to have automatic preview and
publication in my workflow?


texts: Obtain points at beginning/ending of visual line without using vertical-motion

texts:
Q:  How to obtain the points at the beginning and ending of each visual line of the current window -- without using vertical-motion -- when word-wrap is t (aka visual-line-mode).

For this experiment, I am using a few of the functions from the section of the manual entitled Accessing Mouse Events:  http://www.gnu.org/software/emacs/manual/html_node/elisp/Accessing-Mouse.html

BACKGROUND:  As we all know, vertical-motion is very costly in terms of time.  I have a custom minor-mode that is similar to vline.el -- http://www.emacswiki.org/emacs/vline.el -- except that mine works with word-wrap/visual-line-mode.  I am searching for a faster method to perform calculations each command loop.  At the present time, I make one pass of the current window (every command loop) using vertical-motion to obtain the following information:  point at beginning/ending of the whole line; point at the beginning/ending of the visual line; the visual column number at the end of the visual line (which may be different than the actual column number when a line is wrapped at the window edge); point at each location in a vertical line from the cursor position spanning from window-start to window-end; and, various other information based on all of the foregoing -- e.g., colors of foreground/background faces and character codes at the various locations, line numbers, etc.

  (setq word-wrap t)

(setq truncate-lines nil)

(progn
  (remove-overlays) ;; after-string properties prevent `posn-at-point` from working right.
  (let* (
      pt
      posn-at-x-y
      (counter 0)
      (window-height (window-height))
      (window-header-line-height (window-header-line-height))
      (frame-char-height (frame-char-height))
      (position (posn-at-point))
      (posn-x-y (nth 2 position))
      (posn-actual-col-row (nth 6 position)))
    (while (<= counter window-height)
      (unless
          (and
            (= counter 0)
            (= 0 window-header-line-height))
        (setq posn-at-x-y (posn-at-x-y (car posn-x-y) (* frame-char-height counter))))
      (setq pt (nth 1 posn-at-x-y))
      (setq counter (1+ counter))
      (message "counter: %s | %s" counter (if (integerp pt) (char-after pt) pt)))))


texts:
I've written a document in Org-mode but when exported it became like this:

In the image on top, I've inserted a \bullet but it wont show and the text is not alligned:
And in the image on bottom, the text is not aligned as body text, but as a list:

This is the code for the first image:

To calculate the probability its necessary to calculate the probability of C given positive test
- P(C | Positive) = P(C) \bullet P(Positive | C)
- P(\urcorner C | Positive) = P(\urcorner C) \bullet P(Positive | -C)

and for the second:

******* Summary

It is important to always test the data after the fitting to measure the accuracy of the predictions made by the program. At least 10% of the data should be saved to test. When telling anyone the result of the predictions, tell about the accuracy of the test data.


texts: Truncate lines at a specific visual column instead of truncating in the last visual column

texts:
How can I visually truncate the lines of a buffer at a specific column instead at the last column of the buffer?

Is this even possible in Emacs?

If, so, is it possible to also choose at which column the line starts, so that when I have a big Emacs window (let's say with 200 columns), the text occupies only the central (80 columns)?

EDIT: Error message with debug on after trying JEanPierre answer:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  +(4 nil 198)
  (- (+ cur-l cur-r cur-width) width)
  (let* ((cur-width (window-width)) (cur-m (window-margins)) (cur-l (if (and cur-m (car cur-m)) (car cur-m) 0)) (cur-r (if (and cur-m (car cur-m)) (cdr cur-m) 0)) (lr (- (+ cur-l cur-r cur-width) width)) (left (/ lr 2)) (right (if (= 0 (% lr 2)) left (1+ left)))) (set-window-margins nil (max left 0) (max right 0)))
  (if (= 0 width) (set-window-margins nil 0 0) (let* ((cur-width (window-width)) (cur-m (window-margins)) (cur-l (if (and cur-m (car cur-m)) (car cur-m) 0)) (cur-r (if (and cur-m (car cur-m)) (cdr cur-m) 0)) (lr (- (+ cur-l cur-r cur-width) width)) (left (/ lr 2)) (right (if (= 0 (% lr 2)) left (1+ left)))) (set-window-margins nil (max left 0) (max right 0))))
  my/change-window-width(80)
  call-interactively(my/change-window-width record nil)
  command-execute(my/change-window-width record)
  helm-M-x(nil "my/change-window-width")
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)


texts: Getting a dialogue box of custom scripts

texts:
I have a bunch of scripts for managing files/directories that I use on a regular basis. Would it be possible to assign a key binding such that whenever I hit this key binding I get a dialogue box that lists my scripts within emacs and I can choose one to execute on the fly?

This may be fairly obvious but I couldn't find anything about this online possibly because I do not know what the term to search for is.


texts: Adjusting to screen resolution changes on GNU/Linux/ubuntu/gnome

texts:
I'm running emacs 26.1 on ubuntu 18.04 on a Dell laptop with a high-resolution display.  It works very well in that configuration.  It also works very well when the laptop is plugged into a lower-resolution monitor.

What doesn't work is that when you attach or unplug the monitor, emacs does not adjust to the change in resolution.  So when emacs was started without the monitor attached, and then later the monitor gets attached, text is very large in its physical dimensions.  Going the other way, unplugging the monitor yields unreadably tiny text.

Other applications (e.g. firefox and gnome-terminal) don't suffer from this issue, presumably because they react to some signal from X or gnome and adjust to the change in resolution.

Is there any workaround for this problem other than restarting emacs?  If not, what work needs to be done to emacs to make this work better (bug references?)?


texts: Is it possible to add descriptions for the yas-choose-value choices?

texts:
I got a simple snippet for the opening a file in PHP:
fopen('${1:./filename.txt}', '${2:$$(yas-choose-value '("r" "w" "a" "x" "r+" "w+" "a+" "x+"))}') or die();

So when I get to the choose the file opening mode, r,w,a,x... I get the dropdown:
r
w
a
.

But I would like to add a description of whats the function of each mode, like:
r   - Open read only
w   - Open for write erases content
.
.

Is it possible to do this with yas-choose-value?


texts: Delete breakpoint set using edebug-defun

texts:
I set break-point in function

(add-hook 'c-mode-common-hook
      (function
       (lambda nil
         (if (or (string-match "llvm" buffer-file-name)
             (string-match "nvvm" buffer-file-name))
         (progn
           (c-set-style "llvm.org"))))))

I am unable to remove the break-point. This code fragment is in *scratch* buffer.


texts: Python docstrings only allow two indent levels

texts:
I am trying to write a docstring that follows Google's style guide such that it looks something like:

def testFunction(a, b):
    """
    Args:
        a (str):
        b (str):

    Returns:
        Description of return

I am doing this through a yasnippet following the accepted answer to this question, and everything works except for the indentation of the "return description" because my emacs isn't allowing an indentation beyond the first level within the docstring using TAB. Using indent within a lisp function gives the correct indentation (under Args:), but using TAB within the buffer (or in the snippet) does not. As such my docstring looks like:

def testFunction(a, b):
    """
    Args:
        a (str):
        b (str):

    Returns:
    Description of return

Any ideas to overcome the general problem of not being able to force another layer of indent within the docstring using TAB in python-mode?

I've tried making a barebones init.el to avoid loading anything that may create this behavior but still get the same issue. I am using emacs version 24.5.1, in case that provides any clues.


texts: .m file become read only when debugging in matlab-mode

texts:
Is it possible to add a hook or set a configuration variable such that the .m file I am debugging remains in edit mode when debugging starts. I don't want to switch out of read-only mode to interactively debug and code.
It seems this behavior is relatively new since older versions did not enforce this.


texts:
Org table vertical lines do not align properly with Chinese data.

| 標題一   | 標題二       | 標題三   |
|----------+--------------+----------|
| 中文圖表 | 直線會對不準 | 像這樣子 |
| 這       | 是不是       | 問題     |

| col1                      | col2                       | col3              |
|---------------------------+----------------------------+-------------------|
| this is a table           | there are few rows in here |                   |
| aligment is not a problem | at all                     | with english data |
|                           |                            |                   |

My version of org is 9.19.

POSSIBLE SOLUTIONS:

A possible solution is shared my coldnew over here. This re-adjusts font size system-wide so that one Chinese character corresponds to two ASCII letters.

;; Auto generated by cnfonts
;; <https://github.com/tumashu/cnfonts>
(set-face-attribute
 'default nil
 :font (font-spec :name "-*-Menlo-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1"
                  :weight 'normal
                  :slant 'normal
                  :size 20))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font
   (frame-parameter nil 'font)
   charset
   (font-spec :name "-*-STSong-normal-normal-normal-*-*-*-*-*-p-0-iso10646-1"
              :weight 'normal
              :slant 'normal
              :size 28.0)))

The above code is obtained from cnfonts after setting the relative font size for size 20 Menlo font.

Is there a way to make this apply only to the org-table face rather than globally?


texts: Multiple citations with just one pair of braces

texts:
I want to have multiple citations appear in my exported PDF as below:

some well-studied fact [12, 13, 20] blah blah

But the only way I know to do this is by using inline latex:

some well-studied fact \cite{foo2002, bar1997, baz2019}

Is there a way to achieve the same result using the more "org" style citation:

some well-studied fact [cite:foo2002, cite:bar1997, cite:baz2019]

Note: the above results in this export:

some well-studied fact [[1], [2], [3]]

...which I don't want.


texts: transparently find file over ssh in *shell* directory

texts: I ssh'd into a remote server from shell and tried to open a file on a directory path that also exists on my local system. The list of files I was able to open using helm-find-files was the list on my local machine, and not on the ssh'd system. How can I configure Emacs to be smart enough to provide me the list of files on the path for the remote server?


texts: I would like to add a shortcut to sp-wrap-square in spacemacs

texts:
I would like to extend the lisp editing shortcuts so SPC k [ and SPC k { would wrap the current form in [] and {} respectively.

I don't know what I need to write in my spacemacs config to enable this only for the lisp editing buffers.

What I did so far:

(spacemacs/set-leader-keys-for-major-mode 'clojure-mode "k [" 'sp-wrap-square)
(spacemacs/set-leader-keys-for-major-mode 'clojure-mode "k {" 'sp-wrap-curly)

But these add only in clojure mode and the shortcuts will be , k [ and , k { instead of the desired SPC k [ and SPC k {


texts:
I'm a bit confused because the I'm trying to configure org within spacemacs as advised in the official layer documentation for spacemacs), I should use      (with-eval-after-load 'org ( ... :

(defun dotspacemacs/user-config ()
  "Configuration function.
 This function is called at the very end of Spacemacs initialization after
layers configuration."
  ;; My keys
  (global-set-key [f2] 'deft)
  ;; My Notes
  (setq deft-directory "c:/Users/ZsBotykai/Dropbox/Notes/"
        deft-extensions '("org" "md" "txt")
        deft-use-filename-as-title t
        deft-text-mode 'org-mode)

  ;; ORG settings
  (with-eval-after-load 'org (
                              (setq org-agenda-files
                                    "c:/Users/USERNAME/Dropbox/Notes/"))
;; Further lines snipped...

I'm getting the following  error:

(Spacemacs) Error in dotspacemacs/user-config: Invalid function: (setq org-agenda-files "c:/Users/USERNAME/Dropbox/Notes/")

I did try to use

(with-eval-after-load 'org (
                            (setq org-agenda-files
                                  '("c:/Users/USERNAME/Dropbox/Notes/")))

Without any success. Could you point me into the right direction?


texts: setting comment face in major mode on multi-line word-delimited comments

texts:
I am working on a major mode for an input file format I am interested in and want to set multi-line comments with the delimiters skip and noskip like

skip larb noskip

or

skip
GRID
  TYPE structured
  NXYZ 284 307 1
END
noskip

Using the re-builder, I came upon the following regex that highlights both single and multi-line comments

"skip\\(.\\|\n\\)*?noskip"

But this doesn't work to pass to the font-lock-comment-face. Only the single-line version gets its font-locked.

Is there a mode with word-delimited multi-line comments like I  want, that I can borrow the right syntax from?


texts:
Let me define a keyboard-macro: I enter C-x (, then go to beginning with M-<, then type M-% to query-replace some occurrences of foo by bar. Out of 3 occurrences found, I replace only the last 2, then save with C-x C-s and finish the kbd-macro with C-x ). Well done!!

If I now run the kbd-macro on another buffer, it will not ask me whether I want to replace foo by bar, it will reproduce exactly my previous no-yes-yes answers and replace the 2nd and 3rd occurrences! It will not ask for the 4th or 5th occurrences (this 2nd buffer contains more foos)!! This is not what I expected when I defined the macro. I wanted it to call query-replace and let me answer its queries...

Aside question: Don't you find this wrong? [I can M-x edit-last-kbd-macro and see what is recorded and understand the logic of it all but I still find this wrong.]

Real question: What could I have used instead of query-replace to make my kbd-macro work as expected?


texts: Inconsistent behaviour with pretty outlines

texts:
SETUP:
My .emacs.d/init.el reduced to the minimum (I have auctex and use-package installed)
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives
             '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)

(use-package outline
  :hook (text-mode . outline-minor-mode)
  )

(use-package outshine
  :hook (outline-minor-mode . outshine-mode)
  )

(use-package pretty-outlines
  :defer t
  :load-path "custom/"
  :hook ((outline-mode . pretty-outlines-set-display-table)
         (outline-minor-mode . pretty-outlines-set-display-table)
         (LaTeX-mode . pretty-outlines-add-bullets)
         )
  )

pretty-outlines needs to be in .emacs.d/custom

PROBLEM:
If I have the following LaTeX file:
% * Test

% test

I get the correct display (don't mind the airplane, that's because I should tell my emacs what font to use for this range):

But if I uncomment the third line
% * Test

test

I can't figure out what's happening here, looks like there's something messing with some regexps but I really don't understand.


texts:
I am writing a translation and I have found myself translating the same words again and again. I would like to have a file where I could write all the common substitutions I am doing (and hopefully have the ability to add a new substitution rule easily). For example:

source code -> código fuente
computer -> ordenador
of the -> del
[...]

And to have a command which could allow me to lookup the current word under the cursor on this file and to substitute it if it was found.

It is important to notice that the word's context is irrelevant to me and that the substitution rules could affect more than one word.

How could I achieve this? Is there any built-in command or minor-mode doing exactly this?


texts: emacs-daemon opened buffers get affected by other buffers

texts:
I am using emacs-daemon. Lets say many files have already opened using emacsclient.

=> When I open a minibuffer on one emacs frame, all the opened emacsclient buffers get frozen and I cannot type any character into them.

Example:

I have single opened iTerm terminal and it is splitted into two panes. I am using specific keybinding to move in between each other. In both of emacsclient is opened that is connected into same emacs-daemon. Red-box shows the pane windows focus.

=> First I am typing bottom pane than press some keybinding to open the mini-buffer.

=> Later by pressing iTerm's keybinding I move into the upper pane and start typing world or press some emac's keybindings. Please note that I always forget to close the mini-buffer on the bottom pane. Hence nothing is typed on the upper pane.

=> Than I remember I have to close the mini-buffer. So I move into bottom pane and close the mini-buffer. Now I realize all the characters I have already typed is applied on the upper pane even keybindings. For example: world is already written. Or if I already pressed ctrl-k to delete line that is applied and so on.

[Q] Is there any way to prevent this issue? For example, can mini-buffer close itself if I switch into different pane inside iTerm? or at-least prevent typing on different buffers when the mini-buffer is closed?


texts: Function to toggle 'list-bookmark' in the style of Neotree or speedbar

texts:
I modified this function:

#+BEGIN_SRC emacs-lisp
  (defun toggle-bookmark-list ()
    "Toggles between bookmark list and current buffer "
    (interactive)
    (if (string= (buffer-name) "*Bookmark List*")
    (switch-to-buffer (other-buffer (current-buffer)))
      (if (get-buffer "*Bookmark List*")
      (switch-to-buffer "*Bookmark List*")
    (progn
      (list-bookmarks (getenv "Book Mark"))
      ))))
  (global-set-key (kbd "<f6>") 'toggle-bookmark-list)
#+END_SRC

When I press F6, it will open a list-bookmark buffer right where my current buffer is. I can then toggle it on and off. For example:
Original:

   | buffer 1 | buffer 2 |
   |          |          |
   |          |          |

After pressing F6:

   | list-bookmark | buffer 2 |
   |               |          |
   |               |          |

Is there a way to have it display on the side like Neotree, instead of replacing current buffer?
What I mean is:

Original:

   | buffer 1 | buffer 2 |
   |          |          |
   |          |          |

After pressing F6:

   | list-bookmark     | buffer 1 | buffer 2 |
   |                   |          |          |
   |                   |          |          |

So it would appear as a separate buffer and I can specify it to appear where I want (always on the left of buffer 1 in this case).


texts: How to have C-g *not* cancel emacsclient eval commands?

texts:
I'm sending some commands to my emacs using emacsclient --eval on a timer. The only problem with this is if at the time I happen to be using emacs and press C-g to cancel something, instead of canceling what I intended to cancel it will cancel the commands that emacsclient is sending, printing the message "Quit emacsclient request." I actually want to let the emacsclient code finish, and then have C-g cancel whatever I originally intended to cancel.

I thought I could wrap the commands I'm sending in (let ((inhibit-quit t)) ...). But it turns out if you look at the source for server-execute and server-eval-and-print that they override inhibit-quit, on the reasoning that emacsclient actions are usually instigated by the user and that must be what they want to have quit.

Ideally, I'd have two hotkeys, C-g for quitting my normal interactive stuff, and something else, say C-S-g for quitting emacsclient stuff (in case I accidentally send an infinite loop).

I know I could copy pasta the server-execute function and rip out the quit handling bit, but then I'd be left at the mercy of infinite loops when they do come up. Ideas?


texts: Multi-directory tab completion for find-file?

texts:
I am frequently diving through many layers of directory hierarchies (thanks, Java) to find files named like this…
java/test/com/company/thing/test/testy/testier/testier/Tester.java

The main issue that I have is that TAB-completion in find-file only completes one directory at a time, meaning that I may have to press TAB 5 times to get through the first few layers of the hierarchy, where each directory contains only one subdirectory and nothing more (e.g. com/ contains only company/, company/ contains only thing/), etc.
Is there any package that modifies TAB-completion with standard Emacs commands, including find-file, so that multiple directories will be "greedily" autocompleted when they contain only one subdirectory?
I'm aware of Projectile, and know that it has a similar feature, but I'm hoping to find something standalone and minimal that just solves this one issue.


texts:
I want to use evil mode with ggtags but evil mode keeps taking some of the bindings such as M-.. I'm new to emacs and I'm interested in learning what's going on. At first I tried explicitly setting the load order by using a lambda like this:

(add-hook 'prog-mode-hook
          '(lambda ()
             (evil-local-mode)

             (when (derived-mode-p 'c-mode 'c++-mode 'java-mode 'rust-mode)
               (ggtags-mode 1))))

I then saw evil-overriding-maps and evil-intercept-maps but using them seemed to have no effect:

(add-to-list 'evil-overriding-maps '(ggtags-mode-map . nil) t)
(add-to-list 'evil-intercept-maps '(ggtags-mode-map . nil) t)

I realize that I could just explicitly bind to 'ggtags-find-tag-dwim in one of the evil maps, but like I said I'm learning emacs and I'm wondering what's going on here and more importantly if there's a way to make it work without redoing all of the bindings that got clobbered. I figured using evil-overriding-maps should do the trick but it doesn't seem to be. I did check the value of the variable with C-h v and it did get added to that list.


texts:
Is there a hook which runs when the cursor position changes its current line numbers?

For a concrete toy problem, can i highlight the current line as yellow when the line number of the current cursor position is always a multiple of three.  e,g. when the cursor is on line 3 or 6 or 9, that line is highlighted as yellow. When the cursor moves to another line, the highlighted line gets unhighlighted.


texts: isearch but don't move the cursor until I ask to search

texts:
In a large file, I would isearch for the word byebug

but as soon as I type by, my cursor is moved to a line containing the word bystander.  (The file actually does not have the word byebug.)

But now
I'm a bit lost with my cursor at this random line. I didn't find what I was looking for (byebug), and I don't know how to get back to where I started searching.

This kinda sucks. Is there a way to either

a) tell search to not start until I've finished typing or

b) if I search moves my cursor to a partial match, how can I go back to where I was


texts: insert-image doesn't work in the org code block

texts:
I have an org file, which contains the following text:
#+begin_src elisp
(insert-image
     (create-image "/home/searene/Pictures/Selection_007.png"))
#+end_src

When I press C-c C-c to evaluate the code, I want the image to insert in the current file, but that's not the result. The result is just a t, as follows:
#+begin_src elisp
 (insert-image
     (create-image "/home/searene/Pictures/Selection_007.png"))
#+end_src

#+RESULTS:
: t

Why? How can I insert the image by executing the code?


texts:
I am new to emacs (long-time vim user). Specifically, I am using doom-emacs.
Doom is supposedly set up to use company-mode for auto completion, but I have not gotten it to work. I have the following source code:
class CompleteUserBankruptcyJob < ApplicationJob
  queue_as :default

  def perform(user)
    CompleteUserBankruptcy.call(user)
  end
end

If I type in def perfo, I would expect company to suggest perform. However, it does not suggest anything at all. If I manually trigger suggestions via C-SPC, it says "No completion found". Finally, if I run company-diag in the buffer, I get the following information:
Emacs 27.1 (x86_64-apple-darwin18.7.0) of 2020-08-12 on builder10-14.porkrind.org
Company 0.9.13

company-backends: (company-capf company-yasnippet)

Used backend: company-yasnippet
Major mode: ruby-mode
Prefix: nil
Completions: none

I have no idea how to debug further. If it is any help, I have my personal configuration files in this repo, but I have not modified any company-mode related settings, so it should all be using the default from doom-emacs, which for company I believe are located here. Finally, I believe that the list of backends is not being set correctly in ruby major mode (and may be failing in other modes as well), given the references to company in this file.


texts:
I'm trying to create a function that places/aligns/indents curly brackets according to Allman-style formatting (for coding in C).

Generally speaking, I am fan of Smartparens' interface available to users for customizing functionality.  I've written a bunch of other functions using the Smartparens interface so would have a strong preference not to switch packages at this point.  That said, I'm open to package-agnostic implementations (e.g., could defadvice be relevant here?).

On to the problem at hand.  What's the end goal?  Let's suppose we're coding and we reach the state represented below.  The pipe symbol represents the cursor; I've typed the function header and the opening brace {, and Smartparens has automatically added the closing brace  }.  At this point, I'd like it so that pressing RET...

int main {|}

...leads to the following:

int main
{
    |
}

I've been able to write the function that results in this behavior but it only works for the first level of indentation (e.g., for our main function in the example above).  I can't get it to work for subsequent levels of indentation (see gif):

The relevant code is below.  The function isn't pretty but I think it should work...  The very last line is the interface to Smartparens.

Any suggestions?

(defun my-create-newline-and-enter-sexp (&rest _ignored)
  "Open a new brace or bracket expression, with relevant newlines and indent. "
  (interactive)
  (progn
    (backward-char 2) (newline) (forward-char) (newline)
    (indent-according-to-mode)
    (previous-line 2) (indent-according-to-mode)
    (next-line) (next-line) (indent-according-to-mode)))

(sp-local-pair 'c-mode "{" nil :post-handlers '((my-create-newline-and-enter-sexp "RET")))


texts:
can you please help me to write a small emacs function? This is the first lisp function I am writing and I think I am getting confused with point and mark placement.

I want to write a function that yanks text and that than replace parts of it with a regular expression.
Example:
I have in my killring

TEXT_TEXT
TEXT_TEXT

and I want in my buffer

TEXT_TEXT:10=TEXT_TEXT
TEXT_TEXT:10=TEXT_TEXT

These are the functions I have been writing. query-replace-in-yank does what I want, exept that I have to press ! every time I use it. replace-in-yank is what I cant get to work.

(defun replace-in-yank (numstr)
  (interactive "sNumber: ")
  (let ((repstr (concat "\\1:" numstr "=\\1")))
    (let ((startp (point)))
      (yank nil)
       (let ((endp (point)))
          (goto-char startp)
          (while (re-search-forward "\\([A-Z\\_]+\\)" endp t)replace-match repstr t nil))))
   (newline-and-indent)))

(defun query-replace-in-yank (numstr)
 (interactive "sNumber: ")
 (let ((repstr (concat "\\1:" numstr "=\\1")))
  (yank nil)
  (exchange-point-and-mark nil)
  (query-replace-regexp "\\([A-Z\\_]+\\)" repstr  nil (mark) (point) nil nil))
 (newline-and-indent))


texts: How to vertically center when opening a file:line from emacsclient?

texts:
Is there a way to center the vertical scroll position when using emacs client to open a file at a position?

eg:

emacsclient +$NUM:$COL $FILE --no-wait --alternate-editor=emacs

Is it possible to either:

Modify this command so it tells emacs to recenter.
Add to a hook that runs (recenter) after has opened a file from a remote request?


texts: Is it possible to export content of subtrees without their headings?

texts:
I draft documents in org-mode and export them to LaTeX, HTML, etc. as needed. I frequently use the tag :no_export: whenever I don't want a certain subtree to show up in the output.

What I also want is want is for the export to completely ignore certain subtree headings, but not to ignore then content of the subtree under that heading. In other words, certain subtrees should be exported as if their content were just a continuation of the parent, instead of having its own subtree.

I'm ideally imagining a tag like :no_title:. I want my org-mode outline to look more or less the way I am used to. But I would consider other approaches with similar results.

To illustrate, here is a MWE of a document drafted in org-mode.

* Chapter 1
** Section 1
*** Paragraph 1      :no_title:
First paragraph of text in the section.
*** Paragraph 2      :no_title:
Second paragraph of text in the section.
* Chapter 2
** Section 1
*** Subsection 1
**** Paragraph 1      :no_title:
First paragraph of text in the subsection.
**** Paragraph 2      :no_title:
Second paragraph of text in the subsection

When I export that currently, I get something like this:

  1 Chapter 1

  1.1 Section 1

  1.1.1 Paragraph 1 :no_title:

  First paragraph of text in the section.

  1.1.2 Paragraph 2 :no_title:

  Second paragraph of text in the section.

  2 Chapter 2

  2.1 Section 1

  2.1.1 Subsection 1

  ◊ 2.1.1.1 Paragraph 1 :no_title:

  First paragraph of text in the subsection.

But what I want is more like this:

  1 Chapter 1

  1.1 Section 1

  First paragraph of text in the section.

  Second paragraph of text in the section.

  2 Chapter 2

  2.1 Section 1

  2.1.1 Subsection 1

  First paragraph of text in the subsection.


texts: Calling previous-buffer does not update the buffer-list so it breaks other functions that depends on other-buffer

texts:
I have a lisp function that relies on other-buffer which refers to buffer-list. Calling previous-buffer on a window does not update the buffer-list so it breaks the function.

How do make it so previous-buffer updates buffer-list?

reference

edit

I have the following lisp function that toggles to eshell with current directory set to the file I am viewing and from eshell back to the
previous file.

(defun eshell-here ()
  "Go to eshell and set current directory to the buffer's directory.
   If already on eshell, go to last buffer"
  (interactive)
  (if (equal major-mode 'eshell-mode)
      (switch-to-buffer (other-buffer (current-buffer) nil))
    (let ((dir (file-name-directory (or (buffer-file-name)
                                       default-directory))))
      (eshell)
      (if (not (equal (expand-file-name (concat (eshell/pwd) "/"))
                      (expand-file-name dir)))
          (progn
            (eshell/pushd ".")
            (cd dir)
            (goto-char (point-max))
            (eshell-kill-input)
            (eshell-send-input))))))

(global-set-key (kbd "<f1>") 'eshell-here)

The call to other-buffer relies on the most recently viewed buffer which is stored in the buffer-list.

previous-buffer and next-buffer does not update the buffer-list so I lose
the ability to get back to the file I was viewing from eshell.

The solution I have come up with is to call switch-to-buffer after previous-buffer/next-buffer to indirectly update the buffer list.

Do you think there is a better solution?


texts: Is it possible to do word completion on `isearch` shell?

texts:
I want to apply word completion on isearch shell. When I press tab ^I shows up on the shell instead of completing the word and show up a window for suggestions.

=> Is it possible to complete a word on isearch shell?


texts: Why in shell mode not show row/column number in mode line?

texts:
Emacs 26.1
I use smart mode line https://github.com/Malabarba/smart-mode-line.
Here result:

As you can see in scratch buffer show row/column numbers. But in shell mode not. Why?
How I can fix this?


texts: Overleaf like compilation check in emacs

texts:
When I am writing in latex in emacs I have to press C-c C-l to see the compilation log or use M-x TeX-error-overview to see the errors. Overleaf does have a handy feature, which lets the symbol turn red as soon as there is an error (depicted in the image). For now I can resort to M-x TeX-error-overview.

Is there a possibility (some useful package) to have the light bulb indicators for latex compliation similar to the python compilation bulbs in the image below?


texts: mu4e error : Database empty; try indexing some messages

texts:
I recently setup mu4e. My Setup :
emacs25, mu 0.9.18, macOS Sierra

I used mbsync to download my emails.

When I do M-x mu4e, I get error error in process sentinel: Database empty; try indexing some messages

But I have :)

I checked mu4e-maildir. It is correct (which is where mbsync has downloaded the messages.)

mu index (as well as mu index --maildir=~/Maildir just in case) also worked well.

I can use mu find <pattern> successfully.

But mu4e can't seem to find the DB

I think this is some configuration mismatch.

How do I troubleshoot this ?

References :

About 4 year old issue, without conclusive solution with exact same error : https://github.com/djcb/mu/issues/198 (Edit: I read http://comments.gmane.org/gmane.mail.mu.general/938 thread. I mentioned above, I am not using procmail. Using mbsync as mentioned above)
I have asked this question first on reddit (Albeit it started in slightly different context where I couldn't even get mu4e to work. But now I'm past that. https://www.reddit.com/r/emacs/comments/5srva7/mu4e_0918_emailing_with_emacs_now_even_better/deyf717/


texts: How to encode empty json object in elisp?

texts:
The json package coming with Emacs 24 has function json-encode that works like this:

(json-encode '(("key" . "value")))
"{\"key\":\"value\"}"

In case there are no keys (object is empty) I get:

(json-encode '())
"null"

when in this case I need to get an empty object:

(json-encode '())
"{}"

Is there a way to make json encode empty alist or plist as {}?
Is there another json package that can do this?


texts: Share pdf-tools installation between computers?

texts:
Q: how do I share a pdf-tools installation between computers?

I use pdf-tools on two
difference machines, and sync my .emacs.d between them via
Dropbox.

I have installed pdf-tools through
the
package manager. pdf-info-epdfinfo-program points to the executable epdfinfo,
which pdf-tools builds when installing.  That's apparently a problem.

Formerly, I ran one machine on MacOS and another on Linux
(Fedora), and neither one could use the other's epdfinfo
executable.  I now run one machine with Fedora and another with
Ubuntu, and, surprisingly, I have the same problem despite both
being Linux: the Fedora machine can't use the Ubuntu machine's
epdfinfo and vice-versa.  The error message suggests that it cannot one of the poppler libraries:

  pdf-info-check-epdfinfo: Error running ‘/home/dan/Dropbox/.emacs.d/packages/pdf-tools-20170417.150/epdfinfo’: /home/dan/Dropbox/.emacs.d/packages/pdf-tools-20170417.150/epdfinfo: error while loading shared libraries: libpoppler.so.64: cannot open shared object file: No such file or directory

What I have done in the past is:

1) install pdf-tools on one machine and save a copy of its
  executable (say, as epdfinfo-alt),

2) install pdf-tools on the other machine,

3) copy epdfinfo-alt into the pdf-tools directory,

4) put a conditional statement in my init file like:

;; pseudocode
(when (eq machine machine-alt)
  (setq pdf-info-epdfinfo-program
        "some-directory/epdfinfo-alt"))

Surely there is a better way to share a pdf-tools install
between machines that are not running the same operating
system or flavor of Linux.  How do I do it without going to all
this fiddly trouble?


texts:
I have been trying to use pdb to debug my Python program, however whenever I get to this screen

I don't know what to do. Usually when I use pdb I just type commands after (Pdb), but when I try to do the same in the buffer above like

(Pdb) n

It gives me "n is undefined" in the minibuffer. I've tried to look at tutorials for using pdb in emacs specifically such as here and here, but I still can't figure out where to type the commands. When I used an IDE I just typed the commands like I tried above, but here it doesn't seem to work. I'm sure the solution must be obvious, but any help is appreciated.


texts: How to break out of function indirection loop

texts:
I have a problem that I suspect is a general Emacs problem. If I run a certain package, simple-rtm, and then try and use M-x to run any command, I get the error in the bottom line of the screen:

  Symbol's chain of function indirections contains a
  loop: def-rtm-authenticated-scalar-method

I understand at a superficial level what this means - simple-rtm calls rtm, and in rtm.el there is a function def-rtm-authenticated-scalar-method and it has an infinite loop. Given enough time I will learn enough Lisp to work out why and fix it. But that might take me a while. Meanwhile I would like to just continue using Emacs for other things, but I find the only way I can use M-x after running simple-rtm is to exit Emacs and run it again.

My question therefore is: is there a simple Emacs command I can use to break out of the function indirection loop so I can use M-x again?

Emacs version is 24.5.1 running on Windows 10.


texts: How to assign an Emacs buffer to an EXWM workspace based on a regexp?

texts:
I know how to assign apps to various EXWM workspaces thanks to:

exwm-manage-configurations

But I don't know whether it is possible to assign Emacs buffers to EXWM workspaces in a similar fashion. All the EXWM variables (e.g. exwm-class-name, exwm-instance-name) that I know how to use in setting the above use WM_CLASS and I don't think that Emacs buffers have one (or do they? and if so, how can I find what it is?)

I also know how to customize where and how buffers are displayed within windows using popwin or display-buffer-alist. But I don't know if those can be used to assign buffers to workspaces.

Full workspace configurations can be saved thanks, for instance, to Bookmark+. But this is not really applicable to what I am trying to do.

Goal:

My goal is to have all buffers matching the regexp ^\*help\[R:.*$ (R help files in ESS) automatically assigned to workspace 3.

My elisp skills are still limited to write functions and I would appreciate any suggestion.

Thank you very much.


texts: Yasnippet: Prompting the user for information to fill in a latex snippet

texts:
I write a snippet to insert a theorem environment into a latex document, based upon some snippets created by another project: https://github.com/madsdk/yasnippets-latex .

In the snippet below, the snippet is inserted and emacs prompts the user to input some information for the label. What I wanted to do was get a second prompt ${2} that asks the use for the name of the theorem--which will go into the second marked item in the snippet.

# -*- mode: snippet -*-
# contributor: kb
# key: thrm
# group: math
# name: theorem
# --
\begin{thrm}[${2}]
\label{${1:"waiting for reftex-label call..."$(unless yas/modified-p (reftex-label nil 'dont-insert))}}
$0
\end{thrm}

I tried to emulate input for ${1} in ${2}, but the snippet failed to compile or execute. I suspect I just need a different function that takes an input instead of reftex-label but I am not familiar enough with elisp to know which one.

Any suggestions?


texts: Org babel gnuplot cannot find or open file with ledger-cli report

texts:
Expecting gnuplot to create a png on evaluating a ledgerCli plot report I get the GnuPlot error at the bottom of this post

LedgerCli

#+NAME: LedgerCli
#+BEGIN_SRC ledger :cmdline reg Assets:Cash -J
      1957/01/01  Opening Balance
           Assets:Cash  10
           Equity:OpeningBalances
      1957/01/02  Foo
           Assets:Cash  -5
           Expenses:Unknown
      1957/01/03 Bar
           Assets:Cash  -2
           Expenses:Unknown
#+END_SRC

#+RESULTS: LedgerCli
: 1957-01-01 10
: 1957-01-02 5
: 1957-01-03 3

GnuPlot

#+begin_src gnuplot :var data=LedgerCli :file gnuplot.png :exports results
  plot data u 1:2
#+end_src

#+RESULTS:
[[file:gnuplot.png]]

GnuPlot Error

    G N U P L O T
    Version 5.2 patchlevel 6    last modified 2019-01-01

    Copyright (C) 1986-1993, 1998, 2004, 2007-2018
    Thomas Williams, Colin Kelley and many others

    gnuplot home:     http://www.gnuplot.info
    faq, bugs, etc:   type "help FAQ"
    immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'qt'
gnuplot> cd '/home/'
gnuplot> data = "1957-01-01 10
gnuplot> 1957-01-02 5
         ^
         invalid command

gnuplot> 1957-01-03 3
         ^
         invalid command

gnuplot> "
         ^
         invalid command

gnuplot> set term png

Terminal type is now 'png'
set output "gnuplot.png"
Options are 'nocrop enhanced size 640,480 font "arial,12.0" '
gnuplot> gnuplot> plot data u 1:2
         warning: Cannot find or open file "1957-01-01 10"
         No data in plot

gnuplot> set output
gnuplot>
gnuplot>

From from a working org-babel gnuplot example, I noticed that gnuplot refers to data with e.g. data = "/tmp/babel-aXF0nC/gnuplot-5sxbKd. Altering the ledger cmdline to output a table with #+BEGIN_SRC ledger :cmdline reg Assets:Cash --register-format '| %D | %t |\n'
 doesn't change the error either


texts: Change mode-line-buffer-id face for inactive windows

texts:
Is there an Emacs face that can be used to control the colour of inactive buffer names?

Normally when setting the face mode-line-buffer-id all windows are affected.

In this example the mode-line has a light background, so I set mode-line-buffer-id to a much darker #333.

The idea is to invert the colour combination for for mode-line-inactive.

While this is possible for most of the text in the mode-line of inactive windows, the buffer names becomes unreadable since it's still controlled by the mode-line-buffer-id face.

I believe that setting mode-line-inactive to a lighter background would work around the problem, but that's not the result I wish to achieve.


texts: pdb within eshell up/down keys dont work

texts:
I am running python3 in eshell.

When I use import pdb; pdb.set_trace() in my code, pdb opens within eshell.

Everything works in pdb but the up/down keys don't work for running the previous command. I get not found as the message if I press the arrow keys. How can I make them work?


texts: What's the difference between :w and :sav in spacemacs?

texts: I'm using spacemacs and while when I create a new buffer with a given name and try to save it into a real file I find that :w won't work but :sav will. What is the difference between those two commands ?


texts: How to sort comma separated (or otherwise) text?

texts:
Suppose I have the following text:

int z;
int a;
int c;
int g;

or the following text:

z, a, c, g

How can I sort them to:

int a;
int c;
int g;
int z;

and

a, c, g, z

respectively?


texts:
What are some basic things I could do to reduce the start-up time?

Is there anything in particular I should pay attention to, for that matter?

Note: Startup time can be mitigated by starting Emacs less often (once per session) and opening files in a running instance. This question is about minimizing the startup time, for the session start or any other time when starting Emacs is necessary.

See also the same question answered on Stack Overflow, with question and answer scores over 50 and 30-some "favorite" bookmarks. Good answers here should go beyond what is available on Stack Overflow.


texts:
Emacs scrolling is lagging for me on Linux but not on macOS. I'm using Ubuntu 20 and also tried Solus but behavior is the same. Faster system helps but not enough. What so special about emacs build on macOS? Can I achieve this on Linux? I'm using touchpad with high scrolling speed.
Edit: Emacs version: GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)
With emacs -q there is no lag.
(setq fast-but-imprecise-scrolling t) difference is not noticeable.
Disabling highlight line mode helps.
Very strange that scrolling down is better than scrolling up.
Edit: I had to remove anything that operates during scrolling like highlight line, symbol under cursor and custom modeline. Emacs profiler helped to find those.


texts:
In Emacs 25.3 (but not 22.3, for example), the search string " " (space) in LaTeX mode is matched by the carriage return character as well as the space character. I can understand why Emacs has been programmed this way: a single carriage return in LaTeX will give a space in the compiled document. However, I'd like to turn this behaviour off in the Emacs search, so that a search for " " returns only spaces. How can I do this?

I've tried looking for answers through Google and through a direct search on SE ("emacs latex mode search") but couldn't find an answer. Grateful for any help.


texts: Tramp connection history mysteriously appearing in .emacs.d

texts:
Today when reviewing changes to my .emacs.d before committing, I noticed a file called tramp. The contents of this file are as follows:

;; -*- emacs-lisp -*- <16/12/28 15:56:06 /home/ethan/.emacs.d/tramp>
;; Tramp connection history.  Don't change this file.
;; You can delete it, forcing Tramp to reapply the checks.

((["scp" nil "fcp" nil nil]
  nil))

I am curious how/why this file was created. I can see from the documentation what this file does, and how to disable the creation of the file, but I am wondering why it has suddenly appeared since I have never used tramp, and have never seen this file generated before.


texts:
Everytime I expand an abbreviations on a css file it expands as html instead the proper css expansion.

This:

m10+p0

Should expand to this:

margin: 10px;
padding: 0px;

But instead expands to this:

<m10></m10>
<p0></p0>

I have installed the Emmet mode using use-package with this config:

;; --- Emmet Mode ---
;;
(use-package emmet-mode
  :ensure t

  :init
  (add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
  (add-hook 'css-mode-hook  'emmet-mode) ;; Enable Emmet's css abbreviation.
  (add-hook 'web-mode-hook 'emmet-mode) ;; Auto-start on any web modes

  :config
  (local-set-key (kbd "C-c C-e w") nil)
  (local-set-key (kbd "C-c C-e w") 'emmet-wrap-with-markup)
  )

I tried disabling other packages but still does the same, even running the M-x emmet-expand-line instead of using the keybinding in case there's any collision on the keybindings.


texts: Can I generate and show two table of contents with reftex simultaneously?

texts:
I work in a main tex-document, where I use reftex to display the table of contents. But I also have another buffer where I want to show a toc.

Is this possible?

Now the *toc*-buffer is overtaken by any tex buffer in which I use reftex-toc.


texts:
In Section 13.5.4 of the Elisp reference, we are shown a problem whereby a macro definition evaluates one of its argument expressions.

(defmacro foo (a)
  (list 'setq (eval a) t))
(setq x 'b)
(foo x) → (setq b t)
     ⇒ t                  ; and b has been set.
;; but
(setq a 'c)
(foo a) → (setq a t)
     ⇒ t                  ; but this set a, not c.

We are then advised to

  substitute the expression into the macro expansion, so that its value will be computed as part of executing the expansion.

I'm not sure what this means, but I interpret it as meaning that we should try to rewrite the macro as follows:

(defmacro foo (a)
  `(setq (eval ',a) t))

Which, when expanded, gives:

(macroexpand '(foo x)) → (setq (eval (quote x)) t)

But I'm getting the following error when I call (foo x):

(wrong-type-argument symbolp (eval (quote x)))

Even though when I evaluate (symbolp (eval (quote x))), the result is t.

It seems that there's something fundamental that I'm not understanding here. What's the issue?


texts: How to automatically run inferior process when loading major mode?

texts:
Like suggested in this question How to automatically run inferior process when loading major mode for the first time? I want to automatically run run-python when entering python major mode. However,

(add-hook 'python-mode-hook 'run-python)

doesn't work and gives the error

Wrong number of arguments: (1 . 3), 0

Which argument is needed by run-python? How to automatically start an inferior python interpreter when entering python-mode?

Edit: After M-x toggle-debug-on-error the output gives

Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 3) 0)
run-python()
run-hooks(change-major-mode-after-body-hook prog-mode-hook python-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook python-mode-hook))
run-mode-hooks(python-mode-hook)
python-mode()
call-interactively(python-mode record nil)
command-execute(python-mode record)
execute-extended-command(nil "python-mode")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)


texts:
I use:
(global-superword-mode t)

in my init.el because I don't want Emacs to treat _ as a word delimiter.
How do I do the same thing for -? I'd like to enable this globally.


texts: Auto-complete looks funny around bold fonts

texts:
When I use font-lock faces that are bold, it messes up my auto-complete overlays so that they look like this:

One obvious solution to the problem would be to stop using bold fonts.  But since I am using a color theme that I got from somewhere else, I would have to create my own version of it, and go through and manually remove any bold fonts. And if I decide to try a new theme next week, I will have to do the same thing over again.

Is there any way for auto-complete to adjust to account for bold font faces?

Assuming that this is a known limitation of auto-complete, I have a few alternate ideas. The problem is that I am not sure if any of them can be easily achieved (if at all):

Disable bold faces in buffers where auto-complete is enabled
Disable bold faces everywhere
Use a font whose bold face is the same width as its normal face

As you can see, I'm okay with throwing out the bold faces if necessary, but I'm also interested in finding the easiest way to do it.


texts:
Inspired by John Kitchin's presentation of org-links features in Org-mode 9, I tried to implement a simple functionality for "file" links. Since I am working on several machines, I wanted the link face to show if  file exists on disk. So in org-link-set-parameters func for "file" I've put this simple code:

:face '(lambda (path) (if (file-exists-p path)
                          '(:foreground "green")
                        '(:foreground "red")))

It works just fine unless file has Polish characters in its name ("ąęćłóśżź"). Especially after editing the link description with org-insert-link with cursor on the link it's face becomes red (as non existent file), and the path becomes for example like this (assuming the file name is "żółć.org"):

[[file:%C5%BC%C3%B3%C5%82%C4%87.org]]

I was changing the value of file-name-coding-system variable but without any impact for described behaviour.

When I change value of the :follow key to '(lambda (path) (message "%s" (file-exists-p path))) it returns "t". I assume then that it has something to do with filtering file name by different emacs functions but I can't find which would be responsible for wrong behaviour of the ":face" parameter.

I'd appreciate any help to fix that.


texts: Make agenda view only show DONE & CANCEL items

texts:
How can I filter the agenda view of org-mode for a custom sequence of TODO keywords?

Example: Only show agenda items with one of the TODO-keywords DONE or CANCEL.


texts: Elisp, can I pull-in (provide) a function & variable from a library without changing library?

texts:
I.e
In elisp, from inside an .el file, you can make functions global like this:
(provide 'org-pomodoro)

Now, in my personal .emacs, I would like to access (pull in?) a function that's internal to a library (org-pomodoro) but without actually changing org-pomodoro (as I'm not the maintainer of the package).

e.g I want to access org-pomodoro-finish myself to implement the functionality of switching between a task and continuing the pomodoro in another task.

For this I also need to be able to access a count-variable.  (e.g like ~~org-pomodoro-time)

[edit]
The solution below works quite well. I can just evaluate (org-pomodoro-finished) and a pomodoro is finished ahead of time. I can then write my own function that will be listed in M-x for convienience.

Thank you so much, this opens many doors for me.


texts:
Windows 10, Emacs 26.1

M-x shell
grep

here result:

grep
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.

Nice.
Now I want to find files in temp folder:

rgrep
Search for - empty
Wild card - empty
Base directory - select current dir

And here result:

-*- mode: grep; default-directory: "d:/TEMP/temp/" -*-
Grep started at Tue Nov 27 18:55:02

find . -type d "(" -path "*/SCCS" -o -path "*/RCS" -o -path "*/CVS" -o -path "*/MCVS" -o -path "*/.src" -o -path "*/.svn" -o -path "*/.git" -o -path "*/.hg" -o -path "*/.bzr" -o -path "*/_MTN" -o -path "*/_darcs" -o -path "*/{arch}" ")" -prune -o ^"^!^" -type d "(" -name ".#*" -o -name "*.o" -o -name "*~" -o -name "*.bin" -o -name "*.bak" -o -name "*.obj" -o -name "*.map" -o -name "*.ico" -o -name "*.pif" -o -name "*.lnk" -o -name "*.a" -o -name "*.ln" -o -name "*.blg" -o -name "*.bbl" -o -name "*.dll" -o -name "*.drv" -o -name "*.vxd" -o -name "*.386" -o -name "*.elc" -o -name "*.lof" -o -name "*.glo" -o -name "*.idx" -o -name "*.lot" -o -name "*.fmt" -o -name "*.tfm" -o -name "*.class" -o -name "*.fas" -o -name "*.lib" -o -name "*.mem" -o -name "*.x86f" -o -name "*.sparcf" -o -name "*.dfsl" -o -name "*.pfsl" -o -name "*.d64fsl" -o -name "*.p64fsl" -o -name "*.lx64fsl" -o -name "*.lx32fsl" -o -name "*.dx64fsl" -o -name "*.dx32fsl" -o -name "*.fx64fsl" -o -name "*.fx32fsl" -o -name "*.sx64fsl" -o -name "*.sx32fsl" -o -name "*.wx64fsl" -o -name "*.wx32fsl" -o -name "*.fasl" -o -name "*.ufsl" -o -name "*.fsl" -o -name "*.dxl" -o -name "*.lo" -o -name "*.la" -o -name "*.gmo" -o -name "*.mo" -o -name "*.toc" -o -name "*.aux" -o -name "*.cp" -o -name "*.fn" -o -name "*.ky" -o -name "*.pg" -o -name "*.tp" -o -name "*.vr" -o -name "*.cps" -o -name "*.fns" -o -name "*.kys" -o -name "*.pgs" -o -name "*.tps" -o -name "*.vrs" -o -name "*.pyc" -o -name "*.pyo" ")" -prune -o  -type f "(" -iname "*" -o -iname ^".[^!.]*^" -o -iname "..?*" ")" -exec grep --color=always -i -nH --null "how_test" "{}" ";"
FIND: Parameter format not correct

Grep exited abnormally with code 2 at Tue Nov 27 18:55:03

Why I get error:

Grep exited abnormally with code 2 at Tue Nov 27 18:55:03


texts: How to update edited table so that columns align

texts: I am using table.el in Emacs 24.x on win7. I have created a table and updated the cell contents but cannot get the table to reformat to match the new contents. As far as I have read, EMACS should automatically reformat but it does not seem to. I have tried unrecognizing then re-recognizing the table to update how it is displayed but it remains the untidy mess that I edited. In Org-mode tables, TAB reformats the table after changes but I cannot find out how to do this with the Tables feature. Can someone educate me on how to properly reformat a table after editing its contents?


texts: Python org-mode babel output: column headers misaligned

texts:
I'm trying to view some rows of a pandas data frame. Is there a way to prevent the ">>> ..." from appearing before the headers, so that column names are aligned with the data?

#+NAME: simulate-data
#+BEGIN_SRC python :results output :exports code output :session p1
import pandas as pd
import numpy as np
import datetime as dt

def makeSim(nHosps, nPatients):
    df = pd.DataFrame()
    df['patientid'] = range(nPatients)
    df['hospid'] = np.random.randint(0, nHosps, nPatients)
    df['sex'] = np.random.randint(0, 2, nPatients)
    df['age'] = np.random.normal(65,18, nPatients)
    df['race'] = np.random.randint(0, 4, nPatients)
    df['cptCode'] = np.random.randint(1, 100, nPatients)
    df['rdm30d'] = np.random.uniform(0, 1, nPatients) < 0.1
    df['mort30d'] = np.random.uniform(0, 1, nPatients) < 0.2
    df['los'] = np.random.normal(8, 2, nPatients)
    return df

discharges = makeSim(50, 10000)
discharges.head()

#+END_SRC

#+RESULTS: simulate-data
:
: >>> >>> >>> >>> ... ... ... ... ... ... ... ... ... ... ... ... >>> >>>    patientid  hospid  sex        age  race  cptCode  rdm30d  mort30d       los
: 0          0      19    1  55.909740     3       84   False    False  5.211757
: 1          1       2    0  81.362813     1       60   False    False  7.442538
: 2          2      14    0  55.769465     3        5    True    False  5.851072
: 3          3      32    1  75.530266     3       79   False    False  8.721435
: 4          4       5    1  94.081585     1       64    True     True  5.895088


texts:
I am very new to emacs and I can't figure out why my plots doesn't appear, I have ein and elpy installed, my code runs but I just can't see the plot. I installed the packages in M-x list-packages.

My .emacs looks like this :

;(setq debug-on-error t)

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/"))))
 '(package-selected-packages (quote (org ein elpy flycheck py-autopep8 material-theme))))

(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

(setq inhibit-startup-message t) ;; hide the startup message
(load-theme 'material t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally

(elpy-enable)
(elpy-use-ipython)
(require 'ein)

;; use flycheck not flymake with elpy
(when (require 'flycheck nil t)
  (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
  (add-hook 'elpy-mode-hook 'flycheck-mode))

;; enable autopep8 formatting on save
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)

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

A code snippet :

import matplotlib.pyplot as plt
a = [1,2,3]
b = [1,2,3]
plt.plot(a,b)

Result :

In [7]: Out[7]: [<matplotlib.lines.Line2D at 0x110a80c50>]

How can I make the plot show up ?


texts: Make org-mode export to Beamer keep temporary files out of the current directory

texts:
Exporting to Beamer from org-mode creates a myriad of temporary files (the .tex file + files ending in .aux, .log, .toc, .fls, .nav, .vrb, etc.).

Most LaTeX implementations now have an option (-outdir) to keep all these temporary files outside from the current directory.

How can the export to Beamer be modified to use this facility?

Many thanks!


texts:
I currently have a keyboard shortcut bound to C-c t that shows me all of the NEXTACTION items I have, no matter what headline level they're at. It works by using a kbd macro wherein I just typed C-c / N <RET>, and that was enough to fill in everything I needed.

But now I would like that same shortcut to also show me WAITING items. I tried just recording the whole macro of C-c / NEXCTACTION|WAITING <RET>, and assigning that, but for some reason it still seems to use the old macro. I don't have any idea what's going on there, it's almost like it's ignoring that I've changed the macro.

Looking at the function help for org-sparse-tree directly, it seems that it accepts optional arguments, but I can't find any documentation describing how to use the function.

In short, all I want is a single keyboard shortcut that gives an org-sparse-tree on two keywords at the same time. Any ideas?

EDIT:
This is the relevant part of my .emacs file:

(fset 'NEXTACTION-WAITING-org-tree
   [?\C-c ?/ ?T ?N ?E ?X ?T ?A ?C ?T ?I ?O ?N ?| ?W ?A ?I ?T ?I ?N ?G return])

(defun nextaction-org-tree-fun ()
  (progn
    (switch-to-buffer (find-file "~/orgfiles/personalorg.org"))
    (execute-kbd-macro (symbol-function 'NEXTACTION-WAITING-org-tree))))

(global-set-key (kbd "C-c t") (lambda ()
                                (interactive)
                                (nextaction-org-tree-fun)))


texts: Automatically use appropriate Python version with Jedi.el

texts:
Documentation says that it can be done by making some variables buffer local. But how to make it correctly?

Can somebody show me example how to configure this jedi.el behaviour correctly?

Now I have two virtualenv with installed jedi for python 2 and 3. When I change working virtualenv or python buffer, I'll check current python version and if it has changed i call this function

(defun cm:jedi-setup-server ()
  "Setup Jedi server, update and reload."
  (interactive)
  (if (not (equal python-environment-default-root-name (cm:jedi-environment-root-name)))
      (progn
        (custom-set-variables
         '(python-environment-default-root-name (cm:jedi-environment-root-name))
         '(jedi:server-command
           (concat (venv-name-to-dir (cm:jedi-environment-root-name)) "bin/jediepcserver")))
        (jedi:install-server-block))))


texts: c w movement up to next word instead of end of word

texts:
In vi, c w stops at the end of the current word (that movement is normally e, as in c e). This is different from w alone or d w, which go up to the beginning of the next word.
A popular Vim configuration causes c w to do work like other w commands, where the "word" movement takes you UP TO the next word. Consuming any whitespace.
How do I make c w work in evil as it does in this Vim configuration?
Evil: 1.14.0
Emacs: 27.1


texts: Opening file with emacsclientw, file name contains non-latin characters

texts:
My first post here about Emacs. I've spent days trying to figure out answer before posting here.

I'm running Emacs 26.1 on Windows 10. The setup that I'd like to have is running a single instance of Emacs and to be able to open files from Windows file system in Emacs. So, I'm using Emacs with server-start and connecting to it via emacsclientw.

Things work as expected except for when file names have non-latin characters in file name. For example files called māss.txt or lūk.txt. When I open such files with emacsclientw, what I get in Emacs is empty mass.txt or luk.txt buffers.

If I understand correctly, emacs/emacsclient considers that a file with such characters kind of "doesn't exist", so it visits a new file. If I save this "new" empty buffer, it gets saved as a file without those special characters, as mass.txt or luk.txt, and the original files are not touched. If I open/visit the original files from within Emacs, they can be opened and edited as expected, all the characters show up just fine.

Do I understand correctly that emacsclient simply does not support such language specific characters and for emacsclient file names must be latin characters only?

Any other pointers where I should look and what to try?


texts:
Running Doom Emacs 2.0.9 on Emacs 27.1.
A library org-inlinetask provides some functionality I need.
I can SPC h P org-inlinetask to open the library. Then I can SPC c e to evaluate buffer. This makes the functionality available to me.
But all is lost when I restart Emacs. And I have to do these two steps again.
How do I ensure that the functionality provided by the library is available on starting Emacs?


texts:
Using f-split from f.el:

(require 'f)
(f-split "c:/a/b")

returns

("/" "c:" "a" "b")

What is the rationale? Shouldn't it be  ("c:" "a" "b")?

Also in Emacs for Windows the value of:

(f-path-separator)

is "/". When is this value supposed to be different, if not in Windows?


texts: Sort entire hirearchy in an Org mode buffer

texts:
Running Emacs 25.2.2.

Consider the following heading hierarchy:

* L1
  ** C
    *** 2
    *** 1
  ** B
    *** 3
    *** 2

I want to sort it to:

* L1
  ** B
    *** 1
    *** 2
  ** C
    *** 2
    *** 3

org-sort lets me sort entries under a heading at a time. But it does not let me sort the entire tree like the case above.

How do I get this done?


texts: Prevent Emacs from auto-reverting when the file size is over 10 GB

texts:
How can I prevent Emacs from auto-reverting only when the file size is over 10 GB? I know that there's the large-file-warning-threshold option but it doesn't work for auto-reverting.

I'm dealing with a file that I frequently overwrite programmatically. It's a small file most of the time, but it sometimes becomes unexpectedly large so I'd like to prevent Emacs from freezing when I leave that file open.


texts: Yasnippets won't expand in git-commit-mode?

texts:
I have written a snippet for git-commit-mode.  However when I'm writing a commit message (from Magit), the snippet won't trigger.  Does anyone know how to fix this?

I have yasnippet version 20160924.2001, and Emacs 24.5.1.


texts: Org mode: exporting new customized emphasis markers

texts:
In my emacs org mode, I created a new customized emphasis marker (added to Org Emphasis Alist) with the caracter "¡" associated with the font-lock-face "hi-pink" (I use the solarized theme).

This works fine to highlight text displayed within emacs.

But when I try to export my org file into a latex or a html file, I get an error message: "unknown marker". It seems that the new marker is not recognized for exporting.

Is there a way to get the new emphasis marker exported to html, latex or other backend formats (lets say, as a source code text)?

If not, is it possible at least to tell org mode to ignore the new customized emphasis mark, in order to accomplish the export process?

Thanks in advance for your help!
(congratulations for this website!!)


texts: Emacs 25.3.2: reverse windows on files opening

texts:
If I open 2 files by command line:

emacs file1 file2

in Emacs 25.3.2, file2 is opened in the upper window and file1 in the lower.

This didn't happen in previous versions of Emacs that had the correct (in my opinion) behaviour (file1 was open in the upper window and file2 in the lower).

Can I restore the old behaviour?


texts: How to concatenate similar groups of blocks during tangle with noweb syntax?

texts:
I used to have a literate configuration file structured as follows:

#+BEGIN_SRC emacs-lisp :tangle "/tmp/out.el" :noweb yes

;; requirements
<<require>>

;; other
<<execute>>

#+END_SRC

* FOO

Here goes all the snippets of code related to module FOO.

#+NAME: require
#+BEGIN_SRC emacs-lisp
(require 'foo)
#+END_SRC

#+NAME: execute
#+BEGIN_SRC emacs-lisp
(foo-setup)
#+END_SRC

* BAR

Here goes all the snippets of code related to module BAR.

#+NAME: require
#+BEGIN_SRC emacs-lisp
(require 'bar)
#+END_SRC

#+NAME: execute
#+BEGIN_SRC emacs-lisp
(bar-setup)
#+END_SRC

With previous versions of Org-Mode, I obtained the following file:

;; requirements
(require 'foo)
(require 'bar)

;; other
(foo-setup)
(bar-setup)

Notice how all blocks named require  (resp. execute) are grouped together.
With Org-Mode 9.2.3 (Emacs 26.1), I only have the blocks related to foo:

;; requirements
(require 'foo)

;; other
(foo-setup)

Is it a case of "the update broke my workflow"? Is there an easy way to obtain the same result as previously?


texts:
Today I started using desktop-mode. It's nice to be able to save a desktop using the desktop-save command, and load one using the desktop-change-dir command.

Sometimes I do M-x cd to change the working directory in Emacs.
I have three clients at work, with files pertaining to them stored in ~/client_foo/, ~/client_baa/, ~/client_baz/. What if I wanted Emacs to have a background color of black when cd'd in to the first clients directory, green for the second client, and brown for the third. Is there any module that can help me?


texts: Make use of an empty echo area to display information

texts:
The echo area is empty most of the time, which makes me think that I could use it to display some information. For example, org-clock displays the current task, the remaining time and the total elapsed time on the modeline. This information is not really readable there (the modeline can be rather short), is repeated on each modeline (because it applies to the whole emacs session), and is not that useful that I'm willing to sacrifice some precious modeline space for it. On the other hand, it could appear in the echo area when there is nothing else to display here.

Is there a canonical way of achieving this? I have thought of hacking an insert function in minibuffer-inactive-mode-hook (but it doesn't work reliably, for example the message disappears as soon as the echo area is used again), or spamming non-logged messages (but this will be mess with other uses of the echo area and the minibuffer).

A poor-man version of this would use idle timers, but the echo area can be empty without emacs being idle (for example when inputting some text).


texts:
SCHEDULED or DEADLINE TODO items with active timestamps correctly appear in my Agenda View (day/week/fortnight) under Org 9.0.4.

After making a timestamp inactive, such entries do not appear in the Agenda, as expected.

Pressing [ in Agenda View should display inactive timestamps. However, pressing this does not change the View. A message is displayed indicating that inactive timestamps are now included, but none are included. I have tested this in day, week and fortnight views, both pressing [ before and after changing the view. I tested with a DEADLINE item for today.

How can I display inactive timestamps in the Agenda?


texts: how install emacs 26 (or whatever latest ver) on mac

texts:
Someone (in another SE answer) mentioned a feature thats only available in 26,
so I guess now I gotta upgrade.

How do you install emacs 26 on macOS Sierra?

What I tried:

Googled how install emacs 26 Mac,
brew install emacs.


texts: magit tries to create new repository when I do magit-status in a repository

texts:
I recently updated magit from melpa. It seems that it requires Emacs 24.4. Since I had 24.3, I've also updated Emacs to 24.5.

When I do M-x magit-status and choose the directory with .git, it asks me if I want to create repository in that directory. I say no, and nothing happens. It seems that magit thinks that the directory isn't a git repository. If I say yes, it produces wrong number of arguments error.

I waited for the next magit update, this issue still hasn't fixed for me. Should I go back to a stable version?

M-x magit-version says
Magit 20150707.1446, Git 1.7.10.4, Emacs 24.5.1


texts: How can I search for a string recursively under the current directory?

texts:
(Note: this will be a wiki-like question in that I already figured out the answer.  I'm posting it here on the hope it might be useful to others...)

How do I search for a string recursively under the current directory?


texts: Open clickable filenames in the same help buffer

texts:
I looking for simple solution to open clickable filenames in the same help buffers. For example, when we display help for add-to-list variable and click TAB the cursor is placed on the subr.el file link. We can click the link to open this file in other window. I look for solution that will open the file in the same window rather rather than other one.
I was looking for a solution to this problem and found Make opening clickable filenames from Help mode in same window, but this is too over complicated in my opinion to use (it involves using timers and killing other buffers), even if the author claim it's working.
I wonder if after 4 years of initial questions anyone can propose any better solution to this problem.


texts:
I am using org-jira, and generally am happy with it (read happier than using Jira).

However, when I am trying to login, but mistyped my username/password, every operation later fails, and I don't seem to have an other chance to login.

So my question is how to get back to the org-jira login prompt again?


texts: How to cycle through visual-regexp package findings?

texts:
With the regular search forward from Emacs if you keep pressing C-s you cycle through all the findings.

Right now I'm using visual-regexp package with the visual-regexp-steroids extension that has a forward search too, but using regular expressions ( vr/isearch-forward). After running the search how do I cycle through all the findings?.


texts: How do I change the default shell for `sh-mode`?

texts:
sh-mode usually does a great job of auto-magically detecting which shell a file is intended to be run by. It looks at the shebang, for instance. However, I have a bunch of files that are intended to be sourced, not run as executables, and thus I don't have a shebang.

I have my $SHELL environment variable set to bash, but when I open the file, sh-mode still defaults to sh. How do I get it to default to bash?

I've tried running (getenv "SHELL") in both *scratch* and with eval-expression in the shell file's buffer, and they both report "usr/loca/bin/bash". Why doesn't sh-mode respect this? I've been digging through the source code and it really seems like this should be working.


texts: Publishing a single file via org-publish

texts:
How do you save a publishing behavior so that only a single org file out of a directory of org files is published?

org-publish-file could be used with a larger unused project definition, but content could be published unintentionally.


texts: How to write documentation for saved keyboard macros?

texts: I have recently defined a keyboard macro using C-x ( and C-x). I then gave the keyboard macro a name using M-x name-last-kbd-macro RET defined-kbd-macro. And saved it to a file using M-x insert-kbd-macro. When I used C-h f RET defined-kbd-macro, under documentation it simply stated that it was a keyboard macro. Is there a way to include a doc string in fset command?


texts:
To display a text "tiếng Việt" (which means Vietnamese), I tried this:

(set-fontset-font t '(#x1e00 . #x1eff) "Consolas")

but it did not work.

describe-char shows: "ế" ⇒ 1ebf "ệ" ⇒ 1ec7, so they are within the #x1e00 - #x1eff range.
I've read a lot about setting fonts in Emacs, but could not find the reason why. I've tested in emacs -q too. No luck.
(set-frame-font "Consolas") works, but it is not what I want (because it's not font failover, apparently).
(set-fontset-font t 'han "Microsoft Yahei UI") works for Chinese characters.

Please help. How to set font failover for Vietnamese characters? I am using Emacs in Linux.


texts:
Using Crtl+Backspace or Ctrl+Del adds the deleted text to the kill ring.
How can I prevent this from happening? I do not need to have every single piece of text sent to the kill ring when it gets deleted.

Side question:
What's the purpose of this default setting anyway? :)


texts:
I want to print elisp code result as original but currently it will output with "|" separated.
for example:

#+BEGIN_SRC emacs-lisp
(setq my-list '(apple orange peach))
#+END_SRC

The code block will output as below:

#+RESULTS:
| apple | orange | peach |

How can I get output as original style like below:

 #+RESULTS:
 (apple orange peach)


texts: How can I skip 'Scan-error: "Unbalanced parentheses"...'?

texts:
I want to write a script in order to correct spaces inside section command in a LaTeX code, that's to say

\section{Lorem ipsum dolor
  sit amet consectetuer adipiscing
  elit}

should be

\section{Lorem ipsum dolor sit amet consectetuer adipiscing elit}

I do this with the following script:

(defun headings-on-same-line ()
  "Delete new lines inside section commands."
  (interactive)

  (goto-char (point-min))

  (while (search-forward "\\section" nil t)
    (setq sec1 (make-marker))
    (set-marker sec1 (point))
    (set-marker-insertion-type sec1 t)
    (forward-sexp)
    (setq sec2 (make-marker))
    (set-marker sec2 (point))
    (set-marker-insertion-type sec2 t)

    (perform-replace "\\(?:[ ]*\\)?
\\(?:[ ]*\\)?"
             " " t t nil 1 nil sec1 sec2)

    ))

I have problems with unbalanced parentheses like this:

\section{Lorem ipsum $(a\rangle$
   dolor sit amet
   consectetuer adipiscing elit}

I have thought to use an if-else construct, so I have rewritten the code above like this:

(defun headings-on-same-line-unbalanced ()
  "Delete new lines inside section commands."
  (interactive)

  (goto-char (point-min))

  (while (search-forward "\\section" nil t)
    (setq sec1 (make-marker))
    (set-marker sec1 (point))
    (set-marker-insertion-type sec1 t)
    (if (forward-sexp)
    (progn
      (setq sec2 (make-marker))
      (set-marker sec2 (point))
      (set-marker-insertion-type sec2 t)

      (perform-replace "\\(?:[ ]*\\)?
\\(?:[ ]*\\)?"
               " " t t nil 1 nil sec1 sec2)
      )
  (progn
    (insert "Warning"))
  )))

but it does not work. How can I fix it?


texts: `#+NAME:` is ignored unless running Emacs with `-q`

texts:
I am trying to export an .org buffer with the following contents:

#+CAPTION: My subgraph.
#+NAME: fig:subgraph
[[/tmp/image-4383FmT.png]]

The following latex output is produced:

% Created 2018-01-30 Tue 09:32
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{meir}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={meir},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 24.5.1 (Org mode 9.1.4)},
 pdflang={English}}
\begin{document}

\tableofcontents

\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{/tmp/image-4383FmT.png}
\caption{\label{fig:org39390dd}
My subgraph.}
\end{figure}
\end{document}

The #+NAME: command was ignored. It works properly when I start Emacs with emacs -q. In the search for the guilty line in my configuration, I commented out lines in init.el until nothing remained, but the problem persists. What is going on? What is the difference between -q and empty init file? (I compared the *Messages* buffer after starting Emacs both ways and did not find any difference)


texts:
I have an R function which returns a latex fragment, which I'd like to insert into my org file. Here's what I tried, which just inserts the latex source:

#+BEGIN_SRC R :exports none :results silent
data(cars)
fitted <- lm(dist ~ speed, data=cars)
library(stargazer)
stargazer(fitted, out='fitted.tex')
#+END_SRC

#+INCLUDE: "fitted.tex" src latex

The latex output renders fine if I manually paste it into the org file between #+BEGIN_LATEX and #+END_LATEX markers.
Here it is for reference:

% Table created by stargazer v.5.2 by Marek Hlavac, Harvard University. E-mail: hlavac at fas.harvard.edu
% Date and time: Wed, Mar 28, 2018 - 04:44:03 PM
\begin{table}[!htbp] \centering
  \caption{}
  \label{}
\begin{tabular}{@{\extracolsep{5pt}}lc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
 & \multicolumn{1}{c}{\textit{Dependent variable:}} \\
\cline{2-2}
\\[-1.8ex] & dist \\
\hline \\[-1.8ex]
 speed & 3.932$^{***}$ \\
  & (0.416) \\
  & \\
 Constant & $-$17.579$^{**}$ \\
  & (6.758) \\
  & \\
\hline \\[-1.8ex]
Observations & 50 \\
R$^{2}$ & 0.651 \\
Adjusted R$^{2}$ & 0.644 \\
Residual Std. Error & 15.380 (df = 48) \\
F Statistic & 89.567$^{***}$ (df = 1; 48) \\
\hline
\hline \\[-1.8ex]
\textit{Note:}  & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}


texts: How can I change the format of relative numbers?

texts:
I use this plugin relative-line-numbers of Fanael on Github.
how to add extra spaces on the both sides of the relative number sides?

Form this

To this


texts:
I have installed again pabbrev and whenever I activate the mode

I constantly get theses 2 errors.

Error running timer ‘pabbrev-idle-timer-function’: (invalid-function pabbrev-debug-message)
Error running timer ‘pabbrev-short-idle-timer’: (invalid-function pabbrev-debug-message)

I know that pabbrev-debug-message is a macro but I cannot debug further than this.

Any help please?


texts: Keybinding causes only a cursor blink ('\C-t') and no command is executed

texts:
This article is about the keyboard key combination 'Control + t' (smallcase 't')
This problem is exclusive to the GUI version and does not come up while using the terminal.
I am using Wayland

Control+t : The cursor just blinks and nothing happens.

C-h k + C-t (Control+h and k followed by Control + t) : Nothing shows up.
C-h k + C-S-t (Control+h and k followed by Control+Shift+t) : Works. Shows this

'C-t (translated from C-S-t) runs the command transpose-chars (found in global-map), which is an interactive compiled Lisp function...'
Note Translated from C-S-t
This basically means that Control-t is getting eaten up somewhere in the process.
Some more info and curious things -

Control+t and terminals -

Works in Kitty and termite - Detected by wev ; C-t 'tranpose-chars' in emacs-mode (bindkey -e in zsh) works
Does not work in konsole   - Detected by wev ;  C-t 'tranpose-chars' in emacs-mode (bindkey -e in zsh) does not work.

wev output -

    [14:     wl_keyboard] key: serial: 5101; time: 10021865; key: 66; state: 1 (pressed)
                      sym: Control_L    (65507), utf8: ''

    [14:     wl_keyboard] modifiers: serial: 0; group: 0
                          depressed: 00000004: Control
                          latched: 00000000
                          locked: 00000000

    [14:     wl_keyboard] key: serial: 5103; time: 10022192; key: 28; state: 1 (pressed)
                          sym: t (116), utf8: ''

Emacsclient -t (emacs client on terminal and tty)
Works.

C-t runs the command transpose-chars (found in global-map), which is an interactive compiled Lisp function in `simple.el'.

Firefox and Chrome is able to detect the keypresses. Tested on https://keyboardchecker.com/

What do I need?

I need to understand why this is happening.
The solution to the same.

And I need your help.
[Update]
The same problem persists in X11. Again, Control+Shift+t works but not Control+t


texts: What's the difference between a buffer, a file, a window, and a frame?

texts:
When posing questions on this site, people sometimes talk about "windows" when they mean "frames," and "buffers" or "files" when they mean "windows."  So:

Q: What is the difference between a buffer, a file, a window, and a frame?

(I'm posing this question in the spirit of this Q&A combo: to promote correct use of the terms.)


texts: Proportional font breaks company overlays

texts: When I use a proportional font with buffer-face-mode, it breaks company's overlay, because company obviously counts offset from the left margin, as well as pads suggestions on the right in character positions, expecting it to be same width always. Is there a way to use a variable width characters, but still get the proper rectangular box for company? If there's an alternative solution like replacing company with other similar mode I would like to know it too.


texts:
I just found out about the function pop-tag-mark (M-* by default) to go back after a find-tag (or in this case after a racer-find-definition).

Occasionally I would like to go "forward" again after going back with pop-tag-mark. Is this possible in an easy way, or would I have to write a bunch of ELisp to do this?

Basically what I want is something similar to Back/Forward in your web browser.