texts: Org mode: is it possible to display ONLINE images?

texts:
Assuming I want to have an org buffer in which I can preview images from url which I don't want to store on my hard drive - is there a possibility to use a solution similar to org links and display images functions?

I know I can use e.g.

(eww-browse-url "url.jpg")

but it opens an image in another buffer, which I want to avoid.

As a temporary solution I'm using a shell command (which I can put into an "clickable" elisp link in an org buffer):

(async-shell-command "wget -O /tmp/image.jpg https://url/some-name.jpg")

but to make it work I have to put another org link which will use downloaded image path (and then call org-redisplay-inline-images function):

[[file:/tmp/image.jpg]]

I am looking for a oneliner solution in which I just paste the link to the image and then toggle org display images. Is there a generic Emacs way to do that?


texts: How to find what is creating and killing so many buffers?

texts:
A bunch of creating and killing buffers in my setup and I can't track down what is it. Here is my debug code:

(add-hook 'kill-buffer-hook
          (lambda() (message "Killed: %s / %s" major-mode (buffer-name))))

which results in something like this:

Killed: fundamental-mode /  *temp* [170 times]
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp* [234 times]
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp*
Killed: fundamental-mode /  *string-output*
Killed: fundamental-mode /  *temp* [220 times]

Sometimes it peaks a dozen a second. I swapped my .emacs.d with a Doom setup (my current is a Spacemacs heavily tuned) and those killings still happen, but seldom. Especially when idle, nothing is observed, while with my setup it's this very frequent and comes in batches. It's causing lots of slow downs, cursor movements are the main culprit, generating more than a bunch per move.


texts: keymap (overlay / text property): how to create and modify?

texts:
I'd like to have certain keymap active when the cursor is in a particular highlighted area. For instance, I would like to bind hl-todo-next to some easy key combination, but only when the cursor is on such a TODO item, as marked by ht-todo-mode.

I understand that a piece of text or an overlay can have its own keymap property which would work that way.

How do I best augment keymaps for highlighting already put by existing modes, such as hl-todo-mode or highlight-symbol-mode? Can I e.g. associate it with a particular named face?

Specifically, what would be a good way to:

Add / update a keymap for a particular already highlighted fragment of text on which the cursor is currently positioned?
Remove / restore that keymap when the highlighting vanishes (because of the cursor movement or the text being changed).

I definitely can just run a hook at every cursor movement, or character typed, or time elapsed; I wonder if there are nicer ways to do that, and are there any subtleties not immediately obvious from the elisp documentation.


texts:
PragmataPro is a typeface that comes with a number of programming ligatures. My understanding is that these are OpenType face (OTF) ligatures.

I am aware that Emacs supports programmatic replacement of character combinations (for example -> to ⟶ or lambda to λ). However, these are unicode faux ligatures, since they have their own code points, which real ligatures do not.

Am I correct that Emacs (as of 25) does not support OTF ligatures automatically? On a lower level, are there options available to manually specify glyph mappings?

If ligatures are unsupported, then what needs to be done for Emacs to support ligatures?


texts: Add keywords of a language to completion list when selected

texts:
I am using Emacs with auto-complete package. I know that Emacs can auto-detect the language. I would like it to automatically add keywords of the detected language to the completion list, in order to allow me to complete such keywords, even if I just open an empty file.

For example, if launch Emacs with a brand new file main.c:

$ emacs main.c

I would like to be able to auto-complete to #include if I write #inc .


texts:
Java SE 15 adds (finally) support for multiline string literals that start with """\n and end with """.
Has anyone updated java-mode (CC Mode) to recognize this construct?


texts: Launch emacs with ediff-files (of ediff-directories) from command line

texts:
I would like to launch emacs to ediff either files or directories.  For example, I'd like something like:

emacs -f ediff-files file1 file2

But when I do this, it doesn't take file1 and file2 as the two files to diff.  Rather, emacs prompts me for the files to difference.

Does anyone know how to do this in one command line?


texts:
I have been working with Aquamacs and I would like to take Spacemacs out for a spin. I cloned .spacemacs and created an empty spacemacs file to store my configs later:

git clone https://github.com/syl20bnr/spacemacs ~/.spacemacs -b develop ~/.spacemacs.d

touch ~/.spacemacs

Open up Emacs and try to M-x load-file ~/.spacemacs.d/init.el and I keep running into this:

Cannot open load file: No such file or directory, ~/.emacs.d/core/core-dumper.el

I've tried everything I can think of including removing the emacs directory entirely and nothing seems to let me open up Spacemacs. Any suggestions?


texts:
I went to M-x list-packages and accidentally deleted Ivy.

How do I get it back in M-x list packages now?


texts: Can Emacs use tramp to run in an interactive session on a remote HPC node?

texts:
I have been using Emacs with ESS and tramp to load remote files and run remote R processes on HPC computers. With ssh keys, tramp makes this easy with C-x C-f to find file at /ssh:myserver:/path/to/file followed by M-x R to launch an R session.

However, on HPC computers that use a job scheduling system (e.g. Sun Grid Engine or Torque) there are restrictions on how much memory and CPU can be used on the head node, so I have to launch an interactive session using qsub -I.

Is it possible to configure tramp, ssh, and/or Emacs to launch an interactive session on a slave node (using qsub -I or equivalent) after an ssh connection is made?


texts:
In my .dir-locals.el I have:

