texts: Smarter and more efficient way to add font lock keywords to org-mode?

texts:
I really hate looking at raw markup in org-mode documents, so I am trying to replace as much of it with symbols as possible.

So #=begin_ becomes {, src becomes some-glyph etc.

My current approach is to just list a bunch of regexes for each case:

(font-lock-add-keywords
 'org-mode `(("^\s*\\#\\+BEGIN_\\(QUOTE\\) "
              (1 (progn (compose-region (match-beginning 1) (match-end 1) "")
                        nil)))
             ("^\s*\\#\\+END\\(QUOTE\\) "
              (1 (progn (compose-region (match-beginning 1) (match-end 1) "")
                        nil)))
             ("^\s*\\(\\#\\+BEGIN_\\)[:alpha:]"
              (1 (progn (compose-region (match-beginning 1) (match-end 1) "{")
                        nil)))
             ("^\s*\\(\\#\\+END_\\)[:alpha:]"
              (1 (progn (compose-region (match-beginning 1) (match-end 1) "}")
                        nil)))

I wish I knew elisp better to refactor this but I don't. With this approach, you're searching for related syntax elements separately. It seems like it would be much more efficient to first look for an occurrences of #+begin_, replace them with {, then search forward for words like src, quote, comment etc.

I am not sure yet what the performance implications of this are for longer documents (perhaps someone will enlighten me), but I'd like to get off too a good start. Some interesting stuff on font-locking here by @lunaryorn, but it's totally over my head at the moment, and it seems to be about writing new major modes, instead of augmenting the font-locking in org-mode.


texts: How to define a singe weak reference in elisp?

texts:
Hash tables in elisp supports weak references, however weak references may be useful without the need to use a hash.

How can a weak reference to an object be defined without having to use a hash-table containing one item?


texts: What are my options for scroll bars in terminal emacs?

texts:
I use emacs in the terminal. One thing that I miss sometimes from a more traditional GUI editor are scrollbars. Sure, there's the percentage in the modeline, but sometimes you just want a visualization. Also, the percentage doesn't visualize how large the document is relative to the visible buffer like a scrollbar would.

What are my options for scrollbars in terminal emacs? scroll-bar-mode seems to be completely absent (I built emacs with --without-x).


texts:
I am making my tables in pure LaTeX becuase Org-mode doesn't have the functionality to create what I want. My problem is, I am pasting the LaTeX code for the table under a heading but when I get the pdf export, I see that the table has moved under another heading, above some other text.
I had this happen to me before in this document again with an image (since I had used #+CAPTION on it) but using \usepackage{placeins} in LaTeX header and \FloatBarrier at the end of the image did work. I tried doing the same thing for the table but it simply won't work.


texts:
(format "Hard-coded value is 100\% and the variable is %s" "50\\%")

Returns

Debugger entered--Lisp error: (error "Invalid format operation %a")
  format("Hard-coded value is 100% and the variable is %s" "50%")
  eval((format "Hard-coded value is 100% and the variable is %s" "50%") nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

(Note how in the debugger output, the command has the "%" escaped)

How in heaven can I use a string with a percentage in it?


texts: How can I practice searching and replacing with regular expressions interactively in Emacs?

texts:
Searching and replacing using regular expressions is clearly a powerful tool to the Emacs user who can routinely perform these actions. However, as an Emacs (and/or programming) beginner, regular expressions need to be learned and practiced.

Can I learn and train regular expressions interactively in Emacs, similarly to the built-in Emacs tutorial? If not, what are other suggestions to utilize Emacs to practice the use of regular expressions for searching and replacing?


texts: run-with-timer error: "Invalid or unitialized timer"

texts:
I am trying to create a simple timer.

All I am doing is C-x-e-ing this expression:

(run-with-timer (* 60 25) nil (insert "Success!"))

Problem is I get an error message:

 Debugger entered--Lisp error: (error "Invalid or uninitialized timer")
  signal(error ("Invalid or uninitialized timer"))
  error("Invalid or uninitialized timer")
  timer--activate([t 21693 2834 932492 nil nil nil nil 0] nil nil nil)
  timer-activate([t 21693 2834 932492 nil nil nil nil 0])
  run-at-time(10 nil nil)
  apply(run-at-time 10 nil nil nil)
  run-with-timer(10 nil nil)
  eval((run-with-timer 10 nil (insert "Success!")) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

The error message stems from this line in the Emacs source.

How can I fix this and create a simple timer for myself?

Ps. here is the apropos for run-with-timer:

run-with-timer is an interactive compiled Lisp function in `timer.el'.

(run-with-timer SECS REPEAT FUNCTION &rest ARGS)

Perform an action after a delay of SECS seconds.
Repeat the action every REPEAT seconds, if REPEAT is non-nil.
SECS and REPEAT may be integers or floating point numbers.
The action is to call FUNCTION with arguments ARGS.

This function returns a timer object which you can use in `cancel-timer'.

This worked for some reason:

(run-with-timer 0 10 'oo)

(defun oo ()
  (message "message 10 secs"))

Can anyone explain why? I guess a function and a function name aren't interchangeable everywhere.


texts: In which variable are past sparse tree queries saved

texts:
I'm executing sparse tree queries programmatically, and I'd like to save the search queries in the same history variable that org-mode uses by default. I'm guessing I can/should do this with add-to-history (described here).

I took a quick look at the code but, being unfamiliar with it, I could not find the right variable.

Does anyone know?


texts:
I have tried using Cua mode (via adding (cua-mode t) to my ~/.emacs file) but it doesn't seem to set the copy keybinding to Ctrl-c. See for example this screenshot showing my Edit menu:

I have tried adding this line to my ~/.emacs file:

(global-set-key (kbd "C-c") 'kill-ring-save)

but still C-c doesn't copy selected text in an Emacs buffer (and the Edit menu looks the same as in the above screenshot). If you are wondering whether some other line in my ~/.emacs file is overriding this one, feel free to see for yourself. Here is my ~/.emacs file.


texts: Magit equivalent for "git branch | git branch -d"

texts:
I just learned about magit-remote-prune for cleaning up stale remote branch.

For merged local branches, I often use git branch | git branch -d to clean up. Is there a way to do that in Magit; conveniently listing merged local branches, and selecting them for deletion?


texts: How to reevaluate the code in an `eval-after-load`, after the library has been loaded?

texts:
I've defined the following :

(eval-after-load 'clojure-mode
  '(font-lock-add-keywords
    'clojure-mode `(("\\(#\\){"
                     (0 (progn (compose-region (match-beginning 1)
                                               (match-end 1)
                                               "∈")
                               nil))))))

Now I want to change it to :

(eval-after-load 'clojure-mode
  '(font-lock-add-keywords
    'clojure-mode `(("\\(#\\){"
                     (0 (progn (compose-region (match-beginning 1)
                                               (match-end 1)
                                               "Ø")
                               nil))))))

If I just eval this expression, the clojure-mode buffer will not change, the "∈" is displayed and not change to "Ø", even if I run fundamental-mode and clojure-mode again.

How Can I fix this?


texts:
Is it possible to set the same property for multiple headings in one shot?

* Heading 1...
* Heading 2...
* Heading 3...

I would like to select all three headings and do C-cC-xp to set a common property for these entries.

* Heading 1
      :PROPERTIES:
      :Source:   some common value
      :END:

* Heading 2
      :PROPERTIES:
      :Source:   some common value
      :END:

* Heading 3
      :PROPERTIES:
      :Source:   some common value
      :END:

Is it possible to set properties across headings without going through them one by one?


texts: Elisp: How to accumulate function return into a list

texts:
I have this small snippet of Elisp code that decodes kernel traces:

(defvar projbase "/my/proj/base")
(setq my_shell_output
  (substring
   (shell-command-to-string (concat "/home/demetra/scripts/eaddrs2line.sh "
                                    projbase " " <each-line> ))
   0 -1))

How to write an Elisp function that calls this snippet of code for each line in a region and accumulate the results in a list ? The return is of format "module-name function-name file-path/file-name line-num".

After this is done I can work on the next task to show the list in a
helm buffer where going to each line will open the file-path/file-name at line-num.


texts: C-C C-SPC not working in RHEL 6.7 GNOME 2.28.2

texts:
The key C-SPC is not working in RHEL 6.7 GNOME 2.28.2.

When I try C-h k and then hit C-SPC I see the following message on the mini-buffer:

C-@ is undefined

That is, SPC is mistaken for @.


texts:
When I use the ics export functionality of org-mode on org files which contain date ranges, i.e., entries like <2016-08-20 Sat>--<2016-08-25 Thu> only the first and the last day seem to be exported.

Is  there a way to export it so that the generated entry contains the whole date range?


texts: emacs c++ gud cannot skip non existing file, making it unusable

texts:
I have this file:

#include <string>

using namespace std;

string remove(string s) {
    return s;
}

int main() {
    string s1 = "aaaa";
    string s2 = remove(s1);
    return 0;
}

g++9 -g test.cpp

In .gdbinit, I have "skip -gfile /build/gcc-9-NBVNOv/gcc-9-9.1.0/build/x86_64-linux-gnu/libstdc++-v3/include/**/*
", which is used to skip non existing stl lib file.

Debug a.out in Emacs gud with multi windows support.
After loading, "b remove" Then "r" to start debug.

Emacs always prompts (a lot of times, which is very annoying, MAKE EMACS UNSABLE)

Please answer y or n. File /home/user1/test/"/build/gcc-9-NBVNOv/gcc-9-9.1.0/src/libstdc++-v3/src/c++17/fs_ops.c" is read-only on the disk. Make buffer read-only, too? (y or n).*

However, the file does not exist at all. GUD continously prompts similar message, making it usable.

Any workaround?

Thanks.


texts: Emac to open a large file error: Memory exhausted--use C-x s then exit and restart Emacs

texts:
I want to open a large file in the server environment with emacs, but there is error: Memory exhausted--use C-x s then exit and restart Emacs as shown in the following figure.

Please know that I intend to open the file with emacs in the server environment. The Linux is Centos. If your guys know this issue, please tell me in detail, use the figure to explain is the best.

Thanks!


texts: Org plot table : wrong type argument listp hline

texts:
I learn org mode following the documentation, I try to plot an array with gnuplot but get the error Wrong type argument: listp, hline. Where does it come from ?

Here is the array :

#+PLOT: title:"Test" ind:2 deps:(3) type:2d with:histograms set:"yrange [0:]"
|---+-------+--------+-------------|
|   | index | number | number / 10 |
| / |     < |      < |             |
|---+-------+--------+-------------|
|   |     1 |    100 |          10 |
|   |     2 |    200 |          20 |
|   |     3 |    300 |          30 |
|   |     4 |    400 |          40 |
|   |     5 |    500 |          50 |
|---+-------+--------+-------------|
|   | total |   1500 |         150 |
|---+-------+--------+-------------|
#+TBLFM: $4=$3/10

I get the same error if I remove the last column (since it plots only 2d).

Edit :
I know have corrected the table according to the suggestion :

