texts: change default action of opening multiple files in dired

texts:
Having marked a bunch of files in dired-mode, if I wanted to open all them at once, I press F. But, the problem is, all the selected files opens in their own separate window and now i've at least as many windows as the files I marked in dired-mode.

Is it possible to change this behaviour to open only the window of the topmost file in dired listing (while also opening the rest of the selected files in dired-mode, but not opening each of them in a separate window)?


texts: Speed (timing) considerations in Emacs terminal emulators

texts:
I found emacs terminal emulator (M-x term) to be very convenient. However, it is essential for me to time certain portions of my code accurately (in order to compare speed of different algorithms fairly).

To make sure that my speed measurements are unaffected, I have tried comparing the speed of the code using regular Ubuntu terminal (whatever shows up when I type "Terminal") and emacs terminal emulator and they seemed to be pretty close. However, when I started outputting things on the screen in large amounts, the emacs terminal emulator seemed MUCH slower.

I'm an emacs newbie, so I was wondering if somebody could confirm if my observation is correct: Speed of the actual computations is unaffected by using emacs terminal emulator, while the printout to screen is slowed down. Perhaps, if you know of something else that could be slow on the emacs terminal emulator, advice would be much appreciated.


texts:
I would like to enable pabbrev automatically for .org files. At the moment, I have to manually run M-x pabbrev-mode on the buffer I'm editing.

My .emacs regarding pabbrev :

