texts: How to append spaces to align by next word in the line above

texts:
I am looking for a function helping indenting imports.
I noticed following pattern.
Origin file:
import       A.B.C          (x, y, z)

Result file:
import qualified A.B.C          (x, y, z)
import           Z.X.Y          (a, b, c)

After typing import I need to insert arbitrary number of spaces to align Z.X.Y with A.B.C and parenthesis expressions with line above. Doing this manually is tedious.
I could spend a day to write such function, but I bet it must be already implemented by somebody.


texts: Large org-mode file causes error "Re-entering top level after C stack overflow"

texts:
I use org-mode quite a lot and of late I have noticed one of my larger org-mode files has caused Emacs to throw this error:
Re-entering top level after C stack overflow

I tried debugging using the usual debugging mechanisms, including debugging a single function [1] but I could not get any additional information on the problem. Note also that I used the file for a very long time without seeing any problems, and I have much larger org-mode files which do not suffer from this issue.
[1] https://stackoverflow.com/questions/8273546/emacs-how-to-see-how-to-debug-a-single-elisp-function-emacs-command


texts: Why there is a dash after I type C-c . (period)?

texts:
I want to insert a timestamp under org-mode. As stated in the official tutorial of org-mode, C-c . should be enough for inserting a timestamp.

However, when I type C-c ., it shows C-c .- and is waiting for one more input. If I then type other keyboards, Emacs says that this command is undefined.

If I start Emacs with emacs -Q and type C-c ., I get C-c . is undefined.

What is going on, and what am I doing wrong?


texts: How to set time to AM/PM for Org clocking?

texts:
Currently, clocking time format is this:
    CLOCK: [2021-01-12 Tue 22:45]--[2021-01-12 Tue 23:23] =>  0:38
    CLOCK: [2021-01-12 Tue 16:29]--[2021-01-12 Tue 17:08] =>  0:39

Can I change this instead to the AM/PM 12-hour format that I have grown up with?
I looked for the answer online, and I found this good question/answer as a reference: https://stackoverflow.com/questions/22720526/set-clock-table-duration-format-for-emacs-org-mode
I am using org-version 9.3 and emacs-version 27.1. Apparently for org versions 9.1 and above:
(setq org-duration-format (quote h:mm))

the above variable, org-duration-format is to be used. However, I cannot find documentation on how to change this to 12 hour AM/PM format.
The equivalent in elisp string formatting would be "%I:%M %p". However, org-duration-format does not accept string values. The online documentation for formatting time in elisp can be found here.


texts: Process unread-command-events and redisplay

texts:
(defun pretend (keys)
  (dolist (e (reverse (listify-key-sequence (kbd keys))))
    (push e unread-command-events)
    ;; (mystery-function)
    (redisplay t)
    (sleep-for 0.1)))

(pretend "M-x my-function-")

This function is intended to take key events and 'pretend' they were entered by the user at a reasonable pace of 100ms/key. Unfortunately, it doesn't seem like unread-command-events is being processed – probably because emacs is not idle during execution.  One way to get around this is to abuse run-with-idle-timer, but this seems like the wrong approach.

How can I process/flush unread-command-events before continuing execution?