#+PLOT: title:"Test" ind:1 deps:(3) type:2d with:histograms set:"yrange [0:]"
| 1 | 100 |
| 2 | 200 |
| 3 | 300 |
| 4 | 400 |
| 5 | 500 |
#+TBLFM:

And get the error Key sequence C-c SPC l starts with non prefix key C-c SPC


texts:
I use org-babel to generate some reports which can't be automatically processed, and since org is a good outline format, I print the results in org to represent them as trees.

I've noticed that nesting org markup into #+begin_example block makes emacs really slow (and the formatting of the results is off, too).

It would be really cool to have babel place the output of certain code blocks to a separate buffer (and open a window for it too), the same way as it handles errors.

I've looked through documentation but it seems like there's no such option.

Am I wrong? If I'm not, maybe someone has such a snippet around?

Also, the slowness might be caused by some other options in my configuration, how's your experience with org formatted text nested into example? Maybe I'm barking under the wrong tree here.

Thanks


texts: Disable popwin temporarily with pop-up documentation

texts:
Following this question about automatically displaying documentation in a pop-up window, I decided to give it a try based on existing work on Popup Help in Emacs Lisp and clippy.

However, I've run into an issue whereby help-xref-interned doesn't play nice with popwin. When I try to create a temp buffer for help-xref-interned, there is a brief flash as popwin brings the window up, then quickly dismisses it.

Therefore, it seems necessary to disable popwin temporarily, then restore it to its original state. I'm wondering what the idiomatic way to do this is. What I have is below:

