texts: How start a new line in Yasnippet, with the comment?

texts:
Q: how do I get yasnippet to insert the comment sign, when I press return to start new line?

For example, my snippet looks like this

         ;; $1 .
         ;; / END
         $2

When the cursor is on the $1, and I'm typing some text, I would like to press return.
 It will start a new line, but the ;; is missing on the new line.

I found nothing on this specific issue. I could also use elisp forms to create a new mapping on the new line, like (concat comment-start), but it's not clear to me how to expand them appropriately.

See the comment below.


texts: How to get a list of all the buffers in elisp?

texts:
I am trying to get a list of buffers through elisp. So I created the following function:

(mapcar (function buffer-name) (buffer-list))

This works when I do something like:

(minibuffer-message (mapcar (function buffer-name) (buffer-list)))

However, the following line of code does not work:

(insert (mapcar (function buffer-name) (buffer-list)))

Q: Could this just be a noob mistake? Is there a better way of doing it?


texts: Add text property, when global-font-lock mode is on

texts:
I am trying to set the foreground color for first line in my buffer which has global-font-lock ON.

Buffer contents -

(ignore)
(add-text-properties 1 8
                                         '(:foreground "red"))
;;since add-text-properties didn't work, i tried with add-face-text-property
(add-face-text-property 1 8 '(:foreground "red"))

When i do eval-buffer, i like to see the first line, (ignore) made red. But it is not so. I referred here to know the function, add-text-properties doesn't work when font-lock mode is ON.

Is there a way one can change the properties for text that lies between a start and end point?


texts: How to protect myself from my own mistakes?

texts:
I use Emacs for programming and also read mail in Gnus. My problem is that I'm typing fast, switching buffers and Windows etc, and too often accidentally hit some key that is bound to some command that screws everything up. And I have no idea what I did hit.
Could be harmless things like suddenly my summary buffer in Gnus start to line wrap. But also serious things that screws up the Gnus information about mailboxes and mails, and I have to spend hours to try find a backup of those files and get things to a reasonable state again.
So first the simple question, is there a way to let emacs produce a "command log"? I.e. I can go into a log file and see that I accidentally hit gnus-do-something-unwanted so I can more easily find out how to get back to where I was before the incident?
Now, is there a way to globally in Emacs set so that all commands but those I have specified gives a dialog Do you really want to..?. While I use Emacs most of the day I only use a subset of all commands. And maybe I could list them in a .emacs.what.i.use.el file so that any emacs command outside those would bring me a dialog? This way preventing the disaster caused by a single accidental keystroke in Gnus or other mode?
If not possible, maybe there is a way to unbind all keys beside those I really use in Gnus? Lik (gnus-unbind-all-keys-beside ....)? :)


texts: How to change current-directory with emacsclient?

texts:
I am trying to change the default directory using emacsclient, but it isn't working as I had hoped.

$ cd
$ emacsclient -e '(emacs-version)'
"GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)\n of 2020-02-19"
$ emacsclient -e '(setq default-directory "/home/joe/system-test/auth/")'
"/home/joe/system-test/auth/"

M-x describe-variable RET default-directory RET

  default-directory is a variable defined in ‘C source code’.
  Its value is "/home/joe/"
  Local in buffer shell; global value is nil


texts: Accessing regular expression groups outside a buffer

texts:
The code from here accesses groups of a regular expression match in a buffer in interactive mode:

(let ((re (concat "\\([ \t]*" org-clock-string " *\\)"
                        "\\([[<][^]>]+[]>]\\)\\(-+\\)\\([[<][^]>]+[]>]\\)"
                        "\\(?:[ \t]*=>.*\\)?")))
        (when (looking-at re)
          (let ((indentation (match-string 1))
                (start (match-string 2))
                (to (match-string 3))
                (end (match-string 4))
                (use-start-as-default (equal end-as-default nil)))

But match-string n fails with in non-interactive mode, for example in the *scratch* buffer:

(string-match "\\([0-9]?[0-9]\\):\\([0-9]\\{2\\}\\)" "09:20")
0

(match-string 0)
#("save" 0 4 (fontified nil face font-lock-comment-face))

How can I access regular expression groups outside a buffer?

Update: after reading Strange behaviour of match-string/string-match adding the optional argument to match-string doesn't help and I get an error:

(string-match "\\([0-9]?[0-9]\\):\\([0-9]\\{2\\}\\)" "09:20")
0

(match-string 0 "09:20") ;; Debugger entered--Lisp error: (args-out-of-range "09:20" 9 15)

When I run it again, then the last expression returns "09:20", even after I restart Emacs ([this thread from the comments]. When I run the code in emacs -q -nw, then I get the error above.


texts: How can I easily word wrap long text files that include programming code

texts:
In emacs, the command "escape-q" word wraps a paragraph. However a lot of text I copy from the internet has paragraphs that each consist of several sentences, but are not separated by blank lines. Also, where code is embedded in the text, unless it is separated by a blank line from the previous text, it gets gathered up into the paragraph destroying the separate lines and indentation of the code.

To word wrap these and preserve the paragraph breaks etc I have to go through the file and insert blank lines, which is long-winded and tedious in a long file..

Is there a way of word wrapping such text, by "select all" on a long file,  without inserting blank lines?

Here's an example:

This is some text as copied from the internet, and pasted into emacs

Hello World
 The famous "hello world" program, is the first program every programmer writes. It is one of the simplest possible programs to write, but there is still a lot to learn about what happens below the surface.
 The hello world code in C:

 #include <stdio.h>

 int main(int argc, char **argv)
 {
  char str[]="Hello world!!";
  printf("%s\n",str);

  return 0;
 }

There it is, very simple to look at, only 5 real lines of meaningful code. However, all 5 of those lines are worth looking at in detail.

If I select it all and use "escape-q" I get this:

Hello World  The famous "hello world" program, is the first program
every programmer writes. It is one of the simplest possible programs
to write, but there is still a lot to learn about what happens below
the surface.   The hello world code in C:

 #include <stdio.h>    int main(int argc, char **argv)  {   char
str[]="Hello world!!";   printf("%s\n",str);

  return 0;  }

There it is, very simple to look at, only 5 real lines of meaningful
code. However, all 5 of those lines are worth looking at in detail.

And, of course what I really want is this:

Hello World
 The famous "hello world" program, is the first program every programmer writes.
It is one of the simplest possible programs to write, but there is still a lot
to learn about what happens below the surface.
 The hello world code in C:

 #include <stdio.h>

 int main(int argc, char **argv)
   {
     char str[]="Hello world!!";
     printf("%s\n",str);

     return 0;
   }

 There it is, very simple to look at, only 5 real lines of meaningful code.
 However, all 5 of those lines are worth looking at in detail.

Acknowledgement: I copied the snippet from this BetterOs.org Tutorial. Thanks to the author for that excellent tutorial, and hope he doesn't mind.


texts: How to configure latest 32-bit emacs & AUCTeX in Windows 7?

texts:
I'm on Windows 7, 32-bit processor and I'm trying to set up emacs and AUCTeX with RefTeX. I've followed Joachim Schlosser's english guide and Youtube tutorial in German (even if I don't understand German).

When I open a *.tex file, there are no Preview or LaTeX menus, instead a spartan TeX menu that doesn't offer the possibility to customize AUCTeX. Can someone please help me get AUCTeX to work the preview-latex feature that is supposed to display math expressions inside the buffer and not in a separate pdf program such as SumatraPDF? I've also downloaded the appropriate png.dll and zlib.dll (see guide above).

I'm starting to doubt whether I got the right versions of emacs and AUCTeX for my OS. I've got emacs-24.4-bin-i686-pc-mingw32.zip and auctex-11.88-e24.4-msw.zip, are these the correct zip files?

This is my .emacs file which I have created by copy-pasting blocks of code from different places in the net, since I don't know elisp.

(server-start)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq-default ispell-program-name "aspell")

;;; AUCTeX
;; Customary Customization, p. 1 and 16 in the manual, and http://www.emacswiki.org/emacs/AUCTeX#toc2
(setq TeX-parse-self t); Enable parse on load.
(setq TeX-auto-save t); Enable parse on save.
(setq-default TeX-master nil)

(setq TeX-PDF-mode t); PDF mode (rather than DVI-mode)

(add-hook 'TeX-mode-hook 'flyspell-mode); Enable Flyspell mode for TeX modes such as AUCTeX. Highlights all misspelled words.
(add-hook 'emacs-lisp-mode-hook 'flyspell-prog-mode); Enable Flyspell program mode for emacs lisp mode, which highlights all misspelled words in comments and strings.
(setq ispell-dictionary "english"); Default dictionary. To change do M-x ispell-change-dictionary RET.
(add-hook 'TeX-mode-hook
          (lambda () (TeX-fold-mode 1))); Automatically activate TeX-fold-mode.
(setq LaTeX-babel-hyphen nil); Disable language-specific hyphen insertion.

;; " expands into csquotes macros (for this to work babel must be loaded after csquotes).
(setq LaTeX-csquotes-close-quote "}"
      LaTeX-csquotes-open-quote "\\enquote{")

;; LaTeX-math-mode http://www.gnu.org/s/auctex/manual/auctex/Mathematics.html
(add-hook 'TeX-mode-hook 'LaTeX-math-mode)


texts: Does it exists any library and or functionality that provides an API for indenting major modes?

texts:
I am currently maintaining a fork of a major mode and I usually get by through reusing snippets other people have written that provides indention for similar languages. However, this does lead to a lot of duplicated code and or errors, since my new code is not that far from the original.

Does Emacs provide some sort of library/package in which I can specify start/end of blocks and other rules for indention and then delegate the indention to this package/library?


texts:
I want to write a function which equally add "-" character on each sides of bold text. The future line should be no longer then fill-column

Input:

- <1900-01-01 Mon> *XX century* <1999-12-31 Fri>

Output:

- <1900-01-01 Mon> --------------- *XX century* --------------- <1999-12-31 Fri>


texts:
I am trying to use org-mode for scheduling tasks with a time with no avail. Every time I set it the task is not repeated:

On my task I use C-c C-d and then type in 2015-09-15 9:00AM-11:00AM +1w.

Is something with my formatting wrong or am I missing something bigger?


texts:
I'm putting all my backups in a directory:

(defvar saves-dir (expand-file-name "~/.saves/"))
(setq backup-directory-alist `((".*" . ,saves-dir)))

This creates annoying filenames with ! in them, such as !home!bjourne!.fonts.conf.~1~. How do I change that so it instead becomes _home_bjourne_.fonts.conf.~1~.?

Come to think of it, even better would be if emacs created a directory tree and kept each backup file in its own directory. Like this:

~/.saves/home/bjourne/wtf.txt/~1~
~/.saves/home/bjourne/wtf.txt/~2~
~/.saves/home/bjourne/wtf.txt/~3~
~/.saves/home/bjourne/whatever/program.c/~1~
~/.saves/home/bjourne/whatever/program.c/~2~

So if this naming scheme was possible, I'd prefer that.


texts: Incremental search in all visible buffers

texts:
Here's a feature I always wanted: I have two buffers opened side-by-side and I'd like to be able to start an incremental search in one of those buffers, but in a way which highlights results in both buffers.

This would be extra useful to make sure I didn't make a typo - it's sometimes hard for me to be sure just by looking at the text. Alternatively, something like idle highlight but for all visible buffers would work as well.

Is there a package for that? Can it be done?


texts: Why don't major modes just inspect the faces?

texts:
When writing a major mode, it's often useful to know 'is point in a string?' 'is point in a comment?'.

Most major modes seem to attempt to parse the programming language. For example:

python-syntax-content calls syntax-ppss
haskell-fill-paragraph calls syntax-ppss and re-search-forward
c-in-comment-line-prefix-p moves point around and calls looking-at
sp-point-in-comment calls syntax-ppss but also checks if it's on a comment delimeter

However, this doesn't work in some cases. In org-mode buffers, comments in source blocks are not correctly detected by these approaches.

It also seems pointless, since the buffer is already showing comments highlighted.

Instead, you could simply inspect the faces at point:

(defun wh--get-faces (pos)
  "Get all the font faces at POS."
  (remq nil
        (list
         (get-char-property pos 'read-face-name)
         (get-char-property pos 'face)
         (plist-get (text-properties-at pos) 'face))))

(defun wh-string-p (pos)
  "Return non-nil if POS is inside a string."
  (memq 'font-lock-string-face (wh--get-faces pos)))

Why don't major modes do this? The buffer is already fontified, so I would expect this to be faster, more robust, and require less code.


texts: How to save a keyboard macro as a Lisp function?

texts:
Very frequently I would need to perform the set of steps requiring multiple key strokes. For the same session those steps can be recorded in a keyboard macro.

An example is saving a frequently executed search/replace operation as a keyboard macro. But that macro is lost when I quit emacs.

How can I save my frequently used keyboard macro as a Lisp function?

For the sake of simplicity, I want to save the action of replacing "abc" with "def" as a function so that I can reuse it across emacs sessions.


texts: Conflict on the meaning of * when including Org mode files in a calendar diary

texts:
I want to include org-mode files into the default diary file of calendar mode, but there is a problem: the * symbol is used to match unspecific day. for example,

** 2nd heading

in the ~/diary file would generate "2nd heading" to appear each day. Is it possible to change how the calendar/diary mode mark unspecific day? like change * to % ?


texts: How do I specify a daemon to start with alternate emacs version with emacsclient

texts:
I have found this script from here

#!/usr/bin/env zsh
# Checks if there's a frame open
emacsclient -n -e “(if (> (length (frame-list)) 1) ‘t)” 2> /dev/null | grep t &> /dev/null
if [ “$?” -eq “1” ]; then
 emacsclient -a ‘’ -nqc “$@” &> /dev/null
else
 emacsclient -nq “$@” &> /dev/null
fi

that seems nice for starting the daemon with -a '' only if there is not a server up. However at my work, our emacs and emacsclient intended to be used are prefixed with abc, so we have abc_emacs and abc_emacsclient. There are older Emacs in the system with the regular names.

So how do I modify a command like emacsclient -a '' -nqc somearg so that it starts the server in the case of no server being up with abc_emacs instead of emacs?


texts:
How can I remove all but the first n characters of a every line in the file buffer?

What I tried

Mark region
C-x r k #but this is cumbersome when the length of lines are very varied, and there are over 100 lines


texts: how to treat underscore as part of word in auctex?

texts:
I'm using auctex, and trying to make underscores count as part of a word. There are numerous answers to this question, and I've tried the following

(modify-syntax-entry ?_ "w")
(modify-syntax-entry ?_ "w" latex-mode-syntax-table)
(modify-syntax-entry ?_ "w" LaTeX-mode-syntax-table)
(modify-syntax-entry ?_ "w" tex-mode-syntax-table)
(modify-syntax-entry ?_ "w" TeX-mode-syntax-table)

this works for any other mode, but not for my auctex files. I'm not even sure which is the correct syntax table (for example C-h m tells me that I'm in LaTeX/FMP mode, but there is no syntax table called LaTeX/FMP). Any ideas how to proceed?

Using emacs 25.1.1, auctex version 11.90.0.


texts: How to use zenburn with a darker background?

texts:
I have Emacs 24.5.1, installed zenburn-theme off of melpa-stable and loaded the theme in my .emacs with (load-theme 'zenburn). I like all the colours except the background. It's a bit too bright.

How do I set the background colour to a darker colour?


texts: universal argument can not work in this function?

texts:
I made a function in Windows Emacs like:

(defun explorer (&optional tex)
  (interactive)
  (let* ((current-path (file-name-directory (buffer-file-name)))
         (file-path-at-point
           (file-name-directory
             (concat current-path (if (or (ffap-file-at-point) (ffap-url-at-point))
                                (substring (ffap-url-at-point) 5))))))
  (if (equal tex t)
     (shell-command (format "\"C:/Program Files/TeXnicCenter/TeXnicCenter.exe\" %s" (concat (file-name-sans-extension (buffer-file-name)) "\.tex"))))
  (shell-command
     (format "explorer.exe %s"
        (convert-standard-filename (or file-path-at-point current-path))) t nil)))

 (bind-key "<f11>" 'explorer)

In my opinion, when I press f11, this function should open window explorer for me, and if I press C-u f11, it should open a LaTeX file of current directory with Texniccenter.exe, but why doesn't it work, it just open the directory?

PS: if there is some other problems of this function, can anyone give me some advice?


texts: tramp and sudo: how to edit files under another account

texts: On local machine, I am using the account as test1, and I could use the same account to login remote server. After login as test1 on remote server, I could run sudo su - oracle to change as oracle user, and then I could all files under account of oracle. But I don't know the password of oracle, I could only change to oracle using sudo su - oracle. So how to use tramp to edit the file from oracle account on remote server? I read the tramp document, it said we have sudo and su option. I can't simple use su since I don't have the password of oracle. But if using sudo, looks like it doesn't work as the emacs hangs forever.


texts: Sending `C-c C-c` to the process window without swithcing to it

texts: In ESS mode, I sometimes send some code to the process buffer and want to cancel it using C-c C-c. Can I do this without actually switching to the process window from the script window?


texts: How to use magit-commit-arguments to set commit author

texts:
I'm trying to use a .dir_locals.el file to override the author field in Git commits (so when I'm committing something in a work repo, I use my work email).

It looks like magit-commit-arguments is what I need to frob, but I can't seem to get it to work. I've tried the following:

((nil . ((magit-commit-arguments . ("--author John SJ Anderson <john@working.work>")))))

but it doesn't take effect. The variable's local value does get set, but either Magit ignores it, or I get various type mismatch errors from different levels of the Magit code.

(Note: I have a bunch of work repos, and I don't want to set this on an individual repo level in each individual .git/config. I'm also not interested in solutions outside of Emacs; I already have a solution that works from the CLI, but it depends on environment variables and won't easily port to Emacs. I want something that will work, with Magit, inside Emacs.)


texts: How could i create helm-find-file function that copies selected file path

texts: Is there a way to create helm-find-files function that would copy file path upon completion instead of opening it? It's important that original helm-find-files function would still open files.


texts:
I use org-mode combined with htmlize to maintain my personal webpage. For example, I have a directory

webpage/
├── bar.pdf
└── foo.org

0 directories, 2 files

I want to link to the file bar.pdf in the org file foo.org. My foo.org file is

#+Title: testing htmlize links

This is a link to [[./bar.pdf]].

When I htmlize the file foo.org the output is

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

    <title>foo.org</title>

#+Title: testing htmlize links

This is a link to ./bar.pdf.

The problem is with the line

    This is a link to ./bar.pdf.

Somehow htmlize is linking to "nil:nil" instead of ./bar.pdf. What's going on here?

Issuing M-x org-version yields

Org mode version 9.0 (release_9.0-16-g8826f2 @ /home/brian/elisp/org-mode/lisp/)

I think org version 9.0 may have changed how links work and htmlize is not cooperating. If this is so, how can I fix my problem?


texts: The syntax highlight and indentation of source code block in exported html file for org-mode

texts:
When I insert C code block inside an org-mode file, the syntax highlight and indentation of the source code are customized as I wanted.

When I export it into a html file, the syntax highlight in the html file is exactly the same as in Emacs. But the syntax highlight works better with the color-theme of my Emacs. For instance, the { symbol is white in my C code block, but my color-theme is dark, if I export it into html, the background of the html file is white too, it means, you cannot see { in the source code block of exported html even thought it is there.
The indentation of the source code is normal in my Emacs (as I customized it), but the indentation of the source code in exported html file will be different, it adds more spaces for indentation.
If I export the same org file in emacs -q, they are normal in the exported html file, but the syntax highlight and indentation of the source code will be the default configuration of Emacs. So it means font-faces configurations in init.el will affect org-export.

So my question is: when I export an org-mode file which contains source code block into html file (or maybe other formats such as PDF as well), is it possible to get rid of all my own configuration of font-faces about the source code and do it as in emacs -q?

Update:

The second problem is solved by setting (setq org-src-preserve-indentation t) either in init file or by running it through M-: (eval-expression).

Update2:

The first problem is solved by Set the background of org-exported <code> blocks according to theme.

The third problem is not important if 1st and 2nd problems are solved.


texts: How can I eliminate the side effect of left margin?

texts:
I've set a left margin like this:

(set-window-margins (get-buffer-window) 20 0)
(let ((gutter-sep (concat (make-string (- (car (window-margins (get-buffer-window))) 2) ? ) "+")))
  (propertize "." 'display `((margin left-margin) ,gutter-sep) 'intangible t)))

The issue is shown in this screencast :

How can I make the region area not highlight the margin area?

Edit:

a better way to reproduce this issue is:

emacs -Q
(set-window-margins (get-buffer-window) 20 0)
(overlay-put (make-overlay (point) (point)) 'before-string (propertize "." 'display `((margin left-margin) ,"Hi there!")))
(hl-line-mode)

How can I remove the highlight of "Hi there!"?


texts: How to increment several numeric keys of a hash-table

texts:
Q:  How to programmatically increment several numeric keys of a hash-table.

Background:

I am working on a modificion of speedbar to support the concept of speedbar-get-marked-files -- speedbar -- mark/unmark directories/files -- `speedbar-get-marked-files`  I have setup a hash-table that consists of buffer line numbers for the keys, and the values are absolute filenames or directories.

When clicking on a + sign to expand directories, speedbar inserts additional files and directories underneath the expanded node.  It is at this point that the hash-table needs to be modified, since puthash replaces existing entries.  Programmatically, I already know how many new lines will be inserted.

Example:

A buffer contains 9 lines (in this case all directories), with a corresponding hash-table.

1  "/usr/"
2  "/usr/bin"
3  "/usr/include"
4  "/usr/lib"
5  "/usr/libexec"
6  "/usr/local"
7  "/usr/man"
8  "/usr/sbin"
9  "/usr/share"

We click on the expandable directory /usr/lib and programmatically we know that 8 new directories and 27 new files will be inserted.  Therefore, a total of 35 new lines will be added underneath line 4 -- the previous hash-table entries of 5, 6, 7, 8 and 9 all need to be renumbered by adding 35 to each one.  The new hash-table should become:

1  "/usr/"
2  "/usr/bin"
3  "/usr/include"
4  "/usr/lib"
40  "/usr/libexec"
41  "/usr/local"
42  "/usr/man"
43  "/usr/sbin"
44  "/usr/share"


texts:
Is Guile Emacs, the project to integrate a guile-based elisp interpreter, still alive?

It was making headway a few years ago, and seemed like a promising project.  Is it on hold because of lack of interest or time?  Or is it awaiting a maturation of the guile language itself?


texts: Defining a function that takes as an input the current buffer's path

texts:
I am hoping to define an interactive function that I can invoke with M-x <function-name> and that will:

Automatically grab the path to the file
Run the following code on it:

(require 'tramp)
C-x C-f /sudo::/path/to/file

In case it is not clear, the goal is to have this function (re-)open the file in sudo mode.

How can I go about writing this function? Sorry if this is a bit elementary, I have just started to learn elisp.


texts: (Windows Terminal) and xterm-mouse-mode has a problem

texts:
Don’t really know where to post this issue, or even the nature of it, but it can get very frustrating. This is not exclusive to Windows Terminal, MobaXTerm has the same problem.
So I use emacs under Windows Subsystem for Linux 2. Using the mouse works fine in most cases, but there are some elements which makes it completely freak out. I tried both on Spacemacs, and a clean emacs.d config. In Spacemacs, I can click on many links without problem, but when I click on a last opened file, it freaks out. It shows a bunch of down-mouse1 ESC [ < 0 ; 1 1 1 in the command bar and every button or key I press will add on this list. There is no escape, I have to restart emacs. Another place this happens, which standard emacs shares, is customize-group. Clicking on search, a title works fine, but as soon as I click Show Value it freaks out again. I will add a gif to demonstrate how it works until it breaks (a bit cursor offset)


texts: When I give a new async command with an interactively called async-shell-command, it gives a message "A command is running in the default buffer.  Use a new buffer? (y or n)". I think this behaviour is unnecessary, every time I'm giving a new command, I'll press y. Can I disable this behavior in some way?


texts: Removing a latex command (by matching braces)

texts:
In LaTeX, I sometime define a command of the type \tmpcmd{TEXT\cmd{MORE TEXT}}. After I am done, I want to remove all instances of this command, so I usually do a replace-string of \tmpcmd with an empty string. However, this still leaves {TEXT\cmd{MORE TEXT}}. Is there a way to  replace the previous string with TEXT\cmd{MORE TEXT} (without the braces)? I guess the main problem is matching the braces.

Also, is there a way to apply this action to multiple files at once?


texts:
First of all, from http://www.emacswiki.org/emacs/AllOut:

  Allout outline mode is part of GnuEmacs.

  Allout outline mode provides extensive outline formatting and
  manipulation beyond standard emacs outline mode. It provides for
  structured editing of outlines, as well as navigation and exposure. It
  also provides for syntax-sensitive text like programming languages.
  (For an example, see the allout code itself, which is organized in an
  allout outline framework.)

If you view the “allout.el” itself, and trigger M-x allout-hide-bodies, you’ll get an indented outline view of the source code.

How can I configure allout-mode to understand markdown syntax so that I can use it to navigate and show/hide sections in a markdown file?

Thanks


texts: How to turn off iedit-mode quickly after finishing an edit?

texts: I like how multiple-cursors is turned off when pressing RET, and this is not the case for iedit-mode, how can I emulate that behavior?


texts:
Is it possible to enable fuzzy matching in helm-bibtex?

The following example illustrates why it would be very useful to enable it.  Imagine that typing "sm" returns these two matches.

Smith 2015
Smith 2016

To choose between the two, the logical thing would be to type "sm 16".  But without fuzzy matching, helm-bibtex says that there are no matches.

Enabling global fuzzy matching in helm ((setq helm-mode-fuzzy-match t)) does not work for helm-bibtex.


texts:
I experience some weird behavior with tooltips:

(progn
  (let* ((start (point))
         (end (progn (insert "test") (point)))
         (ov (make-overlay start end)))
    (overlay-put ov 'help-echo
                 (propertize "xxx" 'display '(image :type jpeg :file "~/foo.jpg"))))
  (display-buffer-other-frame (get-buffer-create "dummy")))

Evaluating this code and moving the mouse pointer over test I get a tooltip
displaying the image file foo.jpg. The tooltip appears as a box with a
light yellow background color with sharp corners.

But the moment I click into any frame/window the tooltip changes. Now
the tooltip contains no image but the text xxx. Furthermore the
tooltip appears as a transparent black box with rounded corners.

What's going on here? Are their two different tooltip mechanisms with
different capabilities?

If I remove the code lines creating/displaying buffer dummy I
never see the tooltip with the image (the first one); I see only the tooltip
with the text xxx (the second one).

Edit: Here are screenshots of the two different tooltips.


texts: Emacs init file with yasnippets and magit submodule update error

texts:
I have cloned yasnippets repo repo in ~/.emacs.d/yasnippet-snippets.
I would like to synchronize it each time I start Emacs (btw, it would be nice to do it only if there is a connection available), my current (pretty raw) code is:

;; ~/.emacs
(use-package yasnippet
  :config
  (cd "~/.emacs.d/yasnippet-snippets")
  (magit-submodule-update)
  (yas-reload-all)
  (cd "~/"))

But I am getting this error in *Messages*, probably because it changes directory before finishing the magit process:

error in process sentinel: user-error: Not inside a Git repository
error in process sentinel: Not inside a Git repository

*Using: use-package


texts: Server-edit Automatically When Buffer is Killed

texts:
I'm considering using emacs as a server (using (server-start)) but I do not want to use C-x # to kill buffers. I've heard of the -n option for emacsclient, but I'm concerned that it may cause unwanted behavior when other programs use emacsclient. I've thought about using this:
(add-hook kill-buffer-hook server-edit)

Would this work?


texts: View custom org agendas without first storing in org-agenda-custom-commands?

texts:
What is the preferred method of building (viewing) a custom agenda without modifying org-agenda-custom-commands?  I am hoping that there is a function like org-agenda-list or org-todo-list that accepts a custom agenda command definition like those that would be added to `org-agenda-custom-commands.

Edit: Essentially just bypassing the org-agenda dispatcher / stored custom commands

An example taken from the org-mode manual:

(setq org-agenda-custom-commands
  '(("O" "Office block agenda"
     ((agenda "" ((org-agenda-ndays 1)))
      (tags-todo "+PRIORITY=\"A\"")
      (tags-todo "computer|office|phone")
      (tags "project+CATEGORY=\"elephants\"")
      (tags "review" ((org-agenda-files '("~/org/circuspeanuts.org"))))
      (todo "WAITING"))
     ((org-agenda-compact-blocks t)))

I think that org-agenda concatenates the results of individual sub-commands (like org-tags-view) internally.  What I'm looking to do is skip the traditional org-agenda dispatcher and construct the agenda directly from an arbitrary definition like (from the above):

'((agenda "" ((org-agenda-ndays 1)))
  (tags-todo "+PRIORITY=\"A\"")
  (tags-todo "computer|office|phone")
  (tags "project+CATEGORY=\"elephants\"")
  (tags "review" ((org-agenda-files '("~/org/circuspeanuts.org"))))
  (todo "WAITING"))
 ((org-agenda-compact-blocks t)))

The key being that the definition is subject only to the constraints for org-agenda-custom-commands.  It could simply be a tags agenda or a multipart one like that shown.

I originally thought that the user-defined function type that can be added to org-agenda-custom-commands might be the trick, but it looks like it's treated as a match predicate (it's not really mentioned in the documentation).

I'm asking because I'd like to view an agenda that has a dynamically-generated definition.


texts:
We have org-babel-get-src-block-info and org-babel-view-src-block-info.

Is there anything similar to programatically (or preferably interactively) changing the choices from the src-block-info?

If not, what would be the recommended way to do that?


texts:
When I evaluate
(setq sample-list (list 'abc 'def))
(message "%s_suffix" sample-list)

Output is:
(abc def)_suffix

But I need to get:
abc_suffix def_suffix

How can I get the output?


texts: What doesn't my JavaScript layer automatically automatically format my JavaScript files?

texts:
When I open a JavaScript file, the file appears as plain text. When I activate javascript-mode in more (SPC SPC) on a .js file, then the file is correctly formatted.

I have the layer installed with the following configuration under dotspacemacs-configuration-layers:

(javascript :variables
            javascript-backend 'tern
            javascript-fmt-tool 'prettier
            javascript-import-tool 'import-js
            node-add-modules-path t
            js2-include-node-externs t
            js2-strict-missing-semi-warning nil
            javascript-repl `nodejs)

I have been verifying my installation + configuration here. I don't see anything out of the ordinary. Here is my .spacemacs file for reference.


texts:
Upon getting a task done from org mode

* TODO A task

Invoke C-c C-t, change it's state to

DONE a task

How could add a active timestamp to the finished task?


texts: pdf export undefined citation, missing bibliography

texts:
When I export with org-latex-export-to-pdf, the pdf does not contain the nicely-formatted list of references as expected, and the citation is just [?] instead of an actual link. It's just the single page as in the screenshot below. Org-mode's tooltip seems to understand the link:

However, when exporting I get this warning: PDF file produced with warnings: [undefined citation].
How do I get a list of references at the end?
Here is my simple.org:
#+OPTIONS: html-postamble:nil toc:nil num:nil
this is a simple test with a citation cite:9422781.

bibliographystyle:unsrt
bibliography:simple.bib

Here is my simple.bib:
@ARTICLE{9422781,
  author={Oleghe, Omogbai},
  journal={IEEE Access},
  title={Container Placement and Migration in Edge Computing: Concept and Scheduling Models},
  year={2021},
  volume={9},
  number={},
  pages={68028-68043},
  doi={10.1109/ACCESS.2021.3077550}}

Here is the simple.tex file produced:
% Created 2021-05-23 Sun 12:17
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Firstname Lastname}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Firstname Lastname},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 27.1 (Org mode 9.5)},
 pdflang={English}}
\begin{document}

this is a simple test with a citation \cite{9422781}.

\bibliographystyle{unsrt}
\bibliography{simple}
\end{document}

This is what I get after exporting to pdf:

However, exporting to HTML seems to work (although I'd prefer something like 1 instead of the 9422781 link):

versions I'm using:

org-mode 9.5
emacs 27.1
org-ref 1.1.1
Mac OSX 10.14.6
doom-emacs v2.0.9
pdflatex 3.14159265-2.6-1.40.21 (TeX Live 2020)
latexmk 4.69a


texts: I cannot manually edit date fields before closing bracket in org-mode buffer

texts:
I am aware of the syntax for creating repeated tasks in org-mode, but for some reason I am now unable to manually edit the text of the "Scheduled" and "Deadline" date fields to do this, unless I do the workaround described below:

Example date field as it appears in my org-buffer:

    **** TODO [#B] Order kitty litter
DEADLINE: <2017-02-07>

Example date field as copied and pasted:

    **** TODO [#B] Order kitty litter
DEADLINE: <2017-02-07 Tue + = >

If I place the point before the closing angle bracket, as I would normally do to add repeating-event syntax, I cannot type. The only way I can edit this date field manually is if I first move the point to the opening angle bracket and destroy the syntax by adding a random character, e.g. <a2017-02-07., which turns the filed into plain text. I can then move the point to the closing bracket, add the repeat syntax, and then remove the character I inserted to make it editable. But this is not behavior I have encountered before, so something must have changed in my config.

Can anyone point me to a config variable or other problem that might be the culprit? For example, where is that hidden + = text before the closing bracket coming from?


texts: regexp-filter just searches headlines (org agenda view)

texts:
I have a problem with the filtering function org-agenda-filter-by-regexp:
It just searches the headlines of the entries not the whole entry text.
Example:
 * title :work:
 text

Searching for the tag 'work' gives the correct and only headline 'title' in the 'Org Agenda' buffer. But after the regexp-filtering with (= text) the headline disappears because(?) 'text' isn't part of the headline.
I know I can start with the function for 'Search for keywords' (usually C-c a s) and then filter by the tag 'work' but mostly I start with tag searching and then look for keywords.
The documentation says:
"only show agenda entries matching the regular expression the user entered."
But it seems that it searches only the headlines of the entries.

EDIT: Not a solution, just a suggestion. Maybe it helps somebody. If you want to search for a keyword "text" and you know it will have to many results you can add the tag as an additional keyword: :work: -- but in this case only the direct tag of the headline can be taken into account.


texts:
Vim has an option called scrolloff (e.g. set scrolloff=7) which automatically scrolls down or up to keep the cursor/point from getting within a certain distance of the top or bottom of the window.

Is there a way to emulate this behavior in vanilla Emacs / evil mode? (preferably without advising every function that's capable of moving the point)

Emacs is capable of scrolling line by line (e.g. C-u 1 C-v and C-u 1 M-v), but the default behavior seems to be to scroll by full or half screens (maybe to limit the number of times that the entire screen needs to be updated?).


texts: Best (minimal keystrokes) method of jumping to the start of a function and then back to current point?

texts:
Sometimes I'm inside a long function where the start of the function is not visible. While I have recently learned about (which-function-mode) which tells me in the modeline the name of the function, I'd like to be able to quickly jump to the start of the function and then back as easily as possible.

So far I've found two solutions.

Using a mark

C-SPC        Mark current point

C-M-a        Move backward to start of function

C-x C-x      Exchange mark with current point (jumps you back)

C-g          Cancel marked region
Using a register

C-x r SPC p Save current point in register 'p'

C-M-a       Move backward to start of function

C-x r j p   Jump to point saved in register 'p'

Is there a better way? I'm not opposed to adding some elisp to my .emacs file.


texts:
I'm trying to draw a pie chart from an orgmode table. Let's keep it as simple as possible.

#+TBLNAME:kuchen
| 100 | ABC |
|   3 | DEF |
| 123 | XYZ |

#+name: pie-chart (kuchen = kuchen)
#+begin_src R :file pie.png
pie(kuchen[,1], labels = kuchen[,2])
#+end_src

But the resulting pie.png is 0 Bytes, empty.

Error message:

Fehler in pie(kuchen[, 1], labels = kuchen[, 2]) :
  Objekt 'kuchen' nicht gefunden
Ruft auf: <Anonymous> -> <Anonymous> -> pie
Ausführung angehalten

Translation: error in pie, object 'kuchen' not found, calls  ->  -> pie, execution halted

I found this guide: https://orgmode.org/worg/org-contrib/babel/intro.html#meta-programming-language . But if I simply copy the example given there into emacs and export it to html, the (in the case of the guide:) dirs.png is 0 Byte = empty as well.

At a first glance, this website seemed very helpful as well:

https://orgmode.org/worg/org-tutorials/org-R/org-R.html

But the given »actions« on a »intable« don't include any »pie« command.

Any ideas how to get a pie chart from an orgmode table?

If the table needed a third column with percentage, no problem. Any solution welcome.


texts: Turning relative numbering on (with linum-relative) in Spacemacs only when in normal mode

texts:
In Vim I have relative numbering which is turned on most of the time but it's turned off when in insert mode or when the window losses focus (both when changing to another Vim window or when changing to another tmux window).

How do I set this up in Spacemacs?

I think my main issue is that I don't know how to make Spacemacs do certain actions only when in certain evil-modes (I'm really new to Emacs, I've been using Vim until I discovered the wonderful Spacemacs).


texts: Is it possible to open file then load slime automatically?

texts:
So I start up emacs open foo.lisp then I would start slime and the window splits nicely. Except I don't want to start slime manually.

So is it possible to switch to or startup slime when I open an appropriate file?

Such that my file buffer splits and slime is to the side below whatever.

(defun start-or-switch-to (function buffer-name)
  (if (not (get-buffer buffer-name))
      (progn
        (split-window-sensibly (selected-window))
        (other-window 1)
        (funcall function))
    (switch-to-buffer-other-window buffer-name)))

I have found this snippet of code. And tried to execute it with a

(add-hook.....)

This however shoves the opened file and opens slime on both sides of the split.


texts:
I would like to left-align equations in Auctex's preview's generated by preview-latex. I imagine that this would involve putting fleqn in the documentclass options in whatever latex file things are generated from.
How can I do this? I have tried to find this location but have not had much success.


texts: How to automatically save buffer after each modification without using packages

texts:
I'm using Emacs and Windows 10 and I am fairly new to both Emacs and elisp (and I am not a programmer).

I'm looking for a way to automatically save a buffer immediately after any modification regardless of how small it is.

One method I found to do this involves using the package "real–auto–save" found in the melpa package library which can save a file up to a second after a modification.

Is there a way to automatically save buffers without the use of extraneous packages?


texts: How can I commit and push in one command from Emacs?

texts:
Very often I want to commit a change in magit and push it straight after.

With the default magit keybindings, I have to press C-c C-c P u. How can I do this in a single command/keystroke?


texts: Automating inbox zero with the org agenda?

texts:
Q: how can I automate inbox zero with my org-mode agenda by getting linked, deadlined reminders to emails that need a reply?

I get a lot of email, and try to stay at
inbox zero, but I don't always want to reply to an email
immediately upon reading it.  I do, however, want to remind myself
that I need to reply.

I'm hoping to automate this recurring use pattern, described here in excruciating detail:

open up inbox (using mu4e)
mark an email for reply with org-store-link
refile that message to All Mail (or wherever; it's a gmail account)
go to my main agenda file (call it agenda.org)
go to the * EMAIL section
use org-insert-link to create a new entry ** Respond to XXXX
set a deadline for later in the day (or tomorrow, or whenever)

The end product is a series of entries in the EMAIL section,
each linked to a specific email that needs a reply, and each with
a defined deadline so that it will show up in my agenda view to
remind me.  I'm just not sure how to automate the whole thing.

Does something like this already exist and I just don't know about
it?  If not, how would one implement it?

PS: I'm loosely aware of
mu4e actions,
which I expect would be the starting point, but it's also
package-specific and wouldn't apply to, say, gnus.


texts:
In order to test that some code handles an invalid UTF-8 sequence properly, I need to insert an invalid UTF-8 sequence into an existing text file.  However, my attempts to do so result in a valid UTF-8 sequence, not an invalid one.

The byte 0xff is always invalid in UTF-8, so I tried to insert it, following the instructions on the "Inserting Text" page of the Emacs manual:

c-q 377 <RET>

A funny-looking character got inserted into the file:

-OP INC       ÿ3713 SOUTHS
              ^

However, when I examine the contents of the file using the Unix command od -c <path>:

0001240   C  \t 303 277   3   7   1   3       S   O   U   T   H   S   H
                ^^^ ^^^

I can see that a valid UTF-8 sequence 303 277 (octal) has been inserted, not the single byte 377 that I tried to insert.

How can I insert an invalid UTF-8 sequence into a file?


texts: Helm command in `emacsclient -c` does nothing

texts:
I am trying to bind a keyboard key for a new emacsclient frame running a specific helm command helm-locate like that:

emacsclient -c --eval '(helm-locate)'

It does not seem to work (no new frame pops-up). When I change the command (e.g. emacsclient -c --eval '(mu4e)') it does work, so it must be something with the way helm-locate works.

Does anyone know how to fix this?


texts: make `display-buffer` open buffer in new tab

texts:
The display-buffer function seems to be used quite heavily within Emacs.  It has a lot of options to determine where to open a new buffer (a new window, a new frame, an existing window, etc).
Emacs introduced a concept of tabs in 27.1.  However, there doesn't appear to be an easy way to tell display-buffer that you want new buffers to open in a tab, instead of just a new window.
Is there some way to configure display-buffer to open all buffers in a new (or existing?) tab?

The solution from NickD suggests using a function like display-buffer-in-tab.
I was able to get this working by setting display-buffer-base-action like the following:
(setq display-buffer-base-action '(display-buffer-in-tab))

However, this doesn't seem to play nicely with functions like help and magit-status.  They tend to open up too many tabs every time they are run.
More specific settings may be necessary per command or per new buffer.


texts:
I use mu4e. When I reply-all to an email, my own email appears in CC. I have these lines in my configuration:

(setq mu4e-compose-dont-reply-to-self t)
(setq
 message-send-mail-function   'smtpmail-send-it
 user-mail-address "email@domain.com"
 ...
)

I don't have multiple accounts as in this Github issue. The value of the variable mu4e-user-mail-address-list is my username@hostname.domain.tld, where username is my login name and hostname.domain.tld is the hostname of the computer.

When I click Customize this variable, I see that it was changed, but not by me:

INS DEL Address: username@hostname.domain.tld
INS
 State : CHANGED outside Customize.

How can I avoid my email when replying to all?


texts: Trouble binding C-return: C- must prefix a single character

texts:
This is what I have:

(add-hook 'magit-status-mode-hook
  (lambda ()
    (local-set-key (kbd "<C-return>") 'magit-diff-visit-file-other-window)))

Opening a magit-status buffer fails with "C- must prefix a single character, not return".

There are several related questions, but their solutions (for example moving the <> around return instead of the whole string) don't work. Using RET instead of return doesn't work either.

Emacs 26.1


texts: Stop AUCTeX asking how much space I want to insert between rows in tables

texts: I'd like to avoid being asked how much vertical space I want to insert at the end of a row in tables and have C-c C-j behave like C-u C-c C-j.


texts:
I want to enable counsel-projectile-mode by default.

I have added (counsel-projectile-mode) to .emacs file as per project's usage guide but it doesn't work; meaning projectile still uses ido for finding files and such) ...

But after the Emacs is open if i M-x counsel-projectile-mode twice to disable and re-enable it, from within emacs, it will start working. (meaning projectile will use counsel for finding files, instead of using ido)

Any idea what's wrong?

This is my .emacs file.


texts: What is this permanently highlighted region?

texts: I accidentally pressed some keys in a buffer and created the permanently highlighted region shown below. What is this region called, and how can I get rid of it?


texts: Keybinding to go to an agenda custom view

texts:
Running emacs 25.2.2 and org 9.1.13.

I have defined several custom views. I can visit them using C-c a followed by the assigned letter.

I was wondering if I could cut the dispatcher all together. I could, for instance, assign a key-binding to org-agenda-list.

Similarly, is there a way to assign a key-binding to a custom agenda view?


texts: vdiff-refine-all-hunks/ediff-update-diffs in startup eval

texts:
I'm having a problem with putting vdiff-refine-all-hunks or ediff-update-diffs into --eval for startup. Take vdiff as example, I'm calling it using:

emacs --eval "(progn (vdiff-files file1 file2) (vdiff-refine-all-hunks))"

Note the functionvdiff-refine-all-hunks here acts just like ediff-update-diffs in ediff, which actually highlights the difference. Without running these two function the diffs are almost plain text.

According to diff-mode: refine all hunks when opening a diff file?, I added function sit-for before vdiff-refine-all-hunks:

emacs --eval "(progn (vdiff-files file1 file2) (sit-for 3) (vdiff-refine-all-hunks))"

Which works. However the loading time of vdiff really differs for different size of file. Setting 3 seconds works for a relatively large files but is too wasteful for two small one.

I do not understand why it takes so much time for ediff/vdiff to warm up, and is there an existing nice way to avoid the problem?

Update:

By using vdiff-auto-refine, it works if put (setq vdiff-auto-refine t) into init.el, or just implement it in eval:

emacs --eval "(progn (setq vdiff-auto-refine t) (vdiff-files file1 file2))

However, known issue is that it is still not working for emacsclient no matter I setq in init or include it in eval:

emacsclient -c --eval "(progn (setq vdiff-auto-refine t) (vdiff-files file1 file2))"


texts: Is the formula line tracking column insert properly in an org table?


texts: How to indent items in LaTeX/AUCTeX itemize environments?

texts:
Q: how can I get "proper" indentation of LaTeX itemize environments in auctex?

Here's where I'd like to be with an item in an itemize environment:

\item line is indented two spaces relative to the beginning of the environment
continuation lines in the item are indented an additional two spaces relative to the \item line

This is what I would like/expect to see:

\begin{itemize}
  \item Here's a really long item in a LaTeX itemize environment;
    note how the *initial* item line is indented two spaces, and the
    continuation lines are indented another two spaces.
\end{itemize}

One can adjust the initial indentation of the item with the LaTeX-item-indent variable, which defaults to -2.  With this default, I get the undesirable behavior of the \item not being indented, but I do get the desired behavior of the continuation lines being offset by an additional two spaces:

\begin{itemize}
\item Here's a really long item in a LaTeX itemize environment;
  note how the *initial* item line is *NOT* indented two spaces,
  but the continuation lines are indented two spaces.
\end{itemize}

Setting LaTeX-item-indent to 0 gets me the desired indentation on the \item line (two spaces in), but does not get me the second half of the desired behavior of the continuation lines being offset by an additional two spaces:

\begin{itemize}
  \item Here's a really long item in a LaTeX itemize environment;
  note how the *initial* item line is indented two spaces, but the
  continuation lines are *NOT* indented an additional two spaces.
\end{itemize}

So: how does one get both desired behaviors:

initial indent of the \item line two spaces, and
continuation lines an additional two spaces indented?

(Note Related SO thread.)


texts: formatting of elisp file is different in emacs and other text editor

texts:
I'm having an issue with formatting in that when I'm in emacs, the formatting looks fine:

but when the file is viewed with a different text editor, the spaces are different.

this only occurs in the let: form that I've defined. all the other forms seems to work okay.

Is there anything I'm missing? My emacs config is here: https://github.com/zcaudate/etude. It looks different there from the previous two examples.


texts: Practical benefits of new advice system in Emacs 24.4

texts:
Emacs 24.4 comes with a new advice system. The NEWS file says:

  ** New package nadvice.el offers lighter-weight advice facilities.
  It is layered as:

  *** add-function/remove-function, which can be used to add/remove code on
  any function-carrying place, such as process filters or <foo>-function hooks.

  *** advice-add/advice-remove to add/remove a piece of advice on a named
  function, much like defadvice does.

Q: What are the practical benefits and implications of this new package?

I am especially interested in answers addressing the following points:

If I am only using advice to customize Emacs (as opposed to writing add-on packages), do I need to switch to the new system? Will it replace the old system at some point?
What exactly can I do with the new system that I can't accomplish with defadvice?
What is the significance of being able to "add/remove code on any function-carrying place"?


texts: Can I open emacs in nw mode with the scratch buffer? (when emacs is aliased to emacsclient session)

texts:
closed that, re-incarnated here:

When starting emacs from the shell command line, if you pass the "dot", it opened emacs with a 'dired' of the current directory.

But can I do this?

emacs '*scratch*'

Basically I want to tell emacs (emacsclient) to be invoked with the argument "the file to be opened" being *scratch*

It would solve one of the problems I sometimes have:
fyi I always start my day with cd ~/projecta; emacs .
The issue with this is I can't freely kill 'dired' buffers.
If I C-x k the 'dired' buffer for projecta root, emacs frame closes
and I get dropped in to the shell.

Some context:

using macOS
Uses emacs only with Terminal.app ( -nw mode)
Emacs is client/server based, and each of my "customers" get their own
entry in my .bashrc

    function emacs() {
      emacsclient -a "" -s workspace -nw "$@"
    }

    function emacsb() {
      emacsclient -a "" -s workspaceb -nw "$@"
    }


texts: Cleanly terminating asynchronous process after it reads stdin

texts:
I'm starting a process with start-process and immediately calling set-process-sentinel to get notifications when it ends. After attaching the sentinel I send the buffer's contents to the process's stdin followed by EOF, like this:

(process-send-region proc (point-min) (point-max))
(process-send-eof proc)

I'm seeing the correct output in the process's output buffer, so I know it's working correctly to some degree.

But my sentinel reports that the process ends with event "exited abnormally with code 1", but I would like the process to end normally with the "finished" event. Why am I seeing this abnormal exit? What can I do to get a normal exit?


texts: doc-view failing for some PDFs, but ghostscript can view them?

texts:
When I use docview to view PDFs on my work computer (a redhat linux system) it always works, except in PDFs coming from Springer-Verlag articles and chapters.  In that case it gives this error:

Invalid format operation %A

However, I can view such files using gs directly.

I have no such problem on my home iMac.  The version of gs that I have at work is 9.07, and the version of emacs is 24.3.1.  I checked customize and there are no nonstandard settings there for doc-view.

Why is docview failing to load this PDF, even though gs can do it?  How do I fix the problem?


texts: Is there a reason so few packages seem to use transaction queues (tq-enqueue etc.) for communication with external processes? Most of the packages I have looked at seem to prefer the regular filter mechanism.


texts:
I'm trying to write something that will disable a certain mode (fci-mode) if a buffer's visible width is under a certain amount. I know about the (window-width) function, however, that doesn't change if the window is vertically split (so the buffer is only half as wide).

Is there a method I can call that gives the visible width of a buffer in characters?

[EDIT] Stefan pointed out that (window-width) does change when a window is split. I was testing this incorrectly.


texts: How can I tell Emacs to always open help buffers in the current window?

texts:
When looking up documentation with describe-function, Emacs display the docstring in a temporary help buffer. I want this buffer to replace current window.

So far, I've customized help-window-select but it only affect the focus.


texts: How do I change behaviour of eshell/rm (rm in eshell) tab completion?

texts:
Qestion:
Is there a way to make eshell/rm (especially) either display a completion buffer even for few files or remove the . and .. entries for eshell/rm.

Background (and some ranting):

So I learned the hard way that in eshell/ls and eshell/rm tab completes differently.
While eshell/ls has the behavior I expect(sortof) eshell/rm has a rater "disturbing" querk...

lets say you have ~/Download/this_dir/somefile.txt

You go to $ ls ~/Download/this_dir/ and tab complete ls will complete to the file.
However, if you do the same with rm it will cycle through the following outputs

$ rm ~/Download/this_dir/somefile.txt
$ rm ~/Download/this_dir/./
$ rm ~/Download/this_dir/../

notice the last entry points to the parent directory (ouch).
I (may be to my own fault) if I expect only one file in this directory press tab a number of times just to make sure I am at the top which made me cycle to the parent directory entry, which is hard to see if the filepath/name is long and hit enter.

Additional Investigation

I realized that the TAB key is bound to pcomplete which is discussed here but I haven't found the exact thing to help me.


texts:
I'm a relatively new convert to emacs and a very new convert to Mac.  After installing Emacs using the ESS installer (Version 18.10.2).

When I attempt to state a file for commit I receive the following error.

GitError! There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/s2/mjvyfw3d13zd8swxf8ds92c40000gn/T/emacs501/server'.  [Type `$' for details]

Pressing $ yields the following.

0 git … add -u -- inst/process.R
  1 git … commit --
hint: Waiting for your editor to close the file...
Waiting for Emacs...
*ERROR*: Wrong type argument: stringp, nil
error: There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/s2/mjvyfw3d13zd8swxf8ds92c40000gn/T/emacs501/server'.
Please supply the message using either -m or -F option.

  0 git … add -u .
  1 git … commit --
hint: Waiting for your editor to close the file...
Waiting for Emacs...
*ERROR*: Wrong type argument: stringp, nil
error: There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/s2/mjvyfw3d13zd8swxf8ds92c40000gn/T/emacs501/server'.
Please supply the message using either -m or -F option.

My EMACS Version

GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-04-12

When run with M-x toggle-on-debug-error I don't seem to get any different output.

GitError! There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/s2/mjvyfw3d13zd8swxf8ds92c40000gn/T/emacs501/server'.  [Type `$' for details]

  1 git … commit --
hint: Waiting for your editor to close the file...
Waiting for Emacs...
*ERROR*: Wrong type argument: stringp, nil
error: There was a problem with the editor '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --socket-name=/var/folders/s2/mjvyfw3d13zd8swxf8ds92c40000gn/T/emacs501/server'.
Please supply the message using either -m or -F option.

More information.  From the below advice I was able to determine that commenting out the below lines in my emacs.d/init.el file allows magit to work properly.

;; (add-hook 'find-file-hook 'my-r-style-hook)
;; (defun my-r-style-hook ()
;;   (when (string-match (file-name-extension buffer-file-name) "[r|R]$")
;;     (ess-set-style 'RStudio)))


texts: Not getting notifications with rcirc-notify in OSX

texts:
I'm unable to get any notifications when getting pinged by people, or sending private messages.

I'm running on osx and running terminal-notifier works fine. I've also tried to execute rcirc-notify-page-test function and it works as expected. However, when people actually send me messages, nothing happens.

I'm using Emacs 24.4.1 (installed via brew) and I installed rcirc-notify manually from the current gist master with hash id 1198200cd2914fb5116d33cedbc774a1cbc1e1d1.

I've copied it to ~/.emacs.d/lisp folder, where .emacs.d/ is a symbolic link, and I've configured it like this:

(add-to-list 'load-path "~/.emacs.d/lisp/")

(eval-after-load 'rcirc '(require 'rcirc-notify))

;; rcirc settings
(eval-after-load "rcirc"
  '(progn
     ;; List of rooms to join
     (setq rcirc-server-alist
       '(("irc.freenode.net" :channels ("#emacs" "#infinispan"))))

     ;; Identification for IRC server connections
     (setq rcirc-default-user-name "galderz"
           rcirc-default-nick      "galderz"
           rcirc-default-full-name "Galder")

     (message "rcirc has been configured.")))

Any ideas how to debug this further, or even better, solve this?

I've tried both terminal and windowed emacs and same thing applies to both.

Thanks in advance!

p.s. I've not tried ERC yet...


texts: Avoiding partial lines at bottom of screen

texts:
Is there a way to avoid only partially visible lines at the bottom of the
screen, such as in this picture?

Perhaps this could be achieved by adding some empty space below the
minibuffer and echo area, if that is possible.

(Using Emacs 26.1 and i3.)


texts: What is the correct syntax for the exclude and include options in org-publish?

texts:
Does the :exclude and :include option of org-publish-project-alist allow multiple patterns?

Do they involve multiple or regexes or does each pattern require its own separate :exclude or :include line?

In my init.el temporary backup files are set as (setq backup-directory-alist ``(("." . ".backups"))) and although I have added :exclude ".backups/*" to org-publish-project-alist the .backups folders are also exported.

I am currently staging the exports to my local file system before sending them to the hosting server with rsync so I can exclude the .backups directories, but they shouldn't be exported.


texts:
Certain key combos seem to have changed behaviour from emacs 24 to emacs 26 in python mode (python.el). Notably:
Emacs 24:
(no python shell open yet)
C-c C-c: Run python: ... ; Dedicated process?; Eval buffer
C-c C-z: Run python: ... ; Dedicated process?; switch to shell
Emacs 26:
(no python shell open)
C-c C-c: Open a shell first with C-c C-p...
C-c C-z: Open a shell first with C-c C-p...
If a shell is open in 26, all python files are directed to this shell. Haven't found out how to open a dedicated shell for separate files.
Is there any way to get the Emacs 24 behaviour back, at least partially?


texts: Wrong number of arguments: (0 . 0), 1 error on suspend-emacs and run command in shell

texts:
I am trying to suspend-frame and run command: clear in the shell in order to hide warning message: [3]  + 31360 suspended (signal)  TERM=xterm-256color emacsclient -t -q ~/.emacs

I have add this script from this answer (https://emacs.stackexchange.com/a/33449/18414):

(defun suspend-and-clear ()
   (interactive)
   (suspend-frame "clear"))

(global-set-key "\C-]" 'suspend-and-clear);

This gives me following error: Wrong number of arguments: (0 . 0), 1. How can I fix this error?


texts: Is it possible to define all keywords' function definitions as plist-get?

texts:
I really, really like Clojure-style maps:

{:keyword "value"
 :keyword2 'value2}

which can be used like

(get my-map :keyword)

or, even better,

(:keyword my-map)

Can I teach Elisp how to do this?


texts:
Is there a better way in Emacs Lisp to print the list of monospace fonts in a separate buffer?

I found out the following Emacs Lips code in a gist on Github:

(defun font-is-mono-p (font-family)
  ;; with-selected-window
  (let ((wind (selected-window))
        m-width l-width)
   (with-current-buffer "*Monospace Fonts*"
     (set-window-buffer (selected-window) (current-buffer))
     (text-scale-set 4)
     (insert (propertize "l l l l l" 'face `((:family ,font-family))))
     (goto-char (line-end-position))
     (setq l-width (car (posn-x-y (posn-at-point))))
     (newline)
     (forward-line)
     (insert (propertize "m m m m m" 'face `((:family ,font-family) italic)))
     (goto-char (line-end-position))
     (setq m-width (car (posn-x-y (posn-at-point))))
     (eq l-width m-width))))

(defun compare-monospace-fonts ()
  "Display a list of all monospace font faces."
  (interactive)
  (pop-to-buffer "*Monospace Fonts*")
  (erase-buffer)
  (dolist (font-family (font-family-list))
    (when (font-is-mono-p font-family)
      (let ((str font-family))
        (newline)
        (insert
         (propertize (concat "The quick brown fox jumps over the lazy dog 1 l; 0 O o ("
                             font-family ")\n") 'face `((:family ,font-family)))
         (propertize (concat "The quick brown fox jumps over the lazy dog 1 l; 0 O o ("
                             font-family ")\n") 'face `((:family ,font-family) italic)))))))

The way it tries to find out if a font is mono-spaced is to print some lines and check for their length as far as I can see:

But is there a better way, e.g. to filter out only the mono spaced fonts to begin with, I mean without relying on actually printing strings in that font and comparing the width of the display. I mean by using some font specification, etc. I read https://www.gnu.org/software/emacs/manual/html_node/elisp/Low_002dLevel-Font.html, but it doesn't mention anything about "monospace" (unlike https://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html).


texts: automatically update buffers when focusing if file changed

texts:
When programming, I often switch from emacs to Xcode and viceversa.
When I switch to Xcode, it automatically updates the current file when I focus Xcode window, if it detects that there are some external changes.

In emacs I have to press C-x C-v (but I lose the cursor position) or I have to press something and then insert r (reload?) in the minibuffer when emacs asks me what to do.

How to make emacs automatically reload the file (without losing the cursor position), it when I select back a buffer it corresponds to a modified file?

Thank you.


texts: How to make markdown-live-priview-mode use pandoc?

texts:
I'm having a problem where in markdown-live-preview-mode tables are not correctly converted to HTML from markdown. I'm using markdown-mode. I've tried using pandoc to create the HTML and pandoc correctly produces the table. I would like to set markdown-mode to use pandoc to create the HTML file for the live preview.

I get this from current markdown-live:

| Page Type | Description | |:-----------:|:---------------------------------------------------------:| | Stand-alone |
about or static text | | Referance | Index lookup page wit likns of all blog pasts or products | |
periodical | Blog posts or writing column, any series |

If I do M-! [return] pandoc -s -o filename.html filename.md [return]. [position cursor on eww buffer] g.

Page Type
Description

Stand-alone
about or static text

Referance
Index lookup page wit likns of all blog pasts or products

periodical
Blog posts or writing column, any series

It doesn't work on stackexchange; markdown tables. After running pandoc the output is correct in filename.html

I'm thinking there is a way to customize the command that markdown-mode uses to convert markdown to HTML in emacs init file.


texts: how to go to the first definition with xref-find-definitions, do not show all options?

texts: When I press gd to go to the definition of a class in C++, Emacs splits the screen and shows me two definition options that I need to click on with one of them. I'm used to coc.nvim where I would just go for the first option at once. How do I do this in Emacs?


texts: How can I filter out some lines of a plain org-mode list when exporting?

texts:
Under a given task I have a list of lines, some of which are done sub-tasks which I have tagged with :done. For example:

- this thing I completed earlier :done
- this is stuff I did this week
  - I might have a sublist with a link in it
- and other stuff this week
- and stuff for next week :todo

When I export this to my report I want to hide the :done line. I think the solution for this is to use filters but:

(defun my-filter-out-done-lines (s backend info)
    "Filter out lines ending in :done"
    (apply 'concat
           (--remove (s-matches? (rx ":done" (zero-or-more blank) eol) it)
                     (s-slice-at (rx bol (one-or-more blank) "-") s))))

(org-export-define-derived-backend 'my-status-report 'ascii
    :filters-alist
    '((:filter-plain-list . my-filter-out-done-lines)))

But I'm still removing lines that don't end in :done (I think it's being greedy) and links in removed lines are being rendered at the bottom.

Am I on the right path or is there a simpler way? I don't really want all these additional notes to become full subtasks.


texts: Is it possible to get prettified symbols in Org-mode source blocks?

texts: I have a few symbols in prettify-symbols-alist that improve the appearance of elisp code in my configuration file. I am migrating my configuration file from Elisp to Org-mode and I would like to keep the prettified symbols. Is this possible to achieve in Org mode 8.3?


texts:
I have the code below:

Hello
There
I am some code

And want to add code in front of it, like:

I said Hello
I said There
I said I am some code

So how would I add a prefix to each line?


texts: Emacs is compiled with imagemagick and has right PATH but still cannot use it

texts:
I want to use emacs with imagemagick to enable dynamic resizing of images in org-mode (https://www.reddit.com/r/emacs/comments/44id5o/how_to_install_emacs_with_imagemagick_support/). This used to work before I decided to upgrade homebrew.

I have installed imagemagick with homebrew, and it seems to work because I have a working convert command:

$ convert --version
Version: ImageMagick 7.0.4-5 Q16 x86_64 2017-01-23 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib cairo fftw fontconfig freetype jng jpeg ltdl lzma png rsvg tiff x xml zlib

I then installed emacs with homebrew on mac, using the following command:

brew install emacs --with-cocoa --with-gnutls --with-librsvg --with-imagemagick

The installation completes without issues. Starting emacs works fine, and I use exec-path-from-shell in my .emacs to get the right PATH:

(use-package exec-path-from-shell
  :ensure t
  :if (eq system-type 'darwin)
  :config (exec-path-from-shell-initialize)

This seems to work, since the command

M-: (getenv "PATH")

returns

"/Users/my_user_name/Library/Python/2.7/bin:/Users/my_user_name/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin"

However, the images in my org mode file do not resize properly (which they used to before I decided to upgrade homebrew, forcing me to reinstall emacs). Checking if imagemagick works by running the following command just returns nil:

M-: (image-type-available-p 'imagemagick) RET

What am I missing?


texts: Specifying version when using extra latex packages with org mode

texts:
Somewhere long ago I read I could use additional latex packages in org-mode using:

(setq org-latex-packages-alist '())
(add-to-list 'org-latex-packages-alist '("" "color" t))
(add-to-list 'org-latex-packages-alist '("" "physics" t))
(add-to-list 'org-latex-packages-alist '("" "mathtools" t))
(add-to-list 'org-latex-packages-alist '("" "xfrac" t))
(add-to-list 'org-latex-packages-alist '("" "siunitx" t))
(add-to-list 'org-latex-packages-alist '("" "mhchem" t))
(add-to-list 'org-latex-packages-alist '("" "fontenc" t))
(add-to-list 'org-latex-packages-alist '("" "multirow" t))

After updating my system I noticed latex images weren't being rendered. Investigating in /tmp, I discovered that mhchem wanted me to specify it's version number.

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! mhchem error: "options/no-version"
!
! You did not specify a 'version' option for the mhchem package. Please write
! \usepackage[version=3]{mhchem} in your preamble (or any lower number for
! compatibility mode).
!
! See the mhchem documentation for further information.
!
! Type <return> to continue.
!...............................................

l.2971   }

?
! Emergency stop.
!...............................................

l.2971   }

|'''''''''''''''''''''''''''''''''''''''''''''''
| LaTeX does not know anything more about this error, sorry.
|
| Try typing <return> to proceed.
| If that doesn't work, type X <return> to quit.
|...............................................

By educated guess and trial and error, I determined I needed to put version=3 in the first set of quotations. I was wondering if this was documented anywhere?


texts: Can org protocol capture have multiline content

texts:
Not sure what's going on here. This is my capture template:

  ("j" "Capture RSS to Incoming"
   entry
   (file+headline "~/Org/jay.org" "Incoming")
   "* %c :RSS:\n%(org-link-unescape \"%i\")"
   :immediate-finish t)

When I call it with this:

(org-protocol-capture "j/aaa/bbb/cccddd")

I get what I'd expect, a line like

* [[aaa][bbb]] :RSS:
  cccddd

but when I call it with this:

(org-protocol-capture "j/aaa/bbb/ccc%0Addd")

I get the error:

  byte-code: Capture abort: (end-of-file)

So somehow it seems it does not like the initial content, %i, to have multiple lines.
Can anyone clue me in to what I'm doing wrong?


texts: Auto-indent problems related to syntax in Haxe-Mode

texts:
In the Haxe programming language, you can specify the type of the return value of a function with a colon.

function funcName() : ReturnType { }

This becomes a problem when using emacs with haxe-mode. Whenever I try to enter a newline, the point is automatically indented to the column as to where the ":" character is found.

Here's a gif that better explains what I mean:

As you can see, creating a newline after the first function works fine. But on the second function (the one with a return datatype of ": Void"), we can see that the newline is indented at the same column of the ":" character in ": Void".

I tried disabling electric-indent-mode similar to the one found here but it did not do anything. I tried messing around with tab spacings but to no avail.

I would appreciate some help with this one.

Notes:

Link to the Haxe-Node that I am using


texts: How to hide leading stars in windowless emacs org-mode?

texts:
I've been working hard to get emacs and org-mode working inside of my tmux workflow. And i've got a pretty decent setup. :)

I installed org-bullets to get utf8 bullets, it worked. But even if I set into my emacs init file that I want the clean view it show the previous stars for every item. Also tried with the in-file solution but nothing.

Here is specifically what I tried

on my init:

;; Hide leading stars
(setq org-startup-indented t
      org-hide-leading-stars t)

On my org file:

#+STARTUP: indent

It works perfectly on the windowed environment, buy inside my terminal
stars didn't disappear


texts: package--check-signature-content error when running package-list-packages in Emacs 27

texts:
I recently upgraded to a GNU Emacs pretest 27 (version 27.0.91) running on MS Windows 10 platform.

With package-check-signature defaulting to allow-unsigned, I modified init.el so Emacs can work with signature keys using directory ~/.gnupg, where I have additional keys stored/managed through gpg2, installed under Cygwin setup.

This lets Emacs startup import gnu-elpa.gpg-keyring correctly, but when listing/upgrading Emacs packages I still see the following error related to signature verification:

error in process filter: package--check-signature-content: Failed to verify signature: file-error, "Writing to process", "Bad file descriptor", #<process epg>
error in process filter: Failed to verify signature: file-error, "Writing to process", "Bad file descriptor", #<process epg>

which requires either package-check-signature set to nil to be silenced before proceeding to upgrade packages. If I re-run list packages command, returned error message is:

Importing package-keyring.gpg...done

error in process filter: package--check-signature-content: Failed to verify signature: file-error, "Writing to process", "Invalid argument", #<process epg>
error in process filter: Failed to verify signature: file-error, "Writing to process", "Invalid argument", #<process epg>

Tried looking online, but couldn't find anything meaningful related to my issue.


texts: How to make icicle-pp-eval-expression use eldoc like eval-expression?

texts: In recent Emacs versions, eval-expression makes use of global-eldoc-mode in a quite intelligent way, using the modeline to display hints.  However, icicle-pp-eval-expression, which is Icicles' variant of eval-expression, does not have this functionality.  How to enable it?  Simple grepping for eldoc in the body of eval-expression didn't show any reference.


texts: (octave-mode) highlighted region remains highlighted after command

texts:
I am in octave-mode running an inferior octave shell. Now I mark a region and issue 'octave-send-region'. All commands are executed as expected and echoed in the shell buffer, and the highlighting is cleared.

So far so good, this is how it is supposed to work and how it does work initially. After a couple of more region-sending, however, the corresponding commands are still executed, but the highlighting fails to clear (it can be cleared using Ctrl-g).

I see this behavior now for at least a couple of years, and it is quite annoying. Before it was ok.

Anyone know about this behavior, and how to fix it?


texts: How to change comment character from # (hash) to % (percent sign) for Octave major mode

texts:
By default, comment-region inserts # for comments in Octave major mode:

# foo

I want to modify the behavior so that it inserts the percent sign

% foo

I used the following

(setq octave-mode-hook
      (lambda () (setq octave-comment-char ?%) ))
(modify-syntax-entry ?% "<"  octave-mode-syntax-table)

But it gives me this error:

Symbol's value as variable is void: octave-mode-syntax-table

I don't know about elisp so well, so how can I solve this?

Edit

Here is the configuration needed to make octave-mode the default one for .m files and change commenting behaviour to that of MATLAB's. Note that for Octave, both % and # are valid for commenting.

(add-to-list 'auto-mode-alist '("\\.m\\'" . octave-mode))

(add-hook 'octave-mode-hook
    (lambda () (progn (setq octave-comment-char ?%)
                      (setq comment-start "% ")
                      (setq comment-add 0))))


texts:
I would like to create an elisp function to set up a window layout for a single org file, similar to a Kanban layout (Trello, etc).

For each top-line headline, I want to create a separate clone (clone-indirect-buffer), narrowed to that specific header.

For example, I might have this file:

* Head 1
** Sub-item 2
** Sub-item 3
* Head 2
** Item
* Head 3
** One more

The layout can be set up manually with the keystrokes:

C-x 3, C-x 3—Create two vertical splits (3 windows)
C-x +—Set equal width for all windows
C-x 4 c, C-x 4 c—Make two clones of the buffer
C-x n s, once for each window, on a separate line starting Head

The result is three windows, each with a separate subtree—the Kanban layout.

Can anyone suggest where to start with this? I don't have much elisp experience but am happy to learn as I go...thank you!


texts:
Is there a mode out there that has syntax higlighting (and possibly more, but this is the least I want) for a more recent ecmascript? I'm especially interested in one that has support for template strings and generator functions.

This should render properly:

co(function*(){
   var a = yield request(`some.domain/${variable}`)
   return a;
}


texts:
Is there a way to call a certain function after a certain org-capture template
has been run (successfully, ie. not aborted)?


texts: Markdown and Latex highlighting (font lock) in R Markdown file

texts:
I am using polymode to edit rmarkdown files. Exporting to e.g. pdf is super simple and works very well. R code chunks are also properly highlighted.

But:

I do quite often use latex code inside (r)markdown. Would it be possible to highlight the latex code as well?

I guessed I need something like latex as a second major mode or a markdown-latex-r-polymode but didn't get very far.

Example

this is bold in markdown

\center{this centers text} in latex

The latex part should also be highlighted.


texts: How to use ivy to navigate named locations of a buffer?

texts:
Given a list of (point-number . title-text), how can ivy be used to show this in a list in ivy?

I have code which uses completing-read to do this (see link).
This can use ivy since it extends completing-read however it doesn't seem to support all of ivy's features.

For example ivy-next-line-and-call and ivy-previous-line-and-call don't work.

How can ivy be used directly to navigate sections in a document?


texts: Package to detect most common typing mistakes

texts:
I'm a decent touch-typist, capping out around 90 WPM, but I know I'd be better if I eliminated some of the more persistent typos that crop up semi-consistently.

It occurred to me this morning that since I do almost all my writing and programming in Emacs, it should be able to give me a good idea of what my most common typos are and what context they occur in, based on what characters and words I delete then replace immediately.

From there, I should be able to do some typing drills to eliminate those errors in my typing technique.

I did a few searches on the net looking for such a thing but was not able to find it.

Does anyone know of such a thing existing already?

If not, what would be a good starting point for building it?

I'd think some combination of post-self-insert-hook, advising the deletion functions, and perhaps digging around in undo history should make something like this possible, but I'd be delighted to discover someone already did the hard work and I'm just failing to find it.


texts: How to turn off Magit default switch (--reset-author in Commit)

texts: I did something causing the -R (--reset-author) switch in the Commit menu to always be on by default. How can I reset this?


texts: Dired: How copy to kill-ring name of parent directory without moving to parent's directory name?

texts:
Windows 10, Emacs 25.1, Dired

If I want to copy to parent's directory name to kill-ring I go to folder name and press w

Here result:

OK. It's work.

But I wan't to move cursor and get parent's directory name.
I try by command digit-argument w but I get the next result:

As you can see Emacs copy to kill-ring files name and dirs names. But it not copy the parent's directory name.


texts: org mode: expand all headings that match a search

texts:
How can I expand all the headings with a name matching a search term?  For example, take the following fully expanded document:

* Famous Animals
** Pigs
   - Ace
   - Babe
** Cats
   - Duchess
   - Felix
* Musical Characters
** Cats
   - Demeter
   - Macavity
** Chicago
   - Roxie
   - Velma

Now let's collapse it completely:

* Famous Animals
* Musical Characters

I'd like to be able to search for "Cats" and get the following headings to expand:

* Famous Animals
** Pigs
** Cats
   - Duchess
   - Felix
* Musical Characters
** Cats
   - Demeter
   - Macavity
** Chicago

Extra points if I can do an incremental search and have the headings expand as I type.


texts: Are there any good packages for Emacs that implement doubly-linked lists? I know I could make them myself, but I'd rather not re-invent the wheel.


texts: How to find if an Emacs lisp function is setf-able?

texts:
Emacs Lisp setf macro allows you to set generalized variables.  You can, for example change the size of the current window with the following form:
(setf (window-height) 10)

The macro will translate the above code to:
(progn
  (enlarge-window
   (- 10
      (window-height)))
  10)

My question:  Is there a way to find out dynamically whether an Emacs function is "setf-able" like window-height is?
I searched in the GNU EMacs Common Lisp Emulation manual and could not find and answer to my question.


texts: How can I start a server in the background from a source code block without freezing emacs?

texts:
I am creating several org-mode documents to track code example and would like to be able to view the results of tangling or executing these code blocks in a browser. In the example below, I've created a source code block that starts a browsersync session; this which should reflect my changes in the web browser when I tangle a CSS or HTML file. How can I run this process in the background so it doesn't freeze Emacs? Currently, executing this code makes Emacs unusable in the same way that starting it in a shell would make the shell unusable.

#+BEGIN_SRC bash :tangle no :exports none
browser-sync start --server --browser "Google Chrome" --files "*.css, css3_by_example.html" &
#+END_SRC


texts:
My question concerns org-mode. I'm trying to add the characters [ and ] to the org-emphasis-regexp-components in order to mark up words between square brackets.  So I get for example the following effect:

[/bla bla/] → [/bla bla/]

I also want to export it to LaTeX.

I've already tried the solutions described bellow, but without success:

Inline verbatim and code with quotes in Org-mode

https://stackoverflow.com/questions/1218238/how-to-make-part-of-a-word-bold-in-org-mode

https://stackoverflow.com/questions/24169333/how-can-i-emphasize-or-verbatim-quote-a-comma-in-org-mode

I can't understand what I'm doing wrong.  I would appreciate your help. Thank you.


texts: Emacs indent AngularJS code to wrong level

texts:
It's really sad not to write well formatted angularJs code inside emacs, the image below shows what I am saying.

What is happening inside the photo is that the code is already well formatted as it is, but when I create a new line it become like the photo shows.

If any one knows any solution to this problem, it would be so helpful to me.
(note i've used angularJs mode but in vain)

update: what i'm expecting is auto indentation is working as the file suggesting which means if the file is indented with 4-spaces so the indent-level would be 4 spaces, if it's 2-spaces the indent-level would be 2-spaces and so on.

what is set now at my .emacs file is (setq global-tab-width 2) but that doesn't work.

note: i've done what is suggested in Jordon Biondo answer but that forces me to apply this change for Js files only where i need it to be globally applied


texts:
Related Question

I want to interactively invoke Elisp code which extracts the words between two arbitrary symbols. So could someone kindly guide me to a modest document which explains how to invoke Elisp code in Emacs?

This is the code I want to execute on a txt file:

(when (string-match "<br>\\(.*?\\)<" STR)
(match-string 1 STR))


texts:
I have a JSON file where Unicode characters are encoded as UTF-8 codepoints, example: \u05de instead of the Hebrew character Mem (מ). How could I get emacs to display glyphs instead of the codepoint numbers?

Value of buffer-file-coding-system is currently utf-8-unix.


texts: Referencing Lexically Bound Variable in Mocked Function

texts:
I'd like to mock a function for a unit test that I'm writing.  I want the mocked function to count how many times it was called but I'm having issues related to the scope of the count variable.
Here is an example of what I'm trying to do:
;; Assumes lexical-binding is t

(defvar example-settings nil)

(defun function-to-test ()
  (funcall (car example-settings)))

(let* ((function-to-mock-call-cnt 0)
       (example-settings
        '((lambda ()
            (setq function-to-mock-call-cnt
                  (1+ function-to-mock-call-cnt))))))
  (function-to-test)
  function-to-mock-call-cnt)

However, this fails with the error void-variable.
Can someone help me understand why this doesn't work?


texts: How to implement Markdown style link IDs in org-mode?

texts:
At times, I need to use the same link at multiple places in a long document.
For those cases it would be useful to have link IDs like in markdown. From markdown syntax ref,

You can optionally use a space to separate the sets of brackets:
This is [an example] [id] reference-style link.

Then, anywhere in the document, you define your link label like this, on a line by itself:
[id]: http://example.com/ "Optional Title Here"

I believed that the Link Abbreviation in org-mode would work the same way (without tags) but it doesn't.
The purpose of link IDs is to have a central place for editing the links. A good location would be at the end of the document. Full links are defined in the ID but only the ID is used elsewhere in the document where we need to place the hyperlinks.
When exporting, the IDs are replaced with the actual hyperlinks.
Benefits of this approach are,

When the links change, we need to just modify the ID definitions. On exporting, the hyperlinks in the document will be updated to that.
Faster hyperlink insertion when writing the document as one doesn't have to get and paste the full links every time. You type the IDs in the document and define them in a block at the end of the document.


texts: Org ref not exporting authordate when using natbib

texts:
I am trying to export an org file with rounded brackets:

In order to be proficient in mathematics students must be able to
perform fundamental skills with fluency (Williamson 2017:18).

But when using the latex header below I numeric:

In order to be proficient in mathematics students must be able to
perform fundamental skills with fluency (1:18).

#+LATEX_HEADER: \usepackage[round]{natbib}
#+LATEX_HEADER: \setcitestyle{authoryear}
I tried to set the cite style but it did not work.
Though it did work to set the note sep:
#+LATEX_HEADER: \setcitestyle{notesep={:}}
How can I fix this?


texts:
org-drill allows you to configure the learning fraction (org-drill-learn-fraction) so that intervals grow over time. But it will grow without bound.

How can I set a maximum interval?


texts: Get org heading text with only descriptive link text?

texts:
I'm looking for an org function to evaluate to the text of the current heading without full link text (just the descriptive form).

  *** Check out the new [[https://www.google.com][Google]] logo!

should evaluate to

  "Check out the new Google logo!"

in contrast to the full heading with full link text (the undesired behavior):

  Check out the new [[https://www.google.com][Google]] logo!

org-heading-components for example returns the latter.  I'm looking for a DRY solution.


texts:
Just org-exported something and my name was at the top of the exported
document.  How does org know my name?  On Fedora.


texts: Clone a buffer to see the same contents in an other mode

texts:
Suppose I'm working on a file in org-mode or enriched-mode or html-mode ..., and I wanted to see the same contents in an other window with an other mode, say text-mode, how to do that?
I tried to clone the buffer using C-x 4 c, but when I change the mode in the cloned buffer, It changes in the original buffer too, even that its mode line doesn't say so.


texts:
I've never quoted nil before, as I can't see any sense in doing that, but I just played around with some code and it seems that in most cases it is possible to quote nil without any effect. However when I use condition-case with a quoted nil as the first argument, I get an error (wrong-type-argument symbolp (quote nil)).

(condition-case 'nil
    (/ 2 0)
  (error "foo"))

Why does quoting nil cause problems when using it this way ?


texts: Is there bitbucket integration for emacs?

texts: I am looking for listing pull requests on bitbucket that I created from emacs. I found this https://github.com/tjaartvdwalt/bitbucket.el, which seems to be incomplete. Is there any other package out there which will full fill my requirement?


texts: Is post-command-hook or idle timer better for doing something when the user becomes idle?

texts:
Let's say I want to write a mode which updates the display (e.g. adds some annotation) when the user edits the buffer  or just moves around.
What is the recommended way to implement this?
Using post-command-hook with sit-for, so my function does its work when the user becomes idle after a command:
(defun my-post-command ()
  (when (sit-for 0.3)
    ....

Or an idle timer:
(run-with-idle-timer 0.3 t 'my-post-command)

The drawback of post-command-hook is that it holds up the hook with the delay if some other hook function comes after it.
The drawback of idle timer is that it's global, so there can be no buffer local timer, so if one implements some minor mode then the timer has to be deactivated/activated when the user switches buffers.
Is there a better/recommended method for this?


texts: Org-mode: export table columns in verbatim mode

texts:
In an org-file, I have a table where I want one column to be exported verbatim:

|       Date | Rating | Comment    |
|------------+--------+------------|
| 2016-07-01 | ***    | so so      |
| 2016-07-08 | ****   | very good  |
| 2016-07-15 | *      | miserable! |

The rating column, consisting of a number (1-5) of stars, should be exported as verbatim or at least make the asterisks not be interpreted as bold.  By default, the first and third line would be nearly indistinguishable in the exported pdf file (a bold asterisk versus a normal one).

Is there a way to mark the whole column so that it is exported in verbatim mode?  Preferably the solution would still look good in plain text/org-mode.


texts: org-mode: I can recalculate all tables, or realign, but not both

texts:
I've got a dynamic block in org-mode (e.g. a clocktable) and I want to update it on save. To do this, I have written the following function (which I'm calling in a before-save-buffer hook):

(defun my/org-update-and-realign ()
  (interactive)
  (org-map-dblocks 'org-update-dblock)
  (org-table-map-tables 'org-table-align))

(I need to do realignment because otherwise tables come up garbled.)

However, it doesn't wok. I get “Mapping tables: done” in the Messages buffer, but the table isn't realigned. Bafflingly, if I add (redisplay), it does work:

(defun my/org-update-and-realign ()
  (interactive)
  (org-map-dblocks 'org-update-dblock)
  (redisplay)
  (org-table-map-tables 'org-table-align))

So, I've got two questions:

How come?
Can I do it without (redisplay)? The (redisplay) forces a blink, which I don't want.


texts: How to get a list of all folder names under a folder?

texts:
I have a folder structure like this,i want get a list that all folder names in pack folder. Then traverse the list and load them

├── pack
│   ├── completion
│   │   ├── company
│   │   │   └── pack-company.el
│   │   ├── ivy
│   │   │   └── pack-ivy.el
│   │   └── smartchr
│   │       └── pack-smartchr.el
│   ├── editor
│   │   ├── evil
│   │   │   └── pack-evil.el
│   │   ├── fold
│   │   │   └── pack-fold.el
│   │   └── multiple-cursors
│   │       └── pack-multiple.el

list will has pack/completion/company, pack/completion/ivy etc..


texts: Command to visit Github pull request of current branch with Magit

texts:
It's very common that, after pushing a given branch upstream, I'll want to visit it on github and create a pull request. I'm starting to get annoyed at having to manually visit the repo, find the branch, and create the PR.

Q: How can I write a command that visits the PR url in a browser?

The PR url is given by https://github.com/ORIGIN-REPO/compare/BRANCH-NAME. Since both the origin and the branch-name known by Magit (and by plain git), it should be easy to write a command that builds that URL and calls browse-url on it.

Unfortunately, I know nothing about the internals workings of Magit,
so I don't know how to get that information.


texts:
Upon running package-list-packages, I get the following error.

These default coding systems were tried to encode text
in the buffer ` *temp*':
  (iso-latin-1-dos (3242 . 37326) (3243 . 40165))
However, each of them encountered characters it couldn't encode:
  iso-latin-1-dos cannot encode these: 野 鳥

How can I set the default package manager encoding to be utf-8?