(I suspect I won't need the call to reverse after this is fixed.)


texts: "Unable to activate package" when starting Emacs

texts:
I get the following message when starting Emacs:

Warning (emacs): Unable to activate package `elpy'.
Required package `highlight-indentation-0.5.0' is unavailable
Warning (emacs): Unable to activate package `elpy'.
Required package `highlight-indentation-0.5.0' is unavailable
Warning (emacs): Unable to activate package `elpy'.
Required package `highlight-indentation-0.5.0' is unavailable

I then found this Q&A:
Find elisp origin of warning

So I followed the accepted answer and added the following to the top of my .emacs file:

(setq debug-on-message "Unable to activate package `elpy'.")

and then restarted Emacs, but nothing happened. Was I supposed to fall into the debugger?

How can I find what specific line in my .emacs file trigger the warning?


texts: What's the format of a `package-desc` for `package-install`?

texts: The documentation of package-install says: "Install the package PKG. PKG can be a package-desc [...]", but then it doesn't explain what is the format of a package-desc.


texts: Is there a way to make a whole spellcheck in a buffer instead of check every word as you type using flyspell, like using aspell  command with a file ?


texts: How do I make Magit only show diff for unstaged changes?

texts: The default git behavior is to show only unstaged changes (ignoring stuff that I have staged/git added). How do I do that in Magit?


texts: multiple marked files in `dired-do-async-shell-command ` open seperate instances of app (picard)..how does one pass them as a list?

texts:
So I'm trying to send a bunch of marked files to picard with dired's '&' (dired-do-async-shell-command).
In the normal command line this opens one instance of picard with all the selected files:

picard 01\ -\ Snail\ -\ Underwater.ogg 02\ -\ Alain\ Johannes\ -\ Kaleidoscope.ogg

But in dired when I mark a few files and issue & picard I get two instances of picard.

How does one make dired send all mark files into one picard instance?


texts: org Images in LaTeX export set default width

texts:
By default these org lines:

my image:
[[./figure1.png]]

are exported into these ones in latex:

\includegraphics[width=.9\linewidth]{./figure1.png}

How can I change the default value of width \width=.9\linewidth?

I know that it is possible to change locally just before each picture, but it is possible to set another default value?

#+ATTR_LATEX: :width 0.98\linewidth
[[./figure1.png]]


texts: How to chain isearch-forward-symbol-at-point and query-replace-regexp into a single keybinding?

texts:
I'm looking to create a keybinding that will perform the following shortcut:

call isearch-forward-symbol-at-point
call query-replace-regexp

It's basically a shortcut for the following key combo: M-s . then C-M $

Here is my attempt, but my elisp is rather weak:

(global-set-key (kbd "C-x r")
    (lambda ()
      (interactive)
      (query-replace-regexp (isearch-forward-symbol-at-point))))

Any suggestions?


texts: Show only headers in outline mode when I open my dot emacs

texts:
I use outline-minor-mode to organize my .emacs file. I have this code at the end to activate it in the file:
;;; Local Variables:
;;; eval: (outline-minor-mode 1)
;;; eval: (hide-body)
;;; outline-regexp: "^;;; "
;;; End:

When the file opens however, it shows all the contents, but I would like to see only the headings. How can I achieve this?


texts: What's this `slot-missing: Invalid slot name: "#", :incompatible`

texts:
After updating to magit 20190517.1750 from ELPA, I've got this warning

slot-missing: Invalid slot name: "#<transient-prefix transient-prefix>", :incompatible

which breaks a lot of magit functionality.  Does somebody know a fix or a quick workaround?


texts: auctex and pdf-tools in 2 separate frames for dual monitor setup

texts: For auctex with pdftools it is convenient for me (eyesight problems) to have the emacs latex frame on my laptop close to my eyes, and the corresponding pdf (in pdftools) on a separate frame on the dual monitor. How can this be implemented? i.e., emacs latex source in one frame and corresponding pdftools pdf in a separate frame. (Typically latex and pdftools exist in the same frame with two different buffers e.g. with C-x 2; but I want two different frames so that I can drag these frames independently to different monitors)


texts: Org-mode filtering PRIORITY=B retrieves all items

texts:
I'm trying to write a custom block agenda that simply lists all items with priority B:

("b" "Priority=B"
  ((tags-todo "+PRIORITY=B"
   ((org-agenda-overriding-header "Priority B")
    (org-tags-match-list-sublevels nil)))))

For some reason, this returns an agenda with all of my TODOs. I actually currently don't have anything marked priority B. A custom agenda looking for PRIORITY=A or PRIORITY=C works just fine.

I have the same problem if I just do a standard agenda filter (C-c a m PRIORITY=B). Again, priority A and C work just fine.

Does anybody know why this is happening? Sorry, it's hard to make a minimal working example, since that requires an org file.


texts: How can I move a headline and all siblings under another headline?

texts:
If I have an outline that looks like this:

* a
* b
** c
** d
** e

How can I most efficiently move c and d and e under a? And what if, instead of a and b being in the same .org file, a and b are in different .org files?


texts:
I know that there is a calendar in Emacs and I want to use it. After a lot of Google searches, and also after reading Emacs' manual, I still have no idea how to use it. The only thing I have succeeded is to view a buffer with 3 months.

What I want to do is use it like the Google Calendar so to be able to write entries in the days I want and some notes.

I have seen that there are also some other options available like the diary but the only thing I have find for it is a description so I don't actually know what it is! How can someone use Emacs as a Calendar and what are the options to do so (Calendar, Diary etc)?


texts: What is the "customize" feature associated with defcustom and used in projectile.el?

texts:
Asking this question because it's really hard to Google "emacs customize" and get to the feature.
From the defcustom documentation:

You can specify variables using defcustom so that you and others can then use Emacs’s customize feature to set their values. (You cannot use customize to write function definitions; but you can write defuns in your .emacs file. Indeed, you can write any Lisp expression in your .emacs file.)
The customize feature depends on the defcustom macro. Although you can use defvar or setq for variables that users set, the defcustom macro is designed for the job.

I haven't been able to figure out what "customize" is from this definition.
For completeness I am reading the projectile.el source code where this is used (although I don't really expect the answer to depend on the package).


texts:
How can I make an alternative keyboard key (e.g. the Windows key) act as the meta key in emacs?

I am looking for a solution internal to emacs, so using xmodmap is out of the question.


texts: How to write a function for editing a file and then running a command?

texts:
I would like to write a function that does the equivalent of the shell command:

vim $MY_FILE && $MY_COMMAND

In other words, I would like to open a file in a buffer, and then when I save/close that buffer, I want it to run a certain shell command. How would I do this?

Furthermore, the shell command must be run in su mode, so I need to either run it in an interactive shell so that the sudo mode prompts for the password, or maybe have a popup that asks for the superuser password somehow.


texts:
Using Emacs 24.4 with projectile and helm I am trying to customize some faces of the grep results.

;; Helm face customization (M-x helm-colors)
(set-face-underline-p 'helm-selection nil)
(set-face-underline-p 'helm-grep-file t)
(set-face-background 'helm-match "#002b36")
(set-face-foreground 'helm-match "#CB4B16")
(set-face-background 'helm-grep-match "#002b36")
(set-face-foreground 'helm-grep-match "#CB4B16")

By default with solarized-theme files are underlined and candidates on cursor as well. What I'm trying to achieve with lines 1 and 2 is:

Disable underlining on cursor
Keep files underlined, even on cursor

I assume that 'helm-selection is computed everytime I move my cursor and update the styles, thus files won't be underlined.

Is there a way to provide something like !important (CSS) to face attributes in Elisp ?


texts: Why does running my tests with ert-run-tests-batch-and-exit fail

texts:
I have written a few simple tests, when I run them on the buffer inside emacs everything passes.

However, when I run them in batch mode as shown below, it fails. What can explain this?

emacs -batch -l ert -l mytests.el -f ert-run-tests-batch-and-exit

Here's the output from one of the failing tests:

Test pp-test-docker-container-names backtrace:
  (let ((container_ids (split-string (dc-docker-run-return "ps -q" ""
  dc-docker-names()
  (list (dc-docker-names) (quote (nil)))
  (let ((fn-89805 (function equal)) (args-89806 (list (dc-docker-names
  (progn (fset (quote shell-command-to-string) vnew) (let ((fn-89805 (
  (unwind-protect (progn (fset (quote shell-command-to-string) vnew) (
  (let* ((vnew (function (lambda (_) ""))) (old (symbol-function (quot
  (closure (t) nil (let* ((vnew (function (lambda (_) ""))) (old (symb
  #[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\317\320%DC
  funcall(#[0 "\306\307!r\211q\210\310\311\312\313\314\315!\316\"\31
  ert--run-test-internal([cl-struct-ert--test-execution-info [cl-struc
  #[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\"\315\316%DC\2
  funcall(#[0 "r\304 q\210\305 )\306\307\310\311\312\313!\314\"\315\
  ert-run-test([cl-struct-ert-test pp-test-docker-container-names "Tes
  ert-run-or-rerun-test([cl-struct-ert--stats t [[cl-struct-ert-test p
  ert-run-tests(t #[385 "\306\307\"\203D\211\211G\310U\203\211@\20
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("-l" "ert" "-l" "docker-compose.el" "-f" "ert-run-te
  command-line()
  normal-top-level()
Test pp-test-docker-container-names condition:
    (void-function loop)
   FAILED  2/2  pp-test-docker-container-names

Any ideas ?


texts:
Is there a package or code snippet that can make Emacs add recent files to .viminfo? I want this to use with v. (Basically to open recent files using fzf)

I’m using Spacemacs (so evil, too), if that matters.

Ps: Where does recentf save its data?


texts: issues with swiper char-folding and prescient

texts:
With following packages installed and correctly set up: ivy ,swiper, prescient, ivy-prescient and Emacs v27.1, there is a very special issue.
The question is, which component is to blame (aka which project should receive the bug report)?
With a working setup of above mentioned packages, set following options, which trigger the issue
(Note: those are all default settings):
(setq ivy-re-builders-alist
      '((t . ivy-prescient-re-builder)))
(setq prescient-filter-method
      '(literal regexp initialism))
(ivy-prescient-enable-filtering t)
(setq prescient-use-char-folding t)

Issue: now try to use swiper to search in an elisp file for ^(.
It does not find any matches!

The workarounds I found set either:
(setq prescient-filter-method
      '(regexp initialism literal))

or set
(setq prescient-use-char-folding nil)

Then above search succeeds and finds candidates.

To reproduce this issue, do: emacs -Q
(add-to-list 'load-path "~/.emacs.d/elpa/ivy-20210311.1638/")
(add-to-list 'load-path "~/.emacs.d/elpa/swiper-20210310.1230/")
(add-to-list 'load-path "~/.emacs.d/elpa/prescient-20210227.600/")
(add-to-list 'load-path "~/.emacs.d/elpa/ivy-prescient-20210227.600/")

(require 'ivy)
(require 'swiper)
(ivy-mode)
(require 'prescient)
(require 'ivy-prescient)
(ivy-prescient-mode)

(swiper)

Then eval-buffer and enter your search strings.


texts: Modeline artefacts around powerline arrows

texts:
I'm using vanilla powerline with solarized theme:

(require 'powerline)
(powerline-center-theme)
(load-theme 'solarized-light t)

And I get these artefacts (the malformed and sticking-slightly-above-modeline arrows), both when loading a theme after:

... or before powerline:

It happens in other themes as well, so solarized likely isn't at fault. Have you encountered this issue or would guesstimate what might cause it (e.g. (global-linum-mode 0))?

Emacs 24.4, OS X 10.10.3


texts: Keeping that evil cursor from running off

texts: In Evil, as in Vim, combining an operation with a movement moves the cursor to the beginning of the text operated on.  For example, if I'm in the middle of a line and type gU^, then everything from the cursor to the beginning of the current line is upcased; but the cursor is also moved to the beginning of the line.  I would like it better if in general the cursor did not move.  Can this be achieved?


texts:
I want to remove magit local keybinding for "C-w" (to use global one).
But can't find which hook I can use for that.


texts: Is there a configuration of Latex files which can change my key-bindings?

texts:
I am observing what I believe is an odd behavior in Emacs.

I have a Latex file which, when opened, changes the keybindings in my Emacs.

For example, C-x s does not save the file anymore, and Emacs does not find the default pdf viewer upon compiling and visualizing the file.

In the modeline I read:

-UU0:----F1  letter.tex  Top L1  (LaTex Ref)

While normally when I open the other LaTex files I read:

-UUU(DOS):----F1  filename.tex  Top L1  (LaTex/P Ref)

What should I look at?

The file looks like the following:

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{array}
\usepackage{babel}
\usepackage{amsmath}
\usepackage{pstricks}
\usepackage{amsmath,amsthm,amsopn,amstext,amscd,amsfonts,amssymb}
\usepackage{subfig}
\usepackage{graphics,graphicx,epsfig}
\usepackage{xspace}
\usepackage{verbatim}
\usepackage{epstopdf}
\usepackage{color}
\usepackage[round]{natbib}
\usepackage{booktabs}
\usepackage[hyphens]{url}
\usepackage{hyperref}
\usepackage{changepage}
\usepackage{geometry}
\geometry{top=2cm,bottom=2cm,left=2cm,right=2cm}

\newcommand{\C3}{\noindent \textcolor{red}{COMMENT.}\vspace{0.5cm}}

\newcommand{\C2}[1]{
\noindent\hspace{0.2\linewidth}\begin{minipage}{0.8\linewidth}
\emph{#1}
\end{minipage}
\vspace{0.5cm}
}

\newcommand{\C1}[1]{
\noindent #1
\vspace{0.5cm}
}

\begin{document}
\end{document}


texts: how to fix: flake8/pyflakes treats multiline comment before class as error

texts:
I'm using flake8 with emacs. If I begin a file with

# comment comment comment comment comment comment comment comment comment comment
class Foo(object):
    pass

It says there is no syntax error. But if I wrap it to:

# comment comment comment comment comment comment comment comment
# comment comment
class Foo(object):
    pass

I get "E302 expected 2 blank lines, found 0" for the "class" line.

Is this a bug? Can it be fixed with a config setting?


texts: org-babel-execute:sql: reciving erros and no returns

texts:
#+name: Part 1 Task 1
#+header: :engine mysql
#+header: :dbhost localhost
#+header: :dbuser subject
#+header: :dbpassword 1234
#+header: :database hmsec
#+begin_src sql
  SELECT sensorId, type, location
  FROM sensor
  ORDER BY location
#+end_src

org-babel-execute:sql: Wrong type argument: sequencep, 1234
If i removed the password on the server and the password line i get:
org-babel-insert-result: Wrong type argument: markerp, nil

used to guide here: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html

Running the query on the server gives 5 rows.

Please tell me if you need more information.


texts: Is there a way to configure default window split positions when interacting with commands?

texts:
I always enjoyed horizontal splits when interacting with C-h k or a magit commit window, or anything like that.

Now I'm seeing vertical splits when I interact with those commands.

Is there a way to configure this behaviour so I only get horizontal splits?


texts:
I'm trying Projectile + ido + flx-ido (just for Projectile, ido-mode disabled otherwise).

But: I don't like using right and left to switch between items. I want to change them into up and down, but have been unsuccessful:

(define-key ido-common-completion-map (kbd "<down>") 'ido-next-match)
(define-key ido-common-completion-map (kbd "<up>") 'ido-prev-match)
(define-key ido-completion-map (kbd "<down>") 'ido-next-match)
(define-key ido-completion-map (kbd "<up>") 'ido-prev-match)

My question, therefore, is: How do I bind keys in ido-mode?


texts: How to execute a command on the selection (shell-command-on-region) in evil mode, without losing the selection?

texts:
I'd like to use shell-command-on-region on the region, in a way that keeps the selection, even in the case the length of the output changes, and works in regular emacs and in evil mode?

Note, I've already asked this related question which is similar, just not dealing with selection: How to use an external command to modify selected words and lines?


texts: How to kill a running process in compilation buffer in MS Windows?

texts:
I have tried using M-x kill-compilation and it doesn't kill the process (on Microsoft Windows). It just sends ^C, which makes my script to retry.

When I try to M-x kill-buffer on the compilation buffer it kills the process and closes the buffer.

I want the process killed without closing the compilation buffer. How do I send a stronger kill signal in my compilation buffer?


texts: How can I export many org documents to ASCII?

texts:
I have a directory ~/foo/ with hundreds of org documents among other types of files. I want to export each org file to ASCII. The only way I know how to do this is to follow the following procedure

open each file with emacs and issue C-c C-e t a
answer yes to the question Evaluate this emacs-lisp code block on your system?

Can this procedure be automated from the command line?

Update: with the help of @zck's answer, my script now looks like

#!/bin/bash

for file in ~/foo/*.org; do
    emacs --batch -l ~/.emacs \
        --eval "(require 'org)" \
        --insert "${file}" \
        --eval "(org-ascii-export-as-ascii nil nil nil nil '(:ascii-charset ascii))" \
        --eval "(write-file \"${file}.report\")" \
        --kill
done

This does the job but... I have to answer "yes" to the question Evaluate this emacs-lisp code block on your system? for each file. Is there a way to automatically answer yes to this question?


texts: Could magit be writing `.git/index` without my intervention?

texts:
I'm trying to track down an issue which might be caused by magit.

I work on multiple machines, and on each machine I have an emacs running, each of which has some magit buffers open.  I keep machines synchronized using Unison, which propagates changes from each machine to the others.  As long as I make changes only on one machine at a time, it works great.

However, I have noticed that sometimes, I have done some commits, pulls, or pushes on machine A, and Unison refuses to propagate the changes to machine B, because Unison believes that file .git/index has changed not only on machine A (where I made changes myself) but also on machine B (where I believe I have done nothing).  I am wondering if perhaps magit is writing the .git/index file on machine B.

ETA: At minimum, the modification time of the file on machine B has changed (not just the access time).  I don't know if the contents have changed, as I don't usually have a third version to compare it to.

Major search engines and the magit issue tracker have not enlightened me.

My question: Could an otherwise idle magit write file .git/index, and if so, can it be stopped?


texts:
I have a symlink

~/link -> ~/a/really/long/path

When I press ^ in the buffer, it takes me to

~

but I want to go to

~/a/really/long

Is there a right way to do this?

Another question is, if I'm on a symlink file's buffer, how can I find out the buffer's physical path?

Say I'm reading a markdown file ~/a/really/long/path/readme.md, what command can print out the physical path of it?


texts:
A common part of my workflow is to copy and paste file paths into Emacs. This is usually done by navigating to the file in my desktop environment or from a terminal.

What would be more convenient is for me to do so via counsel-find-file, navigate to the file path and then insert at the point in the current buffer (or some similar workflow with autocompletion) instead of actually opening the file.

Is there any way to do this in Emacs?


texts: Draw image outside of emacs and use it in org

texts:
I decided to use killer combination emacs + org mode + latex to take my lessons at school, the only thing that force me to use paper and not be an ecological student is for drawing and painting schemas...

I am aware that there are some mode that let you draw something in ascii some are able to use the mouse (like integrated artist-mode), and export it as a real picture, but it doesn't appeal me, programming picture too.

What would be the best solution for me is to quickly run a painting application from emacs which will export by default the picture in a location that emacs would know so the links to the image would be inserted automatically.

I am sure it is possible, I think it doesn't require that much lisp knowledge, but I still need some help...

I know I can run an external command with exec, I may be able to pass the location in argument of the painting program and inserting the link won't be too difficult.

I need your help for managing images name.

How can I get different default names for each picture ?

Would it be possible to recover the name so I can save it to another name ?

And How can I reopen the application to modify the picture ? (like C-c C-c is able to reevaluate source code... )

I have never coded in lisp, but after configurating a bit emacs it doesn't seem to difficult...

I am excited about lisp coding ! I need your help though.

ps: I am not aware of extensions that do the trick, tell me if there are some.


texts:
this is a lot like the issue described here already.
It seems like the fancy prompt issue, however, I've tried to use sshx which I was told would solve this issue. I an wondering if anyone else have this problem?
Tried:

connected via ssh - successful
connected with TRAMP in Emacs, hangs at "Found remote shell prompt on"
connected with TRAMP using sshx (/sshx:<user>@<host>#<port>:/)


texts:
I just upgraded to modified Emacs

http://vgoulet.act.ulaval.ca/en/emacs/mac/

When I used to work in R files, #' was recognized by ess-mode such that hitting [Enter] at the end of a line that began with #' would start the next line with #'. After the upgrade, it does not seem to recognize #' as a special form.

Any ideas what variable I need to set?


texts: How can I make sure I can stop a long operation in emacs?

texts:
I have a lisp function which performs a transformation on a buffer. It's usually quick, but sometimes it's very slow when the buffer is big.
I can see it's working, because it prints out its progress in the echo area, yet I cannot stop it with pressing C-g.
Is there a way I can ensure it can be stopped? Like could adding a (sit-for 0) to the loop help, so it reacts to C-g?


texts:
I use an org file called books.org to store all the information about my books, including the location of the files (.pdf or .djvu). Usually I open these files directly from Emacs by pressing C-c o. This works like a charm with .pdf which are opened in Evince because I added this lines in my .emacs:

(add-hook 'org-mode-hook
  '(lambda ()
     (delete '("\\.pdf\\'" . default) org-file-apps)
     (add-to-list 'org-file-apps '("\\.pdf\\'" . "evince %s"))))

but not with .djvu which are not opened even if Evince can handle both filetypes. Do you know how I can tell to Emacs to use Evince to open these files?


texts: What is the syntax for a subshell in eshell?

texts:
How to write the analogue of a bash-command like:

(cd ../repo && git fast-export master) | darcs convert import repo_master

in eshell?

Here a subshell is employed to restrict the effect of cd.


texts: How replace auto-complete-mode with company-mode in all major mode using it?

texts:
How I can replace auto-complete-mode with company-mode in all major mode using it?

i.e. make all modes which activating auto-complete-mode (e.g. c-mode or sh-mode etc), activate company-mode instead (and don't activate auto-complete-mode).


texts: Problems trying to turn on auto-fill in a directory local way

texts:
I am inexperienced in Emacs and very new to directory-local variables, so please forgive any obvious things I may be missing.

I am trying to have auto-fill mode activated for all the files in a certain directory.  In this directory, I have a .dir-locals.el file which contains:

((nil . ((eval add-hook 'text-mode-hook 'turn-on-auto-fill)
     (truncate-lines . nil)))
)

(FYI I have truncate-lines set to t in my .emacs file, so that's its "default" value for me.)

After saving this .dir-locals.el file, when opening a text file with Emacs in this directory, I find that truncate-lines is indeed turned off.  However, auto-fill isn't working: the lines I'm writing don't break into new lines.  (My fill-column value is 70.)

When I do C-h v text-mode-hook I get:

text-mode-hook's value is
(turn-on-auto-fill text-mode-hook-identify)
...

but when I don't include the "eval add-hook..." in the .dir-locals.el file, the words turn-on-auto-fill don't appear in the text-mode-hook's value, so the .el file I have appears to be setting something, it just isn't working.

When I do M-x auto-fill-mode, then auto-fill does start working.

Any ideas why auto-fill isn't working for me from my directory local file?  Alternatively, any suggestions for an alternative way to active auto-fill-mode for and only for the files in my directory?


texts: How to implement the piping operator %>% in ESS mode?

texts:
Recently, R witnessed the smart introduction of the piping operator %>% or then operator in code which I use quite frequently nowadays. I wonder if this has already been implemented in the newest version of ESS. If not, it shouldn't be a problem to come up with elisp code to write a function for it. I need to implement this so that it will print that operator %>% and then jumps to a new indented line.

MWE

library(ggplot2)
library(dplyr)
diamonds %>%
      filter(cut=="Ideal") %>%
      ggplot(aes(price)) +
      geom_histogram() +
      facet_wrap (~ color)

My elisp trial - in .init.el or .emacs file:

(defun then_R_operator ()
  "%>% operator or 'then' pipe operator"
  (interactive)
  (insert " %>%") ; note the space before the first %
  (reindent-then-newline-and-indent))
(global-set-key (kbd "C-%") 'then_R_operator)

It works, but I want to check if there is something wrong with it or are there any suggestions to improve it (being a newbie in elisp). How to restrict this only to ESS mode?

Note
I realized that font-locking of %>% can be done by enabling ess-fl-keyword:operatorsfrom the ESS menu.


texts: How to use mail lists with bbdb and message mode?

texts:
I'm trying to follow along here to get bbdb to insert lists of email addresses into my "to" fields when I hit something like "TAB". http://bbdb.sourceforge.net/bbdb.html#SEC39

The section on lists refers to a mail-abbrevs package, which I can't seem to find anywhere. Is there a simple way to just insert a list into my email? The instructions I'm finding seem to be dated.


texts: Helm not working on remote project (Tramp over SSH)

texts:
I'm working on a project that is kept on a shared server (server runs Ubuntu 14.04 LTS; my machine runs OS X 10.10.2). I access the server files via Tramp using a password-secured SSH connection. Whenever I try to use Helm to navigate between files in the project I'm working on, Emacs freezes with the following message in the minibuffer:

Tramp: Opening connection for [username]@[server] using scp...

Emacs is unresponsive after this. A few minutes later, it says the connection was failed:

Tramp: Opening connection for [username]@[host] using scp...failed

It remains unresponsive at this point indefinitely. I need to kill the process or force quit the application so I can reopen it. Backtrace under lldb doesn't give any useful information, probably because the program isn't really crashing - it's being terminated after becoming unresponsive.

Any idea what might be going on / how to diagnose the issue / what to do to fix it?

EDIT: Backtrace available at https://gist.github.com/JDRomano2/eb95345b7cd3c1c71911


texts: Not able to use projectile-mode after installation from Emacs package manager

texts:
I am trying to install the projectile library. I am using Emacs 24.4.1, and I installed  projectile-20150405.126 from the Emacs package manager. Then I tried to activate it in my init file:

(require 'projectile)
(projectile-global-mode)

But this gives an error when I am starting Emacs:

Warning (initialization): An error occurred while loading `/home/hakon/.emacs':
File error: Cannot open load file, no such file or directory, projectile

I tried to debug using emacs -Q and it seems like I am missing a package called dash..

According to the installation instructions at http://batsov.com/projectile/ I should not need to install dash first when using the package manager..


texts: How to build and run Emacs from source with Eclipse?

texts:
I have just downloaded the latest version (Oxygen, Release 4.7.0) of the Eclipse IDE for C/C++ Developers, and would like to use it to build and run Emacs from source, which I have downloaded from the Emacs Git repository into ~/emacs/ (it's Emacs version 26.0.50).

I've never used Eclipse before nor built/run Emacs from source before.

I run macOS, the latest version (Sierra, v. 10.12.6).


texts: Any way to make git errors more prominent in Magit?

texts:
Whenever Git fails (e.g. if you try to rebase when your working tree has changes), Magit writes the following message:

  Git failed ... [See buffer *magit-process: ... for details]

which is then immediately obscured with other stuff like

  Reverting (up to) 670 file-visiting buffer(s)...

In other words it is extremely non-obvious when and why something fails, especially if you don't watch it closely, e.g. commit and switch to a different desktop, for example.

Is there any way to make Magit bark hard when Git underneath it fails, e.g. pop some buffer?


texts:
I have just joined the Emacs church.  I would like to know if the following can be done.

Say I have a project folder, I would like to run some custom commands that tie to some keyboard shorcuts for that folder only.

For example, say I am in /home/Documents/project, I would open this directory in Emacs and I would press, say C-x-F5 for example, and Emacs would send some custom commands that I declare and run in the shell.

Is it possible to do this? The only thing I manage to mess around is the compile command, M-x compile.  But how to tell Emacs to only execute that while in /home/Documents/project?

Below is my attempt at modifying the compile command with adhook to compile C++ file.

(add-hook 'c++-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (concat "g++ " buffer-file-name "&& ./a.out"))))

Please let me know.


texts:
I have emacs installed on two machines, with both installs using a similar spacemacs config. On both, C-M-i is bound to the command complete-symbol.
I am editing different org files on the machines, and am trying to add internal links to elsewhere in the same document. The way this works on one machine is that if I type [[* then C-M-i I get prompted to enter a pattern which then gives me a filtered list of matching locations in the doc. I can choose one of these and the link is created correctly.
On the other machine, when I hit C-M-i I get a message saying simply [No matches].
What should I check to get the completion working the way I want (as in the first example)?
Update
It looks like the completion does work on both boxes, it's just on one I was trying to create the link in a headline (which didn't work), whereas on the other box the link was body text, not a headline. It appears that creating links in headlines is a problem, at least in my setup, which is a bit weird as I can create a bunch of links as a nested list and then convert those to headline structure.


texts: Org-mode Latex export opens pdf with GIMP

texts: Not sure why this is, but I just tried an org-mode Latex export (C-c C-e l o), but it opened GIMP to display my resulting pdf file. I'm on 27.1 and 9.4. My system is Ubuntu 20.04 with Gnome. I went to org-file-apps and see \.pdf\' set to Use default. What are my best options to set the Ubuntu "document viewer" -- which is the default viewer throughout the system -- to be my org-mode Latex export viewer? So yes, the org-Latex interaction is healthy, just the strange choice Emacs/org-mode is making for my viewer. Obviously I could leave off the auto-open, but still...


texts: Access menu-bar using keyboard on Mac OS X

texts:
When I hit C-f2 in any Mac OS X app (e.g., terminal, firefox), I get
keyboard access to the menu bar (file/edit/options &c)
In emacs I get a message <C-f2> is undefined in the Echo Area.
When I hit f10 (menu-bar-open) in Emacs, get the 2 item menu search with google and
add to itunes as a spoken track or sometimes the single grayed-out item menu select.

How do i get Emacs to pass C-f2 to the OS?
How do I get f10 to invoke the real menu in Emacs?


texts: How to remap meta-arrow keys in org-mode

texts:
Say I want ctrl-shift-arrows to do what meta-arrows normally do in org-mode. How do I do this?
I tried
(define-key org-mode-map "C-S-<up>" 'org-meta-up))

(and so on for down, left, and right), but then ctrl-shift-up results in this error message:

Autoloading file /Applications/MacPorts/Emacs.app/Contents/Resources/lisp/org/org.elc failed to define function org-meta-up

Meta-up works correctly, but M-x org-meta-up results in the same error. What am I missing? How do I remap these org-mode keys?
This is the MacPorts version of Emacs.app; M-x version gives "GNU Emacs 27.1 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.6 (Build 19G2021)) of 2020-08-29"


texts:
I am trying to create a new mode for Emacs lisp, let's call it xyz-mode.el.

In testing the mode, I want to re-run xyz-mode.el on a potential target file, let's say abc.xyz. In other words, as I edit xyz-mode.el, I want to reload the mode into Emacs so that abc.xyz is viewable under the modified configuration. To be absolutely clear, what I want to do is as follows:

I edit xyz-mode.el to change, say, the syntax for comments;
I re-load xyz-mode.el
I re-view abc.xyz to see whether my changes to xyz-mode.el have had the intended consequences.

I'm not talking about editing abc.xyz, but about editing xyz-mode.el then reloading.

What is the best way to re-run xyz-mode.el and try to re-view the subject file abc.xyz? I have tried using eval-buffer but this does not work correctly. I am currently killing Emacs itself and restarting, which is time-consuming.


texts: Is there a way to show python generated plots in the python interpreter console?

texts:
I use emacs for most python programming, but really miss the inline plot feature combined with printed output in Spyder. See picture.

I've been experimenting with various interpreter settings but none seem to work:
(use-package python
  :config
  ;; (setq python-shell-interpreter "ipython"
       ;; python-shell-interpreter-args "-i --simple-prompt")
  (setq python-shell-interpreter "jupyter"
        python-shell-interpreter-args "console --simple-prompt"))

Is there a way to setup this functionality in Emacs?


texts: How to mark all entries for particular feed as read in newsticker?

texts: I've got bunch of rss feeds in newsticker and it's nearly perfect but poorly documented. Sometimes people reinstall their blog software (wordpress is particular pile of crap in this regard) and as a result all the entries in their feed become "new". I'm pretty sure there got to be some magic key combo in newsticker to mark entire feed read again, but was unable to find it so far. Ideally I'd like to mark all the entries which are older than (year, month whatever) automatically read.


texts:
When we call helm-find-files on an org link or path, helm is smart enough to autocomplete the path, making it easy for us to navigate from there. Unfortunately, if the link starts with [[file:./this/file/name.png]], then helm extended actions fail, because helm can't find a file that starts with "file:".
Does anyone know how I could advice helm-find-files to trim the "file:" part of a link?


texts:
Yet another question about indentation in AUCTeX...

I would like to be able to indent content inside square brackets [...]. It would be useful for tikz option lists, for example, or trees drawn using forest or qtree: both these packages use square brackets for their syntax, which makes it easy to scan in source code in an editor supporting paren-indentation.

Unfortunately, AUCTeX only indents the content of environments and content between braces {...}.

The forest example is also a situation where cheating by adding braces around the content we want indented won't work, because braces will escape all content from being evaluated as a tree.

Example:

\documentclass{article}
\usepackage{forest}

\begin{document}

\begin{forest}
  [A
  [B]
  [C
  [D]
  [E]
  ]
  ]
\end{forest}

\end{document}

Which I would like indented as:

\documentclass{article}
\usepackage{forest}

\begin{document}

\begin{forest}
  [A
    [B]
    [C
      [D]
      [E]
    ]
  ]
\end{forest}

\end{document}

Is there a way?


texts: How to navigate to previous cursor positions without using the mark?

texts:
I'm often making typing mistakes which will kick me out of the current function block (hitting M-n when I meant C-n). In such cases it would be nice to be able to return immediately to the previous cursor position. My understanding (correct me if I'm wrong) is that the mark ring is not ideally suited to this purpose because it requires setting the mark at positions ahead of time.

I guess I'm asking for a 'trailing mark ring' that stores all cursor positions, say, 2 or 3 moves back...or something like that.


texts: Open recent directories like Ido opens files

texts:
When I want to open a recent file, I use ido-find-find (C-x C-f) or ido-switch-buffer (C-x b) and type a few characters and Ido automatically finds the right file among the recent files I have visited.
I would like to have something similar for directories. For example, with ido-dired, Ido suggests the current directory and I have to navigate my filesystem to reach the one I have in mind. For example, to reach ~/some/sub/directory/containing/the/RightDirectory/, I have to type in the first letters of all the parent directories (and remember them) to reach RightDirectory/. I find that cumbersome.
Is there a way to get an interface similar to ido-find-file to reach a recent directory?
Note: I am open to any other suggestion of workflow to reach a recent (or any) directory quickly.


texts: Idiomatic conversion of non-nil to explicit t

texts:
Is there an idiomatic/commonly used/established convention to convert non-nil values to t that other Elisp programmers are likely to recognize?

Sometimes I have a non-nil value, say from calling member, that I want to return as either t or nil (so that I don't leak implementation details (Cf. Hyrum's Law)).

The Emacs Lisp Coding Conventions, for example, say nothing about this that I can see. The closest I've found is the Elisp manual's section on nil and t, which says "When you need to choose a value that represents true, and there is no other basis for choosing, use t."

Ways I've come up with:

(and val t)

(if val t nil)

(not (not val))

Does one of these have a benefit over the other? Is one "more idiomatic"?


texts: org-id-get-create creates the header property e.g. :ID: 22b9191c-..... though I can't paste the appropriate link from the kill ring nor does org-insert-link. Any clues?


texts: Orgmode export html with fontawesome characters

texts:
I have an org document in which I inserted fontawesome characters (with the package fontawesome).

When exporting to html, the characters are exported as is instead of being exported in html fontawesome code. For instance,
 should get exported as:

<i class="fa fa-plus"></i>

I guess I could achieve this with some post-export hook. How would I do ?

Thanks


texts: How to split a long org file into separate org files?

texts:
I've an huge org file HUGE.org with this structure:

* ID-HEAD-1 Title1 :TAG:
bla bla bla

* ID-HEAD-2 Title2 :TAG:
bla bla bla

...

* ID-HEAD-N TitleN :TAG:
bla bla bla

and I want to split HUGE.org into:

ID-HEAD-1.org
ID-HEAD-2.org
...
ID-HEAD-N.org

where the content of each ID-HEAD-i.org is:

* ID-HEAD-i Titlei :TAG:
bla bla bla

Suggestions?


texts: Conventional implementation of display-buffer-above-selected

texts:
Despite respectable variety of display-buffer-* functions some of them stand out with lack of flexibility, such as display-buffer-at-bottom or display-buffer-below-selected that exist in absence of reverse variant.

Assuming that decision was intentional, I would like to know what limitations are stopping these procedures from following the suit, or if there exists an easy way to create opposite implementation on the spot using existing inventory.

To make it more clear, here's my own attempt at making display-buffer-above-selected which only exposes the duplication that lays burden on those that seek to replace missing functionality.


texts: How do I prevent Gnus from changing the window layout?

texts:
When I open a group in Gnus, it insists on resetting the window layout and using the entire frame for the group buffer.

I'd rather manage the window layout myself, so how can I make Gnus not change it for me?


texts:
In sx.el compose mode, what is the correct way to mark some region as
a code block, the way C-k does it on the web interface ?


texts: Efficiently calling multiple variants of the grep command

texts:
The context
I commonly execute the following variants of the grep command

grep --color -RHIn '' (search in the current working directory)
grep --color -RHIn --include='*.org' '' ~/repos/dotfiles/emacs (search in all the Org files present in a directory that contains configurations of other Emacs users)
grep --color -RHIn --include='init.el' ~/repos/dotfiles/emacs  (search in all init.el files located in the directory mentioned above)
grep --color -RHIn --include='*.org' --include='*.el' '' ~/repos/dotfiles/emacs (search in all .el and .org files files located in the directory mentioned above)

Whenever I want to use one of thoose variants, I press M-x grep and manually type them.
I'm looking for ways which can help me avoid manually typing those variants whenever I want to execute any of those
Additional context
I've tried the following
(let ((grep-command "grep --color -RHIn ''")) (call-interactively grep))
(let ((grep-command "grep --color -RHIn --include='*.org' '' ~/repos/dotfiles/emacs")) (call-interactively grep))
...

The problem with this is that call-interactively considers the global value of the variable grep-command instead of the one provided by let. If this worked, then I would only need to do
; Variant 1

(global-set-key (kbd "C-x g 1")
                (let ((grep-command "grep --color -RHIn ''")) (call-interactively grep)))

; Variant 2

(global-set-key (kbd "C-x g 2")
                (let ((grep-command "grep --color -RHIn --include='*.org' ''")) (call-interactively grep)))

(... more variants)

The question
Do you know a better way to automate this so that I don't have to manually type any of the grep variants? Is there a package that would display something like a menu that would show a menu item with a description for each variant such that when an item is selected, grep is executed with the corresponding variant of the selected item?
If you don't have any idea, I would really appreciate if you could explain how I can make a command ((call-interactively 'grep), in this scenario) to consider the value of a variable provided by let.


texts: Auctex previews, change foreground color of text

texts:
I am using a dark theme and the latex previews from auctex are created with black text color. How can I change it?
What I can do is change the background color to white (in Preview Reference Face customization), then I can at least read the text but it is irritating.
Setting the foreground there did not work for me.

I also already tried to inject \color{white} into the latex commands somehow but without luck. Where would be the right place?


texts: How can I copy spacemacs' helm configuration?

texts:
I tried to use spacemacs for couple of hours, and I think i'll quit here.. just hard to configure.
I like their helm configuration, How can I copy their helm configuration ?


texts:
I have the following archive structure:
archive.zip
├── .ebextensions/
│   └── config.config
├── Dockerfile
└── target/
    └──jar.jar

With emacs I can open and edit the archive files, and also "enter" inside and edit the jar.jar archive, save those changes and seemingly update the jar, but I then cannot update archive.zip with the modified jar. Is it possible?


texts: `raise-frame` not adding frame to `(visible-frame-list)`

texts:
I'm running Emacs 24.5.1 as a daemon on Fedora 24 with GNOME 3.20, and am encountering a strange behavior.

With two frames, F1 (the initial frame) and G1 (the created frame), if G1 is iconified with iconify-or-deiconify-frame, then raised again with (raise-frame (selected-frame)), G1 does not appear in (visible-frame-list).

I think this is probably a GNOME problem, but I'm curious as to whether others have come across it.


texts: Compiled configuration cannot find package

texts:
I am trying to have configuration byte-compiled to improve performances further.

The original code works with no issue. However, adding the optional compile argument:

(require 'ob-tangle)
(org-babel-load-file (expand-file-name "dotemacs.org" user-emacs-directory) t)

Yields the following:

dotemacs.el:79:17:Warning: reference to free variable `package-archives'
dotemacs.el:79:17:Warning: assignment to free variable `package-archives'
dotemacs.el:91:4:Error: Cannot open load file: no such file or directory, use-package

Here is my init.el. And here is the part that breaks in my dotemacs.org.


texts: Org Latex Fragment Succeeded by a Dash Is Not Showing

texts:
I'm using the org-mode to write some mathematical notes, so I'm using
latex fragments like $\frac{a}{b}$ a lot. However, if I succeed the
fragment with a dash, like $\frac{a}{b}$-fraction, it will not
render (preview) the fragment.

Questions:
(1) How can I override this behavior and make it show?
(2) Is this the intended behavior or strictly a bug?


texts: How to search within current folder and sub folder (Spacemacs)

texts: When I do space + s + P, I can search within the project which is cool. But I would like to search in current foler and subfolder. how to achieve that?


texts: rgrep : visiting matches without switching buffer

texts: I was wondering if there is a way to visit the matches listed in the grep buffer without actually switching to the match buffer, similarly to C-o with Occur.


texts: Magit set upstream to origin/master automatically

texts:
Is there a way to set the upstream of a branch automatically in magit?

I know I can select it interactively but for feature branches I set it to master 99% of the times so I was wondering if it can be done at branch creation automatically.

Thank you!


texts: Is escaping backslash in regexp string expressions optional at times?

texts:
In one of my older elisp code snippets, I was surprised to find the below (and that even worked fine all this time!)

The problem (which should have been) is that I did not escape the back-slashes in the regexp string: "\*abc\*"

(string-match-p "\*abc\*" "def*abc*")

So I then fixed the expression to below.

(string-match-p "\\*abc\\*" "def*abc*")

Both of the above expressions yield the same result.

Question: Why did the incorrect way work here?


texts:
Every time, I save files, it prompts that

save files ..? (y, n !)

There are few cases that saving files are mistake operations.

How could disable the confirmation prompts?


texts: Hide extra stars when narrowed to subtree

texts:
I have an outline with many levels of indentation. When I narrow to a particular subtree, I would like to hide the extra stars (and indentation) so that It looks like I am working on a top-level heading.

So for example, this

****** Deeply indented heading
Some text

becomes this

* Deeply indented heading
Some text


texts: Display function arguments in echo area?

texts:
Is there a package to let emacs display the parameters of a function while typing?

For example, if I were to start typing printf( in C, I would like it to display the format taken from man pages, kinda like auto-completion, but without actually putting in any text.


texts: In undo history, how to separate abbrev expansion from self-insert?

texts:
Very occasionally, hit SPC during regular typing and get an unexpected abbrev expansion. What I usually do in this case is undo (which reverts the expansion and the inserted space) and then manually C-q SPC to add the space again.

It would be really useful if, when I hit undo, only the expansion would get reverted, but the space would stay. Then, hitting undo a second time could revert the space insertion too. This is what you usually see in editors with auto-correction features (the first undo affects the correction, the second affects the space you typed).

How can I achieve this?


texts: (window-total-width) returns the number of columns (characters) that fit in the current window (https://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Sizes.html). This will take the current font into account. My header line or mode line might have a different font from the text area (window body). How can I get the number of columns (characters) that fit there instead?


texts:
In Emacs interactive subshell, when I type clear, the screen is not cleared as it should do in a normal Ubuntu Terminal, for example.

When I press Ctrl + l(twice if the screen is full), the screen gets cleared; but as soon as I type any command, let us say ls, I find myself in the bottom of the page (buffer) meaning that the clearing action is undone.

Is there a way to clear a subshell screen?


texts:
I generated a .dir-locals.el by calling the function add-dir-local-variable, giving it the path for the project for which I want the variable, the variable itself, and its value.

The generated file went to my home directory (not the project path as I expected), and had the following content:

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

(("~/tmp/test_test_dir_local"
  (indent-tabs-mode . t)))

Then I went on and created a file a.c in that directory, and copied .dir-locals.el there for good measure.

The indent in that file is still set as spaces, as per my ~/.emacs.d/init.el. I expected it to be tabs, as per the local .dir-locals.el. I tried restarting emacs, but that did not work either.

What did I do wrong, or misunderstand?

I am on Mac OS Sierra.


texts: Only enable auto-revert-mode for the current buffer

texts:
I use auto-revert-mode and ideally I would like the auto-revert-interval to be very small, e.g. 0.5 seconds or less. But I am concerned about performance problems when I have many buffers open, especially as I would like to use auto-revert-mode for dired buffers too.

It occured to me, though, that auto-revert-mode only really needs to be active for the current buffer. After all, if I'm not looking at a buffer, who cares if it is reverted or not? Other buffers can wait to be reverted until I actually switch to them.

What's the easiest/most elegant way to make it so auto-revert-mode is only active (i.e. polling the filesystem) for the buffer currently being viewed?


texts: OrgMode, how to pass options to LaTex listings?

texts:
When I export an Emacs OrgMode buffer like:

#+LATEX_HEADER: \usepackage{listings}
* How to pass options to LaTex listings?
#+ATTR_LATEX: :options [numbers=left]
#+BEGIN_SRC sh
echo "hello world"
#+END_SRC

the exported LaTex buffer does not contain the numbers=left but the default numbers=none.

...snip
\usepackage{listings}
\date{\today}
\title{demo-listings-2}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs 24.5.1 (Org mode 8.2.10)}}
\begin{document}

\maketitle
\tableofcontents

\section{How to pass options to LaTex listings?}
\label{sec-1}
\lstset{language=sh,label= ,caption= ,numbers=none}
\begin{lstlisting}
echo "hello world"
\end{lstlisting}
% Emacs 24.5.1 (Org mode 8.2.10)
\end{document}

I expected the ATTR_LATEX: :options [numbers=left] to override the default value.

The only LaTex configuration I have in the .emacsfile is:

(require 'ox-latex)
(setq org-latex-listings t)

Any idea of what I am missing or doing wrong ?


texts: Was Emacs launched with a filename argument?

texts:
Suppose I want Emacs to be configured differently depending on whether or not it was launched with a filename as an argument.
Is there a way I can deduce this as part of my init file?

One way is to check if there are any buffers open:

(require 'cl-lib)

(defun non-user-buffer (buffer)
  (let ((name (buffer-name buffer)))
    (when (or (string-prefix-p " " name)
              (and (string-prefix-p "*" name) (string-suffix-p "*" name)))
        t)))

(defun num-user-buffers ()
  (length (cl-remove-if 'non-user-buffer (buffer-list))))

;; Provided recently launched...
(defun launched-with-buffer ()
  (when (> (num-user-buffers) 0) t))


texts:
Is there a nifty emacs command to access the serial port on a remote system?;)

I've seen socat, which creates a virtual serial port on the local system, but if emacs can do it directly, without that, I'd like to know.


texts:
i just installed Emacs 24.4 and i get this weird default theme with big fonts

When I install spacemacs theme, I get this


texts:
I use quite a few minor modes and usually I know which minor mode is enabled in every major mode. If I really want to see the full list, I can run C-h v minor-mode-list.

At the same time, my mode line get really clogged, so when I vertically split frame, sometimes I cannot read end of the mode line.

Actual question: how to disable showing of minor modes list in mode line? For example, now it may look like this:

-:--- main.c        All (7,12)     (C/l FlyC SScr Abbrev Fill) [main] 16:19 0.45

I want it to look more concise:

-:--- main.c        All (7,12)     (C/l) [main] 16:19


texts: Open file in new window after searching it with helm

texts:
As written in A Package in a league of its own: Helm there's a way to

search for a file using Helm
decide after searching whether open it in same or other window

My question is: How?


texts: Exclude parts of the org-mode content based on export filetype

texts:
I work with org-reveal for presentations and export to LaTeX based PDF for handouts.
I use SVG for the graphs in the reveal-presentation for better scaling and I want those to be ignored when exporting to LaTeX-PDF. Instead a PDF should be used. There are also some slides I want to have in the presentation but are not necessary for the handout.
Is there a way to exclude parts of the tree from export, e.g., :noexport:, based on the export filetype?


texts: Imagemagick not supported in Emacs on windows?

texts:
Update: As of early October 2016 emacs for windows does not support ImageMagick versions 7.x or greater as discussed here and here.

Presumably some combination of an earlier version of emacs for windows and ImageMagick prior to version 7.x should work. Is anybody using emacs for windows with functioning ImageMagick support (resizing images etc.)? If so,  please let us know which versions of each you are using.

I want to resize images displayed inline in org mode. Apparently this requires Emacs to be compiled with Imagemagick. I need Emacs for windows, but have not found a version compiled with Imagemagick. Can someone point me to a version of Emacs for windows compiled with Imagemagick?

If I have to build a version myself, I noticed the official nt/insall.64 claims:

  we need to disable Imagemagick because Emacs does not yet support it
  on Windows.

Is this still true?

Note, my version of Emacs for windows does have support to display images, but it is unable to resize images.


texts: Is there a way to periodically record the files being opened in emacs?

texts:
Sometimes my ubuntu freezes, and I am using Emacs that has many files opened inside it. I have to reboot Ubuntu, and lose the track of what files I have opened.

Is there a way to periodically record the files being opened in Emacs (maybe by more than one Emacs process), and to allow me to read the record of opened files later for example after rebooting OS?

Btw, I found that sudo lsof -u t  |   grep emacs only gives the directory where each emacs process was started, not the files being opened in Emacs. Does anyone know why?


texts: Keyboard macro produces a series of numbers

texts:
I did some editing. Then went to C-x C-k l edited the stuff to suit my needs. Saved it with C-c C-c. Gave it a name with C-x C-k b. Finally, went to ~/.emacs and did M-x insert-kbd-macro

To my surprise, it produced few words and a long series of numbers. I can still execute it using M-x macroname RET and edit it using C-x C-k e. So no problems.

But why those cryptic numbers in ~/.emacs?


texts: org mode inline image from elisp code block

texts:
Below code will draw a tree graph with dot, it works fine but the output graph has been included in "".

#+NAME: nodes
| From | To | Weight |
|------+----+--------|
| A    | B  |      3 |
| A    | C  |      2 |
| B    | D  |      4 |
| B    | E  |      5 |
| C    | F  |     10 |

#+BEGIN_SRC elisp :results output :wrap image :var nodes=nodes
    (defun rowfun(x)
      (format "%s -> %s [label=%s];" (nth 0 x) (nth 1 x) (nth 2 x))
      )
    (defun dotgen(nodes)
      (let ((dotbegin "digraph {\nnode [shape=circle]\n")
            (dotend "\n}"))
        (concat dotbegin
                (mapconcat #'rowfun nodes "\n")
                dotend)))
    (setq dotname "test.dot")
  (setq pngname (format "%s.png"
                        (replace-regexp-in-string "\.dot" "" dotname)))
  (with-temp-file dotname (insert (dotgen nodes)))
  (shell-command-to-string (format "dot -Tpng %s -o %s" dotname pngname))
  (delete-file dotname)
  (print (format "[[./%s]]" pngname))
#+END_SRC

#+RESULTS:
#+BEGIN_image

"[[./test.png]]"
#+END_image

The output:

How can I get a clean image without the extra "" printed before and end of the picture?


texts: Org v9 and org-latex-preview incompatibility?

texts:
In the following MWE I start with a simple latex code block. I hit C-c C-c to generate the results, and get an export latex block, which I believe is consistent with org-version ≥9 (as opposed to a #+begin_LaTeX block).
#+begin_src latex
\LaTeX
#+end_src

#+RESULTS:
#+begin_export latex
\LaTeX
#+end_export

Unfortunately, if I type C-c C-x C-l to do org-preview-fragments, then nothing happens. However, if I alter the begin_export latex block to a begin_latex block, then org-preview-fragments works as expected. How do I make org-preview-fragments recognize the new export latex block as a valid fragment for which to create a preview?


texts: Python blocks evaled; elisp blocks not: org-babel export to latex

texts:
I need to have automatic evaluation turned on for elisp (or emacs-lisp) because I have huge documents that I export to PDF with batch scripts, and it's intolerable to have to go in and manually evaluate elisp blocks.  Here is an MVE:

Consider the following org-babel file

#+BEGIN_SRC elisp :exports both
(+ 1 41)
#+END_SRC

#+BEGIN_SRC python :exports both :results output
print 'only python, no lisp for y00'
#+END_SRC

I can evaluate either code block by placing point in them and typing C-c C-c.  In each block, I get an interactive security question Evaluate this (elisp / python) code block on your system?  Great, no problem.  Doing that for both, I get

#+BEGIN_SRC elisp :exports both
(+ 1 41)
#+END_SRC

#+RESULTS:
: 42

#+BEGIN_SRC python :exports both :results output
print 'only python, no lisp for y00'
#+END_SRC

#+RESULTS:
: only python, no lisp for y00

Ok, I now remove the #+RESULTS blocks and type M-x org-babel-export-to-pdf.  I only get the security question for the python block, and not for the elisp block.  The PDF output only has the results for the python block and not for the elisp block.

Looks like some setting has auto-evaluation-on-export or some such turned off for elisp.  Changing the code type to emacs-lisp for the elisp block does not fix it.


texts: Org mode macro for including content of another org mode file

texts:
I'm trying to wrap my head around why the following macro does not work:
#+MACRO: INCLUDE_ORG #+INCLUDE: "$1::$2" :minlevel 3 :only-contents t

This is how I'm using it:
{{{INCLUDE_ORG(./somefile.org,Some long heading with spacesj)}}}

I was experimenting with putting quotes here and there without any progress. Using regular include without macro works just fine.
Could you please help me understand what causes the issue?


texts: When I use flyspell-mode, it reports spelling errors whenever I type a URL. Is there a way I can tell Flyspell to stop checking URLs?


texts: How to switch to `flycheck-list-errors` buffer/window/minibuffer?

texts:
For starters I use Doom Emacs.
Here's the scenario:
I have a python/perl/js buffer and flycheck-mode activated. Flycheck does its job and tells me that there are some errors that need attention. I go and do `M-x flycheck-list-errors (or SPC c x). I have 2 spaces now: One with my code (which I believe is a window) and another something (buffer/window/minibuffer?) with the list of errors.
Question is: How do I switch to that something without using the mouse?
I've tried next-buffer, previous-buffer, C-x o, and I simply don't know how to focus on it.
Appreciate your help as It's driving me crazy! It shouldn't be that hard, right?


texts: Narrow down refilling options to single sub-heading

texts:
I have a single file tasks.org that contains all the tasks for agenda and I have separate projects files with a tasks related to specific project. I try to setup a configuration that will let me refile tasks from project files under the heading * Projects in tasks.org file and from the tasks.org file back to specific project file under heading ** Tasks.
I try to use :regexp to narrow down refilling options to specific heading, but it doesn't work at all, it works only when I use :level parameter - maybe there is a bug in "regexp" parameter implementation or I use it wrong way.
Global org-refile-targets:
(setq org-refile-targets `(
                            (,my/project-1 :level . 1)
                            (,my/project-2 :regexp . "Projects$")))

The example project file:
# -*- mode: org -*-
# Local Variables:
# eval: (setq-local org-refile-targets `((,my/org-tasks-file-path :regexp . "Projects$")))
# End:

* Project 1
** Tasks
*** TODO bar
** Resources

Example tasks.org file:
# -*- mode: org -*-

* Tasks
** TODO foo
* Projects

EDIT:
I managed to succesfully refile task from tasks.org to project file. The problem was that there were different heading depths. The tasks.org have 2 levels and project file had 3. I changed project file to match number of heading levels with tasks file and now it works.
The project.org file look like this now:
# -*- mode: org -*-

* Project 1
** Tasks
*** TODO bar
** Resources

The only problem that left is to narrow down local refiling options for project file to just tasks.org * Projects. Local Variables with eval doesn't work. When I eval (setq-local org-refile-targets ((,my/org-tasks-file-path :regexp . "Projects$")))` by hand it works though.
Any idea how can I set org-refile-targets on file level?


texts:
I'm writing a major mode.
In that mode I put:

(define-key oef-mode-map (kbd "C-c C-c") 'oef-edit-in-browser) ;

With Aquamacs (on my mac) the shortcut is working as expected.
But with emacs (on linux) I get: C-c C-c- and the minibuffer is waiting for a key.

If I try C-hk C-c C-c  I get same thing : C-c C-c-

After bisecting my init file, as Drew suggested, I found that the problem was the line :

(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes

If I disable emmet-mode C-c C-c is working fine with my mode... but I don't want to disable Emmet-mode because I like it very much.

Solved

I put that in my init file :

;;; EMMET-MODE
(defvar emmet-mode-keymap
  (let
      ((map (make-sparse-keymap)))
    (define-key map (kbd "C-j") 'emmet-expand-line)
    (define-key map (kbd "<C-return>") 'emmet-expand-line)
    (define-key map (kbd "<C-M-right>") 'emmet-next-edit-point)
    (define-key map (kbd "<C-M-left>") 'emmet-prev-edit-point)
    (define-key map (kbd "C-c w") 'emmet-wrap-with-markup)
    map)
  "Keymap for emmet minor mode.")

(require 'emmet-mode)
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
(add-hook 'html-mode-hook 'emmet-mode)
(add-hook 'css-mode-hook  'emmet-mode)
(add-hook 'web-mode-hook  'emmet-mode)

UPDATE

The solution that gave Tyler is working fine. So I put that in my init file:

(require 'emmet-mode)
(eval-after-load "emmet-mode"
  '(define-key emmet-mode-keymap (kbd "C-c C-c") 'oef-edit-in-browser))
(eval-after-load "emmet-mode"
  '(define-key emmet-mode-keymap (kbd "C-c w") 'emmet-wrap-with-markup))
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
;; `emmet-mode' will automatically start with oef-mode
(add-hook 'html-mode-hook 'emmet-mode)
(add-hook 'css-mode-hook  'emmet-mode)
(add-hook 'web-mode-hook  'emmet-mode)


texts: Saving persistent undo to a single directory, alist format

texts:
It looks like this can be achieved by modifying the variable
undo-tree-history-directory-alist, but I can't figure out how.  I tried a number of lines, the last of which is

(setq undo-tree-history-directory-alist ("." ! "~/.emacs.d/undo"))

But this returns errors.


texts:
I'm using Monokai theme. When I start helm, the current selected line are highlighted in gray. It's not easy to spot,especially with the title information in blue.

How can I change this gray highlight, say, in purple?


texts:
I'm using avy to select and insert symbols on screen with the help of thing-at-point. Is there an obvious way to get this to include periods? At the moment if I select self.blah I get just self (or blah).

I can obviously do this using regular expressions, save-excursion, and searching back and forward. But a standard approach seems less verbose and likely a better thing to learn.


texts: Showing Section Name in Each Frame (Org-Mode Beamer)

texts:
Roughly, I have:

#+options: H:2

* Introduction
** Some definition
    + list item1
    + list item2

This shows Some definition as its own beamer frame (with + list item1..).

Question: How can I have, atop each beamer frame, the section title also? This way I would get a slide that shows something like Introduction and Some definition at the top (i.e., a slide with two titles), with + list item 1... below.


texts: How does one save and close a file in Proof General without all of Evil shutting down?

texts:
I am using evil (emacs+vim). I am also using Proof General for the theorem prover Coq. I was trying to work with emacs but whenever I do:

:x

or

:q

in my coq .v file all of emacs closes as well (with all my buffers going down). I tried just pressing q on it own but it doesn't work.

I did:

C-x C-c

but that also kills everything and emacs it seems.

I also tried C-x 0 but it says:

  Attempt to delete minibuffer or sole ordinary window.

Which doesn't mean much to me. I googled the error and got this Attempt to delete minibuffer or sole ordinary window which didn't clarify things to much.

Does anyone know how I can just close the current coq text file .v without having all of emacs close?

Now I have a new error that after I process part of the Coq script and try to save it and exit, the rest of the panes (buffers? frames?) where the proof context and errors messages are have not been closed...so I end up having to close stuff more times or get stuck...any help?

How do I close a Coq file without it not fully closing and staying within emacs?

To give some more context I am used to using Tmux with Vim + terminal. So doing :x closed my text file and saved it and sent me back to terminal. Thats why I expected it to close my text file but not close emacs (just like it wouldn't close my terminal). I am not saying I necessarily want this behaviour. Perhaps what the issue is that I don't understand what a typical/recommended emacs workflow looks like with ProofGeneral.

Ok, I tried doing what someone suggested which was not to close buffers. Fine. I tried that but now C-x C-f doesn't open files anymore cuz of ProofGeneral :(


texts:
On https://www.emacswiki.org/emacs/MultilineRegexp one finds the hint to use

  [\0-\377[:nonascii:]]*\n

instead of the standard

  .*\n

to match any character up to a newline to avoid stack overflow for huge texts (37 KB). Is the overflow the concern here, or is a matching run for the former also more performant than the latter?


texts: Prepend string to lines in org source block export?

texts:
I would like to prepend a $ sign to the front of every non empty line in the export. Comments should be skipped if possible. Couldn't find an option for it.

Is there an option? If not is there a quick way to achieve that with some elisp?


texts: Correcting and maintaining org-mode hyperlinks

texts:
This is a two part question having to do with link rot.

Does org-mode provide any functionality for validating hyperlinks, especially local ones? This could be used to combat link rot after the fact.
Even better, does org provide functionality so that if I rename a file in dired, it will update affected files? This could prevent some kinds of link rot before it happens, at least for local files.


texts:
I am trying to install emacs 26.3. In installed

sudo apt install autoconf make gcc texinfo libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff5-dev libgnutls-dev libncurses5-dev

It cant find libgnutls-dev. I skipped that and did ./configure --with-gnutls=no and when I do make

make[2]: Leaving directory '/home/itsy/Downloads/emacs-26.3/admin/unidata'
  CCLD     temacs
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libSM.so: undefined reference to `uuid_unparse_lower@UUID_1.0'
/usr/lib/gcc/x86_64-linux-gnu/7/../../../x86_64-linux-gnu/libSM.so: undefined reference to `uuid_generate@UUID_1.0'

Is there something I need to install ?


texts:
I want to start developing emacs packages. I would like to use cask, so I did:

$ cask init --dev

It worked well, and generated the Cask file

tree -La 1
.
├── .git
├── .gitignore
├── Cask
└── README.org

Then when I try cask install, I always get the same error:

cask install
Opening input file: No such file or directory, /Users/toni/learn/emacs/yamelcs/TODO

If I created the TODO file I get:

cask install
Package lacks a file header in file TODO

I do not know what to do next


texts: How to copy and cut multiple lines in Emacs correctly?

texts:
I have researched it. Most post said this way:

C-SPC C-n M-w

It works. But in my case. It only copied a block where the cursor moved. Not the whole lines area I want.

For example, the source below:

1 def hi():
2    print("hi")
3 .  print("hi")
4    print("hi")
----------col:16

The operations I did:

At the beginning of line 1, click C-x SPC (Because I'm using macOS so C-SPC not work, the keys are conflict)
Move down using C-n until line 4
Click C-e to the end of the last line ensure to get all the area I want
Finally click M-w to copy them.
Paste them at other area by C-y. The line 1 likes def hi():_____ with visible space

I can copy the content until col 16, but without the area afterward. So if I paste the content somewhere, the layout went bad.

Key conflict


texts: How can I replace in my .emacs all these `require` with `package.el` and `MELPA`?

texts:
My .emacs still uses old-style (pre MELPA, pre package.el) initializations.

Current (this works)

I'll use web-mode as a concrete example.

If I manually download web-mode.el and put it in ~/elisp, then start Emacs (25) with the .emacs file

(package-initialize)  ; Irrelevant here. Added by Emacs.
(setq load-path
      (cons "~/elisp" load-path))

(require 'web-mode)

(set-face-attribute 'web-mode-css-at-rule-face nil :foreground "magenta red")

all is well.

I'd like to change this .emacs to be able to use any machine+account without having to install manually an ~/elisp on each machine/account.

MELPA + package.el attempt (this doesn't work)

My attempt is:

(require 'package)

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

(package-initialize)

(custom-set-variables
 '(package-selected-packages
   (quote
    (web-mode))))

(set-face-attribute 'web-mode-css-at-rule-face nil :foreground "magenta red")

but this fails with

error: Invalid face, web-mode-css-at-rule-face

What am I doing wrong?

Update

When I run package-list-packages I see

and so it appears that web-mode is installed.

I now have the impression from phil's comment that using package.el + MELPA may not actually spare me from having to download and install elisp packages manually. Please confirm one way or the other.

Post answer

It turns out that this change cannot be completely made. Too many packages are not on MELPA.


texts: why I getting diffrent result between Emacs org and clion to runing the same perl code?

texts:
1.In clion:

use strict;
use warnings FATAL => 'all';
use Scalar::Util qw(looks_like_number);
my $todlist="GOTO  /  -71.42857,  -16.00000,  -49.48717,-0.866025, 0.000000,-0.500000";
my @do = split( /\/|,|\s/, $todlist);
my @str=round_num03(@do);
print(@str);
#foreach my $element (@str) {
#    print ($element);
#}
sub round_num03{
    foreach (@_) {
        if ( looks_like_number($_) )
        {
            $_ = sprintf( "|%.3f", $_);
        }
    }
    return @_;
}

I get result:GOTO|-71.429|-16.000|-49.487|-0.866|0.000|-0.500

2.In my emaces org mode,

#+BEGIN_SRC perl  :results value :exports results both
use strict;
use warnings FATAL => 'all';
use Scalar::Util qw(looks_like_number);
my $todlist="GOTO  /  -71.42857,  -16.00000,  -49.48717,-0.866025, 0.000000,-0.500000";
my @do = split( /\/|,|\s/, $todlist);
my @str=round_num03(@do);
#print(@str);
#foreach my $element (@str) {
#    print ($element);
#}
return @str;
sub round_num03{
    foreach (@_) {
        if ( looks_like_number($_) )
        {
            $_ = sprintf( "|%.3f", $_);
        }
    }
    return @_;
}
#+END_SRC

#+RESULTS:
: 16

The result is 16,may be the size of the array.why? And how to return the string .


texts: Find out about arguments passed to functions

texts:
When I press C-h k C-SPC, Emacs shows me:

  C-SPC runs the command set-mark-command (found in global-map), which
  is an interactive compiled Lisp function.

  It is bound to C-@, C-SPC.

  (set-mark-command ARG)

  Set the mark where point is, and activate it; or jump to the mark.
  Setting the mark also alters the region, which is the text between
  point and mark; this is the closest equivalent in Emacs to what some
  editors call the "selection".

  With no prefix argument, set the mark at point, and push the old mark
  position on local mark ring.  Also push the new mark on global mark
  ring, if the previous mark was set in another buffer.

  When Transient Mark Mode is off, immediately repeating this command
  activates ‘transient-mark-mode’ temporarily.

  With prefix argument (e.g., C-u C-SPC), jump to the mark, and set the
  mark from position popped off the local mark ring (this does not
  affect the global mark ring).  Use C-x C-@ to jump to a mark popped
  off the global mark ring (see ‘pop-global-mark’).

  If ‘set-mark-command-repeat-pop’ is non-nil, repeating the C-SPC
  command with no prefix argument pops the next position off the local
  (or global) mark ring and jumps there.

  With C-u C-u as prefix argument, unconditionally set mark where point
  is, even if ‘set-mark-command-repeat-pop’ is non-nil.

  Novice Emacs Lisp programmers often try to use the mark for the wrong
  purposes.  See the documentation of ‘set-mark’ for more information.

  [back]

I don't see where it says what it chooses for ARG. Apparently, set-mark-command needs an argument because evaluating (set-mark-command) results in an error.

How do I find out about the argument passed to set-mark-command when I hit C-SPC?


texts: Yasnippet minor mode working in lisp-interaction-mode but not in emacs-lisp-mode

texts:
I wanted to test yasnippet for editing Emacs Lisp files. After installing it from the package manager, the problem is that it works fine from the *scratch* buffer but not when editing a Lisp file using emacs-lisp-mode.

To debug, I reduced my Emacs init file to one line:

(setq debug-on-error t)

Then I started Emacs from command line with:

$ emacs test.el

and run M-x yas-minor-mode and then M-x yas-reload-all, then I typed
defun and pressed the TAB key, but nothing happend.

However, if I first switch to the *scratch* buffer and run the same commands it works fine and inserts the defun template when I press TAB..


texts: Export org notes to pdf such that it looks nice

texts:
I have a large number of org-mode files where I took my class notes.
I would like to export them as PDF files.
However, I like to take notes as in the following example:
#+LaTeX_HEADER: \newcommand\RR{\mathbb{R}}
#+LaTeX_HEADER: \newcommand{\norm}[1]{\left\lVert#1\right\rVert}
* Johnson-Lindenstrauss
** concentration on projection on first $k$ coordinates
   $u \in S^{d-1}$ uniform, think $u \sim N(0, I)$, but normalized
   each coordinate concentrates around $\frac{1}{d}$
   $g : \RR^d \to \RR^k$ projection to first $k$ coordinates
   then if $L = \mathbb E \norm{g(u)}^2$, then $L \sim \frac{k}{d}$
   and the concentration is very strong:
   $\mathbb P [L \ge \beta \frac{k}{d}] \le \exp(\frac{k}{2} (1 - \beta + \log \beta) )$

When read with org-latex-preview, it is very readable.
The issue is, when exported to pdf, it loses all readability:

How can I enhance the pdf export to insert linebreaks, and maybe even to render the equations which are in their own lines as if they were in an align environment?
Can I insert some parser before the export?
The pdf output format is not crucial, I just want to be able to send these notes to people who don't use org-mode.


texts:
I'm running Emacs 25.1.1 on Debian. No particularly elaborate setup.

I recently bought a new mouse, a Logitech MX Anywhere 2S, though I am not using any of the "programmable" features. I simply use the mouse via Bluetooth. I haven't changed anything anywhere.

It works fine in every other application, but in Emacs, when I try to scroll, I get beeps and C-M-( [or C-M-)] is undefined. mouse-wheel-mode is enabled.

The other aspects of the mouse work as expected; I can paste using the middle button, for example.

Any thoughts on how to fix this?


texts: How to indent 4 spaces for case in switch in javascript mode

texts:
I'm using default javascript mode and the switch..case look like this:

    switch (component) {
    case 'action-message':
        result = actionMessage(response);
        break;

    case 'action-confirmation':
        result = actionConfirmation(response);
        break;

    case 'action-error':
        result = actionError(response);
        break;

    case 'field-error':
        result = fieldError(response);
        break;

    default:
        result = undefined;
        break;
    }

How can I make it look like this:

    switch (component) {
        case 'action-message':
            result = actionMessage(response);
            break;

        case 'action-confirmation':
            result = actionConfirmation(response);
            break;

        case 'action-error':
            result = actionError(response);
            break;

        case 'field-error':
            result = fieldError(response);
            break;

        default:
            result = undefined;
            break;
    }


texts: How to remove unwanted candidates from helm-semantic-or-imenu?

texts:
Helm has inbuilt function helm-semantic-or-imenu. When this function is called, it shows all candidates including variables, dependencies e.t.c.

I mostly use it only for functions and classes. I want to remove all other candidates and include only functions & classes in it.

I checked source code of helm-semantic-or-imenu to modify helm sources but that looks quite complicated for me. Any help on removing selected candidates from source is appreciated.


texts: Chown with dired over Tramp, from Windows machine

texts:
I launch dired over Tramp (from Win machine to Linux server):

C-x d /plink:user@server|su:root@server:/path-to-folder-controlled-by-root/

Then I type "O" to chown a folder, but I get chown not supported on this system.
Debugging, I can see the error stems from the definition of dired-of-chgrp, which makes the following verification :

  (if (memq system-type '(ms-dos windows-nt))
      (error "chgrp not supported on this system"))

which obviously fails, because my machine is Windows — but I'm not chowning on Windows. Removing these two lines allows me to use the function normally.
I have the same issue with chgroup.

Does this mean my setup is incorrect, or is this a limitation?
What would be a clean way to correct this? Just removing these two lines seems like a dirty hack.


texts: Org LaTeX problems with themes when exporting to html

texts:
I use the two great html theme, bigblow and readtheorg, from https://github.com/fniessen/org-html-themes. They're awesome ! Looks really professionnal. The problem is that when I export some LaTeX, in both mode it's not good yet.

In bigblow, the font LaTeX font size is way too big ! Like 3 times the size of normal text. So I would like to change that size to fit the font size of normal text.

In readtheorg, some LaTeX sometimes overlap normal text, and also some characters aren't displayed like \mathbb{K}.

I like both so I am looking for two solutions ! First solution will be marked as the answer.
Thank you


texts:
Let's say I want to grep word1 and word2.

If I use the grep command for word1 I get the results in the *grep*  buffer.
If I then use the grep command for word2 I loose the old results and get the word2 results in a new *grep* buffer.

I want two see the two grep buffers (for example *grep 1* and *grep 2*) at the same time: How to get this?


texts:
On a hires screen I find it really hard to see on which image the cursor currently is, because the rectangle around the image is very thin. Is it possible to increase the line width of that rectangle?

Already I looked through customization options, through image-dired.el, and using what-cursor-position I inspected what’s at on cursor position, all to no avail.


texts:
When using xref with Fortran  I noticed that indexing by etags is highly incomplete; Almost exclusively subroutines (and maybe functions) are index, but modules, types, constants and global variables are all ignored.

This situation is even confirmed by the executable:

$ etags --help --lang=fortran
In Fortran code, functions, subroutines and block data are tags.

I am trying to fix the situation by adding regular expressions manually, e.g.

find -name "*.f90" | \
    xargs -d $'\n' etags --append \
          --regex='{fortran}/[[:blank:]]*module[[:blank:]]+\([[:alnum:]_]+\)/\1/i' \
          --regex='{fortran}/\(?:[^(]*\|.*::.*\)\(?1:\_<.*?\_>\)[[:blank:]]*=/\1/i' \
          --regex='{fortran}/[[:blank:]]*type[[:blank:]]*\(?:::\)?[[:blank:]]*\(?1:[[:alnum:]_]+\)/\1/i'

While it works, this makes me wonder if any better method is available -- maybe a specialized tools giving better etags for fortran, or at least a centralized place to store my custom regex list.


texts: configuring spacemacs for python development

texts:
It's been really frustrating trying to get spacemacs to work so far. I've grown to really love it - coming from vim - for its capabilities in manipulating and navigating text, but it's just been so hard to get it do behave like an IDE for python that I'm actually about to give up.
(caveat - I'm working on a windows machine.)
I have a couple of questions that I would love some help with.

I've tried both the official python layer, and using elpy directly through use-package and I couldn't get completions with either. I've now moved to installing Emacs on the linux subsystem for windows (an Ubuntu), and I now get completions with the python layer but only through "Helm completion at point" which opens in a new window - and not through a popup with company-complete.
M-x: company-diag gives:

Emacs 28.0.50 (x86_64-pc-linux-gnu) of 2020-04-28 on lgw01-amd64-049
Company 0.9.12

company-backends: (company-anaconda
 (company-semantic company-dabbrev-code company-gtags company-etags company-keywords)
 company-files company-dabbrev)

Used backend: company-anaconda
Major mode: python-mode
Prefix: ("a." . t)

Completions: none

I'd really appreciate any help you could give - thanks!


texts: Error adding Icon^M file to file name cache

texts:
On MacOS, if a folder has custom icon, there would be an invisible file named Icon^M in it. ^M being carriage return.  Kindly refer to https://superuser.com/questions/298785/icon-file-on-os-x-desktop for more details about such a file.

If I try to add the parent folder with M-x file-cache-add-directory, I get error "Filecache: file /xxx/xxx/Icon does not exist"

Is it possible to let Emacs ignore this file?


texts: Helm gtags dwim jump without overwrite current window

texts:
So, I have 2 files: tictactoe.cpp and tictactoe.h.  You can see the image for these two files below in Emacs. I have them stacked horizontally and also have tabbar to show the name of the files
I have helm installed and setup gtags to work.
I also mapped helm-gtag-dwim to a shortcut M-n.
Everthing works: whenever I am near a function call in my main tictactoe.cpp file, I can just do M-n and it would search for the definition and bring up the tictactoe.h file, with the relevant function highlighted.

However, my current window will get overwritten. For example, in current picture, tictactoe.cpp is on top, and tictactoe.h is at the bottom
In the tictactoe.cpp if I do M-n on instruction();, that top window will turn into tictactoe.h and highlight where the definition for instruction(); is.
In other words, I would lose the focus of my main code tictactoe.cpp and instead get 2 instances of tictactoe.h stacked on top of each other.
What I want: keep the main tictactoe.cpp or the top window stay in focused.  Then, whenever I do helm-gtag-dwim, the cursor should jump to the bottom window, helm then does its thing and highlight the relevant function call in the bottom window.
How can I achieve this for horizontal split as well as vertical split?


texts: In org-mode, a function to export to HTML file AND open?

texts:
In org-mode, if I do org-export-dispatch, then choose Export to HTML, I can then choose As HTML file and open. Four keystrokes though.

I'd like to reduce this to a single keybinding. However, I don't see a function to export to HTML file AND open the file in a browser. I see only the function org-html-export-to-html, which does not open the file.

How can I export to HTML and open the file with a single keybinding?


texts: projectile-switch-project not working with autoload

texts:
When I attempt to autoload projectile like so

(autoload 'projectile-global-mode "projectile" " t nil)

And then open Emacs I cannot use projectile-switch-project (Symbol's function definition is void: projectile-switch-project). However once entering a project and calling one of the other projectile commands I can then call projectile-switch-project without any problems. From what I can gather from the error message and the behavior of the problem, it seems to me as if projectile-switch-project isn't autoloaded. This error doesn't occur with any of the commands which further confirms my suspicions.

In saying this I am no elisp expert so I would like to see if any of you have experienced this problem and found a way to solve this.


texts: Evil and org-mode keybinding 't' conflict

texts:
In Spacemacs with evil and org-mode, the letter 't' is assigned to two functions:

org-todo  (don't need this because I use shift-arrow to cycle through todo states)
evil-find-char-to (I need this)

When in org-mode, 't' only works for org-todo.
How to assign 't' to only evil-find-char-to?

The solution by Bernardo Brik worked for Daniel Yang:
https://gitter.im/syl20bnr/spacemacs/archives/2016/03/31 > Mar 31 2016 13:51
(add-hook 'org-mode-hook ((define-key evil-normal-state-map (kbd "t") 'evil-find-char-to)))

But when I try it:
add-hook: Invalid function: (define-key evil-normal-state-map (kbd "t") (quote evil-find-char-to))

I am using Emacs 25.2.1 with Evil Spacemacs and org-mode on Linux.


texts:
I'm trying to get the same functionality as in spacemacs where package-install gives you a list of packages with fuzzy search. Pretty much smex for package-install. That way even if I don't know the exact name, I can still install the package. However, when I search this all I get are issues installing other packages.

Edit:
Here's a picture of what I would like:
. I would like fuzzy search combined with a menu instead of just a minibuffer for package-install


texts: Add more symbols to haskell `haskell-font-lock-symbols-alist`

texts:
I'm trying to add more symbols to haskell-mode's haskell-font-lock.

The documentation for haskell-font-lock-symbols-alist says:

  Alist mapping Haskell symbols to chars. Each element has the form
  (STRING . CHAR) or (STRING CHAR PREDICATE). STRING is the Haskell
  symbol. CHAR is the character with which to represent this symbol.
  PREDICATE if present is a function of one argument (the start position
  of the symbol) which should return non-nil if this mapping should be
  disabled at that position.

I'm trying something like:

(add-to-list 'haskell-font-lock-symbols-alist `("heart" . 2665))

But when typing 'heart' in haskell mode the font-lock won't work, although it works for ->, ., =>.

What am I missing ?


texts: Execute an ediff command while in one of the buffers

texts:
I want to mimic the behaviour of vim's do and dp in ediff mode. These two commands stand for "obtain diff" and "put diff". That is, if I'm on one difference in one buffer, pressing do would copy the difference from the other buffer, while pressing dp would copy the difference from the current buffer into the other buffer.

Now, it seems to me that various ediff- functions and variables do not work from within buffers, but only from ediff's control panel :(

Since I'm using spacemacs, I tried this:

(eval-after-load "ediff"
'(progn
(evil-define-key 'normal ediff-mode-map "do" 'spacemacs//ediff-get-changes)
(evil-define-key 'normal ediff-mode-map "dp" 'spacemacs//ediff-put-changes)))

(defun spacemacs//ediff-get-changes ()
"This function gets changes from the other window into the current window."
(cond ((eq (current-buffer) ediff-buffer-A) 'ediff-copy-B-to-A)
      ((eq (current-buffer) ediff-buffer-B) 'ediff-copy-A-to-B))
)

(defun spacemacs//ediff-put-changes ()
"This function puts changes from the current window into the other window."
(cond ((eq (current-buffer) ediff-buffer-A) 'ediff-copy-A-to-B)
      ((eq (current-buffer) ediff-buffer-B) 'ediff-copy-B-to-A))
)

Since I'm a complete emacs beginner, any pointers are more than appreciated, even just for vanilla Emacs. My goal is to execute one of these functions (ediff-get-changes/ediff-put-changes) from within a buffer, via a keybinding.


texts: "Catch-all" rule for faces in theme definition

texts: I am writing my own custom Emacs theme and I would like to express "if a face isn't explicitly listed above, don't color it".  Many modes have their own custom faces (e.g., Tuareg or Erlang mode) and I would rather not have to laboriously assign colors to every single one.


texts: How does one use flyspell in org buffers without flyspell triggering on tangled code blocks?

texts:
Imagine an org buffer in Emacs like:

* Title

Some text describing the title and the codew (sic) and whatnot.

#+BEGIN_SRC emacs_lisp
(setq backup-by-copying t)
#+END_SRC

I want flyspell to check the org buffer (and catch the spelling error in it) but ignore the content between the #+BEGIN_SRC and #+END_SRC marks. How does one go about that?


texts: What packages are available for modal editing?

texts:
What packages are available for modal editing in Emacs? What do you use and why?

Let's try to post one package per answer. I propose mention advantages and
 shortcomings of every package.

Here is my definition of modal editing (I couldn't find dedicated Wikipeadia
article):

Modal editing — style of text editing when user periodically switches
usually between “normal mode” when keys do not cause inserting of their
characters but perform various operations on text and “insert mode” when
keys insert corresponding characters. There may be more modes, of course.
Most modern editors are not modal. An example of modal text editor is Vi
(Vim).