(defun *-describe-symbol-popup ()
  "Display full documentation of symbol in a pop-up window."
  (interactive)
  (let ((doc (*-symbol-full-doc (symbol-at-point)))
        (x-gtk-use-system-tooltips nil))
    (if (string-empty-p doc)
        (message "Unknown symbol, or no documentation available.")
      (pos-tip-show doc 'tooltip nil nil -1))))

(defmacro *-symbol-full-doc (symbol)
  "Return a string of the full documentation of SYMBOL, as given by
`help-xref-interned'.

If `popwin-mode' is active, disable it temporarily. The value of
`popwin-mode' is thus always nil, even when the mode is active.'"
  (let* ((sym (make-symbol " sym "))
         (form `(let ((,sym ,symbol))
                  (with-temp-buffer
                    (let ((help-xref-following t))
                      (help-mode)
                      (help-xref-interned ,sym)
                      (buffer-string))))))
    (if (fboundp #'popwin-mode)
        `(let ((old-popwin popwin-mode))
           (popwin-mode -1)
           (unwind-protect
               ,form
             (popwin-mode (or old-popwin -1))))
      ,form)))

Can I make this more idiomatic/less verbose?


texts:
In org-mode, I need a function to move point to the last row of a named table of arbitrary length.

Example:

From anywhere in the buffer, I would like to go to:

#+NAME: table-with-unique-name
|---+---------|
| X | Y       |
|---+---------|
| a | some    |
| b | random  |
| c | content | <--first cell in this row
|---+---------|

So:

I there a more elegant way to go to a named table than to isearch for
#+NAME: table-with-unique-name and next-line?

EDIT: ok, so I'm going with a function that searches for the #+NAME: table-with-unique-name line and goes to next-line but that, too, is giving me trouble. With this function:

(defun test-goto-table ()
  (interactive)
    (goto-char (point-min))
    (re-search-forward "^#\\+NAME: table-with-unique-name")
    (next-line))

I can successfully go to the table if it exists but if the search fails, point ends up in the beginning of the buffer. Is there a way to wrap re-search-forward or some other smart way to search the whole buffer? [Resolved by using save-excursion. See "Edit 2" for working function.]

[Answered] Once at the table, how can I go to the last line? (I know
there's a    function    called org-table-goto-line but I can't get
it to go to    last line, only to    a specific line number.)

EDIT 2: This works to goto specific cell of a table with a unique name:

(defun tracktable-exists-p ()
  (save-excursion
    (goto-char (point-min))
    (re-search-forward "^#\\+NAME: table-with-unique-name" nil t)))

(defun test-goto-cell ()
  (interactive)
  (if (tracktable-exists-p)
      (let ((tabel "^#\\+NAME: table-with-unique-name"))
        (goto-char (point-min))
        (re-search-forward tabel nil t)
        (show-subtree) ; necessary if the table is hidden in a subtree
        (goto-char (org-table-end))
        (previous-line 2) ; the dotted line in the bottom is not recognized as part of the table by 'org-table-goto-column' so go two lines up.
        (org-table-goto-column 1))
    (message "table-with-unique-name doesn't exist")))

Marco Wahl resolved the hard part, so accepting answer.


texts: Why does eshell corrupt my files when using redirection?

texts:
If I run this in bash (it's a GraphViz command to make a picture of a graph based on the input file testgraph):

$ dot -Tpng testgraph.dot > graph.png

with this testgraph.dot:

digraph G {
    a -> b
}

I can execute it as many times as I want, and graph.png comes out right everytime. But if I execute it in eshell, the file will be corrupt if I don't move the old graph.png out of the way first. My first guess was that eshell must do appending by default rather than truncating, but if I test with echo and cat with plaintext it works as expected. If I compare one of the corrupt files against one of the regular ones, the broken ones are shorter:

$ ls -l graph*
-rw-r--r--   1 aaaaa        xxxx          3203 2015-12-21 15:24 graph.png
-rw-r--r--   1 aaaaa        xxxx          3087 2015-12-21 15:24 graph.png.broken

The file sizes are consistent, if I run the command fifty times without removing I will get the exact same size truncated file every time.


texts: start-process output processed too slowly

texts:
When start a command asynchronously, using (start-process ...), the output is added to the buffer 3-5 times more slowly than if I had used (async-shell-command ...). I don't have any output filters, I need start process because I need to be notified when the process exits.

The issue seems to have been raised here:

https://lists.gnu.org/archive/html//emacs-devel/2008-07/msg01436.html

but apparently it was never resolved.

What is causing the significant slowdown in output (basically I just want to dump all the output to a buffer and be notified when that is done). Are there output filters running even though I haven't specified any? Is this a matter of increasing some buffer size?

Edit: There's a related question here and an apparent patch available.
Size of process output sent to filter functions


texts: Stop python mode jumping to function definition?

texts:
I recently installed python-mode (via package-list-packages). Since then, whenever I put my cursor by a function I've defined, it jumps to it, and if I put my cursor by a builtin function or operator (or some installed third party thing, like a module name), it opens python-help.

I would like to stop this happening. Any ideas on how to stop this, or even really what might be doing this if it's not python-mode would be very helpful.


texts: Elpy auto-complete gives incomplete suggestions

texts:
I am trying to use Elpy for Emacs to write Python programs.  The
auto-complete feature suggests all attributes of PyQt5 classes, but
suggests only a subset of the attributes of instances of these
classes.

All attributes of the class QLabel are suggested when I type this in Emacs:

from PyQt5.QtWidgets import QApplication, QLabel
app = QApplication([])
label = QLabel()
QLabel.

However, if I replace the last line with:

label.

then only a small subset of the attributes are suggested.  (The
missing attributes include those marked as "module" when I type
QLabel.  For example the method getText() is missing.)  This is
strange because Elpy (or company or jedi?) clearly knows the type of
label to be able to suggest a subset of its attributes!

I am using a fresh install of kubuntu 18.04, with Emacs 25 and Python
3 installed from packages, and follow the Installation instructions
for
Elpy.

apt install python3 python3-pip emacs
pip3 install virtualenvwrapper

I use a virtual environment called elpy with these packages installed:

(elpy) prompt$ pip list
Package     Version
----------- -------
appdirs     1.4.3
attrs       19.1.0
autopep8    1.4.3
black       19.3b0
Click       7.0
entrypoints 0.3
flake8      3.7.7
jedi        0.13.3
mccabe      0.6.1
parso       0.3.4
pip         19.0.3
pycodestyle 2.5.0
pyflakes    2.1.1
PyQt5       5.12.1
PyQt5-sip   4.19.15
rope        0.14.0
setuptools  40.8.0
toml        0.10.0
wheel       0.33.1
yapf        0.26.0

Here is my .emacs.d/init.el:

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)
(elpy-enable)
(custom-set-variables
 '(package-selected-packages (quote (elpy))))
(custom-set-faces)

Output from elpy-config:

Virtualenv........: elpy (/home/asbuch/lib/virtualenvs/elpy)
RPC Python........: 3.6.7 (/home/asbuch/lib/virtualenvs/elpy/bin/python)
Interactive Python: python (/home/asbuch/lib/virtualenvs/elpy/bin/python)
Emacs.............: 25.2.2
Elpy..............: 1.28.0
Jedi..............: 0.13.3
Rope..............: 0.14.0
Autopep8..........: 1.4.3
Yapf..............: 0.26.0
Black.............: 19.3b0
Syntax checker....: flake8 (/home/asbuch/lib/virtualenvs/elpy/bin/flake8)

Any help is greatly appreciated!


texts:
I had an issue with a file that had inconsistent line ending. My file would show a ^M for every line ending. I ran into this article that shows how to get rid of the ^M character and set the buffer file encoding to fix the issue.

However, I still see the ^M character when I stage and commit my file in Magit. Magit show a file that has ^M as a line ending character even when I fixed this in the file buffer.

Do I need to make Magit aware of my file system encoding. If so, how?

Issue seen in macOS Mojave and Emacs 26.1.


texts:
Sometimes my global keybindings are overridden by a major mode.  An easy example is the following setting in my init file

(global-set-key (kbd "C-j") 'newline-and-indent)

But annoyingly this keybinding is hidden by the "Lisp Interaction" major mode which is the default mode of the scratch buffer.

When I find myself in a situation where a major mode (or minor mode) is hiding my global keybinding, how can I get it back?

Note: My question is not "How can I bind C-j to newline-and-indent in "Lisp Interaction" mode?"  I am interested in a much more general answer about how to deal with keymaps that clash or user keybindings that get hidden by some major/minor mode.


texts: How to write a function to open real hyperlinks (Org Mode, Gnus Article, elfeed hyperlinks) in a specific browser?

texts:
First off, you can find my entire current config at https://gitlab.com/mordocai/emacs.d/tree/4cfdfd76368aa687a6277a22161b40624e32b8fe, just in case I miss including something.

I currently have my emacs browser config setup like:

(global-set-key (kbd "<f6> w") 'browse-url-at-point)
(setq w3m-coding-system 'utf-8
  w3m-file-coding-system 'utf-8
  w3m-file-name-coding-system 'utf-8
  w3m-input-coding-system 'utf-8
  w3m-output-coding-system 'utf-8
  w3m-terminal-coding-system 'utf-8
  w3m-use-cookies t)

(defun browse-url-at-point-firefox ()
  (interactive)
  (let ((browse-url-browser-function 'browse-url-firefox))
    (browse-url-at-point)))

(defun browse-url-at-point-default ()
  (interactive)
  (let ((browse-url-browser-function 'browse-url-default-browser))
    (browse-url-at-point)))

(global-set-key (kbd "<f6> f") 'browse-url-at-point-firefox)
(global-set-key (kbd "<f6> d") 'browse-url-at-point-default)
(global-set-key (kbd "<f6> g")
                (icurry 'browse-url-default-browser "http://www.google.com"))

However, this only works if the link is "written out" like http://www.duckduckgo.com. If the current mode handles links natively (like org mode, gnus article's html view, or elfeed's html rendering) then the display text will be used as the link instead. Something like Google will try to go to http://Google instead of http://www.google.com.

Is it possible to write a function(s) that will allow me to bind it to a key and will actually go to one of the above type of links properly? If so, is it possible to detect which situation is at point and intelligently go to the link? I think I could write this, but I'm not sure how to get the actual link text in the first place.

If there is a package that can do all of this, all the better!


texts:
I would like to quickly access my org-contacts stored in the file ~/org/contacts.org through rofi.

egrep "^\* " ~/org/contacts.org |rofi -dmenu -i

allows me to select the contact through rofi. However, I fail to forward the selection to emacs:

emacsclient --eval "(org-narrow-to-subtree $(egrep "^\* " ~/org/contacts.org |rofi -dmenu -i))" ~/org/contacts.org

What I want to do is: start emacsclient, then open the contacts.org file and narrow the subtree to the selection I made in rofi. Is this somehow possible?


texts: Enable LSP in spacemacs only for certain languages?

texts:
The spacemacs LSP layer documentation says:

Enabling this layer will set the used backend for all supported languages to LSP unless you explicitly set a specific backend for the language.

I find this a problem because emacs often prompts me to install a language server (occasionally even trapping me in the minibuffer because of some bug), but I rarely feel the need to use LSP for a given language.  So if I want to use LSP even for one language, I have to configure it off for every other, file type by file type (that includes e.g. things like JSON files). That seems like a never-ending task.
Is there some way around this so that I can explicitly enable (whitelist) use of LSP instead of disable it (blacklist) for particular languages?


texts: org odt export -- edit Text Body style font

texts:
i run emacs 26.1, org 9.3.

i would like to modify the font used by the Text Body style when i export a file to odt.

i followed the instructions at https://orgmode.org/manual/Applying-custom-styles.html#Applying-custom-styles. but when i go looking in the 'stylist', there is only a single Org style there and not one that i'm interested in using or modifying.

& if i use a custom org export styles file, all of my other formatting in org is lost in the export process.

most of my text just uses the Text Body style. is there an easy way to copy/edit the OrgOdtStyles.xml do change the font of that style? or equally of 'Default Style'?


texts: org-agenda just choose with the default keys

texts: These days I am using org-agenda to manage my todo lists. Does there exist some settings that just let the agenda-view choose a specified one. For example, when I use the org-agenda command, it shows a menu and says: "Press key for an agenda command". Since in most cases, I just choose "a", I am wondering whether there exists a setting to skip the choose and just call one of the listed commands.


texts: Is there a way to only accept certain arguments to a function?

texts:
I want to write a function where the only two valid values for the input argument are "dag" or "rulegraph". Is there a way to specify that only these two arguments are accepted this in the elisp function header?

If this is not possible, I'd accept an idiomatic way of handling this.


texts:
My emacs version is 25.2 but i got the same issues on 24.3:
When i run M-x package-install-file RET pdf-tools-0.70.tar RET in emacs i get:

pdf-annot.el:32:1:Error: Cannot open load file: No such file or directory, tablist
Compiling file /home/alex/.emacs.d/elpa/pdf-tools-0.70/pdf-cache.el at Sun     Apr 23 16:19:22 2017
Error: Opening output file: Cannot overwrite file, /home/alex/.emacs.d/elpa/pdf-tools-0.70/pdf-cache.elc

Make install-package  doesn't work either.


texts:
When I try to filter buffers by mode in ibuffer, I am not able to filter by major mode helm-mode.  For example,

 MR Name                 Size Mode
 -- ----                 ---- ----
 *  *helm apropos*        117 Helm
 *  *helm projectile*    3633 Helm
 *  *helm-package*        187 Helm

these three buffers say "Helm" in the mode column, but will only match fundamental-mode when filtering on major mode or derived mode.  Is this a bug?


texts:
Sorry if this was answered somewhere else, but I could not find an answer.
All the text editors installed in my system can display emojis except Emacs (version 27), even if they use the same font.
As an example, I configured both Emacs and Gedit to use the JetBrains Mono font. Gedit can display the shrug emoji  but Emacs cannot.
It seems, this can be workaround by specifying a fallback font that will display these symbols:
(set-fontset-font t nil "Symbola" nil 'append)

However other editors do not require such trick (although maybe they use a similar mechanism by default).
Are editors like Gedit or Visual Studio using a some trick to display emojis that Emacs does not?


texts:
In RStudio, the documentation pane display not just the help file but also links to other help files (see link to aov below).

How to get the same in ESS R?


texts: How to preserve color in *Messages* buffer?

texts:
When running (C-x C-e) the following snippet and doing M-x mes, I see text written in red in the minibuffer area, but the text in the *Messages* buffer is stripped of all formatting.

(defun mes ()
  "message me"
  (interactive)
  (message (propertize "text" 'face 'font-lock-warning-face)))

How can I preserve the color and other font information in the *Messages* buffer?


texts: What's the most efficient, idiomatic way to paste-and-replace in Emacs?

texts:
I often do something like this:

Copy some stuff
Go to where I need to paste it
Paste it (C-y)
Kill the rest of the line (C-k)
Select what I just pasted, and copy it again
Repeat steps 2-5

The whole "re-select what I just pasted" thing is not sensible, I know. On the other hand, I like the Emacs pasting behavior, so I don't want to enable all of what goes on with delete selection mode. There is also a whole collection of increasingly complicated routines you can write or borrow to rethink the kill-ring, but that too seems less about idioms and more about Emacs wrenching.

What is the most efficient (by keystroke count) way to accomplish this regular task, without building a complicated setup or changing to delete-selection-mode?


texts: Can `ivy-switch-buffer` add the current project's files (via `projectile`)?

texts:
I bind C-x b to ivy-switch-buffer and I've gotten used to the idea that pretty much all files I might want are in there (I use ivy-use-virtual-buffers to show recent files). But sometimes they're not, and then I have to quit and do projectile-find-file to open some file in my project.
Is there a customization for ivy to add the current project's files into the list used by ivy-switch-buffer? Like ivy-use-virtual-buffers but for projectile?


texts:
I have known using (setq split-width-threshold 1) splitting windows in horizontal by default.

But I want to only split a window such as slime in horizontal and other window is vertical by default.

Is there a way to do this?


texts: Weekly org-capture-template without days?

texts:
I'm hoping to replicate my manual weekly capture template using the more baked-in functionality.
Given this org-capture-template:
("z" "Test" entry (file+olp+datetree "~/docs/eng-log.org" "Worklog") "**** TODO %?" :tree-type week)

I'd like this output:
* Worklog
** 2020
*** 2020-W39
**** TODO testing?

Instead, I get this:
* Worklog
** 2020
*** 2020-W39
**** 2020-09-22 Tuesday
***** TODO testing?

Is there a way to remove the day marker?


texts: How to make the region face take priority over the `show-paren-mode` face?

texts:
I'm using show-paren-mode with expression highlighting, changing the background face to just a shade lighter than the default background. I like it a lot.

The problem is that when I have a mark, the background face from the paren expression is overwriting the background face for the marked region so it looks odd and inconsistent, and it's difficult to visually tell what the whole region is, at a glance.

Is there any way to configure the region face to have a higher "priority" than the show-paren-match face?


texts:
If I change:
(define-key org-mode-map (kbd "C-c d") 'org-toggle-todo-and-fold)

to eg:
(define-key org-mode-map (kbd "F1") 'org-toggle-todo-and-fold)

This doesn't work.
Is there a way to map to F keys such as the F1 key?


texts:
Suppose I have a function that is 'noisy' and prints to standard output rudely.

(defun not-my-noisy-function ()
  "A function outside my control"
  (do-something-useful)
  (print "Haha! Butts!"))

I would like to be able to make calls to that function without corresponding messages in stdout.  I was hoping that there was an elisp construct which would evaluate the form discarding standard-output from its body.  A little bit like ignore-errors, but applicable to an output stream instead of thrown exceptions.  I haven't been about to find anything in the vein of "suppress"/"silent"/"discard"/"redirect" for output streams.

(evaluate-silently ;; macro I wish existed
  (not-my-noisy-function))

My first thought of setting standard-output to nil doesn't seem to do the trick.

(let ((standard-output nil))
  (print "Nope; doesn't work.  You can still hear me."))

Interestingly the elisp manual says it must not be nil and doesn't say anything about values other than t, a buffer, or a marker.  I can't seem to find documentation about an "real" streams in the elisp manual; only optional parameters to output functions which only seem to duplicate captured standard output rather redirecting it.  with-output-to-string and with-output-to-temp-buffer also only seem to duplicate output to a buffer.

As a last recourse I could manually examine problematic functions and use cl-flet (to override print,message, etc), but I would rather not take that approach.  Unfortunately this is the only technique that I've identified to accomplish this.

(cl-flet ((print (&rest body) nil))
  (not-my-noisy-function)
  (print "I am being ignored!?!!"))

Is there a better way?  I hope I just haven't divined the correct apropos incantation.


texts: set paths in init file taking OS into account

texts:
I use the same config file between my windows-linux-mac machines. But I'm having some trouble setting some org folders because of the different definition of paths per OS.

For instance setting my default notes folder for windows:

(cond
  ((string-equal system-type "windows-nt")
    (setq org-default-notes-file (concat org-directory "/notes.org"))

is giving me "D:\\my_data/notes.org"

(setq feeds-file (expand-file-name "notes.org" org-directory ))

is giving me "D:/my_data/notes.org"

As you can see, none is a working path in windows (or even in linux). How can I define a variable pointing to a path and concatenate any file I need taking Operative System into account?


texts: Org-agenda doesn't find any items with a property search

texts:
I'd like to use org-mode to work with JIRA tickets. There's a package for this, org-jira. When I run it, I get a file like this: FOO is my Jira project, and org-jira creates a file ~/.org-jira/FOO.org:

* FOO-Tickets
** TODO Review big document                                      :FOO_5:
   :PROPERTIES:
   :assignee: waisbrot
   :filename: FOO
   :reporter: waisbrot
   :type:     Story
   :priority: Major
   :status:   Ready
   :created:  2019-04-01T00:00:00.000-0700
   :updated:  2019-04-01T00:00:00.000-0700
   :ID:       FOO-5
   :CUSTOM_ID: FOO-5
   :END:
:LOGBOOK:
:END:
*** description: [[https://jira.example.com//browse/FOO-5][FOO-5]]
  We made a document and now we're gonna read it.
** TODO Publish coverage reports                 :FOO_102:
   :PROPERTIES:
   :assignee: waisbrot
   :filename: FOO
   :reporter: waisbrot
   :type:     Story
   :priority: Major
   :status:   Planning
   :created:  2019-04-01T00:00:00.000-0700
   :updated:  2019-04-01T00:00:00.000-0700
   :ID:       FOO-102
   :CUSTOM_ID: FOO-102
   :END:
:LOGBOOK:
:END:
*** description: [[https://jira.example.com//browse/FOO-102][FOO-102]]
  We generate test coverage so we should publish it

That looks reasonable. Now I want to get a list of tickets that are "Ready" (and other states). I do C-c a m status=Ready and I find no items. Things seem to be working because C-c a t shows me a list of all the tickets, as I'd expect.

(I want to use Agenda for this because I have multiple projects which turn into multiple org-files and I want to search across all of them.)


texts:
I need to perform this kind of (query-)substitutions in LaTeX code:

"fig" --> "figure"

But I don't want to match text inside commands e.g. \label{fig:1} or \includegraphics[width=2cm]{fig/D.pdf}.

I figured out to use face properties to select the strings to be replaced and I wrote this piece of code

(goto-char (point-min)
(while (search-forward-regexp "\\<\\([Ff]ig\\)\\(s?\\)\\>\\.?" nil t)
  (save-excursion
    (let ((b (make-marker))
      (e (make-marker)))
      (set-marker b (match-beginning 0))
      (set-marker e (point))
      (goto-char b)
      (font-lock-fontify-buffer)
      (let* ((face 'query-replace)
         (bg (face-background face)))
    (set-face-background face "OliveDrab3")
    (unwind-protect
        (unless (or (string= (face-at-point) "font-lock-constant-face")
            (string= (face-at-point) "font-lock-builtin-face"))

          (perform-replace "\\<\\([Ff]ig\\)\\(s?\\)\\>\\.?"
                   "\\1ure\\2" t t nil 1 nil b e))
      (set-face-background face bg)))
)))

It works quite well but fails if I run it at the file opening. It seems that emacs needs to scan the buffer in some way I don't understand.

I tried to put (font-lock-fontify-buffer) at the beginning of the script but it doesn't work.

1 - How can I force emacs to fontify the whole buffer before running my code?

2 - Any (tested) idea to achieve the same result with some other technique?


texts: How to set temporary file directory for flycheck eslint (outside of current directory)

texts:
flycheck-mode creates temporary files in the current directory. That is annoying. How can I disable/set the default place for these temporary files.

I use javascript eslint syntax checker for react jsx files.


texts: How to make org-mode timestamps understand a new abbreviation for "tomorrow"?

texts:
Q: How can I make org-read-date understand an abbreviation that calls a function that returns tomorrow's day of the week?

The super-short version: I'm trying to get the timestamp functionality of +1d when typing tom as a more finger-friendly way of saying "tomorrow."

This question follows up on this thread on dates and this thread on times.

I'm trying to train org-read-date to understand new, easier-to-type abbreviations when I'm entering timestamps, scheduled items, and deadlines.  In particular, when entering a timestamp, I'd like to be able to enter tom and have org-read-date recognize it as "whatever day tomorrow is" (yes, I know I can type +1d, but it's an awfully awkward sequence of keys).

The parse-time functionality on which org-read-date relies expects an integer from 0 (Sunday) to 6 (Saturday).  Fair enough, here's a little function that does it:

(defun tomorrow-day ()
  "Returns the day of the week for tomorrow."
  (let ((day (1+ (string-to-number (format-time-string "%w")))))
    (if (= day 7)
        0
      day)))

I'm stuck at the following point.  Following this prior thread, I've pushed this function onto the parse-time-weekdays alist:

(push `("tom" . ,(tomorrow-day)) parse-time-weekdays)

Here's the problem: quasi-quoting pushes the literal value that tomorrow-day returns only at the time it was first evaluated (so, if today is Monday, tom refers to day number 2 from here to eternity).  Instead, I need tomorrow-day evaluated each time I invoke tom when entering a timestamp.  Why?  Because I commonly leave an Emacs session running for days at a time, meaning that tom no longer refers to "tomorrow" after the day on which it was evaluated.

I've tried various forms of quoting and quasi-quoting, and eventually got quite silly with an intricate combination of funcalls and evals, all to no avail.

So: how do I get this function (tomorrow-day) evaluated every time I enter tom in a timestamp?


texts: How to increase a magic number in a file buffer on each save

texts:
I want to change a magic number (or a time stamp) in a file buffer on each save. The position of the magic number in the buffer can be given through a regex with a keyword or similar.

Is there any package for this? I tried auto-insert which comes with Emacs 26, but this seems to only update on file buffer creation, not on each save.

I preferably would like to enable this on a per-file basis through file local variables.

I tried a custom hack via before-save-hook, but struggled to add a function to this hook through afile variable declaration.


texts: How to kill (C-x k) ediff's (A,B,C) buffers automatically on each ediff-quit?


texts: Export to PDF with index bookmarks and unnumbered sections

texts:
I want to export my .org file to pdf, with a table of contents. But I don't want the table of contents to be printed in the first page of the document.
Rather I want the table of contents to be embedded in the pdf file as bookmars. For example, see the figure:

How do I do this?

Update:

Currently the first lines of my .org file look like this:

#+OPTIONS: num:nil
#+OPTIONS: toc:nil

If I remove the #+OPTIONS: num:nil option, I get the desired PDF index (thanks @NickD). But then the sections get automatic numbers which I want to remove.

Is there a way to get the PDF index, and also remove section numbering?


texts:
I started a new question on this topic yesterday, and deleted it because I thought I had it solved. No, I'm still confused about exactly how require works. In my situation I have a file calctest.el in a path that load-path sees. Here is the simple file:

(defun calctest ()
  (calc-eval "deg(37@ 26' 36.42\")"))
(provide 'calctest)

Now, if I call (require 'calctest) in the scratch buffer, I get an error:

Required feature `calctest' was not provided". . .

This is even after a successful (load-library "calctest") and a test to see if it is loaded

(calctest) ==>
"37.44345"

But if I do a load-file on calctest.el, then do (require 'calctest) it "sees" it and "loads" it (again?). Why will a require not simply load my calctest? What am I missing here?


texts: Emacs: how to avoid line wrapping in buffer selection window?

texts:
I often use my Emacs frame split vertically. This makes a problem when I list  my open buffers (C-x C-b). The lines in the displayed buffer-selection list will wrap and the list becomes very untidy visually, like this:

If I hit M-x visual-line-mode the list become what I want it to look, easy tor read like this:

I need line wrapping in all my text files, but want to avoid it for the buffer-selection list.

How can I set visual-line-mode locally only for the buffer-selection list?


texts: Syntax highlight doxygen comments in C/C++? (c-doc-comment-style)

texts:
Is it possible to syntax highlight doxygen in C/C++ code?

QtCreator and Vim both support basic highlighting so \param, \note... etc are highlighted differently.


texts: How can I get emacs notmuch to format replies the same way gmail does

texts:
I have seen this question!
How to control quoting of original message when replying?

None of that actually works. When I am in notmuch and I hit r on a message there is no amount of message-cite-* variables I can have customized that will do anything about the way that reply to sender email is formatted.

Does anyone have this working? I want to reply from emacs and have messages look exactly as if I had sent them using the gmail app to the people receiving my emails. I want threaded conversations to work, I want folding of cited text to work. How can I make this happen? Am I even on the right track with these message-cite-* vars?


texts: "Negative" scrolling, or: actually recentering first line

texts:
Usually, there's some extra "virtual" space shown at the bottom of a buffer, which makes the visual appearance of a file longer than it actually is.  This is quite convenient, e.g., if you're trying to recenter (C-l) the last line: you will end up with it being actually in the middle of the window.

Is there an equivalent possibility for the beginning of a buffer?  Such that when I recenter the first line, it will show up in the middle of the window, and if I scroll to the top, I'll be able to "virtually" scroll above the first line?

A bit of context: I understand why such behaviour is unintuitive in most cases: scrolling to the top like this will give you a mostly empty window. But in my setup the non-existence of this is sometimes inconvenient: I have an overlay terminal showing up on the top of the screen, which can block code in the top half of a buffer.

An optimal solution would allow for two scrolling modes: one like the default, and one with negative scrolling, such that I can choose and bind what I like (which would be none for normal scrolling, but negative scrolling for C-l and something like M-<mousewheel>.


texts: Is it possible to use Emacs to read mail using IMAP without downloading them?

texts:
I have found that Emacs + mu4e + offlineimap can deal with reading emails from a remote server. However, in this case, what I understand is that the emails are copied locally. Having mailboxes with lots of messages I do not want them to use hard disk space.

Did I misunderstand the way offlineimap works or is there another solution to what I want to do ?

I am new to Emacs, thanks in advance.


texts: Org-Drill definitions: "drill item", "drill topic", "org topic"?

texts:
In this Overview of org-drill, what is the difference between "drill item", "drill topic", and "org topic"?

Here is a quote from the "Introduction" section:

  Each topic is treated as a "flash card". The material to be remembered
  is presented to the student in random order. The student rates his or
  her recall of each item, and this information is used to schedule the
  item for later revision.

Here is a quote from the "Writing the questions" section:

  Org-Drill uses org mode topics as 'drill items'. To be used as a drill
  item, the topic must have a tag that matches the value of
  org-drill-question-tag. This is :drill: by default.

  Drill items can have other drill items as children. When a drill item
  is being tested, the contents of any child drill items will be hidden.
  You don't need to schedule the topics initially. Unscheduled items are
  considered to be 'new' and ready for memorisation. How should 'drill
  topics' be structured? Any org topic is a legal drill topic –
  it will simply be shown with all subheadings collapsed, so that only
  the material beneath the main item heading is visible. After pressing
  a key, any hidden subheadings will be revealed, and you will be asked
  to rate your "recall" of the item.

The page contains 16 occurrences of "drill item", 5 occurrences of "drill topic", and 2 occurrences of "org topic".


texts: Best way to test output sent to a buffer

texts:
I'm writing an emacs package for Pipenv and the spike solution uses sync shell calls, which is not desirable for general usage. I'm now changing calls to be async (make-process) and for output to go to a dedicated buffer. This is all good and works. However, I now want to update my test suite. I'm not sure on the best (practice) way to:

Wait on the output of make-process for testing purposes. I am using accept-process-output but it does not return the actual output, only t.
Related, perhaps provide a custom filter for use in testing that collects the output into a value I can return and do assertions against.

What is the best way to test output that is normally sent to a buffer via an async shell command call?


texts: How to get path to library installed through elpa

texts:
I have Emacs installed on multiple machines, and every time I install yasnippet through elpa. As it's version changes, it is being installed into different directories. For example:

#first machine
~/.emacs.d/elpa/yasnippet-20170518.1753
#second machine
~/.emacs.d/elpa/yasnippet-20170828.1908

In ~/.emacs I have the following code:

(defvar *my-emacs-lib-dir* "d:/bin/cygwin/home/user/.emacs.d/")
(defvar *yasnippet-dir* "~/.emacs.d/elpa/yasnippet-20170518.1753")
(load-file (concat *my-emacs-lib-dir* "bootstrap-init.el"))

in bootstrap-init.el I load yasnippet library:

(load (concat *yasnippet-dir* "/yasnippet"))
(yas/global-mode 1)

Is it possible to get path to installed yasnippet library from elpa database? So I won't need to modify *yasnippet-dir* on every machine?


texts:
I started using Emacs a few days ago and facing the problem.
I use "M+ 1mn" for programming so I set this for Emacs. But It looks thicker than usual.(in Geany, VSCode, Xfce Terminal ...)

How do I fix that?

Relevant part from init.el

(when (member "M+ 1mn" (font-family-list))
  (add-to-list 'default-frame-alist '(font . "M+ 1mn-12")))

https://pastebin.com/4ducG3PH
This is my init.el.

Left is Emacs and right is Neovim with Alacritty.

Version: 26.3
OS: ArchLinux (kernel: 4.19.72-1-lts)
WM: i3wm


texts: How to highlight references of local functions and variables?

texts: I want my local function names (those declared in the current file and picked by font-lock-function-name-face) and my variable names (font-lock-variable-name-face) to be highlighted across the whole buffer. Currently font-lock-function-name-face and font-lock-variable-name-face highlight only declarations and not references.


texts: org-emphasis-alist, add additional symbols?

texts:
i know there are other posts out there but i couldnt find an answer to this. is there anyway with latest org (8.3) to add additional symbols to the org-emphasis-alist? i tried for example adding the ! symbol but i cant seem to get it to work

(setq org-emphasis-alist (quote (("!"  (:foreground "red") )
             ("/" italic "" "")
             ("_" underline "" "")
             ("-" (:overline t) "" "")
             ("=" org-code "" "" verbatim)
             ("*" org-verbatim "" "" verbatim)
            ("+" (:strike-through t) "" ""))))

any clue?

alternatively, maybe another approach is to use perhaps the font-lock like this which i use now:

(font-lock-add-keywords
 'org-mode
'(("\\(@[^@\n]+@\\)" (0 '(:foreground "#B40000" :background "#FFDDDD" :weight bold) t))))

yet is there a way to hide the start-end symbols like in org-hide-emphasis-markers option?


texts: Weird behavior of LaTeX-section-label for chapter

texts:
The default value of LaTeX-section-label is:

(("part" . "part:")
 ("chapter" . "chap:")
 ("section" . "sec:")
 ("subsection" . "sec:")
 ("subsubsection" . "sec:"))

However, for chapter, when typing C-c C-s, we get cha instead of chap:.

\chapter{asdf}
\label{cha:asdf}


texts: emacs split window doesn't avoid other pane content

texts:
I'll get terminology wrong here, so be gentle with that (only).

cd ~/src/
./emacs *
C-x 2

So I've got two windows here, one above the other, and a bunch of files in my buffer list (more than 2).  When I C-x k to kill the buffer that I'm in, of course its window then shows another buffer from my open list.

From 1997 to 2014, or so, Emacs has worked hard to avoid the buffer I also have open in another pane (which is usually awesome).  Recently though, when I use C-x k Emacs just loads whatever the next-most-recently-used buffer was into the selected window .. and that's usually the buffer I already have open in the other pane.  So then it looks like:

--top-bordery-border--
file #1 stuff
-UUU:%--F1- [mode] ---
file #1 stuff
-UUU:%--F1- [mode] ---

... which can be called Silly, most times.

Has anyone who can understand my bad description, who's seen that behaviour, know how to get the older behaviour back?


texts:
What is the best way to use conda environmets using emacs as a Python IDE?

I have got different conda environments while programming in Python:

$ conda info -e
# conda environments:
#
django                   /Users/Pablo/anaconda/envs/django
scipy                 *  /Users/Pablo/anaconda/envs/scipy
visual                   /Users/Pablo/anaconda/envs/visual
ml                       /Users/Pablo/anaconda/envs/ml
root                     /Users/Pablo/anaconda

But when I use crtl+c crtl+c emacs only uses my the Mac OS X default Python PATH. How can I chage it between all the different conda environments?


texts: problems connecting to an emacs daemon on RHEL

texts:
I am running into problems creating and connecting to an Emacs daemon on RHEL 6. I am using Emacs 23.1.1.

The daemon starts correctly:

emacs --daemon=foo
...
Starting Emacs daemon.

… but when I try to launch a client against it I get:

$ emacsclient -f foo -t
emacsclient: connected to remote socket at 255.255.255.255
emacsclient: connect: Network is unreachable
...
Starting Emacs daemon.
Unable to start the daemon.
Another instance of Emacs is running the server, either as daemon or interactively.
You can use emacsclient to connect to that Emacs process.
Error: server did not start correctly

Error: Could not start the Emacs daemon

I tried to find the port Emacs listens to by way of lsof:

$ ps aux | grep -i emacs | grep -v grep
mperdike 19396  0.3  0.4 259832 17596 ?        Ss   18:21   0:00 emacs -nw --daemon=foo
$ lsof -Pan -p 19396 -i
$

… but as can be seen in the screen above lsof didn't produce any output (maybe that's because I am not a sudoer).


texts: What is the correct way to pop up a window with a message, and locally bind a key in that buffer?

texts:
What would be the proper way to pop up a window (preferably in the current frame),with a message? I also want to locally (in that buffer only) the q key to a function that will kill the buffer and the window (similar to what is done in IELM's error pop-ups, but it won't be an error pop-up).

I have tried this:

(defun kill-buffer-and-window ()
  (kill-this-buffer)
  (if (not (one-window-p))
      (delete-window)))

(defun cool-message ()
  (interactive)
  (pop-to-buffer "*cool-message-buffer*")
  (use-local-map (make-sparse-keymap)) ; don't change bindings for other buffers
  (local-set-key "q" 'kill-buffer-and-window)
  (insert "Yo!!!"))

(local-set-key "x" 'cool-message)

I know that local-set-key will change the binding for all buffers using the same major-mode -- this is just a quick hack to show what I want.

The problem is that hitting q in the buffer that pops up will not kill it.

What did I miss?  Do I need to create a minor mode?


texts: org-edit-src-code Do not pop a new window, use the current one

texts:
When I call org-edit-src-code to edit a SRC code on a buffer with the proper major mode, I get a new window configuration.

For example, if I have windows 1|2, org-edit-src-code will delete window 2 and split window 1 horizontally.

How can I have org-edit-src-code reuse the window from the org file and leave all other windows alone? In other words, I'd like org-edit-src-code to work as a narrowing command.


texts: Run a TypeScript interpreter in an inferior process window

texts:
Are there any alternatives to ts-comint.el?
https://github.com/emacs-typescript/ts-comint
It's old and unmaintained.
I'm using tide, but I don't see how I can transpile/evaluate the code directly from emacs. Are people switching to a terminal to compile and run or are there some ways I haven't discovered yet?;)


texts: How to make sure that long lines are displayed full (without truncation) in Org Mode?

texts:
Imagine I have a line that is longer than the available space. I want this one physical line to be displayed as multiple ones (so that I can see it in full without scrolling). In the screenshot below you see one logical line displayed as two (red rectangle):

When I open the same file in Emacs, Org mode, type :vsp, then that same line is truncated:

How can I make sure that this line is displayed in Emacs like it is in Vim (see screenshot above)?

I tried the following:

Adding (setq-default truncate-lines nil) to .emacs file as suggested here (then restarting Emacs).
M-x auto-fill-mode or M-x fill-region as suggested here.

None of this helped.


texts:
Every time I open a new file in emacs, hl-line-mode is enabled. I have put

(global-hl-line-mode -1)
(hl-line-mode -1)

in my init.el, but to no avail. What am I doing wrong???


texts: Emacs -nw prints Turkish characters incorrectly

texts:
I use Emacs 25.2.1 on a Windows XP Laptop with a Turkish keyboard.
Problem
On emacs -nw the following (non-ascii) letters print incorrectly:
Letters such as 'ö' and 'ü' which are also used in German and letters which are presumably Roman or Polish/Slavic such as 'ç' and those letters which are AFAIK only to be found in Turkish such as 'ğ' and 'ı' (i without dot)
When I open GUI Emacs there are no problems but when I open Emacs in tty mode (emacs -nw) when I press
   ş prints _
   ı prints 1 (as number)
   ğ performs the `undo` or `redo` actions

Also

Other non-ascii letters common to other languages, as ç ü ö print all correctly.

Using the Windows' built-in cmd.exe or ConEmu or CMDer for emacs -nw makes no difference

Changing Windows' code page chcp.com 1254, 1256 or 857 doesn't help either.

If I chcp.com 65001 (Windows' UTF8 code) then all characters in Emacs print incorrectly.

Note:
When I copy and paste Turkish characters into emacs nw it prints them correctly. So the problem happens only when pressing the letters from the keyboard.
Question
How to fix this problem?


texts: Error when using spell-checker in Portuguese

texts:
I wrote a text file in Portuguese. I have changed my dictionary to portugues. I tried to spell-check buffer and I get the following error message:

Starting new Ispell process aspell with portugues dictionary...
ispell-init-process: Error: Expected language "pt_PT" but got "en".


texts: What's the name of this relative line number package?

texts:
The relative line number style in url below would be very useful for me.

How can I replicate Vim's code folding?

This package shows the number of current position, not just 0.
Both sides of the current line shows relative numbers as usual.
I like it.

Should I modify downloaded relative line numer package or is there any package which already supports this function?


texts: How to read elisp file into s-expression?

texts:
I have a file of elisp code, say foo.el. I want to turn the content into a s-expression, so that I can play with it. Right now, I use the following method:

Read foo.el into a string.
Turn the string into a s-expression using read.

The code is as followed:

(read (format "(progn %s)"
              (with-temp-buffer
                (insert-file-contents "foo.el")
                (buffer-string))))

The above code works, but is there a simpler, more direct method of reading elisp file into s-expression?


texts: How do I generate & tangle source code in a different language?

texts:
In an org file, I have a Perl source code block that generates SQL code.  The Perl code is to be part of the exported document, but the SQL code is not; it is supposed to be tangled to the corresponding output source code file only.  If my source block is as follows:

#+BEGIN_SRC perl     :results output verbatim code replace   :exports code
:tangle no  :eval yes
  #!/path/to/perl

  # Do some computations, generates some SQL code.
  print "INSERT INTO mytable (id, num1, num2) VALUES";
  my $comma = '';
  for (my $i=1; $i<=4; $i++)
  {
      my $n1 = 20 + rand(20);
      my $n2 = 60 + rand(60);
      printf "$comma\n    (%5.2f, %6.2f)", $n1, $n2;
      $comma = ',';
  }
  print "\n";
#+END_SRC

Then when I evaluate the block with C-c C-c, the following results block is inserted:

#+RESULTS:
#+BEGIN_SRC perl
INSERT INTO mytable (id, num1, num2) VALUES
    (1, 21.03,  77.17),
    (2, 28.68,  83.04),
    (3, 31.16,  99.71),
    (4, 21.68,  88.94)
#+END_SRC

The problem is the +#BEGIN_SRC perl line.  I want it to be

#+BEGIN_SRC sql    :eval no    :tangle yes    :exports none

The only way I've been able to do this is by changing the code header in the
Perl source block to raw, and adding explicit Perl statements to generate the org headers for the output block:

#+BEGIN_SRC perl     :results output verbatim raw replace   :exports none   :tangle no  :eval yes
  print "#+BEGIN_SRC sql  :eval no   :tangle yes  :exports none\n";
  # ...REST OF CODE AS ABOVE, THEN:
  print "#+END_SRC\n";
#+END_SRC

This does generate the results code block I want, but it seems clumsy and ugly.  Also, the hacky print statements are exported to the output document as part of the Perl code block.  Is there a more elegant way to specify header options on a generated source code block?


texts:
Sorry for the greenness of this question but I am starting with Org mode to replace Markdown and I don't really understand org/: what to do with / what the org directory is?
I looked through some basic tutorials and the Org website but I couldn't find anything concrete. I have a git repo that I store notes in (.md files) and I have started adding .org files to this repo. Is this alright or do all files have to be in the org directory?


texts: Hide \author, \date, and \title when exporting to pdf with org-latex-export-to-pdf

texts:
I am very new to LaTeX and exporting org-mode files to pdf. When I run the command org-latex-export-to-pdf it adds a title, author name, and date to the top of the exported pdf. Looking at the generated LaTeX, I assume that comes from the lines:

\author{Ethan Skinner}
\date{\today}
\title{My Title}

How can I export a pdf without these properties? I have tried using both the
VISIBLE-ONLY and BODY-ONLY arguments to org-latex-export-to-pdf, but this didn't work for me


texts: Using DeskTop for basic project management

texts: I would like to use DeskTop for basic project management, i.e. opening a set of buffers and restore histories depending on the project I am working on. Is this possible, i.e. having one desktop file in a project directory and how can I achieve this?


texts: Truncate beginning of right-aligned column in org table

texts:
I have a column in an org-mode table that contains long file names.  The interesting part of the filename is the last few characters rather than the first.  For example, given the files below:

/data/capture/abcd_spectrum_01292000.dat
/data/capture/abcd_spectrum_02251435.dat
/data/capture/abcd_spectrum_02251847.dat
/data/capture/abcd_spectrum_02251848.dat
/data/capture/abcd_spectrum_02251848.dat
/data/capture/abcd_spectrum_02251849.dat
/data/capture/abcd_spectrum_02251851.dat
/data/capture/abcd_spectrum_02251852.dat
/data/capture/abcd_spectrum_02251852.dat
/data/capture/abcd_spectrum_02270910.dat

I want my org table to look like this:

|            File | TD | FD | MF | Notes:               |
|-----------------+----+----+----+----------------------|
|           <r15> |    |    |    | <l20>                |
| <=_01292000.dat |    |    |    |                      |
| <=_02251435.dat |    |    |    |                      |
| <=_02251847.dat |    |    |    |                      |
| <=_02251848.dat |    |    |    |                      |
| <=_02251848.dat |    |    |    |                      |
| <=_02251849.dat |    |    |    |                      |
| <=_02251851.dat |    |    |    |                      |
| <=_02251852.dat |    |    |    |                      |
| <=_02251852.dat |    |    |    |                      |
| <=_02270910.dat |    |    |    |                      |

But instead it looks like this:

|            File | TD | FD | MF | Notes:               |
|-----------------+----+----+----+----------------------|
|           <r15> |    |    |    | <l20>                |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |
| /data/capture=> |    |    |    |                      |

Is it possible to make right-aligned columns truncate to the left, so that I can see the right-most part of the entries?


texts: How to highlight graphql template literals (gql) in js(x) files?

texts:
Inside of a jsx file, I want to use a gql template literal to define GraphQL queries.

Could I in emacs make that section of the jsx file highlight graphql syntax, instead of just showing it as a plain string?

Example:

import gql from 'graphql-tag'

const normalJavascriptCode = 42

const query = gql`
  here(a: 1, b: 2) {
    itWouldHighlightSyntax
    accordingToGraphQLMode
  }
`

const jsHighlightBackagain = () => {...}

Here you can see how it works for atom: https://github.com/apollographql/graphql-tools/issues/123#issuecomment-244830016


texts: org verse blocks: indentation not preserved on export to odt

texts:
the org manual says "To preserve the line breaks, indentation and blank lines in a region, but otherwise use normal formatting"
you can use #+begin_verse #+end_verse block.
if i run emacs -Q, open a new file, add this example:
#+BEGIN_VERSE
Great clouds overhead
Tiny black birds rise and fall
Snow covers Emacs

   ---AlexSchroeder
#+END_VERSE

then export to odt using the dispatch with not alternate odt styles file specified, the output in odt looks like this:
Great clouds overhead
 Tiny black birds rise and fall
 Snow covers Emacs

   ---AlexSchroeder

i.e. a space is inserted at the beginning of every new line except the first.
this problem does not appear if you have #+options: \n:t set, but that using option breaks indentation on export for me too (it reduces all indentations to a single space).


texts: Unable to install pdf-tools on spacemacs

texts:
Running Spacemacs 0.300 on Emacs 27.2.
When I try installing pdf-tools by adding pdf-tools to dotspacemacs-configuration-layers, it produces an error:
* Testing settings in dotspacemacs/layers [[file:/home/sandip/.spacemacs::dotspacemacs/layers][Show in File]]
** TEST: Each path in [[file:/home/sandip/.spacemacs::dotspacemacs-configuration-layer-path][dotspacemacs-configuration-layer-path]] is a string
** TEST: Each path in [[file:/home/sandip/.spacemacs::dotspacemacs-configuration-layer-path][dotspacemacs-configuration-layer-path]] exists in filesystem
** TEST: Each layer in [[file:/home/sandip/.spacemacs::dotspacemacs-configuration-layers][dotspacemacs-configuration-layers]] can be found
*** PASS: auto-completion
*** PASS: emacs-lisp
*** PASS: git
*** PASS: helm
*** PASS: latex
*** PASS: multiple-cursors
*** PASS: org
*** FAIL: pdf-tools
*** PASS: spell-checking
*** PASS: themes-megapack
** RESULTS: [[file:/home/sandip/.spacemacs::dotspacemacs/layers][dotspacemacs/layers]] passed 9 out of 10 tests

How do I install pdf-tools?
By the way, I need it just so that I can view the pdf files produced from my tex files right here in emacs. So, if there is another solution to achieve this, do let me know.


texts:
uname -a Linux antixbox 4.9.235-antix.1-amd64-smp #1 SMP PREEMPT Mon
Sep 14 19:26:52 EEST 2020 x86_64 GNU/Linux

emacs --version GNU Emacs 27.1

echo $SHELL /usr/bin/zsh

I'm trying to get the following to work:
em() {   emacs $1 -geometry "56x23" }

I want to use it as follows e.g. with an existing file:
em testfile.txt

Emacs does launch, but no file buffer.
If I edit the function and replace nano for emacs (and get rid of the geometry stuff), the function works perfectly.


texts: org agenda not loading org-agenda-files funkiness

texts:
My config file has the following funkiness:
I have the line (setq org-agenda-files '("~/org/tktodos.org" ))
followed by the line (org-agenda nil "a").
When my org file loads, I can see my todos in my agenda. If I then press C-h v org-agenda-files, the value is set to nil, so if I exit and reopen, none of my todos will show.
If I move the line (setq org-agenda-files '("~/org/tktodos.org" )) to the very end of the config file, nothing changes.
If I re-evaluate the line (setq org-agenda-files '("~/org/tktodos.org" )), org-agenda works again. What's going on?


texts: How to get the raw data for an org-mode agenda without an agenda view?

texts:
Q: How can I have org-mode return the raw data for an agenda view without actually creating an agenda view?

I'd like to access my agenda for an arbitrary day.  However, I do not want to create an agenda view per se.  Instead, I want org-mode to collect and sort all of the elements that would go into the agenda view for that day and return them (ideally in a list) for further inspection and manipulation.

I had presumed that org-agenda-list would be the place to start.  However, that function is a tangled beast and seems to intermingle the collecting, sorting, and displaying processes.  As such, I presume (hope?) that I've simply missed the relevant function somewhere that provides the functionality I'm after.


texts: Completing underscored words without making _ a word character

texts:
I would like to use evil-complete-previous (or whatever) to
complete strings_such_as_this, which is by default not possible.
It is possible after (modify-syntax-entry ?_ "w"), but this
has the undesired side-effect of rendering it impossible to jump
from the beginning of the string to the third s with
(evil-forward-word-begin) (w).  Can I get the effect without
the side-effect?


texts: org-mode table exports centered - change to left?

texts:
I'm exporting a simple org-table through LaTeX to PDF:

| a | b | c |
| 1 | 2 | 3 |

After export with C-c C-e l o the PDF contains a centered table, and I'd rather have it on the left (to be clear, I'm referring here to the table as a whole, not the positioning of elements in individual cells).

I'm not an expert at LaTeX. I've looked at :float and :placement in the Org manual here and haven't been able to affect the outcome. How could I accomplish this?


texts: How to set the background of color-hex-values with corresponding color in all modes (like in css-mode)?

texts:
In css-mode color strings get a background color corresponding to the respective color - like this (image):

How to achieve this behaviour in other modes?


texts: Why does the background of the text not correspond to the background color of the frame?

texts:
If you look closely there is a background on the text that is different than the frame background.

Does anybody know why this happens? According to the manual (if I read it correctly) it says that they should be the same. I've tried changing the default-face but to no avail.

The theme is the moe-theme.

Dotfiles are at https://github.com/zackp30/dotfiles/blob/master/home/.emacs.d/config.org if somebody who is brave enough to try and debug them...

This also happened with the material theme.

EDIT:

So, after trying the suggestions answered, I recompiled Emacs using --with-x-toolkit=lucid and the problem disappeared, so it appears to be a problem with Gtk, is there any solution for this? I found this out via the #emacs channel @ freenode. The OS is openSUSE 13.2.

EDIT 2:

Disregard the previous edit; when using Emacs as it is (as in, not as a daemon) it's fine and has the right colors), but when I am using it as a daemon it has the issue displayed previously. Very very weird...

EDIT 3:

Gah! Forgot about the fact that I reproduced it in an X11 window, with emacs -Q without using the daemon. I'll be submitting an Emacs bug.


texts: evaluate src blocks only if individually pressed and not if globally executed

texts: Is there a way to enable source block execution only if C-c C-c is pressed and keep them silent when C-c C-v C-b is used, i.e. all source blocks are executed?


texts: Get all regexp matches in buffer as a list

texts:
On the Code Golf Stack Exchange site today, I found this answer in Clojure to the question "Get all links on a webpage".

(->> (slurp "http://www.stroustrup.com")
     (re-seq #"(?:http://)?www(?:[./#\+-]\w*)+"))

Without the fancy macro, it's just this:

(re-seq #"(?:http://)?www(?:[./#\+-]\w*)+" (slurp "http://www.stroustrup.com"))

This returns the list:

("http://www.morganstanley.com/" "http://www.cs.columbia.edu/" "http://www.cse.tamu.edu" ...)

Can I do something similar in Emacs Lisp?

Perhaps a function like (re-seq regexp (buffer-string)) that returns '(firstmatch secondmatch thirdmatch ...)?


texts: Emacs can't find Node when Node was installed using NVM

texts:
I've got Node installed using NVM, and Emacs (v25.2.1) isn't able to find Node. When I run M-: (executable-find "node") I get back nil.

However, when I run M-: (executable-find "cat") I get "/bin/cat". I assume the difference is due to my use of NVM.

How do I get Emacs to find Node when I've got Node installed using NVM?

Incidental technical details:

My Emacs was installed using MacPorts (using the emacs-app package that installs to the Mac Applications folder for a GUI experience), and I've got the following lines in my ~/.bashrc:

export NVM_DIR="/Users/fred/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

My ~/.bash_profile contains source ~/.bashrc.

I'm not sure if this is relevant to the problem, but I should mention that when I open M-x eshell, I get the following when trying to run Node:

$ node
node: command not found

However, I am able to run Node through M-x shell.

I did have limited success installing the emacs package (as opposed to the emacs-app package) from MacPorts. Using the Emacs from the emacs package (which installs to /opt/local/bin/emacs), I was able to evaluate in the scratch buffer:

(executable-find "node")

And successfully got the path to node. However, this same lisp expression evaluated in the Emacs from the emacs-app package yielded nil. This doesn't help me much, because I want to use the emacs from emacs-app, because it's the Emacs with the graphical interface for Mac, as I understand it.

I want to continue using NVM, please.


texts: Spacemacs: Code evaluation and security issue

texts:
I want to turn of the security confirmation for the R language, as described here:
http://orgmode.org/manual/Code-evaluation-security.html

So I tried putting the following code in the dotspacemacs/user-config () section of my .spacemacs:

(defun my-org-confirm-babel-evaluate (lang body)
            (not (string= lang "R")))
          (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)

This doesn't have any effect.

If I try to customize-varibale as elaborated on the link above, org-confirm-babel-evaluate, I always get an error saying that the function is invalid. I have tried combinations with and without the the setq command and with and without the brackets around the function.

I can turn off the org-confirm-babel-evaluate variable for all code blocks, and it works too, but that's not the ideal case as now any code block of any language would be executed.

Also, how would I add an additional language (say python) to the function above.

Any ideas?

I am new to emacs and am using the following version of spacemacs.
Using: 0.200.7@25.1.1 (spacemacs)


texts: How to scroll while using multiple cursor?

texts:
I use a lot multiple cursor and sometimes I have to select some words which are off the screen, in sublime text I do not encounter any problem, I can just scroll and continue selecting words.
This, incredibly, seems not possible in emacs! When I scroll the previous cursors get messed up.
You can see this behaviour in the gif I have uploaded.
This may help: Let Emacs move the cursor off-screen

Sublime Text behaviour:

emacs behaviour:


texts: Is it possible to define source block switches globally in org mode?

texts:
I'd like to get line numbers displayed for all the source blocks in
Exported file ( html/pdf)

For a particular souce block,  I got to add the switch -n to the source block
e.g.:

#+BEGIN_SRC C++ -n
  #include<iostream>
  using namespace std;
  int main() {
      cout<<"Hello World";
      return 0;
  }
#+END_SRC

Is it possible to add this switch globally in properties drawer or any better way?
So that I don’t have to add switches like these on all the source blocks..


texts:
Is there a simple configuration to get org-babel to invoke cmd.exe that doesn't involve modifying the org-babel source?

Googling for ["org-babel" sh "cmd"] finds this email list discussion from 2010: Re: [Orgmode] org-babel-sh and Microsoft Windows

but that looks like a blanket solution, not one that could be applied on a per-block or per-file, as I'd want to able to run sh/bash too.

(This is for literate DevOps of windows servers, so "use sh/bash/zsh" is unfortunately not a option.)


texts: Disable evil-mode when git-timemachine mode is activated

texts: How do I disable evil-mode in a buffer in which git-timemachine is activated?


texts: Can turning on lexical binding in a legacy init file cause problems?

texts:
AFAIK turning on lexical binding only affects the current buffer. But if I add lexical scoped code to my crusty old init file which have load and require statements in it (not everything is autoloaded) then turning on lexical scoping in the init file can affect the loaded and required files too which can cause problems if those codes are not lexically scoped.

Is this correct?


texts: How to make (make-symbol "foo") (make-symbol "foo") equal?

texts:
I'm curious why:

(equal (make-symbol "foo") (make-symbol "foo"))

ends up beeing nil.

While

(equal 'foo 'foo)

is t.

Do i have a misconception of symbols?
Aren't they just strings without double-quotes?


texts: Why does `helm-find-files` change behavior depending on my current location?

texts:
Normally when I run helm-find-files I'm immediately shown a list of files in the current directory. Sometimes, however, helm just gives me an empty window. I can start navigating my filesystem in that window like normal, but I have to start navigation from the root of my filesystem. It's as if helm didn't/couldn't figure out the directory of the file I'm editing.

For example, I see this problem if my cursor is at the very beginning of a typical HTLM file:

<!doctype html>
^ point is here

or at the end of a line with a meta tag:

    <meta charset="utf-8">
                          ^ point is here

If the point is anywhere else in those lines, helm-find-files works as expected. In those positions, though, it seems like helm gets confused.

So my question: Is this expected behavior? I know that helm is complex (heck, it's probably self-aware), and it may well be that this is the "correct" behavior somehow. If this is expected, can someone explain why? I just need a better mental model of what's going on.

If this is not expected behavior, I'll likely file an issue with helm. I just wanted to do some due diligence before that, though.


texts: Spacemacs Clojure Cider Debugger Gives Error, "No reader function for tag dbg"

texts:
After connecting Cider to Spacemacs, when trying to set a debug breakpoint on a function using ,-d-b (cider-debug-defun-at-point), I see the following message in the *cider-error* buffer.

3. Unhandled clojure.lang.ExceptionInfo

2. Caused by clojure.lang.LispReader$ReaderException

1. Caused by java.lang.RuntimeException
   No reader function for tag dbg


texts: How can I prevent org-mode reading agenda files when started?

texts:
My org-mode agenda files are on a remote machine, accessed via ssh using tramp.  When org-mode starts it always reads this file, which is inconvenient as it makes opening any org file very slow.  I would prefer for it to read the agenda files only when I actually look at the agenda.  Is there a way to do this?

My .emacs currently sets the agenda location in this way:

  (setq org-agenda-files '("/-:somehost:somefile.org"))


texts: How to replace first 100 digits with letters?

texts:
I want to replace the first 104 digits as it follows:

1    -->   a
...
26   -->   z
27   -->   aa
...
52   -->   az
53   -->   ba
...
104  -->   bz

I have tried as it follows:

(defun digits-to-letters ()
  (interactive)

  (goto-char (point-min))

  (save-excursion
    (save-restriction
      (narrow-to-region (search-forward "\\title" nil t)
            (search-forward "\\abstract" nil t))

      (goto-char (point-min))

      (while (search-forward-regexp "\\([0-9]+\\)" nil t)
      (setq digit (match-string 0))

    ;; 1-26 to a-z
    (if (< digit 27)
        (perform-replace digit
                 `((lambda (data count)
                     (string (+ (1- ?a) digit))))
                 t t nil 1 nil (point-min) (point-max))

      ;; 27-52 to aa-az
      (if (and (> digit 26)
           (< digit 53))
           (perform-replace digit
                   `((lambda (data count)
                      (string (+ (1- ?a) (concat "a"
                                                  digit)))))
                   t t nil 1 nil (point-min) (point-max))

        ;; 53-104 to ba-bz
        (if (and (> digit 52)
             (< digit 105))
             (perform-replace "\\([0-9]+\\)"
                 `((lambda (data count)
                     (string (+ (1- ?a) (concat "b"
                                                digit)))))
                 t t nil 1 nil (point-min) (point-max))
          )))
    ))))

