texts:
When specifying a customizable variable foo-paths as follows:
(defcustom foo-paths nil
  "Paths for foo-related things."
  :group 'foo
  :options '(foo-1 foo-2)
  :type '(alist :key-type symbol :value-type (file :must-match t)))

There doesn't seem to be any enforcement of the value type in the Customize interface. I can enter any text I want for the values, not just a file (let alone an existing file).
Am I missing something here? The manual says:

(file :must-match t)
The value must be a file name for an existing file. The widget provides completion.

What completion is the widget providing? I don't see any; all I see is a plain text box.
I'm using Emacs 25.1.1.


texts: How to Strike out DONE items in org-mode?

texts: I saw some folks have a way to strike out DONE items in org-mode. How do you do that?


texts:
common lisp has a with-accessors macro which is pretty useful but it is still prone to lots of code duplication.

Is there a convenient let/binding macro that makes all accessors from a defclass available as variables without having to name them all in advance? It would require a magical lookup of the class accessor definition at macro expansion time and I'm not sure if that's possible.


texts: How to make browse-url-of-buffer load the same html file in the same tab in Firefox?

texts: When editing a html file (in an Emacs buffer in HTML mode), I often review the file in my default browser (Firefox) by C-c C-v (ie, running browse-url-of-buffer). But every time I run C-c C-v, Firefox opens the file in a new tab so that after making several revisions, there are several tabs for the same file. But what I want is that Firefox reloads the file in the same tab, which is exactly what Safari does. Is there a way to make Firefox behave the way I want? The Emacs customization group `browse-url' does not seem to have an item for this. Neither can I find any suitable item in Firefox preferences (under General/Tabs). (I run Emacs 24.4 in Mac Yosemite, Firefox is 40.0.3.)


texts: Emacs freezes when using split-string in recursive function

texts:
I'm trying to figure out why my emacs keeps freezing when running this set of functions to split a string into a list of pairs. Is there some significant overhead happening when using string-split? Is there a different way to approach this problem?

(setq input "399822 801471
854475 776464
118051 369789
68399 518004
575096 332007
138222 180701
763798 380259
716159 578228
582494 519472
789135 852518
638621 681440")

(defun list-pairs (list)
  (when list
    (cons (split-string (car list) " " t) (list-pairs (cdr list)))))

(list-pairs (split-string input "\n" t))

I run this function and my emacs just freezes. I realize the same thing can be accomplished by using mapcar

(mapcar (lambda (x) (split-string x " " t)) (split-string input "\n" t))

(("399822" "801471") ("854475" "776464")
 ("118051" "369789") ("68399" "518004")
 ("575096" "332007") ("138222" "180701")
 ("763798" "380259") ("716159" "578228")
 ("582494" "519472") ("789135" "852518")
 ("638621" "681440"))


texts: What is the easiest way to detect if an `\includegraphics{*.eps}` has been used in a `TeX` document?

texts:
What is the easiest way to detect if one has used an \includegraphics{*.eps} in a tex document?

(motivation: When I have used this I would like to not use pdflatex and instead use the combination of latex and dvipdfm (I will take care of these).)


texts: AucTeX multiple files parsing not working

texts:
I have not been using LaTeX for quite some while, so I might be missing something obvious. I have a multiple file document and want to make AUCTeX aware of the master file. The minimal example looks like this: A master file test.tex and one section in test-1.tex in the same directory.

test.tex

\documentclass[11pt,a4paper]{article}

\usepackage{lipsum}

\begin{document}

\section{First}
\lipsum[1]

\include{test-1}

\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

test-1.tex

\section{Second}
\lipsum[2]

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "test"
%%% End:

If I compile test.texvia C-c C-c everything works fine but if I am in test-1.tex I get the following error:

ERROR: Undefined control sequence.

--- TeX said ---
l.1 \section
            {Second}
--- HELP ---
TeX encountered an unknown command name. You probably misspelled the
name. If this message occurs when a LaTeX command is being processed,
the command is probably in the wrong place---for example, the error
can be produced by an \item command that's not inside a list-making
environment. The error can also be caused by a missing \documentclass
command.

Also Switch to master file C-c ^ does not work, so there is something not working with the multiple file parsing. I have tried C-u C-c C-n to reset AUCTeX without any effect. What am I missing?


texts:
I do not want emacs company mode to complete the file names in my org-mode buffer, as it wrongly replaces many words eg But becomes Butale (file-name, surname of person) and the becomes (themaskar, another surname).
kindly help


texts:
Running the command org-open-at-point on an external link such as
[[./file.txt::foo][Link]]

causes the file file.txt to be opened in a separate buffer and the cursor to be placed on the first occurrence of the string "foo", if such a search is successful.
Unfortunately the same principle does not apply for a web link such as
[[http://site.com::foo][Link]]

as the external browser is fed the whole text of the link, in this case http://site.com::foo, doing no a posteriori search.
Is there a way to create a web link in an org-mode file which would cause the browser to load a page and then search for a text in it?


texts:
The following is my failed attempt at installing org-drill on Spacemacs.

I tried following instructions on https://bitbucket.org/eeeickythump/org-drill
But there is no "org-modules" in my .spacemacs file.
And there is no .emacs file on my Spacemacs install.

So I added "org-plus-contrib" to .spacemacs file as described in org-drill doesn't load with spacemacs configuration

I added "org-drill" to .spacemacs file, dotspacemacs-configuration-layers.

When I run dotspacemacs/sync-configuration-layers and reload the config file with SPC f e R I get the following message:

FAIL: org-drill

What is the proper way to install org-drill on .spacemacs?

Update

Thanks to Nick I successfully installed org-drill on my Spacemacs.
org-mode was already installed.
The org-drill install went something like this:

Press C-h v
Describe variable: org-modules
Press RET.
In help buffer, move point to "customize" link and RET.
Scroll down and check "External packages:"
Package: drill
Click "State" button and "Save for Future Sessions"
Run dotspacemacs/sync-configuration-layers SPC f e R
Done.
Check box "drill" is now in list, check it.
Scroll up and click "Apply and Save" button.
Run dotspacemacs/sync-configuration-layers SPC f e R


texts:
For some reason it appears eshell/echo can't handle dashes:

$ echo "aaaaaaaaaaaaa"
aaaaaaaaaaaaa
$ echo "============="
=============
$ echo "-------------"
$

Is this expected behavior? I assume it's interpreting the dashes as flags and the quote isn't helping inhibit that. Should I be escaping it a different way?


texts: Prevent whitespace-mode from overzealously highlighting blank lines at end

texts:
When using Whitespace Mode with the empty style enabled, the blank lines at the end of a file aren't highlighted if I'm on the very last line.  However, I also don't want them to be highlighted if I'm on the line before last, since it visually interferes with appending text to the end of a file.  For instance, say I have an unsaved buffer which looks like this, where $ denotes a newline character and | denotes point:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.|$

Now if I decide to add a new paragraph:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.$
$
|$

Whitespace Mode will now highlight the two blank lines at the end.  However, as soon as I start writing text, it becomes obvious that there isn't, in fact, any issue with those blank lines since my point is positioned to rectify them:

Lorem ipsum dolor sit amet, consectetur adipiscing elit.$
$
Pellentesque quis metus eget urna dictum pulvinar.|$

Therefore, how can I prevent Whitespace Mode from highlighting the blank lines in the situation just before I start typing Pellentesque, when my point is on the second-to-last blank line?


texts: How to better debug Emacs CPU management?

texts:
I can't remember since when exactly, but Emacs is getting slow with basic operations (moving cursor around). It's not exactly slow, but feeling laggy.

Before I try and halven my configuration files step by step as suggested in many places, I was wondering if there was another way.

Here is what profiler-report says:

- ...                                   433  36%
   Automatic GC                         406  34%
 + helm-check-minibuffer-input           22   1%
 + company--perform                       3   0%
 + byte-compile-let                       1   0%
 + sp-skip-closing-pair                   1   0%
- command-execute                       426  36%
 - call-interactively                   426  36%
  + helm-M-x                            287  24%
  + next-line                           103   8%
  + previous-line                        16   1%
  + save-buffer                          10   0%
  + kill-ring-save                        3   0%
  + windmove-up                           3   0%
  + windmove-down                         2   0%
  + yank                                  1   0%
  + self-insert-command                   1   0%
- timer-event-handler                   153  13%
 - byte-code                            148  12%
  - apply                               148  12%
   + mouse-avoidance-fancy              112   9%
   + auto-revert-buffers                 21   1%
   + hl-paren-highlight                   4   0%
   + #<lambda 0x72a5c9c7f6e60>            1   0%
     jit-lock-context-fontify             1   0%
   + blink-cursor-start                   1   0%
   + company-echo-show                    1   0%
 + timer-activate-when-idle               2   0%
 + timer-inc-time                         2   0%
+ redisplay_internal (C function)        87   7%
+ delete-selection-pre-hook              45   3%
+ flycheck-error-list-highlight-errors   19   1%
  x-set-selection                         5   0%
+ deactivate-mark                         2   0%
+ flycheck-display-error-at-point-soon    2   0%
+ yas--post-command-handler               1   0%

I can't really identify what gives me that laggy feel, especially since I am merely moving point around.


texts: Spacemacs - Change font size based on system name

texts:
I use one synced dotfiles repository for all of my computers, with some system-specific customization built-in. I've got a new high-DPI display on one of my computers, and would like to increase Emacs' font size just for that system. I'm trying to do the customization based on the system name, but I'm not having any success. (string= "Gotham" system-name) should be working, but for some reason it's not properly setting the font size. Here is the relevant section of my dotspacemacs/init:

(defun dotspacemacs/init ()
  (setq-default
   dotspacemacs-default-font
                 `(,(cond
                     ((or (eq 'ms-dos system-type) (eq 'windows-nt system-type)) "Consolas")
                     ((eq 'darwin system-type) "Source Code Pro")
                     (t "Source Code Pro"))
                   :size,(cond
                          ((string= "Gotham" system-name) 30)
                          ((or (eq 'ms-dos system-type) (eq 'windows-nt system-type)) 17)
                          ((eq 'darwin system-type) 12)
                          (t 17))
                   :weight normal
                   :width normal
                   :powerline-scale 1.1)
))

The two lines to set size by system-type work fine, but my system-name will not. I've also tried using (string= "Gotham" (system-name)), but that doesn't do it either. Describing the variable system-name does tell me that the value is "Gotham".

System information:

OS: Windows 10
Emacs 25.2.1
Spacemacs: 0.200.9


texts: Why an error when calling a command in a specific buffer?

texts:
Q: why do I get errors when calling a command from a specific buffer, but not in any other buffer?

Scratch all of what I had previously said about
call-interactively (see strikethrough below for reference).  It's not even remotely that.

I've done some additional investigation, and have narrowed the
problem down to something even more baffling:

visit buffer mymode.el, which defines some classes
call eval-buffer on mymode.el
call initialize-my-mode command
get error slot-boundp: Wrong type argument: eieio-object-p, #s(my-class-constructor "slot-1" "slot-2" "slot-3" "slot-4")

However, if, after calling eval-buffer, I switch to any other
buffer besides mymode.el and call the initialize-my-mode
command, I get no errors.

Why would I get eieio errors when I call a command when visiting a specific buffer, but not any other buffer?

I have zero idea what could be happening here.  I know it would be helpful to provide a minimal working example, but the classes are buried so deeply inside this mode that I cannot put one together in a timely fashion.  I have to punt on tracking this bug down due to some big family commitments (toddler + newborn in the house, sorry!).

I'll be going back to the stable Emacs 26,
but I'll leave this item up here in case anyone has any idea
what's going on.

PS Apropos one of the bug reports in the comments, I have
eieio-backward-compatibility set to nil.

Q: are there any differences between M-x command and (call-interactively #'command)?

I have an obscure bug I'm trying to hunt down, and can't even
begin to think of how to do it.

the summary version

Here's the short version, abstracting away the details.  I have an interactive command some-command that takes no arguments.  When I call it via execute-extended-command (i.e., M-x some-command), I get the error message some error message.

When I call it via elisp as (call-interactively #'some-command), it runs without error.  Likewise, when I call it via straight elisp as (some-command), it runs without error.

what's happening here?

What could possibly be causing the command to throw an error when
invoked via M-x but not any other way?

the error message in sketch

For the morbidly curious, the error message is as follows,
abstracting away some of the idiosyncrasies:

slot-boundp: Wrong type argument: eieio-object-p, #s(my-class-constructor "slot-1" "slot-2" "slot-3" "slot-4")

FWIW

This error started to show up when I upgraded to the snapshot
version of Emacs (27.0.50).  I've had other problems with eieio
in the process.


texts:
A previous comment...

In the following I'm calling mode-line to the mode-line itself or any of its variations/replacements (e.g. powerline)

Statement of the problem

In the next picture, you can see the behaviour of the mode-line in my emacs session, when there is a single window in the frame.

Except by a problem in my configuration of =diminish= package, it has the information I want.

The problems is that whenever I split the window, I lost useful information... since there is a mode-line for each window. See for example the figure below!

It gets worst as there are more windows in my frame.

What I would like

I'd like the mode-line to behave as the menu-line:

there is only one per frame,
the content depends on the active buffer

Question(s)

Is it possible to hack such behaviour? How? Does anyone try it? ... Or know a package?

I'm not a programmer myself, but I'd appreciate even a hint of where to start hacking!


texts: sh-mode: Correctly indent and highlight inside bash's subshell substitution $()?

texts:
I noticed that bash will correctly apply syntax highlighting inside the subshell substitution in

VALUE="Hello $(echo World)."

But when creating a more complicated value, e.g.

VALUE="Hello $(
    echo good
    echo world
)."

the commands inside the subshell will be highlighted as string-contents, and indentation will behave as text-mode indentation. Indentation works correctly when writing something like

VALUE="Hello "$(
    echo good
    echo world
)"."

but this changes the semantics, unless IFS is set to the empty string.

Is there some way to fix this?


texts: What is a raw prefix argument? (capital P in interactive)

texts:
And what can they be used for?

(interactive "p") takes a numerical argument from the universal argument right? And the universal argument is just an int either way, so what does capital (interactive "P") do?


texts:
I am new to Emacs and I am trying to set up a decent workflow for projects I already have.

What I want to do is to be able to have tabs of buffers on each window (not frame). What I want essentially is, having a tiled configuration of windows, to commit each window on a specific set of buffers, e.g. perhaps I want the upper left window to only cycle between 3 specific buffers. If that does not involve tabs but rather a non-visible set of buffers, I don't mind, but I want to be able to manually set the tabs/buffers assigned to each window - no automatic grouping based on filtering, for start at least.

After a bit of searching, the solutions I found (TabBar, awesome-tab) were either tabs that had some type of filtering grouping for all the available buffers, or tabs that involved switching the whole screen of windows to another. So here I am.

Any proposed solutions?


texts: Set image width globally for LaTeX export

texts:
I write my research notes in org-mode, and I'd like to avoid writing #+ATTR_LaTeX: :width 5cm :placement [!htpb] right before all of my figures, to save some time. A possible solution might be to make changes to my .emacs file. I'm just not sure what to add.

I have spent quite some time searching for a solution to this, but so far I haven't found one.

Any suggestion will be greatly appreciated.


texts: How to create table of time distribution by tags in Org Mode?

texts:
My .org-file contains tasks tagged as: a, b, c, d, e, f, g.  I want to create table of time distribution by tags a, b, c, d.

    | Tag | Time Spent |  % |
    |-----+------------+----|
    | a   |      00:30 | 25 |
    | b   |      00:30 | 25 |
    | c   |      00:30 | 25 |
    | d   |      00:30 | 25 |

What is the easiest way to do it?


texts: Is it possible to apply a function to every region between two "marker" lines?

texts:
I have a .tex file that looks something like this:

$ cat foo.tex

\begin{document}

\begin{question}
lots of
multiline text

with several
paragraphs

of information
\end{question}

other text

\begin{question}
more text

here that i want to

manipulate

easily
\end{question}

\end{document}

I want to apply my-function to every region occuring between \begin{question} and \end{question}. Is this easily accomplished in emacs?


texts: Changing confirmation style when deleting files in dired

texts:
In aquamacs, the confirmation to delete files from dired is a y or n, and immediately on pressing one of them the file is deleted (no RET required after the y or n).

In emacs, the confirmation is yes or no, so that I need to type the full yes or no plus RET afterwards.

I would like to change emacs so that it behaves like aquamacs.

Is this possible at all?  I did a google search plus checked M-x customize-group RET dired RET and couldn't find anything that helped (I found stuff to get rid of the confirmation altogether, but that's not what I am after).


texts: key binding to invoke more than two commands

texts:
I'm in org-mode and would like to have C-c C-c ' run org-edit-special then mark-whole-buffer then indent-region then org-edit-special to get back out again. I've tried

(defun my-run-org-babel-codeblock-format ()
  "Run org babel codeblock formatting in sequence."
  (interactive)
  (org-edit-special)
  (mark-whole-buffer)
  (indent-region))

(global-set-key (kbd "C-c C-'") 'my-run-org-babel-codeblock-format)

but this doesn't work:

my-run-org-babel-codeblock-format: Wrong number of arguments: (2 . 3), 0

Apparently multiple means no more than two commands. That is, when I remove (indent-region) it seems to work. Is there something I can do to have all four commands under one key binding?


texts: I can toggle the visibility of text under a heading by pressing TAB, it doesn't show the contents of the properties drawer. I want to look at properties often. Is there a way to have Emacs expand the properties drawer whenever the text under a heading is shown? What other ways of showing the properties easily and maybe automatically are there?


texts:
I have been trying to get Ergoemacs working on Mac for about 2 weeks now and I have finally managed to get it working using a combo of:

Ignoring Mac's supplied ancient build of Emacs
Installing from Brew.

My final hurdle seems to be that the keyboard maps that comes with ITerm2 and Mac in general seems to be in loggerheads with those defined in Ergoemacs. I have looked at Aquamacs and they seem to come with another set of keyboard shortcuts. I would really hate to have to learn one set of keyboard shortcut during the time I work on Mac and the other times when I am on my Linux machine as that would really hurt my muscle memory.

Any suggestion?

Further digging indicated I need to change the key binding for Mac but the keybinding provided is only for Mac OS X. Any idea how to get it working on Yosemite or better yet how do I change the keybinding on Yosemite?


texts:
I want to install [kaolin-themes][1]
[1]: https://melpa.org/#/kaolin-themes in vanilla emacs.
I did M-x package-intall RETURN and entered kaolin-theme in the Install package prompt.
I got below error -

https://melpa.org/packages/kaolin-themes-20201029.1454.tar: Not found

when I searched melpa link, I found there is latest version 20201108.1814 available.
below is my init file ~/.emacs
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)

(package-initialize)

(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/") t)

how can I fix this issue?


texts:
When visually selecting rectangles with C-v in evil, the point is not allowed to pass the end of line.

This is in contrast with:

rectangle-mark-mode
cua-rectangle-mark-mode

Both of which allow the point to pass the EOL. (Although evils behavior is correct vim emulation)

Is there any way I can bring this functionality to evil?


texts: Query-replace with some context checking?

texts:
(query-replace "foo" "bar") shows you all occurrences of foo and offers to replace them by bar.

I would love to have a version of query-replace that only picks the occurrences of foo that are "in some context" (to be defined). At the moment, I'm thinking of LaTeX files with the context being "any part that is in math style". Or any part not in math style. These parts are already highlighted by Emacs' latex-mode so it can recognize them.

query-replace can already perform a bit of context checking since its DELIMITED argument allows restricting to occurrences surrounded by word boundaries, but this is a simple special case that can be implemented with regular expressions, e.g., looking for \<foo\>.

My question: do you know of an extension of query-replace in some package somewhere that can do the replace-only-in-math-style trick I need? Or of something similar enough that would be a good start for tweaking and hacking around?


texts: Bind keybord shortcuts to a MIDI keyboard?

texts:
I'm exploring the possibility of using a programmable keybord like this one:

https://storefront.expertkeys.com/startseite/28-expertkeys-ek-20-usb-tastatur-0700587547911.html

to expand and simplify my keyboard shortcuts.

Now I'm wondering if there is the possibility to use a musical MIDI keyboard instead? E.g. like this one:

https://www.akaipro.com/lpk25

This solution would be much cheaper and, in my opinion, "smarter".

Anyone have news of such a project?


texts: Emacs tries to read init.el from remote machine during start-up

texts:
I have a very weird issue since a few days without being aware of any change in my set-up. I run Emacs 27.1 (on macOS installed via macports) on my laptop and on my desktop computer with a very similar set-up. Both machines run independently in the same network with an own init.el file located in ~/.emacs.d/.
Since two or three days my laptop tries to load the init.el via tramp from the desktop machine. They do not share any volumes etc. I haven't used tramp for any remote editing etc. But I get a lot of messages like this in my Message buffer
Tramp: Inserting ‘/ssh:martin@XXXXX:/Users/Martin/.emacs.d/init.el’...

And if the desktop machine is not running Emacs halts during start-up. That's very annoying and I have no clue what is causing this.
Can anyone give me some hints how to find out what is happening?


texts: Insert inactive date with elisp function including date arithmetic

texts:
For a capture template I want to insert inactive dates for the upcoming week (without a prompt). In this format (no time component):

[2020-02-10 Mo]

I've figured out that I could do something like this
[%(org-read-date nil nil "Tue")] which yields [2020-02-11]. So it misses the weekday.

I also know about this method
(org-insert-time-stamp (org-read-date nil t "+1d")) but that timestamp is not inactive.


texts:
I'm trying invoke magit-blame in spacemacs. If I do:
SPC g b

Then I see a "git-blame" section at the bottom which says:
Press [_b_] again to blame further in the history, [_q_] to go up or quit.

But if I hit b, I see the error message:
Unbound suffix: 'b'

ON the other hand, if I invoke magit blame instead by doing:
M-x magit-blame

And then I hit b, it works.


texts: Magit asks for passphrase for ssh key every time

texts:
Running emacs 25.2.2 magit 2.12.1 on Kubuntu 18.04.

I have set-up ssh keys for my bitbucket repository and I run ssh-agent on start.

When I fetch or pull or push, magit asks for the passphrase for ssh key.

How can I avoid keying this passphrase every time there is any remote operation?


texts: What is the best way to modify an existing function from a package?

texts:
There is a function in ESS called ess-sas-goto-log (https://github.com/emacs-ess/ESS/blob/master/lisp/ess-sas-a.el#L705) that will open a log file and search forward using re-search-forward. I would like to make a version that searches backwards. What would be the best way to go about this?

I know I can simply replace search-forward with search-backward but I would like to do it the proper way.

Thanks!


texts: Helm-minibuffer-history doesn’t refresh if search is multiple words

texts:
I have defined the following binding to access my history of searches input into helm buffers:
(define-key helm-map (kbd "M-r") 'helm-minibuffer-history)

However, if I invoke this binding, e.g., in the M-x menu and select an item from my search history that is two or more words long, the helm buffer will not re-list the results associated with that search after filling in the string. Instead, I have to delete every word of the string but the first word before the helm results are refreshed.
Using previous-history-element while in the M-x menu does not have this issue, but the problem with it is that it skips over searches that I input into the helm buffer but did not execute with RET. I wish it worked like ivy-previous-history-element, which cycles through a history of every string you typed into an ivy minibuffer.
Is there a way to make helm-minibuffer-history automatically refresh the helm buffer with multi-word searches, or alternatively to make previous-history-element behave like ivy-previous-history-element?


texts: Adding an argument to compile mode from "Local Variables"

texts:
I have the following code in my .emacs file

(push
   '("Latexmk" "latexmk -interaction=nonstopmode -pdflatex='pdflatex -synctex=1 -file-line-error' -pdf %t" TeX-run-TeX nil t
     :help "Run Latexmk on file") TeX-command-list)

However, I would like to compile certain files with additional arguments (like "--shell-escape"), but I don't want to always have that option and I prefer not to create a separate command for it.

Is there a way to specify these arguments locally in a file so that they are passed to latexmk? Perhaps something like this at the end of the file

%%% Local Variables:
%%% compile-args: --shell-escape
%%% End:


texts: How to set a short-cut for #+BEGIN_SRC #+END_SRC?

texts:
I read the org-mode manual but did not find a short cut to insert:

#+BEGIN_SRC
#+END_SRC

I guess I need to create a configuration in ~/.emacs to set a shortcut? Or, is there a shortcut but I did not know?

I use R much in emacs. Is there a way to create a separate shortcut to create this?

#+BEGIN_SRC R
#+END_SRC


texts: Is there any way to visually enhance org-mode?

texts: For example making different headline levels appear in different font sizes or changing the color scheme.


texts: How can I add my own key-bindings to magit transient state?

texts:
Magit defines a transient state

(transient-define-prefix magit-dispatch ()
  "Invoke a Magit command from a list of available commands."
  ["Transient and dwim commands"
   [("A" "Apply"          magit-cherry-pick)
   ...
  ["Essential commands"
   :if-derived magit-mode
   ...
   ("C-h m" "   show all key bindings"    describe-mode)])

I would like to add <escape> and <q> as key-bindings to exit the transient state.

If I edit magit.el directly, I can achieve what I want:

(transient-define-prefix magit-dispatch ()
  "Invoke a Magit command from a list of available commands."
  ["Transient and dwim commands"
   [("A" "Apply"          magit-cherry-pick)
   ...
  ["Essential commands"
   :if-derived magit-mode
   ...
   ("<escape>" "quit transient state"     transient-quit-one)    ; <--- I added
   ("q" "       quit transient state"     transient-quit-one)    ; <--- these
   ("C-h m" "   show all key bindings"    describe-mode)])

However, unless I can upstream my changes, this won't persist if I reload my packages from elpa, etc.

How can I add these key-bindings in my own init.el so they augment the transient state magit defines?


texts:
I would like to create a template called "my-article", with specified packages and settings to be exported to latex from org-mode. How can I do this?

PS: the instructions for org-mode<8.0 does not work as in here http://orgmode.org/worg/org-tutorials/org-latex-export.html

Thanks


texts:
While I am typing company shows suggestons. When I press space I want to abort suggestions and apply space, but instead it only does abort. Hence I need to press two times space to apply space.

[Q] How could I abort and apply space when company suggests completion?

(add-hook 'after-init-hook 'global-company-mode)
(setq company-auto-complete t)

(with-eval-after-load "company"
  (define-key company-active-map (kbd "C-p") #'company-select-previous-or-abort)
  (define-key company-active-map (kbd "C-n") #'company-select-next-or-abort)
  (define-key company-active-map (kbd "C-h") #'backward-delete-char)
  (define-key company-active-map (kbd ".") #'company-abort)
  (define-key company-active-map (kbd "SPC") #'company-abort)
  (define-key company-active-map (kbd "C-f") #'company-abort)
  )

(eval-after-load 'company
  '(progn
     (define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
     (define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle)))

(setq company-frontends
      '(company-pseudo-tooltip-unless-just-one-frontend
        company-preview-frontend
        company-echo-metadata-frontend))

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


texts: How to replace a character display only for the `italic` face?

texts:
I am using a font that does not include italic characters. However, it does include characters like mathematical italic small a, which I would like to use instead.

I can set up a display-table that maps a regular character a to its mathematical italic counterpart .

(let ((d (make-display-table)))
  (aset d ?a (vector ?))
  (set-window-display-table nil d))

But I can't figure out how to use this display-table only for italic text.


texts: After installing an icon font, propertize still show unknown characters

texts:
I'm trying to use custom icons from https://materialdesignicons.com/.

(defface mdi-face
  `((t (:family "Material Design Icons")))
  "Face for Material design icons.")

(insert (propertize "\f004" 'face 'mdi-face)))

The font is installed system-wide and is available to Emacs. All I see is a sequence of little squares as if the font wasn't installed.


texts: Make `re-search-forward` return string with Korean characters

texts:
I am trying to implement a web scraper that does the following:

Make a request to https://m.weather.naver.com/,
Get interesting pieces of information (regarding today's weather), then
Organize them nicely into a new org-buffer.

So far, I have this piece of code (credit: http://teaching.sociology.ul.ie/bhalpin/wordpress/?p=580):
;;; scrape_weather.el ---  -*- lexical-binding: t; -*-

(defun get-weather-page ()
  "get the title text of Naver Weather"
  (set-buffer (url-retrieve-synchronously "https://m.weather.naver.com")) ; set this buffer to current buffer
  (re-search-forward "<title>\\(.+\\)</title>")                           ; re-search for pattern
  (match-string 1))                                                       ; return the first parens in regexp

(defvar *str* (get-weather-page))

;; *str* evals to "\263\327\300\314\271\366 \263\257\276\276".. is there any way I can encode it back to Korean?

;;; scrape_weather.el ends here

For debugging purposes, I evaluated the variable *str* and got weird sequences of hex codes. That must be 네이버 날씨, but I'm sure that the decoding of Korean characters got broken after the execution of re-search-forward.
Is there any way I can correct the decoding?


texts: How to prevent undo from operating on invisible text/regions?

texts:
Q: how can I prevent undos of invisible text?

I use org-mode and outline-minor-mode in virtually every
buffer, and leave text folded (invisible) unless I'm explicitly
working on it.  Sometimes I hide text and then accidentally hit
undo, which is super confusing.

How can I prevent undo from undoing edits that are in an
invisible part of the buffer?


texts: translate a modifier key (Super to Ctrl OS X)

texts:
Most of the convenient OS X keybindings that GNU Emacs defines, such as s-a for C-x h, are not all that useful to me. I'd like to make Super synonymous with Ctrl. Is there a way to easily map all key chords involving Super to the equivalent Ctrl version? Failing that, is there a way to map a key to another key that works for prefix keys as well as non-prefix keys?

I've tried using keyboard-translate and global-set-key so far.

(keyboard-translate (kbd "s-a") (kbd "C-a")) results in a type error. I'm not sure why.

(global-set-key (kbd "s-a") (kbd "C-a")) works fine, but (global-set-key (kbd "s-h") (kbd "C-h")) does not seem to do much of anything.


texts: How do I get byte-compilation warnings about undefined variables?

texts:
The following code works fine with M-x eval-buffer, and byte-compiles without any warnings.

(eval-when-compile
  (defconst demo-one 1))

(defvar demo-some-var
  `(foo bar ,demo-one))

However, if I byte compile it, I get broken code:

;ELC
;;; Compiled
;;; in Emacs version 26.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.

;;; This file does not contain utf-8 non-ASCII characters,
;;; and so can be loaded in Emacs versions earlier than 23.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defvar demo-some-var (list 'foo 'bar demo-one))

The byte compiler hasn't put demo-one in the .elc file, so anyone installing my package from (M)ELPA gets broken code.

I should be using eval-and-compile in this case, but I didn't realise my code was wrong. Can the byte compiler warn me here? Why didn't it?


texts: How to force all fontification to complete?

texts:
I have a package which checks the face of a character before operating on it.

A problem with this is, the face might not yet have been calculated because of:jit-lock-context-time, which delays contextual fontification.

How can I ensure a region of text has all it's font-faces calculated, including contextual fonts?


texts: show white spaces only when region is selected

texts:
whitespace-mode will show the whitespace all the time in entire buffer,
Is there the way to show whitespaces only when the region is selected. which is pretty cool to have, does there mode exist for such feat or an configuration.

There is exists the similar functionality in sublime editor, as show in screenshot.


texts: How do buffer local bindings go into effect?

texts:
I'm learning to program with buffer local variables. The emacs documentation describes buffer local variables as:

  A buffer-local variable has a buffer-local binding associated with a particular buffer. The binding is in effect when that buffer is current; otherwise, it is not in effect. If you set the variable while a buffer-local binding is in effect, the new value goes in that binding, so its other bindings are unchanged. This means that the change is visible only in the buffer where you made it.

How does a buffer-local binding go into effect? This is an amateurish question. I assume it has something to do with the buffer being loaded, but I can't begin to imagine what this looks like in code.


texts: (Sudden) Weird behavior of M-q in auctex

texts:
I very much enjoying using the auto fill functionality that the key binding M-q provides. However, starting recently, I am experiencing a small (but annoying) change in its behavior when in LaTeX mode. That is, now I have to explicitly mark the paragraph that I want to auto fill, whereas before it was good enough as long as the cursor is somewhere in the paragraph. For example,  to format
Hello
World

to
Hello World

it was enough to hit M-q with my cursor somewhere in those two lines. Now I have to mark the two lines and then hit M-q to get the reformatting. I haven't installed anything new or touched my configuration file. I did update Emacs a couple days ago. Any advice will be greatly appreciated.


texts:
I want to have tables that I can easily export to files. In this regard I want to associate a file path and a format to tables. This page in the docs is most relevant: https://orgmode.org/manual/Built_002din-table-editor.html

I tried this to set the file path:

#+TABLE_EXPORT_FILE: 'data/observations.csv'
| day              | observation |
|------------------+-------------|
| <2019-11-14 Thu> | cold        |
| <2019-11-14 Thu> | warm        |

And then running org-table-export but I still get the prompt asking for a file.

I am fine with a per-file setting of the file format, i.e.:

# Local Variables:
# mode: org
# org-table-export-default-format: orgtbl-to-csv
# End:

But it would be nice to set that as well on a per table basis.

I also would like a way to run this for all tables at once (ideally in combination with org-babel-tangle). I'll ask another Q for that if you want the points :)


texts: How to lazy load init files to speedup Emacs startup?

texts:
My ~/.emacs.d/init.el file looks like this:

(package-initialize)

(require 'init-my-emacs-settings)
(require 'init-my-emacs-performance)
(require 'init-my-emacs-font)
(require 'init-my-emacs-color-theme)
(require 'init-my-emacs-appearance)

(require 'init-my-tool-calendar)
(require 'init-my-tool-dictionary)
(require 'init-my-tool-clock)
(require 'init-my-tool-speak)

(require 'init-my-prog-programming)
(require 'init-my-prog-license)
(require 'init-my-prog-code)
(require 'init-my-prog-comment)

;;; Programming Languages
(require 'init-my-prog-lang-lisp)
(require 'init-my-prog-lang-emacs-lisp)
(require 'init-my-prog-lang-common-lisp)
(require 'init-my-prog-lang-clojure)
(require 'init-my-prog-lang-ruby)
(require 'init-my-prog-lang-python)

I hope to load them only when needed. If for init files like
init-my-emacs-settings can’t be lazy load. Then I hope lazy load for programming
languages init files like init-my-prog-lang-lisp.

Here is my simple idea to load programming language init files only when load major-mode hook.

;;; TODO: convert code into an macro.

(defvar init-my-prog-lang-lisp-loaded nil)
(add-hook 'lisp-mode-hook
          (lambda ()
            (unless init-my-prog-lang-lisp-loaded
              (require 'init-my-prog-lang-lisp)
              (setq init-my-prog-lang-lisp-loaded t))
            ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun symbol-concat (symbol string)
  (intern (concat (symbol-name symbol) string)))

;; (type-of (symbol-concat 'ruby-mode-hook "-p"))

(defmacro my-lazy-load-init-file (init-file mode)
  "Lazy load my `INIT-FILE' only when `MODE' loaded."
  (let ((state (symbol-concat init-file "-loaded")))
    ;; state variable
    (defvar state nil)
    ;; load on major-mode hook
    (add-hook (symbol-concat mode "-hook")
              (lambda ()
                (unless state
                  (require init-file)
                  (setq state t)
                  )))
    )
  )

My questions:
- how to improve this macro?
- Do you have better solution? If have, please show me. Thanks


texts: Debug org-mode link to PDF displayed with PDF-Tools

texts:
Emacs 24.5 on openSuse Tumbleweed. *.org file with a link to a pdf:

[[.\somefile.pdf::2][myfile p 2]]

I'm using the PDF Tools to display a PDF in Emacs. What I expect is that page 2 of the PDF will be shown. But it always opens on page 1.

I have no idea, what could be wrong. I asked on the orgmode-mailinglist, as well as the maintainer of org-pdfview.el -- without any success.

Unfortunately I'm lacking of lisp skills. How could I debug e.g. org-pdfview.el and find out, why it does not provide a pagenumber to PDF-Tools?

I open org-pdfview.el, M-x eval-buffer, point the cursor inside a function and "instrument" it: C-u S-M-C-x. But how can I change to an org-mode buffer containing a link like given above? If I just change the buffer and open a link C-c C-o, I never get any reaction inside the buffer of org-pdfview.el.

Well, I ran out of ideas.

Edit:

In my .emacs there are these commands:

(eval-after-load 'org '(require 'org-pdfview))
(delete '("\\.pdf\\'" . default) org-file-apps)
(add-to-list 'org-file-apps '("\\.pdf\\'" . org-pdfview-open))
(add-to-list 'org-file-apps '("\\.pdf::\\([[:digit:]]+\\)\\'" . org-pdfview-open))


texts: Change the syntax highlighting when exporting to HTML

texts:
I am using Org mode to write some tutorials for myself on a topic where I weave the explanation and code samples into the same document. This document will then be exported to HTML to distribute to some colleagues.

Currently, I am able to export my org file to HTML and get syntax highlighting for code snippets. However, I don't like the default syntax highlighting provided in the exported HTML file. The background is white, the string color is a pale pink which tends to be indistinguishable from the white background.

How can I change this color scheme? I would like to have a scheme similar to the one used on, say, this page.

Note that I want the syntax highlighting customized in the exported HTML and not inside an Emacs buffer itself which I am perfectly happy with,.


texts: emacs-pinentry not working on emacs 28.0.50 and Ubuntu 20.04?

texts:
Emacs-pinentry is not working for me on emacs 28.0.50 and Ubuntu 20.04, and I wonder why. I follow these steps:

In /home/user, do git clone https://github.com/ecraven/pinentry-emacs.git
Following the answer here, I put this in ~/.gnupg/gpg-agent.conf:

allow-emacs-pinentry
allow-loopback-pinentry

Tell gpg-agent to load this configuration with gpgconf in a shell: gpgconf --reload gpg-agent
In Emacs' init.el I write:

(use-package pinentry
    :config
    (setq epa-pinentry-mode 'loopback)
    (pinentry-start))

Following advice here, I also include in my emacs dotfiles:

(defun pinentry-emacs (desc prompt ok error)
  (let ((str (read-passwd (concat (replace-regexp-in-string "%22" "\"" (replace-regexp-in-string "%0A" "\n" desc)) prompt ": "))))
    str))

The author of emacs-pinentry also says to set GPG_AGENT_INFO correctly inside Emacs, but I don't know what that means.
Maybe that's the missing bit for my setup to work. Thought I think to remember that on one or two occassions I did enter successfully the password for decrypting some entry in .password-store with pass. But on those occassions I entered the password blindly, without any prompt or feedback on the minibuffer. I kinda tried my luck and it worked. However, my expectation was to have a prompt on the minibuffer and some indication that I am typing, such as a string of stars.


texts: Variable assignment for programming modes not working

texts:
I want to set the variable truncate-lines to t in order to have truncated lines, but only in programming modes. So, following this thread, I put the following code in my configuration file:

(defun my-prog-mode-hook ()
  (setq truncate-lines t))
(add-hook 'prog-mode-hook #'my-prog-mode-hook)

My problem is this does not work, because truncate-lines is still nil when I start Emacs in fortran-mode (for example). The lambda version of the above code gives the same result.

What am I missing?


texts: How to append string that get's updated to mode line?

texts:
I would like to append some information (that changes over time) to the mode line format and then use it in the title.

My thought being is that once a minute I would set the frame-title-format to be that of the mode-line-format + pomodoro count.

Something along the lines of:

(defun runOnceAMinute ()
   (setq frame-title-format (concat mode-line-format my/PomodoroCount))
)

But I can't quite figure out how.

EDIT
I would need to update the string that I append. E.g the pomodoro-count would increment after each pomodoro.

EDIT 2
I got it to work by editing mode-line-format variable and using the eval construct:

("%e" ......... "[Pomodorors: " (:eval (number-to-string my/pomCount)) "]")

This is not Drew's original answer, but Drew mentioned it in his comment.


texts: How to exit emacsclient when C-x C-c doesn't work

texts:
I've been using emacsclient for a good while now, and in the past I've always used C-x C-c out of habit. This has never been a problem when using emacsclient -t as my terminal EDITOR for entering git commit messages, for instance.

I'm not sure what's changed, but now when I do, say, git commit, enter a message, save, and then C-x C-c like usual, it now complains

  Don’t kill this buffer. Instead cancel using C-c C-k

But, when I use the suggested combination, it exits with status code 1 and git aborts the commit.

I really genuinely do want to kill this buffer and exit normally, so I'm a bit at a loss how to where this message is coming from, and how to fix it.

Update: Using C-c C-c does work, but I'd still like to use the usual key combo as the manual suggests I should be able to do. Is there a way to conditionally rebind C-x C-c to (with-editor-finish), but only within client sessions?

I'm also still curious about what caused this to start behaving differently from how it has in the past.


texts: Remove surrounding markup when prettifying symbols

texts: Is there any way to get Emacs to hide surrounding markup when prettifying? That's a feature I really miss from Vim.  For example, when editing LaTeX in Vim, the conceal feature can be made to replace not just a string with an associated character, but also hide the surrounding math markup: $\rightarrow$ gets rendered as just a plain arrow (no dollar signs).  Is this possible in Emacs?


texts: Can emacs beautify existing tcl source code?

texts:
I'm just getting started with tcl; what sort of beautifier, or prettifier, or formatter, is there for tcl with emacs?

My main interest would be to fix existing scripts so that particularly the indenting is consistent and the braces, brackets and parenthesis line up nicely.

It doesn't have to be perfect.  Perhaps it's the nature of tcl that this is more difficult than for Java?


texts: Text properties overriden in org-agenda header

texts:
I do load a sexp entry - as a diary- from one of my agenda files which calls a custom function. Everything works fine except that the propertized text using utf glyphs is overriden in the agenda view as org-agenda-calendar-sexp.
The entry in the org file looks like:
* Data for a given day
     :PROPERTIES:
     :CATEGORY: data
     :END:

%%(myFunction)

Where myFunction returns a string made out of a data concatenation gathered from several weather forecast network places, which, simplified, looks like this:
(concat "test line :\t"
        #("\uf055" 0 1 (font-lock-face (:family "Weather Icons" :height 1.2 ))))

Once the agenda is built, the line is there with correct data but:
What I expect is having the line with the glyph displayed using Weather Icon font family, as it does in any other buffer using font-lock if I insert that string.
What I get is the same line using my system default unicode font family for \uf055 glyph, as org-agenda-calendar-sexp face.
Question is
How I can keep the properties I've set first?
Alternatively, where can I find %%() implementation?.
Related relevant questions which I've read before asking:

Why does insert not insert colorized text?

Propertize org-agenda-overriding-header
accepted answer's section two may work, but I'd rather give up using propertized text before using such convoluted approach for a small thing like this.


texts: How does one set input-decode-map on GUI frames in emacsclient?

texts:
I'm trying to adjust bindings in input-decode-map (to distinguish C-m and RET in GUI mode).  None of the advice given on Stack Overflow, gnu.emacs.help, Reddit, or Super User seems to work.  I ended up with this:

(defun ~/setup-C-m (&rest args)
  (define-key input-decode-map [?\C-m] [C-m]))

(~/setup-C-m)
(add-hook 'tty-setup-hook #'~/setup-C-m)
(add-hook 'window-setup-hook #'~/setup-C-m)
(add-hook 'terminal-init-xterm-hook #'~/setup-C-m)
(add-hook 'after-make-frame-functions #'~/setup-C-m)

Even with all these, starting Emacs with emacsclient --alternate-editor="" --create-frame --frame-parameters="((fullscreen . maximized))" results in input-decode-map being set to this:

Value:
(keymap
 (27 keymap
     (C-backspace)
     (C-delete))
 (C-M-backspace)
 (C-M-delete)
 (M-backspace)
 (M-delete))

Which doesn't include the C-m binding.  I've printed the value of input-decode-map when my setup-C-m function is called, and it's always an empty keymap.

How can I ensure that my setup-C-m function runs every time I create a frame and properly sets input-decode-map?


texts: Specifying location of Flow binary to Flycheck Flow checker

texts:
For reasons related to work, the Flow binary isn't available globally on my system and can only be found in a project repository's node_modules/.bin directory.
It turns out that flycheck-flow checker seems to assume that the flow binary is always global on the system and refuses to run (disables itself as reported by C-c ! v) since it cannot find the binary on my system.
I looked in the flycheck-flow.el source file and could not find a variable I could customize, and ended up replacing the default checker definition in my Emacs initialization file as follows:
(flycheck-define-checker javascript-flow
    "A JavaScript syntax and style checker using Flow.

See URL `http://flowtype.org/'."
    :command (
              "/path/to/node_modules/.bin/flow"  ; Customization here
              "check-contents"
              (eval flycheck-javascript-flow-args)
              "--json"
              "--from" "emacs"
              "--color=never"
              source-original)
    :standard-input t
    :predicate flycheck-flow--predicate
    :error-parser flycheck-flow--parse-json
    ;; js3-mode doesn't support jsx
    :modes (js-mode js-jsx-mode js2-mode js2-jsx-mode js3-mode web-mode rjsx-mode))

Is there a better way of setting up Flycheck Flow correctly?


texts: Rebind TAB to show help in counsel minibuffer

texts:
I'm in the process of migrating from helm to ivy/counsel, and I would like to replicate a binding that I had in my previous setup.

When browsing the results minibuffer (for example in counsel-M-x), I would like to have the help for the current result displayed when pressing TAB. To get help currently I need to do M-o h. Since this is an ivy action, I'm not sure how to add a key binding to just TAB.


texts:
Is these a function that behaves like file-truename on local files, but does not add the /protocol:host: prefix on remote files?
Currently if I run

(file-truename "./file.ext")

while in a remote directory, I get "/ssh:host:/remote/path/file.ext". but
I just want  "/remote/path/file.ext"

The reason that I am asking is that pdf export in org-mode does not work on remote file for me. I have tracked the problem down to the call
(org-latex-compile "./myfile.org")
which uses file-truename to produce the actual file name that is supplied to the latex shell call. This causes problems on remote files because the tramp prefix is included in the shell call. I would like to write a patch for this.


texts: Modifying entry display in org-agenda-log-mode agenda view

texts: The day view of my org-agenda in org-agenda-log-mode shows the estimated effort for each entry (e.g., the 1:00, the 0:05, the 0:45, etc)---I'd like to remove that if possible. Is there any way to edit what columns are shown in the log mode?


texts: Info manuals from packages not showing up in info

texts:
I was just fooled by an old org info file that was hanging around in my info dir.  I assumed that when I call

(use-package wanderlust
  :ensure t)

That the current info file would be installed automatically.

The following from the elisp manual would indicate that this is so:

  If the content directory contains a file named ‘dir’, this is assumed
  to be an Info directory file made with ‘install-info’.  *Note Invoking
  install-info: (texinfo)Invoking install-info.  The relevant Info files
  should also be present in the content directory.  In this case, Emacs
  will automatically add the content directory to ‘Info-directory-list’
  when the package is activated.

Yet, they do not show up.  Is there something else to do in my init.el file to make this work?

Regards,


texts: How to show all unchecked checkboxes in the agenda

texts:
Assume I have some org-files that contain content like the following:
* some tasks [1/3]
Some content / comments.
- [ ] a task
more comments.
- [X] another task
even more comments / prose
- [ ] a final task

I'm looking for a way to perform something like org-todo-list, where the result looks like:
 somefile: TODO some tasks [1/3]
   - [ ] a task
   - [ ] a final task

otherfile: TODO other stuff to do
...

Is there a way to accomplish this, so that the only content shown with a TODO headline is the un-checked checkboxes from the headline's body?  I'd also be OK with a solution that includes both checked and unchecked, but no other content.


texts: Commas don't work with Org formatting (regarding Pandoc)

texts:
When exporting an Org document to ConTeXt using Pandoc, I noticed the following.

( [org code] → PDF output )

  *bold* → bold  *bold,* → *bold,*

  /italics/ → italics  /italics,/ → /italics,/

  ~code~ → code ~code,~ → ~code,~

Note that, in each case, a final comma breaks the formatting.

Is there some way of coercing the formatting into working?

(Perhaps similar to this hack for Markdown regarding code blocks and lists?)

  This question seems concerned with the Emacs syntax highlighting, and so the fix is made from within Emacs; I'm using Pandoc to export the Org document to ConTeXt – so I can make finer typographical adjustments. Therefore changing Emacs' settings won't work.


texts: Do I have to rename my org-mode load-path folder after every update?

texts:
I use package manager to update my packages automatically by doing package-list-packages, package-menu-mark-upgrades, package-menu-execute. (I assume this is the easiest way to automatically update all my packages, though I don't really know.)

When I do this, org-mode winds up in a directory with a path like this:

~/Dropbox/emacs/prelude/elpa/org-20150511/

I use packages that are part of contrib, so my .emacs includes these lines:

(add-to-list 'load-path "~/Dropbox/emacs/prelude/elpa/org-20150511/lisp" load-path)
(add-to-list 'load-path "~/Dropbox/emacs/prelude/elpa/org-20150511/contrib" load-path)
(add-to-list 'load-path "~/Dropbox/emacs/prelude/elpa/org-20150511/contrib/lisp" load-path)

Since the org directory is named according to the date of the release, this means I have to either:
1. edit the directory name in the load paths
2. rename the org folder

Is there a way to get org-mode to find the contrib directories automatically when I upgrade org?


texts: Disable clickable links for misspelled words (flyspell)

texts:
Is there a way to disable the way flyspell converts misspelled words into clickable links, as well as the background colour (pink, at least for my colour theme) it uses?

I find it confusing and unnecessary.

See here:


texts: Before first headline at position XX in buffer - Unable to update org-clock-table

texts:
I'm using emacs on Windows 7.
I have this file called temp.org, where I log all my project information.
I have clock entries project wise and I also had the clock table report. After the update that happened today (7-Sep-2017), I'm unable to update the clock table report using C-c C-c.

This is the message that is being displayed when I press C-c C-x C-r

  Before first headline at position 79 in buffer temp.org

I don't know what is wrong as I have not changed anything myself. In my .emacs file I had the following entry - but I commented it out to see if that was causing the problem.

;; Display the org clock sum in terms of hours and not in units of days
;;(setq org-time-clocksum-format (quote (:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)))

As expected that did not solve the problem.
This is my .emacs file for reference.

This is how it looked before

#+BEGIN: clocktable :maxlevel 4 :scope subtree
#+CAPTION: Clock summary at [2017-09-06 Wed 19:52]
| Headline                                    | Time     |        |       |       |
|---------------------------------------------+----------+--------+-------+-------|
| *Total time*                                | *447:58* |        |       |       |
|---------------------------------------------+----------+--------+-------+-------|
| Projects                                    | 447:58   |        |       |       |
| \_  D301 Cycle time reduction               |          |  37:09 |       |       |
| \_    Overview - KOM                        |          |        |  1:37 |       |
| \_    PCSD Development                      |          |        | 10:17 |       |
| \_      C_Add_ALARMS_AT [0/1]               |          |        |       | 10:17 |
| \_    Control coding                        |          |        | 25:15 |       |
| \_  FMTO - MRU for Propylene Loading...     |          | 172:19 |       |       |
| \_    IFDS & DI/DO Mismatch alarms          |          |        | 35:17 |       |
| \_    Alarms, DO & AO [0/12]                |          |        | 56:09 |       |
| \_    Simulation & Code check out           |          |        | 80:53 |       |
| \_      Line up checks                      |          |        |       | 39:26 |
| \_      Sim code checkout sheet             |          |        |       | 20:06 |
| \_  IP21 graphics update                    |          |  30:00 |       |       |
| \_    KR-26/27 OFCC + OXF + Staged Temp...  |          |        | 30:00 |       |
| \_  MET-2 Loss of Cooling implementation... |          |  10:42 |       |       |
| \_    General information:                  |          |        | 10:42 |       |
| \_  B-6610 Quat 188 LOPA Gap Closure        |          |  24:43 |       |       |
| \_  Poly 3 Project                          |          |  25:51 |       |       |
| \_  PBG-MEI Expansion Code -...             |          |  16:14 |       |       |
| \_  DCG Exception report                    |          |  37:28 |       |       |
| \_  EDC V800A/B Project                     |          |  45:30 |       |       |
| \_  B4 project                              |          |  25:22 |       |       |
| \_  Waterbatch Work Project                 |          |  19:48 |       |       |
| \_  MOD Sample project - Tic-Tac-Toe        |          |   2:52 |       |       |
| \_    Charter - Overall idea                |          |        |  1:12 |       |
| \_    PCSD Development                      |          |        |  1:40 |       |
#+END:

When I pressed C-c C-c, the table was gone and I got message mentioned above.


texts: Any way to make prompts and previous-output uneditable in shell/term-mode?

texts:
This is admittedly a superficial question.

Although ansi-term starts out behaving correctly when I first open it, it seems to degrade into an 'editable' mode after a few commands, e.g., when I do C-a (start of line) followed by C-k (kill line), it wipes out the whole prompt.

For my aesthetic sanity, is there any way to make the prompts and previous output uneditable (for shell)?  (Updated to exclude ansi-term given the meaningful differences.)

I'm using zsh in Emacs 24.4; OS is LXDE (Ubuntu 14.04) via Virtual Box.

(Ideally I'd still be able to move my cursor around...)


texts: How to reference source blocks in org text

texts:
I want to create source blocks (in any language including LaTeX), then refer to these in the text using internal links, with descriptions as shown below. This similar post is not working for me.

I have easily been able to created many source blocks using the common structure, for example:

#+BEGIN_SRC python
  for i in 1:10:
      print i
#+END_SRC

Then I added names to the blocks because I want to talk about them with internal links. Id did this by adding #+NAME:, and so have this:

#+NAME: some-source-code
#+BEGIN_SRC python
  for i in 1:10:
      print i
#+END_SRC

So the text block is somewhere within an org file (the same one in my case) and I want to insert a link to that code block above using C-c C-l. I have tried this with and without a description, so ending up with both:

[[some-source-code][my description]]

and

[[some-source-code]]

but neither are recognised in the exported PDF file. I simply get a pair of question marks in the PDF file and in the *Org PDF LaTeX output buffer* there is just a message stating:

  Hyper reference some-source-code on page 6 undefined on input line 182.

Within the org-file itself, the links are shown and if I click on them I am taken to the code block as expected.

In the babel documentation for such source blocks there was an unfinished-looking sentence regarding the  (which I assume to mean the name I provde for a source block), saying:

  The name can be 20 characters long, and contain…XXX

Are there actually rules regarding the #+NAME: <label>?

Should I be including a specific #+LaTeX_HEADER in the org-file??

I am able to create links to websites using C-c C-l, with a description - and this is exported as expected to PDF.

I have org-version 8.2.10, emacs version 24.5.


texts: Quoting selected text using email conventions?

texts:
Is there any existing elisp function which will quote any selected text using email quoting conventions?

For example, suppose the following text appears in a buffer ...

This is some text that
I want to quote, using
email quoting conventions.

And this is a bit more text
which I also want to be quoted
in the same manner.

I'd like to select this text and run some sort of function which will cause it to appear as follows:

> This is some text that
> I want to quote, using
> email quoting conventions.
>
> And this is a bit more text
> which I also want to be quoted
> in the same manner.

Furthermore, if I select this quoted text and run that same function on it again, I'd like the result to look like this:

>> This is some text that
>> I want to quote, using
>> email quoting conventions.
>>
>> And this is a bit more text
>> which I also want to be quoted
>> in the same manner.

In other words, I don't want any space to appear between the leading > characters in the multiply quoted text.

Are there any existing elisp functions which will do this?


texts: CC-Mode - Javadoc Comment Colors in C/C++

texts:
I've been fiddling around a bit with CC-mode lately and figured that since I prefer to comment my functions/classes with javadoc-like syntax, I'd like to use the built-in comment highlighting provided by the corresponding c-doc-comment-style. This works rather well, it highlights something like this rather easily:

/** @brief This is function foo.
    @param a this is a parameter.
    @return I return this.
*/
int foo(unsigned a) {...}

However, I noticed that the comment suddenly changed color as well to a default one I don't really like. Any idea how to change that color back to the one defined by the current theme instead?


texts: I am trying to use tufte-book document class in org-mode. But for some reason, org-mode doesn't let me use it and says it is unrecognized. So I am going to the resulting .tex file and manually changing article to tufte-book. But doing this everytime got worrysome. So I want a way to make org-mode recognize tufte-book. I looked for the manual and found something about org-article class but couldn't make much sense out of it for my own problem.


texts: How to wait while evaluating an expression with emacsclient?

texts:
I use emacsclient regularly to open files. In order to open files owned by root, it is necessary to use tramp. As far as I know this requires the use of the eval option of emacsclient.

emacsclient --eval '(find-file "/sudo::/etc/motd")'

But this command behaves as if I specify the option no-wait, because the evaluation returns after the file has been opened.

Which expression needs to be evaluated in order to wait till the file has been closed?


texts: How to run a command in Emacs (rvm-use) against all current and future buffers?

texts:
I am very new to Emacs. In my case what I'm actually using is Spacemacs.

I have few versions of Ruby installed in my system and I use RVM for switching between them.

I'm trying to change current version of Ruby when working on some project by pressing M-x and entering command rvm-use and then selecting the version I need, but it only changes Ruby version for the current buffer and when I open a new file of the same project I can see that Ruby version is back to previous one.

Is there any way to persist the setting for whole Emacs session (or persist it for all files in the current directory) so it only gets reset when I restart Emacs (or when I change current directory)?
I don't actually know if it's something specific to rvm.el or Emacs, but I can't find a way to achieve what I want.

Now the only way for me to achieve that is to run rvm *needed_version* --default in the shell, but that changes the version for whole operating system, and I would prefer to limit the effect to Emacs only.
When working in OS X terminal I can just run rvm *needed_version* and it changes rvm version for whole terminal session but without affecting other sessions, but I can't find a way to achieve the same in Emacs.


texts: Return key when Emacs running inside a terminal

texts:
I have re-assigned the RETURN key to exit the insert state in Evil mode.

(define-key evil-insert-state-map [return] 'evil-normal-state)

But this does't work with emacs -nw in terminal. Any way to make it work?


texts: Debugging slowness in init file (not hostname related)

texts:
I am seeing some slowness in my init file loading:

$ time emacs --debug-init -eval '(kill-emacs)' -Q

real    0m0.672s
user    0m0.338s
sys     0m0.057s

$ time emacs --debug-init --eval '(kill-emacs)'

real    4m17.821s
user    0m2.769s
sys     0m0.226s

These 4mins of loading is reproducible. Actually looks like a timeout. It happens when I do (require 'magit). But I don't think it's related to magit because (require 'helm-gtags) causes the same slowness.

However --debug-init is not activated when I press C-g during the time emacs is unresponsive. Obviously is not activated either after the load finishes because there's no error.

I am wondering how I can understand where the slowness comes from. I guess a backtrace at the point of slowness would be nice. Maybe some tracing facility?


texts:
I've installed reveal.js and org-reveal, and they are working as expected. Even, I'm getting the equations!

However, the point with the equations is the following: If I introduce directly the LaTeX code

\begin{equation*}
  E  = \frac{1}{2} \sum_{a \neq b} \frac{e_a e_b}{r_{ab}}
\end{equation*}

equations are shown in the exported reveal presentation, but if I use the LaTeX export

#+BEGIN_EXPORT latex
\begin{equation*}
  E  = \frac{1}{2} \sum_{a \neq b} \frac{e_a e_b}{r_{ab}}
\end{equation*}
#+END_EXPORT

the equations are not shown!!!

Why do I want to use the export block?

Because I can treat the block as native LaTeX, and use yasnippets or LaTeX shortcuts...

Question: What should I do to change this behaviour?

Alternative question: What should I do to load the LaTeX yasnipets together with those of org?


texts: I'm interested in naming Emacs buffers. In particular I'd like to give names to shell buffers that I've started. That way I can easily tell them apart when switching buffers.


texts:
I want to build a helm-source from a large hash-table, is there a smarter/faster way to to this, than the way described below?

(setq tab #s(hash-table
             size 16
             test equal
             data ("asdf"  "asdf"
                   "zxcv"  "zxcv"
                   "qwert"  "qwert")))

(setq l '(("asdf" . "asdf")
          ("zxcv" . "zxcv")
          ("qwert" . "qwert")))

;;; works as expected
(helm :sources (helm-build-sync-source "test"
                 :candidates l
                 :fuzzy-match t
                 :action (lambda (candidate) (insert candidate)))
      :buffer "*helm test*")

;;; does not work
(helm :sources (helm-build-sync-source "test"
                 :candidates tab
                 :fuzzy-match t
                 :action (lambda (candidate) (insert candidate)))
      :buffer "*helm test*")

I can build a function that transforms the hash-table:

(defun hash-to-alist (hash)
  (let (res)
    (maphash (lambda (key value)
               (push `(,key . ,value) res))
             hash)
    res))

(helm :sources (helm-build-sync-source "test"
                 :candidates (hash-to-alist tab)
                 :fuzzy-match t
                 :action (lambda (candidate) (insert candidate)))
      :buffer "*helm test*")


texts: Org-mode :results file hook to launch file

texts:
My scenario

python code creating a wav file
last line of code returns the written file name
org-mode src block with the option :results file

The result block correctly links to the audio file, and I can easily click it and play it.

My question is if it would be possible to add a hook, and if the resulted file has a .wav extension to automatically launch it (and will be opened by the OS default audio player)

Or could be more generic: if you can have a hook like org-babel-after-execute-hook but having access to the result if it's a file or not, the filename, or the contents etc..


texts: auto-complete Key binding doesn't work in one emacs mode

texts:
I have changed the keybindings for yasnippet and autocomplete so that I can use tab for indentation anywhere in a line without accidentally autocompleting or inserting a snippet.

I have this in my init.el

(package-initialize)

(require 'auto-complete-config)
(ac-config-default)
(define-key ac-mode-map (kbd "TAB") nil)
(define-key ac-completing-map (kbd "TAB") nil)
(define-key ac-completing-map [tab] nil)

(ac-set-trigger-key "`") ;; sets the auto-complete key

(require 'yasnippet)
(yas/initialize)
(yas/load-directory
  (dot-emacs "elpa/yasnippet/snippets"))

;; Remove Yasnippet's default tab key binding
(define-key yas-minor-mode-map (kbd "<tab>") nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
;; Set Yasnippet's key binding to shift+tab
(define-key yas-minor-mode-map (kbd "§") 'yas-expand)

This works for most emacs modes, however when I use one particular mode (vhdl-mode) the yasnippet key bind § works as expected but ` does not work for auto-complete and it resets to the default tab key for autocomplete.

This means when I go through my code using tab to indent or un-indent parts of it random words are auto-completed.


texts: `auth-source-search` returns nil for valid queries

texts:
In trying to debug auth failures from something that should be getting its auth info from auth-sources, I noticed an extremely weird thing: auth-source-search frequently returns nil for valid queries -- queries that in fact work elsewhere in the code.

For instance: I have these two lines in my .authinfo.gpg:

machine gmail.com login gastove password mypassword port xmpp
machine dev.urbanairship.com login gastove password myotherpassword

This:

(auth-source-search :host "dev.urbanairship.com")

Returns the very normal, expected:

((:host "dev.urbanairship.com" :user "gastove" :secret (lambda (&rest --cl-rest--) (apply ... ... ... --cl-rest--))))

But this:

(auth-source-search :host "gmail.com")

Returns the totally imponderable: nil. This makes even less sense because that line provide auth info to jabber.el, which is working normally. I've even confirmed jabber.el is reading my .authinfo.gpg by deleting that line. It's not like it's just the host -- a search for :user "gastove", for instance, only returns the second line, not the first.

So uh. What's going on? Any ideas?


texts:
While trying to figure out another problem. I was advised to use the ivy-hydra package.

By default, it appears that ivy-hydra is NOT included with prelude-ivy. So I did a package-install ret ivy-hydra.

That seemed to install it, but then when I do a C-o I get a message saying

symbol's value as variable is void: ivy-preferred-re-builders

I have no idea how to move forward to resolve this. I guess it is something about regular expression builders? How does one correctly install ivy-hydra when working from a prelude-ivy install?


texts: How to play back an edit session in emacs?

texts:
The book Clean code says emacs can play back an edit session (page 13):

You could work for an hour and then play back your whole edit session like a high-speed movie. When I did this, the results were fascinating.
The vast majority of the playback was scrolling and navigating to other modules!

Bob enters the module.
He scrolls down to the function needing change.
He pauses, considering his options.
Oh, he’s scrolling up to the top of the module to check the initialization of a variable. Now he scrolls back down and begins to type.

I want to do play back my own edit session, but I didn't find a way to accomplish this through googling. Can someone help me? Thanks a lot!


texts:
Are there any tools for making UI-based or email-based DEADLINE notifications in org-mode?

It'd be nice to convert org-mode's pull-based DEADLINE access (via C-c a a) into a push-based system :)


texts: Emacs installation does not initialise after updating packages

texts:
What should I do? After just updating packages my Emacs installation does not initialise. I tried the same process in two Macs with the same result. The error message (using --debug-init) is:

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


texts: Loading new agenda keywords (org-todo-keywords) is broken for me - bug in Emacs?

texts:
Objective

I decided to add custom agenda keywords (I'm still setting up the environment, don't have any agenda files yet) and I used this example code from some tutorial:

(setq org-todo-keywords
      (quote ((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
              (sequence "WAITING(w)" "HOLD(h)" "|" "CANCELLED(c)" "PHONE" "MEETING"))))

I added this code at the end of my init file.

Expected behavior

The expected behavior is after adding this code to my init file I can M-x org-agenda, then t and see all my custom keywords available for selection:

Global list of TODO items of type: ALL
Press ‘N r’ (e.g. ‘0 r’) to search again: (0)[ALL] (1)TODO (2)NEXT (3)DONE (4)WAITING
                      (5)HOLD (6)CANCELLED (7)PHONE (8)MEETING

But I don't, at least not without some ugly hack I don't understand (see below).

The problem

When I start Emacs and run M-x org-agenda and select the 't' option I don't have those added keywords available for selection, I get an empty sequence of keywords:

Global list of TODO items of type: ALL
Press ‘N r’ (e.g. ‘0 r’) to search again: (0)[ALL]

However, if I instead did M-x org-agenda with the a option (for no apparent reason) and then did M-x org-agenda with the t option, I would properly see all the keywords. So in other words, I have to select a "agenda for current week or day" first and only if I do that I get to see my keywords if I do t "list of all TODO entries". Obviously this is very inconvenient to do.

Edit: (temporary workaround)

Now I've arrived at a simpler workaround by accident - even though I've seen an empty sequence of keywords, what I did was try to filter by ALL (0 r), which doesn't make a lot of sense since it's the default filtering mode, but it brought up my keywords on the screen for some reason. This isn't too convenient but works. So the keywords are there, just don't show up immediately. To verify this I restarted Emacs and before running M-x org-agenda I checked the contents of org-todo-keywords with C-h v, it shows the correct contents but they are only displayed when I do this dummy 0 r filtering, which I believe is a bug. So I consider the problem temporarily resolved (though with a slightly inconvenient workaround) but I will keep the question open for some time in case it's not a bug and I'm doing something wrong and someone can point it out.

Two other problems I had with org-todo-keywords

Now for completeness I include two similar weird behaviors with org-todo-keywords both of which magically resolved themselves so I'm not looking for help about them, I just write them here in case it is of any value.

It used to be the case that even though my (setq org-todo-keywords ... ) code was in my init file (at the end), it wouldn't work unless I manually selected it and run eval-region on it.
If I updated my sequence of org-todo-keywords, I wouldn't get the updated keywords list to work no matter what - it would still show the old list, as if it was cached. Nothing would help - running 'eval-region' on the new code, restarting Emacs, etc.


texts: how to sort describe-variable completion list by recency (or frequency)?

texts:
When I run describe-variable, then choose something, I often wind up looking at the same variable again later or next session. However, when I do describe-variable again, the helm list of variables that pops up is completely random, showing me variables I'll never use.

It would be much more useful to show me a list of my most recently described variables, as recentf does with files.

Is this possible? I use helm, and I see that helm-adaptive-mode is on. It would be great to make this work with other commands too, e.g. if load-theme would show me my most recently (or commonly) used themes instead of showing me a list of themes in random order.

Related, but didn't help me: Is there any way to order helm results by commonly used?


texts: Error running Emacs from a Terminal window: "Symbol's function definition is void: package-initialize"

texts:
After starting Emacs from a Terminal window, the following message is displayed:

An error has occurred while loading '/Users/EvanAad/.emacs':
Symbol's function definition is void: package-initialize
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.

Restarting Emacs with the --debug-init option displays the following in Emacs' Debugger buffer:

Debugger entered--Lisp error: (void-function package-initialize)
(package-initialize)   eval-buffer(#<buffer  *load*> nil
"/Users/evanaad/.emacs" nil t)  ; Reading$
load-with-code-conversion("/Users/evanaad/.emacs"
"/Users/evanaad/.emacs"$   load("~/.emacs" t t)   #[nil
"^H\205\276^@   \306=\203^Q^@\307^H\310Q\202A^@
\311=\2033^@\312\307\31$   command-line()   normal-top-level()

P.S. The reason why I want to start emacs from the command line is as an attempt to resolve this issue (see step #5 in the 'Attempted steps' section).

Operating system: macOS Sierra, Version 10.12.4
Emacs version: 25.1.1


texts: What's a good way to have a hook that runs for every file in a given directory?

texts:
What is a good way to assign a function to run when I open any file in a specified directory? Just like a hook but based on the location of a file rather than a major mode.

It would be nice if I could enable this by having a special file in the directory, but adding the hook in my central config file would be good too.


texts: Regular expression to ignore a domain in address completion

texts:
I read the manual on address autocompletion:

  mu4e-compose-complete-ignore-address-regexp — a regular expression to filter out other ‘junk’ e-mail addresses; defaults to "no-?reply".

I am looking for a regular expression that matches that no-?reply username, a username and a domain, and a domain.

My first try was:

(setq mu4e-compose-complete-ignore-address-regexp
      (concat "\\(?:no-?reply"
          "\\|.*first\\.last@domain\\.com"
          "\\|.*@other-domain\\.com"
          "\\)"))

The middle match works and I am not prompted for that email address. The last match fails and I still have hundreds of completions for that domain name.

What is a regular expression that ignores those three types of addresses?


texts: Is it possible suppress save message for undo-tree?

texts:
When I save my any file I am working on I always see following message, I believe this is related to my unto-tree configuration.
Wrote /home/alper/.emacs.d/undo/.!home!alper!current_folder!__init__.py.~undo-tree~

[Q] Is it possible suppress this message (saving undo-tree) somehow?
My config file:
(global-undo-tree-mode 1)
(setq undo-tree-auto-save-history t)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))

(defmacro with-suppressed-message (&rest body)
  "Suppress new messages temporarily in the echo area and the `*Messages*' buffer while BODY is evaluated."
  (declare (indent 0))
  (let ((message-log-max nil))
    `(with-temp-message (or (current-message) "") ,@body)))

(defun save-all ()
  (interactive)
  ;(save-some-buffers t)
  ;(recentf-save-list)
  (with-suppressed-message (save-some-buffers t))
  (message "")


texts: How to connect to Windows 10 OpenSSH over tramp?

texts:
I've installed OpenSSH on a Windows 10 machine, and can connect to it from the Linux command line with ssh or scp, giving the cmd.exe "shell". But tramp hangs on Waiting for prompts from remote shell:

Tramp: Opening connection for win using ssh...
Tramp: Sending command ‘exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none win’
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for win using ssh...failed

also with (setq tramp-use-ssh-controlmaster-options nil)

Tramp: Opening connection for win using ssh...
Tramp: Sending command ‘exec ssh    -e none win’
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for win using ssh...failed

Is there some special trick?

I've tried changing the Windows OpenSSH shell to bash, which makes regular ssh-ing and git cloning nicer, but doesn't seem to help tramp.

I've also tried both

 (setq explicit-shell-file-name "cmd"
       explicit-cmd-args '("/q"))

and

 (setq explicit-shell-file-name "powershell"
       explicit-powershell-args '("-file" "-"))

to no avail.


texts: Neotree window permanently resizes other windows

texts:
I usually have my emacs frame something like this:

|             |             |
| <window 1>  | <window 2>  |
|             |             |

When I open neotree, it then looks like this (N representing the neotree window):

|   |             |         |
| N |     W1      |   W2    |
|   |             |         |

Then, when I close neotree, the windows look like this:

|                 |         |
|         W1      |   W2    |
|                 |         |

This is aesthetically displeasing and brings window 2's width below 80 characters, so code lines wrap.

Is there a way I can make neotree-toggle reset the window sizes to their values in the first diagram?


texts: elisp: create window layout with specific cycling order

texts:
I'd like to create a window layout like so:

-----------|--------------
    a      |    b
-----------|--------------
    d      |    c
-----------|--------------

This is so that I can cycle from a -> b -> c -> d (clockwise). The following doesn't quite work.. the cycling order is a -> d -> b -> c

(progn
  (delete-other-windows)
  (split-window-right)
  (other-window 1)
  (split-window-below)
  (other-window -1)
  (split-window nil nil 'above))


texts: Disable enlarged org-mode header appearance

texts:
I am using org-mode on Macintosh GNU Emacs version 24.5.1 in GUI mode and the headers are enlarged. I would like to disable this feature so they rendered in the default font size.
I have tried this...
(with-eval-after-load "monokai-theme"
  (custom-theme-set-faces
    'monokai
    '(org-level-1 ((t (:weight semi-bold :height 1.0))))
    '(org-level-2 ((t (:weight semi-bold :height 1.0))))
    '(org-level-3 ((t (:weight semi-bold :height 1.0))))
    '(org-level-4 ((t (:weight semi-bold :height 1.0))))))

Though this clobbers the theme and the colors are no loner rendered.
Should I accomplish it a different way?


texts: How can I always expand abbrevs with prefixes?

texts:
How can I remove the need to use  M-' for abbrevs with a prefix?

From the manual:

  You may wish to expand an abbrev and attach a prefix to the expansion; for example, if cnst expands into construction, you might want to use it to enter reconstruction. It does not work to type recnst, because that is not necessarily a defined abbrev.  What you can do is use the command M-' (abbrev-prefix-mark) in between the prefix re and the abbrev cnst.

I would like to make cnst followed by a space always expand into ‘construction’, i.e. without typing M-' for recnst.


texts: Is it possible to disable aggressive indent mode per file extension?

texts: Would it be possible to disable aggressive indent package just for some file extensions?. I know it's possible to do it by major mode, but I use web-mode for js,html,php and others. And I just want to disable it for javascript.


texts: Interactively pass argument and use regex in find replace

texts:
I have written the following code
(defun krmet-replace()
  (interactive)
  (save-excursion
  (save-restriction
    ;; Narrow to the region
    (narrow-to-region
     (progn (search-forward "C %% MODULE %%")
            (line-beginning-position))
     (progn (search-forward "C %% END MODULE %%")
            (line-end-position)))

    ;; Find Replace
    (goto-char (point-min))
    (while (search-forward "KRMET" nil t)
      (replace-match "KR23" nil t))           ;; remove the hard coded replacement, use user input
    (goto-char (point-min))
    (while (search-forward "KR-MET" nil t)
      (replace-match "KR-23" nil t)))))       ;;;; remove the hard coded replacement, use user input

(global-set-key (kbd "C-c #") 'krmet-replace)

There are two things that I don not know how to do:

How to interactively pass a number, in this case it is "23". I want to replace KRMET with KR23. I   modified the code like shown below

(defun krmet-replace (r)
  (interactive "nRx # : ")

and used the r in replace match line like so
(replace-match (concat "KR" string(r)) nil t))

I get this error: replace-match: Symbol’s value as variable is void: string
Answer Edit:
I fixed the first problem like so using number-to-string function
    (goto-char (point-min))
    (while (search-forward "KRMET" nil t)
      (replace-match (concat "KR" (number-to-string r)) nil t))
    (goto-char (point-min))
    (while (search-forward "KR-MET" nil t)
      (replace-match (concat "KR-" (number-to-string r)) nil t)))))

How to replace string using regex? Like KRMET or KR-MET with KRnn or KR-nn where nn is the user provided number when running the function


texts: Is it possible to disable wrapping of inline HTML with  tags?

texts:
If I have the following line in an org-mode file

@@html:
@@

If I export to HTML, it becomes:

This applies the CSS I have for my <p tags around the
 tag, resulting in a lot of unwanted padding.

If I use the following:

#+begin_export html

#+end_export

I get the tag without the
 tags, but that's three lines of text just for a single tag.

For background, I'm trying to see if I can get tufte-css to work with org-mode's HTML export. The CSS requires headings to be wrapped in
 tags.


texts: Get revert-buffer to stop corrupting my files

texts:
I'm not sure how to completely reproduce this.  It may be related to this other question of mine. My hope is that someone else has seen this as well and knows what causes it.

Sometimes when editing an emacs buffer, generally for a Python file, the buffer is out of date (usually because it has changed from git checkouts in other terminal tabs). So when I try to edit the buffer, it tells me that the file is out of date and if I want to edit it or revert it. I choose revert.

What happens then is that instead of reverting the file, it gets corrupted. In particular, it seems to insert chunks of the original file in the wrong place. For instance, the first 20 or so lines will be inserted twice. This error persists (but often with slightly different results) if I manually run M-x revert-buffer.

Fortunately, I always keep my files under revision control, so I can usually detect and fix these issues, but it's pretty annoying, and there is potential for it to screw me over pretty hard or even cause me to lose data. Any suggestions on what might be causing this are welcome.


texts: Install EMMS and missing executable (emms-print-metadata)

texts:
Q: how do I populate the cache in EMMS?

I just did a fresh install from source of Emacs, and then got the
emms package from melpa.  When I go to populate the EMMS cache,
I get the following error message:

Error running timer ‘later-do-timer’: (file-missing "Searching for program" "No such file or directory" "emms-print-metadata")

I've gotten this message in the past, and it's always puzzled me.
What is this executable (emms-print-metadata), where do I get it, and how do I install
it?

I'm pretty sure I can get emms as a .deb package and install it
through my distro's package manager, but that's not the point.
I'd like to install EMMS through the Emacs package manager.


texts:
I'm using helm with projectile and trying to exclude various files from the output that are project specific (i.e with .projectile files, not globally variable). The problem is that it never works for me, e.g in my .emacs.d folder i have a .cask folder, so i'm adding the following line to the .projectile file:

-/.cask

This invalidates my projectile cache and everything is clean, but if i open any file under .cask directory, it's added to the cache and i can see the file in helm-projectile output. Maybe i understand the guide incorrectly, but adding -/.cask to the .projectile file i expect it to ignore any file under this project root path.


texts:
When I open the Emacs info reader, the top directory node is really cluttered.  It's difficult enough to navigate that it puts me off from using it.  There are a few things that I can't figure out how to do that would simplify my life a great deal:

Sorting by name. The entries seem to be sorted according to the order they are added, which means that an entry starting with Z comes before an entry starting with A if it is in a directory that comes earlier in Info-directory-list.  Can I change this so that I can browse in a sane manner?
Change fill column.  I understand there are complexities with hidden text, but the narrow fill column wastes a lot of vertical space.  I see Info-refill-paragraphs but this doesn't do what I expect (or anything at all that I can see).
Hide or reorganize entries.  I understand the headings are set in the actual info files on my machine, but is there a way to modify this without editing each file?  It's frustrating when I don't know if something will appear in "individual utilities" or "utilities" or "gnu utilities" or "network applications" or "basics" or "software development".


texts: org-mode header property to start cursor at header and start org-clock-in

texts:
It's possible to set :VISIBILITY: under a header to make it show at the startup of the file.

Does there exist a property to make the cursor start in a header too? How hard is it to write the elisp to amend a property function? I realise that there is a conceptual problem, since many headers could have a cursor property, but there is only one cursor, but I think I could accept strange behaviour / a warning message if I accidentally did that.

The main purpose of this is to speed up the time it takes me to jump into the work task I'm currently interested in, which is sometimes nested a few layers deep. I'd also be interested in a property that clocked me in on startup if no clock was hanging or running. A solution using the headers of the org file would also be an acceptable alternative.

Thank you,


texts: How to permanently save modified variable in emacs config?

texts:
I have list of words to capitalize automatically

(setq auto-capital-words '("Foo" "bar"))

I have one more function which adds word at point to this list.

(defun add-to-capital-words ()
  "Add words"
 )

Now when ever i add words, they will be saved only for that session. When i restart emacs they will be gone.

How do i save those values permanently in config, so that they will be updated on multiple systems also?


texts: Blacken installed but is giving the error that is isn't installed

texts: I am running Emasc 26.2 on Windows 10 and have installed black via pip and installed blacken via melpa but when I enable blacken-mode it doesn't change any of the formatting even when I intentionally mess it up and when trying to enable elpy-black-fix-code it gives the error of Elpy error: black not installed.Am I using it incorrectly? I have also tried blacken-buffer and I get Searching for program: No such file or directory, black. Any help is greatly appreciated.


texts: Show content of another file in org-column view

texts:
I want to have something like:

* The column view
:PROPERTIES:
:Other_file_content: file:<path-to-file/file.org>::*Heading
:END:

and then display in the column view in the current buffer the text that is under the heading "* Heading" in the file 'path-to-file/file.org'.

Is that possible?


texts:
I'm looking for a simple way to make emacs remember of declared variable in a single function in C/C++. By "simple", I mean without any external package, just with some elisp lines in configuration files.

My default Emacs configuration colors variables names in yellow on declaration, but let them white on use.

char toto; // 'char' is green, 'toto' is yellow

toto = 42; // 'toto' is white

I would like to make every "toto" of the same function/scope colored in yellow as well.

I've already looked on this question but I would like something simpler. I also tried to do something with font-lock mode, but I didn't succeed to make something adaptable to variable names.

I already have an idea for C++ class member names (using a name pattern), so I just want a local variable match here.


texts:
What is the difference between add-to-list vs add-hook?

For example I see in progmodes/make-mode.el:

(add-hook 'completion-at-point-functions
          #'makefile-completions-at-point nil t)

instead of add-to-list.

add-hook has interesting properties - it binds non-existing symbol! And it is convenient to use in .emacs  to avoid if/when boundp or (defvar ...).

Can I use add-hook instead of add-to-list in general? Or requirement to be a function for second argument of add-hook is mandatory?