texts: How to make interactive functions (simply) undoable?

texts:
This question refers exclusively to interactive functions that modify the contents of the current buffer.

What does one need to do to ensure that a single execution of (undo), right after running the function, will fully undo all the changes it made to the buffer's contents?

(For the rest of this post I'll use the word undoable to mean "can be undone with a single execution of (undo)".)

Apparently, interactive functions are not undoable by default, as the example below shows.

(NB: I stress that the function below is just an example of the problem; I'm looking for a general solution, not one that just works for this particular function/use-case.  Also, please do not use this function!  In addition to not being undoable, it has other shortcomings.)

The function quote-region inserts single quotes at the beginning and end of the current region, and replaces all occurrences of single quotes in-between with a backslash-escaped single quote:

(defun quote-region ()
  (interactive)

  (let ((beginning (region-beginning))
        (end       (region-end)))

    (goto-char end)
    (insert "'")

    (replace-string "'" "\\'" nil beginning end)

    (goto-char beginning)
    (insert "'")

))

For example, if the current region's content is

foo'bar

...then running M-x quote-region will change it to

'foo\'bar'

...as desired.

But if I now hit C-/ (undo), the buffer changes to

foo'bar'

I must then hit C-/ a second time to return to

foo'bar

Hence quote-region is not undoable, as defined above.


texts:
I'm trying to execute C and/or C++ snippets in Org Babel.  For example, I want to be able to execute the following snippet with C-c C-c:

#+begin_src C
printf ("Hello World!");
#+end_src

The documentation states that there are two installation steps: (1) having a C compiler available from PATH, and (2) having C added to the Org Babel load languages variable.

When I do this and I try to run the above code snippet, I get the following message:

Evaluation of this C code block is disabled.

The message suggests that there is something wrong with this particular code block (the use of the world this), but other code snippets result in the same message.

Was anybody able to run C and/or C++ code blocks in Org Babel?  Were more installation steps needed?

I'm using Org mode 9.1.2 and GNU Emacs 25.3.1.  Org Babel code block evaluation does work for other languages (e.g., SPARQL, SML, ELisp).


texts:
I'm having trouble getting query-regex-replace to do what I want. I've read the docs several times and still can't figure it out. Here are a few examples of things I can't figure out how to do with query-regex-replace:

Replace a bunch of whitespace on one line followed by "*" with just "*" (get rid of the whitespace.

EDIT - I got this to work with [[:space:]]+\* RET * RET

Replace two forward slashes followed by non white space with two forward slashes and white space (insert a space before the first non white space character).

EDIT - I also got this to work with //\([^[:space:]]+\) RET // \1

Get rid of blank lines (optionally of course because this is a query replace).

EDIT - I still cannot get this to work. Among other things, I tried these:

)[[:space:]]+{ RET ) { RET

and

)\s-+{ RET ) { RET

Thanks for any help.


texts: (require 'flx-ido) fails, but "M-x flx-ido-mode" succeeds

texts:
I installed the flx-ido package from MELPA, and added the following two lines of code to my .emacs file.

(require 'flx-ido)
(flx-ido-mode 1)

Emacs startup fails with the following error:

File error: Cannot open load file, no such file or directory, flx-ido

Yet, after I see the error, I can type M-x flx-ido-mode and the flx-ido-mode operations start to work fine. So the flx-ido files must have been loaded.

I don't understand how this behavior is possible. Does anyone have some ideas that I might try to solve the problem?


texts: Make C-S-up handle shift selection under Org-Mode

texts:
When shift-select-mode is on (Emacs' default), C-S-up in text mode selects the previous paragraph.

This does not work under Org-Mode, where C-S-up gets translated into C-up, which is mapped to org-backward-paragraph and just moves up, but does not select the paragraph.

The question is how to enable shift selection for C-S-up.

The solution here is not ideal, as it relies on backward-paragraph (instead of org-backward-paragraph), which does not work well with several Org-mode constructs (e.g., doesn't treat bullet points as paragraphs).

PS: I'm using org-support-shift-select and org-replace-disputed keys, like this:

(setq org-support-shift-select t
      org-replace-disputed-keys t)
(setq org-disputed-keys
      '(
        ([(shift left)]          . [(meta -)])         ; change status (todo/closed/done)
        ([(shift right)]         . [(meta =)])         ;
        ([(shift up)]            . [(control meta -)]) ; change priority
        ([(shift down)]          . [(control meta =)]) ;
        ([(control shift right)] . [(meta +)])         ; status of group
        ([(control shift left)]  . [(meta _)])         ;
        ([(control shift up)]    . [(control meta +)]) ; change clock logs
        ([(control shift down)]  . [(control meta _)]) ;
        ))


texts:
I tried to set key bindings to ztree (dir and diff), but they are not working after the emacs startup (there is no errors). f8 and C-f8 works but not the navigation keys. Pleas help.

When I eval my init.el after starting ztree all keys are working correctly.
My init:

(use-package ztree
  :bind (("<f8>"   . ztree-dir)
         ("C-<f8>" . ztree-diff)
         :map ztree-mode-map
         ("n" . next-line)
         ("p" . previous-line)
         :map ztreedir-mode-map
         ("f" . ztree-dir-narrow-to-dir)
         ("b" . ztree-dir-widen-to-parent)))


texts: How to use find-file with wild-cards non-interactivley?

texts:
In this post it talks about opening org files via find-file.

I'm trying to do this non-interactivley. I try calling:

(find-file "~/git/LeoUfimtsev.github.io/org/" "*.org")

But instead of opening all org files, it pops up with a list of possible choices.

Can I force it to load all files instead of showing a menu?


texts: ido, smex , candidates: show directories with different color

texts:
emacs 26.1 , windows 10, ido mode, smex package

M-x map

And here result:

smex show all candidates content text map
Nice. It's work fine.

But second candidates (mappings) is a directory. Rest of all candidates are files.

The question is: Is it possible separate (e.g. by text color) the directories and files candidates?


texts: How to open org-mode table as a pandas dataframe (with column names)?

texts:
I can't find how to open an org-mode table as a pandas dataframe.
Here is my example:
#+NAME:tbl
| a | b |
|---|---|
| 1 | 2 |

#+BEGIN_SRC python :var tbl=electro :results replace output   :session test :exports both
import pandas as pd
df = pd.DataFrame(tbl)
print(df)
#+END_SRC

Here I get the dataframe, but the columns are 1 2


texts: How to instruct reftex to automatically pick the .bib file in local directory?

texts:
Whenever I press C-c [ in the main.tex file I get the message No valid bibliography in this document, and no default available. How do I set the default? Using helm-bibtex seems way to easy, using the option helm-bibtex-with-local-biliography. Is there anything equivalent int reftex?

MWE:

file --> main.tex

\documentclass[11pt]{article}
\begin{document}
This is a test paragraph C-c [
\bibliographystyle{plain}
\bibliography{publications}
\end{document}

file --> publications.bib

@article{testkey,
author={J. Doe and I. Dane},
title={Fake title},
journal={Proc. of Int. Fake Journals},
year={2009},
}


texts: how do I do case sensitive searches using evil/spacemacs?

texts:
I'm trying to perform a search and replace in spacemacs but I need it to be case sensitive when by default it appears to be case insensitive. So I try to do :set noignorecase but then I have this error message :

  State noignore case cannot be set as initial evil state

Any idea how to perform a case sensitive search and replace with spacemacs?


texts:
I'm facing a major issue with Tramp and Emacs 27.1 on a Mac (10.15.7), which makes it almost impossible to work on remote files ...
As soon as I start to type a SSH or SCP based URL in the mini buffer (after C-x C-f), I get a dialog from the OS, that I need to permit access to some keychain password. One of those trigger this issue:
/ssh:
/sshx:
/scp:
/-:

The dialog always asks for access to the oldest entry in my keychain, totally unrelated to what I do in emacs.
When I permit the access, I've still a chance to stop (ESC or C-g).
When I reject, the emacs freeze and I can only kill the app.
Any hint or recommendation is very appreciated.
Br,
Michael
PS: When I type the URL faster, or paste the full URL, I pass the issue sometimes and I can open remote files.


texts:
When I do isearch on the buffer having coq mode it somehow executes code folding,
something like (... *)...

I have tried to use (setq company-coq-disabled-features '(code-folding)) for disabling code folding, but it didn't help (the code folding face was changed from [...] to ... though).

Any ideas how to disable a code folding completely?

My full emacs setup for Coq:

;; Coq
(setq overlay-arrow-string "")
(setq company-coq-disabled-features '(code-folding))

(add-hook 'coq-mode-hook
          (lambda ()
            (add-fira-code-symbol-keywords)
            (company-coq-mode)))

(add-hook 'coq-goals-mode-hook #'add-fira-code-symbol-keywords)
(add-hook 'coq-response-mode-hook #'add-fira-code-symbol-keywords)

(setq proofgeneral (shell-command-to-string "printf \"$(dirname $(dirname $(readlink $(which proofgeneral))))/share/emacs/site-lisp/ProofGeneral/generic/proof-site\""))
(load proofgeneral)


texts: ido mode not previewing buffers names on switch buffer C-x b

texts: I just started using ido-mode and can't seem to get it to give a buffer list on switch-buffer. It works fine for visit file (C-x C-f) and kill buffer (C-x k), but not on C-x b, which is a much more common event. I've just updated to Emacs 24.4.1 (i686-pc-mingw32), but that didn't solve the problem.


texts: What function are associated with these expression evaluation commands in buffers?


texts: Time in Org heading is read as timestamp by Org agenda

texts:
Suppose I'd like to set a task for tomorrow for me to check if a cron job of mine ran at the proper time.

So, I add to my org file:

** TODO check if cronjob has run at 5:00
SCHEDULED: <2018-12-03 Mon>

However, this is output in my agenda as:

  5:00...... Scheduled:  TODO check if cronjob has run at

which is not quite what I expected, which would be, for this particular task to be shown in the agenda scheduled for 2018-12-03, but with no particular time associated with it. Also the time "5:00" should not be stripped from the heading.

Org's documentation states that:

  A timestamp can appear anywhere in the headline or body of an Org
  tree entry.

However, my "5:00" does not obey the timestamp syntax (no <> or []).

Is there an "opt-out" of this behavior from Org to get timestamp information from heading content? Or am I missing something here?

I'm using Org version 9.1.14 (up to date org-plus-contrib from http://orgmode.org/elpa/).


texts:
I write *TeX in emacs with AucTeX, using pdf-tools as the viewer.
When I compile a LaTeX document in AucTeX with C-c C-c the viewer in the other window automatically refreshes, but this does not happen when writing a plain TeX document. How do I enable it?


texts: Org tables: Wrap all fields in column to a given size

texts:
In org it is possible to set a column width like follows:

|---+------------------------------|               |---+----------------|
|   |                              |               |   | <14>           |
| 1 | one                          |               | 1 | one            |
| 2 | two                          |     ----\     | 2 | two            |
| 3 | This is a long chunk of text |     ----/     | 3 | This is a lo=> |
| 4 | four                         |               | 4 | four           |
|---+------------------------------|               |---+----------------|

I would like to obtain this layout instead:

|---+----------------|
|   | <14>           |
| 1 | one            |
| 2 | two            |
| 3 | This is a long |
|   | chunk of text  |
| 4 | four           |
|---+----------------|

Of course I can use M-S-<down>  and M-<ret> to insert a new row and wrap the long field.
However, for many fields, this is inconvenient. Is there any hack or package to speed up this process?


texts: C++-mode indenting performance depends on length of previous function?

texts:
Using c++-mode in emacs23.

UPDATE:  In response to some early comments, I tested on emacs24 and emacs25, and see exactly the same behavior.  I don't have convenient access to emacs26 or emacs27 (25 is the latest version in Ubuntu Bionic LTS).

UPDATE2:  The live code in question is here:

https://github.com/jasonrohrer/OneLife/blob/master/gameSource/LivingLifePage.cpp

Grep for "dummyFunctionA" and then try adding some new blocks inside that function.  Since it's the function after the gigantic ::step function, editing it is slow.  But the next function, ::makeActive, is fast to edit.

ORIGINAL QUESTION:

Got some code that looks like this:

void longComplicatedFunction() {
.....
}

void anotherShorterFunction() {
.....
}

longComplicatedFunction is 6000+ lines.  I know that sounds horrible, but it's a main game loop, and I want it that way for many good reasons (I've shipped 19 games...).  "Just split it up" would make the code harder to read in this case.  If I were going to split it up, it should be for good code/design reasons, and NOT just for "emacs reasons."

I'm finding that typing new blocks inside anotherShorterFunction is very slow, and it seems to be due to auto-indent calculations.  This struck me as strange, because anotherShorterFunction starts in the left-most column (it's a top-level block).

In fact, editing new blocks inside anotherShorterFunction is SLOWER than editing new blocks inside longComplicatedFunction.

The really interesting thing happens when I do this:

void longComplicatedFunction() {
.....
}

void dummyFunction() {
}

void anotherShorterFunction() {
.....
}

Now typing new blocks inside dummyFunction is slow, but editing anotherShorterFunction becomes fast again.

Thus, it seems like calculating indents inside a function depends on some kind of complete scan of the previous function?  If the previous function is short, then the indent calculation is fast.  But if the previous function is long and complicated, then indent calculation becomes slow.

Can anyone explain what's going on here?  Why should the previous top-level block matter at all, or need to be scanned, when computing indentation inside a subsequent top-level block?

Note that this is true for any sub-block of anotherShorterFunction, like this:

void anotherShorterFunction() {
    if( true ) {
        int x = 5;
        if( x < 10 ) {
            x = 10;
            }
        }
    }
}

Creating the ( x < 10 ) block is slow if the previous top-level block is long.

And how slow?  Well, slow enough that Emacs turns the cursor into a beach-ball sometimes.


texts:
Is there any why to make FlyCheck learn new html tags? Custom tags? or just html5 tags.

Is there any way to add them?


texts: Org Mode export bullets instead of numbers

texts:
When exporting an Org-mode buffer to Text or ODT, I'm getting the following:
 1. Lorem
 1.1. Ipsum
 1.1.1. Dolor
 1.1.2. Sit

I'd like to change it to a bulleted list rather than numbered (closer to Org Mode view itself):
* Lorem
  + Ipsum
    - Dolor
    - Sit

(the specific bullets chosen are just an example).
How can I do that?


texts: Pre-populate property entry menu with items from setup file

texts:
I have a collection of Org files that all link to a central properties file in which I specify _ALL properties so that I can get uniform entry of information across many files:
#+SETUPFILE: ../../properties.org

I have also tried adding properties set to <unspecified> in the hopes that they would pre-populate the property entry list because it is easier not to retype the same property names every time I open a new file. Thus, a snippet of my properties.org looks like:
#+PROPERTY: GENRE <unspecified>
#+PROPERTY: GENRE_ALL Commentary Theology History Biography Philosophy Sermons

However, I was wrong about how this works. The properties menu seems to be only populated from properties that are physically in the file, not from properties that are imported from the SETUPFILE.
Is there some way I can pre-populate the property menu so that I don't have to fully retype the property names every time I start entering them in a new file?


texts: Copying an rectangular selection to system clipboard

texts:
Does anyone know a command or somtething to copy an rectangular selection (as with C-x r M-w / copy-rectange-as-kill) and put the killed rectangle into the system clipboard like with the kill-ring-save command ?

I would something like :
1) copy the rectangle region
2) paste the rectangle in a temporary buffer
3) delete the trailing whitespaces
3) copy the buffer's content to system clipboard but not in the kill-ring (don't mess with the kill-ring)
4) delete the temporary buffer.


texts: How to find out what a key sequence really does

texts:
From time to time I observe unexpected behavior when editing text.  My first recourse is usually to use C-h k to find out what functions are being called by a given key sequence.  However, sometimes the documentation is at odds with the observed behavior.  In these cases, I usually assume that some other package has hooked into that function or key sequence and is modifying its behavior.

How can I find out which functions are hooking into my key sequence?

One example that I encountered recently was that I pressed the " key and quotation marks were inserted at the beginning and end of the active region.  I had a suspicion that this was not the default Emacs behavior, so I used C-h k " to find out what function was actually being called.

The describe-key documentation told me that the function self-insert-command was being called, which is a built-in function.  To make a long story short, after some amount of trial and error, I was able to determine that the behavior was caused by electric-pair-mode.  In the future, is there a faster way to arrive at this conclusion than to turn off suspected packages one at a time until finding the culprit?


texts: Error in using "helm-projectile-find-file"

texts:
This is my config in init.el:

(require 'helm-projectile)
(projectile-global-mode)
(setq projectile-completion-system 'helm)
(helm-projectile-on)
(setq projectile-indexing-method 'alien)
(setq projectile-switch-project-action 'helm-projectile-find-file)

I was told "Find: incorrect argument formatting" and failed to list any file when used 'helm-projectile-find-file'.  I found that this error tips was produced by “find.exe”. However, this command works normally in a project which is considered project by default.


texts: How to set TAB behavior in Org-mode source-blocks when the language isn't supported?

texts:
How can I set a default TAB behavior (i.e. 4 spaces instead of tab) in an Org source-block when the language is not supported? Example:

#+begin_src xyz
lkjsdf
    iouqweou
#+end_src

Using TAB within the source-block gives me the following error message:

  org-edit-src-code: No such language mode: xyz-mode

I've already added

(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)

to the top of my init-file, and I'm loading org-mode via use-package

(use-package org
:ensure org-plus-contrib
:mode (("\\.org\\'" . org-mode))
:hook
(org-mode . variable-pitch-mode)
(org-mode . visual-line-mode)
:config
(setq org-src-preserve-indentation t)
(setq org-src-tab-acts-natively t))


texts: What is the difference between TAB and ?

texts:
I was reading the the documentation for Yasnippet mode, when I came to the section where the trigger key is defined:

It seems like Yasnippet minor mode defines the TAB key to run yas-expand using:

(define-key yas-minor-mode-map (kbd "<tab>") 'yas-expand)
(define-key yas-minor-mode-map (kbd "TAB") 'yas-expand)

What is the difference between <tab> and TAB?
(I tried to google this but I could not find a clear description)


texts: How to control the way windows are opened by "next-error" and "previous-error"?

texts:
The context
In the gif shown below, I demostrate that the way next-error show the current error in a new window depends on the size of the font.

When using the font Fira Code 20, a single window is used to show the selected error.
When using the font Fira Code 10, 3 windows are used to show the selected error.
When using the font Misc Fixed:pixelsize=7, 7 windows are used to show the selected error.

The question
How can I change the behavior of next-error and previous-error so that a single window is opened on the right of the compilation buffer (i.e. the *grep* buffer) and make this behavior not to be affected by the size of the font being used?


texts: How to debug elisp code when it is running

texts:
I have a elisp program which check server in a endless loop, like

(while t
  (let ((status (check-server)))
     (case status
        ...)
     (sleep-for 100))
  )

and I want to debug or update code in ielm, like

(print status)

or

(defun check-server ...)

However when I run it, I can't enter any code in ielm. Is there a method to finish my purpose?


texts: Automatically store link when org-capture is called?

texts:
I know about the %a template element, which inserts the stored link in the entry. I'd also like to automatically store a link whenever org-capture is called from within emacs (as opposed to spawning a capture window externally via emacsclient).

This would be useful, for example, when coding and needing to capture a task relevant to the passage of code I'm currently writing, or when I'm reading email and decide the current email needs to become a task.

When appropriate, I'd like to include the line number in the link.

Is this something that's already built in, or would it require a custom lisp function? I'm thinking I can probably advise org-capture to run org-store-link first, but perhaps there's a better idea.


texts: Cannot set correct size for variable pitch font in Doom Emacs

texts:
I am trying to use a variable-pitch font for Org-mode:
(add-hook! 'org-mode-hook #'mixed-pitch-mode)

I am specifying a variable pitch font that is normally renders much smaller than the fixed pitch one:
(setq doom-font (font-spec :family "Fira Code" :style "Retina" :size 14)
      doom-variable-pitch-font (font-spec :family "ETBembo")
      doom-big-font (font-spec :family "Fira Code" :style "Retina" :size 24))

However, no matter what I do I cannot change the size of the default text face in Org mode. I can change size for title, org-levels, etc. but not the default text font. I've tried this:
(setq doom-font (font-spec :family "Fira Code" :style "Retina" :size 14)
      doom-variable-pitch-font (font-spec :family "ETBembo" :height 1.3)
      doom-big-font (font-spec :family "Fira Code" :style "Retina" :size 24))

and this:
(setq doom-font (font-spec :family "Fira Code" :style "Retina" :size 14)
      doom-variable-pitch-font (font-spec :family "ETBembo" :size 18)
      doom-big-font (font-spec :family "Fira Code" :style "Retina" :size 24))

and even this:
(after! org (custom-set-faces! '(org-default :weight normal :slant normal :height 2.9)))

and it still fails. Can somebody help me?
screenshot:


texts: Ctrl-K Kill Line, Not Screen Edge in Visual Line Mode

texts:
(I apologize in advance for my general technical / emacs inexperience. I use org-mode for writing novels, so have not delved very deep into its many options)

I have visual-line-mode set as my default with the line (global-visual-line-mode t) in my ~/.emacs. In the past, ctrl-k (kill-line) has killed the entire line in this mode, but on a recently reformatted computer, ctrl-k is only killing to the screen edge.

How would you suggest setting ctrl-k to kill past the screen edge again?


texts: Is there a way to get proper "breadcrumbs" behavior in emacs?

texts:
I want something that I figured would be pretty basic, what with all the fancy mark-ring and all, but I can't find a way to get.

I want a global (i.e. across files) no-nonsense "breadcrumbs" behavior - that is, the ability to jump backwards (and forwards!) through the locations I visited.

I really like that locations are pushed into the ring when I search or give movement commands (I'm on spacemacs), and I would also like to have the same behavior when I jump to a new buffer, or follow links in org-mode.

I've found the breadcrumbs package, but I don't know how to go about integrating the setting of those breadcrumbs in all the different movements around files (I also favor a more a solution that's more native to emacs, such as the mark-ring, but beggars can't be choosers...).


texts: How can you set clocktable scope dynamically? Or call it programmatically?

texts:
I want to get a clocktable for a list of files defined by a function, and I can't see a way to do that. In theory (according to this answer: Is there a simple way to use all org-files referenced in a main file for the org-mode clock table) you can just provide a function, but it doesn't seem to work.

Alternatively, I'd be happy calling clocktable programmatically with elisp (and providing the function of files that way), but can't figure out how from my scan and attempts in org-clock.el.

For reference, here is an example function I would use to generate the list of files:

(load-library "find-lisp")
(defun current-dir-org-files () (find-lisp-find-files "." "\.org$"))


texts: Spacemacs/org-mode with nvAlt: disabling numbered backups

texts:
I'm fairly new to spacemacs/emacs, so apologies if this is a trivial question.

I'm using org-mode for my notes, stored within nvAlt. This works wonderfully in terms of searching/syncing, however emacs seems to keep creating numbered backups. I.e. if I have a note called todo.org, it will keep creating files called todo.1.org all the way through to todo.10.org and so on. Furthermore, the currently opened buffer would undo a bunch of latest changes I made, presumably because a new backup was created. This can be rather irritating.

I looked into how emacs handles backups, and this seems to be slightly different to the classic numbered backups (i.e. I would expect them to look like todo.org.~1~), so it seems like a custom backup format to spacemacs.

I did try to move the backups to a different location via

(setq backup-directory-alist `(("." . "~/.emacs_saves")))
(setq backup-by-copying t)
(setq auto-save-file-name-transforms `(("." "~/.emacs_saves" t)))

but to no avail.

What would be a good way to move the backup files, so they don't cause the abrupt "undos"?


texts: how to org-refile to a target within the current file?

texts:
I use org-refile quite a bit, but for my use-case, I want to refile my org-mode subtrees not to an org-agenda file, but to the current file or another file I'm currently visiting.

I had a way of doing this that was working correctly, but now has stopped working. I'm not sure what I changed that broke it.

Here's the code I'm using for org-refile:

(setq org-outline-path-complete-in-steps nil) ; Refile in a single go
(setq org-completion-use-ido nil)
(setq org-refile-use-outline-path t) ; Show full paths for refiling
(setq org-refile-allow-creating-parent-nodes (quote confirm)) ; allow refile to create parent tasks with confirmation

(defun my-org-files-list ()
 (mapcar (lambda (buffer)
   (buffer-file-name buffer))
   (org-buffer-list 'files t)))

(setq org-refile-targets '((my-org-files-list :maxlevel . 3)))

Again, this used to work. But now when I run org-refile, I get this:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  get-file-buffer(nil)
  org-find-base-buffer-visiting(nil)
  org-get-agenda-file-buffer(nil)
  org-refile-get-targets(nil (#("this" 0 4 (fontified t face org-level-1))))
  org-refile-get-location("Refile subtree \"this\" to" nil confirm nil)
  org-refile(nil)
  call-interactively(org-refile record nil)
  command-execute(org-refile record)
  execute-extended-command(nil "org-refile")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Any suggestions on how to fix this? Thanks!


texts:
windows 10, emacs 26.1, helm 3.0

Here my buffer list:

How I can hide all helm buffers? I'm don't want to Emacs to show them in Buffer List ?


texts:
Is it possible to set key bindings specific to buffer?

I have the following in one of my org files:

# Local Variables:
# eval: (local-set-key (kbd "<f10>") 'some-custom-defun-specific-to-this-buffer)
# End:

But this binding persists for other org-mode files too. If I open a file with a different major mode, then my default key binding kicks in.

It looks like local-set-key is setting bindings specific to the major-mode not specific to the buffer.

How can I have bindings that activate only in a particular buffer?


texts: How to put Media Wiki source into org-mode document?

texts:
My current workflow for most things in life is to create a TODO item in org-mode, build the solution up in the org-mode entry before pasting it elsewhere.

This has worked fine for me for quite a few years.  However I am currently creating MediaWiki entries for a third party system using this approach.

However MediaWiki uses asterisks as bullet points so I have something like the following in my org-mode entry:

* bullet item 1

* bullet item 2

Obviously org-mode attempts to interpret these as headings and refuses to accept they are sub-entry of my

* MediaWiki entries

top level-heading.  I've tried surrounding the whole entry with #+BEGIN_EXAMPLE/#+END_EXAMPLE and #+BEGIN_SRC/#+END_SRC.  While this may impact any export it clearly doesn't force org-mode to consider my bullet lists any differently.

Is there anyway to tell org-mode to not process a particular section as org-mode source?

Thanks! Any help appreciated


texts: Making relative line numbers behave well with folds?

texts:
Context: I have relative line numbers displayed in emacs. If there is a fold (for example: in org-mode), these relative numbers appear to "jump". For example if I'm on line 0 over a fold, emacs could show me that the next line visible is "50 lines" below me instead of 1 line below me.

The problem: This is causing issue with line jumping behavior. Say I want to type "50j" (in evil mode) to move 50 absolute lines down; if I do this, my cursor jumps 50 visible lines down, so that my cursor overshoots my target.

Question: Is there a way to either:

Make line jumping absolute-relative as opposed to visible-relative (so that typing "50j" moves 50 absolute lines down, as opposed to 50 visible lines down)?
Make relative line numbers along the side of the screen be visible-relative as opposed to absolute-relative?

EDIT: I'm running emacs 25 with spacemacs config, getting relative line numbers via dotspacemacs-line-numbers 'relative.


texts: Building Emacs 24.4 without admin rights, ncurses dependency

texts:
I'd like to build Emacs 24.4 from source on a system where I don't have admin rights. When I run ./configure, I get the error:

"The required function \'tputs' was not found in any library.
The following libraries were tried (in order):
  libtinfo, libncurses, libterminfo, libtermcap, libcurses
Please try installing whichever of these libraries is most appropriate
for your system, together with its header files.
For example, a libncurses-dev(el) or similar package."

I naively downloaded ncurses6.0 and built it, and then just pasted the headers, sources and .a files into the emacs24.4 directory. This didn't work. (I tried pasting those files into all of the subdirectories of emacs24.4, too.)

Any idea how, or if, I can do this? As you can tell, I'm not particularly experienced with building things on Linux.

Edit: I just double checked, and I found that ncurses is in fact installed on my system. Is there a way I can get the build script to recognize it, given the location of the ncurses install?


texts: help with writing a dired function to convert md to org with pandoc CLI..started but stuck

texts:
im trying to write a function that will be used in dired where i would launch it on the file at point and it will convert it using pandoc. i have the following code chunk (warning: my coding skills are basiclly zero :))

 (defun  z/dired-shell-md2org ()
 ""
 (interactive)
 (shell-command (concat "pandoc -o OUTPUT.org" (dired-file-name-at-point))))

the original pandoc command i use succesfuly is this

pandoc -o EDA.org EDA.md

can anyone guide me on 2 things:

how does one get the current file variable (i think its dired-file-name-at-point) to be the last word
is there a way that instead of OUTPUT.org it will use the same filename (sans extension) of original file at point?

Basically i want the converted orf file to have the same name as the original md file


texts:
I want to modify the highlighting of my JS files, so that every line starting with LOG gets shown in a different color.1

I wrote the following

(require 'font-core)

(font-lock-mode 1)

(defface mg-js-pseudo-face '((t (:background "White"))) "..." :group 'faces)

(defvar mg-js-pseudo-regex "^[ \t]*\\(LOG .*\\)")

(defun mg-js-pseudo-hook ()
  (font-lock-add-keywords
   nil
   `(
     (,mg-js-pseudo-regex 1 'mg-js-pseudo-face t)) ;;; <----- here
))

(add-hook 'js-mode-hook 'mg-js-pseudo-hook)

It works well when highlighting the whole line (using 0 instead of 1 in the marked line). It does nothing at all, when used as is. Why?

1It's invalid JS, I know. It gets preprocessed by the server to console.log with some added information.


texts: How to switch to ediff-mode from diff-mode (using the currently open diff)

texts: I would like a quick way to switch to ediff from diff-mode (since it's capable of staging git changes), is this possible?


texts: Revert buffer messages in echo area obscure minibuffer

texts:
My issue is that when I switch git branches in a project, each file that changes needs its buffer to revert, and this message is spat to the echo area for each file. If I try to run a command from the minibuffer, anything displayed in the minibuffer (the command I am typing as well as the completion suggestions) are temporarily overwritten by the revert buffer message.

Is there a way to suppress these messages so that I am able to run commands using smex in the minibuffer?


texts: org-pomodoro - extending its function: popup windows and pomo logging

texts:
I'm using pomodoro method of focus-enhanced time allocation when I work in my tasks. In Emacs (I'm using Windows 10), here comes the org-pomodoro package for org-mode, where I can 'clock-in' an item in an .org file.

What I want is to extend the function in two ways:
1. When the countdown is finished, I want Emacs to send out a system pop-up windows in case the Emacs windows is minimized or not active.
2. I want to log the pomodoro by adding a line to the item in the .org file where I 'clock-in' and potentially with pomodoro count.

I have some knowledge of Lisp but hacking Emacs Lisp (except for the really long .emacs file and tiny code files in load-path I have written).
Where should I begin?

Please give me some ideas and your opinion.
Thanks in advance.


texts:
I have M-x (and also my menu key) mapped to the command helm-M-x.

How to write an elisp function or how to configure emacs so that M-x (and the menu key) performs as C-g when the minibuffer is open.

the goal is then to make M-x (and the menu key) a toggle on/off feature.


texts:
I use eww to read online articles in Emacs instead of in a browser because it is less distracting and I can take notes in an org-mode quickly without switching applications.

I wonder how feasible it is to read an e-books in epub, or pdf format in Emacs? I found the epubmode.el on emacswiki.org but it is broken and haven't been updated since 2011.


texts: How to stop C-backspace or M-backspace from copying text?

texts: Deleting a chunk of text from the cursor causes the deleted contents to be copied into the kill ring, overwriting whatever I had stored there. How do I stop this from happening?


texts:
I'm using Inconsolata font in emacs. The setting looks like
(set-face-attribute
   'default nil
   :font (font-spec :name "-*-Inconsolata-bold-italic-normal-*-*-*-*-*-m-0-iso10646-1"
                    :weight 'normal
                    :slant 'normal
                    :size 12.0))

But the wave style underline has some issue like

The bottom of the underline is strip by the next line. Using Iosevka everything is just fine

How can I fixed this without changing to another font? Changing the font size doesn't help. Thanks.


texts: org-mode Modeline total for 'today' 'incorrect'?

texts:
I have set the org-clock-mode-line-total to be 'today as shown in the line from my custom.el

'(org-clock-mode-line-total (quote today))

When I have a task where I had some spent some time yesterday (Monday) and I start clocking it today(Tuesday), the amount of time that I spent from yesterday seems to be included in the mode line total.

e.g. current time is 7:45 am on Tuesday for the task shown below and my modeline total is shown to be 0:55.

**** STARTED Port over additions/changes to the real project.
:LOGBOOK:
CLOCK: [2018-01-30 Tue 07:35]
CLOCK: [2018-01-30 Tue 07:20]--[2018-01-30 Tue 07:30] =>  0:10
CLOCK: [2018-01-30 Tue 07:20]--[2018-01-30 Tue 07:25] =>  0:05
CLOCK: [2018-01-29 Mon 16:25]--[2018-01-29 Mon 16:55] =>  0:30
:END:

If I manually change Monday's log book entry to make it Sunday, the time shown on the modeline becomes correct(i.e. 0:20) . Maybe I have a wrong option setting somewhere? Any suggestions?


texts:
I am reading through An Introduction to Programming in Emacs Lisp in an emacs buffer. I get to the file through C-h i and navigated to Emacs Lisp Intro. If I kill the buffer and return the same way, it takes me back to the table of contents. I have save-place enabled in my init file with the following code.

(setq-default save-place t)

How can I save my place in an info file?


texts: How do I prevent the deletion of ~/.emacs.d/auto-save-list/.saves-PID-HOSTNAME~ files?

texts:
I recently upgraded to Emacs 26.3 from a much older version of Emacs (22.x). One of the many changes I've noticed with Emacs 26.3 is that the ~/.emacs.d/auto-save-list/.saves-PID-HOSTNAME~ files are being deleted even when the emacs process is terminated with a SIGHUP, such as when I lose my connection to the remote server where Emacs is running. Is there a way to prevent that? I only want the ~/.emacs.d/auto-save-list/.saves-PID-HOSTNAME~ file to be deleted if I intentionally quit Emacs. That is how it worked in older versions of Emacs.

I rely on the existence of the ~/.emacs.d/auto-save-list/.saves-PID-HOSTNAME~ file to restore my session (i.e., re-open all of the files I had opened previously) whenever my emacs process is terminated. I have a restart-session.el that I've been using for over a decade that does this.


texts: How to use my own fork of a package in spacemacs

texts:
How would I go about using my own fork of some core packages in spacemacs? So for example I'd like to use my own fork of spaceline, but I would like to keep the modifications that spacemacs does for it.

I tried doing this in layers/+spacemacs/spacemacs-modeline/packages.el:

(setq spacemacs-modeline-packages
      '(
        anzu
        fancy-battery
        ;; dependency of spaceline-all-the-icons which came from
        ;; the emacs wiki, we fetch it from Emacs Mirror for now.
        ;; TODO eventually remove this if font-lock+ is available
        ;; in an ELPA repository.
        (font-lock+ :step pre
                    :location (recipe :fetcher github
                                      :repo emacsmirror/font-lock-plus))
        neotree
        (spaceline :location local)
        (spaceline-all-the-icons :location local)
        symon
        (vim-powerline :location local)
        ))

and symlinked the local copy of my forks to spaceline and spaceline-all-the-icons to the local folder, but it just uninstalled all the packages related to those and gave me errors about undefined functions


texts: find-name-dired: find exited abnormally with code 2

texts:
Windows 10, Emacs 25.1

I try to find all el files in emacs folder and all subfolders:

M-x find-name-dired
/path/to/emacs-25.1
*.el

Result is error:

  find . "(" -iname "*.el" ")" -exec ls -ld {} ";"
  File not found - "*.el"

  find exited abnormally with code 2 at Sat Sep 23 18:59:43


texts: Ways to unobtrusively vary text rendering?

texts:
I'm writing an emacs extension for use with speech recognition, and I'm looking for help with a particular feature. Some words the speech recognizer (Dragon) recognizes consistently poorly -- it doesn't matter how many times you train it, it will just suck at recognizing certain words. At the same time usually when you're writing on a topic or when coding you'll be using a lot of the same words over and over again.

So I've written a mode that uses overlays to change how words are rendered in the buffer. It takes a random letter in the word, underlines it in a random color, and puts a random diacritical mark (accent, umlaut, etc.) over the top of it. Here's a screenshot (you will probably need to zoom to see marks/underlines):

Then you can say, "purple p hair" and it will look for the word with a purple underline under its 'a' with a diacritical mark that looks like hair and type that word for you. So in the above screenshot saying that would cause emacs to type "regexp-quote" for you.

The idea is this lets you refer to any word you've already used that's onscreen using a finite set of words the recognizer is consistently good at recognizing.

It works pretty well, except occasionally there is a collision. To make it so I can learn to consistently refer to words the same way I'm using bytes from the md5 hash of the word instead of (random) or having an algorithm assign the changes such that collisions are avoided. I've only found 6 easily distinguishable colors (it's hard when the underline is only one character wide and a single pixel thick) and 3 easily distinguishable diacritical marks (easy to tell apart from one another and also not confusable with an underline on the above line or overlapping with the underline), seen at the top of the source above.

I need more ways to alter rendering in order to reduce the collision frequency. Ideally a rendering modification would:

Not be jarring from the rest of the text. This has lead me to dismiss for example the inverse-video property.
Not be easily confusable with other changes. Overlines are easily mistaken for underlines on the previous line. Lots of diacritical marks look similar unless your font size is impractically huge.
Be spatially near where the other changes are. Right now once my eye finds the targeting character all the information is there, the marker, the underline, and the letter.
Work nicely with a fixed width font (needed for coding) that correctly renders diacritical marks (I had to switch to DejaVu Sans Mono from Consolas in order to have the marks render correctly)
Work on latin alphabet letters. There are arabic combining marks for example, but they don't combine on latin alphabet characters.
Not change letter color, since that's already being used for syntax highlighting.
Actually be doable in emacs with emacs lisp ;)

Maybe there are special unicode characters controlling rendering that could be abused to open up new possibilities? Or a way to thicken underlines so I might be able to easily distinguish more colors? Or some other obscure emacs feature letting you render marks on top of characters besides unicode?


texts: Code-block specific interpreter in Org Babel

texts: Is it possible to have, in the same org file, two code blocks in the same language that are run in different interpreters by specifying different options at the top of the code block?


texts: I am just wondering how can VC can be used to sign commit using gpg, Currently I am using vc without sign mean I am using vc-next-action to perform git commit


texts: `M-! enter shell command enter` in org mode does not insert output in current buffer

texts:
When I run M-! enter shell command enter in org mode, I expect the output to be inserted into the buffer I have active.

Instead, emacs opens a second buffer (splitting the window in two) and inserts the output there. How can I make it insert the result in the buffer I am working?


texts:
Having some command automatically populate the input string is a great thing (particularly, I refer to the feature that swiper-thing-at-point provides).

However, I would like to enhance this functionality even more by being able to have the input string automatically marked after running this command. The rationale behind it is that I find myself using swiper mostly for two things:

Find other occurrences of the thing that I currently have at point;
Find an arbitrary text in the current buffer, regardless of thing at point.

For each of these cases, having the input string automatically marked is optimal because I can, respectively, with a single command,

Start searching other occurrences of the thing at point right away;
Start typing the string I have in mind right away, knowing that, whatever input string there is, it will be completely replaced (assuming delete-selection-mode is enabled), without having to check if an initial input was populated in the minibuffer and deleting it in case it was.

I have tried creating a function to do so, but the problem is that the part of the function that tries to mark the input string (which should be whole line inside the minibuffer) is only executed when I finish the swiper search, i.e., I end up selecting a region in the buffer where I executed the function (not in the minibuffer), and the swiper input string is never selected (and so I have to delete it manually). What would be the best way to solve this problem?


texts: How can I find surrounding parenthesis (from emacs lisp)?

texts:
Is there a way to find out the type of the surrounding parenthesis (i.e. '(', '[' or '{') around point? For example (using | to represent point)

{ abc, | df }

should return '{', and

{ abc[ | ], 123 }

should return '['. Ideally I would like it to handle quotation marks as well.

In case anyone is curious or needs more details: my aim is to set up smart automatic spacing around : in python using electric-spacing (also known as smart-operator). The problem is that normally (in python) : is either the slice operator or the start of a for/if/... statement, which shouldn't be surrounded by spaces. However, within a dictionary it is something like an assignment operator, and so it should be surrounded by spaces. So I a way need to check if point is inside a dict (i.e. inside {}), but not inside a slice operation or string within that dict (i.e. not inside [] or "").

Edit:

Here's the helper function I wrote, based on abo-abo's answer:

(defun enclosing-paren ()
  "Return the closing parenthesis of the enclosing parens, or nil if not inside any parens."
  (ignore-errors
    (save-excursion
      (up-list)
      (char-before))))

Then then the final predicate is:

(and (not (in-string-p))
     (eq (enclosing-paren) ?\}))

Edit 2:

The above function turned out to be too slow (it often caused a noticeable lag when a : was typed). I'm using Stefan's answer instead now, which seems to be much faster.


texts: Is it possible to prevent screen flashing on combination of `isearch` and `recenter`?

texts:
I have followed answer for Emacs: Combine iseach-forward and recenter-top-bottom, replacing (recenter-top-bottom) to (recenter).
My goal is to re-center after each isearch-forward or isearch-backward. When I put same two words into the buffer and do isearch-repeat-forward operation (CTLR and hold s for the selected word) screen keep flashes (like keep blinks). This does not happen on default isearch-repeat-* operation.
[Q] Is it possible to prevent flashing on combination of isearch and recenter?

My setup:
(defadvice
  isearch-repeat-forward
  (after isearch-repeat-forward-recenter activate)
  (recenter))

(defadvice
  isearch-repeat-backward
  (after isearch-repeat-backward-recenter activate)
  (recenter))

(ad-activate 'isearch-repeat-forward)
(ad-activate 'isearch-repeat-backward)


texts: How to display full name of path in sr-speedbar or wrap it if it exceeds the window width

texts:
So it occurs offen that the full path always exceeds sr-speedbar window width. Is there a way to hack sr-speedbar to display the fully path seperately in a sufficient long bar or wrap the path if it exceeds the window width?

Done by adding the following to my init file:

(add-hook 'speedbar-mode-hook (lambda () (setq truncate-lines nil)))

Was having a hard time to make it also happen in spacemacs, but in case someone has the same issue, note the wrapping will become ineffective when other setttings are present, so better add all the sr-speedbar settings in hooks altogether:

(defun startup_layout ()
        (setq sr-speedbar-right-side nil sr-speedbar-width 50)
        (sr-speedbar-toggle)
        (with-current-buffer sr-speedbar-buffer-name (setq window-size-fixed 'width))
    (other-window 1)
)
(add-hook 'emacs-startup-hook 'startup_layout)
(add-hook 'speedbar-mode-hook (lambda () (setq truncate-lines nil)))

And also put in user-init instead of user config.

Knowing Problem:

When sr-speedbar-width is set less than 50, the name of path cannot be wrapped.


texts:
I installed haskell-mode, and I follow this tutorial to install company here.
But it only ran once; now when I launch Emacs I get this error:

Warning (initialization): An error occurred while loading /home/lowley/.emacs':
File error: Cannot open load file, company
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the --debug-init' option to view a complete error backtrace.

on M-x company-mode, the company mode is activated but if I enter putS it proposes putStrLn only (no putStr) and the mode turns to company-<dabbrev-code.

Here is my emacs config file :

(require 'package)
(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa-stable" . "http://stable.melpa.org/packages/")))))

(custom-set-variables
 '(custom-enabled-themes (quote (misterioso))))
(custom-set-faces
 )

(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

(let ((my-cabal-path (expand-file-name "~/.cabal/bin")))
  (setenv "PATH" (concat my-cabal-path ":" (getenv "PATH")))
  (add-to-list 'exec-path my-cabal-path))

(add-to-list 'load-path "~/.cabal/share/ghc-mod-5.4.0.0")

(autoload 'ghc-init "ghc" nil t)
(autoload 'ghc-debug "ghc" nil t)
(add-hook 'haskell-mode-hook (lambda () (ghc-init)))

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

(add-to-list 'company-backends 'company-ghc)
(custom-set-variables '(company-ghc-show-info t))


texts: C-RET not recognized by Emacs in terminal

texts:
Attempting C-c C-RET gives me the following:

C-c RET is undefined

Any thoughts on what is happening here?


texts: How do I find the code for the current major mode?

texts: How do I find the elisp code for the major mode in use in the current buffer?


texts:
I have a clear installation of spacemacs with layer shell on.

I open remote dir SPC f f ssh:<host>:<path>
I open shell SPC '
Shell is local (I expect it to be opened on the remote host)


texts: Prevent `(keyboard-quit)` from closing `*compile*` windows

texts: After a recent update to my Spacemacs install, I noticed that C-g i.e. keyboard-quit closes *compilation* buffers that result from an M-x recompile. How can I prevent this behavior? I don't want C-g to close *compilation* buffers.


texts: How to get buffer filename to appear in the ledger-report command?

texts: I work on different ledger files. Currently, each time I call ledger-report I have to retype the command ledger -f [filename] bal. How can I get the current buffer filename to appear by default in this command?


texts:
When I use the image-dired but find pictures displays in very small size.

How could enlarge them?


texts: Is it possible for Emacs to highlight backslash escape (e.g. \n) and format keyword (e.g. %s) inside string, without messing up current modes' faces? Like this:


texts: when installing a package with package.el, How to never show the compile log buffer?

texts:
This buffer annoys me every time I install a new package or update one with package.el:

How can I tell to emacs that never ever show that buffer unless I need to know something really important from it?


texts: Make forward-word not to jump over newline character

texts:
I have a text like this,

testStatus['id'] = elt.$.id^^''&&&&
testStatus$$['suite_id'] = ""

where ^^ is my cursor position. When I press M-f, it uses forward-word and end up in the place $$ in line number two.

How can I force M-f to treat newline characters as a word seperator and just stop at the end of line number one.

This works fine, when the last part of line one has some alphabets.

testStatus['id'] = elt.$.id^^''&&&&abcd$$
testStatus['suite_id'] = ""

where ^^ is my initial cursor position and $$ is my new cursor position.


texts: How to prevent  from triggering abbrev expansion?

texts:
I am trying to stop emacs from expanding abbrevs after I press the return key. If I press return, I simply want to create a new line without expanding any abbrev at point.
I am relatively new at elisp. I’m assuming the answer involves pre-abbrev-expand-hook, but I haven’t found an answer in my research.


texts: How to make Geiser send the output to REPL buffer instead of echo area?

texts:
I am running Emacs25 with Geiser (latest version from MELPA, 20180128.1821) and Guile (version 2.2, Debian package). So far it works fine, but when I evaluate a sexp, it will print the result to Emacs' echo area instead of in the REPL buffer. Is there a way to change this behavior? I'd like to be able to scroll through long output, copy parts of it, etc.

I tried looking into the configuration menus, but found nothing that seemed to be related to that.

I'd appreciate any help with this.


texts:
I have many files with the many of the following forms:

export function foo(payload={}) {
  return { type: bar, payload };
}

I would like to do a regex-replace that removes the spaces between the brackets so that the above becomes (note the removed spaces in the return clause):

export function foo(payload={}) {
  return {type: bar, payload};
}

In regex-builder I can get matches with the following:

"{ \\(.*?\\) }"

But when I try to do any kind of regex-replace across the file, with a replace pattern like {\1} I get 0 matches.

Flummoxed.


texts: Emacs think there is an accented character in the keystroke

texts:
Version

GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511)) of 2018-05-31

Use emacs -Q with following config:

(setq mac-command-modifier 'super)
(setq mac-right-command-modifier 'super)
(setq mac-option-modifier 'meta)
(setq mac-right-option-modifier 'meta)

To input M-s-a (meta - super - a) :

use right cmd + right option + a , I got M-s-a

use left cmd + left option + a,  I got M-s-å, which is not what I expected.

Does anyone know why this happen ?


texts: How to get current file name when running under ERT?

texts:
I have a set of tests that involve loading files from the file-system and I would like to use the current filename to locate the test files relative to the test file.

The below code shows the pattern I am trying, but unfortunately when I run the test using M-x ert, it fails with (wrong-type-argument stringp nil), because both the load-file-name and buffer-file-name are nil. How should I approach this?

(ert-deftest closing-braces ()
  (find-file (concat (file-name-directory
                       (or load-file-name buffer-file-name))
                     "ClosingBrace.file"))
  ...
  )


texts: Change the background color with region text as color code

texts:
I have many color variables defined in my css - LESS file, whose background color i like to highlight on text selection and running this elisp block.

(add-text-properties
 (region-beginning)
 (region-end)
 '(:background (buffer-substring (region-beginning) (region-end))))

When i chose the word, #ea7600 in this LESS code and eval the above elisp code,

@rw-orange:         **#ea7600**;
@rw-orange-dark:    #ce6006;
@rw-orange-light:   #fff5cc;

It didn't change the text's background to orange color. How can i make such a change and persist it too for all future sessions?


texts:
Reading through Magits documentation there seems to be full support for github through Ghub.

I am having trouble replicating the set up for gitlab, it is a supported forge but does not have Ghub support.

Does anyone have a guide for set up?


texts: How to remove day grouping header for today's date in Agenda View?

texts:
I have following custom agenda command definition. What I would like to achieve is to group all tasks for today without wrapping them in the current date header.
  (setq org-agenda-custom-commands
        '(("o" "Custom Agenda"
           ((agenda "" ((org-agenda-overriding-header "\n  ⚡ Do Today ⚡\n⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺⎺")
                    (org-agenda-remove-tags t)
                    (tags-todo "today")
                    (category-todo "today")
                    (org-agenda-highlight-todo)
                    (org-agenda-span 'day)
                    (org-agenda-skip-deadline-if-done)
                    (org-agenda-time-grid nil)
                    (org-agenda-prefix-format "  %-3i  %10b %15t%10s")))))))))))))

TL:DR How to remove current day header, but still group the tasks by today's date?


texts:
I'm very new to emacs, but from what I understand it should be able to do almost anything.

Something I have wanted in my IDE for a long time, is a bunch of open files, based on a git branch. I do dev work on a large software project and use feature branches. I constantly switch between different branches, and I will usually close all the open files that are not associated with the current thing I'm working on.

The problem is, when I switch back to a branch to do some more work, I can never remember what files I was working with. Basically I am after something like this:

I am working on some branch X
I switch to some other branch Y. At this point all the files I had open are closed, and their names are saved ~somewhere~
I do some work on Y and switch back to X. All the files I was working on are closed and names saved
When branch X is checked out, all the files I had open from the last time I was working on X are opened

Is something like this possible with emacs? Does it already exists? Would it be hard to implement?


texts:
Please look at the following elisp expressions.
(funcall 'lambda '() 1)
;; or
(apply 'lambda '() 1 ())

The interpreter says that lambda is not a valid function for both the above expressions. Why? Is it because lambda is a macro? If so, is there a variant of funcall/apply for macros?


texts: Ditaa source code evaluated with no result

texts:
The code below evaluated successfully but ~/Downloads/foo.png is empty. A look at the downloads folder shows that no file has been generated. What went wrong?

#+begin_src ditaa :file ~/Downloads/foo.png

    +--------+   +-------+    +-------+
    |        | --+ ditaa +--> |       |
    |  Text  |   +-------+    |diagram|
    |Document|   |!magic!|    |       |
    |     {d}|   |       |    |       |
    +---+----+   +-------+    +-------+
        :                         ^
        |       Lots of work      |
        +-------------------------+
#+end_src

#+results:
[[file:~/Downloads/foo.png]]

The same diagram, when ditaa is called from terminal, produces an output in 6 secs.

ditaa diagram.txt sample.png

ditaa version 0.11, Copyright (C) 2004--2017  Efstathios (Stathis) Sideris

Running with options:
Reading file: diagram.txt
Rendering to file: sample.png
Done in 6sec

ORG version

*Messages*

executing Ditaa code block...
java -Dfile.encoding=UTF-8 -jar /usr/local/bin/ditaa  /var/folders/rw/rpr418x91h13ysbc6k7fzj240000gn/T/babel-6iUieC/ditaa-lD3wxu /Users/satibodhi/Downloads/foo.png
Error: Invalid or corrupt jarfile /usr/local/bin/ditaa
Code block evaluation complete.

Seems like this has something to do with homebrew aliasing java -jar ditaa.jar to ditaa.

$ ditaa
usage: java -jar ditaa.jar <INPFILE> [OUTFILE] [-A] [-b <BACKGROUND>] [-d]
       [-E] [-e <ENCODING>] [-h] [--help] [-o] [-r] [-S] [-s <SCALE>]
       [--svg] [--svg-font-url <FONT>] [-T] [-t <TABS>] [-v] [-W]


texts: Have org-mode's exported HTML use CUSTOM_ID when linking to sub-sections in TOC

texts:
If I have an org-mode buffer like that looks like:

* My headline
:PROPERTIES:
:ID: id1
:END:
* My second headline
:PROPERTIES:
:ID: id2
:END:

And I export this to HTML with a table-of-contents, the table of contents uses #sec-1 and #sec-2 as the anchor links for each headline.

I would like it to automatically use #ID-id1 and #ID-id2 so that I can change the order of the headlines without changing where the links point to. Is there a way to tell org-mode to export the table of contents using these anchors instead?

EDIT As Jonathan suggested below, I have created a custom function to use :CUSTOM_ID: instead, here is my setup in case others find it useful:

(defun my/org-custom-id-get (&optional pom create prefix)
  "Get the CUSTOM_ID property of the entry at point-or-marker POM.
If POM is nil, refer to the entry at point. If the entry does not
have an CUSTOM_ID, the function returns nil. However, when CREATE
is non nil, create a CUSTOM_ID if none is present already. PREFIX
will be passed through to `org-id-new'. In any case, the
CUSTOM_ID of the entry is returned."
  (interactive)
  (org-with-point-at pom
    (let ((id (org-entry-get nil "CUSTOM_ID")))
      (cond
       ((and id (stringp id) (string-match "\\S-" id))
        id)
       (create
        (setq id (org-id-new prefix))
        (org-entry-put pom "CUSTOM_ID" id)
        (org-id-add-location id (buffer-file-name (buffer-base-buffer)))
        id)))))

(defun my/org-add-ids-to-headlines-in-file ()
  "Add CUSTOM_ID properties to all headlines in the
current file which do not already have one."
  (interactive)
  (org-map-entries (lambda () (my/org-custom-id-get (point) 'create))))

;; automatically add ids to captured headlines
(add-hook 'org-capture-prepare-finalize-hook
          (lambda () (my/org-custom-id-get (point) 'create)))))

Which I can then use the my/org-add-ids-to-headlines-in-file function to add :CUSTOM_ID: properties to each headline in a file.


texts: Emacs Ipython Notebook - What is determining inline plot background?

texts:
I have been trying to figure out what attribute is setting the background for inline plots in EIN. The background for the plot seems to always take the default background color for my color theme, even though I'm changing the default background color for the major mode that it's contained in. I.e.:

(defun switch-color ()
  "Switch default bg for ipython notebook."
  (face-remap-add-relative 'default '((:background "white"))))
(add-hook 'ein:notebook-multilang-mode-hook 'switch-color)

This works for everything except for the inline plots that are generated.

I have also tried editing matplotlibrc, and have been able to change the coloring for different parts of the plot (ticks, axes, etc) with the exception of the background.

I don't know enough about how the plots are generated inline to figure out where they're inheriting their background color from. I've looking through the M-x customize-group options for ein, but haven't been able to find anything that affects the inline plot background.


texts: possible to make it so that left-word and right-word include spaces?

texts:
Is it possible to adjust the behavior of the commands 'left-word' and 'right-word' (which I have bound to m-left and m-right) so that when I invoke, say, 'right-word' and the point jumps to the end of the next word, it also includes the space following it? But NOT any punctuation.

I want to do this because I use m-left and m-right, with the mark set, to highlight regions for deletion. With current behavior, when I set the mark, then do m-right to highlight a word or set of words then delete them, I am left with two spaces in a row.

(Theoretically left-word should then also be greedy and jump to to a position BEFORE a PRECEDING space, though I almost always select words moving forward, not backward.)

When I'm deleting just one word, I invoke kill-word, but when deleting multiple words, I prefer to first highlight them all and then delete them all at once.


texts: how to make emacs gui behave like guake/tilda/yakuake

texts: Emacs newbie here. I simply want to setup Emacs GUI to toggle hide/show(visibility) just like we see in guake, tilda or yakuake terminals. for example I have am working with Emacs within GUI and I have a browser window behind it, I want to hide Emacs with a shortcut(e.g F12) and then I will see my browser and will be able to interact with it and other windows, then again press F12 and I will have my Emacs GUI back. If it is not possible from inside Emacs, can I do this from desktop(running KDE 5.13).


texts: How to check whether ImageMagick is setup correctly on macOS?

texts:
I installed emacs on macOS by brew cask install emacs. But the functionality of resizing images doesn't work as expected.

So, how to check whether the emacs distribution is built with imagemagick support or not?

And are there any other setup needed?


texts: How to switch keyboard layouts for different languages?

texts:
Q: how do I switch between input methods for different languages when using a non-standard keyboard layout?

I have to edit text in two different languages.  I would like to be able to use my keybindings across the two languages, except, of course, when inserting text into the buffer.  It looks like I should be able to toggle-input-method (C-\) and select the alternate language.

So far, almost so good.

Here's the rub: I use the English Dvorak layout, which I set at the OS level (ie, with setxkbmap).  When I toggle-input-method, the text I insert would be correct if I had a QWERTY layout (the standard in the US), but comes out as gibberish because I'm on Dvorak.  (FWIW, when I switch my layout to standard US, it works fine.)

So: how do I inform Emacs that I'm using Dvorak so that toggle-input-method and friends translate my keypresses to the correct characters in the other language?


texts:
I'm trying to apply a logic function over a list, but:

e.g.(apply 'and some_list) give me Invalid function: and.

There is a way to apply a logical function to a list?


texts: I'm using emacs in a text terminal and would like to have an overview over the frames at all times. Something like the tab bar in firefox would be neat. Is that possible somehow?


texts:
I just need a function that will say if a heading is collapsed or not.

Need it to ensure an open heading, because org-cycle, well, cycles and it appears there are no good alternatives (e.g. org-show-entry shows ellipsis instead of children).


texts: How can I use an absolute path to my CSS with impatient-mode?

texts:
I installed impatient-mode through MELPA, and I'm having some trouble with the CSS functionality.

If I create a directory called temp with an HTML file and a CSS file inside:

temp
├── index.html
└── stylesheet.css

where index.html looks something like this:

<!DOCTYPE html>
<meta charset="utf-8">
<title>Hello, world!</title>
<link rel="stylesheet" href="stylesheet.css">
<p>Hello, world!

then start simple-httpd and impatient-mode:

C-x C-f temp/index.html RET
M-x httpd-serve-directory RET RET
M-x impatient-mode RET
C-x C-f stylesheet.css RET
M-x impatient-mode RET

and finally navigate to http://localhost:8080/imp/live/index.html/ in my browser, I can edit both index.html and stylesheet.css and see my changes in real time.

However, if I use an absolute path instead:

<link rel="stylesheet" href="/stylesheet.css">

the real-time view doesn't seem to work; I need to reload the HTML every time I edit the CSS.

How can I fix this behavior? Should I simply change the absolute paths to relative paths while I'm working on the CSS, or is there a more convenient solution? Should I submit this as an issue?


texts: Can you configure python-mode, elpy-mode to apply font-locking to imported library functions?

texts:
This question is likely an expansion / duplicate of this question: how to highlight imported functions in python code?

My .py file looks like this:

from math import floor

(max(1, 8))

(floor(3.7))

Screenshot for reference:

max has font-lock applied to it. While floor has no font-lock applied.

Questions:

How can I configure my setup (python-mode, elpy-mode) so that emacs recognises 'floor' as a function that font-lock should apply to.
If there are no answers for #1, can you recommend a package which can help?


texts: cannot open load file org2blog-autoloads

texts:
I'm using Ubuntu 14.04 lts and emacs 24.3.1

The error I get is

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

Symbol's value as variable is void: org2blog-autoloads

I set the in comment while it is not working.
The file exists and I have user privileges.

org2blog portion of my .emacs file :

;; org2blog
;; org2blog dependencies
(add-to-list 'load-path '“~/.emacs.d/elisps/metaweblog/”)
(add-to-list 'load-path '“~/.emacs.d/elpa/xml-rpc-1.6.8/”)
(add-to-list 'load-path '“~/.emacs.d/elpa/org2blog-0.5/”)
;(require 'org2blog-autoloads)

;; org2blog setup blog
(setq org2blog/wp-blog-alist
      '(("steptoharmony"
         :url "http://steptoharmony.wordpress.com/xmlrpc.php"
         :username "guybon"
         :default-title "Hello World"
         :default-categories ()
         :tags-as-categories nil)
       )
)

location of file :

.emacs.d/elpa/org2blog-0.5:
metaweblog.el org2blog-autoloads.el org2blog-autoloads.elc org2blog.elc org2blog-pkg.elc
metaweblog.elc org2blog-autoloads.el~ org2blog.el org2blog-pkg.el

Starting emacs with '--debug-init' gives this

Debugger entered--Lisp error: (file-error "Cannot open load file" "org2blog-autoloads")
require(org2blog-autoloads)
eval-buffer(# nil "/home/guy/.emacs" nil t) ; Reading at buffer position 1169
load-with-code-conversion("/home/guy/.emacs" "/home/guy/.emacs" t t)
load("~/.emacs" t t)

load-path =
    ("/home/guy/.emacs.d/elpa/org2blog-0.5" "/home/guy/.emacs.d/elpa/org-20150223" "/home/guy/.emacs.d/elpa/xml-rpc-1.6.8" “~/.emacs.d/elpa/org2blog-0.5/” “~/.emacs.d/elpa/xml-rpc-1.6.8/” “~/.emacs.d/elisps/metaweblog/” "/etc/emacs24" "/etc/emacs" "/usr/local/share/emacs/24.3/site-lisp" "/usr/local/share/emacs/site-lisp" "/usr/share/emacs24/site-lisp/git" "/usr/share/emacs24/site-lisp/dictionaries-common" "/usr/share/emacs/24.3/site-lisp" "/usr/share/emacs/24.3/site-lisp/git" "/usr/share/emacs/site-lisp" "/usr/share/emacs/24.3/lisp" "/usr/share/emacs/24.3/lisp/vc" "/usr/share/emacs/24.3/lisp/url" "/usr/share/emacs/24.3/lisp/textmodes" "/usr/share/emacs/24.3/lisp/progmodes" "/usr/share/emacs/24.3/lisp/play" "/usr/share/emacs/24.3/lisp/org" "/usr/share/emacs/24.3/lisp/nxml" "/usr/share/emacs/24.3/lisp/net" "/usr/share/emacs/24.3/lisp/mh-e" "/usr/share/emacs/24.3/lisp/mail" "/usr/share/emacs/24.3/lisp/language" "/usr/share/emacs/24.3/lisp/international" "/usr/share/emacs/24.3/lisp/gnus" "/usr/share/emacs/24.3/lisp/eshell" "/usr/share/emacs/24.3/lisp/erc" "/usr/share/emacs/24.3/lisp/emulation" "/usr/share/emacs/24.3/lisp/emacs-lisp" "/usr/share/emacs/24.3/lisp/cedet" "/usr/share/emacs/24.3/lisp/calendar" "/usr/share/emacs/24.3/lisp/calc" "/usr/share/emacs/24.3/lisp/obsolete" "/usr/share/emacs/24.3/leim")


texts: Does org-mode support callouts like asciidoc?

texts:
I wonder if org-mode has a feature like asciidoc callouts, and if so what is the syntax?
Below is a explanation on what the callouts are and how it all looks when rendered

Thanks


texts: Enabling Company CAPF backend with timer in Major Mode

texts:
I've be working on a new major mode for a DSL. I'm planning to use the CAPF backend for company mode and would like to provide the integration. The completion at point functions produce the correct options and when I explicitly call company-complete from the minibuffer, the correct completions come up. I'd like to have the completion kick in after a timer interval as I've seen in other modes. Company provides a setting for deciding the duration of the timer, so I don't think I should have to initialize one myself.

I'm new to company mode and don't know if this is a problem in my mode or in my configuration.  How do I get this to work?


texts: turn a list into a set of arguments for a function

texts:
I have a defun get-quotes with one mandatory and 2 optional arguments.  I would like to do something like this:

(let ((articles
       '("/home/matt/art/mice.pdf" '("/home/matt/art/cats.pdf" "Smith, "Neural Pathways in Cat Brains" 3)))
  (dolist (thisarticle articles)
     (get-quotes (SOMEFUNCTION thisarticle)))

Where SOMEFUNCTION checks thisarticle, and if it's a string, passes it directly as an argument, or if it's a list, makes it available to get-quotes as a set of elements (rather than a list object).  My understanding of elisp is pretty vague, so I may be missing some fundamental point. Many thanks for the help!

The possible dupe in @Drew's post is quite helpful, but since the new answer from @abo-abo was a little easier for me to follow, I'm going to accept it rather than the slightly more technical answer in the earlier question.  Thanks to everyone though.


texts: mu4e-headers view: move point to first unread e-mail

texts:
I am using mu4e-headers view with emails sorted by date in ascending order: the most recently received e-mail is shown on the bottom.

I usually have 20-30 older, read mails in my inbox, with the oldest one on top of the buffer. When I open the mu4e-headers buffer, then point is at the first buffer line, and therefore at my "oldest" e-mail. I would prefer the following behavior:

When the mu4e-headers buffer is opened, then point is automatically moved to (the beginning of) the line of the first unread email
If possible, point is at the same time in the first row of the frame. That is, the buffer is scrolled down, such that initially only the new, unread e-mails are visible, and I have to scroll up to see older ones.

Achieving only 1. would already help me a lot, if 2. turns out to be too difficult. I would appreciate any advice on how to achieve this.

My Elisp programming skills are rather low, but I think I have already figured out that mu4e-headers-mode-hook is the right place where a function that implements the above can be hooked in. But I have no idea how to identify the line of the first unread message, and how to move the cursor there.


texts: How to run multiple versions of emacs for package development?

texts:
Is there a set of tools to enable testing a package on multiple Emacs versions.
For example 24.4 is almost released. Can I install it and still safely test my package in 24.1?

How would I deal with a conflicting .emacs.d/?

I came across a repo on Github that says

  Currently, Names is being supported on the entire Emacs 24 family (24.1–24.4)

And realized I have no idea how to accomplish testing cleanly on multiple Emacs versions.


texts: Short of editing the task and removing the repeater token, is there absolutely any way to mark a repeated task done so that it does not repeat any more?


texts: electric pair of any length, using AUCTex

texts:
According to https://www.emacswiki.org/emacs/AutoPairs the package smartparens supports an electric pair of any length for example \{.

My question about the possibility that the built-in electric-pair-mode can do it. I tried this without success:

(add-hook 'LaTeX-mode-hook
              (lambda ()
                (define-key LaTeX-mode-map "\\{" 'electric-pair)))


texts: How to let make-process prompt user in echo area

texts:
This works:

(make-process :name "test"
      :command (list "bash" "-c"
     (concat "echo hello stdout!; "
     "echo hello stderr! >&2; "
     "exit 20"))
      :buffer (generate-new-buffer "*stdout*")
      ;;:stderr (generate-new-buffer "*stderr*")
              ;;:noquery nil
              )

but, I want this code to work:

(make-process :name "test"
          :command (list "bash" "-c"
                 (concat "echo hello stdout!; "
                     "echo hello stderr! >&2; "
                                     "echo enter your name; "
                                     "read name; "
                                     "echo enterted name was $name; "
                     "exit 0"))
          :buffer (generate-new-buffer "*stdout*")
          ;;:stderr (generate-new-buffer "*stderr*")
              ;;:noquery nil
              )

In other words, when the process sits and waits for user input, the end user should be prompted in the emacs echo area.
(I think tramp does something like this when it encounters a password prompt)

not part of this SO question, but eventually I would like to integrated the solution in to
(defun org-babel-sh-evaluate (session body &optional params stdin cmdline)
of https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-shell.el


texts: How to navigate horizontally in a Helm buffer?

texts:
When I use helm-occur it prints the path to the source file of the buffer, which is inconvenient on a small display.

How can I navigate horizontally?
How can I hide paths in a helm buffer?


texts: emacs on terminal does not recognise option as alt-key on mac

texts:
I am on a mac and I am running emacs 24.4.1, but I have the same problem also with 22.1.1. When I open mac on a terminal on the remote host, it does not recognise option key (alt) like the meta key. I have modified the .emacs in the following way

(setq mac-option-key-is-meta nil
      mac-command-key-is-meta t
      mac-command-modifier 'meta
      mac-option-modifier 'none)

so I have tried to change the meta key to command, but also in this case the meta key doest work .  This only work on the X version of emacs (when I open emacs in a new window), both with the option as meta key that as command as meta key. This is a problem I have with emacs in the terminal-only.

Now I don't know how to run commands in emacs! is there any keybinding I can use?


texts:
suppose I want to bind a key to a partial key sequence (i.e. a key sequence that is a prefix of some other bound keybindings).

I've tried the obvious

(global-set-key (kbd "C-x C-x") (kbd "C-c"))

But that doesn't work for some reason.


texts:
I'm looking into a way to extend search in documents, especially, Org files by ways of indexing them. In order to make the indexing more robust, it would be great to make it aware of different sections of a file. In Org files, in particular, it would make sense to look separately into headers, the pargraphs of text, comments and snippets of other documents (code, tables etc.)

Is there a way to extract this information as some data-structure?


texts:
TeXStudio seems to be aware of the interdependencies of files and internal structure (e.g., blocks for beamer posters shown in example below).

For instance, the left column panel in TeXStudio shows the files included in the master file and the block environments are recognized - it's easy to click and navigate to them.

Is there similar functionality in AucTeX?


texts:
Creating a popup menu with

(require 'popup)
(popup-menu* '("aaa" "bbb" "ccc"))

always returns the selected item even if the mouse clicks occurs outside of the menu. I would have expected that a mouse click outside of the menu would be equal to quitting the menu.

Am I missing something or do I really have to implement this myself?

I figured out that (popup-menu-item-of-mouse-event event) actually
returns the selected item if the mouse click occurs onto this item and
nil if it occurs outside. But going this way would mean to hook into
the keymap if I'm not mistaken. Is this the right way to go?
It feels like reinventing the wheel.


texts: Zip/Map functions ending when shortest list runs out

texts:
I wanted a function in the style of zip, but rather than stopping when one of the supplied lists runs out, I wanted it to continue using zip on the rest of the lists.

Looking around at a few Emacs functions (referring mainly to those internal to Emacs and in the Common Lisp, and dash.el extensions), I found a few functions like mapcar*, -zip, and -zip-fill that were close to what I was looking for, but ended when one of the given lists ran out.

I ended up writing my own function, but I'm interested in knowing why many of the functions I saw implement this behavior.  Looking online, it appears that this is the most common interpretation of how zip should work.

Would my desired function be considered zip?  I figure it may be called something else, unless is a specialized unnamed variant.

To hopefully clarify myself some, here is the function I wrote:

(defun my-zip-alt (&rest lists)
  (when lists
    (cons (mapcar #'car lists)
          (apply #'my-zip-alt (delq nil (mapcar #'cdr lists))))))

;; (my-zip-alt '(1 2 3) '(4 5) '(6) '(nil))
;;=> ((1 4 6 nil) (2 5) (3))

Recommendations for making my function simpler or more efficient are welcome, of course :)


texts: (RegEx-)Replace: Sporadic Match data clobbered by buffer modification hooks

texts:
I know this was asked in other contexts already, but I couldn't find anything related to C++ development with my hooks that could help me.
I am working a lot with replace and query-replace and query-replace-regexp and I love it.

Now I have the very annoying problem that after a while I am working in a buffer I suddenly get the error mentioned in the title after the first replace.

This happens not always but after a while it suddenly appears. Reopening the buffer fixes it for a while but is not a solution.

In other answers the before-changes-functions and the after-change-functions are mentioned. Because the error occurs after the first replace, I would assume it should be located in the after-change-functions hook. The value for this in the buffer is:

(c-after-change flycheck-handle-change flymake-after-change-function lsp-on-change jit-lock-after-change t)

I failed to find out what is going on there, so any help on that is highly appreciated.

EDIT: Thanks to Alex Karbivnichiy for the answer. I like your idea of a custom replace.

It inspired me to do some more testing with before-change-functions and after-change-functions without success. I had a buffer with the clobbered problem and started to disable minor modes. Nothing helped. I then set both change functions to nil and even this did not solve the problem.

I killed and reopened the buffer and replace is working as expected again.

Am I missing any other variable or function that can cause this problem.


texts: Prevent any form of ESC from closing a magit buffer

texts:
I'd like to be able to prevent Magit from closing a buffer when I press ESC. I also want to prevent my evil-escape-mode sequence (kj) from closing it as well.

Running C-h k ESC gives

<escape> runs the command magit-mode-bury-buffer, which is an
interactive compiled Lisp function in ‘magit-mode.el’.
It is bound to <escape>, <normal-state> <escape>, <menu-bar> <Magit> <Quit Magit>.

I'm not sure what the best approach is. Can I unbind magit-mode-bury-buffer from all of those commands? If so, how?


texts: how to provide a parameter for interactive lamda function

texts:
I want to be able to perform helm-swoop on an input error: on a compiler output buffer using C-x C-r, here is how I tried to achieve it.

(global-set-key (kbd "C-x C-r") (lambda () (interactive) (helm-swoop "error:")))

When I try to use it I get:

Keyword argument error: not one of (:$query :$source :$multiline)

I'm in a process of learning Emacs Lisp. Having this short cut would help speed up a workflow looking up compiler errors.


texts: helm find projectile file: how to view the file content when choose the file?

texts: when run the command of helm-find-projectile-file, it will show a file lists in the mini buffer, and then I can use up and down key to select the file I want to view. But is it possible to view the file content when I select a file without press the "Enter" key? if press the Enter key, then I have to get back the helm session. I just want to use up and down key to go through each file, and then let emacs show the file content immediately.


texts: w3m view image under a point in an external viewer not working

texts:
I try to view image under a point in external viewer by w3m-view-image, but when I call it I get in the *Messages*:
zsh:1: no matches found: accept_media=*/*

How can I make it working?
I use:
macOS 10.15.7
Emacs 27.1.90

EDIT:
Following @lawlist guidence, I found out that the solution to the problem will probably be configuring ~/.mailcap.
Because the main reason to have it working was to display an image in external viewer, I decided to use external browser. I ended up creating copy of w3m-view-image function but which opens image in external browser. What's good about this is solution is, it doesn't download images into ~/.w3m, the content is managed by external browser (Firefox in my case) instead. I set the function below to override default binding I.
  (defun farynaio/w3m-view-image-generic-browser ()
    (interactive)
    (let ((url (w3m-url-valid (w3m-image))))
      (if url
        (browse-url-generic url)
        (w3m-message "No image at point"))))


texts: Can I use org-mode to structure other dotfiles?

texts: I really like the idea of structuring my init.el file with orgmode. Now I wonder if this would also work with other configuration files like vimrc.


texts:
I don't like ido-find-file, which seems to be the default response to C-x C-f in my Emacs 23.1.1 installation on Centos. I tried to change it in my .emacs file:
(global-set-key (kbd "C-x C-f") 'find-file)

This doesn't change anything, at least in either text mode or lisp mode.
What am I missing?


texts: How to swap two tab-separated values on a line, and generalize the process?

texts:
My file has one book listed per line, title first followed by a tab character, followed by the author's name.

TITLE<TAB>AUTHOR
TITLE<TAB>AUTHOR
...

I want to swap the two fields, such that the author's name appears first on each line.

AUTHOR<TAB>TITLE
AUTHOR<TAB>TITLE
...

I could accomplish this with a keyboard macro, but it seems like the sort of thing which might come up again. It seems to me that Emacs Lisp should be able to do the job, but how to go about it? What if next time I want to delete a field, or filter lines based on specific fields?

In fact, AWK excels at exactly these kinds of tasks. What about Emacs Lisp?

EDIT: To reiterate, I'd like to do this with elisp, rather than evil, org, or other features.


texts:
Could someone explain in a very general sense how EMMS is intended to be used?  I am a refugee from the world of GUI music players and perhaps my mind has been warped by that.  But I haven't been able to understand from the official documentation the basic idea of what functions to call at what time.

I am generally pretty Emacs-literate, and have installed EMMS.  I've managed to get tracks playing by a kind of process of trial and error.  I've even managed to fumble my way to creating a playlist and saving it.  But I haven't figured out how to re-load it later and use it again.

It seems that the playlist is the central abstraction in EMMS, and I gather that your whole library is basically a playlist (?) but I'm not sure where to go from there, or how to use it on a "day-to-day" basis.

If I have, for example, a playlist that I've saved, it seems like maybe the idea is that I have to first do emms-playlist-new to create an empty buffer to hold the saved playlist, then I have to be in that buffer and do emms-insert-m3u-playlist (or similar, depending on the type of the playlist) and then I can use the playlist -- though the lines are just the file names, not track name, artist name, etc.  Is this really the way EMMS is intended to be used, or am I missing something that makes it simpler?

Thanks for any help....


texts: Emacs and command line $PATH disagreements on OSX

texts:
Having some issues with PATH settings on Emacs that are affecting my Haskell environment:

I'm using ZSH, and when I go to the command line and call echo $PATH, it returns: /Users/g/Library/Haskell/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

This is coming from .zprofile configuration where I have:

# Set the list of directories that Zsh searches for programs.
path=(
  ~/Library/Haskell/bin
  /usr/local/{bin,sbin}
  $path
)

So, from command line, when I call which cabal, I correctly get: /Users/g/Library/Haskell/bin/cabal

When I start Emacs and go to the shell and call which cabal, I get: /usr/bin/cabal which is causing me issue since it's a different version.

When I inspect echo $PATH from the Emacs shell, I see: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/g/Library/Haskell/bin:/usr/local/sbin

I've no idea how on earth the PATH can be different...

Anyone knows how to get my ZSH shell and Emacs to agree on the same PATH? I suspect that's what's controlling where cabal is being loaded from.

UPDATE: Running echo $SHELL from Emacs prints: /bin/zsh

UPDATE 2: This is on OSX.

UPDATE 3: I have tried to use exec-path-from-shell module and it does not work. I still have same issues, and as a side effect, it messes up my terminal theme colours :(

UPDATE 4: I've installed Emacs via brew install --cocoa --srgb emacs and I run emacs that's linked this way:

~ ❯❯❯ which emacs
/usr/local/bin/emacs
~ ❯❯❯ l /usr/local/bin/emacs
lrwxr-xr-x  1 g  admin    30B 29 Jan 18:34 /usr/local/bin/emacs -> ../Cellar/emacs/24.4/bin/emacs
~ ❯❯❯ l /usr/local/Cellar/emacs/24.4/bin/emacs
-r-xr-xr-x  1 g  admin    87B 29 Jan 18:34 /usr/local/Cellar/emacs/24.4/bin/emacs


texts: In org mode, \Cc & goes back to the reference to a link; but this binding is suppressed by yasnippet.  Do I have to redefine it, or can I prevent yasnippet from creating these bindings in the first place?


texts: Org-mode code blocks do not inherit variable properties from enclosing nodes

texts:
When playing with the literate aspects of Org-mode I found a description here of how you can set up a var property of a node and how this would then be inherited by enclosed code blocks as a variable binding. So you could do something like:

* Some node
  :PROPERTIES:
  :var:      x=123
  ...
  :END:

And this would be equivalent to something like:

#+BEGIN_SRC emacs-lisp :var x=123
  ...
#+END_SRC

Unfortunately, this doesn't seem to be the case in my Org mode, as I'm getting eval: Symbol’s value as variable is void: x when trying to execute the code block. I'm using Org-mode version 9.0.7 from Elpa. I've tried looking at variable org-use-property-inheritance, but was unable to get this to work. Any hints or ideas will be much appreciated.


texts: Can I navigate Bookmark+ bookmarks like I can with e.g. helm-bookmark?

texts:
I am experimenting with Bookmark+ and would like to be able to navigate to a bookmark using a similar workflow to that which I currently use to navigate bookmarks.
For example, previously in order to navigate to a bookmark I am used to using something like helm-bookmarks, then entering some text which Emacs will use to filter the set of bookmarks to the one I want. If I am explicit enough, the correct bookmark is highlighted at the top of the list as I type, I hit enter and am transported to the bookmark position. All is good.
With Bookmark+ however, I am opening the bookmark list, which I can then filter by typing /<search text>. The matching set of bookmarks is shown to me dynamically, as before (although the UI is different), but the focus does not shift to any of the matching bookmarks. That then entails a number of rapid hits on the down cursor key to go to the bookmark I want.
Is there a way to navigate to a Bookmark+ bookmark in a similar way to that when I use helm-bookmarks (or bookmark-jump for that matter)?


texts: Using upcase-region gives the message about it being disabled because new users find it confusing; but it seems very straightforward—replace every character with its upper-case version, if there is one.  Am I missing something in what the function does?  Or is there a whole discussion recorded about this somewhere?


texts:
When I switched to Emacs from Vim, I really loved the extensibility of Emacs. But compared with Vim, Emacs still feels somewhat sluggish. Especially when I moved my pointer/cursor around, and typing something.It's still my biggest issue with Emacs. Every time when I try Vim again, then I know again why I like to be inside Vim. It feels so snappy.

Now it seems there is a proof about my experiences with Emacs as not being so snappy:

https://pavelfatin.com/typing-with-pleasure/

I assume the latency has something to do with the font locking and Elisp in Emacs? This is a general question, not to be specific to a culprit. Emacs in overall feels less 'snappier' than Vim.

Is there any suitable approach to make Emacs more 'snappier'? Like if we could compile our extensive dot-Emacs into a compiled version of personal customized emacs in binary code? Would that make Emacs feel snappy? Or are there another ways to make Emacs feeling more 'snappy' like with Vim?

I use Xubuntu 16.04 on SSD with GUI Emacs version 25.1


texts: Am I missing something on eshell piping to an elisp function?

texts:
I use emacs on a lot of different types of machines during the day, so I'm toying with writing some elisp scripts to avoid managing 4 scripting environments.

Specifically, I'm writing an elisp function to convert the batch-agenda-csv output into a markdown blob. However, I don't seem to be understanding how the piping works. The command I'm using is here:

emacs -batch -eval '(org-batch-agenda-csv "a" org-agenda-files (quote ("~/org_life/work.org")) org-agenda-span (quote week) org-agenda-start-on-weekday 0)' | ftwynnfunc

in this case, the ftwynnfunc is simply:

(defun ftwynnfunc (text)
  (concat text "**"))

I would've expected the output from emacs to get piped to the function, which would append "**" and display on stdout. Instead, I get a usage statement from ftwynnfunc and the csv output displays afterward. Am I missing something about how pipelines work in eshell (or possibly something even more basic)?


texts: Subscribing to an individual bug on debbugs

texts:
Is it possible to subscribe to an individual bug on https://debbugs.gnu.org/?

By subscribe, I mean that ideally one would receive all the e-mails sent to that bug report, but something like an RSS or Atom feed would also be useful.

I'm aware that one can subscribe to bug-gnu-emacs, and filter client-side (e.g. for something like "to N@debbugs.gnu.org" or "cc N@debbugs.gnu.org"), but that doesn't seem ideal.

Googling, I've found this bug report:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=5439

which suggests that per-bug subscribing is not possible, but perhaps something might have changed since 2010.


texts: Are commands not equivalent to functions in Emacs?

texts:
The documentation for M-x says:
M-x runs the command execute-extended-command (found in global-map),
which is an interactive compiled Lisp function in ‘simple.el’.

It is bound to <execute>, <menu>, M-x.

(execute-extended-command PREFIXARG &optional COMMAND-NAME TYPED)

  This function is for interactive use only;
  in Lisp code use ‘command-execute’ instead.

Read a command name, then read the arguments and call the command.
To pass a prefix argument to the command you are
invoking, give a prefix argument to ‘execute-extended-command’.

I'm still a beginner at Elisp so I'm not sure I understand all of this, but it is saying that this should run an interactive compiled Lisp function somewhere.
I recently was looking for a way to find the current frame height & width. I stumbled across this website after searching about it in my favourite search engine: https://www.gnu.org/software/emacs/manual/html_node/elisp/Frame-Size.html
Now, this is saying that, for example

Function: frame-height &optional frame
Function: frame-width &optional frame
These functions return the height and width of the text area of
frame, measured in units of the default font height and width of frame
(see Frame Font). These functions are plain shorthands for writing
(frame-parameter frame 'height) and (frame-parameter frame 'width).
If the text area of frame measured in pixels is not a multiple of its
default font size, the values returned by these functions are rounded
down to the number of characters of the default font that fully fit
into the text area.

that frame-height and frame-width are functions in Emacs. This seems like the legitimate gnu.org website so it should have the latest information.
Not sure why this isn't working when I do M-x frame-height in Emacs; frame-height has [No Match] apparently.
Could anyone help me out in understanding this documentation?


texts: Can emacs close open LaTeX tags automatically?

texts:
When using web-mode, typing a </ will autocomplete with the highest level open tag name. For example, if I have an open <div>, </ will be autocompleted to </div>.

Is it possible to get the same thing in LaTeX? For example, if I have a \begin{foo} tag, how can I make emacs autocomplete an \end or \end{ to \end{foo}?


texts: TRAMP on Windows connects to Linux but not to OSX (macOS)

texts:
Using Emacs-25.2.1 on Windows XP (and on 7, too) I can connect to my Raspberry Pi (Rasppian OS) using TRAMP and the plink method and it works flawlessly. But when I try to connect to my Mac mini (OSX 10.7.4), after I input the password it hangs on with the "Found remote shell prompt..." message. The shell on OSX is plain old bash with no fancy configuration in ~/.bash_profile and the sshd is the default one at /usr/sbin
If I try to connect directly from the CMD or MSYS shell to the OSX e.g.

$ plink macmini@lionserver.home

It connects flawlessly. Any help is appreciated. Thanks.
Parts of debug tramp/ssh related to locale from the Linux connection:

12:40:09.589843 tramp-send-command (6) # locale -a
12:40:09.655846 tramp-wait-for-regexp (6) #
C
C.UTF-8
en_GB.utf8
en_US.utf8
POSIX
tr_TR
tr_TR.iso88599
tr_TR.utf8
turkish
12:40:09.709849 tramp-open-connection-setup-interactive-shell (5) # Setting coding system to ‘utf-8’ and ‘utf-8-unix’

Parts of debug tramp/ssh related to locale from the OSX connection:

12:33:56.549506 tramp-send-command (6) # locale -a
12:33:56.655512 tramp-wait-for-regexp (6) #
af_ZA
af_ZA.ISO8859-1
af_ZA.ISO8859-15
af_ZA.UTF-8
tr_TR
tr_TR.ISO8859-9
tr_TR.UTF-8
....
C
POSIX
12:33:56.709515 tramp-open-connection-setup-interactive-shell (5) # Setting coding system to    utf-8-hfs    and    utf-8-hfs