It gives me the following error:

Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p #("1" 0 1 (fontified t)))

P.S. I have just asked something like this, but for the first 26 digits: How to replace a digit by a letter?.

Updates

There is a mistake in the correspodence between digits and letters:

53   -->  ba
...
78   -->  bz
79   -->  ca
...
104  -->  cz

I have corrected my code as it follows:

(defun digits-to-letters ()
  (interactive)

  (goto-char (point-min))

  (save-excursion
    (save-restriction
      (narrow-to-region (search-forward "\\title" nil t)
                (search-forward "\\abstract" nil t))

      (goto-char (point-min))

      (while (search-forward-regexp "\\([0-9]+\\)" nil t)
        (setq digit (string-to-number (match-string 0)))
        (setq sdigit (match-string 0))

        ;; 1-26 to a-z
        (if (< digit 27)
        (replace-match (string (+ (1- ?a) digit)))

          ;; 27-52 to aa-az
          (if (and (> digit 26)
               (< digit 53))
              (replace-match (concat
                              "a"
                              (string (+ (1- ?a) (- digit 26)))))

            ;; 53-78 to ba-bz
            (if (and (> digit 52)
                 (< digit 79))
                 (replace-match (concat
                                 "b"
                                 (string (+ (1- ?a) (- digit 52)))))

              ;; 79-104 to ba-bz
              (if (and (> digit 78)
                   (< digit 105))
                   (replace-match (concat
                                   "c"
                                   (string (+ (1- ?a) (- digit 78)))))

        ))))

    ))))