(require 'pabbrev)
;; TAB does not work without this in orgmode
(define-key pabbrev-mode-map [tab] 'pabbrev-expand-maybe)

Sorry for the noob question and thanks in advance !


texts: How to prevent LaTeX verbatim environments to be subject to LaTeX-fill-region

texts:
With LaTeX-verbatim-environments-local, it is possible to declare environments that AUCTeX should consider as verbatim ones.

\documentclass{article}
\begin{document}
\begin{myverbatimenv}
First verbatim line.
Second verbatim line.
\end{myverbatimenv}
\end{document}

% Local Variables:
% LaTeX-verbatim-environments-local: ("myverbatimenv")
% End:

The problem is, such environments are subject to LaTeX-fill-region (C-c C-q C-r). Hence, if the whole buffer is selected (C-x h) and is filled (C-c C-q C-r), the verbatim environment becomes:

\begin{myverbatimenv}
First verbatim line.  Second verbatim line.
\end{myverbatimenv}

whereas I would like:

\begin{myverbatimenv}
First verbatim line.
Second verbatim line.
\end{myverbatimenv}

How to prevent these LaTeX verbatim environments to be subject to LaTeX-fill-region?


texts: Using replace-regexp with a shell command

texts:
I'm trying to format some text that matches a regexp using an external shell command. I've been able to use C-u M-| successfully on a region, but I can't figure out how to do that within replace-regexp.

I've tried using \,(shell-command-on-region point-min point-max "python -m json.tool") as the second argument to replace-regexp, but I get Error evaluating replacement expression: (void-variable point-min).

Is there a way to use replace-regexp with shell-command-on-region?


texts: Closing emacsclient after quitting calc?

texts:
I'd like to run calc in an emacsclient in my terminal, and then have that particular emacsclient session close completely and return me to my shell when calc quits.

I've got the first part of that working with emacsclient -t --eval '(calc nil t)' but when I quit calc, the emacsclient session stays open and just displays another buffer.

I've also tried emacsclient -t --eval '(calc nil t)(delete frame)' but that behaves no differently.

Then I tried emacsclient -t --eval '(progn (calc nil t)(delete frame))' but though that does exit emacsclient, it does so too soon, before I've even had a chance to use calc.

How can I make emacs close that emacsclient session only after I use and deliberately quit calc?

Update: I wound up Marco Wahl's solution below, but I modified it slightly to delete the hook when it's called, because I only wanted the frame deleted when calc is called from the shell through emacsclient, but not when it's called at other times from inside emacs itself.

So now I do:  emacsclient -t -e '(progn (add-hook (quote calc-end-hook) (lambda () (setq calc-end-hook nil) (delete-frame)))(calc nil t))'


texts: How can I stop newlines from being entered in an editable-field widget?

texts:
I have the following widget:

(widget-create 'editable-field :size 76 :format "Title: %v")

However, when I create this widget and edit its value, I can use C-j to insert new lines.

How can I restrict the widget to one line?

Runnable code:

(defun widget-example ()
  (interactive)
  (switch-to-buffer "*Widget Example*")
  (kill-all-local-variables)
  (let ((inhibit-read-only t))
    (erase-buffer))
  (remove-overlays)

  (widget-create 'editable-field :size 76 :format "Title: %v")

  (use-local-map widget-keymap)
  (widget-setup))


texts: Multiple occurrences of variable in yasnippet snippet

texts:
I would like to do create a snippet in which the ${1:} command is present in multiple locations, allowing me to editing in multiple locations at once.

In particular I would like this snippet to work as "expected".

cout << "${1:} = " << ${1:} << "\n";

usage:

1) type cout

2) expand the snippet

3) type the name of the variable you want to print


texts: Dropdown Menus fail on mouse click with 'Wrong type argument'

texts:
Emacs 24.4 installed on OS X via homebrew: brew install --with-gnutls --cocoa

Dropdown menus work fine with <F10>:

But fail when clicked on with the mouse:

I have recompiled as many files as I can, and the problem persists. Some clues, if not an outright solution, would be great. Is something else eating the mouse clicks? Might Helm be interfering?

My base Emacs configuration is prelude, but I am about to remove all my configuration and revert to a vanilla setup to see if I can make the dropdowns work.


texts:
When using ReSharper in Visual Studio symbols can be auto-completed using fuzzy matching instead of prefix matching. For example if I'm looking for a function named DoSomethingAmazing I could write DoSoAm and it would try to expand my query to match all symbols containing Do, So and Am somewhere in their name.

Another example can be found in the below gif. You can see several expansions where non-prefix strings are expanded to the correct symbol. (Ignore the snippet expansion as in this question I'm only concerned with fuzzy matching).

Another example can be seen in the YouCompleteMe plugin for Vim:

Autocomplete and Company Mode both seem to have prefix matching but I can't find a way to enable fuzzy matching.

Ideally the solution would be language agnostic and apply to whatever symbol completion package I'm using but I'm also interested in language-specific solutions. I've looked at Helm but haven't found a way to apply it to code completion.

I have considered alternatives such as having a keybinding to activate symbol completion using a Helm buffer but I'm hoping there's a way to do this using popup-style completion.

I'm also open to doing manual configuration on a per-language basis since some languages separate symbols with dashes while others use underscores or dashes which I assume would affect how the matching would be done.


texts: Why does emacs add a tab to the current line when I use "expand abbreviation" feature?

texts:
Apologies if my question is silly, it's my first day
using abbrev expand.

I have an abbrev set up like this

"bm"           3    "bookmarks-acd1fe"

When I press bm tab, I end up with

bookmarks-acd1fe<tab character here>

I didn't want a tab character, why is it inserting tab?  ¯_(ツ)_/¯


texts: hideshowvis text shown in Org mode source code

texts:
I am using in Org-mode to document inherited Java code.
Here is shown an enum:

However, when I export to HTML, the document is rendered like this:

Which incorrectly shows a *hideshowvis* text.
I suspect something might be working wrong between hideshow minor mode and Org-mode.

Anyone has deal with this issue?
Regards.


texts: Running a function every time a character is inserted

texts:
I want to check its properties as soon as a Greek word has been
inserted into the buffer.  As far as I can see, this requires me to
check each time the buffer changes, whether, if a Greek word was being
typed, the last character was not a word character.  How might I do
this?  That is, how can I run a function every time a new character is
inserted into the buffer?


texts: Do something before window configuration change

texts:
AFAIK, window-configuration-change-hook applies after a configuration change, and there is no corresponding window-before-configuration-change-hook.

What's the best way to detect window configuration change before the change occurs?

Edit: use case:

centered-window-mode centers the window by hacking fringe widths. This can sometimes make the window too small to split. Ideally, we can detect window configuration changes like splitting and reset fringes to previous values to prevent such errors.


texts: How to use C header files in org-mode source code blocks?

texts:
I have a C code block in my org-mode document like the following:
#+begin_src C :exports both
#include "my_header.h"

int main(void)
{
    function_from_my_header();
    return 0;
}
#+end_src

When I have point inside the code block and C-c C-c to compile + generate results, I get the following error.
/var/folders/bc/2wq0dn651ys844kp5cz459mc0000gn/T/babel-SktA20/C-src-RnWgKS.c:8:10: fatal error: 'my_header.h' file not found
#include "my_header.h"
         ^~~~~~~~~~~~~
1 error generated.
zsh:1: permission denied: /var/folders/bc/2wq0dn651ys844kp5cz459mc0000gn/T/babel-SktA20/C-bin-DWq2ho

How do I get org-mode to recognize the header file (which is contained in the same directory as the org file?
It is worth noting: everything has worked fine so far if I don't have (custom) headers (e.g., includes for stdio.h etc. work fine). It is also worth noting that if I save the source code block to a file and compile using gcc, then the file compiles fine. Ergo, it seems the missing piece is determining how to get org-mode to recognize my_header.h, which lies in the same directory as the org file itself.

Edit: Solved
I did as NickD suggested but still got an error. To be precise, I have the three files

my_header.c

#include <stdio.h>
#include "my_header.h"

void my_function(void)
{
    printf("I can C clearly now.\n");
}

my_header.h (contains only the prototype for my_function.
my_test.c

#include "my_header.h"

int main(void)
{
    my_function();
    return 0;
}

When I compile and link from the command line (from within the directory in which these files reside), I run:
gcc my_test.c my_header.c -o my_test && ./my_test

Everything works perfectly.
Now, if I run the following code block from within an org-mode document (residing in the same directory):
#+begin_src C :flags -I .
#include "my_header.h"

int main(void)
{
    my_function();
    return 0;
}
#+end_src

I get the following error message from the compiler:
Undefined symbols for architecture x86_64:
  "_my_function", referenced from:
      _main in C-src-fboHG7-40f2c1.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
zsh:1: no such file or directory: /var/folders/bc/2wq0dn651ys844kp5cz459mc0000gn/T/babel-SktA20/C-bin-9wLHvS

The fix (in addition to setting :flags -I. was to also set :includes my_header.c
The following works perfectly for me when I C-c C-c in org:
#+begin_src C :flags -I . :includes my_header.c
int main(void)
{
    my_function();
    return 0;
}
#+end_src

Question summary
How do I get org-mode to recognize the header file (which is contained in the same directory as the org file?
You don't. You point it to the source file corresponding to the header (i.e., my_header.c) by include-ing my_header.c.
Why is this the expected behaviour? My understanding is that this flag creates an #include "my_header.c" line in the temporary .c file, and that this is not standard practice when writing C code (one usually includes the .h file).


texts: Emacs wrapping lines that are exactly 80 characters long in a 80x24 terminal

texts:
Using a 80xN terminal, I'm seeing that lines that are exactly 80 characters long are wrapped and the 80th character is shown on a separate line:

Is there some way to stop emacs from wrapping lines that are exactly 80 chars long? (Or rather, exactly $COLUMNS long?). And show them on one line while still wrapping lines that are > 80 chars long... After all, they do in fact fit on an $COLUMNS wide terminal.

A 2003 posting on help-gnu-emacs says:

  Also, prior to Emacs 21, Emacs wasted a column for the "\" character that's
  used to indicate that a line has wrapped (Emacs 21 replaced this with a
  marker closer to the window border).  So a line that's exactly the window's
  width would be wrapped -- the first n-1 characters would be on the line,
  then there would be a "\", and then the next line would contain the nth
  character.

Which describes my situation perfectly, except I'm running Emacs 24.4.1 according to (emacs-version).

(I'm investigating returning to Emacs after many years with Vim. And yes, I want to run Emacs in the terminal, as 99% of my development time I'm editing on remote servers)


texts: Stopping Neotree from constantly switching to the open file's directory?

texts:
I have the problem that, even when I'm in a projectile project, NeoTree always switches to the directory of the currently open file in the active buffer. Which is annoying to say the least.

It used to behave the right way, but (probably with a recent update?) that changed. How can I get the correct behaviour back?


texts: Connect open and close delimiters with a line

texts:
I wonder if emacs has something similar to this VSCode extension (Bracket Pair Colorizer 2) which does the following (screenshot below) which I find is a really helpful UI enhancement

[

In the above screenshot, you can see a yellow line that shows the matching parentheses, I know you can get rainbow parentheses but this isn't the same as the screenshot shown.
Does anyone know if this is possible within emacs and if there's a package to enable it? Or how to enable it?


texts:
I am trying to set up emacs to run as a server to avoid the time required to open individual sessions for each file. This is on OS X El Capitan. Using the instructions provided  here, I have the first item described, the emacs executable I presume, at the indicated location on my system:

/Applications/Emacs.app/Contents/MacOS/Emacs --daemon

However the second item described, the emacsclient, is not present (or visible) at the indicated location:

/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient -c $argv

Will I need to install emacsclient separately? I used homebrew to set up emacs originally on this system. Does this method not install emacsclient by default?


texts: Why does Emacs use C-a for moving to the beginning of a line (home)?

texts:
I am making a tutorial about Emacs and do not know how to explain the reason why C-a is chosen as the keyboard to move the cursor to the beginning of a line?

Everything with C-b, C-f, C-n, C-p, C-e make sense for me, as they stand for backward, forward, next, previous, end

But why C-a stands for home?

My guess is that home can be understood as begin, but b is already used for backward, hence a, which stands before b, is chosen.

Does anyone know a better explanation?


texts: Emacs hangs to due to looking for TAGS file on remote machine

texts:
I am working on a local file and I will see these TRAMP messages:

Tramp: Opening connection for YYY@XXX.XXX.com using ssh...
Tramp: Sending command `exec ssh -l YYY  -o ControlPath=/var/folders/4c/5l5ydzjx1jqbjc3t60t41vpc0000gn/T/tramp.40799Yr1.%r@%h:%p -o ControlMaster=auto -o ControlPersist=no -e none XXX.XXX.com'
Tramp: Waiting for prompts from remote shell...
Tramp: Sending password
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on `XXX.XXX.com'
Tramp: Opening connection for YYY@XXX.XXX.com using ssh...done
Making tags-file-name local to TAGS while let-bound!

Why is emacs automatically establishing a remote connection?
Why is it automatically building a TAGS file?
How can disable these two features?
Where are the references to the TAGS files stored, so one can edit it?

At one point this froze emacs to the point C-g repeatedly did not help.

UPDATE:

My machine was disconnected from the network and was able to catch this new error which likely seems related, as I was not working on a remote file.

Company: An error occurred in auto-begin
Company: Back-end (company-dabbrev-code company-gtags company-etags company-keywords) error "Tramp failed to connect.  If this happens repeatedly, try
    `M-x tramp-cleanup-this-connection'" with args (candidates CpF)
Company: An error occurred in auto-begin
Company: Back-end (company-dabbrev-code company-gtags company-etags company-keywords) error "File /ssh:***@***.com/project/TAGS does not exist" with args (candidates CpFq)

Still don't know how to resolve the issue, but hopefully this will provide a clue.


texts: Python org-mode source block output is always ': None'

texts:
This is my source block:

#+BEGIN_SRC python
print "hello"
#+END_SRC

The output is always:

#+RESULTS:
: None

This is my org-babel configuration:

    (org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)
   (C . t)
   (calc . t)
   (latex . t)
   (java . t)
   (ruby . t)
   (scheme . t)
   (sh . t)
   (sqlite . t)
   (js . t)))

Python is on my PATH and executable via terminal.

Emacs-lisp SRC blocks works just fine.

Why do I get None instead of hello?


texts: Help; how use Persistent Sets of Completion Candidates for search?

texts:
I want to use a set of files inside my directory ~/Dokumente to search for changes in title, content.  So I saved such a set of file names persistently, using C-} during file-name completion with Icicles.

Later, I can use C-{ to restore that set of file names as completion candidates for a command that prompts for a file name.

But how can I combine this with command icicle-locate (or another command that prompts for a file name)?

Command icicle-locate can used with C-M-j to filter by both file name AND file content.  How can I do that and also take advantage of my saved persistent set of file names?


texts: How to get displayed unicode in python shell

texts:
I am trying python-sympy on Emacs using the the python shell. Problem arise when I try to display unicode characters. This is what I get:

>>> from sympy import *
>>> x = symbols('x')
>>> init_printing(use_unicode=True)
>>> solve(x**2 -2, x)
Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/Library/Python/2.7/site-packages/sympy-0.7.7.dev-py2.7.egg/sympy/interactive/printing.py", line 30, in _displayhook
      print(stringify_func(arg))
  UnicodeEncodeError: 'ascii' codec can't encode character u'\u221a' in position 2: ordinal not in range(128)

Is there a way of displaying unicode (I did not tried ein-package)?


texts: Copy current URL from web browser from Emacs while editing

texts:
When editing code or org-mode, I often need the URL of the page I'm viewing in Google Chrome.  Is there a way to do this from Emacs?  Or with an external helper script if necessary?

An example use case would be editing code:

# See <insert current link to StackOverflow on bash variables>
if [[ -z "${param// }" ]]; then foo; fi


texts: How can I set the default shell in spacemacs (Evil mode) when executing commands in a buffer?

texts:
I've downloaded spacemacs (configured with Evil mode) on a Windows PC and would like to use bash or wsl as the default.

Example:

Open the evil-tutor and execute command :!ls

Desired Behaviour:

I would like this command to run in bash or wsl.


texts:
I am trying to search backwards and find [ but skip all square brackets within strings. I came across (nth 3 (syntax-ppss)); but I can't figure out how to use it with let in the following code:

(defun ext-ess-symbol-at-point-modified ()
  "Return the name of a symbol to the left of \"[\"."
  (interactive)
  (save-excursion
    (let* ((cpoint (point))
           (sbt0 (search-backward "[" 1 t))
           (sbt1 (search-forward "]" cpoint t)))
      (if (and sbt0 (not sbt1))
          (progn (goto-char (1- sbt0))
                 (message "%s" (buffer-substring
                                (search-backward-regexp "^\\|[[:space:]]")
                                sbt0)))
        (error "Could not find open square bracket \"[\"")))))

I would like something along the lines of

(let* ((cpoint (point))
       (sbt0 (while (nth 3 (syntax-ppss))
               (search-backward "[" 1 t)))


texts:
I want to stage a file or a hunk using vc-git (the vc system that comes with Emacs). How do I do this?

(To clarify, I made modifications on a file that is already (registered) in git. I would like to stage the new modifications made. How do I do this with vc-git?)


texts: Send a single raw keystroke to ansi-term

texts:
Occasionally, I want to send a keystroke to a program in my ansi-term buffer that is already mapped to something in emacs.  I know that for one I use often I could change my configuration to always send it, but in this case I just need a one-off.

Is there any way I can set some key combination to "send the next key as raw" ?


texts:
When I'm editing a org-mode file, the structure of mine is like this(you may need configuration in init.el):

* A section
  This is the content of the section
  #+BEGIN_SRC lang
    code here
  #+END_SRC
  ** A subsection
     This is the content of the subsection
* Another section
  This is the content of another section

But when when I'm editing a tex file using auctex, the structure of the tex file is this after I indented the whole buffer:

\documentclass{article}

\begin{document}

\section{A section}
This is the content of the section.

\begin{verbatim}
some verbatim text
\end{verbatim}

\subsection{A subsection}
This is the content of the subsection

\section{Another section}
This is the content of another section

\end{document}

It is not easy to view the whole structure, I know I can use C-c = to view the toc, but how can I make it like org-mode such as:

\documentclass{article}

\begin{document}

  \section{A section}
    This is the content of the section.

    \begin{verbatim}
      some verbatim text
    \end{verbatim}

    \subsection{A subsection}
      This is the content of the subsection

  \section{Another section}
    This is the content of another section

\end{document}

So, how can I indent the tex file (just using TAB and ENTER keys when editing it or indent the whole buffer using TAB or indent command)?

I mean, every block (section, subsection, EVERY \begin{}...\end{} pair no matter what is inside the {}) should be a part and should be in its place related to its parent? And the indent-level should be configurable.

How can do I do that? I googled a lot and found nothing useful.


texts:
I'm trying to use org-ref and I'm doing pretty well. There is one thing bothering me, though. The bibliography gets attached to the last heading (in the org file), where-as I would like it to be separate.
#+TITLE: Title

#+LATEX_HEADER: \usepackage{natbib}

* Section 1
* Section 2
** Subsection 2.1
** Subsection 2.2

# Maybe add a * Bibliography heading here? But how to hide it?

bibliographystyle:unsrt  # These get attached to subsection 2.2
bibliography:project.bib

Thank you in advance for your answers.


texts: org-mode render a particular latex fragment without using cache

texts:
Is it possible to override the caching behaviour of org-latex-preview once and for a particular latex fragment? That is, how should I call the command if I want to regenerate the particular latex fragment at point without using cache?

Many times, after introducing a newcommand or changing the latex header, I want to regenerate the latex preview of some fragments without using cache, but I do not necessarily want to delete the whole cache or stop using it.

The solution in the general case seems to be to just delete all images in the cache subfolder ltximg (see this question), but I would still like to be able to just regenerate one image without having to recreate the whole cache.


texts: Is it possible to make 'tput bel' behave like it does in iTerm with a macOS Dock badge?

texts:
Running sleep 1s && tput bel inside iTerm and quickly tabbing out into another application displays this very nice notification badge in the Dock:

I tried running (shell-command "sleep 1s && tput bel") or calling something like echo -e "\a", but there is no audible beep or that nice Dock badge. It just displays ^G.
I am interested in using this badge for new emails, linking it into mu4e-alert as a subtle way to notify me because I don't want to use the full-size notifications provided by something like terminal-notifier -message "New email...".
Does anyone know of other ways how I could get this badge to appear? I especially like the integration into macOS that the badge goes away on its own when the application is launched into its foreground.

I also tried the built-in (beep) and it beeps, but does not display the Dock badge when Emacs is not in focus:
(sleep-for 2)
(beep)


texts: How to assign the undo command to the Ctrl-z keybinding?

texts:
I have added:

(global-set-key (kbd "C-z") 'undo)

to my ~/.emacs file. But still when I press Ctrl+z nothing is undone even when I've had GNU Emacs open for a while and done several things in my present buffer. You can even see in my Edit menu that Undo isn't set to my desired keybinding: Ctrl+z.

Here is my ~/.emacs file, if relevant.


texts: Move to the beginning of a heading smartly in Org-mode

texts:
I just started with Org-mode today and noticed whenever I press C-a on a heading, the cursor is moved all the way to the beginning of the line instead of the first character in the heading.
Like so :-

* This i|s a heading.

after pressing C-a, the cursor moves like so :-

|* This is a heading.

I want C-a to move the cursor like so :-

* |This is a heading.

This is pretty minor quirk, but I've bound C-a to the below function (I don't remember where I got this from) and I'd want the behvaior of it to be consistent across all emacs modes.

(defun smarter-move-beginning-of-line (arg)
  (interactive "^p")
  (setq arg (or arg 1))

  (when (/= arg 1)
    (let ((line-move-visual nil))
      (forward-line (1- arg))))

  (let ((orig-point (point)))
    (back-to-indentation)
    (when (= orig-point (point))
      (move-beginning-of-line 1))))

The problem with Org-mode heading is, we use asterisks to indicate heading levels ( * -> level 1, ** -> level 2, and so on,) and they HAVE to be entered as the first character on the line and all these commands which move to the beginning of the line think the indentation level is the first character of the line. The solution should be pretty simple, but sadly I haven't learned elisp as of yet. All we have to do is :-

identify if the line is a heading or not.

if so, ignore all the asterisks and move forward by one character
if not, invoke the smart-beginning-of-line command I mentioned in the post.


texts:
I would like to achieve the following workflow:

When I open files to edit and close emacs, I want this changed files to be temporarily saved, so that I can very quickly close Emacs / move to other work items. The next time I open Emacs, these "scratch-items" shall be recovered.

I am aware of auto-save, but I want Emacs to "silently" open the auto-save files instead of prompting me what to do for every buffer.


texts: How to have both Greek Alphabet and LaTeX command of it in the same table in exported PDF (TEX)?

texts:
Just want to create a table of LaTeX command for Greek Alphabet. One column for the Greek Alphabet and one for the command.

When I use \beta, it shows as Greek alphabet in the exported PDF file. How could I escape it to make it shows as LaTeX command?


texts: Make signed messages the default in mu4e, unless disabled on a per-message basis

texts: How can I configure mu4e to start every newly composed message as signed (<#secure method=pgpmime mode=sign>)?


texts: How to use 'eww-view-source' in a function?

texts:
I need to kill and yank some portion of the source code of multiples websites for a database i'm making of news of certain web. But the problem is, whenever i call eww-view-source for viewing the website's source, it gives me an error of "no source".

The function and macro (I made a keyboard macro when the function didn't work) works the first time, but at a second execution it gives me the error.

I'm using an .org file with all the links i need to access and copy a portion from their source. This region is determined with two search-forward expressions. This is the function i made (ignore the name and description, i'm from Latinoamérica):

 (defun aporrea-listar-archivo ()
  "Copia en la entrada el código relativo a las noticias
de una página del archivo de aporrea."
  (interactive)
  (save-excursion
    (org-open-at-point)
    (set-buffer "*eww*") ;;added this trying to solve
    (eww-view-source)
    (set-buffer "*eww-source*")   ;;added this trying to solve
    (copy-region-as-kill (search-forward "
Noticias
")
             (search-forward "
Artículos de Opinión
"))
    (View-quit)  ;; This exits the view-mode of eww for sources
    (kill-buffer "*eww-source*")
    (kill-buffer "*eww*")))

For some reason the save-excursion is not working. I'm ok with that...


texts:
I am currently using org-mode to edit code blocks for presentations and blog posts.

Currently I have a frame set up with one large window pane on the left, and two smaller panes on the right.

The bottom right pane is a Python console
The top right pane is ideally a "target" buffer in Python mode
The left pane is an editing window for the entire .org document.

Ideally, I would be able to send the code blocks to the "target" pane from the org document (using C-c ') while all of the window positions remain static. Unfortunately, org-mode replaces the existing panes with the temporary one when I issue this command.

I have tried setting(setq org-src-window-setup 'other-window) in my configuration file. This seems to be close to the desired behavior, but emacs does not seem to know which existing window I want to send the editing block to.

Is there any way to send the code blocks to the target pane (perhaps with C-c ' or some other command) as described? All other functionality would ideally work the same as C-c ' (edit the buffer, and send the edited code back to the original code block).


texts: How to speed up `undo-tree-visualizer-toggle-diff` and stop tree movement when cursor is not pressed?

texts:
After opening undo-tree-and-diff and enabling undo-tree-visualizer-toggle-diff by pressing d; I start to move in the history tree:

If I just press up or down cursore for few seconds ; undo-tree keeps moving on the history (on the direction I pressed the cursor) and I cannot stop it for a while like 5 to 10 seconds. Also each movement in the undo-tree is so slow.

I realize that using undo-tree-visualizer-toggle-diff was the main cause of this issue during moving on the undo-tree.
=> I am not sure is it the general behavior of undo-tree-visualizer-toggle-diff. Is there any way to fix it (make the process faster and stop the tree movement when cursor is not pressed) while keeping undo-tree-visualizer-toggle-diff enabled?

My configurations related to undo-tree:
(global-undo-tree-mode 1)
(setq undo-tree-auto-save-history t)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))

(defun my-undo-tree-save-history (undo-tree-save-history &rest args)
  (let ((message-log-max nil)
        (inhibit-message t))
    (apply undo-tree-save-history args)))

(advice-add 'undo-tree-save-history :around 'my-undo-tree-save-history)

(defun my-find-file-check-make-large-file-read-only-hook ()
  "If a file is over a given size, make the buffer read only."
  (when (> (buffer-size) (* 1024 1024))
    ; (setq buffer-read-only t)
    (buffer-disable-undo)
    (fundamental-mode)))

(setq undo-tree-show-minibuffer-help t)
(setq undo-tree-minibuffer-help-dynamic t)

(defun undo-tree-and-diff ()
  (interactive)
  (undo-tree-visualize)
  (undo-tree-visualizer-toggle-diff)) ;; d close toggle-diff

(global-set-key "\C-x\C-v" 'undo-tree-and-diff)


texts: Info files are found but not installed (on archlinux)

texts:
I am not able to access many info files. For example, the command (info "(gnus) Sorting the Summary Buffer") returns

  Info file gnus does not exist

So I want to install/configure my info files directory. I am using emacs 24.5.1 on Archlinux.

According to this post I should have my info files located under export INFOPATH=$INFOPATH:/usr/share/info/emacs-24. But it does not load my info files, and the directory /usr/share/info/emacs-24 does not exist. I notice, however, that I have numerous *.info.gz files under, such as the following:

/usr/share/info/flymake.info.gz
/usr/share/info/forms.info.gz
/usr/share/info/gnus.info.gz
/usr/share/info/emacs-gnutls.info.gz
/usr/share/info/emacs.info.gz
/usr/share/info/emacs-mime.info.gz

The complete file listing is listed here: https://www.archlinux.org/packages/extra/i686/emacs/files/ which includes many more *.info.gz files under /usr/share/info/. How can I make these files accessible to my emacs distro? Should I make the directory /usr/share/info/emacs-24 and unzip the files in there? Or is there an elpa package that I am missing?

Any help would be great.

UPDATE

Interestingly, if I run M-x dired RET /usr/share/gnus.info.gz, then I can open the info manual. But how can I execute a function like (info "(gnus) Sorting the Summary Buffer")?


texts: Using emacs with thunderbird to compose and respond to mail

texts:
There is a lot written for using emacs as a full-blown primary email program. I am looking for something with a simple setup so that I can keep Thunderbird as my primary email management program but compose and send email in emacs. Since python can send mail from the command line, I suspect this would not be too difficult for emacs.

Next step: if possible I'd still like to be able to sync with an imap server to pull off the last ~100 emails so I can compose responses in emacs. This wouldn't require folder management, but some amount of syncing, though I don't need to keep the messages locally available to emacs after the session. Would it still require offlineimap?

Any suggestions for a suitable configuration?


texts: Keyboard macro get data from one buffer and put to another buffer

texts:
I use keyboard macros in one buffer like this:

'C-x (’ or <f3>– start defining a keyboard macro
`C-x )’ or <f4>– stop defining the keyboard macro

Nice. It's work fine.
But I use macro in on buffer.
But suppose I has 2 buffers. I split window. In the top I has countries.xml and in bottom buffer I has insert-data.sql

Is it possible to create keyboard macro that copy data, line by line, from insert-data.sql and paste to countries.xml ?

Here screenshot:

I know that I can write elisp script. But I want to do this task by keyboard macros. Is it possible?


texts: How do I get the highlight region mouse and yank functionality work like Emacs 21.3 in a newer version?

texts:
Recently at work (a small academic department, absolutely no Emacs support) we upgraded from Emacs version 21.3.1 to 24.3.

In version 21 marking a region with the mouse will put the highlighted text into the kill-ring. Highlighting another region and yanking would insert the previously highlighted text while saving the recent highlight to the kill-ring. You could continue this "alternating replacing" indefinitely.

I cannot recreate this behavior in version 24 even by changing the .emacs like done in this page: https://www.emacswiki.org/emacs/CopyAndPaste

(setq x-select-enable-primary t)
(setq x-select-enable-clipboard nil)
(delete-selection-mode)

Highlighting the text in version 24 with the mouse seems to just put it into the primary selection but not into the kill-ring until I yank, but then it doesn't produce the inserting alternating text behavior as in version 21, which is desired.

I have also looked into this page https://www.emacswiki.org/emacs/Comments_on_CopyAndPaste but there are many proposed solution and I haven't had the time to see which one would approximate the above mentioned behavior.

Many thanks for your help.


texts:
I'd like to get access to org mode's extra keys.  However, although the value of org-use-extra-keys is set to "on (non-nil)" (and has been for several Emacs sessions), I don't seem to have access to them.  For example, when I enter the command describe-mode while visiting an org file, the extra key bindings are not displayed.  In addition, if I type for example C-c C-x l, I get an error saying this command is not defined.

I'm on a Macbook Pro in Mojave, running the latest version of Emacs found on emacsformacosx.com.

Does anyone have ideas for how I could get these extra keys working?


texts:
I had previously installed and used Emacs 25.2.2 and ESS 17.11 on Ubuntu 18.04 (Bionic Beaver).  While attempting to update to the latest version of ESS, the ESS install script appears to have failed (see terminal output below).

I tried removing (with --purge) and then re-installing both ESS and Emacs 25, but this did not solve the problem.

Does anyone have a solution to this problem?

dorazio@toucan:~$ sudo apt install ess
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  xlispstat pspp jags julia
The following NEW packages will be installed:
  ess
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/1,341 kB of archives.
After this operation, 5,776 kB of additional disk space will be used.
Selecting previously unselected package ess.
(Reading database ... 376257 files and directories currently installed.)
Preparing to unpack .../ess_17.11-3bionic0_all.deb ...
Unpacking ess (17.11-3bionic0) ...
Processing triggers for install-info (6.5.0.dfsg.1-2) ...
Setting up ess (17.11-3bionic0) ...
Install emacsen-common for emacs25
emacsen-common: Handling install of emacsen flavor emacs25
Install ess for emacs25
install/ess: Handling install for emacsen flavor emacs25
ERROR: install script from ess package failed
dpkg: error processing package ess (--configure):
 installed ess package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 ess
E: Sub-process /usr/bin/dpkg returned an error code (1)


texts: Why are eight-bit single-byte characters counted as multibyte with (byte-to-position)?

texts:
I was investigating a problem with how an Emacs process (monroe.el) decodes messages formatted in bencode, where the process would not skip over the correct number of characters in the message, causing the connection to hang. Bencode encodes strings like <length>:<bytes>, where <bytes> is a series of bytes with no specified encoding. In the server's case, it sends UTF-8 where possible, because that's how the data being gathered on the other side happens to be encoded. The process is set to encode and decode in utf-8-unix.
Some responses from the server to monroe.el contain bytes that fall outside the valid range of ASCII and are also not valid UTF-8. It turns out that when the decoding filter uses byte-to-position to determine where to move the point to next, those invalid bytes were being counted with width 2 instead of 1 for purposes of moving over the string. To test this theory, I ran this code:
(with-temp-buffer
  (set-buffer-file-coding-system 'binary)
  (insert "testあ\335")
  (let ((i 1) pos res)
    (while (cddr (setq pos (cons (char-after (byte-to-position i)) (cons i (byte-to-position i)))))
      (push pos res)
      (setq i (1+ i)))
    (nreverse res)))

Note that \335 is supposed to be an eight-bit sequence displayed in Emacs representing a single byte, not a string as in the code above. This code outputs the following:
((116 1 . 1) (101 2 . 2) (115 3 . 3) (116 4 . 4) (12354 5 . 5) (12354 6 . 5) (12354 7 . 5) (4194269 8 . 6) (4194269 9 . 6) (nil 10 . 7))

This was not what I was expecting to see: the 4194269 at the end is apparently the "codepoint" of the eight-bit sequence \335, and it's repeated twice in the output, meaning more than one byte position in the buffer maps to it. This does not make sense to me, because it's supposed to represent the single byte 0xDD, or 221 in decimal, so there should only be one buffer position for it. Indeed describe-char shows as much:
             position: 132 of 366 (36%), column: 17
            character:   (displayed as  ) (codepoint 4194269, #o17777735, #x3fffdd)
              charset: eight-bit (Raw bytes 128-255)
code point in charset: 0xDD
               syntax: w    which means: word
             category: L:Left-to-right (strong)
             to input: type "C-x 8 RET 3fffdd"
          buffer code: #xDD
            file code: #xDD (encoded by coding system raw-text-dos)
              display: no font available

It shows the "buffer code" as 0xDD, correctly.
If I call (set-buffer-multibyte nil) inside the temporary buffer, I get this result instead.
((116 1 . 1) (101 2 . 2) (115 3 . 3) (116 4 . 4) (66 5 . 5) (221 6 . 6) (nil 7 . 7))

This time the 0xDD byte is mapped correctly, but the hiragana あ (which is proper UTF-8) is not, so the overall size of the string as binary still isn't correct.
The end goal is to be able to parse the following bencode:
4:test3:あ1:\335

where test is ASCII, あ is UTF-8 and \335 is the byte 0xDD.
Is there something more that needs to be setup for this to work correctly? I'm using Emacs 28.


texts:
I'm using Emacs 24.3.1 on Ubuntu 14.04 with AUCTex for LaTeX editing. The command C-c C-c allows me to easily compile the document with pdflatex. However, the second time I'm running C-c C-c, instead doc-view is launched (showing the resulting pdf).

This doesn't fit with my workflow. I use a different pdf viewer, and sometimes need to compile the document twice to get citations right etc.

Can I disable doc-view so that C-c C-c always executes pdflatex?

I've tried the solutions suggested here
How to disable DocView as default command in AUCTeX?
but had no effect.

This solution didn't work either
how to modify default command for TeX-command-master (ie, C-c C-c)?
since I don't seem to have a TeX-command-master command installed (not available on M-x). C-c must be mapped to something else.

EDIT (Solved):
It turns out my problem was caused by me using Emacs latex mode rather than AUCTeX. After making sure AUCTeX is installed, it's invoked with LaTeX-mode, in contrast to Emacs latex mode that is invoked with latex-mode. The answer here how to modify default command for TeX-command-master (ie, C-c C-c)? now solves my problem.


texts:
I have been using projectile-ripgrep for a few months and I'm pretty happy with it. A few days ago I was testing some of is options and the default search for ripgrep (what I see in the minibuffer) changed from:
[my-project] Ripgrep search for (default my_function):

to:
[my-project] Ripgrep search for: my_function

I find it a bit annoying since I like how it used to suggest the search (same as when you do a query-replace), meaning that if I did not enter any character, it would search the suggested term. Now that term is already part of the input, so if I want to search for something else I have to delete it first.
I am not sure how I changed this and I am not able to set it back to how it was. Any ideas?


texts: How to center region in exact middle of screen?

texts:
So i basically want to (as the title suggest) to center a region of text, in the center of the screen. Current example is using part of this site.

From this

To this

And here a small gif video to show how i did it manually (for more detail):

Used screenkey to display the key i used. Roughly, i'm just putting a newline characters in front of the first line of the block of text (which is on the same line, in this example) and center it (very roughly) in the center.
Then i input space characters in front of each line, until it is formatted into one block of text, in the position i choose above.

This is basically what i want to do (on a region selected text) but in elisp.


texts:
When using org-mode to create Beamer slides, sometimes the error shown is

"Pdf file ... wasn't produced"

or the previous PDF file generated is opened (without the changes made) when the command C-c C-e l o is issued to open the PDF directly.

However, the .tex file generated from export to Beamer when compiled separately does give the PDF.

Since there is no debug message given, I am not sure how to detect why the export to Beamer to open the slides directly is not working.

How can we detect the source of error in exporting org files ?

Thanks.


texts: Easiest way to customize holidays that appear in org-agenda

texts:
This may have an obvious solution, which would explain why I cannot find it anywhere online, but I would like to customize the holidays that show up in my org-agenda--as easily as possible. Instead of manually entering each holiday in a diary or org mode file, I'd ideally like to draw on the "holidays.el" package. To do this I currently have the line %%(org-calendar-holiday) in an org mode file. The only problem is that I get every single holiday showing up in my agenda now, most of which are only useful in clogging up my agenda.

Is there a way to "turn off" some of these calendar lists so they don't get displayed in my agenda? I tried going the route of setting variables like holiday-solar-holidays to "nil," but that doesn't seem to affect their display in the agenda. This increases my suspicion that the holiday-xx-holidays variables are only applicable to the calendar, and not the agenda. If that's the case I'll assuredly have to go another route, and other suggestions would be welcome.

My end goal is to have major U.S. holidays and solar holidays displayed in my agenda. With so few holidays you may ask why I don't manually enter them and forget the org-calendar-holiday function and "holidays.el" library all together. Well, coding the dates of all future solstices and equinoxes doesn't sound very appealing. Plus, I like drawing on what's already been done when I can--in this case the "holidays" package. Although I could be using it in an entirely different manner than it was intended.

As a side note, I read the post entitled "Programmatically add birthdays/holidays to agenda view in org-mode", but there didn't seem to be enough detail to tell if it's the same issue I'm encountering. And interesting as the current answer in that post is, it's not the solution I'm hoping for.

Thanks for your help.


texts: User-friendly setup of Emacs with GPG, mu4e, and mu4e-send-delay

texts:
I use mu4e and Emacs for email, as well as GPG for credentials and mu4e-send-delay for delayed sending.

Sometimes the GPG prompt for the encryption password is overwritten by another message in the mini-buffer, and GPG gets the wrong password. The mini-buffer shows Blocking call to accept-process-output with quit inhibited! and a pop-up dialog says Buffer *temp* modified, kill anyway?. A copy of the message is saved in the home directory with filepath ~/*message*-20191031-185747.

This pop-up appears as many times as the number of emails to send and comes again after the value of mu4e-send-delay-timer (60 seconds in my case).

The only solution I found (from How to force Emacs or pinentry to forget wrong GPG password?) was to kill the GPG agent with gpgconf --kill gpg-agent and restart Emacs. Either of them alone is not enough, I need to do both. Then I get prompted for a GPG password.

I am using GNU Emacs 26.3, gpg 2.2.17, and macOS Mojave 10.14.6.

How can I set up Emacs, mu4e, and GPG to be more user-friendly, maybe with a pop-up to request the password, and setting GPG to forget wrong passwords?


texts: (Company) Doc Buffer ignoring scroll-other-window

texts:
I'm trying to write my own backend for a certain tool language that has no repl. Hence, I thought it would be the best idea to parse the documentation and store it as a hash table (I'm open to other suggestions, I'm fairly new to Emacs). In general this works fine, the problems arise when the documentation is longer than a display. In this case, I would like to use scroll-other-window like anywhere else to scroll the documentation down, but it immediately jumps back to the top.

This is the basic structure of my backend:

(defconst my--constants
  (list "asdf"
        "bsdf"
        "csdf"))

(defconst my--doc-buffer
  #s(hash-table
     size 3
     test equal
     data("asdf" "Test."
          "bsdf" "Doing\nfine."
          "csdf" "T\nh\ni\ns\n \ni\ns\n \nw\nh\ne\nr\ne\n \ni\nt\n \ng\ne\nt\ns\n \nr\ne\na\nl\nl\ny\n \nm\ne\ns\ns\ny\n.\n \nE\nv\ne\nn\n \nw\ni\nt\nh\n \ns\nc\nr\no\nl\nl\n-\no\nt\nh\ne\nr\n-\nw\ni\nn\nd\no\nw\n \ni\nt\n \nj\nu\nm\np\ns\n \nb\na\nc\nk\n.")))

(define-derived-mode my-mode prog-mode "My")

(defun my-completion-at-point ()
  (let ((bounds (bounds-of-thing-at-point 'word)))
    (when bounds
      (list (car bounds)
            (cdr bounds)
            my--constants
            :exclusive 'no
            :sorted (lambda (cand) t)
            :company-doc-buffer
            (lambda (cand)
              (company-doc-buffer (gethash cand my--doc-buffer)))))))

(add-hook 'completion-at-point-functions 'my-completion-at-point)

When company-show-doc-buffer is called upon csdf, scroll-other-window won't do it's job properly. Instead it immediately jumps back to the head.

Are those \n linebreaks the wrong approach? Am I missing something else? Unfortunately I couldn't find any other backends that use doc-buffers in an offline table. Is it actually the way to go, to use a company-doc-buffer, or is there a more generic thing available/recommended?


texts: Show a list of names for all git projects

texts:
Windows 10, Emacs 25.1, Helm, Magit

I have many git projects in different folders.
Is it possible to show list of names for all git projects in one buffer?


texts:
Emacs cannot compete with another other IDE if it doesn’t have an auto completion function. Auto-complete simply makes me a more efficient programmer. I know of the Auto Complete Mode extension, but it does not work with C++.

How can I achieve smart and efficient autocompletion for C++?

This question was originally asked by Malabarba on the Area 51 proposal:
How to get intelligent auto-completion in C++?


texts: Links to .org files are not recognized as links in org-mode

texts:
I've been trying to use links in my org files but it doesn't work as I'd expect. It works as is should - convert [[target][Desc]] to Desc and make it clickable for any target, except when the target ends with .org. Then it is just the "raw" text version.
I've tested in on an empty init.el with the same result.

[[file:~/test.or][Works]]
[[file:~/test.org][Does not work]]
[[file:~/test.org-][Works]]

Whenever  I change the org extension either by adding a letter or subracting one, it folds the link properly.
What should I adjust to fix it?

Emacs version: emacs-26.3-z-mac-7.8

Thanks!


texts:
I want to comment out all environments say myenv in a tex-file. I can find them with the regexp:

\\begin{myenv}\(.\|\n\).*?\\end{myenv}

(instead of \n I had do type C-q C-j).

But what would be the correct regexp for replacing? How to reverse it, i.e. uncomment all environments myenv?


texts: How to add font styles to org-capture templates?

texts:
I want to change the color and font style in my template.
I use custom-set-variable and cannot set, for example, italic style

(custom-set-variables
 '(org-capture-templates
   (backquote
    (("d"
      "diary"
      entry
      (file+olp+datetree ,(concat org-directory "diary.org"))
      ,(propertize "* [%<%H:%M>] test %?" (quote face) (quote italic)))))))

My goal is to get this: * [20:32] test
Org-capture works, but the font is not italic: * [20:32] test

UPD I missed an important part of my question. I need to change the styles just for the time mark. Is it possible to color this time mark as a timestamp?


texts: What's the lighest version of emacs for Ostro x86_64-unknown-linux-gnu?

texts:
Using Ostro on #IntelMaker #Joule, I've downloaded the earliest version of emacs available from https://ftp.gnu.org/pub/gnu/emacs/, and tried running configure, but it failed with a message that emacs wasn't ported to the platform yet.

root@intel-corei7-64:~/emacs/emacs-21.4# ./configure
creating cache ./config.cache
checking host system type... x86_64-unknown-linux-gnu
configure: error: Emacs hasn't been ported to `x86_64-unknown-linux-gnu' systems.
Check `etc/MACHINES' for recognized configuration names.
root@intel-corei7-64:~/emacs/emacs-21.4# cd ..

If I just want an emacs-like text editor, and don't have a package manager, what's the quickest way to get an emacs-compatible editor going?

Size-wise, emacs-21.4a.tar.gz is only 19M, but emacs-25.1.tar.gz is already 59M.

What was the earliest version that had support for x86_64?


texts: How to insert the content of a org-mode's code block inside  tags when exporting to HTML?

texts: When exporting to HTML, org-mode renders a code block in a very ugly way, I don't like that. I want to use HighlightJs to highlight my exported code blocks. But, how do I tell org-mode to simply insert the content of the code block and wrap it around <pre><code> tags when exporting to HTML? adding the language name to <code> as a class would be great.


texts: emacs Aborted (core dumped)- centOS 7.0 emacs 25.3 -- Please Help

texts:
Dear stackexchange users,

I would really appreciate your help in fixing my issue.
I am new with centOS 7.0 with less a year of experience.
I was using emacs-24.3 until the following error came up, so I compiled emacs-25.3 with source code. I tried to purge gtk without a success. This issue persists for weeks, and I really don't know what to do.

I would fully appreciate your help..

When I type emacs any.log the following Error shows up:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X protocol error: BadRequest (invalid request code or no such operation) on protocol request 130
When compiled with GTK, Emacs cannot recover from X disconnects.
This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715
For details, see etc/PROBLEMS.
Fatal error 6: Aborted
Backtrace:
emacs[0x500792]
emacs[0x4e8659]
emacs[0x500823]
emacs[0x4b9dc1]
emacs[0x4bd945]
emacs[0x4bd9ce]
/usr/lib64/libX11.so.6(_XError+0x12b)[0x7fc8a5a6a07b]
/usr/lib64/libX11.so.6(+0x420d7)[0x7fc8a5a670d7]
/usr/lib64/libX11.so.6(+0x42195)[0x7fc8a5a67195]
/usr/lib64/libX11.so.6(_XReply+0x208)[0x7fc8a5a68088]
/usr/lib64/libX11.so.6(XQueryPointer+0x8e)[0x7fc8a5a5e0be]
/usr/lib64/libgdk-3.so.0(+0x4f80c)[0x7fc8a78a380c]
/usr/lib64/libgdk-3.so.0(+0x6ed9d)[0x7fc8a78c2d9d]
/usr/lib64/libgdk-3.so.0(gdk_window_get_device_position_double+0x12d)[0x7fc8a7895b0d]
/usr/lib64/libgdk-3.so.0(gdk_window_get_device_position+0x2d)[0x7fc8a7895bfd]
/usr/lib64/libgtk-3.so.0(+0x342c41)[0x7fc8a7e4ec41]
/usr/lib64/libgtk-3.so.0(+0x34312f)[0x7fc8a7e4f12f]
/usr/lib64/libgdk-3.so.0(+0x22338)[0x7fc8a7876338]
/usr/lib64/libglib-2.0.so.0(+0x4aeed)[0x7fc8a61d1eed]
/usr/lib64/libglib-2.0.so.0(g_main_context_dispatch+0x159)[0x7fc8a61d14c9]
emacs[0x5c8c18]
emacs[0x5966b1]
emacs[0x4f2c8d]
emacs[0x4f492f]
emacs[0x4f6446]
emacs[0x557d0d]
emacs[0x4e8b8c]
emacs[0x557cbb]
emacs[0x4e8b47]
emacs[0x4ecf74]
emacs[0x4ed295]
emacs[0x417318]
/usr/lib64/libc.so.6(__libc_start_main+0xf5)[0x7fc8a1eaac05]
emacs[0x417e1c]
Aborted (core dumped)


texts:
I read that the usual way to bind key to keyboard macros are C-x C-k 0 to 9 and A to Z.

So for example, after we define a keyboard macro, we can type
C-x C-k b and Emacs will ask for a key to bind.  And the reserved keys for this purpose are C-x C-k 0 to 9 and A to Z.

But this involves quite a few keystrokes.  What are good keys to bind this to?  I found that I could bind it to C-<return> or Option + Enter on a Mac running the Ubuntu Virtual Machine using the Emacs GUI version. So that should work, but the Emacs terminal version and the native Emacs on a Mac both treat C-<return> or Option + Enter as just <return>, so that won't work.

What might be unused keys on Emacs that generally can be used to bind keyboard macros?

Or maybe alternatively, is there a way to show all the simple keys that are not bound to Ctrl and Meta?


texts: How to load json.el included in emacs instead of fallback lib included in gnus

texts:
I want to use the json.el included in 24.5, but cannot do that, because gnus includes an older version of json.el that is loaded before the one from 24.5.

When running list-load-path-shadows I got this as one of the shadows:
/usr/share/emacs/site-lisp/gnus/gnus-fallback-lib/json hides /usr/share/emacs/24.5/lisp/json

How do I prevent the fallback json from being loaded?


texts: How can I run the `main` Haskell function directly upon loading the code of a buffer?

texts:
Having some spare time at the moment, I wanted to expand my horizon a bit and learn a bit of Haskell.
Using GHCi on Ubuntu 18.04 works well.
To have a comfortable editor, I have installed haskell-mode.
After some troubles with haskell-interactive-mode, I set haskell-mode-hook to haskell-inferior-mode.
The key combination C-c C-l (control key and lowercase c, control key and lowercase l) loads the active buffer to the Haskell interpreter.
To run the code, I still have to type main (i.e. the name of the module).
Is there a way to run the main function directly upon loading the code of a buffer?
In python-mode, a simple C-c C-c suffices to run the code.


texts:
I want to put some config outside my init.el file into .dir-locals.el, i.e the following:

((nil
  (let ((dirs '(".cask" "core" "packages" "modules" "snippets" "themes")))
   (mapc #'(lambda (path) (add-to-list 'projectile-globally-ignored-directories path)) dirs))))

But each time i'm trying to open any file in my .emacs.d folder, emacs asks me if it's save to apply this code. I've tried to silence it by setting file local vars:

;; -*- enable-local-variables: t; enable-local-eval: t -*-

and it didn't help at all, on the contrary adds another message to trust these local settings. How can i make it trust my .dir-locals.el code?


texts: Debugging a "Warning (bytecomp): reference to free variable" message

texts:
I just upgraded to a new bleeding edge version of Emacs in OS X:

brew install emacs --HEAD --use-git-head --with-cocoa
--with-gnutls --with-rsvg --with-imagemagick

I understand that this version is not stable and that I shouldn't expect it to wok without any problems. Still, my experience so far has been relatively positive installing from HEAD directly.

For some reason, after today's update, I now run into this warning when I start Emacs. I am hoping to debug this problem using setq debug-on-message as suggested in many threads without luck.

I tried adding  (setq debug-on-message "Warning (bytecomp)")
or (setq debug-on-message "Warning \(bytecomp\)") at the beginning of my .emacs file and starting Emacs with emacs --debug-init, but I don't see any trace either in the Compile-Log or the Messages log.

I have also tried re-compiling all packages from scratch, as explained in this answer, i.e. doing M-: (byte-recompile-directory package-user-dir nil 'force), but the problem persists.

How can I effectively debug this type of warning?


texts: Hold button+[a-z] to immediately trigger ace-jump+[a-z]?

texts:
Currently I have to press some modifier combo + letter to trigger ace jump with letter. This is obnoxiously time-consuming for a command I use all the time.

I want to be able to just hold down a key (æ in my case) and press "s" (like I'd do shift-s to write capital S) to trigger ace-jump for s. And so on for the other letters.

The main problem is taking a general letter and triggering the command for that letter, I presume. (I could probably have come up with a hard-coded solution myself and will be hesitant to accept one as an answer.)

PS. ace-jump tag missing.


texts: how to upgrade packages if init file calls package function?

texts:
[Note to folks with itchy 'close' fingers: this is not a duplicate of Noninteractively upgrade all packages, since those answers rely on code or package in one's init.el, which would suffer from the following problem described below.]

I'm currently-unpackaged, but migrating there now. I'm also not much of an Org user now, but hope to increase my usage soon. I noticed this open issue on Eric Schulte's popular ESK, which says (edited to collapse nested blockquote)

As people will quickly tell you when you ask about weird Org issues,
"when installing from ELPA, please do so from a fresh Emacs session
where no Org function has been called."

OTOH, ESK is not the only Emacs config out there that uses literately-programmed tangled Org, so I'm guessing "there's gotta be a way" to, e.g., run package updates (at least for Org) offline. Perhaps with a one-liner like

emacsclient -c -a '' -e '(unknown-package-update-magic)'

? (I'm guessing one must use -e since I'm not seeing any equivalent of --no-init-file for emacsclient, at least for my version=24.4--am I missing something?)

Specifically I'd like to know:

1. Does the above instruction still apply? I.e., should (at least, to avoid "weird issues") one still update Org packages from a never-Org'ed session?

If so,

2. When referring to an Emacs session in this context, how does running emacs --daemon (either directly after host boot, or indirectly via, e.g., emacsclient -c -a '' -e) change the situation? E.g., if I close my Emacs client (with C-x C-c), but leave the daemon running, and then startup a new client, am I still in the same "Emacs session" until I kill/restart the daemon, or should I do something else to make a running daemon start a fresh Emacs session?

3. How to create a fresh Emacs session in which no Org function has been called if one's init.el (or code called by one's init.el) calls Org functions? For extra credit, show how to create an Emacs session (after answering the previous question :-) that can programmatically update all one's packages (or at least one package name provided by the user) and then exit.


texts: Characters replaced with angled bracket sequence, possibly due to encoding

texts:
I have files in Markdown, saved in a Dropbox folder. One of them replaces characters with angled bracket sequences. For example a git diff no-index between the saved file and a copy-paste of the text to a new file gives:

-# `Package <81><B4>julia-mode-0.3<81><B4> is unavailable.`
+# `Package ´julia-mode-0.3´ is unavailable.`

Other sequences are <91><A1><AD> for ellipsis (...), <81><A0> for a space, <81><E2> for â, <86><A4> for the euro sign €, <91><A1><B0> for opening double quote, <91><A1><B1> for closing double quote, <86><A1> for opening single quote, <86><A2> for closing single quote.

The variable buffer-file-coding-system is emacs-mule-unix in the original buffer and utf-8-unix in the buffer with the copy-pasted content.

Many other files in the same folder have recently stopped showing with proper formatting. They list Fundamental in the mode line instead of Markdown. The characters display properly. Many of these buffers have a variable buffer-file-coding-system of undecided-unix.

As I started having these issues around the same time, I believe they are related. Since the characters display fine in Emacs, it's not a question of converting the buffer from one encoding to another (as many of the threads I have found).

How can I save all of these buffers back to utf8-unix, and what triggered this behavior?


texts: Is there a package for semantic refactoring

texts: Is there a package that allows syntax aware refactoring in python or c++. For example, extracting a value as a parameter, into a function signature, extracting a block as a function (passing local values as parameters into the function signature).


texts:
that’s some time yet I began to use emacs as much as possible for quite everything (org-mode, Gnus, etc.), but I’m still maintaining a single file with a list of names, numbers, adresses, etc. manually… And I know there’s BBDB inside emacs, which seems to be linked to a lot of things… How to learn to use it? What is it supposed to do exactly? How? Why? etc.

For now I just found the v2 manual (outdated it seems) and this post: Where is the canonical location for the BBDB manual?


texts: How do I fully uninstall/erradicate powerline?

texts:
I'm running GNU Emacs 24.4.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
 of 2014-10-20 on builder10-9.porkrind.org, the one available form gnuemacsformacosx.com. After upgrading, my modeline was mostly blank, and it seemed that this error was due to something involving powerline. In any case, I decided to switch to smart-mode-line. So I installed the latter package and have attempted to delete powerline by

deleting it from the package list using d, x
deleting all occurrences of expressions containing 'powerline' in my .emacs

However, I am still receiving the following error in my messages when I launch Emacs:

Eager macro-expansion failure: (error "Autoloading failed to define function defpowerline")
Error: (file-error "Cannot open load file" "no such file or directory" "powerline")

I cannot figure out how to track down the cause of this error. I'm most grateful for any help!


texts: How to turn off `emacs-lisp-checkdoc` of flycheck when edit source block in org-mode file?

texts:
I have a emacs-lisp block in org-mode and when I try to edit it by press C-c ', flycheck always report errors as below:

0     warning         The first line should be of the form: ";;; package --- Summary"... (emacs-lisp-checkdoc)
0     warning         You should have a section marked ";;; Commentary:"... (emacs-lisp-checkdoc)
1     warning         You should have a section marked ";;; Code:"... (emacs-lisp-checkdoc)

How could I turn it off when edit it source block?


texts: Which value for topmost-intro-cont, to align variable names in c-mode?

texts:
In c-mode, how to align following code so, that the second variable name's starting character (A) is aligned below the first variable name's starting character (V)?

static unsigned int V_name_1,
                    A_name_2;

c-show-syntactic-information shows, that that indentation can be justified with topmost-intro-cont.
(I am unable to find a setting to achieve the wanted indentation.)


texts: Chinese Text commentary syntax highlighting

texts:
Plain text inherited from ctext.org contain the following syntax: {{...}}

  堯年十六，以唐侯升為天子，遂以為號。{{《論語·泰伯》疏

  案曰：堯典正義云：徧檢書傳無帝堯卽位之年，則此似非伏生大傳文，疑出書緯。}}

  辯章百姓。{{見《毛詩·采菽》正義、《史記·五帝紀》索隱、《後漢書》注}}

  辨章百姓，百姓昭明。{{《癸辛雜識》前集引《尚書大傳》第一曰云云}}

Commentary within the braces are displayed as such:

How can this be reproduced in org-mode? My guess is that I would need to work on faces and syntax tables.

Using @xuechunyang's answers below, I'd like to define another set of commentary markup on my own by changing some of the variables. Why doesn't this work?

(defface org-commentary-2
  '((t :foreground "blue2"))
  "Face for blue text in org mode")

(defun org-add-my-extra-markup ()
  (add-to-list 'org-font-lock-extra-keywords
               `(,(rx (group "((")
                      (group (+? anything))
                      (group "))"))
                 (1 '(face default invisible t))
                 (2 '(face org-commentary-2))
                 (3 '(face default invisible t)))))

(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)


texts: Optimal settings for auto-complete for writing papers / prose in natural language?

texts:
As the question suggest, I am trying to set up the auto-complete package for writing papers. I have also installed ac-ispell. So far it seems more or less useless, mostly because it is way too slow. Suggestions take several full seconds to appear.

Here are the relevant lines that I currently have in my init, which are based directly on the recommendations in the documentation for these two packages:

(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-modes '(org-mode text-mode LaTeX-mode))

(custom-set-variables
 '(ac-ispell-requires 4)
 '(ac-ispell-fuzzy-limit 2))

(eval-after-load "auto-complete"
  '(progn
     (ac-ispell-setup)))

(add-hook 'git-commit-mode-hook 'ac-ispell-ac-setup)
(add-hook 'mail-mode-hook 'ac-ispell-ac-setup)
(add-hook 'org-mode-hook 'ac-ispell-ac-setup)
(add-hook 'text-mode-hook 'ac-ispell-ac-setup)
(add-hook 'LaTeX-mode-hook 'ac-ispell-ac-setup)

(global-auto-complete-mode t)

In case this helps, the resulting value for ac-sources is (ac-source-ispell ac-source-ispell-fuzzy ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers).

If you've had better luck with this then I have, please help!


texts: How to force emacs to open a file always as a new frame rather than a new window

texts: Assume that I have already opened a file with emacs. Is it possible to force emacs to re-open that file in another frame when I re-open that file intentionally or a third party program open that file with emacs ?


texts: How do I jump to the next sentence in evil?

texts:
When i press ) in Vim it jumps to the next sentence.  In evil, however, ) (evil-forward-sentence) at the beginning of the following paragraph takes you to the paragraph's end, while in Vim it jumps to "Donec a diam":

  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor.

Is this a bug or a config error on my side?


texts: How can I configure overlay text to be read-only? I know there is a text property read-only, but that's not exactly what I want to use.


texts:
Let's say I need to associate symbols with directories, and this will only need to be done for a small number of boundp symbols.

The way I see it, there are two easy ways to do that:

Store this association in a separate variable (alist or a hash map). This way the directory of each symbol would be accessible with (cdr (assq SYMBOL my-alist)).
Store this in a symbol property. This way, it would be accessible with (get SYMBOL 'my-directory).

Which of these would be the idiomatic way of keeping track of this information?


texts: spacemacs and "file name too long" error on auto-save

texts:
I reorganized some of the folders on my computer, in an attempt to get rid of old stuff and organize useful stuff. So with the new directory structure, I am getting all of these auto-save errors.

Error (auto-save): Auto-saving file1.org: Opening output file: File name too long, /home/xxx/.emacs.d/.cache/auto-save/site/#!....file1.org#
Error (auto-save): Auto-saving file2.org: Opening output file: File name too long, /home/xxx/.emacs.d/.cache/auto-save/site/#!....file2.org#
Error (auto-save): Auto-saving file3.org: Opening output file: File name too long, /home/xxx/.emacs.d/.cache/auto-save/site/#!....file3.org#

I am not sure of the cause of the errors. On thing I was thinking is that my hard drive is encrypted and this might interfere with the auto-save operation.

Is there a way to fix this, short of just moving the files to a different directory? Is there a setting I can change to increase the filename length? Has anyone else found a good workaround for this error.

UPDATE:

As per Stephen's suggestion, Spacemacs sets up the auto-save configuration in its own internal files. There is a single reference to auto-save location in the .spacemacs file. The variable dotspacemacs-auto-save-file-location specifies where a file is saved: the cache, in-place, or no auto-saving. Other than that, there did not appear to be any other configurable settings for auto-save.


texts: create new keybinding for command mode in evil mode

texts:
I am using doom emacs and would like to create a keybinding to run the following line so that I don't need to write it every time I want to run a block of code of python
:w !python

The above line runs python code highlighted in visual mode in the terminal.


texts:
Reading this twitter and applying Pemdas I believe that the answer should be 9, but applying this formula in emacs-calc yields 1:

'6/2(1+2)  ==>
alg' 6 / 2 * (2 + 1)
 1

Hard to believe I'm wrong, but even harder to believe emacs-calc is wrong.


texts: Flush all output in shell buffer (and *Messages* too)

texts:
Is there any easy way to flush all output in the shell buffer? Since recently (I believe Emacs 24.4 already has this) *shell* buffers aren't editable, they behave similar to how typical terminal would behave, i.e. only allowing you to append text at the end, or to flush the last output, but you can't add text at any place or remove part of it arbitrarily. It feels like I'm missing something important about this improvement (?). It actually makes it more annoying. I searched the docs for the *shell* and *Messages* buffers, but couldn't find a mention of the question.

In addition to the original question: what's the point of this change? To me this doesn't feel like an improvement at all, so, unless there's "a catch", I'd like to set it to read-write as default.

I'm talking about Emacs 24.4, 25.0.50.1 of course.


texts:
When flycheck finds too many warnings that do not fit in the mini-buffer, it opens up a window on a buffer named Warnings that looks something like this:
Warning (flycheck): Syntax checker python-pylint reported too many errors (665) and is disabled.
Use ‘M-x customize-variable RET flycheck-checker-error-threshold’ to
change the threshold or ‘C-u C-c ! x’ to re-enable the checker.
Warning (flycheck): Syntax checker python-pylint reported too many errors (665) and is disabled.
Use ‘M-x customize-variable RET flycheck-checker-error-threshold’ to
change the threshold or ‘C-u C-c ! x’ to re-enable the checker.
Warning (flycheck): Syntax checker python-pylint reported too many errors (659) and is disabled.
Use ‘M-x customize-variable RET flycheck-checker-error-threshold’ to
change the threshold or ‘C-u C-c ! x’ to re-enable the checker.
Warning (flycheck): Syntax checker python-pylint reported too many errors (667) and is disabled.
Use ‘M-x customize-variable RET flycheck-checker-error-threshold’ to
change the threshold or ‘C-u C-c ! x’ to re-enable the checker.

How to stop this window from opening? It is extremely obtrusive and annoying.


texts:
I just downloaded a fresh installation of the Haskell platform on Mac El Capitàn:

    brew cask install haskell-platform

and a fresh installation of the Haskell layer for spacemacs:

   dotspacemacs-configuration-layers
   '( ;;; lots of other layers
     haskell)

However, I get errors on almost every keystroke in emacs

Try installing a more recent version of haskell-stack-ghc, and please open a bug report if the issue persists in the latest release.  Thanks!
Suspicious state from syntax checker haskell-stack-ghc: Flycheck checker haskell-stack-ghc returned non-zero exit code 1, but its output contained no errors: Downloading lts-10.0 build plan ...
Downloaded lts-10.0 build plan.
AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\""

This results in very slow operation as it (apparently) redownloads lts-10.0 build plan on almost every keystroke.

The rest of the interface to the ghci interpreter seems to work. The defect only affects my editing in Haskell mode.

I'd be grateful even for hacky workarounds not including just disabling Haskell-mode.


texts:
I'm trying to build a simple proc that copies the text on which the point is set and returns the point to where it was, but can't make it work properly.
Before you say "thing-at-point" - I cannot install it (work network).
My proc looks like this:
(defun string-at-point ()
 "copy string around point"
 (interactive "")
 (point-to-register ?y)
 (re-search-backward "\_<" nil t 1)
 (setq mark-active t)
 (re-search-forward "\_>" nil t 1)
 (call-interactively 'kill-ring-save)
 (register-to-point ?y)
)

Thing is, it only copies parts of the text.
Sample text:
this is some /very/long/name-of/my.file/that-might_contain_letters/andnumbers0-9/anywhere in it.
I expect my proc, when placed inside the long string (say - point is at 0), to copy the string and leave the point back at 0.
instead, it copies 0-9/anywhere in it. (meaning - until the end of the line).
Also tried using "\\_>" and "\\_<" in the re-searches, but got even weirder results...
What am I doing wrong?


texts: Evil: Is there a default register that does not get overwritten by later yanks to explicit registers?

texts:
I often use registers in evil, but I have a common use case that I cannot seem to resolve.  I would like to have all copied text stored somewhere that does not get overwritten when I explicitly make another copy to a specific register.

Here is an example:

I want to copy this FIRST line, so I copy it (without explicitly using a register)
I later realize that I want to copy this SECOND line as well, and I want to be able paste it separately from the FIRST line, so I copy it to a register (ie register j via "jVy)

I can easily paste that SECOND line (ie "jp), but how can I paste the FIRST line? The default register is overwritten by my second copy command (ie "*p would paste the SECOND line) and my clipboard stores the SECOND line as well (ie p would paste the SECOND line).
In sum, I don't want to explicitly use a register for all of my copy commands - that is too tedious. Is there a "default" register that I can use that is not overwritten when I copy to a specific register? Perhaps I can bind all copy commands to a specific register?
UPDATE
I prefer a solution that uses pure vim/evil commands, so that it is extensible for my other vim editors and vim plugins (ie JetBrains' idea-vim). I found my solution by using the 0 register. In my example above, I can paste the FIRST line by running "0p.
In hindsight, I think this solution would have been better suited for a vim-related forum, but I hope it proves helpful for other Evil-mode users.


texts: What is the logic behind the weird lisp docstring (left) indentation?

texts:
Why is the third line in this code indented "too much" to the left?
It feels "off" to me.

(defun hello-world nil
  "Greet the world.
This function implements the canonical example program."
  (interactive)
  (message "Hello world!"))


texts:
I'm entirely new with Emacs. I'm trying to split vertically my window, but I can't.

Googling, I've discovered the commands to do it is C-Mouse-2. So I clicked Ctrl+scroll button+2 but it matched C-down-mouse-2.

So how can I deploy C-Mouse-2?


texts:
I'm trying to get Emacs to align operands vertically.

Current behaviour

#include <iostream>

void main()
{
    std::cout << 1 + 2
        + 3;
    return 1 + 2
        + 3;
}

Wanted behaviour

#include <iostream>

void main()
{
    std::cout << 1 + 2
                 + 3;
    return 1 + 2
           + 3;
}

My research so far suggests that I probably want to add something to align-rules-list, but I can't figure out what. c-show-syntactic-information on the continued line returns:

  Syntactic analysis: ((statement-cont 76))

Update

I've found out that I probably can solve my problem with c-offsets-alist. The following snippet lines up assignments, strings and cascaded calls correctly, but it doesn't work for streams and return.

(setq c-offsets-alist '((statement-cont . (c-lineup-assignments
                                           c-lineup-math
                                           c-lineup-string-cont
                                           c-lineup-cascaded-calls
                                           +))))


texts: How to define yasnippet templates using elisp instead of the file system?

texts:
I would like to use YASnippet template system to expand abbreviations. (I don't want to use abbrev-mode which use space or symbols for expansion.)

It is not convenient to create a new file for each of my abbreviation.  Could I define yasnippet templates using elisp (in init.el) instead of using the YASnippet files structure?


texts:
After running something with M-x some-command, how do folks get back to the same command?

In this example (assume C-x w h is not available please)
I try to match some text between DATABASE_URL=wildcard<space>, and after learning it fails, I go back to revising the regex by doing

M-x
hi space regexp

Note that's ten key presses. I'm guessing theres a way to do it with 2 or 3 presses.
Can I simply tell emacs to simply "invoke my most recently invoked M-x command"?

NOTE: I do not know beforehand when I'm running a M-x command whether I would need to re run it.  So, macro recording is not suitable for this use case.


texts:
I imagine it would be possible, with the tables

| food    | kcal/hg |
|---------+---------|
| sausage |     281 |

and

    | food    |   g | kcal |
    |---------+-----+------|
    | sausage | 100 |      |

that is, with a table of food names and kcal/hg values and a
table of names and g values, automatically to calculate the kcal
values in the second list.  But how exactly is that to be done?


texts: Org-src-fontify-natively makes Magit think there are unsaved files

texts:
I've got a weird one for you. When all of the following are true:

I'm using org-mode
My org-mode file has a code block
I export the org file
org-src-fontify-natively is true

Then I get a leftover buffer with a name like " org-src-fontification:clojure-mode". It's considered an "invisible" buffer, so it only shows up when listing buffers from Elisp code. It does not appear in the interactive buffer list.

The next time I refresh my magit-status, I get prompted to save a file. There's no option to skip it! If I save the file, it has the contents of the leftover internal buffer.

If I turn off org-src-fontify-natively then this doesn't happen. But my exports also don't get nice fontification either.

Is there some way to either discard that buffer, or convince magit to ignore it?


texts: Yasnippet & AutoInsert cutting off template when inserting sub-snippet

texts:
So following some examples online, I've got autoinsert and yasnippet set up so that the template gets handled like a snippet.
I'm trying to sort out how to include other templates but I'm running into a weird issue I can't quite sort out.
So in my config I've got the following:
  (defun sh/autoinsert-yas-expand()
    "Replace text in yasnippet template."
    (yas-expand-snippet (buffer-string) (point-min) (point-max)))

  ;;; skipping other config stuff

  (define-auto-insert "\\.go?$" ["default-package.go" sh/autoinsert-yas-expand])

default-package.go is this:
package `(file-name-nondirectory (directory-file-name (file-name-directory buffer-file-name)))`

`(yas-expand-snippet (yas-lookup-snippet "header"))`

$0

And that header snippet looks like this:
# -*- mode: snippet -*-
# name: biba-header
# key: biba-header
# --
/**
 * File: `(sh-get-file-name)`
 * Date: `(sh-get-timestamp-ver1)`
 * Revision: 1
 * Creator: Sean Hagen <sean@company.com>
 * Notice: See LICENSE.txt for modification and distribution information
 *
 * Copyright © `(sh-get-year-only)` by Company Inc.
 */$0

This... mostly works.
What I get when I create a new file is the following:
package mapper

t/**
 * File: example.go
 * Date: 2021-03-18 17:26:57
 * Revision: 1
 * Creator: Sean Hagen <sean@playbiba.com>
 * Notice: See LICENSE.txt for modification and distribution information
 *
 * Copyright © 2

It mostly inserts the template? But it's adding a t at the start of the snippet, and cuts off before it finishes. Is there something I'm missing, or is this just never going to work?


texts: How to automatically use rjsx-mode instead of js-jsx-mode

texts:
When I work with JSX files Emacs automatically switches to js-jsx-mode and acts sluggishly. When I switch it to rjsx-mode it works much faster. So the idea is to override one mode with another, so that rjsx-mode is used instead of js-jsx-mode.
What is the best way to achieve this effect?


texts: How to scroll up when expanding a section in magit-status?

texts:
In the magit-status buffer, pressing TAB shows or hides a given section, which is handy when looking at unstaged content and see what hunks can be staged.

However, when tabbing on a section, the buffer goes down, so the section I am trying to expand goes to the bottom of the buffer, thus hiding the expanded part of the section.  I then have to cycle using recenter-top-bottom to bring the section back to the top of the buffer.

Is there a way to automatically bring the section / entry to the top of the buffer when expanding it?


texts:
This question was originally asking for a custom progress indicator, but I've since removed the 'custom' requirement because I think the generalized case is more helpful to others.

I have added a command that takes a while to execute. Therefore I'd like to temporarily display a buffer with an animated textual progress indicator (rotating \|/-, perhaps) that updates with some frequency to show that the command is still running.

What's the best way to go about doing this?


texts: Skip vertical whitespace/non-whitespace blocks (sort of vertical M-f / M-b)

texts:
Say the point is on the  0 here:

as0sasasa
asasasasa
as1sasasa
    asa
as3sasasa
asasasasa
as2sasasa

I'd like to have a command – like a vertical forward-word – that when run repeatedly would jump first to point 1, then to point 2. And another command – a vertical backward-word – that would then jump back to 3, and finally to 0 again.

Use cases (see comments)

I have some tables in LaTeX that are structured like this:

header    text    text    text
          text    text    text
          text    text    text
header    text    text    text
          text    text    text
          text    text    text

This command would be useful to jump to the different instances of header.
Also, I often format plain text like this

texttexttexttexttexttext
  texttexttexttexttexttext
  texttexttexttexttext
  texttexttexttexttexttexttext
  texttexttexttexttexttext
  texttexttexttexttext
texttexttexttext
  texttext
    texttexttext
    texttexttext
texttext

And I'd use this command to skip the more deeply indented parts of the text (the “stops” would be at the bold italic letters if starting from the x).

Update

I've been given a solution to a similar request on Jump to non-whitespace characters along a column.


texts:
I'd like to set things up so that I can use emacs on multiple computers, with the .emacs.d directory shared amongst them (via DropBox).
My solution so far has been to use environment variables which are then read in my init.el.  The computer-specific environment variable then tells me where to find the computer-specific recentf file, etc, etc.
On Windows this works great because one can set environment variables via a control panel option.
I'm trying to figure out how to get computer-specific environment variables to work in emacs on MacOS.  Ideally, I'd like to be able to launch emacs from both Spotlight and from a terminal window (iTerm2, specifically).
I found a StackOverflow answer about getting environment variables into GUI apps but it doesn't seem to work (emacs still has troubles loading the computer-specific files because the environment variable doesn't appear to be set in the init.el).
I'd like to avoid setting up .bash_profile to set the environment variables so that I can share my .bash config files through DropBox, as well


texts: Is it safe to comment out the "custom-set-variables" part in your init file?

texts:
Recently I had some font lock mess with auctex (similar to this). To solve the problem I commented out my init file part for part and realized that the problem is inside the custom-set-variables section.
I just realized that this section contains much clutter I don't need anymore (long time ago when I started using emacs I used the graphical customization interface, but I don't use it anymore today and configure everything via elisp in my init file directly).
So, is it safe to comment out or delete this section?


texts: How to generate a PNG from a TikZ figure with org-babel?

texts:
I'm try to use org-babel to generate images from tikz code.
The first code (take from this example) works perfectly, but when y want to export the tikz figure in  a png (or a jpg) I have an error like :
org-compile-file: File "/tmp/babel-RNLDyr/latex-o3rO8d.pdf" wasn’t produced.  See "*Org PDF LaTeX Output*" for details

I can't find the cause of this error and the "Org PDF LaTeX Output" buffer does not exists.
Code use to make a svg (It's work) :
#+HEADER: :file ./images/contour.svg :imagemagick yes
#+HEADER: :results output silent :headers '("\\usepackage{tikz}")
#+HEADER: :fit yes :imoutoptions -geometry 400 :iminoptions -density 600
#+BEGIN_src latex
\begin{tikzpicture}
\draw[->] (-3,0) -- (-2,0) arc[radius=0.5cm,start angle=-180,end angle=0] (-1,0) -- (1,0) arc[radius=0.5cm,start angle=180,end angle=0] (2,0) -- (3,0);
\filldraw (-1.5,0) circle[radius=1mm];
\filldraw (1.5,0) circle[radius=1mm];
\end{tikzpicture}
#+END_src

Code use to make a png (It does not work) :
#+HEADER: :file ./images/contour.png :imagemagick yes
#+HEADER: :results output silent :headers '("\\usepackage{tikz}")
#+HEADER: :fit yes :imoutoptions -geometry 400 :iminoptions -density 600
#+BEGIN_src latex
\begin{tikzpicture}
\draw[->] (-3,0) -- (-2,0) arc[radius=0.5cm,start angle=-180,end angle=0] (-1,0) -- (1,0) arc[radius=0.5cm,start angle=180,end angle=0] (2,0) -- (3,0);
\filldraw (-1.5,0) circle[radius=1mm];
\filldraw (1.5,0) circle[radius=1mm];
\end{tikzpicture}
#+END_src


texts: A possible incompatibility between `toggle-frame-maximized` and a mode using `visual-line-mode`

texts:
I have (toggle-frame-maximized) in my init file. If I enable the ospl-mode (btw very handy mode) given in the answer https://emacs.stackexchange.com/a/473/, then I minimize the frame, Emacs (GNU Emacs 24.5.1) get frozen. Any idea why this happens? I also checked this with emacs -Q the same happens.

Edit 1: The OS is windows, for minimizing I click on the middle icon of the bar of emacs window (see the image below)

Edit 2: It seems that I have localized the problem a little more, if I do the following steps Emacs get frozen (unresponsive), I am wondering if other people can test the following steps to see what happens for them.

Start with emacs -Q
Eval (toggle-frame-maximized)
Then Eval all of

(visual-line-mode 1)
    (setq right-margin-width (- (window-body-width)  fill-column))
    (set-window-buffer (selected-window) (current-buffer))
Click on the icon which looks like a double overlapping squares (see the above image, the icon between - and X).


texts: Controlling Behaviour of (Compilation) Window Creation

texts:
How do I control whether the output buffer *Compile* of M-x compile will be shown

in an existing window or
in a new window by splitting an existing window

?
My problem is that the compilation buffer is opened in an existing window that I want to leave unchanged for other content.
AFAICT, this behaviour is controlled by display-buffer.


texts: Dynamically hide lines indented more than current line

texts:
Is there a way to dynamically hide lines that are indented more than the current line?

For example, if I am looking at this file

{
  "a": 1
  "b": {
    "c": {
      "d": 2
    }
  }
}

and I am on the line with "b", I would see something like

{
  "a": 1
  "b": {
  }
}

and if I move down one real line, I then see

{
  "a": 1
  "b": {
    "c": {
    }
  }
}

I suspect that a minor mode that does (set-selective-display (indentation-of-current-line)) after each movement of the point is what I want.  Although I would also want a simple what to go to the first line of the hidden region.  Which is probably simple to do, but I'm not immediately seeing it.


texts:
When I do a double click, I don't see any selection.
Is there anything I need to enable to make it work?
Other mouse functionalities work fine.
See http://www.gnu.org/software/emacs/manual/html_node/emacs/Word-and-Line-Mouse.html

Here is my mouse configuration

;; Enable mouse support
  (require 'mouse)
  (xterm-mouse-mode t)
  (global-set-key [mouse-4] (lambda ()
                              (interactive)
                              (scroll-down 1)))
  (global-set-key [mouse-5] (lambda ()
                              (interactive)
                              (scroll-up 1)))
  (defun track-mouse (e))

EDIT:
I use emacs through a terminal: I ssh from ubuntu terminal to a remote machine and run emacs -nw on the remote machine.


texts: It throws the error After 0 kbd macro iterations: isearch-search: Keyboard macro terminated by a command ringing the bell and I have no idea why, nor can I find anything about it by searching. Any help?


texts:
I essentially want to bring up the helm buffers list and hit RET. This goes to the previous buffer in an alt-tab-like manner.

Thought this would do the trick but stops short of actually exiting the minibuffer:

(defun helm-alt-tab ()
  "Acts as a buffer alt-tab using helm."
  (interactive)
  (helm-buffers-list)
  (helm-maybe-exit-minibuffer))


texts:
I'm trying to define a key binding that executes a sequence of commands. I add this code to my ~/.emacs file

(require 'origami)
(defun open-close-node ()
  "Open/Close node origami mode"
  (interactive)
  ('origami-open-node)
  ('origami-close-node))

(define-key origami-mode-map (kbd "C-c C-f") 'open-close-node)

Emacs start with no errors, but when i try to use the key binding, shows this open-close-node: Invalid function: (quote origami-open-node)

EDIT:

What i really trying is to adapt this to my case.
By the way, I'm pretty new with lisp language.

I just want a fast key binding to open/close the nodes within origami-mode


texts: How to set up Magit to access a GitHub repository?

texts: How can I set up Magit to access a GitHub repository?


texts:
How can I change the color of the comments starting with -- | in Haskell mode?

When I write a comment in Haskell I get a grey face, but when the comment starts with -- |, as required by Haddock documentation lines, it takes a green one. I have tried to change the Haskell Literate Comment Face to inherit from font-lock-doc-face to font-lock-comment-face, but it has had no effect over the comments starting with -- |.

Edited:
Ok. Now I see the problem. The face of these comments is not Haskell Literate Comment Face, it is directly font-lock-doc-face (?). If I change it, the comments reflect the change. But why is it like this? I would like to change the color of the doc-comments only for Haskell, not globally.


texts: Dired, colorize (change face) marked files/folder and save between sessions

texts: I was wondering if anyone knew a way to mark some files/folder in dired and then colorize (change face for BG/FG) them. this would also need to be saved even after Emacs restarts.


texts: how to add a prefix key to all keybindings of a specific mode?

texts:
i am using a mode, but am not used to its key-bindings: some of them conflict to the emacs global ones. so, i want to add a prefix key-binding to all its existing keybindings.

for example, if my-mode defines key-binding M-] for my-mode-shot, i am looking for some ways as following:

(define-prefix-for-mode 'my-mode (kbd "C-c m"))

then the key-binding for my-mode-shot now is C-c m M-].

how should one add a prefix key-binding to all available key-bindings of a specific mode?


texts: Change size of wavy underlines for HiDPI displays

texts:
I'm running emacs on Linux with HiDPI display and all X environment I successfully tuned to support it, but in emacs wavy underlines are still looking extremely thin (relatively to font size).

I've checked face settings, but it allows only to customize color and style (wavy or line) of underlines.

Are there any other options that controlling width/size of underlines?


texts: src python in org-mode: IndentationError: unexpected indent

texts:
mac 10.13.4 / emacs 25.3 (9.0) / org-version 9.1.12 / python 3.5.2

I am trying to understand why C-c C-c generate an IndentationError: unexpected indent when executing a simple code like the example below as a code block:

#+BEGIN_SRC python :session :exports results
  def spam():
      try:
          a, b = 1, 2
      except:
          a, b = 11, 12
      finally:
          a = 'voila'
#+END_SRC

my init.el is as follows:

    ;; Set org mode
    (eval-after-load "org"
      '(org-babel-do-load-languages
        'org-babel-load-languages
        '((sh . t)
          (python . t)
          (emacs-lisp . t)
          (ditaa . t)
          ))
      )
    (setq org-src-tab-acts-natively t)

I have actually written this python code in a python buffer (C-c') and it works everywhere else except in the org-mode.
I would really appreciate any lead


texts: Where to download image library for Emacs 64bit Windows version?

texts:
I would like to use Emacs 64bit Windows version to view images sometimes, PNG images and JPEG images mostly.   The README file says:

  Emacs can also support some other image formats with appropriate
   libraries.  These libraries are all available on the following sites:

  http://sourceforge.net/projects/ezwinports/files/
  -- leaner, more up-to-date builds, only for 32-bit Emacs
  http://www.gtk.org/download/win32.php
  http://www.gtk.org/download/win64.php
  -- the GTK project site; offers much fatter builds, but includes
     64-bit DLLs (from the 2nd URL)
  GnuWin32 project -- very old builds, not recommended

The URLs in the 2nd point are no longer valid. I've googled a lot and still haven't found a place to download 64bit image libraries.

I used to use Emacs 32bit and I could download the image libraries from http://sourceforge.net/projects/ezwinports/files/

Question is,  now using the 64bit,  where can I can download the PNG & JPEG image libraries?


texts:
I got this setup:

but the pass module says it can't find the entry "irc/freenode". I have constructed this by looking at the pass tests, and i am most certainly doing it wrong. Can somebody help me do it right?