texts:
I've been using magit for a couple of weeks now and I really really like it. There is, however, one thing I still can't get to work, which is the highlighting of changes. In the pictures used in the walkthrough on Magit's website, changes are highlighted. Not so in my case. This is what a typical change looks like on my machine, using the Zenburn theme, but other themes are doing the same thing.

After the response I got from tarsius I checked if I had the magit-diff-refine-hunk variable set to "all", which was the case

I then checked if anything had changed, but at first sight nothing had.

But then I noticed something. If I selected the line with the changes, I could actually see the magit makes some kind of distinctions, but one that is only visible when the line with the changes is selected, like so:

So the question now is: how to get these changes to be visible when nothing is selected?

Ideas, anyone?

All the best,

MPE


texts: Is there a setting to center the text after any jump?

texts: For any jump to a new buffer(for example from the ack buffer or godef-jump) point is left at the very bottom of the window. Is there a global configuration to automatically center occur and similar buffers without wrapping every conceivable function that jumps point very far away?


texts: How to improve ‘jedi‘ package's load time

texts:
When I try to use jedi package I get following message in the minibuffer.
This feature requires the ‘jedi‘ package to be installed. Please check ‘elpy-config‘ for more information.

Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.34.0
Virtualenv........: venv (/home/alper/venv)
Interactive Python: python3 3.7.5 (/home/alper/venv/bin/python3)
RPC virtualenv....: rpc-venv (/home/alper/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.7.5 (/home/alper/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.17.2
 Rope.............: 0.16.0
 Autopep8.........: 1.5.3 (1.5.4 available)
 Yapf.............: 0.29.0 (0.30.0 available)
 Black............: 19.10b0 (20.8b1 available)
Syntax checker....: flake8 (/home/alper/venv/bin/flake8)

After few minutes it starts working or when I restart emacs there are some cases that it starts working right way. So its behavior is random for its load time to start.
=> Is there anything I can do to prevent this error to force jedi to start right away? or is this a normal behavior of jedi?
Please note that I had similiar question (elpy - This feature requires the ‘jedi‘ package to be installed), but it was not related to jedi package's load time.


texts: How to delete all buffers in shell mode quickly

texts:
Emacs 26.1
First I create several buffers in shell mode.

Then I open ibuffer (C-x C-b) and mark all shell buffers manually by pressing D to delete them.
It works, but it's very slow. Is there a quicker method for deleting all buffers in shell mode?


texts: Make ending curly brace of block go down an extra newline in Golang

texts:
Upon pressing enter inside a newly created block I would like the Emacs to move the ending curly brace an extra newline down, and then indent the cursor. Is this possible?

Example

Before pressing Enter

for i := range x {<cursor>}

After pressing Enter once I get this

for i := range x {
<cursor>}

However what I would like to get is this

for i := range x {
    <cursor>
}


texts: How can I more easily see interactively whether `overwrite-mode` is enabled?

texts:
I am sick of pressing Insert instead of Backspace and running into problems in certain modes.
How can I fix it?
One option is to have some visual indication that overwrite mode has been activated, so I can press Insert again and correct my mistake.


texts: Moving a subtree to the top or bottom of its parent

texts:
How could one write a function to move an org subtree to the top or
bottom of its parent?

I thought of repeating org-move-subtree-up/down until it reaches an
extreme, but unfortunately it doesn't return any indication of whether
it succeeded in moving anything.


texts:
Is there a simple way to add parent node in org-mode?

* heading
... # 100 or more first-level headings over here
* heading # interspersed with ones with subtrees
** heading
** heading
*** heading
...

I would like to add a NEW HEADING to the above so that everything else shifts down and right.

* NEW HEADING
** heading
*** heading
*** heading
**** heading
...

Currently, selecting everything and hitting M-→ works just some of the time. It gets cumbersome when many sub and/or sub-sub headings are involved.

Note:

I presently use mark set to select region to be demoted. It works only in a specific way and not all the time. Namely, I need to:

C-@ ↓ somewhere above the first * heading
Move the cursor to the left-most * just below the region the be selected
Hit M-→

Any other method would fail incessantly.


texts:
Windows 10, Emacs 25.1, Dired+

Here example of my folder's content:

As you can see the files and folder are mixed. But I want first to show list of folders and after show list of files.
Is it possible?

With respect to the answer by @Drew:

I install dired-sort-menu and add in my init.el the next line:

(add-hook 'dired-load-hook
          (lambda () (require 'dired-sort-menu)))

and restart Emacs. But ... how open sort menu? When I mouse right click on Dired buffer I get another menu.

Here my screenshot:


texts: Sentence in text is read only even though the buffer is not, how to fix this?

texts:
I am running emacs 24 with the Inferior Python mode for the interpreter.
See below for all the minor modes in effect. Basically the problem is that particular lines (say at the prompt) remain read-only even when I mark toggle "read-only-mode" and I can edit the rest of the buffer.

I am not able to figure out why this might be happening.  I have tried toggle-read-only as well. It seems like something related with the font-lock or something else since the behavior happens only at the python prompt lines.

The buffer is running the following minor-modes.

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Column-Number Compilation-Shell Diff-Auto-Refine Electric-Indent
Electric-Pair File-Name-Shadow Font-Lock Global-Company Global-Ede
Global-Eldoc Global-Font-Lock Global-Semantic-Decoration
Global-Semantic-Highlight-Func Global-Semantic-Idle-Completions
Global-Semantic-Idle-Scheduler Global-Semantic-Idle-Summary
Global-Semantic-Mru-Bookmark Global-Semantic-Show-Unmatched-Syntax
Global-Semanticdb Ido-Everywhere Line-Number Mouse-Wheel Recentf
Semantic Shell-Dirtrack Tooltip Winner


texts: How to graphically represent Meta characters

texts:
Given that the variable x contains the numeric representation of the key "Control-Z", say

(setq x ?\C-z),

one may graphically represent its contents by issuing the command

(char-to-string x),

producing the usual representation of "Control-Z", namely "^Z".  I would like to acheive a similar effect in case x contained the numeric representation of "Meta-Z", namely

(setq x ?\M-z).

However my system represents "Meta-Z" as the number 134217850, and (char-to-string x) now causes the error (wrong-type-argument characterp 134217850).   I am aware that the graphical representation of "Meta-Z" is not as standard as
for "Control-Z", since the latter is part of the ASCII code while the former isn't, but anything legible, such as "M-Z" would be better than the big number 134217850.

My question is thus: which standard elisp function should I use in order to transform numerical representations of Meta characters into a legible string?


texts: Icicles custom sort function is inappropriate?

texts:
I'm trying to define a new sort function in icicles that sorts by flx score.

(defun icicle-flx-score-greater-p (s1 s2)
  (message "Testing testing!")
  (>
   (car (flx-score s1 icicle-current-input))
   (car (flx-score s2 icicle-current-input))))

(icicle-define-sort-command "by flx score"
                            ;; icicle-dirs-last-p
                            icicle-flx-score-greater-p
                            "Sort completions by flx score.")

However, trying to use this sort function results in:

  Inappropriate sort order - reverting to UNSORTED

The funny thing, though, is that Testing testing! is never printed.

What am I doing wrong here?


texts: How do I move custom- commands into a separate file and include them in .spacemacs?

texts:
I don't know whether it is because I started using org-mode but when I checked the .spacemacs file this is what I found:

;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(org-agenda-files (quote ("~/doc.org"))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

I don't know what Custom is but on further research I find out that I can create a separate file and configure .spacemacs to read from it. eg

(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)

Where in .spacemacs should this part go? When copied into custom.el should they be copied directly as they are, ie into the top-level of the custom.el, or are they supposed to go into a function which will then be called from .spacemacs?


texts: Query replace with different replacements

texts:
Suppose we start with the following

Adam ate an apple.

Adam ate an apple.

Adam ate an apple.

Adam ate an apple.

Adam ate an apple.

I want to replace Adam with Bob, Chris, and David. So I want to do it such that I call a query-replace-like function, search for Adam and then cycle through the results specifying what to replace it by.

I am guessing there are three possible answers here:

Write a function to do it, which I haven't tried.
There is a way to do it using query-replace-like function which is what I am looking for.
I realize that I could do C-r during query-replace, but I was wondering if there was a way to avoid that.


texts: How can I find out what face I need to change in the mode-line?

texts:
I have a UI element in my mode-line provided by which-func-mode. I also have it in my header-line, pictured below (the blue "render" text):

How can I find out which face this is so I can style it to make it easier to read?


texts: Mongo console doesn't behave properly in ansi-term

texts:
In ansi-term when using mongo console (or 'repl') control codes do not seem to behave properly.

When I move cursor it doesn't get redrawn at a expected location. Instead all entered text get appended to the input. The same goes for backspace. My input does get interpreted, however, it is not displayed correctly.

Here's result of typing 'testtest', then pressing backspace.
$TERMINFO value is set to 'eterm-color'

Thanks for any suggestions!


texts: org-mode how to increase header level recusively in org file?

texts:
How can I increase the level of headers recursively? example:

 * Top header
 ** Sub header
 *** Sub sub header

To :

** Top header
*** Sub Header
**** Sub sub header


texts: Web mode -indentation is misaligned on skipping semicolons

texts:
When i indent javascript code (inside html - web mode) that has no semicolons in it, the next statements are indented right with two extra spaces,

    <script>
 function processTemplates(){
   var tmpldata = $( "#suiteSummaryTemplate" ).tmpl( tempData );
   $(tmpldata).appendTo( "#example" )
     //$( "#example" ).html(tmpldata)
     var logSummTmplStr = $( "#logSummaryTemplate" ).tmpl( logSummaryData )
     $(logSummTmplStr).appendTo( "#logs_table" )
     //$("#logs_table").html(logSummTmplStr)
}
</script>

After adding semicolons to a line, it works properly like,

  var tmpldata = $( "#suiteSummaryTemplate" ).tmpl( tempData );
  $(tmpldata).appendTo( "#example" )

In javascript-mode, when i place the same code in a js file (after removing the script tag), it works properly.

How can i achieve this correct indentation without forcing the user to use semicolons everywhere?


texts:
Though SMIE seems to be indenting my little language very nicely, and forward-sexp also works well, I don't get backward-up-list working as desired.

My grammar:

(defvar holscript-smie-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    '((id)
      (decl ("Theorem" id ":" quotedmaterial "Proof" tactic "QED")
            ("Definition" id ":" quotedmaterial "Termination" tactic "End")
            ("Definition" id ":" quotedmaterial "End")
            ("Datatype:" quotedmaterial "End"))
      (quotedmaterial)
      (tactic (tactic ">>" tactic)
              (tactic "\\\\" tactic)
              (tactic ">-" tactic)
              (tactic ">|" tactic)))
    '((assoc ">>" "\\\\" ">-"  ">|")))))

If I have my cursor inside a Theorem (at * below, say):

Theorem name:
  statement
Proof
  tactic1 `*` >> tactic2
QED

then I can navigate along the tactics nicely.  If I have the cursor on Theorem I can use C-M-b to navigate a sequence of Theorems nicely too.  But if I'm between the Proof and QED keywords (or the Theorem and Proof keywords), I can't use backward-up-list to get me to the top level of that phrase.  Instead, I get a Scan error: "Unbalanced parentheses", and I shoot to the top of the whole file.

It seems to me as if the grammar is defining the Theorem-Proof-QED syntax as a sexp-like thing (and wrt to forward-sexp this also seems true), but backward-up-list doesn't seem to agree...


texts:
I use ibuffer-vc, a replacement for list-buffer that displays the VC status of the listed files. I noted that the VC status stays as "edited" even after I push my changes. That is, the VC status does not differentiate between the following two situations:
(1) I modified a file and I still have to push my changes; and
(2) I pushed my changes and the local and remote versions are the same.

The VC status for both situations is "edited". However, I would like to differentiate between these two types of situations.

My question is: Assuming that this is the typical behavior of VC status, is there a way of changing my Emacs config so that the VC status could differentiate between the two situations cited above?

Note: I use git and magit for my version control. My understanding is that ibuffer-vc uses vc-state to get the status of a file.


texts: Searching text between markers as in Nota Bene

texts:
The Word Processor Nota Bene has a feature which I would like if possible to emulate within Emacs. One can insert into a document non-printing markers which are then used to delineate areas of text or individual keywords to be indexed in text files.  For example in the paragraph below the area in double brackets would be the area that would be searched in a document, as opposed to the whole document.

[[Emacs is the extensible]], customizable, self-documenting real-time display editor. This manual describes how to edit with Emacs and some of the ways to customize it; it corresponds to GNU Emacs version 26.3.

If one then did a search through the Nota Bene search tool Orbis, one would search for (say) the word "extensible" and only the text between the markers would be searched. This allows one to more easily find specific information in a file, rather than having to search through dozens of possible hits.


texts: How to pass a prefix argument to helm-m-x?

texts:
I have read the prefix has to be added after running helm-m-x, but I don't know how to do it.

For example I want to pass an argument to shell. When I run helm-m-x and then C-u I see in the mode-line [prefarg:4]. On the next key press there will be 4 occurrences of the key instead of only the first one.

How can I do this?


texts:
I'm using auctex with texlab as a language server for latex, the problem i have is that i get multiple previews of the same equation
my question is how to get only one preview?


texts: ALT as my modifier key stops me using a pound sign

texts:
I've just switched to Spacemacs (Evil mode), as it is time to change things up, having used Sublime Text for years.

I have a British Mac keyboard which relies on ALT + 3 to output the pound sign (#).

If I want to run :#,#s/ then I get a message saying no window 3, so I need to fix my key bindings and I guess the modifier key needs to move.

What is the best approach here?
Are there other British keyboard users, who can advise me on what they have done and how to do it effectively?


texts:
I am trying to add Magit to Emacs package list.
I got as far as "Packages" menu and do not see how to add new, unlisted package. Is it even possible from Emacs ?

I even tried to "i-install"  highlighted package from the list but I have no idea WHERE to input it.

OK I got to Melpa and I am following the instructions to add new package to the list..
To add new package I have to do Alt -x  ....
But I do not know where in Emacs I am supposedly to put / type  this  Alt x .... ( see post title )

I am getting this error and I have no clue what to call the form the error is displayed on. Sorry.
.....
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:80 [2 times]
Beginning of buffer
command-execute: Buffer is read-only: #
X is undefined   after I type Alt -x
C-c C-c is undefined

PS I have modified my original post - too big to put into  comments.

How do I update what has been successful so far and what is no longer an issue? Here ?

The error is no longer an issue
I know where the CLI goes - what is that area called ?
No need to type "i" on package to be installed - after highlighting it there is pretty intuitive GUI to follow.
I am missing plain Ctrl C / V , pity.


texts: Indented multi-tiered lists (and headings), with org-indent-mode?

texts:
I am new to Emacs, using it to structure text/ideas. After enabling word wrap from the menu and doing M-x org-indent-mode, I would like my document to look like this (the returns in the middle of sentences should be soft returns that adapt to the width of the window):

* The idea
  * Example One
    Curabitur suscipit et dui quis placerat. Nunc aliquam posuere elit,
    maximus velit elementum non. Cras accumsan ex velit, eu semper arcu
    fermentum vel.
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin
      gravida tincidunt magna, mattis mattis massa maximus sed. Donec
      varius vestibulum nibh imperdiet tristique. Vestibulum sit amet
      lacinia nibh.
      - Integer eu dapibus nulla.
      - Nam varius risus dolor, eu ultricies lorem ultrices et. Nulla
        bibendum lectus dui, eget iaculis velit posuere sed. Donec
        imperdiet felis dui, eget sodales sem feugiat nec.

Whereas now it looks like:

* The idea
  * Example One
    Curabitur suscipit et dui quis placerat. Nunc aliquam posuere elit,
    maximus velit elementum non. Cras accumsan ex velit, eu semper arcu
    fermentum vel.
    + Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin
    gravida tincidunt magna, mattis mattis massa maximus sed. Donec
    varius vestibulum nibh imperdiet tristique. Vestibulum sit amet
    lacinia nibh.
      - Integer eu dapibus nulla.
      - Nam varius risus dolor, eu ultricies lorem ultrices et. Nulla
    bibendum lectus dui, eget iaculis velit posuere sed. Donec
    imperdiet felis dui, eget sodales sem feugiat nec.

... because the indentation always reverts to that used below the last *-marked header. The - and + list bullets (and their manually given indentation) are not considered in the automatic indentation of the wrapped text.

Using headers throughout would be messy/clumsy/overkill since the text blocks at the + and - marks are not titles.

Is there a way? Thank you.


texts: Why isn't the Evil global motion map used in Info mode?

texts:
I'm having a problem where it appears Emacs is not looking at keybindings set in my evil-motion-state-map.

Below is my entire init.el. I start with an empty .emacs.d directory and only install evil.

;; The following line is a workaround for Emacs 26.2.
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

(package-initialize)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")))

(setq package-selected-packages
      '(evil))

;;; theme config
(set-face-attribute 'default nil :height 160)

(defun lookup-spc-tab ()
  "For debugging."
  (interactive)
  (message "SPC TAB binding for motion and normal states: %s %s"
       (lookup-key evil-motion-state-map (kbd "SPC TAB"))
       (lookup-key evil-normal-state-map (kbd "SPC TAB"))))

;;; evil config
(evil-mode 1)
(lookup-spc-tab)
(evil-define-key 'motion 'global
  (kbd "SPC") (make-sparse-keymap)
  (kbd "SPC TAB") #'switch-to-buffer)
(evil-define-key 'motion Info-mode-map
  (kbd "SPC") (make-sparse-keymap)
  (kbd "SPC SPC") #'Info-scroll-up)
(lookup-spc-tab)

When I start Emacs the following is printed in the *Messages*, which leads me to believe that SPC TAB was set in evil-motion-state-map. The following messages come from my debugging function lookup-spc-tab and appear in the *Messages*.

SPC TAB binding for motion and normal states: 1 1
SPC TAB binding for motion and normal states: switch-to-buffer 1

Now for my question:

In every mode I've tried (Fundamental, Emacs-Lisp, Message), in both motion and normal state, SPC SPC is undefined and SPC TAB is switch-to-buffer; this is all to be expected.

The exception is Info mode. When I use Info mode, in both motion and normal state, SPC SPC is Info-scroll-up (expected), but SPC TAB is undefined. What is is about Info mode that overrides SPC TAB? SPC TAB works in every other mode!

However, if I do:

...
(evil-define-key 'normal 'global
  (kbd "SPC") (make-sparse-keymap)
  (kbd "SPC TAB") #'switch-to-buffer)
(evil-define-key 'normal Info-mode-map
  (kbd "SPC") (make-sparse-keymap)
  (kbd "SPC SPC") #'Info-scroll-up)
...

That is, if I change my config to modify normal states instead of motion states, then everything works (in normal state) in every mode, even Info mode. Specifically, SPC TAB is defined in every mode, including Info mode, and SPC SPC is defined only in Info mode. All as expected.

So, again, my question is, what is it about evil-motion-state-map that gets overridden in Info mode only? And why does only motion state get overridden but not normal state?


texts: Web-mode uses 1 space indent instead of 2

texts:
I have this config in my init.el:

(setq-default indent-tabs-mode nil)
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(defun my-web-mode-hook ()
  "Hooks for Web mode."
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-code-indent-offset 4)
  (setq web-mode-enable-auto-pairing t)
  (setq web-mode-enable-auto-closing t)
  (setq web-mode-enable-current-element-highlight t)
  (setq web-mode-enable-current-column-highlight t)
)
(add-hook 'web-mode-hook  'my-web-mode-hook)

And when I have script tag I only have javascript code indented by 1 space instead of 2. Is there a way to fix that?


texts:
I'm currently working on a file that has a lot of duplicate lines splattered across the file and I'm trying to remove those duplicates. I tried using replace-regexp with \(.+^J\)\(\(.+^J\)+?\)\1+ => \1\2 which is working okay. Then I realised that there'll be some lines not caught by that so I captured it in a macro. But now I'm stuck running that several times and not knowing if/when it'll ever be done.

I get the feeling I should be able to use some sort of function to do this but I'm not entirely sure how. What should I be doing instead?


texts: How to force filename completion in shell buffers to use quotes instead of backslashes

texts:
I have a directory with the file a file name with spaces and in Emacs I have a bash in a shell buffer. Rhen  I type
ls a<TAB>

and shell mode completes to
a\ file\ name\ with\ space

However I would like the completion to look like
'a file name with space'

How can I achieve this? What function do I have modify?


texts:
I have this problem using recentf: the list seems to be updated only for the current session; when I close and restart the Emacs client, the last visited files are in the list; if I close Emacs and kill the daemon, when I restart Emacs the last visited files are not in the list.
Here is the value of the variable kill-emacs-hook:

kill-emacs-hook is a variable defined in ‘C source code’.
Its value is
(company-clang-set-prefix recentf-save-list smex-save-to-file bookmark-exit-hook-internal ido-kill-emacs-hook flycheck-global-teardown org-babel-remove-temporary-directory)


texts: How do I debug when match-data is not getting set?

texts:
Lately, I have seen some cases where I use re-search-forward to find a pattern, and then try to do something with the match, only to find that the match-data is apparently not correct.

For example, in a file I might have this text:

:RESULTS:
async-abcd-1234-output
:END:

I would expect this code to replace async-abcd-1234-output with "string"

(when (re-search-forward "async-abcd-1234-\\(output\\|value\\)" nil t)
  (let ((result-type (match-string 1)))
    (cond ((string= result-type "output")
           (replace-match "string")))))

That works when I run it in a buffer, but when I run it from a callback function I find that (match-string 1) is nil, and even (match-string 0) is "". What could be causing this? I feel like sometimes it works, and then stops working. It is baffling. Any ideas on how to debug this? When I use edebug, I can see the search appears to work, but the match-data isn't correct.


texts: Term double prompting (duplicate prompts) in Emacs

texts:
My term in emacs appear:

0;me@debian: ~me@debian:~$

instead of me@debian:~$

~$ echo $PS1
\[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\[\033[0;35m\]$\[\033[0m\]

Versions:

debian-9.5.0 and GNU Emacs 25.1.1

I tried various solutions given in stackexchange by adding additional lines to .bashrc and init.el

https://stackoverflow.com/questions/24812345/emacs-terminal-bash-ps1-prompt-duplicated
https://stackoverflow.com/questions/17579662/shell-prompt-repeating-when-using-ssh-in-ansi-term

But nothing worked out. This issue is there in shell also; but not in eshell.


texts: How to know my buffer's visible/focused status?

texts:
I'm writing an extension that talks to an outside process, so it is a given to lower the amount of 'hey whats up' requests when my buffer isn't focused.

So, what is the best way to recognize:

When my buffer is visible and focused
When my buffer is visible but not focused
When my buffer is neither visible nor focused


texts:
Let's say I have a language which looks like this:

anchor (item something item some thing item some item thing) item item

and that I'm playing with font-lock a bit. I would like to highlight "anchor" as being a function and every "item" in the parens as well.

I tried the following:

(setq test-font-lock-keywords
      `(
        ("\\<anchor\\>" (0 font-lock-function-name-face)
         ("\\<item\\>" nil nil (0 font-lock-constant-face))
         )
        )
)

(define-derived-mode test-mode fundamental-mode
  "test mode"
  "Test mode"
  (kill-all-local-variables)
  (interactive)
  (setq font-lock-defaults '(test-font-lock-keywords))
  )

My problem is that it considers every "item" word that comes after an "anchor" until the end of the line. The words "item item" in the end of my example should thus not receive syntax highlighting.
There may be a way to achieve this with a post-form but I'm not sure that's how it's meant to be used or how to do it anyway.

So I tried with the following, much less sexy regular expression:

(setq regexp "\\(\\<anchor\\>\\)[\t ]*(\\(?:\\(item\\)\\|[^)]\\)*)")

(setq test-font-lock-keywords
      `(
        (,regexp (1 font-lock-function-name-face) (2 font-lock-constant-face))
       )
)

And it only highlights the last found "item" before the parens. How can I make this regex capture every "item" here represented with index 2?


texts: In this SO question Emacs 23.1.50.1 hangs ramdomly for 6-8 seconds on Windows XP the OP show logs from Emacs that may cause errors, where can I find those logs?


texts: Minor modes not working with derived mode from c++-mode

texts:
I created a derived mode (using define-derived-mode) based on c++-mode to include new keywords, etc.

The mode is working great, but I'm having problems with other minor modes that stop working with my derived mode.

For example, flycheck and company-mode, the first stops telling me when there is broken code in the buffer, and the second will not complete (it will always say No completion found).

If I load the c++-mode in the buffer, all these minor modes start working again.

So, my question is how can I make these modes see my derived mode as if it was c++-mode.

Thanks!


texts: Org Link to png file displays as wildcard rather than the image file itself

texts:
When I click on a link to a certain recent screenshot, this is shown rather than the image  itself.

  /Users/satibodhi/Creation/notes:
  wildcard 楷{氵尸}.png
  -rw-r--r--@ 1 satibodhi  staff  2373 Jul  3 09:24 楷{氵尸}.png

All my other image links show properly with org-display-inline-images.


texts: evaluate sh source code, output is not displayed well

texts:
When I evaluate this:

#+begin_src sh
brew list
#+end_src

The result is good:

However, if I use:

#+begin_src sh
brew info emacs
#+end_src

I get something weird:

Does anyone know why this happens?


texts: Unable to set font-family from a variable

texts:
The below line works correctly:

(custom-set-faces
 '(default ((t (:family "Liberation Mono")))))

but when I try to retrieve the font-face from a variable, it fails

(setq font-family-default
  "Liberation Mono")
(custom-set-faces
 '(default ((t (:family font-family-default)))))

Is there not a way to refer to a font-face through a variable/symbol?


texts: ESS C-RET does not add a new line at the end of buffer

texts:
According to the doc, since ESS 12.09

ESS: ess-eval-*-and-step functions go to next empty line at eob, instead of staying at the last line.

However, when I hit C-RET at the end, it still says on the last line.

C-h c C-RET confirms that C-RET is being bound to ess-eval-region-or-line-and-step.

My ESS version is 16.10


texts: When I run helm-M-x and enter characters,  I like to see only those commands which has key-bindings.  How I can achieve that?  I like to have reverse functionality as well, ie.. commands without key-bindings.


texts: Ignore spurious focus events for after-focus-change-function

texts:
I'm on Emacs 27.1, Fedora 33, GNOME 3.38.2.
In the latest NEWS it is reported that

The hooks focus-in-hook and focus-out-hook are now obsolete.
Instead, attach to after-focus-change-function using add-function
and inspect the focus state of each frame using frame-focus-state.

The documentation for after-focus-change-function says

Depending on window system, focus events may also be delivered
repeatedly and with different focus states before settling to the
expected values.  Code relying on focus notifications should
"debounce" any user-visible updates arising from focus changes,
perhaps by deferring work until redisplay.

Indeed, after evaluating this code,
(defun focus-test ()
  (message "ffs: %s" (frame-focus-state)))
(add-function :after after-focus-change-function #'focus-test)

every time I switch buffer by selecting one with the mouse my message buffer shows
ffs: nil
ffs: t
ffs: nil
ffs: t

That is, Emacs sees two back and forth focus changes where I did none, and most importantly it has hallucinations of focus-out events which defeat the usefulness of the after-focus-change-function+frame-focus-state method for triggering functions based on focus events.
My question is, how do I "'debounce' any user-visible updates arising from focus changes"? (I made a naive attempt with
(defun focus-test ()
  (sit-for 0)
  (message "ffs: %s" (frame-focus-state)))

but it didn't work.)


texts: How to default markdown-mode's markdown-live-preview-mode to vertical split

texts: Using markdown-mode, I can run M-x markdown-live-preview-mode (or C-c C-c l) and it will split the window horizontally and display the rendered markdown (i.e. the HTML) with eww in a window below the markdown text window. How can I get this command to instead split the window vertically so that the markdown and rendered output are side by side? I'd like to avoid having to manually toggle the window split.


texts: How do I export an ORG file to an interactive HTML site?

texts:
Is there a way to export a .org file into an html that supports expanding and collapsing titles?

What I want is to be able to press a key like TAB and expand and collapse the outline, but on a html site.

Github wikis support orgmode but they don't seem to allow expanding and collapsing of titles.


texts: Polymode appears in minibuffer but does not weave into a file on Windows, why?

texts:
This is a follow-up post to Polymode installation on Windows machine. Accordingly I installed polymode using this code in the init.el file after ESS code:

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

This seems to work as polymode (PM-Rnw) does appear in the minibuffer:

Now I want to weave this file using M-n w and knitr option, it prompts me then whether this is the master file:

When I hit RET to accept the default (same file is master file), I get this message:

This indicates that a mwe_demo[weaved].tex buffer has already been created and transferred to a project cache in projectile. But this buffer is empty and no such file was ever found in that path. So what am I missing here?

Update
the following message appears in the *polymode weave* buffer:

weaving latex with command:
     Rscript -e "library(knitr); knit('mwe_demo.Rnw', output='mwe_demo[weaved].tex')"
'Rscript' is not recognized as an internal or external command,
operable program or batch file.

So it seems that knitr could not be loaded because of no recognized Rscript.exe shell command. This means that it won't use the Rterm.exe that I have this line of ESS installation in init.el:

(setq-default inferior-R-program-name "C:/Program Files/R/R-3.1.2/bin/i386/Rterm.exe")

but how to make Rscript recognized which I have it on this path C:/Program Files/R/R-3.1.2/bin/Rscript.exe? I hope that was more explained in the documentation.

I ended up adding the above path to PATH variables Win + break. It worked now and weaved into .tex file. Now when I press M-x e/E I get two candidates pdflatex|latexmk how to extend that to include xelatex, which is more useful in my case?

Updated Question

How to make polymode opt for xelatex?

A similar case with Noweb mode could be solved by M-x customize-group as in this post: https://stackoverflow.com/a/28515366/1288722

Note

The same file could be weaved successfully using the Noweb mode in ESS using knitr
Pandoc is already installed and in the PATH variable M-x getenv RET PATH RET
Windows 7 32 bit


texts:
I'd like to find all occurrences of == in a buffer and overlay them with Unicode ≡, keeping width of two chars and centered in the space.

I know about replacing text visual representation:

(put-text-property 1 10 'display "replacement")

about keeping known width

(put-text-property 1 10 'display '(space :width (119)))

I do not know how to put this together and keep it centered.


texts: dealing with s-expressions in javascript without paredit

texts:
I was using paredit for other languages apart from lisp and it was great for being able to delete and yank whole functions etc. but it was also quite buggy with web-mode and js2-mode.

Fir example, I could hit ctrl + K at the first line of the code below:

const  = (x) => {
  // function body
};

and it would cut the entire function. This worked with html in web-mode etc.

Is there anyway I can replicate this behaviour without paredit or how do more seasoned emacs users go about copying whole expressions like this or working with them in non-lisp languages?


texts: CIDER, how to fix "No cljs REPLs in current session" error

texts:
I'm editing a ClojureScript file, and I have a working ClojureScript REPL in another buffer. But when I try to evaluate a form in my file ui.cljs, with C-c C-c, I get a beep an a message in the mini-buffer that says

  No cljs REPLs in current session "MyProjectDir/MyProject:localhost:59437

I don't really understand what that means, but it appears that my ui.cljs file got associated with the wrong REPL - the Clojure REPL, not the CLJS REPL.

CIDER Sessions:

1: MyProjectDir/MyProject:localhost:59437
    linked-to: buf(ui.cljs)
      objects: *cider-repl %s(clj)*

2: MyProjectDir/MyProject:localhost:60016
    linked-to: >proj(~/Workspace/MyProjectDir/MyProject/)
      objects: *cider-repl %s(cljs:weasel)*

I try to "unlink" it by running the sesman-unlink command in the ui.cljs buffer. But I only get a beep and a cryptic error message in the minibuffer:

  Wrong type argument: stringp, #<buffer ui.cljs>

How to associate that ui.cljs file/buffer with the correct REPL?

Emacs 25.3.1 on macOS. CIDER 0.19.0


texts:
I want to use flush-lines in a selected region, but I have troubles.

Here it is my code:

(defun delete-empty-lines ()
  "Delete empty lines in bibliography."
  (interactive)
  ;; set point-min
  (setq m1 (make-marker))
  (goto-char (point-min))
  (search-forward "\\begin{thebibliography}" nil nil)
  (beginning-of-line)
  (set-marker m1 (point))
  ;; set point-max
  (setq m2 (make-marker))
  (search-forward "\\end{thebibliography}" nil nil)
  (end-of-line)
  (set-marker m2 (point))
  ;; set marker
  (push-mark m1 nil t)
  (push-mark m2 nil t)
  ;; color region
  (setq mark-active t)
  ;; clean empty lines
  (flush-lines "$^" m1 m2)
  ;; decolor region
  (setq mark-active nil))

The line (flush-lines "$^" m1 m2) seems to be ignored when I call my function in emacs and I do not understand why... How can I fix my code?


texts: Infinite repetition (iteration) in Elisp code

texts:
There is an option to

  repeat a macro an infinite number of times until the function quits (for example, by reaching the end of the buffer) or if the user cancels the command in keyboard macros

by using C-u0 as prefix to C-xe.

How can we mimic this behavior in Elisp code with the loop? For example, I would like to write a code that brings point to the outermost bracket to check if it is of a certain value:

(defun outer-paren()
  (interactive)
  (while condition
    (up-list)))

What should condition be to mimic keyboard macro infinite argument behavior?

  ((some (|text) embedded) within brackets) --> |((some (text) embedded) within brackets)


texts: elisp - How to dump plist to property value pairs

texts:
Below example dump it as a list, but I wish to dump it in property value pairs:

#+BEGIN_SRC elisp :results output
(defun dump-plist(obj level)
  (if (listp obj)
      (dolist (item obj)
        (dump-plist item (1+ level)))
    (progn
      (while (> level 1)
        (princ "  ")
        (setq level (1- level)))
      (princ obj)
      (princ "\n"))))

(defun test()
  (let* ((my-plist (list :a 1 :b 2 :c 3 :more (list 4 5 6))))
    (print my-plist)
    (dump-plist my-plist 0)
    ))

(test)
#+END_SRC

#+RESULTS:
#+begin_example

(:a 1 :b 2 :c 3 :more (4 5 6))
:a
1
:b
2
:c
3
:more
  4
  5
  6
#+end_example

expected output is:

:a 1
:b 2
:c 3
:more (4 5 6)


texts:
Because Xcode 10 no longer supports SVN I am looking for something to replace it. It seems as a good time to learn to use Emacs for SVN management.

The answer could be a single tool or easy Emacs flows (transition between Emacs tools that don't take much time and cognition). You could also give example of what are your SVN/Emacs most used work flows.

FYI I am Emacs noob.

Minimal functionality that I would like:

List all modified files. Select a file from the list and see a diff
for working and base. Be able to modify working right inside the
diff.

Extra/Optional functionality:

Be able to select which files to commit. Be able to select which lines to commit and which to skip. This point implies having point 1 from minimal functionality.
Have tortoisesvn-like ease of use for when using commits log. Be able to log commits. Have a way to filter them(including using the name of the file or part of its path as a viable way to filter). Select a commit from the list and see all the files it has changed. Choose a file from that list and see a diff of the changes that it has made.
Creating/applying patch for one or multiple files. (This is not that
hard to do trough svn command so it is not that important)

Emacs integration into SVN(Optional / Nice to have):

How can I setup Emacs as external help application for everything in ~/.subversion/config

These are the ones that I know what they do and use:

# editor-cmd. This should do here editor-cmd = emacs
# diff-cmd - I should be able to save diff as patch when using this. By default I can do svn diff >> myFix.patch.
# diff3-cmd
# merge-tool-cmd

My thoughts on the matter in this answer


texts: Middle-click copy/paste link to Spacemacs in Helm Org Insert Link

texts:
I have just entered the Spacemacs ecosystem with no prior Emacs experience.

I want to copy paste a link with my mouse from my X clipboard using middle-click in Spacemacs Org mode.
I have selected the link in my browser with double-clicking (or with C-c).

In Spacemacs, editing emacs-notes.org, I type C-c l and the following appears:

I can type the http://.../ with the yellow-filled-box cursor (), but I cannot use the mouse middle-click (or C-v) to paste it from my X clipboard and save me from all the typing.

~/.spacemacs contains:

(defun dotspacemacs/user-config ()
  (xterm-mouse-mode -1)) ;; copy paste with mouse middle button from X

Nevertheless, when I middle-click, the system pastes the link elsewhere (e.g. in the emacs-notes.org buffer).
I have also tried disabling the mouse but this doesn't work either.

How can I paste a link from the X clipboard in the yellow-filled-boxed using the mouse (or a keyboard shortcut)?

If there are other ways to do this, I'd like to learn them.


texts: Idiomatic way of extending keymap for inserting unicode symbols?

texts:
I often find myself needing to insert Unicode characters that have no default binding in iso-transl-ctl-x-8-map, i.e., characters that can't be inserted using C-x 8 followed by one or more letters/punctuation characters.

To add bindings to the C-x 8 keymap, I usually

define a custom command for inserting a given Unicode character, such as:

(defun ucs-rightwards-arrow ()
  "Insert unicode symbol: →"
  (interactive)
  (insert-char #x2192))

add a binding for this command to the map via

(define-key iso-transl-ctl-x-8-map (kbd "a") 'ucs-rightwards-arrow)

Since the C-x 8 keymap really only pairs key bindings with single characters I'm wondering:

Q: Is there a more light-weight/idiomatic way of extending the C-x 8 keymap?


texts: Slime inspector customization (Common Lisp development)

texts:
Here follows Common Lisp code, using a datastore library named bknr.datastore

(ql:quickload :bknr.datastore)

(defclass userdata (bknr.datastore:store-object)
  ((email :initarg :email
      :index-type bknr.indices:unique-index
      :index-values all-users)
   (name :initarg :name))
  (:metaclass bknr.datastore:persistent-class))

(let ((object-subsystem (make-instance 'bknr.datastore:store-object-subsystem)))
  (make-instance 'bknr.datastore:store
         :directory *default-pathname-defaults*
                 :subsystems (list object-subsystem)))

(make-instance 'userdata :email "m@b.com" :name "Maria")
(make-instance 'userdata :email "k@g.com" :name "Katerina")

(setf (slot-value (first (all-users)) 'name) "Elena")
; Attempt to modify persistent slot NAME of #<USERDATA ID: 0> outside of a transaction
;   [Condition of type BKNR.DATASTORE::PERSISTENT-SLOT-MODIFIED-OUTSIDE-OF-TRANSACTION]

(bknr.datastore:with-transaction ()
  (setf (slot-value (first (all-users)) 'name) "Elena"))
; runs successfully, the above wrap in with-transaction () is necessary

I use the Slime inspector to view the datastore, so in the minibuffer after C-c C-I Inspect value (evaluated):
I input

(all-users)

I can see the data but not edit it in the slime inspector, because the same condition is thrown as above.

Can the slime inspector be customized in a way that it wraps calls to setf inside transactions?

PS: if you run the above code, a directory named "current" will be created in your lisp's working directory. It saves the datastore on disk.


texts: Hook to insert content into a particular file when visited

texts:
I want to insert content from one file anytime a file with a particular name is opened, i have this:

(defun insert-foo-bar(filename)
  (when (string= (file-name-nondirectory filename) "foo")
    (insert-file-contents "~/bar")))

(add-hook 'find-file-hook 'insert-foo-bar)

However after visiting a file with C-x C-f i get a "wrong number of arguments" error. Can anyone tell me what am I doing wrong?

Thanks


texts: I know I can use ibuffer to filter available buffers by mode, but I can I do something analogous directly in helm? The mode is listed by helm, so maybe there is a way?


texts: How to make DEL in isearch always delete character?

texts:
In Isearch, after hitting C-s a few times, you have to hit DEL a few times to get back to editing the search string.

How can I disable this behavior? I'd like it so that DEL always deletes a character from the search string (the behavior of DEL when you've hit C-s just once [to activate Isearch initially]).


texts: jedi: Wrong type argument: epc:manager, nil

texts:
After installing Ubuntu 20.04 and switch from 3.7 to 3.8 I have started to face with following error. I have tried everything reinstalling removing emacs and re-installing it but I won't able to solve it. Any advice to solve this problem?
At M-x:

elpy-goto-definition returns No definition found

Wrong type argument: epc:manager, nil, jedi:jump-to-definition and jedi:goto-definition returns Wrong type argument: epc:manager, nil

M-x jedi:install-server returns:

deferred error : (error "Deferred process exited abnormally:
  command: virtualenv
  exit status: exit 1
  event: exited abnormally with code 1
  buffer contents: \"AttributeError: module
'virtualenv.create.via_global_ref.builtin.cpython.mac_os' has no attribute
'CPython3macOsFramework'
\"")

Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.35.0
Virtualenv........: venv (/home/alper/venv/)
Interactive Python: python3 3.8.5 (/home/alper/venv/bin/python3)
RPC virtualenv....: rpc-venv (/home/alper/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.8.5 (/home/alper/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.18.0
 Rope.............: 0.18.0
 Autopep8.........: 1.5.5
 Yapf.............: 0.30.0
 Black............: 20.8b1
Syntax checker....: flake8 (/home/alper/venv/bin/flake8)

My setup:
(use-package elpy
  :ensure t
  :defer t
  :init
  (advice-add 'python-mode :before 'elpy-enable))

(setq elpy-rpc-backend "company-jedi")
(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))

(defun my/python-mode-hook_1 ()
  (add-to-list 'elpy-rpc-backend 'company-jedi))

(add-hook 'python-mode-hook 'my/python-mode-hook)
(add-hook 'python-mode-hook 'my/python-mode-hook_1)
(add-hook 'python-mode-hook 'company-jedi)
(company-jedi 1)


texts:
I tried convert the following region to table

Attribute     Description
form          A dictionary with all the form fields submitted with the request.
args          A dictionary with all the arguments passed in the query string of the URL.
values        A dictionary that combines the values in form and args.
cookies       A dictionary with all the cookies included in the request.
headers       A dictionary with all the HTTP headers included in the request.
files         A dictionary with all the file uploads included with the request.
get_data()    Returns the buffered data from the request body.
get_json()    Returns a Python dictionary with the parsed JSON included in the body of the request.
blueprint     The name of the Flask blueprint that is handling the request. Blueprints are introduced in Chapter 7.
endpoint      The name of the Flask endpoint that is handling the request. Flask uses the name of the view function as the endpoint name for a route.
method        The HTTP request method, such as GET or POST.
scheme        The URL scheme (http or https).
is_secure()   Returns True if the request came through a secure (HTTPS) connection.
host          The host defined in the request, including the port number if given by the client.
path          The path portion of the URL.
query_string  The query string portion of the URL, as a raw binary value.
full_path     The path and query string portions of the URL.
url           The complete URL requested by the client.
base_url      Same as url, but without the query string component.
remote_addr   The IP address of the client.
environ       The raw WSGI environment dictionary for the request.

Tried multiple times to convert the region to table but failed.

Could please provide any hints?


texts: How to use outline-minor-mode to hide some exam class exercises in auctex

texts:
I use the exam document class in auctex to write exams for my students. I want to use the features provided by the outline-minor-mode to hide all the exercises I have finished  and only show the one I am editing.
In the exam class there is \question macro for writing exercises.
here is an example :

\documentclass{exam}
\begin{document}
\begin{questions}
\question % exercise N°1
     statement of exercise 1
\question % exercise N°2
    statement of exercise 2
\question % exercise N° 3
     statement of exercise 3
\end{questions}
\end{document}

I want for example to hide the statements of exercise 1 and 3 when I edit the statement of exercise 2!
So I have add  \question to the heading list of auctex with the variable TeX-outline-extra like this:
M-x (setq TeX-outline-extra '(("\question" 1)))
But \question is not recognized as a heading as expected!


texts: How to add a suffix to the end of a string in a line?

texts:
Here's an example of content in a file

This_is_line_1    :  1
This_is_another_line  :2
This_is_3rd_line    :3
Here_is_line_4 :4

So, how can using emacs to add  char @ immediately to the end 1 string on each line, i.e.

This_is_line_1@   :  1
This_is_another_line@  :2
This_is_3rd_line@    :3
Here_is_line_4@ :4


texts: Poly-Markdown+R does not find the right version of R for R code chunks

texts:
I am working on a Rmarkdown document and I have R 4.0.4 running in a buffer. I try to export the document with M-n e and it finds R 3.6.3
sessionInfo()

R version 3.6.3
This meant that I had a lot of trouble with packages not being found before I saw the underlying problem. I have a distribution R 3.6.3 in /usr/bin and a more recent R in /use/local/bin. poly-R may be using absolute path names but I can't see how to configure it.


texts: How can I get SMIE to not treat keywords as parentheses?

texts:
I'm writing an SMIE-based mode for a language that has type definitions that look like this:

type Foo = {
  foo : Int,
  bar : String
}

One problem I'm running into is that type and = are treated as parentheses. For example, if I put the cursor on type in my previous example, it's highlighted as an unmatched parenthesis:

The = is also treated as a parenthesis, but, oddly, it is matched with the  corresponding type keyword:

How can I tell SMIE not to treat type and = as parentheses?

Here's a pared-down version of the grammar I'm using that exhibits this problem:

(defconst theta-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    '((id)

      (statement ("type" id "=" type-definition))

      (type-definition (type-definition "|" type-definition)
                       ("{" fields "}"))

      (fields (fields "," fields)
              (id ":" id)))

    '((assoc "|"))
    '((assoc ","))
    '((assoc ":")))))


texts: How to search for function calls, not just function definitions, with etags?

texts:
Edit: Answered my own question.

In the past, when working with Emacs, C and etags, I was able to do M-. and find a function definition. But I could also do M-, and find all calls of that function. Very convenient.

I've recently started programming C with Emacs again. I've built a TAGS file with etags. I can use M-. but I can't use M-,. When I look into the TAGS file, I see that there are only lines for the function definitions. There is no information where all the calls to that function are.

So my suspicion is that I should build the TAGS file differently. But I've read the man-page for etags, and I can't find any options that might do what I want.

The only thing I could imagine is that the company where I worked in the past had a modified version of etags?

We had a coding convention that function-calls should always have a space between name and open-bracket. E.g. int my_function (int x){ and calls should never have a space there. E.g. x = my_function(1);. Could this be it ? Or is that unrelated ?


texts: How do I install Emacs on windows 10 pro

texts:
I can't find a clear tutorial for how to do this on windows 10. Normally there are a few tricks required to get it running properly so I thought I would ask here before trying one of the windows 8 tutorials

The specific "flavour" of Emacs is not particularly important


texts: Where can I get texinfo documentation for CMake, for example?

texts:
Since texinfo is kind of the help format for emacs, I hope the question is not too much off topic...

I'm starting to learn cmake and not having a texinfo documentation hurts a bit. Is there a way to convert the qt-help that's offered on the cmake page or any other solution?

Many thanks,
Markus


texts: Magit on Windows: "searching for program: permission denied, git"

texts:
I installed Magit on Windows, but every time I use it, it give me the error:

searching for program: permission denied, git

even though I already installed the git software on windows. (it seems that there is no git available from the cmd). I am using the GUI emacs and not emacs from cygwin.


texts: How to trace the evaluation of all forms in the body of an Elisp function

texts:
When working with bash scripts, when something is not behaving the way you want it to, you can add a

set -x

and the next time you run the script you can see the methods and the sub methods being called in real time.

Is there an equivalent switch in "elisp"?


texts:
How can I introduce hierarchical sections in org-mode without requiring the tasks within those sections to have a large number of asterisks?

To context is that I'm looking for a standardized plaintext format for todo lists that I can use to collaborate with non-technical team members who only use plaintext editors, while still providing software support to those of us willing to install special software. Goals:

the list can be divided into hierarchical sections
the prefix of each task within these sections does not vary based on its nesting level (so, for example, tasks nested 4 levels deep could have a prefix of '*' or '-' but not '****', and not required indentation that varies with nesting level)
tasks can have notes (that is, each task has a title but also possibly body text associated with it)

For example, in org-mode I can write:

* Shopping tasks
** buy milk

* Apartment tasks

** urgent apartment tasks
*** bedroom
**** bathroom in bedroom
***** fix leak
remember to turn off water first!

** not urgent apartment tasks
*** kitchen
**** clean out fridge
*** bedroom
**** bathroom in bedroom
***** buy more toilet paper
***** clean floor
***** clean sink

But now the actual tasks have a ridiculous number of asterisks in front of them. This is difficult to read and write for my teammembers using plaintext editors, and it's difficult for them to introduce new sections, delete sections, or move tasks between sections.

This can be improved by using '-' lists instead of tasks:

* Shopping tasks
 - buy milk
* Apartment tasks

** urgent apartment tasks
** bedroom
*** bathroom in bedroom
 - fix leak
   remember to turn off water first!

** not urgent apartment tasks
*** kitchen
 - clean out fridge
*** bedroom
**** bathroom in bedroom
 - buy more toilet paper
 - clean floor
 - clean sink

but now org-mode doesn't treat tasks as tasks, which makes a lot of its todo features unusable. Maybe I could use an extension in emacs but often I am using iOS or Android org-mode clients. The org-inlinetask extension is unusable for another reason too, that is that all tasks have 15 asterisks which is, again, tedious when using a plaintext editor.

So, my question is, is there another way to introduce section headings that does not force you to put many asterisks as the prefix for tasks within the sections? Something like this:

= Shopping tasks
* buy milk

----

= Apartment tasks

== urgent apartment tasks
=== bedroom
==== bathroom in bedroom
* fix leak
remember to turn off water first!

== not urgent apartment tasks
=== kitchen
*  clean out fridge
=== bedroom
==== bathroom in bedroom
* buy more toilet paper
* clean floor
* clean sink

(in the wished-for example, I also used '----' to break up the document into major parts). If something like this is not possible in org-mode, then what do you recommend? Some things I've heard of include TaskPaper, but I think it requires variable indentation (which is much easier to read than  asterisks, but still a little bit of a pain to edit in plaintext). I could also use Markdown and one of the Markdown-compatible todo lists tools, or just use Asciidoc with no todo-specific support. I use emacs on the computer and various apps on Android and iOS, and some of my teammates will be using a plaintext editor (like Windows Notepad).


texts: How can I increase the spacing between the buffer and the top part of the frame?

texts:
I'd like to add a margin to the top of the window so that it's not so close to the top part of the frame.

Here's what it looks like currently (arrow indicates where I'd like to add extra margin):

How would I go about accomplishing this?


texts: Emacs on Android - org-mode - error - `(wrong-type-argument stringp (require . t-mouse))`

texts:
I'm running Emacs in Android under ZShaolin, with whatever the default configuration is.  When I open an org-mode file (or try to enable org-mode), I get an error:

(wrong-type-argument stringp (require . t-mouse))

[This seems to be the case whether or not I enable the trackpad (I'm running on a tablet with keyboard)]

Here is the backtrace:

Debugger entered--Lisp error: (wrong-type-argument stringp (require . t-mouse))
  string-match("\\(\\`\\|/\\)org-exp\\(\\.elc\\|\\.el\\)?\\(\\.gz\\)?\\'" (require . t-mouse))
  load-history-filename-element("\\(\\`\\|/\\)org-exp\\(\\.elc\\|\\.el\\)?\\(\\.gz\\)?\\'")
  eval-after-load("org-exp" (add-hook (quote org-export-preprocess-before-normalizing-links-hook) (quote org-remove-file-link-modifiers)))
  org-mode()
  set-auto-mode-0(org-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer Notes.org> "/sdcard/Android/data/com.dropbox.android/files/u139630781/scratch/Org/Notes.org" nil nil "/storage/emulated/legacy/Android/data/com.dropbox.android/files/u139630781/scratch/Org/Notes.org" ((16419 . 51200) 20))
  find-file-noselect("/sdcard/Android/data/com.dropbox.android/files/u139630781/scratch/Org/Notes.org" nil nil t)
  find-file("/sdcard/Android/data/com.dropbox.android/files/u139630781/scratch/Org/Notes.org" t)
  call-interactively(find-file nil nil)


texts: Test whether variable is defined, but not initialized

texts:
Q:  How can I test (programmatically) whether a variable has been defined, but not initialized?

(defvar foo)

EXAMPLE:

(if (my-test foo)
  (message "%s has been defined, but not initialized." foo)
  (message "%s has been defined AND initialized." foo))


texts:
Is there an Emacs package that can help organize buffers into projects? I commonly work on many projects, but I only have one Emacs instance open (with hundreds of buffers). It would be nice if I could easily organize the buffers into projects (using for example a tag associated with each buffer; the tag name could for example be the name of the project that the buffer belongs to).

I could think of some tasks that could be performed by this package:

Search through buffers of a given project
List buffers of a given project
Delete buffers of a given project,

and so on..


texts: Emacs Ispell to list all spelling errors at once

texts: I am using emacs ispell to look for spelling mistakes. It works well in interactive mode, but I was wondering if I can see all the words with spelling issues highlighted in the buffer itself or highlighted in a separate buffer. I need this because a lot of my writing involves use of technical nouns that aren't in the dictionary and it is a little inefficient to cycle through them, specially since I don't make a lot of mistakes. I am unable to find any clue online and the manual mentions only the interactive mode of usage.


texts:
Setup

Windows 10 host with X server (VcXsrv)
Linux guest (Arch) in virtual machine (VMware)

Benchmark

(defmacro measure-time (&rest body)
  "Measure the time it takes to evaluate BODY."
  `(let ((time (current-time)))
     ,@body
     (message "%.06f" (float-time (time-since time)))))
(measure-time (byte-recompile-directory package-user-dir nil 'force))

Results

Total of 285 files compiled, 22 skipped in 16 directories

Native Emacs on Windows: 11.5 sec
emacs -nw in Linux virtual machine: 5.1 sec
Emacs in Linux virtual machine, displayed in X on the same machine
(startx): 31.9 sec
Emacs in Linux virtual machine, displayed in X server on Windows:

33.6 sec (X11 forwarding via PuTTY SSH, uncompressed)
32.5 sec (direct access from virtual machine to X server port 6000 on
host via VMware host only networking / Windows firewall disabled)

Question

Is it normal that Emacs on X is that much slower than emacs -nw? In any case, what may be the cause for the slowness?

At first I only tested 4, and I was thinking that there is some network overhead between Linux and Windows which is causing the problem. Now I see that even with X on the same virtual machine (result number 3) slowness is an issue.

Only explanation for me is that the status messages in the mini buffer cause too much network traffic. To test that it would be interesting to completely disable the minibuffer, which I don't think is possible.

More benchmarks

For completeness, as I just have all that installed:

emacs -nw in WSL (Ubuntu):

Defender on: 10.3 sec
Defender off: 6.1 sec

Emacs in WSL, displayed in X server on Windows:

Defender on: 44.4 sec
Defender off: 36.3 sec

emacs -nw in Mingw-w64: 9.7 sec
Emacs in Mingw-w64, displayed in X server on Windows: 17.4 sec

Version details

Native Emacs on Windows: GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30
Emacs in Linux virtual machine: GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05
Emacs in WSL: GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-29
Emacs in Mingw-w64: GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30


texts: Org-Mode Latex Preview screen-dependent size

texts:
When using the inline latex preview in org-mode, I have discovered that it seems the size of the preview images is dependent on the display size.

While at work, I have my laptop connected to a dock, with an external display. I have then configured the preview with the :scale property in my init.el file. The scale is set to 1.2.

As I got home, I continued work on my laptop, and when I wrote a new expression in latex and toggled the preview of the expression, the size was significantly larger (see image).

Is there a simple way I can fix this and get the size to be equivalent (relative to my text) on all screens?


texts: How can I stop Emacs from grabbing focus at startup?

texts:
I typically start GUI Emacs on macOS, https://bitbucket.org/mituharu/emacs-mac/overview, installed via Nix package manager, as part of a larger startup script on the terminal (iterm). While Emacs is loading I am entering passwords to decrypt various encfs volumes. Annoyingly, Emacs steals focus after a while, sometimes in the middle of entering a password on the terminal. I am aware of about when in the startup sequence this happens so I can simply wait for it to complete then switch focus back to terminal, but naturally I prefer to avoid this.

I've searched for all occurrances of raise-frame, select-frame-set-input-focus, x-focus-frame, select-frame and while there are many instances of these they are not at top-level. To some of these few containing functions that I wondered may be getting called during init, I added message printf style statements, restarted Emacs and read the *Messages* buffer, none of these were printed out. I might have missed something though as I didn't try them all this way, just the most likely looking ones.

It may be a feature of the Emacs I use and I may have to patch to overcome, but I don't want to have to do that.

Any clues what I should look for to change this behavior?


texts: Org-Mode cycling inside subtree impossible?

texts:
In org mode I go to a subtree. This subtree contains lots of text, let's say a thousand lines. I want to look up some information in it. I got it, but now I want to collapse that subtree I'm in directly with a keystroke. That's all. But it seems that I need to go with the cursor to the heading before I can use TAB for visiblity cycling. Jumping to the heading takes time and is tedious. When I use TAB inside the subtree text nothing happens and I haven't found any other way to collapse the subtree directly.

I looked at the manuals and internet but I couldn't find any solution. Stackexchange is my last resort. Since I'm not a coder I can't help myself here programming a lisp function to solve the problem. Additonally I think this is useful also for other users and I would have needed it very often myself.


texts: How to mark current line and move cursor to next line?

texts: How do I mark the current line and then move the cursor to the beginning of the next line?  I'd like it to behave like Sublime Text's Ctrl-L.


texts: How to use Emacs to prevent screen lock from activating (Windows)

texts: My employer has a pretty paranoid screen locking policy on Windows machines. There's no way to override the time settings for the lock. My colleagues an I have been experimenting with various homebrew methods to keep the lock from activating. I'd like to have an Emacs process jiggling the mouse cursor and potentially doing other things to fool the system into thinking there's activity.


texts:
In Tortoise SVN I would do "svn cleanup" with "Delete unversioned files and folders".
In Emacs "svn status" I can mark "unknown" files or folders (marked with "?"). But I cannot delete them, as they are not under version control.
"svn-status-cleanup" provides no option to delete also unversioned files.

So, how could I remove files not under version control?

Many thanks!

Note added:
for svn-status I used xsteve.at/prg/emacs/psvn.el


texts:
I'm just getting started with mu4e after using Gnus for about a year. The sending of mail seems similar between the two, but mu4e hangs when I try to send mail and finally fails with the error:

network-stream-open-starttls: Failed connect: connection timed out.

Here's my .emacs.d:

;; * mu4e
(require 'mu4e)
(setq mail-user-agent 'mu4e-user-agent)

(setq mu4e-maildir "/home/steven/mail/")

(setq mu4e-sent-folder   "/sent")
(setq mu4e-drafts-folder "/drafts")
(setq mu4e-trash-folder  "/trash")

(setq   mu4e-maildir-shortcuts
'(("/archive"     . ?a)
  ("/inbox"       . ?i)
  ("/sent"        . ?s)))

;; smtp mail settings
(setq message-send-mail-function 'smtpmail-send-it)
(setq smtpmail-smtp-server "example.server.com")

Is there anything here that would foul sending a message? If not, where might I look next for the cause of this behavior, or what experiment might I run to deduce the problem?


texts: How to make man replace the same buffer?

texts: Instead of open many buffers I wish to have the same buffer for all calls to the man.


texts: How to specify a color theme specifically for Latex editing (the buffers with .tex files)?

texts:
I am using Emacs and there are various 'themes', eg. link to examples, but they do not appear to be dedicated to Latex. Some have modes for Latex, but I am wondering if there are theme files that can be loaded specifically when using Latex (dedicated themes), and if this exists how would the init.el file be set to use the appropriate theme file?

I have tried to use the lines in my init.el

(require 'color-theme-buffer-local)
 (add-hook 'latex-mode
     (lambda nil (color-theme-buffer-local 'color-theme-empty-void (current-buffer))))

This color-theme (color-theme-empty-void), was taken from link to theme .el file. Is it maybe not customary to have a specific color theme for Latex?


texts: Differing behaviours with EDITOR=emacsclient between git and sudoedit

texts:
In my .profile I've

export EDITOR="emacsclient -qa \"emacs --no-window-system --no-desktop\""

Doing sudo -e /somefile doesn't work even when Emacs server is running.  I get

emacsclient: unrecognized option '--no-window-system'
Try 'emacsclient --help' for more information
sudo: /somefile unchanged

However, git commit does the right thing (Emacs editor for writing up my commit message) with both Emacs server running and not (opens inside terminal).

export EDITOR="emacsclient -qa nano"

Now sudo -e is happy.  So it looks like git is OK with the spaces in the -a (alternate editor) option's argument while sudo is not.  But, shouldn't this be a  emacsclient problem?  Why do I see these different behaviours.


texts: ido-find-file key-binding `Ctrl-b` and `Ctrl-f` to move around in the list

texts:
From Mickey Petersen' blog Find files faster with the recent files package:

(require 'recentf)

;; get rid of `find-file-read-only' and replace it with something
;; more useful.
(global-set-key (kbd "C-x C-r") 'ido-recentf-open)

;; enable recent files mode.
(recentf-mode t)

; 50 files ought to be enough.
(setq recentf-max-saved-items 50)

(defun ido-recentf-open ()
  "Use `ido-completing-read' to \\[find-file] a recent file"
  (interactive)
  (if (find-file (ido-completing-read "Find recent file: " recentf-list))
      (message "Opening file...")
    (message "Aborting")))

I can walk through the list using ido-find-file with arrow keys. Instead can I do this with the following key bindings: Ctrl-f (next), Ctrl-b (previous)?


texts: Prevent current line from being underlined

texts:
I switched from the default theme to wombat and now the current line is highlighted and underlined.

With the default theme, it is only highlighted

My init.el file has:

(global-hl-line-mode 1)

How do I only highlight the current line and not underline it while changing themes ?


texts: how to not html export src block result in org-babel

texts:
I'm using emacs version 26.3 with org-mode version 9.1.

how to stop from exporting #+RESULTS and export only code block.

     #+BEGIN_SRC python :results output
       print('hello world')
     #+END_SRC

     #+RESULTS:
     : hello world


texts: How to open a PDF after running tex-file?

texts: I am able to run pdflatex via tex-file, and the PDF generates just fine. How would I go about automatically opening the resultant PDF file after generation?


texts:
I'm confused by the interpretation of ' in the context of lists of symbols.

The problem is that I'd like to check whether a buffer is in one a list of modes, and I'll use the scratch buffer as my example.

(with-current-buffer "*scratch*" major-mode) ;; lisp-interaction-mode
(equal (with-current-buffer "*scratch*" major-mode) 'lisp-interaction-mode) ;; t

So far so good.

(member (with-current-buffer "*scratch*" major-mode)
        '('lisp-interaction-mode) ;; nil

Huh? Trying to simplify this, I ended up with

(member 1 '( 1)) ;; (1) - okay, my list syntax seems correct
(member '1 '( '1)) ;; nil - Why doesn't this work? I think this is the issue

So how can I make a list of symbols, and then check whether a symbol is in there?


texts: Starting Emacs from a USB stick: how to extract the drive letter assigned to the stick?

texts:
I have installed Emacs, with all its init files, on a USB stick for use on different PCs. The init files contains paths to the USB stick itself. The problem is that the drive letter assigned for the USB stick changes from PC to PC. How can I make Emacs determine the drive letter assigned to my USB stick. store it into a variable that I can use in all paths pointing to the USB stick?

For instance my init file contains, among many others, the following line:

(load "K:/home/.emacs.d/init_calendar")

This will not function on a PC where the USB stick i assigned another letter, e.g. D:. So how can I make Emacs determine which drive it starts from?

EDIT: how can I make Emacs AUTOMATICALLY determine the letter of the drive it starts from?
If my usb is assigned letter x on one pc I want emacs to find this letter, and store it in a variable.


texts: Paredit: paredit-forward and paredit-backward don't work

texts:
I've been having trouble with navigating in paredit. When I try using C-M-f and C-M-b to go forward and backward, nothing happens. The minibuffer doesn't respond and the point doesn't move.

When I type C-h f paredit-forward/backward it confirms that the function is bound to the keys mentioned above, and when I type C-h m in a buffer with paredit-mode enabled it shows the same binding. Other paredit functionality works just fine - I'm slurping and barfing all over the place.

I'm beginning to suspect it's a problem with the C-M combination. When I try to use C-h k to identify the combination, nothing registers.

I use Emacs on Windows 7 and Bodhi Linux (a Ubuntu derivative), and I see the same (lack of) behavior on both. Any insight would be appreciated.


texts: Keymap doesn't work as is when you use some multiple modifier keys

texts:
When I define and evaluate some complicated key combo like below and try to run it, I get an error.

(global-set-key (kbd "s-C-M-r") 'newline)

The error:

<C-M-s-268632082> is undefined

I can work around it by changing the key definition accordingly like below, but it makes my keymap really complicated. Is there a way to fix this?

(global-set-key (kbd "s-C-M-<268632082>") 'newline)

This doesn't happen for simple key combos like s-r.

My Emacs is OS X Desktop version 24.5 (9.0).


texts: How can I syntax-highlight a function like a macro?

texts:
I've got a function that behaves more like a macro in that it does compile-time environment definitions.  For various reasons (at this point, one of those reasons is 'because it is easier to grok in my head'), I'd like to keep it as a function.  When I use the function, how can I have emacs color it like it would a macro?

(defun test-func ())
(defmacro test-macro ())

(test-func)  ; not colored
(test-macro) ; colored


texts:
I have a config file to setup defaults for tramp.  For the purposes of this example foo and bar are hosts defined in /etc/hosts.

(require 'tramp)
(setq tramp-default-method "ssh")
(add-to-list 'tramp-default-user-alist
             '("ssh" "foo" "user1"))
(add-to-list 'tramp-default-user-alist
             '("ssh" nil "user2") t)

From this link I expect to then be able to use the following shorthand:

eg1 - load filename from user1@foo

C-x C-f /foo:filename rather than C-x C-f /ssh:user1@foo:filename

eg2 - load filename from user2@any_server, here we've picked bar

C-x C-f /bar:filename rather than C-x C-f /ssh:user2@bar:filename

Both of the left-hand shorthands fail on typing C-x C-f /foo: - options given suggest that Emacs has not recognized foo as a server (perhaps it's recognizing it as a connection method?).

Both of the right-hand long-winded versions work, as does the following:

C-x C-f /ssh:foo:filename

i.e. Tramp is correctly finding the default user1, but seems not to find the default connection type of ssh.

I've tried running Emacs as emacs --no-init-file to make sure it's not something in my init file. But doing that, and loading only the Tramp settings manually, the issue is identical.

As a final attempt I tried adding to tramp-default-method-alist instead.

(add-to-list 'tramp-default-method-alist
             '(nil nil "ssh"))

And also this:

(customize-set-variable 'tramp-default-method "ssh")

These don't work either - although in every case I do see the variable has been set with M-x Customize.

I'm using 26.1 with built-in tramp on Ubuntu 18.04:

tramp 2.3.3.26.1 built-in Transparent Remote Access, Multiple Protocol

I'm probably missing something obvious, given it's such a simple thing to setup!  Can anyone point me in the right direction - it's driving me nuts!


texts:
I would like to clean up BibTeX entries so that fields always appear in the same order.

For example, I would like the order of fields to always be: author, year, title, journal.  So, pressing C-c C-q on:

@Article{Smit90,
  title = {The Title},
  year = 1990,
  author = {Smith, J.},
  journal = {The Journal}
}

Should produce:

@Article{Smit90,
  author = {Smith, J.},
  year = 1990,
  title = {The Title},
  journal = {The Journal}

}

bibtex-mode has many options to reformat and clean up fields (see http://www.jonathanleroux.org/bibtex-mode.html#0620), but does not seem to have a way to reorder fields.  Ideally, the order of fields should be controlled from bibtex-entry-format and follow the order of fields that is defined in bibtex-BibTeX-entry-alist.

How could this be done?


texts: org-mode export headline without contents, if tagged with tag in list

texts:
In the answer to this question, the author posted a function that, in an export, shows only the headline of an entry if the tag is exportHeadlineOnly.

It is possible to hide the tags in a list-typed variable that can be customized, like export does with org-export-exclude-tags to completely hide some tags, so that one can dynamically decide to hide tags in the current buffer without changing the ~/.emacs file?


texts:
I am curious about the origin of certain files under ~/.emacs.d, such as: places, url/cookies, tramp, eshell/history, eshell/lastdir, auto-save-list/.saves-15234-mymachine~, request/curl-cookie-jar.

I'd like to know not only where they came from, but what variable I need to set in order to relocate them to other locations of my choosing.

To further my investigation of these files, I'd like to get a backtrace from Emacs when it opens any of them (or any other files of my choosing).  Is there a way to do that?


texts: Don't apply executable-make-buffer-file-executable-if-script-p to backup files

texts:
I currently have

(add-hook 'after-save-hook
  'executable-make-buffer-file-executable-if-script-p)

in my config to automatically make scripts executable when saving them.  However, I personally don't like that this means that also the autosaved files ending in ~, e.g., myscript.sh~, will automatically be rendered executable.

So my question is:

How can I automatically make only files not ending in ~ executable upon save?  I guess one has to write a small wrapper function, but my elisp skills are quite under-developed ... Any help is appreciated!


texts:
I'm trying to make an expression that would match the text foo if it's not on a commented out line.

;; foo ; <= not this
bar    ; <= not this
foo    ; <= this

Now rx.el can exclude character syntax classes, like:

(rx
 (not (syntax comment-start))
 (not (syntax comment-end)))

But this will only skip the comment character itself, not the whole line. How can I make it to completely skip the commented out line?


texts: How can I paste a defvar into the minibuffer?

texts:
I've written a regular expression to transform Markdown links into Org Mode links and I've stored it into a variable.
(defvar markdown-link-to-org-regexp "s/\[\(.+\)\](\(.+\))/[[\2][\1]]")

I'm using Doom and Evil mode so next time I type : so I go to the minibuffer I'd like to bring that string into the minibuffer. Is there an easy way to do it?


texts: Where to put user configurations/defaults for spacemacs?

texts:
I am a vim user trying to covert to emacs/spacemacs, but I'm having a horribly difficult time configuring things that seem like a breeze others.

I want to limit the fill to 80 (mainly for .txt files and .org mode.. I thought the default was 80 anyway? Is this only for certain file extensions?), and I found this question which gives this line:

(setq-default fill-column 80)

but where do I put this?. I have tried putting it in
init.el, the dotspacemacs/user-config section of my .spacemacs, and the dotspacemacs/user-init section of my .spacemacs. The keyboard combos C-u 80 C-x f work for setting the fill to 80 while I'm in the buffer, and M-q adjusts the fill if lines are overfilled.

Am I missing something here? From what I can see, this (dated) blog of a spacemacs contributor suggests placing such lines in dotspacemacs/user-config and not in init.el. Meanwhile, Eivind Fonn, another spacemacs contributor who has publicized his dotfiles on github, has everything in an init.el and no .spacemacs.

I should add that other statements such as (gobal-hl-line-mode) and (setq-default evil-escape-key-sequence "jk") work as expected for me. Do I have a big misunderstanding of how to configure spacemacs as my own or am I just mistaken on the intricacies of this specific function?

EDIT

I was mistaken on the command that I needed. I actually want auto-fill-mode instead of the default fill value. I tried putting

(auto-fill-mode 1)

in dotspacemacs/user-config and in dotspacemacs/user-init but neither work. If I simply execute it as a command, it works fine.

I decided to scrap spacemacs and start learning emacs with evil-mode from the ground up. If I put the (auto-fill-mode 1) into my ~/.emacs.d/init.el, it works fine. I even made a function that auto-enables this only in org-mode. Learning emacs from scratch has given me a much better understanding of how emacs works, but now that I am manually installing packages and configuring things on my own, I want all the pre-configured-ness of spacemacs back! So now my question is where do I put (auto-fill-mode 1) in my .spacemacs?

Version info:

OS: Ubuntu 14.04
Emacs: 24.4.2
Spacemacs: Develop Branch (Release 0.105.x)


texts:
proselint is a prose linter which returns error/warning messages like this:
2020-09-09-still-processing.md:18:14: typography.symbols.curly_quotes Use curly quotes “”, not straight quotes "".

I know there is a proselint checker in Flycheck, but I am trying to configure Flymake. For this task, I am using flymake-easy like this:
(defconst flymake-proselint-err-line-patterns
  '(("^\\(.*\.md\\):\\([0-9]+\\):\\([0-9]+\\): \\(.*\\)$" 1 2 3 4)))

(defvar flymake-proselint-executable "proselint"
  "The proselint executable to use for syntax checking.")

(defun flymake-proselint-command (filename)
  "Construct a command that flymake can use to check Markdown in FILENAME."
  (list flymake-proselint-executable filename))

(defun flymake-proselint-load ()
  "Configure flymake mode to check the current buffer's ruby syntax."
  (interactive)
  (flymake-easy-load 'flymake-proselint-command
                     flymake-proselint-err-line-patterns
                     'tempdir
                     "md"))

(defun flymake-proselint-maybe-load ()
  "Call `flymake-proselint-load' if this file appears to be Markdown."
  (interactive)
  (if (and buffer-file-name
           (string= "md" (file-name-extension buffer-file-name)))
      (flymake-proselint-load)))

I added flymake-proselint-maybe-load to markdown-mode-hook but flymake-show-diagnostics-buffer shows an empty buffer instead of the above-mentioned message from proselint.
My guess is I am setting flymake-proselint-err-line-patterns, but I am not sure if this is the problem.


texts: How can one debug a situation when emacs is unresponsive on Windows?

texts:
There is an operation in my setup which makes emacs unresponsive with high CPU.
I checked the emacs process with process monitor, but it does not wait for an other process, so I guess it must be something inside emacs.
I don't want to compile my own emacs with debug symbols (why isn't there a precompiled one?). Is there some feature inside emacs which I could start before invoking the operation, which writes into a text file what emacs is doing, so I can check where it gets stuck?
Debugging a frozen Emacs gives answers that work on Unix-like systems, but Windows doesn't have a USR2 signal. Is there a Windows equivalent?


texts: Org-mode calendar notifications on Windows 10

texts:
I'm looking for a way to have emacs send me desktop notifications (on Windows 10) for appointments in my org file. I did find a way to be notified within emacs (https://sachachua.com/blog/2007/11/setting-up-appointment-reminders-in-org/) and also how to have a desktop notification on Mac (https://lists.gnu.org/archive/html/emacs-orgmode/2013-02/msg00644.html ) and also on Linux (Good methods for setting up alarms (audio + visual) triggered by org-mode events? ) but not on Windows. Can anyone help me with that maybe through Windows native message boxes or Autohotkeys?
Thanks!


texts:
I am trying to use Tramp, but it seems unable to execute the ssh command.
Here is the error from *Messages*:
Tramp: Opening connection for AWS2 using ssh...
Word wrapping enabled
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none AWS2’
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    ‘M-x tramp-cleanup-this-connection’
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for AWS2 using ssh...failed

and this appears briefly in a pop-up buffer:
/bin/sh: 1: exec: ssh: not found

which makes me think it might be something to do with the PATH that Emacs is getting.

The contents of the auto-generated tramp file inside ~/.emacs.d/, which I have deleted and was recreated:
;; -*- emacs-lisp -*- <20/07/16 14:53:07 /home/user/.emacs.d/tramp>
;; Tramp connection history.  Don't change this file.
;; You can delete it, forcing Tramp to reapply the checks.

(((tramp-file-name "ssh" nil nil "AWS2" nil nil nil)
  nil))

AWS2 is a Host defined in ~/.ssh/config, with other settings (User, Identityfile, Port, etc).
More info:

I have tried tramp-cleanup-*-connections (all variants thereof).
Tried instead using the sshx: command/prefix - same error.
I can open a plain bash terminal and successfully connect using ssh AWS2.
In other IDEs, I am also able to set up an ssh-based SFTP connection and that works fine.
I have set a simple prompt on the remote machine for "dumb" $TERM values.
Tramp version: 2.3.5.26.3
Emacs version: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2019-12-23
OS: Ubuntu 16.04
Restarted my machine
Looked for any clues that Tramp has been blocked on the remote machine (given other connection routes work), but didn't find anything.


texts: How to describe-mode (but not the current major mode)?

texts: I know that describe-mode will describe the current major mode. Is it possible to describe a mode, and I will input the mode name?


texts: How to unbind a key from a command in general.el?

texts: I am using emacs with evil, and space is my leader key, however, space is bind to dired-next-line in dired-mode. So, how can I unbind space, so I can still use it as my leader key in dired-mode, and how can I achive this in genral.el.


texts: Is it possible to have a quick look to org-todo in splitted window?

texts:
I believe this can be done but I couldn't find the right wrapper package or approach for it.
I just want have a quick look to TODO and close it. Similar approach is done in org-journal. I am using org-journal to keep my journal entries. Can the same usage mechanism applied to org-todo, where:
org-journal-new-entry opens half frame windows showing journal entries.

Like org-journal-new-entry, .todo file will be opened on a half window and cursor's focus is on it.
With C-x C-s it will be closed like (define-key org-journal-mode-map (kbd "C-x C-s") 'org-journal-save-entry-and-exit) does.


texts: If I invoke org-preview-latex-fragment under one region, it destroys my previews in all other regions. Is there a way to make latex previews stick, so that previews are only removed when running C-c C-c a local (on point) or global "hide previews" command?


texts: Realgud to default to my most recent python executable

texts:
When I run realgud for python debugging, with:
M-x realgud:pdb
I see this prompt:
Run pdb (like this): python -m pdb /home/username/work/place/scratch.py

I'm using a conda environment installed in ./place/environments/default/, so I'd like to use the python executable at ./place/environments/default/bin/python
This means I have to type out a correction to use a different python:`
Run pdb (like this): /home/username/work/place/environments/default/bin/python -m pdb /home/username/work/place/scratch.py

installed in that directory every time I invoke pdb, which is tedious.
I have multiple projects in
/home/username/work/

So I can't just hard-code /one/, it needs to be configurable---but I'd like something like the following:

Default to using the last python binary I used but otherwise make me type this once.
Multi-step dialog, where the first step chooses a python (and defaults to last time).
Some variable I can set once per project and get picked up
Being able to tab complete here.

What options do I have to reduce the amount I have to type to change the python invoked?


texts: Having same commands in different Emacs configuration files.

texts: I am using Prelude Emacs and it has different configuration files. I keep my configuration files inside ~/.emacs.d/personal/. . Say,  I have a command (menu-bar-mode 1) that enables menu bar inside config1.el  but later I unintentionally put another command in another configuration file config2.el in which there ise (menu-bar-mode 0) that disables menu bar of emacs. Which configuration file overtakes other?


texts: Auto-completion of round bracket in Auctex

texts:
When using Auctex to type tex files, round bracket ( can't auto-complete for me. But [ and { can do. How can I fix it?

According to introduction of LaTeX-electric-left-right-brace, this variable is set to t. But the problem also appears. Meanwhile, my auctex can't auto-complete \(, \[, \{, \left(, \bigl[, \Bigl\{.

Emacs is new and interesting for me. Please help me solve it. Thanks!

BTW: Is there any way to delete (), [], {} by pairs?


texts: Meaning of CRM column in buffer list from `C-x C-b`?

texts:
In the Buffer List, I wonder what the CRM column means and .,  *,  % and D mean in the column? For example
CRM Buffer                Size  Mode              File
. * .emacs                3294  Emacs-Lisp        ~/.emacs
 %  *Help*                 101  Help
    search.c             86055  C                 ~/cvs/emacs/src/search.c
 %  src                  20959  Dired by name     ~/cvs/emacs/src/
  * *mail*                  42  Mail
D%  HELLO                 1607  Fundamental       ~/cvs/emacs/etc/HELLO
 %  NEWS                481184  Outline           ~/cvs/emacs/etc/NEWS
    *scratch*              191  Lisp Interaction
  * *Messages*            1554  Messages


texts: C-x 5 0 quits emacs in full-screen mode on Mac High Sierra

texts: I am running MacOS High Sierra. When I create new frames using  C-x 5 2 and try to close one of the frames using C-x 5 0 running in full-screen mode, it kills Emacs entirely instead of deleting the frame I want to kill, and I get an "Emacs quit unexpectedly" message. C-x 5 0 works normally if I don't have the frames in full-screen mode. Anyone know of a possible fix for this (other than not running Emacs in full screen)?


texts: Setting the file name for exporting from a temporary buffer

texts:
Consider:

(defun my-export-to-file (orig-fun &rest args)
  (with-temp-buffer
    (org-mode)
    (insert "some contents")
    (rename-buffer "mybuffer.org" t)
    (apply orig-fun args)))

(advice-add 'org-export-to-file :around #'my-export-to-file)

When I run export from the currently active buffer, the name is derived from that buffer instead of being mybuffer.org. Why is this the case and how do I set the file name for exporting from the temporary buffer?


texts:
I'd like to make changes to ~/.emacs.d/init.el that change my key bindings for clojure/cider mode and re-evaluate these changes without having to quit/restart emacs. This would make it easy to iteratively test new keybindings.

I mention clojure/cider specifically, but I haven't gotten this to work with modes other than emacs-lisp mode (i.e. org mode).


texts:
Suppose I want the face helm-match to have an unset foreground. Unfortunately, helm-match inherits from match so, if I try to unset the foreground normally:

(set-face-foreground 'helm-match nil)

The inherited foreground becomes active. I'd rather not mess with the match face itself (because I can't tell what ramifications that would have), and I would like to avoid hard coding the other values in helm-match because I use multiple themes.

How can I achieve this sanely?


texts: Call a function and insert text in minibuffer prompt

texts:
I'd like to define a key binding that calls a function and inserts some default input in the function's minibuffer prompt. For example, I'd like to call the command ivy-switch-buffer and automatically insert yank "!\*" into the minibuffer.

(note: not really interested in alternative solutions to this particular example; would like a general solution)


texts: Looking for a function to determine if an org-mode entry has a tag

texts:
I can use (org-entry-get (point) "myproperty") to get the value of the myproperty property for the current org-mode entry.
What about tags? Since a tag is either present or not, I was expecting some org API function such as org-entry-has-tag but there doesn't seem to be such a function. Am I missing something? If not, what's a good way to write such a function?


texts: export org to pdf not working: PDF was not produced

texts:
installed emacs and Latex ()texlive and texlive-latex-extra) on ubuntu.
Exported an Org file to PDF with no success.

Exporting via org-export-dispatch  and selected [l] export to latex and [O] as PDF file and open Beamer. Tried [p] export to pdf too. To no avail.

message is : "pdf was not produced. See "Org PDF LaTEx Output" for details"

EXAMPLE ORG:

* BASH
** Find files older than.....
#+BEGIN_SRC bash find files older 1 day
find /path/to/folder/ -mtime +1
# and then delete -exec rm -rf {} \;
# 1 hour older
find /path/to/folder -mmin +59
#+END_SRC

This is my message buffer (actual file is much longer):

org-babel-exp process sql at position 33...
org-babel-exp process bash at position 370...
org-babel-exp process bash at position 460...

Wrote /home/joe/.emacs.d/.local/cache/undo-tree-hist/.!home!joe!Documents!org!snippets.org.~undo-tree~ [2 times]
Wrote /home/joe/Documents/org/.export/snippets.tex
"org/.export/snippets.tex" 73L, 2035C written
Processing LaTeX file /home/joe/org/.export/snippets.tex...
org-compile-file: File "/home/joe/org/.export/snippets.pdf" wasn’t produced.  See "*Org PDF LaTeX Output*" for details

Checked mentioned latex file:

! LaTeX Error: File `beamer.cls' not found.

so I tried to install beamer:

    sudo apt-get install latex-beamer
[sudo] password for joe:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package latex-beamer is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'latex-beamer' has no installation candidate


texts: How to save a file in place even with backups?

texts:
In order to prevent NFS caching from leading to stale files, I need to preserve the inode of a file when Emacs saves it.  Normally, it does so anyway, but apparently not if backup files come into play.

One can test this easily by adding the following snippet to .emacs, forcing Emacs to create backups with every save:

(defun force-backup-of-buffer ()
  (setq buffer-backed-up nil))
(add-hook 'before-save-hook 'force-backup-of-buffer)

Can one make Emacs save files always in place?


texts: Open code snippet from org-mode with C-' in a vertical split instead of an horizontal one

texts:
In org-mode, I open a code snippet with C-' (org-edit-special) to edit it in a separate split. By default, it opens it in a horizontal split.

Is there a way to open a code snippet from org-mode with C-' in a vertical split?


texts: Could ediff-buffers re-use the current window configuration?

texts:
For instance, say that I have a two-window vertical split.  If I call
ediff-buffers from the right window, it will swap the right and the
left window for the diff, and even leave it like that afterwards.

I'd like ediff to try to keep the buffers in the same order during
the diff.  Is there already some setting that does this?


texts: Alt-Shift-Left and -Right (M-S-/) do not work in emacs on Raspberry Pi (org-shiftmetaleft / org-shiftmetaright)

texts:
I am on a Raspberry Pi with Raspbian and any shortcut with Alt-Shift-arrow has no effect in emacs org-mode. I discovered it while trying to use org-shiftmetaleft and org-shiftmetaright.

This is my lsb_release -a

No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:    10
Codename:   buster

and M-x emacs-version is

GNU Emacs 26.1 (build 2, arm-unknown-linux-gnueabihf, GTK+ Version 3.24.5) of 2019-09-23, modified by Debian

I tried to use xevto figure out, what happens when I press the keys but I don't understand what the output means:

FocusOut event, serial 48, synthetic NO, window 0x2c00001,mode NotifyGrab, detail NotifyAncestor FocusIn event, serial 48, synthetic NO, window 0x2c00001,mode NotifyUngrab, detail NotifyAncestor
KeymapNotify event, serial 48, synthetic NO, window 0x0,keys:
2   0   0   0   0   0   4   0   1   0   0   0   0   0   0   0
0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

I appreciate any ideas how to tackle this.


texts: How can i keep the case when I am using select and paste to C-s input field?

texts:
I see a word in buffer1. I want to look for it in buffer2.  I select the word in buffer1. I select buffer2 as my current buffer, hit C-s, and press mouse-2 (the middle mouse button).

Emacs converts the word to lowercase, and I can't find it...  The word has both lower and upper cases in it. How can I prevent Emacs from downcasing the search pattern?

I am using Emacs version 23.1.1 on RHEL 6.