Now it works.


texts:
I am trying to re-define two functions in two-column.el.gz, namely 2C-split and 2C-merge. Both of those are declared with ;;;###autoload. I gathered I should use (eval-after-load "two-column" ...), because Linux (Ubuntu) won't let me change the original file.

I have this eval-after-load body in my .emacs file, more precisely in a settings.org file which I load from the .emacs. I have all my code here. When I do find-function after startup, I am shown this file (inside the eval-after-load bit). But then, when I do C-x 6 s, it's the original function which is called, not mine. And after that find-function sends me to the two-column.el.gz file.

I tried with-eval-after-load, I tried the full file path instead of "two-column", but nothing seems to work. after-load-alist doesn't even show my new functions, unless I specifically load the (eval-after-load ...) with C-x C-e - then there is an entry for it.

My questions are both how to load my functions without having to load the file explicitly (which also didn't quite work, but that's a different problem), and why this is happening. I simply do not understand.


texts: Show Timestamp for each TODO in Org Agenda Global Todo List?

texts:
Popular todo softwares nowadays usually list tasks with their scheduled due date attached by default so that we can have a general idea about the progress of our different projects. However in org agenda global todo list view (C-c a t) it seems that only the project and priority of the tasks are listed, without any of their timestamps(deadline, scheduled, or just normal timestamp). This makes the view much less useful because looking at tasks without due dates is not very helpful for me to arrange my work.