(cpp-mode . (setq flycheck-gcc-include-path '("/home/<user>/<project>/include")))

This doesnt seem to set flycheck-gcc-include-path, any ideas why?

Also is there a list option for flycheck-gcc-include-path so I can specify more than one include directory?

Edit: Heres my flycheck stuff in my init.el:

;; syntax checker flycheck
(add-hook 'after-init-hook #'global-flycheck-mode)
; error showing up console
(with-eval-after-load 'flycheck
  (flycheck-pos-tip-mode))
;(setq flycheck-gcc-include-path '("/home/<user>/<project>"))
(setq flycheck-disabled-checkers '(c/c++-clang))
(setq flycheck-enabled-checkers '(c/c++-gcc))

If I uncomment the line for flycheck-gcc-include-path it works. I want this on a project basis so I am trying to set it in .dir-locals.el


texts: How to repeat a command immediately after calling it?

texts: I've just called an interactive function (i.e., a command).  I want to call it again, with the same arguments.  I know that I can call a keyboard macro again by using e right after running it the first time.  Is there something similar regarding interactive functions?


texts: YASnippet: How to resume (or reactivate) snippets after exiting them

texts:
After exiting yasnippet snippets that contain one or more tab stops, I often find myself wanting to go back and modify content that I entered at the tab stops. Of course, I can do this using standard movement and editing commands, but it would be much easier if I could simply reactivate, say, the last snippet I inserted and TAB through the fields again.

Another frequent use case is exiting snippets prematurely. I sometimes do this on purpose, but more often than not this happens because I accidentally hit C-g (or some other command that cancels the snippet).

Q: Is there a way to resume or reactivate a snippet after exiting it?

I ran M-x apropos for various combinations of yas/yasnippet and resume/reactivate, but that didn't turn up anything useful.

UPDATE

As @Stefan helpfully points out in the comments, it is possible to call undo to reactivate a snippet. However, this is only useful as long as the current buffer stays unmodified: If I exit a snippet, make some unrelated modifications in other parts of the buffer, and then hit C-/ (undo), Emacs first reverts the most recent changes instead of resuming the snippet, which (in most cases) is not what I want.


texts: How do I get rid of RET being translated from ?

texts:
I'm overhauling all of my keybinds and I'm trying to keep it logically consistent.

When I issue the command describe-key -> RET

This pops up in the *Help* buffer:

RET (translated from <return>) runs the command newline (found in global-map),
which is an interactive compiled Lisp function in ‘simple.el’.

It is bound to RET.

(newline &optional ARG INTERACTIVE)

What I don't like about this is the fact that RET is translated from < return >.

This is also the case with DEL -> < backspace >, M-DEL -> < M-backspace >, etc.

So to get rid of said indirections I issue the command:

(define-key function-key-map (kbd "<return>") 'nil)

And thus bind RET to newline:

(define-key global-map (kbd "RET") 'newline)

But then I get this error in the minibuffer when pressing the RET key:

<return> is undefined

How do I get rid of this behavior?

I tried reading the documentation on map translations, but it is very confusing to me. Perhaps I haven't had that AHA moment.


texts:
Upon launching emacs, I get this:

Warning: Cannot convert string "--courier-medium-r----120-----iso8859-*" to type FontStruct

Warning: Cannot convert string "--helvetica-medium-r----120----*-iso8859-1" to type FontStruct

Next, when I go to Options --> Set Font/Fontset --> Font menu, I get 3 submenus: Misc, Courier and Fontset. I clicked on every item in each submenu, but it didn't change the font. How do I change a font, mine is too small?

The operating system is SunOS 5.10.


texts:
What is the simplest way of getting the number of distinct repeated in a region?

For example, from

THIS IS LINE A
THIS IS LINE A
THIS IS LINE A
THIS IS LINE B
THIS IS LINE B
THIS IS LINE C

I would like to get

THIS IS LINE A    3
THIS IS LINE B    2
THIS IS LINE C    1

The output could be made over the same region (replacing the current selection).


texts: What is the meaning of the entry `("%T" file t t nil t)` defined in the AucTeX variable `TeX-expand-list-builtin`

texts:
AucTeX uses the two variables TeX-expand-list and TeX-expand-list-builtin when processing (La)TeX buffers.

According to the documentation of the  variable TeX-expand-list

  ...
  Each entry is a list with two or more elements.  The first
  element is the string to be expanded.  The second element is the
  name of a function returning the expanded string when called with
  the remaining elements as arguments.  The special value ‘file’
  will be expanded to the name of the file being processed, with an
  optional extension.

With only this information in hands I am enable to figure out what is the expansion of the string "%T" by applying the rule ("%T" file t t nil t) as well as the expansion of the strings "%s" and "%t" by applying ("%s" file nil t) and  ("%t" file t t) defined in TeX-expand-list-builtin


texts: Customizing the layout of the *Bookmarks List* buffer?

texts:
What would be the best way to go about customizing the layout of the bookmarks Bookmarks List buffer?  I'd like to end up with a result similar to the Spacemacs equivalent buffer:

That is, the default header and column headings have been replaced with a single line header and 2-column indent. I also have bookmarks+ active which must be altering that buffer too.

Any advice much appreciated,

Thanks,

Stu


texts:
Just a quick question,

Can emacsclient evaluate/run Elisp code from a given file, or even better, from stdin?


texts: Is there any easy way to copy/paste text from a browser window into an org file, automatically converting  links into [[][]] org-mode links? thanks!


texts: How to read the python documentation offline in emacs?

texts:
Sometimes I use ctrl h i or M-x woman, though I almost always head to the web for basic queries like python find line in string. Do I need to download this[0], that[1] or something else before leaving to a remote island and come back as python wizard after years of being offline and M-x doctor?

[0] https://docs.python.org/3/download.html
[1] https://www.archlinux.org/packages/community/any/python-docs/


texts: Emacs won't load theme installed from MELPA

texts:
I just installed the seti-theme from MELPA and no errors occurred. Than I ran M-x load-theme and after a few questions nothing would hapen and emacs would throw the following error:

Warning (initialization): An error occurred while loading `/home/matthias/.emacs':

error: Unable to find theme file for `seti'

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

After I did the same a second time in a session the theme would appear without any errors.

I tried to add the theme to my .emacs( http://pastebin.com/Gk7gH3dT ) with:
(load-theme 'seti), which doesn't work either.

emacs --debug-init

results in:

    Debugger entered--Lisp error: (error "Unable to find theme file for `seti'")
  signal(error ("Unable to find theme file for `seti'"))
  error("Unable to find theme file for `%s'" seti)
  load-theme(seti)
  eval-buffer(#<buffer  *load*> nil "/home/matthias/.emacs" nil t)  ; Reading at buffer position 113
  load-with-code-conversion("/home/matthias/.emacs" "/home/matthias/.emacs" t t)
  load("~/.emacs" 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()

The theme I had installed manually works fine.


texts: Opening a new file whose parent directory doesn't exist yet

texts: When opening a new file whose parent directory doesn't exist yet, I  either open a shell window, or an Emacs shell buffer, and then mkdir the directory in it. I find this cumbersome. Is there an easier way?


texts: How to identify the file of an already loaded feature, independently on how the file was loaded?

texts:
Normally to find which file corresponds to a loaded feature, one could use the (locate-library LIBRARY &optional NOSUFFIX PATH INTERACTIVE-CALL) function.
However, if the user used the function (load-file FILE) a file that is not located in a directory listed in load-path can be loaded. A call to locate-library will not find it.
Also, lets say that there are several files that provide the same FEATURE because they have the same (provide FEATURE) form in them, and they are all stored in a directory listed in the load-path and one of them is loaded,  locate-library will always report the file it finds with what is the content of the load-path at the moment of the execution of locate-library.  This may happen in the following scenarioS:

while developing where several copies of the file exists in various directories or,
on projects that create the final distributed file from a set of smaller files.

I am trying to find a way to identify the path of the file that was originally used to load the existing feature, regardless of any modification that might have occurred to load-path after the file was loaded and even if the file was loaded from a load-file call.
Is this feasible?


texts: Emacs as environment for iOS development

texts:
Is there any modes which may improve development experience for nowadays ObjC (syntax highlight for method calls, properties, blocks, literals, lightweight generics, modern keywords)?

Ideally with Xcode projects/workspaces integration (add/remove files, reuse environment variables).


texts: both keywordp and macrop then eval from a functionp

texts:
'Hope it won't bother my using defmacros named in the style of keywords (colon-prefixed, e.g., :set-this or :get-that): it apparently tricks ELisp from otherwise requiring quoted symbols (') or function symbols (#').

For example:

(foo :set-this value-that) ; line 0

Nevermind that: the problem goes as follows.

Say there are two "keywordp"-like defmacros with one parameter, and given a cl-flet* context, there should be two similar forms (as in line #0), but with two different macros and arguments.

An MWE is the following.

(defmacro :m (x) `(length ,x)) ; line 1
    ⇒ :m
(and (keywordp :m) (macrop :m)) ; line 2
    ⇒ t

(:m `(3)) ; line 3
    ⇒ 1

(defmacro :w (x) `(length (nreverse ,x))) ; line 4
    ⇒ :w
(and (keywordp :w) (macrop :w)) ; line 5
    ⇒ t

(:w `(6)) ; line 6
    ⇒ 1

(defun x (y z) (eval `(,y ,z))) ; line 7
    ⇒ x

(x :m `(8)) ; line 8
    ⇒ Invalid function: 8

(x :w '(9)) ; line 9
    ⇒ Invalid function: 8

(- (eval `(:m '(8)) (eval `(:w `(9))) ; line 10
    ⇒ 0

The faulty code is in line #7.

In these simple cases, it don't matter if the argument-list is backquoted `(8), quoted '(9), or returned as (list 8).

Lines #8 and #9 show what is wrong.

Yet, line #10 shows that evaluating as it "should be" is possible.

Now, if instead of defun there were a defmacro:

(defmacro x (y z) `(eval (,y ,z))) ; line 11
    ⇒ x

then lines #8 or #9 would be equivalent to line 10, but this is impossible within a cl-flet*.

Any hints? Thank s.


texts: Switch Emacs default shell from bash to zsh or fish

texts: When I deleted the zsh shell to move to fish, alot of my emacs configuration got messed up. It won't recognize my racer (Rust autocomplete) or do syntax highlighting. When I run doom reload, it gives me an error saying the zsh is no longer there. How can I switch from zsh to fish in emacs?


texts:
I'm trying to achieve the following with this:

$pricelist = pricelist();
$hotels[$index ]['id']

I want to copy the bottom line into the pricelist() function like this:

$pricelist = pricelist($hotels[$index ]['id']);

I'm selecting the bottom line text only in visual mode, and yanking it, then when I go to the first parenthesis it pastes the line below, but with the last square bracket moved like so:

     $pricelist = pricelist();
]$hotels[$index ]['id

Can anyone explain what I am doing wrong?

Apparently I can't paste anything into the parentheses, it puts it on the line below.


texts:
When I'm using pylint-mode for a big refactor, I quite frequently want to banish lower-priority errors to the bottom of the buffer. Currently I have to skip the same errors ever time I refresh the buffer.

Is there a way to do this?


texts: use euro symbol (or any symbol) for emacs keybinding

texts:
I set up this duplicate line function: https://kundeveloper.com/blog/duplicate-line/

and bound it to the euro symbol like this:

(global-set-key (kbd "M-€") 'duplicate-line)

And it worked (for a while).  On my keyboard, left alt + right alt + 4.

However, all of a sudden, when I restarted, it started to give me the following error:

error: M- must prefix a single character, not \342\202\254

and when I look in my init.el file, it also looks likes this

but if I copy that from init.el and paste it into stack overflow (as I did at the start of this question) I get the € back!

Does anybody know what I might have changed about my emacs or ubuntu to stop it accepting € as a key?

btw I still get this nice message when I try to use it:


texts: local keymap in mode-line doesn't work in terminal

texts:
I'm having trouble with getting local keymap:s to work in the mode-line, but only in terminals (with xterm-mouse-mode enabled).

This applies to both the standard mode-line entries (like mode-line-toggle-read-only) and entries I manually add.

For example, the following work in a GUI Emacs (tested on the NS port on macOS), but not in an Emacs running in a terminal. (When clicking on the PRESSME text in the mode-line, the message I was pressed should appear.):

(defun my-press-me ()
  (interactive)
  (message "I was pressed"))

(push '(:propertize "PRESSME"
                    local-map
                    (keymap
                     (mode-line .
                                (keymap
                                 (down-mouse-1 . my-press-me)))))
      mode-line-format)

Interestingly, when I press C-h k and click in the PRESSME text, it reports my-press-me both in a GUI Emacs and when running in the terminal.

Any thoughts?


texts:
I have defined a macro \mpunct{...} which I would like to be displayed in the same face as \mbox{...} is (i.e. green, not red as the rest of the text in math mode).

I don't know if it matters, anyway, \mbox is in the class "function" in font-latex.el.

Do I have to define my own keyword class, or is it better to add it to the list "function"?

Also, do I have to set it in my .emacs or is it possible to do it in a style file?


texts: How to preserve linebreaks of MS-Word text pasted into an Emacs buffer

texts: This is similar to There's a way to use emacs like MS Word, to make text permanently colored, stylized, etc...? However, I do only wish to preserve linebreaks so that the pasted raw text from word looks somewhat readable and not just one long line. Are there any utilities in Emacs to achieve this?


texts:
I am trying to write a short script file with elisp for the first time which will serve me to install all the required packages that I use. Thus when I change from one computer to another, I can get all the basic tools that I use daily.  My purpose here is to write some code in lisp that actually serves me.

My question is about (oddp) function. I can execute this in ielm. But when I try to run script from the terminal. It gives me :

  Symbol’s function definition is void: oddp

I searched a little and found another function (symbol-function). If I understand correctly this function shows the real name of a function. For instance, a user defined function is actually a lambda function (described in gnu-emacs). For the oddp function it is cl-oddp function. And when I change oddp to cl-oddp script finally started to work properly.

I am wondering 2 things :

Why renaming does not work ?
If renaming does not work then why it is used?

B.R.

p.s. I am using Aquamacs (Emacs 25.1.1)


texts: Why is the matplotlib plot produced by executing `org-babel-execute-src-block` contain errors?

texts:
The context
Consider the following Emacs configuration
$ cat ~/.emacs.d/init.el
(org-babel-do-load-languages 'org-babel-load-languages
                             '((python . t)))
$

and the following Org mode file
$ cat ~/Experiments/main.org
#+begin_src python :tangle main.py :results file :file 1.png
from matplotlib import pyplot
x = [1, 2, 3]
y = [1, 4, 9]

pyplot.plot(x, y)
pyplot.savefig('1.png')
#+end_src
$

If I tangle the Python code block (i.e. execute org-babel-tangle), execute the Python script (i.e. execute python main.py in a shell) and obtain the hash of the resulting image I get
$ pwd
/home/myusername/Experiments
$ python main.py
$ sha512sum 1.png && du -h 1.png
084ffd63ec53665c21fc3eaba5f5ec3622d4d27a97f89cb67e3b436ca8093467272bbc239fd0e60dde27f5207ee33392f5b83b9eca1427efe7523450d92a6a8c  1.png
20K    1.png

I can open 1.png with firefox and mpv without any problems.
If I execute the code block in Emacs by pressing C-c C-c (i.e. execute org-babel-execute-src-block) while the cursor is in the #+BEGIN_SRC block, I get the following
$ sha512sum 1.png && du -h 1.png
e39d05b72f25767869d44391919434896bb055772d7969f74472032b03bc18418911f3b0e6dd47ff8f3b2323728225286c3cb36914d28dc7db40bdd786159c0a  1.png
4.0K    1.png

Note that the size of 1.png is significantly lower than the size shown above.
Additional context
In addition to that, if I try to open the image with mpv, I get the following error
$ mpv 1.png
 (+) Video --vid=1 (png 1.000fps)
[ffmpeg/video] png: Invalid PNG signature 0x00000000.
Error while decoding frame!
(Paused) V: 00:00:01 / 00:00:01 (100%)
[ffmpeg/video] png: Invalid PNG signature 0x00000000.
Error while decoding frame!
(Paused) V: 00:00:01 / 00:00:01 (100%)

An error is also shown when I try to open the image in firefox (see image below)

The error is not present in both firefox and mpv when producing the image 1.png by executing the script in a shell.
The question

Why is the file 1.png obtained after executing org-babel-execute-src-block different than the one produced by tangling the #+BEGIN_SRC block and executing python main.py in a shell?
Why does the resulting file 1.png contain errors?


texts: How can I prevent the modeline from covering up the last line of some prompts/buffers in the bottom?

texts:
When I use some commands that display a buffer in the bottom which prompts some additional info, my mode-line is covering up the last line (or part of it). Is there a way to turn off the mode-line in these cases, or possibly adding some additional padding to the prompting buffer so that it doesn't cover up anything important. In the screenshot you can see one such case, where it is covering the tasks when selecting a task to clock into.

EDIT: Looks like this is cause by the package spaceline-all-the-icons. Disabling that and using vanilla spaceline, it seems to work just fine. I'll report this to spaceline-all-the-icons issues.


texts: Advising evil-forward-char seems to trigger advice twice

texts:
I am trying to update annoying-arrows to work with evil-mode.

Annoying arrows is this minor-mode that complains when you use the same simple movement-command too many times in a row. (I have also updated it to open a buffer when it is triggered to make it super annoying.)

Here is my attempt at getting annoying-arrows to work with evil-mode.

One problem I have is that when the advice is triggered for the functions evil-forward-char and evil-previous-char, the message is written twice in the buffer.

So instead of this:
Annoying! How about using left-word (<C-left>) instead of this-command: evil-backward-char??

I get the following message:

Annoying! How about using left-word (<C-left>) instead of this-command: evil-backward-chaAnnoying! How about using left-word (<C-left>) instead of this-command: evil-backward-char?r?

Anybody have a clue why that might happen and if there is a workaround? Any debugging tips would be appreciated.

There is probably nothing wrong with my code as it works for the regular emacs functions next-line and previous-line.

Ps. This issue might be related, but is above my current level of emacs understanding:
Problem with defining advice for evil-delete


texts: How do I view all org-mode TODOs that are not recurring, or not scheduled?

texts:
Weekly, I try to make sure that there are no TODOs I want to have scheduled that I've missed. So I look through the list of all TODO entries (C-c a t). This is great; it shows only open TODOs, so I don't have to waste time skipping past all the stuff I've already done.

But really, I don't want the list of all TODOs; If something is scheduled, or recurring, I don't want to see it in this list. I'd rather only see things that I could be missing, and I'm not missing something scheduled tomorrow that repeats every two days.

One can run org-agenda-filter-by-tag with /, but either it can't filter by scheduled/recurring status, or I'm not sure of the way to use it that way. Given that the list of tags that show up when you press TAB doesn't include anything like "unscheduled", I'd bet this isn't the tool I want.

So there are two possible solutions. While I'd prefer the first, having the second is also a possible solution for this problem.

How can I view all unscheduled open TODOs?
How can I view all open TODOs (scheduled or not) that are not recurring?


texts:
I want to write a macro that makes a diffpdf before and after some changes in my LaTeX file (that would be compiled twice by pdflatex).
I tried:
(defmacro with-diffpdf-after-changes (&rest body)
  "DOCSTRING"
  (declare (indent 1))
  (let* ((FILE_NAME (file-name-sans-extension (buffer-name)))
         (PDF_FILE (concat FILE_NAME ".pdf")))

    `(progn
       (save-buffer)
       (call-process-shell-command
        (concat "pdflatex \"\\let\\oldExecuteOptions\\ExecuteOptions\"\\\n"
                "\"\\def\\ExecuteOptions#1{\\oldExecuteOptions{#1,draft}}\"\\\n"
                "\"\\nonstopmode\\input{" (buffer-name) "}\";"
                "mv "  ,PDF_FILE " /tmp/"  )
        nil nil)

       ,@body

       (save-buffer)
       (call-process-shell-command
        (concat "pdflatex \"\\let\\oldExecuteOptions\\ExecuteOptions\"\\\n"
                "\"\\def\\ExecuteOptions#1{\\oldExecuteOptions{#1,draft}}\"\\\n"
                "\"\\nonstopmode\\input{" (buffer-name) "}\";"
                "diffpdf -a " ,PDF_FILE " /tmp/" ,PDF_FILE )
        nil nil)

       )
    ))

But something's wrong with my code. PDF_FILE is named by the file that calls the macro while I need it to be named by the buffer of my LaTeX file.
E.g. my LaTeX file is paper.tex, the macro is called by a function in the file replacements.el
I get that the macro makes diffpdf look for ./replacements.pdf and /tmp/replacements.pdf
I need diffpdf paper.pdf /tmp/paper.pdf.


texts:
I've been using the dired-do-search for a long time to find regexp
matches in marked files in a directory.  If there were more matches, you
could resume the search and find the next match with M-, but it
stopped working for me somewhere around the 24.4 or 24.5 release.
Currently I'm on 25.0.50.2 and when I do M-, after the first match is
found, I'm getting xref-pop-marker-stack: Marker stack is empty.

Can somebody help me fix it?  Thanks.


texts: Search and replace with many possible replacements?

texts:
Suppose I have a code base with many instances of string "console.log(" for example.  I want to replace each one with one of the following six lines:
logger(FATAL,
logger(ERROR,
logger(WARNING,
logger(INFO,
logger(LOG,
logger(DEBUG,

Each replacement is different and depends on the context in which the search string occurs (in a way that can only be judged by a human).  So I want to do a search and replace, but instead of only typing "y" or "n", I want to type for example 1, 2, 3, 4, 5 and 6 (and the number I type determines which one of the set is used as the replacement for that instance).
I prefer to do this in one pass, and I also want to avoid typing any of the replacement strings (in full) more than once as suggested here,
Query replace with different replacements
since the replacements will not occur consecutively but randomly.  In a typical large code base there could be hundreds of changes between consecutive instances, and this will require typing the replacement strings too many times.
Attempted solution sketch (does not work):
Use search-and-replace but with a macro replacement, and the macro replacement itself invokes a little function to ask me what the replacement should be.  For example something similar to this:
    (defun prompt-me-for-replacement (response)
      (interactive (list (read-key "Choice [1-6]: ")))
      ; or this --> (interactive "cChoice [1-6]: ")
        (cond
         ((equal response 1) "logger(FATAL, ")
         ((equal response 2) "logger(ERROR, ")
         ((equal response 3) "logger(WARN, ")
         ((equal response 4) "logger(INFO, ")
         ((equal response 5) "logger(LOG, ")
         ((equal response 6) "logger(DEBUG, ")
         (t (prompt-me-for-replacement))))

Then I want to invoke it with query-replace-regexp (or a similar function) and when I am prompted for the replacement string, I say \,(prompt-me-for-replacement).  This does not work, firstly because the function prompt-me-for-replacement will not even run once directly from the minibuffer.  Secondly I don't know if an interactive form can be called from the middle of a search and replace operation like I'm trying to do, because it is one interactive operation in the middle of another interactive one.
Any pointers/ideas will be greatly appreciated!!!


texts: Is there a variable with a list of languages supported by Org-mode src-blocks?

texts:
In org-mode, is there a variable/const/whatever containing a list of all  languages supported in "BEGIN/END_SRC" blocks?

Are there any other methods to list them? (except parsing a list of ob-*.el files)


texts: Dual-language text mode using the original interpretation of tabs

texts:
Does there exist an Emacs mode that replaces the contemporary interpretation of tabs (move to 8, 16, 24, .. or a multiple of some constant) with their original typewriter interpretation (set stops at 40, at 60, or at any fixed columns)?

Within text-mode or without, either is fine.

The objective is to easily enter dual-language texts, side-by-side. The following example highlights why resorting, say, to csv-mode is inadequate:

Stabat mater dolorósa         At the Cross her station keeping,
juxta Crucem lacrimósa,       At the Cross her station keeping,
dum pendébat Fílius.          close to her Son to the last.

Cuius ánimam geméntem,        Through her heart, His sorrow sharing,
contristátam et doléntem      all His bitter anguish bearing,
pertransívit gládius.         now at length the sword has passed.

There is no way to set the separator within the file, and—excluding that one would change the default—it's a nuisance to select it at each edit.

I'm not seeking something as sophisticated as counting rhythms, nor something as simple as adjusting tab-width. It would be nice if it works for prose (paragraphs wrap around in columns 0-39 and also wrap around independently in columns 40-79) as well as for poetry (lines match strictly one-to-one), but support for just the latter (again, as in a typewriter) would be nice.

This appears to be the implementation behind indent-dwim in programming modes, or at least in c-mode and c++-mode. I haven't figured out why python-mode does not align comments vertically (some PEP mandated it?), but that's an altogether separate question.


texts: How to properly highlight a code block (in-buffer) when inside of another block/environment?

texts:
The issue is that my source code blocks, BEGIN_src ... END_src, are not properly highlighted when within another block, e. g., BEGIN_proof ... END_proof. Here is a picture of how that looks like:

Observe how the second code block within the proof environment is not highlighted properly?
This is just an example of the problem. The real problem is that I have a homework.cls Latex class that I use with orgmode. The structure of that class in latex looks like this:
\documentclass{homework}
\author{Student}

\begin{document} \maketitle

  \begin{question}
  ...
  \end{question}

  \begin{question}
  ...
  \end{question}

  \begin{question}
  ...
  \end{question}

  ...

\end{document}

This as an org file looks like this,
#+LATEX_CLASS: homework
#+AUTHOR: Student

#+BEGIN_question
...
#+END_question

#+BEGIN_question
...
#+END_question

#+BEGIN_question
...
#+END_question

...

See now if I want to have a code block within a question, it is not properly highlighted just like it is not in the proof environment (see the picture above).
I am using doom-themes Here are my (what i think to be) relevant org mode configs:
;; org-mode
(use-package org
  :ensure org-plus-contrib
  :pin org
  :custom
  (org-log-done 'time "orgmode.org/manual/Closing-items.html")
  (org-support-shift-select t "Support selection with shift key")
  (org-export-with-toc nil "Suppress table of contents")
  (org-src-fontify-natively t "Fontify code in code blocks")
  (org-latex-packages-alist '(("" "listings" "xcolor")) "For code listings")
  (org-preview-latex-default-process 'org-xdv-to-svg)
  (org-babel-python-command "python3")
  ;; (org-latex-with-hyperref nil "Don't insert hypersetup in preamble")
  :config
  (define-key cua-global-keymap [C-return] 'conditional-C-return)
  (add-to-list 'org-preview-latex-process-alist org-xdv-to-svg)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((python . t))))

This is already a pretty long post, so if I can make it better by adding or taking away details, let me know. In case it's needed, here is my config file. You can find the org configs by Ctrl-f and typing ;; org-mode.
Thanks!
Edit:
I tried loading the above file with no configs like this emacs -q filename.org. The results were the same, i. e., the nested source block was not highlighted. So maybe orgmode just does not support that?


texts:
I am using spacemacs-light theme in Emacs and love it.
In my spacemacs-light theme, some org-files open with bullets not hidden though. In those cases I go to the top of the file and hit C-c C-c to refresh my org-file. And then I go back to where I was via C-u C-SPC.
Now I would like to create an elisp function that does this in a single step and map it to a key.[^1] Here is my approach in Elisp:
(defun my-refresh-org-fle ()
  (interactive)
  (progn
    (set-mark-command nil)
    (beginning-of-buffer)
    (org-ctrl-c-ctrl-c)
    (pop-mark)))

But it does not work. It won't go back to where I was.
I guess I haven't quite understood the functions set-mark-command and pop-mark. Although I do understand the concept of the mark-ring, and I enjoy using it (love jumping back to where I was prior to jumping to other files).

[^1]: Of course I could start debugging as to why I have this behaviour in spacemacs-theme in Emacs 26.x, but I don't have the time to.


texts: What are the potential pitfalls of enabling lexical-binding for a buffer?

texts:
This was inspired by the discussion of lexical-binding vs lexical-let in this question. As lexical-binding gives you the ability to have useful closures people may be used to in other languages like JavaScript why wouldn't you enabled it all the time?

Assuming backwards compatibility with older Emacsen is not a concern what pitfalls should you be looking for if enabling it in legacy code buffers?


texts: How to create an overview for a GTD implementation in emacs org mode?

texts:
I am implementing a GTD system in org-mode. I use tags for headings to signify various levels of "stuff". Primarily, I use "Goal" and "Project" tags to differentiate between a Goal (which is not a todo) and a project (which is a todo and goes through status changes). Projects can be children of Goals but the opposite is not true. Projects can exist without a Goal.

I use multiple files in 2/3 directories (which are scanned for org files and are added as agenda targets).

What I would like to achieve is a view which presents an overview of goals and projects as a hierarchical view as following

Goals

Goal 1

Project 1
Project 2

Goal 2
...

Projects

Project 1
Project 2

Is there a way (preferably agenda view) to generate this?


texts: Can I override the “nil” variables in .dir-locals.el with a more specific mode?

texts:
There is a project called Piglit with a .dir_locals.el file like this:

((nil . ((indent-tabs-mode . t)))
 (python-mode . ((indent-tabs-mode . nil))))

I think the intention is that most files in the project should use indent-tabs-mode but Python files should not. However this doesn’t seem to work. As far as I can tell the definition for the nil mode overrides the definition for the Python mode and Emacs enables tab indentation for Python files. Is there any way to correctly implement the intended behaviour?


texts: Insert aligned multi-line text in current buffer regardless of position?

texts:
I'm creating a function to easily insert ditaa boxes while drafting reports in org-mode. I have the meat of the function accomplished, but not sure how to implement it so that boxes can be inserted without losing formatting across new-lines.

Here is the current function:

(defun create-ditaa-box (x)
  (interactive "sText: ")
  (let* ((input x)
         (input-list (s-split "\n" input))
         (input-lengths (mapcar 'length input-list))
         (max-len (+ 2 (seq-max input-lengths)))
         (border (concat "+" (make-string max-len ?-) "+"))
         (input-format (mapcar* '(lambda (x y)
                                   (concat "| "
                                           x
                                           (make-string (- (- max-len y) 1) ? )
                                           "|")) input-list input-lengths)))
    (with-current-buffer (buffer-name)
      (insert border)
      (mapc '(lambda (x)
               (newline-and-indent)
               (insert x))
            input-format)
      (newline-and-indent)
      (insert border))))

It currently works as expected when my cursor is at the beginning of a line:

+--------+
| Hello  |
| World! |
+--------+

When creating diagrams I might have a box that needs to be in the center of the buffer. Currently, my function can't handle this:

Output:

                  <cursor-here>+--------+
| Hello  |
| World! |
+--------+

Expected Output:

                  <cursor-here>+--------+
                               | Hello  |
                               | World! |
                               +--------+


texts: Open two files on startup - how to set vertical split as default?

texts: When I invoke Emacs from the shell with the command emacs fileA fileB, I'd like to have the Emacs window split vertically (i.e. with one file on the left and one file on the right), not horizontally, to show the two buffers. How should I edit my .emacs configuration file?


texts: How to change fringe background color for current line only?

texts: We can change current line background using global-hl-line-mode.  How about fringe background of the current line?


texts: How to fix backwards incompatibility of mu 1.4?

texts:
I upgraded mu from 1.2.0_1 to 1.4.1 and it does not seem backwards compatible. I immediately got a problem of mu server process ended with exit code 127 error in process sentinel:, which I solved from this issue with:

mu init
mu find hello
mu index

I can now read emails and have two problems in the mu4e setup, even after restarting the system. When I compose an email, I get:

error in process filter: concat: Symbol’s value as variable is void: mu4e-compose-auto-include-date
error in process filter: Symbol’s value as variable is void: mu4e-compose-auto-include-date

and when delayed sending timer runs (mu4e-send-delay), I get:

Error running timer ‘mu4e-send-delay-send-queue’: (void-variable mu4e-maildir)

How can I fix these errors in the upgrade from 1.2.1 to 1.4?


texts: Why do "gnu" and "linux" `c-default-style` treat `c-basic-offset` differently?

texts:
These lines in my .emacs

(setq-default indent-tabs-mode nil)

(setq-default c-default-style "linux")
(setq-default c-basic-offset 4)

result in the following formatting of my c code (the c-basic-offset of 4 is respected by the style):

int main(
    int argc,
    char argv
    ) {
    if (1 == 1 &&
        2 == 2
        ) {
        return 42;
    }
    return 0;
}

At the same time, setting the style to "gnu", makes the offsets different (9 and 4 spaces):

int main(
         int argc,
         char argv
         ) {
    if (1 == 1 &&
        2 == 2
        ) {
        return 42;
    }
    return 0;
}

Why is the same setting treated differently by different styles? Bonus quesition: what do I set up to move the closing ) { of the function and the if blocks to the left like so:

int main(
    int argc,
    char argv
) {
    if (1 == 1 &&
        2 == 2
    ) {
        return 42;
    }
    return 0;
}


texts: Org Mode Babel - Interactive code block evaluation

texts:
I would like to evaluate in org mode source code blocks in C++ containing "cin" instructions  but I can't find a way to have an interactive evaluation (with user input) during evaluation. Example of code :

#+BEGIN_SRC C++  :results output :export code :tangle myfile.cpp
#include <iostream>
using namespace std;

int main()
{
int a;
cin>>a;
cout<<a+1;
}
#+END_SRC

Is it possible to have such an interactive evaluation or to simulate (by giving to the source code a fake input) ?


texts:
I need to add a single integer to a list that's already sorted, such
that it goes in the right place. My first tought was something like

(sort (cons newelt list) #'<)

However, given that list is already sorted, only one insertion is
really needed, which means this solution could be horribly unsuitable
depending on the algorithm used by sort.

So, which is the algorithm that sort uses?

Would I be better off doing something like the following?

(let ((tail list))
  ;; The first element is never less-than
  (while (and tail (< newelt (cadr tail)))
    (setq tail (cdr tail)))
  (setcdr tail (cons newelt (cdr tail)))
  list)


texts: Gnus to reuse same window for article buffer

texts:
I'm starting to use Gnus to read email. I've made this change so that I get the summary on one side of the screen and email on the other:

(gnus-add-configuration
 '(article (horizontal 1.0 (summary .50 point)
                           (article 1.0))))

I have one problem with the article window. Sometimes I'd switch the buffer in that window to, say, read a file. If I leave the file buffer open in the window which previously held the article buffer, then when I go to the summary window and open a new email, the article buffer opens in a new window (split from the summary one), resulting in 3 windows. This is annoying; I'd like Gnus to reuse the same window as before for displaying article buffers.

Would it be possible to make Gnus open the article buffer in the window where the file buffer was shown?


texts: Is it possible for multiple modes to combine their fontifications?

texts:
For example, a buffer has some major mode and it does its own fontification.

If I turn on a minor mode A then it adds its own fontification which changes the existing fontification by  changing the apperance of some characters which are already fontified by the major mode.

Then if I turn off the minor mode it removes its own fontification and for those characters which the major mode fontified originally the original fontification is restored.

Is it possible for a minor mode to change fontification in such a layer-like way, so that it overshadows the existing fontification, but this layer of fontification can be removed cleanly if the mode is turned off?


texts:
I'm using Emacs (24.4+1-5) and org mode for writing prose, which means that I need some mechanism for line wrapping that just works, and preferably the same way each time. At the moment I'm using visual-line-mode with fill-column set to 80. However, opening an old text file (having ascertained that org-mode, visual-line-mode, and the fill-column parameter are all set) and entering some additional text, the lines easily exceed 80 characters and have to be re-wrapped manually using M-q. What am I not getting here?

Here's my .emacs:

(setq sentence-end-double-space nil)

(add-hook 'text-mode-hook 'visual-line-mode)

(menu-bar-mode -1)

(defun margins ()

(setq left-margin-width 20)

(setq right-margin-width 20))

(add-hook 'text-mode-hook 'margins)

(setq-default fill-column 80)


texts:
I'm using org-babel to do litterate programming and I find it very convenient. I am able to execute shell commands on remote hosts, and local database commands with the postgres client. To open a file as postgres user, it would look for example like

C-x C-f /sshx:user@remotehost|sudo:postgres@remotehost:/tmp/testfile

To do so on Emacs 24.5.1, I needed to add:

(require 'tramp)
(add-to-list 'tramp-default-proxies-alist
             '(nil "\\`postgres\\'" "/ssh:%h:"))
(add-to-list 'tramp-default-proxies-alist
             '((regexp-quote (system-name)) nil nil))

So far, I have failed to understand how one could execute a postgresql (or mysql if you so choose) command on a remote server. The database server is not accessible directly over the network, I have to ssh into the remote host, su as the postgres user and then I'm able to execute commands through the psql client.

How could one use such a command:

#+BEGIN_SRC sql :engine postgresql :ExtraParametersIfNeeded
SELECT * from pg_database
#+END_SRC

On a remote host? I know the :dir switch, but have so far only been able to use it for shell scripts.

Many thanks!


texts:
The emacs functions mentioned in the docs don't seem to exist in my org version 7.9.3f.

http://orgmode.org/manual/Markdown-export.html

Any idea how I can get org-mode to export to markdown for me without pulling my hair out?


texts: How can I hide indentation on a narrowed defun?

texts:
When I'm in the middle of implementing a new function, I like to narrow my source buffer to just that function (C-x n d). However, this leaves the function indented as it was.

I would like to have the function aligned to the left, but returned to its original position when the buffer is widened again.
Example:

Default

        function foo(bar) {
            return 'baz';
        }

Desired

function foo(bar) {
    return 'baz';
}

Is there an existing method to accomplish this?


texts:
I'm taking notes in a largish org-mode file that has the following structure:

* Toto, A
Notes about Toto.
* Titi, C
Notes about Titi.
* Tutu, A
Notes about Tutu.

I'd like to sort the file so that all the headings with A precede the headings with B, which in turn precede the headings with C, and so on.  Is there an automated way to do that with org-mode?


texts: Classification system for data (have data accessible by several keywords)

texts:
I want to create a library of useful info.

I want to be able to have each info-snippet classified by several keywords

I.e.

("Jumping Flame Spiders go for your face. Get your pet cat to eat them.")

could be classified with the keywords spiders, everyday-tips-and-tricks and cats.

Later, all searches for any of the combinations of the keywords above should return the line above and all other relevant ones.

Is this possible to do in emacs lisp? Which libraries should I look into? If I have to "shell out", what would be the most multiple-platform friendly way of doing it?

Edit: my main use case will be to provide one piece of info (a paragraph of two) in the mode line or displayed in a buffer. If many info pieces match, I'll select one randomly.


texts: In helm-swoop minibuffer, insert text saved in registers

texts:
This is my usecase:

Open file1
store the text in register a using C-x r s a
Go to another place, store the text in register a using C-x r s b
Go to file, store the text in register a using C-x r s c
Invoke helm-swoop
Insert the content of the registers a, b, c with \|    i.e. (text_in_rega\|text_in_regb\|text_in_regc\)
M-i
This will show me the grep like across files, I can use C-c C-e and edit multiple files at once and save them.
This is a big time saver in verilog.


texts: Source code pretty-printer / beautifier / formatter for minified HTML/CSS/JS using only code I can trust?

texts:
I am reverse engineering foreign web site and have a lot of minified code for CSS/HTML/JS.

What package or tricks allow to beautify code?

I am usually replace \([{}]\) to \1\n and C-x h C-M-\ (indent-region) but would like something better.

I tried these packages from package-list-packages:

json-reformat - doesn't work on JS file
web-beautify depends on npm -g install js-beautify


texts: evil-surround: change and delete not working with all surroundings

texts:
I'm using GNU Emacs 24.5.1 (GUI version) on Mac OS X 10.11.1 with Evil mode and installed evil-surround through the built-in package manager of Emacs.

Now, I can add all surroundings, for example, surround a word by / with viwS/.

However, changing and deleting surroundings works only with certain types of surroundings, for example, ", ', ), ], but not with /, *, = (which are used in org-mode).

If I move the cursor, for example, on the text /word/, and type ds/, then after typing ds the word delete appears in the minibuffer, but then upon typing / the minibuffer is emptied, but nothing changes in the surrounded word, i.e. the / are still there.

Does anyone know how to fix this, i.e. allow surroundings like /, *, = to work properly?


texts:
I'm trying to use ERT to test the ycmd package, and part of what I need to do is pass bodies of code to the ycmd server and ask for completion candidates. I'd like to be able to keep these bodies of code in separate files, partly for organization and partly because that makes it simpler to determine the position in the code for which I would like to do completion.

However, I can't figure out the right way to address these files when the test is running. The crux of what I want to do is read the contents of a file which is in a location relative to the elisp file which defines the test. How can I do this?

(I've tried load-file-name, and it appears that this might work for batch mode testing. However, it doesn't work for interactive testing inside emacs, so at best it's an incomplete solution.)


texts:
Typically, at the beginning of a coding/maintenance task, I usually start with a carefully worded grep, such as
M-x grep
git --no-pager grep -n -e 'collect' -- ':!*spec*' ':!*.yml'<enter>

and suppose I got 200 grep results. Usually a task requires changing only 1 or 2 files,
but figuring out which files that needs the edit is the hard part in the beginning.
so I would essentially "eliminate suspects" from the grep results, until I come up with a "manageable" list of files I can focus on/dig in to.
How can I effectively work with the grep results in emacs, do we have the ability to "eliminate" lines interactively ?


texts: How to edit code in the source window using realgud?

texts:
I've started using realgud:pdb for python debugging in emacs: https://github.com/realgud/realgud

When you begin a realgud session, it opens a command window and a source window.

Keys like 'n' and 'b' typed inside the source window execute pdb commands, like 'next' or 'breakpoint.'

I would like to make modifications to the source code while I debug, but this is impossible if my keystrokes in the source window are captured by the debugging application.

Am I missing something?  What's the right, effective workflow for making changes to source using realgud based on information I learn in the debugging process?


texts: Magit - How to commit to multiple branches from a dirty working tree

texts:
I've got a dirty working tree with changes that are destined for two different branches:

The student branch will get documentation with lab problems and some infrastructure.
The solutions branch will get working code.

My usual workflow is to go through files hunk by hunk and try to commit things that go together.  But in this case, I want to send some commits to the student branch and other commits to the solutions branch.  I feel like there must be a nice way to do this, but I'm not thinking of it.  Here are two ideas that might work:

Commit everything to one branch, then use cherry picking to move the ones that don't belong.  I'll have to label each commit with what goes where, and then once the commits are moved, I'll have to edit all the labels.
Stash everything, then separately pop the stashes each into its own branch.  But then I'll have to retype every commit message.

Suggestions warmly appreciated!


texts:
Let's say I have this in the buffer:

  'BE BOLD'

I select it and type Alt-o b. It is now displayed as 'BE BOLD' I Save, quit, reopen: The font change is lost. How to keep the font change, please?


texts:
In magit-repolist-mode:
magit-repos.el:151:9:Warning: assignment to free variable ‘x-stretch-cursor’

In magit-submodule-list-mode:
magit-submodule.el:332:9:Warning: assignment to free variable
‘x-stretch-cursor’

Any way I can stop that?


texts: Can't connect to package managers on multiple computers

texts:
I just did a clean install of emacs 26.1 on multiple computers running different OS (Ubuntu, Mint, Windows), and for some reason I cannot update my packages using M-x refresh-package-contents. I've also re-installed emacs25 through apt with no change in results. Emacs gets caught in an infinite loop trying to connect to elpa or Melpa, with the message:

  Contacting host: elpa.gnu.org:443

For more information, here is my init file:

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl
    (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)

On ubuntu i'm getting:

  Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed \"failed with code 113\" :host \"elpa.gnu.org\" :service 80)")

I should note that I am not using a proxy, and I am on a home network. I also know that gnuTLS is properly installed on the windows machine, as it came packaged with emacs 26.1. You might see similar questions on the forum already, but they do not have solutions that fit my needs.

EDIT:

As Nega suggested, I ran an uninitialized instantiation of emacs and tried to manually update the packages. Here are the contents of my Messages buffer after:

Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
Quit
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:80
Failed to download ‘gnu’ archive.
Importing package-keyring.gpg...done
You can run the command ‘list-packages’ with M-x l-pac RET
Package refresh done
error in process sentinel: Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed "failed with code 113
" :host "elpa.gnu.org" :service 80)
error in process sentinel: Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed "failed with code 113
" :host "elpa.gnu.org" :service 80)
Mark set

After debugging (list-packages) again, this is the backtrace:

Debugger entered--Lisp error: (error "Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed \"failed with code 113
\" :host \"elpa.gnu.org\" :service 80)")
  signal(error ("Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed \"failed with code 113\n\" :host \"elpa.gnu.org\" :service 80)"))
  #[257 "p\306\307!\210\310\311!r\211q\210\312\313\314\315\316!\317\"\320$\216\3211R
url-http-activate-callback()
url-http-async-sentinel(#<process elpa.gnu.org<1>> "failed with code 113\n")


texts: ido-find-file: typing "//" triggers loading of tramp

texts:
When using M-x``ido-find-file and typing "//" via keyboard in the minibuffer, some hook or function is triggered which starts loading the tramp package.

Which tramp function is triggered and how to get this information?
(in case there is more which gets triggered)

Note: this is my use-package definition of tramp:

(use-package tramp
    :defer t
    :config
    (message "tramp-loaded"))


texts: Set an Elisp var on the command line and read it in the init file

texts:
I'm trying to set a variable at load-time:

# emacs --eval '(defvar myvar t)'

Now, in this session, if I C-h v myvar RET I get a nice t. But if I put (message "MYVAR: %s" myvar) in my init file, I get a nasty Symbol's value as variable is void: myvar.

I also tried

# emacs --eval '(eval-after-load (defvar myvar t) t)'

Without luck. (How) can I set (Elisp, not ENV) variables on the command line that I can use in my init file?


texts: How can I properly reload my code from the REPL?

texts:
I have a src/example/foo.clj file:

(ns example.foo)

(defn my-fn []
  (println "Hello, world!"))

I can open it in Emacs and spin up a REPL using C-c M-j and play with it. I don't want to type long namespace names, so I alias the ones I need:

user> (require '[example.foo :as foo])
; => nil

So far so good. Everything works fine at this point.

user> (foo/my-fn)
; Hello, world!
; => nil

If I try to use a function that doesn't exist, I get a CompilerException as expected:

user> (foo/my-function)
; CompilerException java.lang.RuntimeException: No such var: foo/my-function

Now, since obviously foo still needs a lot of work, I'm actively making changes to it. I decide to rename one of my functions to something more descriptive.

src/example/foo.clj:

(ns example.foo)

(defn greet-world []
  (println "Hello, world!"))

I then save the file and reload it using C-c C-x, and that's where everything seems to break. If I try to call the function using its old name, I get an IllegalStateException instead of a CompilerException:

user> (foo/my-fn)
; IllegalStateException Attempting to call unbound fn: #'example.foo/my-fn

And if I use its new name:

user> (foo/greet-world)
; CompilerException java.lang.RuntimeException: No such var: foo/greet-world

So now my alias namespace is completely useless. I can, however, call the function using its full name:

user> (example.foo/greet-world)
; Hello, world!
; => nil

But of course, if I try to run require again, I get an error:

user> (require '[example.foo :as foo])
; IllegalStateException Alias foo already exists in namespace user, aliasing example.foo

So, how can I actually reload a namespace without restarting my entire REPL?


texts: Making pdf-tools work after successful compiling on mac os x

texts:
After installing the required dependencies with homebrew, I was able to compile pdf-tools . But I cannot make it work (I cannot see the pdf on emacs after compiling)

I would like to know if somebody can post its .emacs config to make pdf-tools work since I have not been able to make it happen. I have tried several options, like the following (copy from somebody else):

(load "pdf-tools") ;;
(setq output-pdf "PDF Tools") ;;
(pdf-tools-install)
(setq TeX-view-program-selection '((output-dvi "Okular")
                                   (output-pdf "PDF Tools") ;;
                                   ))

Or also

;; Use pdf-tools to open PDF files
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
      TeX-source-correlate-start-server t)

;; Update PDF buffers after successful LaTeX runs
(add-hook 'TeX-after-TeX-LaTeX-command-finished-hook
           #'TeX-revert-document-buffer)

But, after compiling a tex file (with C-c C-c with Auctex) and trying to see the pdf with the same command (and selecting View), I always get the error

Unknown PDF Tools viewer. Check the Tex-view-program-selection variable

I am sure I am missing a key config for making pdf-tools available or known to auctex/emacs, but cannot figure it out. Could you please post your config to get an inspiration from it? I have already checked install-pdf-tools-on-emacs-macosx, how-to-let-auctex-open-pdf-with-pdf-tools and how-to-use-pdf-tools-pdf-view-mode-in-emacs without success.

Thanks in advance.

Edit: Making already visited links more explicit.


texts:
I seem to be unable to configure hunspell to work within emacs. I have hunspell 1.7.0 and emacs 25.3. Supposedly, emacs should be able to find hunspell by default, but it seems that it is unable to find all the dictionaries, actually, it seems to be only to find "default" dictionary and returns 'nil'.
I have tried the functions named on the comments here, namely
ispell-find-hunspell-dictionaries and it seems that I do not have that function or I do not know how to acces it. Also I do now know how to acces
hunspell-dictionary-alist and ispell-local-dictionary-alist
I also tried the solutions suggested elsewhere, namely to put something like this in .emacs:

;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
(setenv
 "DICPATH"
  "/usr/share/hunspell")
;; Tell ispell-mode to use hunspell.
(setq-default
  ispell-program-name
  "/usr/bin/hunspell")

Or something like this:

(setq ispell-program-name (executable-find "hunspell")
      ispell-dictionary "en_GB")

But they also seem not work. I still have no access to the dictionaries.
I need to be able to choose dictionaries in english (both british and us variants), spanish (mexican), german (de) and portugues (Brazil). I cannot seem to grasp the solutions pointed here, and how to modify the extra entrances in .emacs for all the mentionated languages.


texts: Mixed time scales for org mode repeated habits

texts:
I'm trying to set-up an org-mode habit (i.e., "STYLE" property = "habit") to repeat at a maximum of one month, on the first of the month, and a minimum of one month and five days (the fifth of the month). Is it possible to achieve something like this, something like SCHEDULED: <2015-05-01 Fri +1m/1m5d>? Emacs doesn't see the "5d" portion in this script though--it only recognizes the "+1m/1m" and subsequently throws an error.

Is there a syntax that enables Emacs to handle this mixed time scale?


texts: How to install `*-utils` manuals in GNU Emacs on Mac OS X?

texts:
I've been using GNU manuals of core-utils and find-utils and so on in GNU Emacs when I am using GNU Linux.

They are default after installing GNU Emacs on many GNU Linux distributions.  After open GNU Emacs and C-h i I'll find the core-utils and find-utils doc if I installed core-utils and find-utils on my Linux.

On Mac, I cannot find the core-utils and find-utils docs.  I've heard that Mac uses FreeBSD as its kernel.  So I am wondering whether there is a *-utils doc that I can install in Emacs, or there is a way to install the *-utils docs of GNU Linux on a Macbook?


texts: How to prevent highlighting when using ‘xref-pop-marker-stack’

texts:
I was using dumb-jump to get back from jump definition's location. I started to get following message:
‘dumb-jump-back’ is an obsolete command (as of 2020-06-26);
‘dumb-jump-back’ has been obsoleted by ‘xref-pop-marker-stack’.

When I do elpy-goto-definition jump definition's line is not highlighted, so if possible, I want same behavior when I jump back.
Instead of ‘dumb-jump-back’ , when I use xref-pop-marker-stack it jumps back but it highlights the jumped line, is it possible to prevent the highlighting?


texts:
I'm running Emacs 25.1 on macOS Sierra. After opening Emacs using the GUI and maximizing its frame, I execute (C-x C-e) the following code:

(setq ns-auto-hide-menu-bar t)
(set-frame-position nil 0 -24)
(set-frame-size nil (display-pixel-width) (display-pixel-height) t)

This code moves the Emacs frame up so that the title bar is hidden, and then resizes the frame so that it fills the entire screen.

Problem: If I add the code above to my init.el file and relaunch Emacs, the title bar is not hidden anymore. But if I open my init.el and C-x C-e the mentioned code, then the title bar goes  away.

Question: How can I make the code above work properly inside my init.el file?

Thanks for helping!


texts: How do I show a final line number for files with a trailing new line?

texts:
I have (global-display-line-numbers-mode) in my init.el to show line numbers as well as (setq require-final-newline t) to add a newline to the end of my files. However, I notice that the line numbers don't show that final blank line. I'd like to have a final number as a visual cue that my files end in a newline, which is something other editors can do. I know the modeline shows it, but I prefer to see it in the line numbers gutter. Is there a setting or (M)elpa plugin that lets me do this?
Emacs has a trailing line without the line number:

Other editors can show that final line number:


texts: in Emacs regex, how to search for uppercase letters only?

texts:
I'm trying to build a function but having trouble with the regex. Specifically, I want to match capital letters only.

This function is supposed to capitalize words that are in lowercase (the → The) but not touch words that are already in uppercase (like #+STARTUP: or * TODO).

(defun capitalize-unless-org-heading ()
  (interactive)
(unless
(or
(looking-at "\*")
(looking-at "[\n\t ]*\\*") ; don't capitalize an org heading
(looking-at "* TODO") ; don't capitalize an org todo heading
(looking-at "[\n\t\ ]*#+") ; don't capitalize org options like #+STARTUP:
(looking-at "[\n\t\ *[A-Z]") ; don't capitalize any word that might be all uppercase
)
(capitalize-word 1))
)

If it matters, case-fold-search is set to t so I can search for text in my buffers without worrying about case. How do I build a regex to search for uppercase letters only?


texts: Naming convention for variable and function names

texts:
When programming in Emacs Lisp, should variable and function names always be lower case? According to The Emacs Lisp Style Guide they should use "lisp-case", but what is that? In Emacs Lisp manual the case of symbols is not mentioned.

The motivation for this question came when I studied the Lisp code for M-x buffer-menu, see  https://github.com/emacs-mirror/emacs/blob/master/lisp/buff-menu.el

We see that the code mixes two types of symbols. One type is starting with Buffer-menu (note capital B) and the other is starting with buffer-menu.. I think this is confusing, is this a recommended way of programming?


texts: Properties inheriting in org doesn't work

texts:
I have this sample org file:

#+COLUMNS: %25ITEM %TODO %5owner %3PRIORITY %TAGS
* test1
  :PROPERTIES:
  :owner:    own1
  :END:
** test2
** test3

I also have in my .emacs file:
(setq org-use-property-inheritance (quote ("owner")))

Why the "owner" property is not inherited to headings "test2" and "test3"?
In column view the column "owner" is empty for above headings:

I also tried (without success):

.emacs file: (setq org-use-property-inheritance t)
changing :owner: in the "test1" drawer to :owner_ALL:
using file property: #+PROPERTY: owner_ALL own1


texts: org export interanl [[links]] to keep link text

texts:
When exporting a document such as:
 * Title

 Link to [[Title]]

The link text is converted to the section number. I.e.

1. Title
Link to 1

Is there a way to keep the link text e.g.:

1. Title
Link to Title

Without having to write each link as [[Title][Title]]?


texts: Interaction between package, use-package, and quelpa

texts:
I am testing quelpa with my use-package configuration. My question is: Is quelpa meant to complement use-package, or rather to replace it?

I have the following code in my init file:

(require 'package)
(package-initialize)
(setq
 package-enable-at-startup nil
 package-user-dir (concat user-emacs-directory "elpa")
 package-archives
 '(("melpa" . "http://melpa.org/packages/")
   ("marmalade" . "http://marmalade-repo.org/packages/")
   ("org" . "http://orgmode.org/elpa/")
   ("gnu" . "http://elpa.gnu.org/packages/")
   )
 package-archive-exclude-alist
 '(("melpa" elnode)
   ("melpa" org-trello)
   ("melpa" org)
   ("marmalade" org)
   ("gnu" org)
   ("org" org))
 )

(if (require 'quelpa nil t)
    (quelpa-self-upgrade)
  (with-temp-buffer
    (url-insert-file-contents "https://raw.github.com/quelpa/quelpa/master/bootstrap.el")
    (eval-buffer)))
(setq quelpa-upgrade-p t)

(quelpa 'use-package)
(require 'use-package)

(package-initialize)


texts: How to move marked files or file under point in dired to a pre-defined directory?

texts:
I am trying to create a simple function for dired where I would be able to call the function on current (or marked) files and then quick move the current (or marked) files to a pre-defined directory.

I know I need to write a function and use dired-do-rename but I am unclear of other steps (I have zero coding skills :))

This is what I have so far:

(defun z/dired-move-2home ()
  (interactive)
  (dired-do-rename FILE/MARKED FILES "~/Downloads"))


texts: How to make Emacs edit JSON data in `json-mode`?

texts:
I am working with GNU Emacs 23.1.1. When working with a .json file it is treated in the Fundamental mode:

How can I have the json file treated in the json mode?

I note that GNU Emacs 24.3.1 opens json files as Javascript which already allows formatting.


texts: Why symbol-value throws a void-variable error with a let form if lexical binding is on?

texts:
Here's a simple example from the manual:
;; Here the symbol ‘abracadabra’
;;   is the symbol whose value is examined.
(let ((abracadabra 'foo))
  (symbol-value 'abracadabra))
⇒ foo

Why does this throw an error with lexical binding? The variable is bound in the let, isn't it?
Emacs 26.2


texts: Rectangular blocks appear when I start emacs

texts:
So this is happening from past few days.
When I start Emacs it is displaying rectangular block for each character.

and when I start Emacs inside the terminal with the -nw option it starts renders fine inside the terminal.
emacs -nw

Not sure of what might be wrong?


texts:
I have a file (my org-mode todo list) that I keep in sync across my machines, and I often leave it open in Emacs. Thus, I placed the following in my .dir-locals.el in the same folder as this file:

((org-mode . ((auto-revert-mode . 1))))

I know it has taken effect, because my modeline shows ARev, among others.

However, the file never auto-reverts. Even if I have been away from my machine all day, making changes on another machine and syncing them, I don't see the changes. The sync was successful though, because as soon as I try to type in that buffer, I see

<me>.org changed on disk; really edit the buffer? (y, n, r or C-h)

I can hit r at that point to revert the buffer, but I would rather just have that happen automatically.

Why is my file not being auto-reverted? What can I do to determine the cause of this problem?

I am running Emacs 24.4, and I have seen this behavior both on Windows 8 and on Debian Jessie.

Edit: Forgot to check this originally, but the problem doesn't happen when I run emacs -Q. This means that it is caused by something in my init file.

Edit 2: The problem only occurs when using the .dirs-locals file. If I open a file, do M-x auto-revert-mode, and edit it elsewhere, it reverts automatically, even using my full init file.

Edit 3: I was mistaken: The problem does occur when running emacs -Q if I use the .dirs-locals.el posted above. So it is not a problem with my init file.


texts: Beginner: emacs org-agenda view: Beginner-friendly explanation of other answers on Emacs:SE

texts:
I am new to using Emacs and org-mode. In my current situation, I am using org-agenda view to overview and later exporting my TODO-tasks. However, when I view my TODOs with org-agenda, all TODO-marked headings have level 1 (well, are flattened to level 1). How can I preserve the level of TODO headings while viewing it in org-agenda and exporting it to another file?
For example:
tasks.org
* TODO Feed the cat
** TODO Wash dishes
* TODO Feed the dog

I get:
exportedAgendaView.org
* TODO Feed the cat
* TODO Wash dishes
* TODO Feed the dog

I have found these answers with identical issue:
TODOs 1
TODOs 2
But these answers are using terms (breadcrumbs) and functions (org-agenda-prefix-format) I dont know how to find or use. If I try to simply copy-paste code from accepted answer in TODOs 2 to config.el; I get no change in the org-agenda view or in the exported file.
Is this achievable? And could required steps be explained in beginner-friendly terms?
Final note: I am using Doom Emacs "distribution", if that is a factor.
Thank you in advance for any help with this.
Regards, Tomas
EDIT
How am I getting org-agenda view and export to file:
In Doom Emacs (I hope that regular Emacs use same functions, I translate keyboard shortcuts to Emacs functions as much as I am able):
First I use M-x org-agenda, then in minibuffer I choose another keybinding - t, listed as "List of all TODO entries" (I think it is global TODO-list). This buffer (agenda view?) I am exporting with org-agenda-write (standard keybinding could be C-x C-w).
Is that correct way how to export todo-tasks?


texts: Asterisks render as question marks in org mode

texts:
I am trying to join the Church of Emacs and I installed it because I wanted to use the org-mode.

I am using the Doom Emacs distribution.

The problem I am facing is that when I put * and press space I see a ? rather than a nice bullet. (See the image).

What is wrong?

EDIT: Cross posted here at github.


texts:
I have to collaborate with someone who uses Word.  I can open the document
(which has comments) in Libre-Office, but I want a proper editing environment.
What can I do?


texts: Display months/days or timestamps in another language than English

texts:
Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL compiled from EmacsW64.

Windows 7 x64 Dutch version.

Situation:

When I'm evaluating the following snippet:

(format-time-string "%B")

It gives me "August" as result. In the Dutch language, we have "augustus" (spelled in another way, and without any case).

And my operating system is also in Dutch language. When I tried (setq system-time-locale "nl_NL") to no avail.
When I check the value of current-language-environment, it gives me UTF-8 as value.

Another suggestions to get the days/months displayed in Dutch?

Update:

things are getting weird. On the Windows with the Dutch language (my work pc), I get "August".
On my home pc with Windows with the English language, I get "augustus". And it's with the same Emacs configuration. So I guess it's not related to the operating system.


texts: How to format code comprehensively, not just indent region, but apply correct coding style

texts:
I switched from Sublime Text a little over a month ago and I prefer emacs, but something that I haven't been able to find are external packages that do more than just give you more than correct indentation.

For example these packages for sublime:

Astyle Formatter
HTML-CSS-JS Beautify
Auto PEP8 Format

I haven't been able to find the equivalent for in emacs. Do any packages like this exist for emacs?

If they don't, the interesting thing about some of these packages is that they work off running already installed nodejs modules, and I'm curious if I can somehow assign my own keybindings to manually run those nodejs programs.


texts: How to track user changes in the buffer?

texts:
I would like to make a mode that would react to user changing the buffer. One way i know is to use hooks.

What hooks, other then post-self-insert-hook, should i use?

What changes i am interested in:

entering text
changing indentation
deleting text
yanking

And maybe, in future, so-to-sy:

changes in cursor position

In general, some way to react to changes in the buffer would be sufficient.


texts: When editing files, some foo.bar~  backups appear  (files ending with a tilde ~). How can I control their creations, and is it possible to ask for a recursive bulk deletion of all files from a specific directory and all it's sub directories?


texts:
I'm using a virtualenvwrapper setup for Python. On my emacs, I have virtualenvwrapper and jedi installed from MELPA.

What I currently do is, I open Emacs, M-x venv-workon RET blabla RET, then M-x jedi:setup RET. Now I have Numpy installed in environment blabla, but not globally. After workon and restarting of the Jedi server, I anticipate Jedi would auto complete Numpy functions from the package automatically. Say when I type import numpy; numpy., after the dot, I want Jedi to jump out and give me a list of completions. But it doesn't. I tried jedi:install-server, it installs it to the old path ~/.emacs.d/.python-environments/default. I guess Jedi is not reading virtualenvwrapper correctly. What's the right way to setup Jedi with virtualenvwrapper?


texts: Syntax highlighting of keywords only if following builtin

texts:
I'm writing a syntax highlighting mode and am trying to highlight certain arguments, only if they are following a specific word.
I've written a MWE to show my problem:
(defvar mwe-builtin-list '("func" "proc" "height"))
(defvar mwe-args-list '("high" "low" "meduim"))

(setq mwe-builtin-regexp (regexp-opt mwe-builtin-list 'symbols))
(setq mwe-args-regexp (concat "height " (regexp-opt mwe-args-list)))

(defvar mwe-font-lock-keywords
  `(
    (,mwe-builtin-regexp (0 font-lock-builtin-face))
    (,mwe-args-regexp (2 font-lock-keyword-face)) ;; <- Not working
    ))

(define-derived-mode mwe-mode prog-mode "MWE-mode"
  "Major mode for MWE mode to tinker with syntax highlighting"
  (font-lock-add-keywords nil mwe-font-lock-keywords))

(provide 'mwe-mode)

For the example buffer which contains:
# words should have font-lock-builtin-face (working)
func
proc
height

# word "height" should have font-lock-builtin-face (working)
# word high|low should have font-lock-keyword-face (not working)
height high
height low

# should not be highlighted as out of context
high
low
medium

All the "func|proc|height" words are highlighted correctly, but the high|low arguments in the second paragraph aren't highlighted.
I don't want to simplify the mwe-args-regexp to match all instances of "high|low|medium" as I want the third paragraph to not be highlighted (the arguments are there, but not in the correct context to be highlighted)


texts:
I'm try to setup my golang IDE on doom-emacs.

I've go installed

    $ go version
    go version go1.14.3 darwin/amd64

gopath is set -

    $ echo $GOPATH
    /Users/rajkumar.natarajan/go

$PATH is set as -

    $ echo $PATH
    /Users/rajkumar.natarajan/.cargo/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/Users/rajkumar.natarajan/.local/bin:/usr/local/opt/openssl/bin:/usr/local/opt/openssl/bin:/Users/rajkumar.natarajan/.sdkman/candidates/sbt/current/bin:/Users/rajkumar.natarajan/.sdkman/candidates/maven/current/bin:/Users/rajkumar.natarajan/.sdkman/candidates/kotlin/current/bin:/Users/rajkumar.natarajan/.sdkman/candidates/java/current/bin:/Users/rajkumar.natarajan/.sdkman/candidates/gradle/current/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/share/dotnet:~/.dotnet/tools:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Applications/Wireshark.app/Contents/MacOS:/Users/rajkumar.natarajan/.nvm/versions/node/v8.15.0/bin:/Users/rajkumar.natarajan/n/bin:/Users/rajkumar.natarajan/go/bin

As you see $GOPATH/bin is in $PATH.

gopls is installed as well -

    $ which gopls
    /Users/rajkumar.natarajan/go/bin/gopls

    $ gopls version
    golang.org/x/tools/gopls 0.4.1
        golang.org/x/tools/gopls@v0.4.1 h1:0e3BPxGV4B3cd0zdMuccwW72SgmHp92lAjOyxX/ScAw=

But when I open a gocode in file I get error LSP :: No LSP server for go-mode (check *lsp-log*)

I check this [comment][2go mod init /root/TestApp] in github If I do SPC h d d I didn't get anything

Below is the M-x getenv RET PATH RET result -

Note - My Os is macos sierra 10.12.6 version

I tested this in fedora as well and same issue is happening.

    $ lsb_release -a
    LSB Version:    :core-4.1-amd64:core-4.1-noarch
    Distributor ID: Fedora
    Description:    Fedora release 31 (Thirty One)
    Release:        31
    Codename:       ThirtyOne

Any idea how can I fix this issue?


texts:
This is a follow-up to this question about changing labels on priorities. The question refers to setting the org-mode priorities to something like #1 #2 #3 #4 #5 instead of #A #B #C. Now, from the org-mode documentation it appears that org-highest-priority, org-lowest-priority, and org-default-priority must be in alphabetical order. In addition, these priorities are chars, and thus cannot be replaced with a string. I take it this is because org-mode computes display order of priorities in the agenda using direct comparison operators on the priorities. Now, the question becomes, is there an easy way to display the priorities as something like High, Medium, and Low, even if underneath it treats it as #A #B #C?

Thank you!


texts: Expand an archived org-mode subtree with just TAB

texts: I like to use the archive tag just to collapse the subtree automatically on opening the file (and also its gray coloring); I do not see why it should force me to use some esoteric hotkey (which my terminal emulator doesn't support) to expand the archived subtree. Any way to remove this limitation?


texts: How can I remove clipboard from being the default register?

texts:
I'm using emacs with evil keybindings (specifically spacemacs).
The default behavior of the paste command p is to paste in the clipboard, and default behavior of the delete command d is to put the removed text on the clipboard.
However, when you use vim this is not the default behavior. In vim, clipboard is on the '+' register and the default register is not in sync with the clipboard.
This has some benefits like delete commands do not overwrite your clipboard, and if you do want to overwrite the clibpoard you have to do some extra work by pressing "+d.
Instead of learning evil defaults, I was wondering if there is a way I can move keyboard to the '+' register. I use multiple editors with vim emulation so this minimizes friction for my workflow.


texts: How does one type  or  on a keyboard (in Emacs)?

texts:
I recently came across these two keybindings in someone else's config and haven't seen them before. I have a US qwerty keyboard, a Kinesis Freestyle Pro. I know where the control, C, key is, and I see a Menu key in the left auxilliary cluster of my keyboard, but when I ask Emacs, C-h k, to describe C-menu it says: <C-linefeed> is undefined. So the Menu key produces is linefeed? And, I don't know where the <next> key is, I can only assume it is the media next key?

Even better, how would I ask Emacs for these values? I know about C-h k, describe-key, but is there a way, something like C-x 8 return that would show me all the keys I could use including odd ones like?


texts: Autocompletion of relative, not absolute, file name

texts:
I am typing a Tex file with Emacs and I want to be able to include the relative path of an image file name from inside Emacs.

For example, my Tex file that is being opened in Emacs is located at ~/mydir/mytex.tex. The image file whose path I want to import is located in ~/mydir/figdir/fig1.png. How can I get the path ./figdir/fig1.png from inside Emacs also with autocomplete feature, e.g. if I type the letter f it should suggest figdir among other possible files or directories starting with f.

I feel that this kind of thing is not necessarily something that is only relevant with LaTeX. It should apply generally with any kind of docs opened by Emacs.


texts: emacs breaks down text snippet copied from another X Window application

texts:
When I select with a mouse a block of text in Firefox or VIM for example, copy it and then try to paste in Emacs, it gets pasted, but unaligned, meaning that beginning of the lines shift away to the right.

What is happening, and what would be the appropriate solution? Thanks.


texts:
How do I get into the agenda buffer?

I tried C-c a, but it doesn't work; nothing happens.


texts: Is there an equivalent to sed-style substitution commands from vim?

texts:
One of the things I miss from vim is being able to type in a substitution command that will work over multiple lines, for example:

:/begin/,/end/s/foo/bar/g

The above command substitutes "foo" for "bar" starting with the first line containing "begin" and ending with the next line after that containing "end".

Is there a way to do something similar in emacs?


texts: Polymode installation on Windows machine

texts:
Polymode is very promising to handle the integration of R chunks using different modes.
I went through the documentation and it works well when I am inside .Rmd file but not inside .Rnw. In the .Rnw I found the Noweb mode activated without polymode PM-rmd. So there must be something wrong with my installation on Windows machine.

installation
I installed rmarkdown-mode from MELPA, BTW this was not shown clearly in the documentation of polymode, I wish there was a requirement section in it.

I was confused about that part of installation:

(setq load-path
      (append '("path/to/polymode/"  "path/to/polymode/modes")
              load-path))

Because in Windows, polymode resides in c:/emacs/.emacs.d/elpa/polymode-20150105.931/ but I don't see the \modes folder in there! So is the above code needed if I had used install-packages from MELPA?

I installed the polymode package from MELPA. M-x list packages.

I have pandoc installed and checked in the PATH variables by M-x getenv RET PATH RET; pandoc was there.

relevant .init.el code

(require 'poly-R)
(require 'poly-markdown)
;; Markdown
(add-to-list 'auto-mode-alist '("\\.md" . poly-markdown-mode))

;;; R related modes
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))
(setq ess-swv-processing-command "%s(%s)") % this to get rid of .ess_weave() function not found error

MWE of .Rnw file

\documentclass[a4]{scrartcl}
\begin{document}
  Here is a code chunk.
<<demo, fig.height=4,message=FALSE,warning=FALSE>>=
library(ggplot2)
summary(cars)
qplot(speed,dist,data=cars) +
  geom_smooth()
@
You can also write inline expressioins, e.g. $\pi=\Sexpr{pi}$.
\end{document}

Notes

Windows 7 32 bit
Polymode updated from MELPA

Update
I used this code right after ESS code in the init.el and it worked well:

(require 'poly-R)
(require 'poly-markdown)
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))

I realized that for MELPA installation these lines of code in the documentation are irrelevant:

(setq load-path
      (append '("path/to/polymode/"  "path/to/polymode/modes")
              load-path))


texts: How to obtain the statistic of the the frequency of words in a buffer

texts:
For linguists and many other scientists, analyzing the frequency of the words appearing in a text is an great tool. Some commercial text editors and some websites provide this tool.

The word frequency analysis, sort the words in decreasing order with respect to their frequency. For example in this text

Emacs Stack Exchange is a question and answer site for those using, extending, or developing the emacs text editor. It's built and run by you as part of the Stack Exchange network of Q&A sites. With your help, we're working together to build a library of detailed answers to every question about emacs.

we have:

56 words
9: punctuation marks

3: ,
3: .
3: a
3: emacs
3: of
2: '
2: and
2: exchange
2: question
2: stack
2: the
2: to
1: &
1: about
1: answer
1: answers
1: as
1: build
1: built
1: by
1: detailed
1: developing
1: editor
1: every
1: extending
1: for
1: help
1: is
1: it
1: library
1: network
1: or
1: part
1: q
1: re
1: run
1: s
1: site
1: sites
1: text
1: those
1: together
1: using
1: we
1: with
1: working
1: you
1: your

I am wondering if there exists already a package which can be used to provide such statistics.

PS I have already asked different question in the same esprit and an excellent answer  was provided (I wish to upvote it more if I could).


texts: extra frame in (visible-frame-list) when started in daemon mode, is causing problems

texts:
When I start emacs (emacs), and then eval (visible-frame-list), I get a list with one frame, the one that is visable. However if I start emacs as a daemon (emacs --daemon), and then eval (visible-frame-list) (emacsclient --eval '(visible-frame-list)'). I also have one frame, but as expected this is none visible.

This causes a problem, because after I do emacsclient -c I get a real frame, and (visible-frame-list) evaluates to two frames.

Why is this a problem? I have some emacs lisp code that does shuts down emacs when there are no-longer any frames, but it does not trigger because of this out by one error.

(defun intelligent-close ()
  "quit a frame the same way no matter what kind of frame you are on"
  (interactive)
  (if (eq (car (visible-frame-list)) (selected-frame))
      ;;for parent/master frame...
      (if (> (length (visible-frame-list)) 1)
          ;;close a parent with children present
          (delete-frame (selected-frame))
        ;;close a parent with no children present
        (save-buffers-kill-emacs))
    ;;close a child frame
    (delete-frame (selected-frame))))

I could “fix it” by changing the 1 to a 2, but I suspect that this will cause it to get a false positive at some point in the future.

Can you help to:

get rid of this extra frame
be confident that my hack will always work
OR find another solution

A don't care which.

note
If I do

emacs --daemon
emacsclient -c --no-wait
emacsclient --eval '(delete-frame (car (visible-frame-list)))'
emacsclient --eval '(visible-frame-list)'

Then I get the desired result (for this state).


texts: Derived major mode: new keyword fontification not playing nice with parent mode's

texts:
I am writing a major mode derived from f90-mode in order to fontify the syntax of a commonly used Fortran preprocessor, fypp (similar to jinja2 for HTML templating). Here's a contrived example of what that looks like, with plain f90-mode highlighting on the left and my fypp-mode on the right.

The #: directive and the ${...}$ evaluator are new syntax atop Fortran, which is why f90-mode does not color them properly. I want my major mode to inherit the fontifications defined in f90-mode.el and add to them. Here's a minimal but representative implementation
;;; fypp-mode.el

(setq fypp-highlights
      '(("#:set" . font-lock-preprocessor-face)
        ("\\${\\|}\\$" . font-lock-preprocessor-face)))

(define-derived-mode fypp-mode f90-mode "fypp"
  "Major mode for editing Fortran code with fypp extensions"
  (font-lock-add-keywords nil fypp-highlights))

I have two complaints with this, seen in the right-side image above:

The ${...}$ syntax in the subroutine name declaration breaks the fontification of the subroutine name.

The ${...}$ inside a string literal does not get fontified, but I would like it to.

Issue #1 I am able to solve by modifying the syntax table entries for { and } to make them word class instead of parentheses. I do wonder if this is likely to bite me later, though.
Issue #2 is the trickier matter for me. Normally, you want strings fontified as strings, even if they happen to contain keywords. Here, though, the string "Hello, ${whom}$!" will get expanded by the preprocessor to "Hello, world!", so I want the ${...}$ to be fontified. I still want string literals to be fontified, I just want my preprocessing tokens to "take precedence". But I don't know how to do this cleanly, if at all.


texts:
When I write Python code, I personally prefer indenting with 4 spaces instead of a tab. However, in my day job I work with a codebase that uses only tabs.

When I open one of these files in emacs, tabs display eight spaces wide. I have tried adding both (setq-default tab-width 4) and (setq tab-width 4) to my init file, but neither of these seem to have any affect on this problem. I have used whitespace-mode to confirm that it is indeed one tab that I am seeing and not two, and that they are indeed eight spaces wide. When I check the value of the variable tab-width from whatever buffer I am having the problem in, I get the following message:

tab-width is a variable defined in `C source code'.
Its value is 8
Local in buffer <whateverbuffer>; global value is 4

I know that I want Its value to be 4 instead of eight, but I have not had any luck setting it. Also, in the documentation it says of tab-width: Automatically becomes buffer-local when set...I have a feeling my problem stems from this, but I don't quite understand what this means. Any suggestions? Thank you!