texts: Display multi-file org agenda as a sparse tree?

texts:
org-sparse-tree function lists selected information with the headline structure above it.
This is useful when the meaning of org headings depends on context:

SPC m T (org-show-todo-tree)

org-agenda function prints the headings out of context, which can make the headings incomprehensible:

SPC a o o s   Phrase: TODO (org-agenda, list all entries with keyword "TODO")

As far as I know, org-sparse-tree only works on one org file at a time.
While org-agenda is derived from multiple org files.

Is there a way to display an agenda as a sparse tree? (when the agenda is derived from multiple files)

Alternatively, I could combine all my org project files into one. Is that the "org-mode way"?
If not, I will customize org-mode after gaining more org-mode experience.

I am using Emacs 25.2.1 with Spacemacs, evil, and ivy on Linux.

The remainder of this question describes what I have tried so far.

googled: org-mode agenda sparse tree

I tried the org-occur-in-agenda-files function:

SPC a o /

Org-files matching: tasks.org
Searched 5 buffers; no matches for "tasks.org"

What should be entered after the "Org-files matching" prompt?

From my ~/.spacemacs file:

(setq org-agenda-files (list
                    "~/Documents/developer/editors/emacs/tasks_demo/proj1/notes1.org"
                    "~/Documents/developer/editors/emacs/tasks_demo/proj1/tasks.org"

                    "~/Documents/developer/editors/emacs/tasks_demo/proj2_per/notes2.org"
                    "~/Documents/developer/editors/emacs/tasks_demo/proj2_per/tasks.org"

                    "~/Documents/developer/editors/emacs/tasks_demo/tasks.org"
                    ))

This google search found none: "org-occur-in-agenda-files" "Org-files matching"

UPDATE_1

This works:
Search all the org files with org-agenda, and if a heading needs context, ENT on the heading, which opens the heading in the same window.
SPC b b (ivy-switch-buffer) *Org Agenda* returns window to the agenda.
Is there a faster way to jump back to agenda?
C-c & (org-mark-ring-goto) does not jump back to agenda.

This works:
Search all the org files with org-agenda, and if a heading needs context, mouse-3 on the heading, which opens the heading in another window.
But if another window is already open, that window's buffer is displaced.
Is there a way to open the agenda heading in a new window?


texts:
I would like to sort the dired buffer by a suffix in the file names. For instance, with the following buffer content:

/nixos/nix/store:
total used in directory 140344 available 17530560
drwxrwxr-t 1612 root  30000  1810432 Mar  4 21:41 .
drwxr-xr-x    4 root  root      4096 Feb  4  2015 ..
dr-xr-xr-x    5 root  root      4096 Dec 31  1969 01l09wxficgyw6yhd812xzxldxrp4yma-pangomm-2.34.0
dr-xr-xr-x    5 root  root      4096 Dec 31  1969 03afp0sdvnvj9aj8k18s7ikkh4pnzlij-perl-HTTP-Message-6.06
dr-xr-xr-x    4 root  root      4096 Dec 31  1969 04yx1lnhzbiy4hkwkhnw7cw2i6zmfhf4-xmlto-0.0.26
dr-xr-xr-x    3 root  root      4096 Dec 31  1969 0534201di00hs189hzvx8gv8kxgbl2q1-unit-script
dr-xr-xr-x    2 root  root      4096 Dec 31  1969 06g99nk2q4pjq4xx3p6qw77zxmnyr5rn-kmod-blacklist-3ubuntu1
dr-xr-xr-x    4 root  root      4096 Dec 31  1969 06l8iksb8mndiis047z5f7b1zaqc1i4a-feh-2.14
dr-xr-xr-x    4 root  root      4096 Dec 31  1969 06s10661ji3s3cwsmrxc38kx856jds8i-nixos-system-jrm.no-ip.org-16.03pre77568.40c586b
dr-xr-xr-x    5 root  root      4096 Dec 31  1969 06wqzjsbjlhimn18g9ah04klhslj8b04-libkrb5-1.14
dr-xr-xr-x    7 root  root      4096 Dec 31  1969 06xdwfrhbjwhgxcsp2d2qlxhkv3ck01b-gcc-4.9.3
dr-xr-xr-x    3 root  root      4096 Dec 31  1969 079ix6d3aarvjjh83r7vcc6nk9pjcb25-mesa-noglu-11.1.1-drivers
dr-xr-xr-x    2 root  root      4096 Dec 31  1969 07k6b606sxwfib3f1srbdi1pifpb9gj3-unit-firewall.service
dr-xr-xr-x    5 root  root      4096 Dec 31  1969 07yqgv4n248xrigrnk9xn7ami5dyz3q8-lzo-2.09
dr-xr-xr-x    5 root  root      4096 Dec 31  1969 09i3xn0lbi268354l9y2nm8302qc5dhg-poppler-qt4-0.36.0
drwxr-xr-x    2 30001 30000     4096 Mar  4 20:39 09jszxa0cdd65g7yxb64fc87dq7ayy5s-jwm-s1406
dr-xr-xr-x    6 root  root      4096 Dec 31  1969 0ac359cfc4a8kw95g494z0x5vn37vrqa-libwacom-0.15

the file names consists of a hash sequence, followed by an -, followed by a suffix (the really interesting part of the name). I want to sort by this last part.

How can this be achieved?


texts:
I'm using Spacemacs to develop a laravel + Vue application and I followed the steps in this configuration example to highlight syntax in Vue, but now every time Spacemacs starts it gives me this error:

  (Spacemacs) Error in dotspacemacs/user-config: Symbol’s function definition is void: lsp-make-traverser.

This is my dotspacemacs-user-config():

EDIT 1: Only the vue-mode example config.