Default agenda view has dates but it doesn't offer an overview of all tasks, which usually span a long period of time beyond default agenda view timespan.

Is there a way to show timestamps associated with TODOs in global TODO list?


texts:
From the Elisp manual at the Sentinels chapter:

  The sentinel receives two arguments: the process for which the event occurred, and a string describing the type of event.

But I need it to receive one more argument, because at the end of the process, the context (like current buffer) may have changed.

(defun faustine-mdoc (&optional build-all)
  "Generate mdoc of the current file, display it in a buffer."
  (interactive)
  (let ((files-to-build (if build-all
                            (mapconcat 'identity (project-files (buffer-name) '()) " ")
                          (current-buffer))))
    (set-process-sentinel
     (start-process-shell-command
      "Mdoc"
      output-buffer-name (format "command %s" files-to-build)) 'mdoc-sentinel)))

(defun mdoc-sentinel (process event)
  "mdoc sentinel"
  (let ((pdf-file (format "%s-mdoc/pdf/%s.pdf"
                          (file-name-sans-extension
                           (buffer-name))  ; <- See? This is not the right buffer
                          (file-name-sans-extension
                           (buffer-name)))))
    (log-to-buffer process event)
    (when (string-prefix-p "finished" event)
      (faustine-show pdf-file))))

How can I pass arguments to a sentinel? More generally, how to pass arguments in a quoted function call?


texts: How to show a diff between two buffers with "character-level" diffs

texts:
When two buffers are compared for differences, M-x ediff-buffers does not indicate the specific characters that have changed within a word (ie "character-level" diffs). Most modern diff tools will show the diffs within a word.

Emacs seems to be missing this important (or obviously useful?) feature by default. How can I make Emacs display the diffs by character?

Update
Here's M-x ediff-buffers diff1 diff2, using emacs -Q to ensure that my theme is not interferring:

Here's the same text pasted into Meld:


texts: Export slide and handout version of same beamer slides in org subtree

texts:
I want to create an org file with all my beamer lectures notes for one course.

With the example below I can generate my slides for a specific lecture with subtree export by positioning point within the drawer and pressing C-c C-e C-s l P

(I have put common packages, etc., in the slides-preamble.tex file.)

* Lecture 1
  :PROPERTIES:
  :EXPORT_LaTeX_CLASS: beamer
  :EXPORT_LaTeX_CLASS_OPTIONS: [presentation]
  :EXPORT_BEAMER_THEME: default
  :EXPORT_FILE_NAME: L01-intro-slides.pdf
  :EXPORT_LATEX_HEADER: \input{slides-preamble.tex}
  :END:
** Lecture 1, Slide 1
   - Items
** Lecture 1, Slide 2
   - Items
* Lecture 2
  :PROPERTIES:
  :EXPORT_LaTeX_CLASS: beamer
  :EXPORT_LaTeX_CLASS_OPTIONS: [presentation]
  :EXPORT_BEAMER_THEME: default
  :EXPORT_FILE_NAME: C02-fundamentals.pdf
  :EXPORT_LATEX_HEADER: \input{slides-preamble.tex}
  :END:
** Lecture 2, Slide 1
   - Items

However, I would also like to be able to generate a handout set of my slides. I could change some of the properties to

  :EXPORT_LaTeX_CLASS_OPTIONS: [handout]
  :EXPORT_FILE_NAME: L01-intro-handouts.pdf
  :EXPORT_LATEX_HEADER: \input{handouts-preamble.tex}

and re-export (handouts-preamble.tex would containt, e.g.,
 a \pgfpagesuselayout command, etc.). However I would like a more streamlined solution. Can anyone help me? I have searched and found quite a few Q&A that relate to this, but none that describes how to export a subtree to different files with different attributes.

Emacs 24.5.2, Org mode 9.1.

EDIT:

After debugging org-beamer-export-to-pdf and friends I'm thinking along the lines of writing two functions that would call said function with different ext-plists. However, I'm not sure of the format of ext-plist. Can anyone share an example?


texts: Finding the source file containing the definition of functions and variables

texts:
Is it possible to merge find-function and find-variable to a
single find-function-or-variable to be able to search both functions and variables at the
same time and going to their definition in the same way as for find-function and find-variable?
(possibly with the ability to use
TAB completion like the original find-function and find-variable and choosing between two options when a function and a variable bear the same name as remarked by @lawlist).


texts:
How can I perform the equivalent of M-x sort-columns with a stable sort?

For example, let's say my text is:

a 99
b 98
b 97
a 96
a 95
b 94
a 93
b 92
c 91
...

And I want to perform a stable sort against the first column.

With sort-columns I would put mark at the beginning of the buffer, put point in the last line just after the first column, and M-x sort-columns RET.

My problem is that this sort is not stable.  The output is:

a 93
a 95
a 96
a 99
b 92
b 94
b 97
b 98
c 91

Whereas I need to keep the line order for each first column:

a 99
a 96
a 95
a 93
b 98
b 97
b 94
b 92
c 91

How could I do that?  Is there a hidden option in sort-columns?  Or is some Elisp necessary?  I know sort --stable could do the trick but I want a solution that works on Windows where the sort command-line tool is absent.


texts: I love dired, but sometimes (particularly when filming screencasts) I want to see the tree-structure of a directory and its children, a la the tree(1) command. Is there a tree-oriented directory browser for Emacs?


texts:
I would like  to always trigger company suggests. When I use:
(global-set-key (kbd "<tab>") 'company-complete))

It breaks ivy's completion in the minibuffer. How can I prevent this? I would like to set the above key binding globally, even for the scratch buffer, but not to break the current completion used in the minibuffer.


texts: C-d in java-mode not being overwritten by .emacs file

texts:
So I have a custom .emacs file that I have a series of key strokes bound to.  The specific key stroke that I'm speaking of is C-d which I have bound to left-word via the line (global-set-key (kbd "C-d") 'left-word)

This works fine for any major mode that I've used except for java-mode.  For some reason, when I'm in java-mode, the key becomes bound to c-electric-delete-forward.

Anyone have any idea as to why this key binding override works in all major modes except for Java?


texts: How do I hit the equivalent of `C-u` (of normal emacs) in Spacemacs?

texts:
According to the "Evilified modes" documentation [1], C-u gets moved to C-U, but when I try to hit that (Ctrl+Shift+u), my cursor still gets moved one page up, instead of starting a new long command.

[1] - http://spacemacs.org/doc/DOCUMENTATION.html#evilified-modes


texts: use .dir-locals.el to setup blacklist (based on projectile root) for ccls (c++mode server)

texts:
I use this setup to setup blacklists for ccls in my project:

(
(prog-mode (ccls-initialization-options . (:index (:blacklist [
"^/Users/xxx/proj/dir1/"
"^/Users/xxx/proj/dir2/(dir3|dir4)/"])))
)

How do I make it dependent on (projectile-project-root) instead?

This didn't work:

(
 (nil . ((eval . (progn
                   (require 'projectile)
                   (setq ccls-initialization-options (:index
                                                      (:blacklist
                                                       (vector
    (concat "^" (projectile-project-root) "dir1/")
    (concat "^" (projectile-project-root) "dir2/(dir3|dir4)/"))))))))))
)


texts: Is there a shortcut for \mathrm in AUCTeX?

texts: Is there a build-in shortcut for inserting \mathrm{} and putting the cursor between {} in AUCTeX?


texts:
Goal: unbind <C-return> key ONLY in dired mode in order to rebind it to dired-w32explore.
My configuration is using use-package with something like this:

(use-package dired
  :init
  (unbind-key "<C-return>" cua-global-keymap)
  :bind (:map dired-mode-map
              ("<C-return>" . dired-w32explore))

The key works in dired-mode as I want.
But I get the CUA key completely removed in the rest of modes.
Is it possible to unbind that key only for dired-mode?


texts: how to substitute SUPER keybindings in Emacs terminal mode?

texts:
In GNU Emacs GUI, I use the Mac Command key ⌘ as super: (setq mac-command-modifier 'super)

However, the ⌘ key does not send input to Terminal or iTerm2. Given this, is there a way to simulate the super key and still access my Emacs super keybindings from within terminal mode?

If I'm trying to do keybinding (kbd "s-s"), for instance, can I tell Emacs to look for some substitute, like maybe EscEsck or something? Or even a key-chord like (key-chord-define-global "SS" 'super-modifier)?

Note: I also have keybindings that combine super with other modifier keys, e.g. (kbd "s-S-k"), i.e. ⌘⇧K.


texts:
I don't know the main reason but once in a while emacs or git completely removes the content in a buffer/file that I am working on if the commit is not completed successfully.
After file's content is cleaned, file's undo-tree is not able to fetch the latest changes using emacs as well, instead its tree is completely cleaned. I am not able to find the latest changes I have and they do not show up in the history of the undo-tree
In the background: zsh's git auto-fetch is running, I am not sure would that have any affect.

=> Is there anyway to prevent for emacs to completely delete the content of a file? (I assume it is done in the emacs end since the undo-tree history is cleaned out too)
My setup:
(global-undo-tree-mode 1)
(setq undo-tree-auto-save-history t)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))


texts: Find/replace all files in a directory? (recursively)

texts:
One task I still end up using an IDE for is project wide find-replace.
The steps are as follows.

Select a directory to replace in(this could default to the projects root).
Select the file extensions to match(this could initialize from other extensions variables, eg ffip-patterns, projectile-other-file-alist).
Test the replacement, to see what it does.
Show all replacements, giving the option to skip some.
Execute or cancel the replacements for all files.

This is something I'm used to from an IDE, is there anything that gives similar functionality in Emacs.

Note that I've seen dired can almost do this, it's not too far from what I'm after, but requires opening and accepting changes in every file, the proceeding steps are a little cumbersome too, although I suppose they could be streamlined.
Reference: https://www.gnu.org/software/emacs/manual/html_node/efaq/Replacing-text-across-multiple-files.html


texts: magit: commit without whitespace-only changes

texts:
Is there a way to commit only the lines with non-white-space changes?

I have (add-hook 'before-save-hook 'delete-trailing-whitespace) in my .init.el and this usually helps me avoid committing trailing white spaces.

However, when I'm working on a project that does not care about those trailing white spaces, the setting makes a huge diff on files I've saved.  It might be possible to make the setting per project, but I'm looking for a way to tell Magit to handle it.

I've found a similar question for git proper at https://stackoverflow.com/questions/3515597.

git diff has a variety of options for white spaces --ignore-space-at-eol,
--ignore-space-change, --ignore-all-space, and --ignore-blank-lines.  It would be nice if we could select those options at magit's popup window.


texts: Gui won't start, throws an "Args out of range: 0, 100"

texts:
The only response I got is this:
Weird behavior: GUI won't start, but terminal emacs will

But he doesn't clarify on the solution. I have the same problem, my .Xdefaults and/or .Xresources causes the error

This is my .Xresources

*.color0: #1d2021
*.color1: #cc241d
*.color2: #98971a
*.color3: #d79921
*.color4: #458588
*.color5: #b16286
*.color6: #689d6a
*.color7: #a89984
*.color8: #928374
*.color9: #fb4934
*.color10: #b8bb26
*.color11: #fabd2f
*.color12: #83a598
*.color13: #d3869b
*.color14: #8ec07c
*.color15: #ebdbb2
!! Transparency (0-255):
*.alpha: 230

If I remove .Xresources emacs starts with no issue at all, but that meeses up with my i3blocks and i3 config