(defun dotspacemacs/user-config ()

  (require 'vue-mode)
  (add-to-list 'vue-mode-hook #'smartparens-mode)

  (require 'lsp-mode)
  (require 'lsp-vue)
  (add-hook 'vue-mode-hook #'lsp-vue-mmm-enable)
  (with-eval-after-load 'lsp-mode
    (require 'lsp-flycheck))

  (require 'company-lsp)
  (push 'company-lsp company-backends))

OS: Ubuntu 18.10

Emacs: GNU Emacs 25.2.2

Spacemacs: 0.200.13

Here is my dotspacemacs


texts: How to automatically set indent width (e.g. c-basic-offset) based on edited file?

texts: I often work on several different codebases that use different indent styles (2 spaces vs 4 spacces vs tabs...). It is annoying to set c-basic-offset (or other variables, depending on mode) each time I open new file. Is there a package (or setting) that makes Emacs detect indentation style of opened file?


texts: Modes have no effect unless I deactivate and activate again

texts:
I'm extremely new to emacs (started using it yesterday),
I use the latest version of emacs.
The problem is, The modes I have enabled such as auto-complete-mode and org-bullets-mode seem to be enabled at launch. But i don't see their effect on screen unless I turn them off and on again (I'm not sure if the tex global pdf mode has activated either).
Since, I'm a beginner . I'm pretty sure this is horrible code writing on my part. So, A bit of insight into what went wrong and few resources into how to set it up would be a lot more helpful than just correcting my code.
This is my init.el:
;Installing Repos
(require 'package)

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(setq package-enable-at-startup nil)
(package-initialize)
; Use evil mode
(require 'evil)
(evil-mode t)

;For Tex
(require 'tex)
(TeX-global-PDF-mode t)
(latex-mode)
(setq auto-complete-mode t)
(auto-complete)

;For Org
(require 'org-bullets)
(org-mode)
(setq org-bullets-mode t)
(org-bullets-mode)
;Window Size
(if (window-system)
    (set-frame-size (selected-frame) 100 200))

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

Edit:
Even simpler things like
(set-cursor-color "#ffffff")

Isn't working on startup. What am I doing wrong? Is my installation botched?


texts: Are there any Perl options for company mode?

texts: The only code completion I've found was PlSense but as far as I can see the only options with Emacs using autocomplete among other dependencies. While I don't mind that if I can try to stick to doing my completions with as little dependency purpose replication as possible.


texts: emacs --daemon is not loading gui elements

texts:
I defined emacsclient as default editor in .bashrc so emacs -daemon will be called upon startup:
export ALTERNATE_EDITOR=""
export EDITOR=emacsclient

But compared to a normal load without client, if I call emacsclient afile, then some ui elements are missing, like the scrollbar, which will disappear, and the speedbar pictures, which will be replaced with "+" sign. Apparently the init file is not fully loaded by emacs daemon? What could possibly caused the difference and how can it be fixed?

a) Above is a normal load with emacs afile, same with emacs ; emacsclient -c afile.
b) Below is a client load with emacsclient -c afile after emacs --daemon &


texts: easy-menu primary menu separator problem

texts:
I really like easy-menu but have discovered an item separator problem; a minimum working example is given below.  When I hybrid define-key-after with easy-menu-add-item, the item separators in the "Words and Lines" submenu are fine.  However in the primary menu, "My-XEditing", the second item separator is missing.
Apparently, using this approach, easy-menu will only allow one item separator in the primary menu.  Since this is the only easy-menu problem that I have, I want to avoid having to delve through elisp (keymaps).  My guess is that a workaround might be found by grafting on easy-menu-define, but I can't figure out how.
(define-key-after global-map [menu-bar my-xediting]
    (cons "My-XEditing" (make-sparse-keymap "My-XEditing")))
(easy-menu-add-item nil '("My-XEditing")
    ["Move Character Forward" forward-char t])
(easy-menu-add-item nil '("My-XEditing") "--")
(easy-menu-add-item nil '("My-XEditing")
    ["Move Character Backward" backward-char t])
(easy-menu-add-item nil '("My-XEditing") "--")
(easy-menu-add-item nil '("My-XEditing")
    (easy-menu-create-menu "Words and Lines"
        '(["Move Word Backward" backward-word t]
        "--"
        ["Move Word Forward" forward-word t]
        "--"
        ["Move Line Backward" previous-line t]
        "--"
        ["Move Line Forward" next-line t])))


texts:
Emacs manuals (such as the Emacs Lisp Reference Manual are provided at a .../emacs/manual/<manual-name>.html URL. Surprisingly, the version number that the manual applies to is not part of the URL.

As I understand it, Emacs-specific manuals are versioned alongside Emacs itself (e.g. there is an Emacs Lisp Reference Manual for Emacs 24.5, one for Emacs 25.0, etc.). Where can older manuals be found? The Emacs download mirror contains a single Emacs Lisp reference from 2002.

I think it'd be a good idea for the .../emacs/manual/<manual-name>.html site to always refer to the newest manual, but for older version to be available at ...emacs/<version-number>/manual/<manual-name>.html.


texts: org-fill-paragraph leaves a comma at end of C style comment

texts:
In a src block when there is a C style comment /* ... */ doing an org-fill-paragraph would always put a comma just before the last star, like this:

/*
Some comment
,*/

Is there a way to stop it from doing so?


texts: How to launch 'term' with my default shell without a prompt to select the shell?

texts:
I would like to launch term with my default shell, without being prompted every time for the path of the shell.
How can I bind a key to term without being prompted for the shell to run?


texts: Can company-mode show the doc of the functions?

texts:
I am using company-mode for backends to auto-complete in Python and emacs is used as command line.
(add-hook 'after-init-hook 'global-company-mode)
(setq company-auto-complete t)

(setq company-auto-complete t)
(global-set-key (kbd "C-c C-k") 'company-complete)

During autocompletion, it shows the name of the fuctions and their type. In addition to those, I was wondering can it show the doc of the each function like jedi does (example first image on the jedi site)?

company (information of functions are missing on the right hand-side):

jedi:


texts: How do I lowercase (downcase) a group with replace-regexp?

texts:
I have some text that looks like this:
"CFName"
"CLName"
"CDOB"
"CGender"

I would like to get output where are of the text inside the double quotes is lowercased, like this:
"cfname"
"clname"
"cdob"
"cgender"

So I've tried to use M-x replace-regexp with the regexp being \(".*"\) and the replace as \,(downcase \1).  Which is how it is explained in this question.  The selection does what I expect, but the replacement doesn't.
What I get is:
"cfname"
"clname"
"CDOB"
"cgender"

The groups that are in ALL CAPS aren't downcased.  I've tried using downcase-region and downcase-word but those both fail with errors such as Wrong type argument: integerp, #("\"CG_DOB\"" 0 8 (fontified t)). I don't understand why downcase doesn't work with a group that is all caps.
How do I get this replace-regexp to downcase all groups?
I'm using GNU Emacs 24.3.1. The problem persists even if I start emacs with the -Q (don't use .emacs) flag. I've tried it in both sql-mode and text-mode with the same result.
I've tried this on the following two versions of emacs with the same results:
GNU Emacs 24.5.1 (x86_64-apple-darwin14.4.0) of 2015-07-20
GNU Emacs 24.3.1 (x86_64-pc-linux-gnu) of 2014-03-07 on lamiak, modified by Debian


texts: Emacs leaving behind files preceded with # despite lock files being disabled

texts:
I've noticed that emacs is leaving behind files in the directories of files I've edited with it. The files are named the same as the original, except the filename is preceeded and succeeded with a # character. For example, something like #file.c#, for example (if the original file was named file.c ).

I've already disabled lockfiles and changed the default directory backup files are saved to in my init.el script, like so:

(setq create-lockfiles nil)
(setq backup-directory-alist `(("." . "~/.saves")))

So I'm wondering why these files are generated, what their purpose is, and if there's a way I can supress them/change where they are saved to.


texts: How to delete the first few n chars of every line?

texts:
I recently asked:

How to add a prefix to every line?

So go from the code below:

I said Hello
I said There
I said I am some code

To code like:

Hello
There
I am some code

Now, how do I delete n number of characters from a line?


texts: window-configuration-change-hook false positives from desktop-mode

texts:
I'm trying to use window-configuration-change-hook in a package to perform some action when a buffer becomes visible for the first time. It works, however when starting Emacs, desktop-mode calls switch-to-buffer as it is restoring buffers, which triggers window-configuration-change-hook. I don't want that to count because the user doesn't actually see the the buffers as they are restored.

Is there a good way to avoid false positives from desktop-mode? Or maybe a better way to detect when a buffer becomes visible?

My only current idea is to add a timer or something to ignore cases where the buffer is only "visible" for a very short period, but I don't really like that idea.


texts: No graphic output for MATLAB src block in org-mode

texts:
In an org file, if I include a MATLAB src block that has a graphic output (a figure is plotted there), for example, the following src block:

#+begin_src matlab :session :file tst.png :results graphics
  imagesc(rand(100))
#+END_SRC

it won't be shown in the result of the src block (although the file gets saved as it should). Emacs returns, Code block produces no output (this is "not" the case for a python src block).


texts:
Studying the variable org-capture-template I found several configurations where a certain :created t property is used. One example is here
In my help buffer (help:org-capture-templates) I could not find this property. I use Emacs 26.3 and org 9.3.6 from MELPA.
Is this property too old, or is there a more complete documentation for the variable?


texts: How to move the cursor to the end of the read only text?

texts:
Say I have text:
This read only text ends here>*********************|
The This read only text ends here> is read only while the asterisks are are not. When the (move-to-read-only-end) is called, I want the cursor to move right after the >. Like this:
This read only text ends here>|*********************
How can the (move-to-read-only-end) be written?
EDIT: Adding comment here per advice,
"In eshell, the prompt is read only but when you write commands those are not. So, I want to be able to move at the end of the prompt and the start of the commands."


texts: Enable flyspell for org-mode source blocks

texts:
I am using org-mode to write an interactive fiction with the inform7 language. In particular, I write all the inform7 into source blocks and then use the org-babel-tangle function. As inform7 is written in plain English, it would be helpful for me to have flyspell enabled in all my source blocks.
How can I enable flyspell for all the text in my buffer, including source blocks?


texts: How to produce UTF8 info file with makeinfo on osx?

texts:
In the texi file I have the directive @documentencoding UTF-8 but makeinfo gives me a warning: unrecognized encoding name `UTF-8'
raoul@MacBook-Pro-de-Raoul oef-mode % makeinfo oef-mode.texi
oef-mode.texi:6: avertissement: nom d'encodage non reconnu « UTF-8 ».

raoul@MacBook-Pro-de-Raoul oef-mode % whereis makeinfo
/usr/bin/makeinfo

raoul@MacBook-Pro-de-Raoul oef-mode % makeinfo --version
makeinfo (GNU texinfo) 4.8
Copyright (C) 2004 Free Software Foundation, Inc.


texts: shortname for complex filter in org agenda

texts:
I want to give a shortname to a regular filter I use for agenda.

To prepare some meeting, i have a list of task / note with tag. I filter tag in org-agenda and before the meeting, i use org-agenda filter to get note.

Filter is like TAG1|TAG2|TAG3 ...

I want to just type in filter meeting1-filter. Is-it possible ?

Thanks in advance for your feedback.

Best regards.


texts: %%j and %%S in format string for frame-title-format

texts:
In my cobbled-together init.el, my frame-title-format variable has these %-sequences in it: %%j and %%S

Does anyone recognize these specific sequences? They come up blank in my frame title. Here's the full variable def:

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

This evaluates to

("mySystemName %S: %j "
 (buffer-file-name "%f"
                    (dired-directory dired-directory "%b")))

and displays in my frame as, for example when visiting a help topic, as

mySystemName : *Help*


texts:
Hi I am a little bit confused, because I think that I have already managed to make ispell work on my macOS 10.15.4 and emacs 26.3, but when I tried it I got an error that emacs cannot find ispell.

Then I figured that I need to install it which I did with brew install ispell but now emacs responses with Can't open usr/local/Cellar/ispell/3.4.00/lib/ispell/en_US.hash when I run M-x ispell. When I looked into usr/local/Cellar/ispell/3.4.00/lib/ispell/ there was no en_US.hash only american.hash and english.hash

Just before this error emacs also tells Starting new Ispell process /usr/local/bin/ispell with en_US dictionary... for a very short time.

I guess that some variables are set wrong, but how can I fix this?


texts: How to detect the number of lines scrolled from scroll up/down?

texts:
When running scroll-up or scroll-down, it's possible emacs isn't scrolling the number of lines requested (if you hit the start/end of the buffer for eg).

Is there a convenient way to know how many lines were actually scrolled?


texts: orgmode export - skip/ignore first headline level

texts:
In orgmode, is there an easy way to tell the exporter to ignore the first heading level and start exporting at the second level? I imagine something like this:

in org:

* Toplevel
** Head_1
  content 1
** Head_2
  content 2
** Head_3
  content 3

to be exported to:

1. Head_1
  content 1
2. Head_2
  content 2
3. Head_3
  content 3

Thanks for your help!

** Update **

After the comment by @artscan I revisited the :ignore: tag, and it indeed achieves what I need. To use it you need to add to the .emacs file:

(add-to-list 'load-path "~/path/to/orgdir/contrib/lisp" t)
(require 'ox-extra)
(ox-extras-activate '(ignore-headlines))

Please note that this also requires org-mode 8.3+

Once ox-extra is installed, simply tag the *Toplevel headline with :ignore:


texts: Make emacs automatically open binary files in hexl-mode

texts: How can I make emacs automatically open binary files in hexl-mode? It's probably sufficient to define "binary" as "contains a null byte" (I suppose https://github.com/audreyr/binaryornot could be used if that ends up being an insufficient heuristic).


texts: How do I programmatic add, delete and update org-mode properties from entries?

texts: I want to write a function to help me add/update or delete a custom property in my org-mode's entries. But I'm not really sure where to start, are there org functions that can help me manipulating this data or I have to parse an entry by myself?


texts: Org-mode: use result from babel in another programming language

texts:
Org and babel in emacs are awesome. Is it possible to have something like this:

Here is a C code

#+BEGIN_SRC C :output results
  #include <stdio.h>
  int main(){
    int x = 5.00;
    int i;
    for (i = 0; i < 5; ++i) {
      x = x+1;
    }
    printf("X = %d", x);
    return 0;
  }
#+END_SRC

Then I would like to use this X in another programming environment, say Python and do something else with this X.

#+BEGIN_SRC python :output resultPython
print(x+2)
#+END_SRC

It is not as simple as just directly use the variable X. Is it possible to do this in Babel?


texts: How to know the list of possible commands when in a session?

texts:
For instance: When I am in C-c C-e (export), by pressing # you get extra options. How to know this?
Another example: When in a helm session, by pressing C-c C-f, you activate helm-follow-mode. But this is not obvious.
Is there a "help" shortcut to show potential keys in such buffers?
Thanks!


texts: Shift all "deadline" and "scheduled" ahead of 2w

texts:
I am using spacemacs, but this question is emacs-related.

I have a long list of "deadlines" and "scheduled" in a .org file, and I would like to know how to shift all the dates at once of 14 days.

I can't understand properly what I find if I google this issue, or more probably I didn't understand properly how a .org file is written. Let's say for example that I have

** L9 : TASK XYZ
   SCHEDULED: <2017-11-29 Wed>

** L11 : TASK XYZ
   SCHEDULED: <2017-12-13 Wed>

** L13 : TASK XYZ
   SCHEDULED: <2018-01-10 Wed>

** L15 : TASK XYZ
   SCHEDULED: <2018-01-24 Wed>

** L17 : TASK XYZ
   SCHEDULED: <2018-02-07 Wed>

** L19 : TASK XYZ
   SCHEDULED: <2018-02-21 Wed>

** L21 : TASK XYZ
   SCHEDULED: <2018-03-07 Wed>

** L23 : TASK XYZ
   SCHEDULED: <2018-03-21 Wed>

What shall I do to shift everything by 2 weeks?


texts:
I am currently using org-mu4e with

(setq org-mu4e-convert-to-html t)

and (org-mu4e-compose-org-mode). When I attach files to a email I get the classical

<#part type="application/type" filename="/somepath/somefile" disposition=attachment description=somedescription>
<#/part>

inserted into the body, but when org-mode converts the body to html it somehow does nothing and the actual email displays the code <#part.... #/part> without including any file. Is there any workaround? I need the option org-mu4e-convert-to-html since I use LaTeX in my emails.


texts: Launching in daemon mode crashes emacs while loading configuration from .org file

texts:
I've been using literate programming using org-mode for my initialization file. I've a init.el which loads a org file converts it to .el and uses it as startup file. Here is my configuration files. When starting with --daemon option emacs crashes if ~/.emacs.d\copyninja-emacs.el file exists, if I remove it and start it launches fine.

Here is the crash log

("/home/vasudev/.emacs.d/copyninja-emacs.org")
Loading /home/vasudev/.emacs.d/copyninja-emacs.el (source)...

Backtrace:
emacs[0x8143ee3]
emacs[0x812a323]
emacs[0x81422ae]
[0xb7774400]
emacs[0x808ec89]
emacs[0x80b0a24]
emacs[0x819dde7]
emacs[0x81d1987]
emacs[0x819d89e]
emacs[0x819db63]
emacs[0x819e037]
emacs[0x81a413c]
emacs[0x81a6aeb]
emacs[0x819dde7]
emacs[0x81d1987]
emacs[0x819d89e]
emacs[0x819db63]
emacs[0x81d1987]
emacs[0x819d89e]
emacs[0x819db63]
emacs[0x81d1987]
emacs[0x819d89e]
emacs[0x819db63]
emacs[0x81d1987]
emacs[0x819d89e]
emacs[0x819db63]
emacs[0x81d1987]
emacs[0x819d89e]
emacs[0x819ccdb]
emacs[0x819cff4]
emacs[0x81bc645]
emacs[0x81c0349]
emacs[0x81c0a4d]
emacs[0x819dd8d]
emacs[0x81d1987]
emacs[0x819d81d]
emacs[0x819db63]
emacs[0x819df7f]
emacs[0x81c13ff]
emacs[0x819dd8d]
emacs[0x81d1987]
...
Error: server did not start correctly

I'm unable to figure out what is the reason this crash is happening. If some one can point me what might be wrong in my setup it would be great. I use emacs-snapshot package and this used to work fine before and started a couple of month back. I tried emacs from the git and it happens there to.


texts: binding M-[ causes mouse focus to insert characters

texts:
I have bound M-[ to backward-paragraph. This causes a problem in terminal mode, whereby every time the mouse enters or leaves the frame (i.e., Emacs gains or loses focus), the characters I and O are inserted in the buffer.

To reproduce:

start vanilla emacs in terminal mode:

emacs -nw -Q

bind a function to M-[:

(global-set-key "\M-[" 'backward-paragraph)

move the mouse in and out of the Emacs frame.

What I see are the letters I and O inserted in the window. view-lossage shows:

 ESC [                  ;; backward-paragraph
 O                      ;; self-insert-command
 ESC [                  ;; backward-paragraph
 I                      ;; self-insert-command
 ESC [                  ;; backward-paragraph
 O                      ;; self-insert-command
 ESC [                  ;; backward-paragraph
 I                      ;; self-insert-command
 ESC [                  ;; backward-paragraph
 O                      ;; self-insert-command
 ESC [                  ;; backward-paragraph
 I                      ;; self-insert-command

I can still use M-[ as a keybinding - pressing it causes point to move backward as expected.

Is this a normal deficiency of terminal-mode emacs, or is it a bug?

Emacs version 27.0.50
Debian with i3 window manager
confirmed with gnome-terminal and xterm


texts:
I open a terminal and type fg like it says but it says no current process.

I also tried %emacs and got the same.

I'm on trusty tahr 14.04, anyone else got this?
*edit: I was following the built-in tutorial.


texts: Is CUA Mode good over usual Emacs Cut and yank commands

texts: Just wanted to capture the advantages of CUA mode over the usual emacs copy and paste commands. One advantage which is quite obvious is it similar to the keybindings which are present in other editors. What would a more better explanation on using CUA mode in emacs.


texts:
I have a red border around my modeline, and I don't like it. How can I get rid of it?

Emacs 24


texts: Can I have two views on a file - one narrowed one not?

texts:
I am editing some file, abc.org, and call org-narrow-to-block to narrow to a code block that I want to edit. For the editing process I have to access another part of abc.org and just want to show it in another window. So I do "C-x 2" and find that the window shows the abc.org, but also narrowed. Is it possible to have two "views" on the file? One narrowed and one not?

I have checked the seven questions tagged with narrowing and did not find a similar question.


texts: Elisp code to check for internet connection

texts:
When I open Emacs, it evaluates my init file, which includes refreshing my package archives via internet connection. This is problematic when I don't have an internet connection, thus I need to prevent execution of that code when starting Emacs without an internet connection. To solve this issue, I wonder if there is there a way to have Emacs ignore the package refresh code when I don't have an internet connection?

Here are the first few lines of my init.el:

;; Requisites: Emacs >= 24
(require 'package)
(package-initialize)

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

(package-refresh-contents)

I imagine that I can add code to load my Emacs file as follows:

;; Requisites: Emacs >= 24
(when (connected-to-internet-p)   ; I need this predicate function
  (require 'package)
  (package-initialize)
  (add-to-list 'package-archives
               '("melpa" . "http://melpa.milkbox.net/packages/") t)
  (package-refresh-contents))

Is there a (connected-to-internet) function, or similar approach, to resolve this issue?


texts: How auto set "diredc" mode when start Emacs?

texts:
Linux Mint 20.1
Emacs 26.3
I install package "diredc". https://github.com/Boruch-Baum/emacs-diredc
To start in I use: M-x diredc
Nice. It's work fine.
But problem is when I restart Emacs I need again execute M-x diredc to switch it  diredc mode.
Is it possible to autoset diredc mode when run Emacs?


texts:
Emacs Lisp does not have syntactical support for non-nil defaults of optional parameters. What is the recommended idiom for supplying these parameters?

To clarify my point, here is one overly explicit way of doing so.

(defun command (a &optional supplied-b)
  (let ((b (or supplied-b default-b)))
    (command-body a b)))

What, if anything, is the recommended style?


texts: Parsing an Orgmode file with org-element-parse-buffer

texts:
I am trying to get the ast of an orgmode file and it does not seem like the todo-keyword or todo-type keywords are being set properly.

I have the following orgmode file:

#+TITLE: Org Test File
#+AUTHOR: Jesse Millwood
#+TODO: TODO WAITING | DONE

* Some Time Stamps
  - An appointment: <2017-08-21 Mon>
  - Something done: [2017-08-21 Mon]
* List of things I need to get done
** TODO Parse an org file
** WAITING Look at the AST
** WAITING Verify the AST
   - And make sure the ast contains the right info

I am trying to get the ast by simply running

(setq org-ast (with-temp-buffer
        (insert-file-contents "~/Playground/elisp/orgfile.org")
        (org-element-parse-buffer)))

I then just print it out in the buffer to look at it and the ast looks good except the section that represents the TODO items.

The section that represents the first todo point is:

(headline (:raw-value "TODO Parse an org file"
                      :begin 207 :end 233
                      :pre-blank 0
                      :contents-begin nil
                      :contents-end nil
                      :level 2
                      :priority nil
                      :tags nil
                      :todo-keyword nil
                      :todo-type nil
                      :post-blank 0
                      :footnote-section-p nil
                      :archivedp nil
                      :commentedp nil
                      :post-affiliated 207
                      :title (#("TODO Parse an org file" 0 22 (:parent #2))) :parent #1))

I did make sure to run 'C-c C-c' on the '#+TODO' line at the top. So I figured the keywords in the the ast would be something other than nil. Am I missing something here?


texts:
I'm looking to add some elisp to my init file that will execute a number of additional functions when I call a particular command.

More specifically, when I execute the compile and view command using AUCTeX I have added the following code to automatically revert-buffer on the PDF output buffer (suggested to me in another post on this forum).

(add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)

The problem is after the execution of this function the active window is the PDF output buffer rather than the buffer containing the LaTeX source file. I'm using the ACE-windows
package for window navigation and I notice that within this package there is a noninteractive function for switching to the previous active window called aw-flip-window.

How can I edit my code so that I can add this function to the list of functions executed when I called the compile and view command?

**edit: the eventual solution utilised the majority of the code suggested in the reply highlighted as the solution with one alteration. Namely, that the native Ace Windows function aw-flip-window was replaced with PDFview major mode command as part of the PDFtools package pdf-outline as can be seen in the code below.

(defun my-TeX-revert-document-buffer (file)
  (TeX-revert-document-buffer file)
  (pdf-outline))
(add-hook 'TeX-after-compilation-finished-functions #'My-TeX-revert-document-buffer)

However I don't know why this particular solution works and I would be interested to hear any ideas why this may be the case.


texts: Problem with character encoding in Emacs 25

texts:
I am running Emacs 25 on Ubuntu 18.04. When I type accents, they display properly, but when I close and then reopen the file they appear like a backslash and then an octal number.
This only happens with one particular file: all other files I process with Emacs on the same computer and same user account save and display accents fine. How is that possible? Whatever settings are contained in the .emacs config file would apply to all files?
I've tried to set the coding system on the individual file that is causing problems, with the command set-buffer-file-coding-system and then selecting utf-8-unix, but I get the message: utf-8-unix cannot encode these: é

How can I fix the encoding of this file?

@DoMiNeLa10 Thanks for your reply.
Nothing particular with file name, nor comments and the major mode is org-mode.
What I suspect that has happened is that the problematic file has weird characters from copy/pastes from webpages.
For instance, it contains the octal sequence \342\200\224 which on the original web page looks like a long dash. I suspect emacs doesn't know how to display it and then gets confused and gives up altogether trying to figure out the encoding; For instance, the file is full of the octal sequence \303\251 which is just accented é,  that emacs should know how to display (as I said in my previous post I tried the command set-buffer-file-coding-system and then selected utf-8-unix, but it continues to display accents as octal sequences)

Is there a way to force emacs to use the utf-8-unix encoding to display accents correctly and just ignore the octal sequences that are not part of the encoding? I mean, I don't mind that the weird characters just remain octal sequences in the file, but I want to see the accents.

@Stefan: the output of checking: M-L buffer-file-coding-system RET

buffer-file-coding-system is a variable defined in ‘C source code’.
Its value is ‘no-conversion’
Local in buffer todo1.org; global value is utf-8-unix
Automatically becomes buffer-local when set.

I tried C-x RET r utf-8 RET as you suggested and it works well, displaying all accents correctly instead of backslash octal sequences and the buffer-file-coding-system value becomes utf-8, but if I close the file and then open again, the backslash octal mess reappears and the value reverts to 'no-conversion'.

@DoMiNeLa10 I ctrl-c to copy from firefox and ctrl-y to paste in emacs. Sometimes, I just select in firefox and then middle-click mouse button to paste. Maybe pasting with the middle-click mouse button is the cause of the problem?


texts:
I often did undo too much, then redo it. I noticed I have default undo position in my mind. I think C-x C-s is helpful but not enough, because it just indicate modified or not, so the buffer is still possible to undo.

So I want to reset undo history when I think this is certainly my default undo position. If I can do so, I think I can come back default undo position easily like this C-u 1000000000 C-_.

For example, I need to find or create command like below xxx.

If I type below text in the current buffer,

...So Emacs is the excellent editor.

then I use M-x xxx. And then, I continue to type like this.

...So Emacs is the excellent editor.
But there are more excellent editor like...

But to pass through the reviewers, I need to correct second one. So I have to do C-u 1000000000 C-_ and the result will be

...So Emacs is the excellent editor.

Is there any command like xxx above?


texts: Move cursor left/right while entering isearch

texts:
How can I move my cursor left and right while entering my isearch text?

isearch-forward
Enter some text
Press cursor left to edit the search text

Argh! Emacs returns the cursor to the main buffer.

I tried (setq isearch-allow-scroll t), but this doesn't seem to do anything. I even tried (setq search-exit-option nil), which gives an error, even with emacs -q.

Error in pre-command-hook (isearch-pre-command-hook): (wrong-type-argument characterp left)


texts:
I'm a new emacs user so its possible that I've misunderstood something. I'm looking for a function that automatically changes my current keybindings depending on the current major mode.

My approach was the following:

(add-hook 'org-mode-hook
  (lambda ()
    (define-key evil-normal-state-map (kbd "C-c r") 'mark-done-and-archive))

(add-hook 'clojure-mode-hook
  (lambda ()
    (define-key evil-normal-state-map (kbd "C-c r") 'cider-restart))

Consider the following scenario:

Open a new org-file in emacs, "C-c r" is now bound to mark-done-and-archive.
Open a new clj-file in emacs, "C-c r" is now bound to cider-restart.
Switch back to my org file using for example ivy-switch-buffer or windmove-right, "C-c r" is still bound to cider-restart, even though the current major mode is org-mode.

I'm looking for something that redefines the keybindings on every window/buffer switch to the ones I defined for that particular mode.


texts: find-file opens file but buries its buffer when ECB is activated

texts:
I have a hook in my .emacs file that activates ECB when prog-mode entered:

(add-hook 'prog-mode-hook 'ecb-activate)

When I open the first file that starts a prog-mode, it seems to cause find-file* to open the file, but then 'bury' it below all the other buffers. By this I mean that it opens the file, so that I can find it in the list of buffers, but it doesn't switch to that buffer, as I would expect.

If I comment out the line above, it behaves as it should (opens the file and switches to its buffer). Also, once ECB is activated, opening new files behaves as it should.

My question is, how do I stop it from doing that, so that when I open a file, I get that file's buffer? Am I using ECB wrong, i.e. are you not meant to activate it in the mode hooks?

*I am also running ido-mode, so maybe it's not actually calling find-file,  I get very confused with what's actually going on under the hood.


texts: Is there an org function or combination of such that will hide all content but keep the currently visible headings visible?  That is, something like org-content but which does not show currently invisible headings.


texts: Can magit show if a branch is ahead or behind?

texts:
Git hosting web services like Bitbucket Server and GitHub provide a branch view that shows whether branches are ahead or behind master:

This is great for finding remote branches which have been merged and can be deleted.

Can I see whether remote branches are behind or ahead with magit?

I found issue 1550 but that just shows the age and author, not the number of commits. L L gives:


texts: Is it possible to safely eject flash drive from Emacs

texts:
Windows 10, Emacs 25.1.
If I want to safe eject usb flash drive I use this (on system tray)

Is it possible to do this in Emacs?


texts: org-preview-latex rendering weirdness when a space after initial inline expression delimiter

texts:
\(S\) renders fine. No problem here.
$S$ renders fine. No problem here.
$ S $ does nothing. I wouldn't expect this. Comment below referencing manual explains this case.
$S $ does nothing. I wouldn't expect this. Comment below referencing manual explains this case.
\( S \) renders with an image of TLT TLT over the expression. Using luatex. Weird. This remains unexplained.
\(S \) renders fine. Similar to previous but notice no space after initial inline expression delimiter.
I wouldn't expect spaces just after the opening inline expression delimiter to be a problem.
Question: Any ideas on what I should look at in my config to allow space after opening inline delimiter \(?
This issue happens when rendering org-mode latex fragments. I have found that it happens with the default value of org-preview-latex-process-alist of:
((dvipng :programs
         ("latex" "dvipng")
         :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
         (1.0 . 1.0)
         :latex-compiler
         ("latex -interaction nonstopmode -output-directory %o %f")
         :image-converter
         ("dvipng -D %D -T tight -o %O %f"))
 (dvisvgm :programs
          ("latex" "dvisvgm")
          :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
          (1.7 . 1.5)
          :latex-compiler
          ("latex -interaction nonstopmode -output-directory %o %f")
          :image-converter
          ("dvisvgm %f -n -b min -c %S -o %O"))
 (imagemagick :programs
              ("latex" "convert")
              :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
              (1.0 . 1.0)
              :latex-compiler
              ("pdflatex -interaction nonstopmode -output-directory %o %f")
              :image-converter
              ("convert -density %D -trim -antialias %f -quality 100 %O")))

and default value for org-preview-latex-default-process of: dvipng.
Update: This happens when Org version > 9.0 uses its default config, i.e., no use of luatex. I am no longer using luatex but the problem still remains.


texts: Emacs Org-mode + Letter class = Unknown latex class 'letter'

texts:
I want to use Emacs with org-mode to export notes using 'letter' class. Texlive is installed in a Mac, and have many classes to export. But Emacs in org-mode only work with: article, report and book:

#+LATEX_CLASS: letter

But when I go to export I get the message:

Unknown LaTeX class 'letter'

If use 'article' and open the generated .tex file changing 'article' with 'letter' and exec from terminal 'pdflatex' passing the .tex file as a param then export a PDF correctly using the letter class. How can I use 'letter' class or others that come with Texlive inside of Emacs and Org-mode?

Thank you.


texts: Whenever I currently do M-x slime, it creates a split buffer, with SLIME going in the bottom half. This is not really very desirable - I'd much rather SLIME appeared in a separate frame, and kept its REPL there. Is there a way I can make it so that when I do M-x slime, it will create a new frame, and open the SLIME REPL there?


texts:
I'm trying to setup robe for Rails development. It needs company mode
and I have some issues with it:
Have following in init.el:

;; robe, documentation lookup and completion for Ruby
(require 'robe)
(add-hook 'ruby-mode-hook 'robe-mode)
(add-to-list 'load-path "./elpa/company-20150306.1548/")
(autoload 'company-mode "company" nil t)
(add-hook 'after-init-hook 'global-company-mode)
(push 'company-robe company-backends)
;; end robe setup

It raises:

Symbol's value as variable is void: company-backends

Full error trace is:

Debugger entered--Lisp error: (void-variable company-backends)
  (cons (quote company-robe) company-backends)
  (setq company-backends (cons (quote company-robe) company-backends))
  eval-buffer(#<buffer  *load*> nil "/home/me/.emacs.d/init.el" nil t)  ; Reading at buffer position 3073
  load-with-code-conversion("/home/me/.emacs.d/init.el" "/home/me/.emacs.d/init.el" t t)
  load("/home/me/.emacs.d/init" t t)
  #[0 "\205\262 \306=\203\307\310Q\202; \311=\204\307\312Q\202;\313\307\314\315#\203*\316\202;\313\307\314\317#\203:\320\nB\321\202;\316\322\323\322\211#\210\322=\203a\324\325\326\307\327Q!\"\323\322\211#\210\322=\203`\210\203\243\330!\331\232\203\243\332!\211\333P\334!\203}\211\202\210\334!\203\207\202\210\314\262\203\241\335\"\203\237\336\337#\210\340\341!\210\266\f?\205\260\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
  command-line()
  normal-top-level()

I'm newbie in Emacs world and I can't figure out why company-backends is void?
I doubt that somewhere it is not set and I should set it to myself but I can't find the way to do this.

Edit

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


texts:
In my .emacs file, I have the following variables:

(custom-set-variables
 '(org-babel-load-languages (quote ((emacs-lisp . t) (R . t))))
 '(org-confirm-babel-evaluate nil))

I save this example to a file called "example.org":

#+TITLE: Test
#+AUTHOR: Your Name
#+EMAIL: your-email@server.com
#+PROPERTY: session *R*
#+PROPERTY: cache yes
#+PROPERTY: results graphics
#+PROPERTY: exports both
#+PROPERTY: tangle yes

* Example of Org-Babel for R Literate Programming
** R text output
A simple summary.
#+begin_src R
  x <- rnorm(10)
  summary(x)
#+end_src

** R graphics output
Note we use the object =x= generated in previous code block, thanks to
the header option =:session *R*=.  The output graphics file is
=a.png=.

#+begin_src R  :file a.png
  y <- rnorm(10)
  plot(x, y)
#+end_src

Same plot with larger dimension:

#+begin_src R  :file b.png :width 800 :height 800
  plot(x, y)
#+end_src

Then I call (org-html-export-to-html) (bound to C-c C-e h h), which generates an html file but does not run the code. What am I missing?


texts: How to set up Emacs to cycle through files

texts:
I'm in a situation where I would like to look through a lot of text files as they are being created.

I would like to configure Emacs to do the following:

Launch from a script with directory argument
Open the oldest file in directory
Have two buttons; "Next" switches the current buffer to the oldest younger file and "Prev" would switch to the youngest older file.

I'm imagining that it would look like the "undo/next" buttons from this picture of Proof General:

How do I go about doing this? Is it even possible?


texts:
I am trying to make a TODO item dependent on another TODO item from a different heading and while searching for this feature, I stumbled upon org-depend.el.

From the official site docs it seems that I can do exactly that using the BLOCKER/ID properties, but my problem is that I can't seem to find org-depend.el and using (require 'org-depend) gives me a "cannot find file" error.

I have looked inside the org-mode repository and the file is not in the lisp folder. Is it dead?

Links:

org-mode Repository

org-depend Official Doc


texts: Org mode code snippets - not appearing as expected

texts:
I would like to add snippets of code for several languages to my org files.

The code I enter has syntax highlighting, but does use correct indetation.
One language I use is python, and I have seen here, that what I want is possible. In the linked video, referring to entering code snippets with the correct syntax highlighting and so fourth, Matthew says:

  "... provided you have configured the appropriate settings...".

I am not sure what I could be missing as, for example, my python works just fine in a python buffer.

I always need to open a separate buffer to achieve this, as mentioned here. The OP in that answer pasted his code in from somewhere else, but I am writing mine on the fly. Also, I do not really wish to use the accepted answer there, which is the timed-running of a custom function

As a clear example, I enter the code here, leaving my cursor at the underscore, _ :

#+begin_src python
for i in range(1:23): _
∫   √

#+end_src

and when I press enter, I end up at the integral sign, ∫. I would of coursel ike to end up at the square root symbol (sorry for overkill on symbols!). That means 4-space indent.

My Emacs 24.5 (9.0) on Mac OSX automatically inserts the #+begin_src and #+end_src all in upper case. I have tried both out and it doesn't make a difference.

I know there are some parameters one can set in the opening line, after having written the mode, in my case python is there. Is there a parameter to specify something like indentation in the code snippet?


texts: How to git stage a just-tangled file in `org-babel-post-tangle-hook`

texts: I want to create a org-babel-post-tangle-hook that does a git stage buffer-file-name.  There is a boring technical issue I have, which is that I don't know how to call magit-stage-file from elisp so that it doesn't prompt me to save. There's some way to wrap my call to magit-stage-file to accomplish this that I haven't figured out yet.  Then there's the second issue of getting this to work across different settings.  For example, I would like to be able to have this work even in the case that buffer-file-name is in a different git repo than the one I'm currently working out of. The buffer-file-name might even be on a different machine (over TRAMP)Could projectile be of use here?


texts:
I has Emacs 25.3
emacs -version
GNU Emacs 25.3.2
Copyright (C) 2017 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

I want to install on my Linux Mint 19.6 the Git.
So I try this:
sudo apt install git

But I get error:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 emacs27 : Depends: emacs27-common but it is not going to be installed
 git : Depends: git-man (> 1:2.29.2) but 1:2.27.0-1~ppa0~ubuntu18.04.1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

I always get this error if I want to install any package.
E.g.
sudo apt-get install libcurl4-openssl-dev

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 emacs27 : Depends: emacs27-common but it is not going to be installed
 libcurl4-openssl-dev : Depends: libcurl4 (= 7.58.0-2ubuntu3.12) but 7.58.0-2ubuntu3.9 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).


texts: How can I set custom date formats in org mode?

texts:
I would like all my dates in org-mode to be displayed like <Mon 24-Aug 2015>. I found a piece of code that addresses the problem

(setq-default org-display-custom-times t)
(setq org-time-stamp-custom-formats '("<%b %e, %Y>" . "<%b %e, %Y %H:%M>"))

but I'm not sure how to edit it to fit my needs. Any ideas?


texts: Reloading files from disk in frame with emacsclient

texts:
This may be user error, but if I open a file with

emacsclient -c file.tex

then if I try to reload the file using C-x C-v, then I get the usual

Find alternate file:

but if I press enter on that, I get

Buffer: `file.tex` still has clients: kill it? (yes or no)

If I say yes to that, the frame exits. If I say 'no', then nothing happens.

This seems to happen when the same file is open in multiple frames, using emacsclient everywhere. So presumably the same process is being used for these multiple frames.

Can someone explain what is going on here? What is the meaning of the message, and why does the frame exit instead of updating the file buffer in that frame?


texts: How can I create secrets for use with the Secrets API auth-source?

texts:
Trying to create new secrets in the GNOME keyring via auth-source results in

  The Secrets API auth-source backend doesn’t support creation yet

How can I manually create this secret?


texts: Copy-paste text among Split Window Buffers

texts:
Say I have split my main Emacs Window into 2 : LEFT and RIGHT.

My cursor is currently in LEFT. How do I copy some text from LEFT to RIGHT without going to the RIGHT window?


texts: Switch to another buffer, then back to the first

texts:
I want to save a buffer somewhere temporary so I can later say bring up that buffer I was using.

Is there an equivalent to minimizing a window/buffer? I know you can kill the buffer to go to the previous one, but a true minimizing concept would be ideal.


texts: Evaluate shell source block on spacemacs

texts:
I'm new to spacemacs. I did a fresh install following these instructions. When i try to evaluate a shell src block, i get the following message:
org-babel-execute-src-block: No org-babel-execute function for sh!

I tried adding the following lines inside ~/.spacemacs under defun dotspacemacs/user-config ():
(with-eval-after-load 'org
   (org-babel-do-load-languages
   'org-babel-load-languages
   '(
     (python . t)
     (sh . t)))
  )

Tried shell or bash instead of sh in the above code (replacing the language identifier in the src block respectively).

Also tried adding the above code without the with-eval-after-load 'org under defun dotspacemacs/user-init ()

When i do M-x load-file i get a done message, but when I try  M-x dotspacemacs/sync-configuration-layers i get this message:
helm-M-x-execute-command: Cannot open load file: No such file or directory, ob-bash

Spacemacs v.0.300.0

GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of  2020-11-30


texts: How to make indent-region keep the TAB in Makefile buffer?

texts:
A very simple Makefile:

all:
        gcc -o hello hello.c

And I already set:

(add-hook 'before-save-hook
      '(lambda ()
         (delete-trailing-whitespace)
         ;; indent the whole buffer before-save
         (when (derived-mode-p 'prog-mode)
           (indent-region (point-min) (point-max)))))

in my init.el, so if I C-x C-s in this Makefile file, it will become:

all:
gcc -o hello hello.c

Is there a way I can make Emacs recognize that the lines under : symbol should be indented with one TAB?

BTW: Typing TAB in the gcc... line will keep inserting tabs, is there a way that typing TAB indents this line like doing it in C code and TAB again won't do anything like inserting another tab)?


texts: LISP command won't work in init.el but works in *scratch*

texts:
I've executed the following lines in my scratch buffer

(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)

and everything worked without any problems, but if I add those same lines to my init.el file I just get the following error

File error: Cannot open load file, no such file or directory, expand-region

What have I done wrong?


texts: Org Agenda - Matching multiple TODO keywords in custom commands

texts:
This is probably pretty simple, but for some reason I can't seem to get this to work.

I have a block agenda that should list all the headlines with NEXT as well as DONE and DROPPED todo states. I want one block to show Done and Dropped, and another one to show NEXT.

I currently have this in org-agenda-custom-commands:

("n" "Next"
  ((tags-todo "/+DONE|+DROPPED" ((org-agenda-overriding-header "Done/Dropped:")))
  (todo "NEXT" ((org-agenda-overriding-header "Next:")))))

The NEXT block works, but the "Done/Dropped" block is blank. When I use this match syntax in the Agenda's actual match/search (C-c a m), it works, but for some reason it doesn't work in custom commands.

Perhaps some of the characters need to be escaped? I've tried various combinations of escaping with \, but no success so far.


texts:
Is there any way to open an emacs file so that all local variables definitions are ignored? I often use local variables into tex documents to fix root documents, dictionaries, etc. Sometimes I need to compile some document ignoring these variables.
For example, in a TeX document, I have
%%  Local Variables:
%%  TeX-master: t
%%  End:

Sometimes I'd like to ignore that because, for example, I don't want to treat the file as a master file.


texts: org mode — verbatim syntax for new type of block

texts:
the following MWE shows how I have created a new type of environment called a codebox to store output in, so that I can format it inside a box with LaTeX.  However, I don't know how to make Org Mode treat each #+begin_codebox ... #+end_codebox environment so that its contents are preserved verbatim.
This works:

Source:
#+TITLE: MWE
#+LATEX_HEADER: \RequirePackage{fancyvrb}
#+LATEX_HEADER: \DefineVerbatimEnvironment{verbatim}{Verbatim}{fontsize=\scriptsize}
#+LATEX_HEADER: \usepackage{mdframed}
#+LATEX_HEADER: \newenvironment{example}{\VerbatimEnvironment\begin{BVerbatim}[fontsize=\scriptsize]}{\end{BVerbatim}}
#+LATEX_HEADER: \newenvironment{codebox}{\VerbatimEnvironment\begin{mdframed}\begin{example}}{\end{example}\end{mdframed}}

#+begin_src R :session :results output org :wrap codebox
# Sample from the vector 'a' 1 element.
a<-c("a","b","c","d","e","f")
sample(a, 3)
#+end_src

#+RESULTS:
#+begin_codebox
[1] "b" "e" "d"
#+end_codebox

However, if I make a codebox that includes things like ~ or _, etc., those symbols are given a special interpretation by the org mode exporter.
This isn't what I want:

Source (to add to file above):
* Not so great

#+begin_codebox
This ~ is a test_of_the{codebox}
#+end_codebox


texts:
How can I add a custom formatter that will be picked up by doom-emacs' format ((format +onsave)) module?
I want to run the erlfmt program on save when editing Erlang files, but I'm not sure how I should configure that.
Doom seems to be using https://github.com/lassik/emacs-format-all-the-code under the hood, so I tried adding the following to config.el:
(define-format-all-formatter erlfm
  (:executable "erlfm")
  (:install (macos "brew install erlfmt"))
  (:languages "Erlang"
  (:format (format-all--buffer-easy executable "-")))

However, this just gives me the error “Don't know how to format erlang-mode code” when I run format-all-buffer. (I get the same error if I change to :languages "erlang-mode".)


texts: including archives in org-mode clock-table

texts:
I clock my time in org-mode. Because projects in my line of work can last for several years, I'd like clock reports that extend over a long period of time.

The problem is that it's annoying to keep completed subtasks in my todo files. I'd like to be able to put those in the archive. However, this destroys the clocktable structure. Anything in the archive is listed separately (it's a different file), and there's no longer any hierarchical structure to it.

What I would like is to be able to automagically merge information from the archive and the main file when the clocktable is compiled.


texts: Switch between horizontal and vertical splitting?

texts:
From time to time, by mistake, I split my screen vertically C-x 3 (binded to split-window-right), whereas I originally wanted a horizontal splitting C-x 2 (binded to split-window-below).

Question: is there a function to switch between vertical <-> horizontal splitting?

note: for the moment, I hide the buffer C-x 0 and re-split with the right C-x 2 (instead of C-x 3) and reselect the buffer... which is clearly not optimal.


texts:
Is there a function in elisp that will return the description of an internal org-mode link?

I would want this to work for any type of supported link:

[[link][description]]

[[description]]

Etc.


texts: How to make buffer name in mode-line be bold when its window is selected?

texts:
In Emacs, on the modeline: I would like the name of the currently focused buffer to be bold, but only when its window is selected.

My modeline looks something like this:

(setq mode-line-format
  (list "%&"
    " "
    (propertize "%b " 'face 'mode-line-buffer-id)
    "%p of %I"
    " "
    "[%l,%c]"
    'vc-mode
    " "
    'mode-line-modes
    ))

I would like "%b" (the name of the buffer) to be bold when its window is selected. I am totally new to Emacs Lisp. I thought setting the face to a variable that is changed by some "focus-in" hook would be the way to go (and possibly forcing the modeline to be redrawn).

I'm not sure what event I should hook in to. I know about focus-in-hook and focus-out-hook but those are for the frame.

Any hints are greatly appreciated.


texts: Apply buffer-local function inside another function in temporary buffer

texts:
Elisp newbie here,
I am trying to filter MS safelinks from an org-mode icalendar event, which gets saved by the gnus-icalendar:org-event-save function. I have created a function that filters the MS safelinks and am now trying to apply it to the buffer created inside gnus-icalendar:org-event-save. I have tried unsuccessfully to 1) run it as a hook, and 2) re-define the function as
(defun gnus-icalendar:org-event-save (event reply-status)
  (with-temp-buffer
    (org-capture-string (gnus-icalendar-event->org-entry event reply-status)
            gnus-icalendar-org-template-key)
    (unsafelinks nil)))

When I have MS safelinks in *scratch* and eval (unsafelinks nil) the links get filtered, so I don't understand why the above setup doesn't work. Probably it is an obvious mistake from someone learning elisp. Thank you in advance.
Update
Per request of wasamasa, the text to be filtered out is returned by the function (gnus-icalendar-event->org-entry event reply-status).


texts: Emacs indents C++ functions in structs in an unexpected way

texts:
Emacs indents functions in structs in the following way:

struct A {
    int a() {
        return 1;
    }

    int b()
        {
            return 2;
        }
}

int c() {
    return 3;
}

int d()
{
    return 4;
}

I want b to be indented just like d. How can I fix this?


texts: Strange elisp byte-compiler warning about unused variables

texts:
The following elisp code inserts hello world! 10 times:

-*- lexical-binding: t -*-
(dotimes (i 10) (insert "hello world!\n"))

If I byte-compile that code, I get the following message:

hellos.el:2:1:Warning: Unused lexical variable `i'

This is strange ... i is used to count from 0 to 9, even if it is not used in the repeated code. How am I supposed to loop 10 times ?!

Even stranger, the warning message disappears if I set

-*- lexical-binding: nil -*-

Go figure ...

Is this a bug (admittedly minor) in the emacs compiler? Is there a way to loop 10 times without using a counting variable?


texts: how to apply parent directory and current directory variable together

texts:
there is a .dir-locals in parent directory

((nil (global-auto-revert-ignore-buffer . t)))

and there is a .dir-locals in current directory

((nil (tags-file-name "TAGS")))

but when I visit files in current directory only tags-file-name directory variable are applied. but when I visit another subdirectory without .dir-locals, global-auto-revert-ignore-buffer are applied.

Could apply both directory variables in current directory?

Thanks!


texts: How can I get list of all things supported by thing-at-point?

texts:
I want a complete list of things that works with thing-at-point. The documentation states:

Possibilities include `symbol`, `list`, `sexp`, `defun`,
`filename`, `url`, `email`, `word`, `sentence`, `whitespace`,
`line`, and `page`.

See the file `thingatpt.el` for documentation on how to define a
valid THING.

Because users can dynamically define new things, I'm assuming this list needs to be dynamically computed. Things are defined by adding the appropriate properties to a symbol. Is it possible to get a list of all symbols that has a given property?


texts: Emacs Trunk: How to prevent creation of home directories in `load-path`

texts:
In the Emacs Trunk build -- i.e., built --with-ns, I have the following entries that get added automatically to my load-path when launching without any user configuration:

"." "./Applications" "./Applications (Parallels)" "./Desktop" "./Documents"
"./Downloads" "./Library" "./Movies" "./Music" "./Pictures" "./Public" "./Sites" "./Users"

I've done some grepping, but haven't found an option to prevent the creation of those entries.

Clearly, Emacs is scanning my home directory for all folders and creating entries based on the results.

How can I prevent the creation of those entries?

This does NOT happen when I launch:  Emacs -Q

EDIT (08/26/2015):  I have tracked down the bug and submitted a bug report -- http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21353 -- which states in relevant part:

The default-directory is initially set to ".", which results in erroneous entries being added to the load-path by normal-top-level-add-subdirs-to-load-path within .../site-lisp/subdirs.el when starting Emacs.  The erroneous entries look like this:

"." "./Applications" "./Applications (Parallels)" "./Desktop" "./Documents"
"./Downloads" "./Library" "./Movies" "./Music" "./Pictures" "./Public" "./Sites" "./Users"

I built Emacs Trunk from the directory ~/Desktop, in the event that has any relevance -- /Users/HOME/Desktop/emacs.


texts: How can we convert a range of table types (latex,org) to html when org-exporting to html?

texts:
Suppose that I have 3 types of tables in an org file, A latex table, an org-table, and a html-table. How can we to export these table as html tables when org-exporting to html?

# #+BEGIN_LaTeX
# \begin{table}
# \begin{center}
# \begin{tabular}{l c }
# \hline
#       & Model 1 \\
# \hline
# (Intercept) & $0.06$       \\
#       & $(0.10)$     \\
# x           & $1.02^{***}$ \\
#       & $(0.10)$     \\
# \hline
# R$^2$       & 0.53         \\
# Adj. R$^2$  & 0.53         \\
# Num. obs.   & 100          \\
# RMSE        & 1.05         \\
# \hline
# \multicolumn{2}{l}{\scriptsize{$^{***}p<0.001$, $^{**}p<0.01$, $^*p<0.05$}}
# \end{tabular}
# \caption{Statistical models}
# \label{table:coefficients}
# \end{center}
# \end{table}
# #+END_LaTeX

|-----------+-----|
| groceries | qty |
|-----------+-----|
| apple     |   1 |
| banana    |   5 |
|-----------+-----|

#+BEGIN_HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Statistical models

Model 1

(Intercept)
-0.10

(0.11)

x
1.33***

(0.11)

R2
0.60

Adj. R2
0.59

Num. obs.
100

RMSE
1.07

***p &lt; 0.001, **p &lt; 0.01, *p &lt; 0.05

#+END_HTML


texts: Lines vanish when using string rectangle with line-wrap

texts:
I paste this text, copied from IBM's social
responsibility, into an Emacs
buffer where the frame is 80 characters, or is small enough to cause a line-wrap:

02 Education and skills

We are reinventing education for the era of AI and helping to prepare young people around the world for the jobs of tomorrow.

I select lines 1-4 until the middle of the last sentence. I do C-x r t for string rectangle. The first three lines vanish! Here is a screenshot before the string rectangle command:

And a screenshot after string rectangle (C-x r t):

This also happens when launching with emacs -Q to skip customizations. It also happens when the last line is longer than the current fill. It does not happen when the frame is wide enough or when the last sentence is reflowed to fit on two lines.

Am I doing something wrong or is this a bug worth reporting?


texts: Byte compilation still happening when `no-byte-compile` is t on adding advice

texts:
In org-mode, I have the following:

#+BEGIN_SRC emacs-lisp :results scalar
(setq no-byte-compile t)
(defun f ())
(defun g ())
(add-function :before (symbol-function 'f) 'g)
(symbol-function 'f)
#+END_SRC

#+RESULTS:
: #[128 "\300\301\"\210\300\302\"\207" [apply g (lambda nil nil) nil] 4 nil]

I wanted to see what adding advice did to the function. Why is byte compilation happening, despite no-byte-compile being t? How do I prevent byte compilation in this case?


texts:
Since a couple of months ago, Helm has changed in his behavior of "doing its thing" when some command requires selecting a candidate, which was a default behavior in old releases of Helm. How can I restore that in these new releases of Helm?

Edit: the referred old behavior is that one where Helm handles completion candidates for any given command that requires choosing one candidate.


texts: Whenever I run C-c C-v to view the corresponding part of the PDF of the point, the focus switches to the PDF viewer (evince in my case). Is it possible to make the focus stay in Emacs?


texts: How can I publish a single org file to multiple pdfs

texts:
I have an org document that has confidential and non-confidential information.  I need to publish the org file to two different pdfs: one that contains all of the information from the org file and the other with the non-confidential information.

I have tried the following elisp.

(setq org-publish-project-alist
    '(("counselor"   :base-directory "~/Dropbox/org/"
    :base-extension "org"
    :publishing-directory "~/Dropbox/org/"
    :exclude-tags "confidential"
    :recursive t
    :title "Appointments"
    :publishing-function org-latex-publish-to-pdf
    :headline-levels 4
    :exclude ".*"
    :include ["appointments.org"]))

This produces an appointments.pdf document, but the confidential tags are still included.  I also don't know how to change the file name to be appointments-confidential.pdf and appointments-non-confidential.pdf.


texts:
I'm working on a package and I want to present a list to the users that they can select from.

The package allows editing of remote Dokuwiki pages from Emacs which can be found here: https://github.com/accidentalrebel/emacs-dokuwiki

I want to list pages that users can scroll up and down, once they press enter it should open the page they have selected. I'm thinking this can be done by listing the selection in a new buffer, then just code it in a way it can only accept up, down, and enter commands.

Are there other alternatives to doing this? I can use helm too but want to know if there are other simpler options.


texts: Make hints appear immedietly when using Hydra

texts:
I use Hydra, and find it very useful. However, I often find that I can only remember the key to trigger the hydra itself, but can't remember which keys are used for the "heads".

Luckily, Hydra will give me a nicely formatted list of the keys and the commands they will trigger.

However, I can only seem to get this list of hints to come up once I have already successfully triggered one of the commands listed - this requires that I remember how to trigger at least one of the heads, which is sometimes not the case.

Is there any way to have the hints show up immediately? That is, if I have the following hydra:

(defhydra hydra-transpose (global-map "C-t")
  "transposing hydra"
  ("l" transpose-lines "lines")
  ("w" transpose-words "words")
  ("s" transpose-sexps "sexps")
  ("p" transpose-paragraphs "paragraphs")
  ("c" transpose-chars "characters")
  ("w" transpose-frame "windows")
  )

How can I get it to show me hints as soon as I hit C-t? The documentation seems to suggest that this is possible:

  Assign a custom hint to this group of functions, so that you know immediately after pressing C-c that you can follow up with j or k.

But I have not yet been able to figure out how to accomplish this by reading the documentation, or by exploring the different hydra variables and functions. Does anyone know if this is possible/how to achieve it?


texts:
I have a problem with AUCTeX loading the correct hooks with a Beamer file.

If my file contains line breaks in the documentclass line, the style hooks are not loaded. (Thus I have no frames in my AUCTeX environments, and other commands are also unavailable.) For instance:

\documentclass[14pt,
  handout, % no transitions
  xcolor=svgnames]
  {beamer}

But if there are indeed no breaks, the style hooks are correctly loaded. For instance:

\documentclass[handout,xcolor=svgnames]{beamer}

Note that both ways are correct in LaTeX, but the first one enhances readability.

Is there a way to fix this?


texts: Customize isearch to start from buffer start

texts:
Ctrl-s, isearch-forward is not appealing to me and so, i wrote a wrapper around it to search from the beginning of the buffer always.

(defun sk-isearch-forward (original)
  (interactive "sEnter search string:  ")
  (save-excursion
    (beginning-of-buffer)
    (isearch-forward original)))

Now, i am seeing two issues:::

1) M-x sk-isearch-forward goes to the beginning of the buffer but never returns to the original cursor position. save-excursion is added to take care of this but it is failing me

2) it is not highlighting any of the matching words in the current buffer.

Is isearch-forward not the right function for this job?

I always search for a word, no regexes and the search, i prefer to start from the beginning. How can i do this?


texts: How to make Wanderlust mark replied emails as "answered"

texts: I noticed that Wanderlust 2.15.9 (Almost Unreal) does not automatically mark an email as "answered" to which I have written a reply, as some other mail clients do.  How can I make it do so?  I am aware that there are wl-summary-mark-as-answered and the likes, but I am not sure how to use them from a elisp code.


texts:
I have setup Emacs pdf-tools with auctex on ubuntu and the forward and reverse search work fine. But in the forward search (latex file to corresponding position in pdf document), it is difficult to find the precise spot in the pdf file. Is it possible to have some sort of highlight color (or box or colored dot) in the pdf file which marks the point. For example, forward search with auctex and evince draws a red box around the corresponding portion in the pdf file. Something similar with pdf-tools would be great.

Another way of posing this question: forward search only jumps to the relevant page in the pdf file, not the precise location in the pdf file. Is there way of jumping to the precise location and marking this location in the pdf file?


texts: When does shell-command-on-region actually pass the region to the command?

texts:
I am having some trouble understanding how shell-command-on-region works. Sometimes the region is passed to command, sometimes not, as far as I can tell.

Suppose I have an emacs buffer with "word" in the region, then counting the region's length with wc:

shell-command-on-region wc

returns  0 1 4 , as it should. But other commands don't seem to receive the region as input. For instance, both

shell-command-on-region   echo

and

shell-command-on-region locate

produce, respectively, an empty result and an error message ("locate: no pattern to search for specified").

Why is the region passed to the command in the first example and not in the second and third one?


texts: Split windows horizontally not working when global-visual-fill-column is enabled

texts:
As @drew asked me to do here I'm asking one question per problem
I'm trying to enable/disable visual-fill-column when there is one window/multiple windows.
(defun my-visual-fill-one-window ()
  (global-visual-fill-column-mode -1)
    (if (one-window-p)
      (global-visual-fill-column-mode 1)
      (global-visual-fill-column-mode -1)))

(add-hook 'window-state-change-hook 'my-visual-fill-one-window)

I need to disable the mode globally at the start of the function because if I don't and try to split one window horizontally I have the following error (strangely, I don't have it if I M-x visual-fill-column-mode manually and split the window without having this function hooked):
split-window: Window #<window 3 on file> too small for splitting


texts: Flycheck with eslint doesn't use ~/.eslintrc

texts:
I'm having trouble getting flycheck to use the .eslintrc file in the root of the current project, and I'm struggling to find any documentation that will tell me how to configure it to use the appropriate file. This setup was derived from this blogpost

(use-package flycheck
  :ensure t
  :diminish flycheck-mode
  :config
  (global-flycheck-mode)

  (setq-default flycheck-temp-prefix ".")
  ;; disable jshint since we prefer eslint checking
  (setq-default flycheck-disabled-checkers
                (append flycheck-disabled-checkers
                        '(javascript-jshint)))

  (setq flycheck-checkers '(javascript-eslint))
  ;; use eslint with web-mode for jsx files
  (flycheck-add-mode 'javascript-eslint 'web-mode)
  (flycheck-add-mode 'javascript-eslint 'js2-mode)
  (flycheck-add-mode 'javascript-eslint 'js-mode)
  ;; disable json-jsonlist checking for json files
  (setq-default flycheck-disabled-checkers
                (append flycheck-disabled-checkers
                        '(json-jsonlist)))
  )

(provide 'init-flycheck)

do i have to configure my local eslint installation, the javascript-eslint package, or flycheck?

i've also tried using M-x customize-group, but even though I specify the file i.e ~/.eslintrc (yaml) it doesn't apply the rules from config. is there anyway of seeing if it has found the file?


texts: setting up irony-mode json compilation database

texts:
I am struggling with the setup for irony-mode's JSON cdb support. I have this in my initialization:

;;; C++ code completion
(eval-after-load 'company
  '(add-to-list 'company-backends 'company-irony))
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
(eval-after-load 'flycheck
  '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
(add-hook 'c++-mode-hook 'flycheck-mode)
(add-hook 'c-mode-hook 'flycheck-mode)
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)

;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's function
(defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

(eval-after-load 'company
  '(add-to-list 'company-backends 'company-irony))

;; (optional) adds CC special commands to `company-begin-commands' in order to
;; trigger completion at interesting places, such as after scope operator
;;     std::|
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)

I've tried running irony-cdb-json-add-compile-commands-path and setting the project root and compile_commands.json (generated using CMake), but when i go back to irony-cdb-menu, it just tells me that there is no compilation database in use. Any thoughts? Thanks! :)


texts: Adding a menu with radio boxes or check boxes

texts: How do you create options with radio boxes or check boxes in the menu bar?  I can't find any examples.


texts: How can I access Mac menu bar help via keyboard?

texts:
I'd like to be able to search Emacs's Mac menu bar entries using the keyboard, as you normally do in most other Mac applications using s-? (this answer suggest that it should be possible?).
I've unbound  s-? from calling info, but that has not helped in allowing me to access the help search via the keyboard.


texts:
Q: how can I map a function onto elements of nested lists?

For flat lists, we can use mapcar to apply a function to each
element of the list:

(setq flat '("kittens" "puppies" "otters" "bunnies"))
(mapcar #'upcase flat)                  ; => ("KITTENS" "PUPPIES" "OTTERS" "BUNNIES")

But mapcar doesn't work on nested lists:

(setq nested '(("kittens" "puppies")
               ("otters" "bunnies")))
(mapcar #'upcase nested)                ; => ERROR

How can I map a function onto each element of a nested list, and
get back a new list with the same structure as the old one?


texts: How do I run a function upon pressing a prefix key?

texts:
Trivial example of what I would like to do:

(define-prefix-command 'my-prefix-map)

(defun populate-my-prefix ()
  (define-key my-prefix-map (kbd "a") #'move-beginning-of-line))

(define-key global-map (kbd "<f6>") #'my-prefix-map)

Upon pressing f6 I would like to run populate-my-prefix, before my-prefix-map is executed.

I think Hydra can do something like this (call another function upon entering the Hydra), but I'm writing my own package and would rather not depend on it.


texts: How to link from parent source block to child block (included via >)?

texts:
When exporting the documentation (HTML or PDF) for a literate program that uses noweb references in blocks, how can I get the output to actually hyperlink the <<noweb_snippet_name>> line (in the parent source code block) to the block named “noweb_snippet_name”?

Or, better yet, how can I make that noweb reference link to an arbitrary part of the exported document?  The child block might not be exported, so I would want the reference to link to the discussion of the snippet.

For example:

#+BEGIN_SRC klingon-lisp :noweb tangle :exports code
...
<<declare_variables>>
<<conquer_worlds>>
<<declare_victory>>
...
#+END_SRC

...
... /much later in the org file/
* Global variables
Blah blah discussion of variables, blah blah...
| Variable name | Description |

#+NAME: declare_variables
#+BEGIN_SRC klingon-lisp :exports none
(defvar yuQ nil
  "yuQmey chargh tetlh.")
#+END_SRC

Here, the main program source block is exported, to document the structure of the program.  The subsidiary block declare_variables does not need to be included in the export, since the text describes the variables and lists them in a table.  Ideally, <<declare_variables>> in the exported main program block would link to the * Global variables header.  But I could live with it linking to the declare_variables source block, and having to export that as well.


texts:
when I invoke some function that requires to select an option from the minibuffer, there is often a first option tagged with [^M]

what does it mean? How to select it?


texts: Sporadical change of permissions of file being edited

texts: I have a strange behavior - sometimes while editing, permissions of .rs files are changed from 0644 to 0755. I'm not sure if it is specific for rust-mode or not as so far it is the only mode I regularly use. The most annoying thing is that it happens absolutely randomly.


texts: "buffer is not visiting file" when trying to tail "elfeed-log"

texts:
When I turn on auto revert tail mode on a elfeed-log buffer I get
error "buffer is not visiting file" in the mini buffer.

So now what?


texts: Python Documentation String Indent In Auto-Fill Mode (Emacs 26.2)

texts:
I've noticed a peculiar behavior when using auto-fill-mode editing Python code. For example if I start typing the following (fill-column is set to 79):

def some_function(keyword_argument0, keyword_argument1,
                  keyword_argument2='foobar'):
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

and press Enter, it will look like this:

def some_function(keyword_argument0, keyword_argument1,
                  keyword_argument2='foobar'):
    """
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
                  tempor incididunt ut labore et dolore magna aliqua.

If the keyword arguments are all in one line, the doc string continues to be indented with 4 spaces as expected, but whenever it is extended across multiple lines, any line of the doc string after the first will match the indentation of the second line of the list of keyword arguments. Is there a good reason for this, or is this just a bug in auto-fill-mode?


texts: Why do sql-mode and sql-interactive-mode not highlight strings the same way?

texts:
Here is a screenshot showing the difference between sql-interactive-mode (top) and sql-mode (bottom).

Why does the string not get highlighted properly in sql-interactive-mode? (Note - this also happens with no color theme enabled.


texts: What’s the most common way to debug C++ on Mac

texts:
I'm wondering what's the most common way to debug C++ programs using emacs for Mac users? I’m currently using gdb, which takes a moment for me to make it work for Mac, so I’m now considering give dap-mode a try.
I’m new to emacs. Just wanna know what most Mac users do to debug C++ on Mac?


texts:
Can anyone tell me what is going on when Emacs starts up? As I understand, Emacs has a "base," a "foundation" of code written in C, but then supposedly a great Lisp "program" takes flight. And from then on you are interacting with one big live Lisp "program," which is supposedly different than running a regular compiled C/C++ program.

But then I've never really fully understood what that really means, i.e., what the difference is between a compiled program running in live memory and a Lisp program running in, what?, a Lisp virtual world, perhaps? One specific question would be, when the elisp part of Emacs starts up, is it just like a huge tree of one initial function calling other functions that in turn call other functions? I also understand that the *scratch* and the ielm REPL allow you not only to do calculator stuff, but to actually change the running instance of Emacs, at least the running elisp code. Some explanation of this process would be illuminating.


texts: Why do setq and set quote act differently on let-bound variables with lexical scope?

texts:
I had a bug in one of my extensions that eventually turned out to be caused by set not working as I expected:

;; -*- lexical-binding: t -*-

(let ((a nil))
  (setq a t)
  (print a))

(let ((a nil))
  (set 'a t)
  (print a))

when run with emacs -Q --batch -l temp.el prints:

t

nil

This seems very strange to me. I was under the impression that (setq a b) is shorthand for (set 'a b). What's going on?


texts: Emacs Lisp performance regression testing

texts:
I'm trying to find a way to implement ERT tests for performance of some elisp code. For that to work I need to have a stable performance metric.

Is there a stable performance metric I could use?

It is okay if Emacs version is fixed.

My attempt is here: https://github.com/haskell/haskell-mode/pull/1259/commits/581dc7b31931710da00c592f3ce049ef579de04b


texts: In org mode, how can I hide body text but show drawer contents?

texts:
Using spacemacs I would like to be able to display an org mode document such that:

all headings are visible
all drawers are open and their contents visible
all other body text is invisible

It would also be acceptable if instead point 2. read "all comments (lines starting # or delimited by #+BEGIN_COMMENT / #+END_COMMENT) are visible"


texts: fill-column-indicator mode doesn't show a straight vertical line


texts:
my-test.el contains the following:

(defun test01 ()
    "scan for end of entry, trapping error."
    (interactive)
    (condition-case nil
        (setq my-pt (scan-lists (point) 1 0))
        (error (setq my-pt nil)))
    (if my-pt
        (message "my pt is %s" my-pt)
    ;;else
        (message "my pt is nil")))

Line 1: abcdfn(def)ghi
Line 2: abcdfn@{def}ghi

I placed the cursor just before the "(" on Line 1 and then did M-x test01.  This worked okay.  Trying a similar test on Line 2, with the cursor just before the "{" failed, with a "my pt is nil" message.  Experimenting I tried the same test in a my-test.txt file (text major mode instead of emacs-lisp major mode).  In the text major mode, both Lines 1 and 2 worked okay.

Researching, I inferred that the syntax table for emacs-lisp major mode must be different from the syntax table for text major mode.  However, from the my-test.el local buffer, I executed M-x describe-syntax and found the following lines:

The parent syntax table is:
...
{               (}  which means: open, matches }
}               ){  which means: close, matches {
...

Experimenting, I placed the following line in the my-test.el local buffer, placed the cursor at the end of the modify-syntax-entry command, and then typed C-xC-e to execute the command.

(modify-syntax-entry ?{ "(}")

I then re-executed test01 on Line 2; again it failed with a "my pt is nil" message.

Questions:

What syntax table oriented command will permit the test01 function to work correctly on Line 2, within an emacs-lisp major mode local buffer?
Once I execute the syntax command from question 1, and find test01 working correctly on Line 2, what corresponding syntax table oriented command should I use to BACK-OUT the change made from the syntax command from question 1?


texts: Define main file to always be run on C-c C-c in emacs elpy

texts: When I am working on a file in my application in emacs/elpy, I always have to jump back into my main file buffer and do C-u C-c C-c (i.e. ) in order to run and debug it in the python shell. This is rather time consuming, so I was wondering, how can I define a corresponding C-u C-c C-c binding but which always runs my defined main file?


texts:
Running Doom Emacs 2.0.9 on Emacs 27.1.
My current settings are:
(setq org-directory "~/Documents/organize/org-mode")
(setq org-agenda-files (directory-files-recursively "~/Documents/organize/org-mode/agenda"  "^[[:alnum:]].*\\.org\\'"))

org-refile-targets is set to:
((nil :maxlevel . 3)
 (org-agenda-files :maxlevel . 3))

Refile targets seem to come only from agenda files. I would like to be able to refile to any file in org directory.
What changes do I need to make?


texts:
I'm using completing-read to get an argument for an interactive command.  The argument is a non-intuitive word (required for my application), so the completion list looks like this:
Possible completions are:
faz   foo   bar   baz

I'd like it to also show some help, something like this:
Possible completions are:
faz   Pogo quote part 2
foo   Regular fubar
bar   All the soap
baz   Pogo quote part 1

Is there a straight-forward way to accomplish this, or something similar?


texts:
During export, Org generates this:

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
                    semithick]

\node[initial,state]   (A)              \{\$q$_{\text{0}}$\$\};
\node[state]           (B) [right of=A] \{\$q$_{\text{1}}$\$\};
\node[state]           (C) [right of=B] \{\$q$_{\text{2}}$\$\};
\node[accepting,state] (D) [below of=A] \{\$q$_{\text{3}}$\$\};
\node[accepting,state] (E) [below of=C] \{\$q$_{\text{4}}$\$\};

  \path (A) edge [loop above] node \{\$b\$\} (A)
            edge              node \{\$a\$\} (B)
        (B) edge              node \{\$a\$\} (C)
            edge              node \{\$a\$\} (D)
            edge              node \{\$b\$\} (E)
        (C) edge              node \{\$a\$\} (B);
\end{tikzpicture}

from this:

#+HEADER: :exports results
#+HEADER: :results (by-backend (pdf "latex") (t "raw"))
#+BEGIN_SRC latex
  \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,
                      semithick]

    \node[initial,state]   (A)              {$q_0$};
    \node[state]           (B) [right of=A] {$q_1$};
    \node[state]           (C) [right of=B] {$q_2$};
    \node[accepting,state] (D) [below of=A] {$q_3$};
    \node[accepting,state] (E) [below of=C] {$q_4$};

    \path (A) edge [loop above] node {$b$} (A)
              edge              node {$a$} (B)
          (B) edge              node {$a$} (C)
              edge              node {$a$} (D)
              edge              node {$b$} (E)
          (C) edge              node {$a$} (B);
  \end{tikzpicture}
#+END_SRC

Where by-backend looks like this:

(defmacro by-backend (&rest body)
  `(cl-case (when (boundp 'backend)
              (org-export-backend-name backend))
     ,@body))

This behavior is present in Org version 8.2.10, but it didn't happen on my laptop with potentially different version, which I don't remember.

How to prevent it from escaping the results?


texts:
I am using the org-roam package, which, while great, uses up the entire side window of my main emacs frame. I would like to use some of that side window to display something else, ideally an eaf browser buffer displaying the roam database using org-roam-server.
However, splitting a side window is not done so easily, when attempted it yields the message Cannot split side window or parent of side window.
The Emacs documentation states

By default, side windows cannot be split via split-window (see Splitting Windows). Also, a side window is not reused or split by any buffer display action (see Buffer Display Action Functions) unless it is explicitly specified as target of that action.

The answer then to specifically target either the org-roam buffer or the eaf buffer using display-buffer-alist. However, I seem to be unable to figure out how

To target the org-roam buffer for splitting or
To tell the eaf buffer to take up the bottom slot in the side window.

I have been experimenting with some code from here and modifying it to at least affect to org-roam buffer, but to no avail. The code mentioned in the link does work, as *info* or *Help* windows do appear in new frames and the right side window respectively.
Below is some code I have been trying to use, to little avail. Does anyone know how I can accomplish what I want? I am admittedly very new to Emacs and Elisp, and this really got me stumped.
(setq
 ;; Maximum number of side-windows to create on (left top right bottom)
 window-sides-slots '(0 1 2 1)
 ;; Default rules
 display-buffer-alist
  `(
    ("^\\*org-roam)"
    (display-buffer-reuse-window display-buffer-in-previous-window display-buffer-in-side-window)
    (side . top)
    (slot . 0)
    (window-width . 0.33)
    (reusable-frames . visible))
   ))


texts:
for some reason i cant bind space in evil mode and get an error. all other keys work well. any clue? this is the bind that dosent seem to work

(define-key evil-normal-state-map "<SPC>" 'hydra-leader/body)

here is the error i get when launching emacs:
Error (use-package): evil :config: Key sequence < S P C > starts with non-prefix key <


texts: dired-do-rename throws file-error when changing upper/lower-case name

texts:
I am using Emacs master branch built --with-ns on a drive that is case insensitive -- aka Mac OS Extended (Journaled).  I would like to use dired-do-rename to change a folder name from upper to lower-case or visa-versa.  Emacs throws a file-error and does not change the name:

Move ‘/Volumes/STORAGE/PROGRAMS/HP_ScanJet_8290’ to ‘/Volumes/STORAGE/PROGRAMS/hp_scanjet_8290/HP_ScanJet_8290’ failed:

(file-error Renaming Invalid argument /Volumes/STORAGE/PROGRAMS/HP_ScanJet_8290 /Volumes/STORAGE/PROGRAMS/hp_scanjet_8290/HP_ScanJet_8290)

I am looking for some assistance, please, to redefine one or more of the dired functions to permit this operation to succeed.  The solution can certainly use advice (since most of the forum participants seem to prefer that method), however, a new function that replaces one or more existing functions is also acceptable.

EDIT:  The following is the output from M-x debug-on-entry dired-do-create-files after evaluating (require 'dired-aux), and then trying to rename a folder [from CamelCase to all lower-case] using S-r in dired-mode -- aka dired-do-rename:

Debugger entered--entering a function:
  * dired-do-create-files(move dired-rename-file "Move" nil t "Rename")
    dired-do-rename(nil)
    funcall-interactively(dired-do-rename nil)
    call-interactively(dired-do-rename nil nil)
    command-execute(dired-do-rename)

EDIT:  This appears to be a bug affecting OSX users of Emacs and the appropriate thing to do (as Drew suggested) is file a bug report so that everyone can benefit from the fix -- instead of a fix that is only available on emacs.stackexchange.com.  Here is the link to the report:  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22300

EDIT:  The bug was summarily dismissed / closed in about 5 minutes flat with the following explanation:

Since this is not an Emacs bug, I'm closing this report, but here is what I do
that should work for you:

  1. Rename the file to 'x'.
  2. Rename 'x' to the correctly cased name.

Copy the name to the kill-ring before #1, so that you can paste it in when
asked by #2.

[@lawlist (the original poster)]:  The moral of the story is that this question remains open and any help to implement a proper bug fix for OSX users would be greatly appreciated.


texts: Why is a TAB character added when using kill-rectangle and yank-rectangle to insert multiple rows into an org-mode table?

texts:
I noticed an annoying behaviour when copying multiple rows (a list) from a web page into an org-mode table, following a process inspired by Is it possible to copy /paste multiple lines of text into cells of org-mode table?.
The annoying result is that the table sides don't align properly, due to a TAB character being introduced during the process. Maybe I've discovered a bug or an undesired feature.
Note: It seems that using copy-rectangle-as-kill rather than kill-rectangle in the process prevents the TAB from appearing.
Reproducing the behaviour
Update: Reproduced in Emacs 26.3, but not fully in 27.1. If you have Docker installed you can test yourself using: docker run -it silex/emacs:26.3 emacs.
For version 27.1, do docker run -it silex/emacs:27.1 emacs and note that when yanking, a TAB character is actually created/inserted after the A. However, when you then press C-c C-c the TAB is replaced with a suitable number of spaces.
Create an empty table and these lines of text (the number of characters matter):
|   |
|   |

A
12345678

Cut/kill the lines as a rectangle in exactly the following way:

Start rectangle-mark-mode (C-x SPC) with the cursor to the left of A
Use kill-rectangle (C-x r k) with the cursor to the right of 8

Yank rectangle into the table:

Place cursor on first row
Do yank-rectangle (C-x r y)

It should now look like this:
| A   |
| 12345678  |

There should be a TAB character after the A in the first row.
With cursor in table, align borders using C-c C-c, giving:
| A  |
|  12345678 |

Oops, still unaligned.
Discussion
I suspect the misalignment is due to the TAB character. But to see the effect, you have to have the right number of characters on the second row. Repeating steps above on the following two lines of text produces an aligned table without a TAB character:
A
1234567

| A        |
| 1234567  |

Further, using copy-rectangle-as-kill (C-x r M-w) on the original two lines of text also did not result in a TAB character.