texts: Open GNU Scientific Library Documentation within emacs?

texts: How do I open documentation of the GNU Scientific Library within emacs?


texts: Client window hung with no visible cause

texts:
I was editing some code in an Emacs client, when all of a sudden it stopped reacting to my input. If I killed the client and connected with a new one, I got a pretty strange behaviour:

if I tried to open a file that has changed (due to git rebase operations in another terminal), Emacs warned me about this and asked me if I wanted to re-read the buffer’s file. It accepted and displayed my input in the minibuffer. After that it presented me an empty window, and stopped reacting
if I tried to open any other file/directory, I got the same empty window with no reaction again
if I opened an X-Windows version of Emacs client with any file, I got the same result. Furthermore, the menu items didn’t react to clicking and the X window didn’t react to its close button, Alt-F4, etc.

After this point, nothing happened. The minibuffer and all the other windows didn’t update, any input seemed to be discarded (C-x C-c, M-x, whatever).


texts: Compilation exiting abnormally with code 1 only when inside Emacs + liking to pthread library

texts:
Only when I'm trying to compile + link to the pthread library, I'm getting this error from Emacs:

-*- mode: compilation; default-directory: "~/GITHUB/kandr/" -*-
Compilation started at Mon Nov 14 02:50:59

cc -Wall -Wextra -pedantic -std=c11 -g -lpthread how_to_thread.c -o ./bin/how_to_thread
/usr/bin/ld: ne peut ouvrir le fichier de sortie ./bin/how_to_thread: Aucun fichier ou dossier de ce type
collect2: error: ld returned 1 exit status

Compilation exited abnormally with code 1 at Mon Nov 14 02:50:59

I tried to type the same command: cc -Wall -Wextra -pedantic -std=c11 -g -lpthread how_to_thread.c -o ./bin/how_to_thread directly from the command line, and I have no error, the compilation went fine.

The problem seems to occur only when I need to link (-lpthread). Compiling from Emacs a simple c source code, wich doesn't need a library to be linked brings not compilation errors. Is there something I'm doing wrong?


texts: Orgmode custom agenda view - remove unecessary info and align tags

texts:
I can't seem to find a way to get the "default" (t) agenda view so I can edit it an comment out stuff. Basically what I have now is:

Global list of TODO items of type: ALL
Available with `N r': (0)[ALL]
 My super long file name:TODO Get milk           :groceries:
 My super long file name:TODO Fix Conky   :fixes:

But what I want is:

 TODO Get milk           :groceries:
 TODO Fix Conky          :fixes:

OR

 :groceries::      TODO Get milk
 :fixes::          TODO Fix Conky

But just getting rid of the ugly file name would be great help
Thank you!


texts:
My Emacs's python-indent-offset is fixed at 2, even though I have the below code in my init.el to set it to 4. I used C-h v to describe the variable, it says its value is 2 and default is 4. I removed the below code and it's still 2. I've tried everything, but I can't seem to increase it to 4. Can someone help me out here?
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)

;; ----------------------- Python tab fix
(add-hook 'python-mode-hook
      (lambda ()
        (setq indent-tabs-mode t)
        (setq tab-width 4)
        (setq python-indent-offset 4)))


texts: Have table.el insert space after vertical separator for reStructuredText

texts:
I am using Emacs's table.el mode to fill a lot of tables in rst documents.
table.el is really fine to do the job, but it lacks the possibility to have one space between vertical separator and cell content.

That is, by default, it fills tables like this:

+-------+-----+
|content|stuff|
+-------+-----+

What I want to achieve is to have a one space padding before and after each separator to match the RST syntax like this :

+---------+-------+
| content | stuff |
+---------+-------+


texts:
I've got #+OPTIONS: tex:t and #+STARTUP: entitiespretty at the top of my org file, however, this seems to allow only a subset of Latex. For example, typing \rightarrow embeds upon the last keystroke a → just fine. But if I try a \vdash (⊢) I get nothing. \vdash just sits there.

So I looked around and found this, which seems to be an Emacs-wide solution (per buffer). (set-input-method 'TeX) in fact does recognize \vdash and converts it instantly to ⊢. Another curiosity is how I put \vdash inside an emacs-lisp code block -- while set-input-method is still active -- and it worked, and it saved it, and it exported to HTML just fine. Typically, being in a code block means Latex markup either won't display, or if it does, it won't export.

I then tried to use ⊢ as a symbol

(set-input-method 'TeX)
(setf ⊢ t)
(defun foo ()
  (if ⊢ 1 2))
(foo)
    => 1

I'm guessing this is utf-8 lore, and Emacs will work with a utf-8 "character" just as if it were old-school ascii. set-input-method seems to have permanently replaced the Latex markup code. Is this correct? Also, why is org mode incomplete at in-buffer Latex substitutions while set-input-method with TeX is more complete? Which is the better choice?


texts: How to open Emacs (Terminal) using key combinations?

texts:
On Ubuntu, to open the Terminal, we press Ctrl + Alt + t.

Do there exist key combinations to open Emacs Terminal (without GUI)?


texts: In org-mode if I am typing the lines will wrap to the next line at around 70 characters.  However if I yank text from the OS clipboard into the org-mode buffer, then the text will not wrap but be on one long line.  How can I get the text to wrap upon being yanked?


texts: flush-lines fails in script but works when called otherwise

texts:
I'm very new to programming in Elisp so maybe the mistake is there but I'm completely stuck right now.
I wanted to make a small, simple Elisp function to remove the AUTOs from my Verilog files so I don't commit those lines to our git repository since the rest of my team doesn't use Emacs. I thought this would be a very simple task but for the life of me, I can't get flush-lines to work properly.
The regular expression I'm trying to use is \/\*AUTO\w+\*/. When I do M-x flush-lines RET \/\*AUTO\w+\*/ RET this works. So I would think the regular expression works. But when I try to do it in either my .emacs or by doing M-: (flush-lines "\/\*AUTO\w+\*/" nil (buffer-size) t) RET, it just outputs a nil. I also tried (flush-lines "\/\*AUTO\w+\*/") and (flush-lines "\/\*AUTO\w+\*/" nil (buffer-size)) and they both just output nil and don't remove the matching lines. My point is set to the top of the buffer, so I don't understand what the issue is. I can't seem to find anywhere any resources that could point me in the right direction. The closest I found was this post from a couple years ago but it goes far beyond the simple task I'm trying to do, and I seem to be suffering from a different issue than that user was.


texts:
I tried to use

M-x package-autoremove

but my .emacs.d directory is still a mess: it's full with several versions of the same package. As side info I use the no-littering package, but when I update packages the old versions are kept in the elpa directory.

I also tried to manually delete old packages. For example if I run

M-x package-list

I get the package list, and at some point in the list I have

no-littering    20190409.1154 installed   help keeping ~/.emacs.d clean

at the end of the list I have

no-littering       1.0.0         obsolete    help keeping ~/.emacs.d clean
no-littering       20190129.2355 obsolete    help keeping ~/.emacs.d clean

and these 3 versions have 3 corresponding folders in the ELPA directory. Therefore I presume that the last 2 entries are old versions, and I mark both of them for deletion (d) and than I  execute the deletion with (x). The mini-buffer tells me to run

M-x package-autoremove

which I do, and in fact the corresponding 2 folders in ELPA directory disappeared. But after that when I reload emacs I get an initialization error do to no-littering.

What am I missing?


texts: Semantic-stickyfunc-mode show definition for current location

texts:
I've started to use semantic-stickyfunc-mode, but there is one thing that annoys me slightly. For functions not going outside the window top, the header line either doesn't show anything or it shows the definition of the previous function. This is sometimes a bit confusing, since I would like to use the header line as a quick reminder of which function/part of the code I'm currently working on.
My question is simply how to get semantic to display its information for the current cursor location, and not for whatever might be crossing the window top.


texts: How to disable tramp autosave and backups, but keep other backups/autosave?

texts:
I'd like to disable autosaves and backups when using tramp, because I neither want to save stuff from remote machines nor stuff belonging to root in my backup/autosave directory. How to do that?

I have read the documentation about tramp autosave and backup.

In particular I have read the suggestion

(add-to-list 'backup-directory-alist
              (cons tramp-file-name-regexp nil))

Unfortunately I fail to grasp if that is valid if 'backup-directory-alist already contains an entry for my other backup files (".*" . ,init-backup-directory).

Besides disabling backups, disabling autosave would also be nice.


texts: How can I save a personal bookmark file?

texts:
I work on doom-emacs and keep personal configuration in .doom.d, thus leave the gene config .emacs.d.

Today, I re-installed doom.emacs to .emacs.d, but find all my bookmarks disappeared when launch in.

How can I save a personal bookmarks file?


texts:
I use this function to reopen a file killed by mistake.

(defun undo-kill-buffer ()
    (interactive)
    (let ((active-files (loop for buf in (buffer-list)
                              when (buffer-file-name buf) collect it)))
      (loop for file in recentf-list
            unless (member file active-files) return (find-file file))))
  (global-set-key (kbd "C-x K") 'undo-kill-buffer)

The problem is that I would like to reopen the file at the right place (save-place-mode) only in this case. If I open a file with another function (find-file, find-alternate-file, find-file-at-point, ...) I don't want to remember the last position.

I have not found a solution to activate save-place-mode in some cases only.
Is it possible to write a find-file-with-saveplace function without modify find-file ?

Thanks for any help.


texts: Make emacs to use only tabs for JS indentation

texts:
I've set my tabs to 4 and haven't changed any JS indent settings. All the indents I found in the "JavaScript group" have values either 0 or 4, yet the following code

describe('test Info', () => {
    it("should respond with Info", done =>
       doGet("Info", r => {
           expect(r.statusCode).toBe(200);

gets indented to columns 4, 7 and 11, while I'd strongly prefer 4, 8 and 12. I guess, Emacs indents doGet just below "should...", but I can't see any reason for it. Strangely, it doesn't do this on the next line...

How can I change it?

Details

GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Blink-Cursor File-Name-Shadow Font-Lock Global-Font-Lock Line-Number
Menu-Bar Mouse-Wheel Show-Paren Tooltip Transient-Mark

Javascript mode defined in `js.el':


texts: How can I download a web page's source from Emacs?

texts:
I want to use Emacs as an enhanced way to view the source of a page (say http://example.com). Is there some easy way to download the page directly from Emacs, maybe even through C-x C-f?

I remember doing this somehow in the past (maybe thanks to TRAMP?), but not how, and I can't reproduce it any more.


texts: How to make emacs shell the same as system terminal experience?

texts:
On macOS, using iTerm2. It looks like

In Emacs For Mac OS X, it looks like

I copied system's ~/.zshrc file to ~/.profile and ~/.bash_profile, but doesn't they read configrations when start emacs?


texts: Haskell-mode-hook help window keeps opening

texts:
I installed haskell-mode, but every time I press RET or TAB on a Haskell file it keeps opening that window

Any idea on how to deactivate this ?


texts: How to hide all dired buffers in ibuffer?

texts:
I want to hide all Dired buffers as major mode in Ibuffer.

But

(add-to-list 'ibuffer-never-show-predicates "magit*")

ibuffer-never-show-predicates accepts a regexp and a function.

How can I hide all Dired buffers in Ibuffer?


texts: Is there a way to recognize `-- vim: et:sw=4:ts=8:sts=4:tw=80` in emacs?

texts:
I'm working on a project with all source files appended with this vim formating rule -- vim: et:sw=4:ts=8:sts=4:tw=80. Is there a way to make Emacs setup the correct indentation for me automatically?

The indentation options of vim are described at http://vimdoc.sourceforge.net/htmldoc/options.html.
There follows a rough description of the used options:

et / expandtabs means to insert whitespaces instead of tabs. It should at least be similar to (setq indent-tabs-mode nil)
sw / shiftwidth is the number of spaces to use for each indent
sts / softtabstop Number of spaces that a  counts for while performing editing
operations, like inserting a  or using .  It "feels" like
s are being inserted, while in fact a mix of spaces and s is
used.  This is useful to keep the ~ts~ setting at its standard value
of 8, while being able to edit like it is set to ~sts~.
tw / textwidth corresponds to fill-column in emacs


texts: How to redefine key binding for "C-m" without clobbering ?

texts:
I am trying to remap "C-m" but it seems to prevent  from working. It actually seems to make  the same as "C-m". I have no idea why.

I have tried this, which causes the problem:
    (bind-keys :map global-map
           ("C-m" . jump-char-backward)
           ("C-," . jump-char-forward))

And I tried this to fix it, which causes the problem that everywhere (for example on helm completion)  now causes a new line:

(bind-keys :map global-map
       ("C-m" . jump-char-backward)
       ("C-," . jump-char-forward)
       ("<return>" . newline))

How can I fix this? And what mistakes have I made understanding how remapping keys work?!


texts: popup package not found when installing ac-cider package

texts:
When I try to install ac-cider via package-install or via init.el I get the message http://melpa-stable.milkbox.net/packages/popup-20160531.425.el: Not Found:

This is the code in my init.el:

(require 'package)
;; (add-to-list 'package-archives
;;              '("marmalade" . "http://marmalade-repo.org/packages/") t)
;; (add-to-list 'package-archives
;;              '("tromey" . "http://tromey.com/elpa/") t)
;; (add-to-list 'package-archives
;;              '("melpa" . "http://melpa.milkbox.net/packages/") t)

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa-stable.milkbox.net/packages/")))

;; Load and activate emacs packages. Do this first so that the
;; packages are loaded before you start trying to modify them.
;; This also sets the load path.
(package-initialize)

;; Download the ELPA archive description if needed.
;; This informs Emacs about the latest versions of all packages, and
;; makes them available for download.
(when (not package-archive-contents)
  (package-refresh-contents))

;; The packages you want installed. You can also install these
;; manually with M-x package-install
;; Add in your own as you wish:
(defvar my-packages
  '(ac-cider))

How can this be fixed so that ac-cider is installed?


texts: Adding keywords programmatically using the display property

texts:
I've added some keywords using the following construct (where tag-todo and tag-note are variable holding a SVG image and tag-key () is a function returning a SVG image):
(font-lock-add-keywords nil
        '(("\\(\:TODO\:\\)" 1 `(face nil display ,tag-todo))
          ("\\(\:NOTE\:\\)" 1 `(face nil display ,tag-note))
          ("\\(=[0-9a-zA-Z- ]+?=\\)" 1
                              `(face nil display ,(tag-key (match-string 0))))))

This works great (see reddit post) but I would like now to do the same using a list of regexp / tag (or function):
(setq tags '((":TODO:"            . tag-todo)
             (":NOTE:"            . tag-note)
             ("=[0-9a-zA-Z- ]+?=" . tag-key)))

I can iterate over the list using dolist but then I'not sure how to write the actual call to font-lock-add-keywords (building the regexp and make sure the tag variable (or function) is called):
(dolist (item tags)
  (let ((regexp (car item))
        (tag    (cdr item)))
    (message (format "%s : %s" regexp tag))
    ;; HOW TO CALL font-lock-add-keywords with regexp and tag ?
))

Update
I've tried using mapcar, but the (cdr item) does not evaluate to the actual tag content.
(defun f (item)
  `( ,(concat "\\(" (car item) "\\)") 1
     `(face nil display (cdr item))))
(mapcar 'f tags)


texts:
I'm clocking the time spent on daily tasks like email and for that I
have a "Daily Routine" TODO entry. Clocking in this task adds a new
clock line everyday, leading to a very populated CLOCK drawer. I'd like
to limit its size by either a maximum number of clock entries by
removing the older ones or better, removing the entries older than some
date. Ideally, I'd like to find a function that tidies the clock drawer of an entry, to be added to the clock-in or clock-out hook.
Any idea how to achieve that ?


texts:
How can we convert the current text buffer to a pdf file, preferably turning those headings started with * into bookmarks of the pdf file.
For example, turning the Emacs integrated tutorial (shown by C-h t) into a bookmarked pdf file. Thanks.


texts: How to better align tags in Org Mode using variable-width font

texts:
I prefer using variable-width fonts in Emacs whenever I can. That said, Org Mode tags are horribly aligned when headings use variable-width fonts, even if the tags themselves use fixed-width fonts. Is it possible to continue using variable-width fonts for org headings and have tags properly aligned?

Another acceptable solution would be to customize Org Mode faces by file extension. This would allow the use of fixed-width fonts for org headings in .txt files, where I use a lot of tags, and variable-width fonts for .org files, where I rarely use tags. I just don't know how to customize faces based on file extension.

The first situation, where I continue using variable-width fonts, is preferred; I'm just not hopeful that such a solution exists.


texts: Change syntax highlighting without changing major mode?

texts:
I want to start a python-shell M-x python-shell. If I'm not happy with the syntax highlighting, is it possible to improve it (put more colors in the buffer) without changing major mode? In vim this would be simple with set filetype=python.

The python syntax itself is not highlighted in python-shell mode, I want it to be highlighted.

A simple solution will be favored because I'm just learning about emacs.


texts: How to force the window splitting direction when starting slime?

texts: When I use emacs in a separate Window (under X), if I start slime the window is split horizontally if the window's width is smaller than its height, and vertically otherwise. Is it possible to force the direction of the splitting and make it independent of the dimensions of the emacs window? For example, I would like to have slime always open under my source code buffer. I cannot find anything about this in the documentation.


texts: How to escape regexp special characters in a string?

texts:
I'm composing a complex regular expression and the user can supply a part of the expression.  However, the user-supplied part should be interpreted literally, i.e. regexp special characters should be escaped.  Is there a function for escaping these characters?  It seems like a common thing to do but all my googling was unsuccessful.

Example:

(re-search-forward (format "\b%s\b" user-string))

If user-string is test*case, I want to match test*case but not testttttcase.


texts:
I have some experience in Emacs-LISP. Today I spent 6 hours writing LISP code that I guess-timate would have taken 1h30 to write in Python because my workflow to develop and debug is very clunky. In Python I would log successive values with print("Stage N: " + value) at different stages. I am looking for something better.

I give two examples below. I'm sure other people are more productive given the high reputation of LISP. What workflows do coders use for development and debugging in Emacs-LISP?

One example

Automated testing with ERT does not indicate the line of an error. This is so strange that I made it into its own question).

Another example

In debugging a function with an optional argument, I was unable to log that value to the *Messages* buffer as I could not find how to convert t and nil to string. In the *scratch* buffer:

(message (concat "Value is: " (string t))) ;; concat: Wrong type argument: characterp, t

(message (concat "Value is: " (string nil))) ;; concat: Wrong type argument: characterp, nil

(message (concat "Value is: " t)) ;; message: Wrong type argument: sequencep, t

(message (concat "Value is: " nil))
"Value is: "


texts: Use autocomplete variables from first column of a CSV file

texts:
I have used conventional auto complete feature in emacs and I think I understand how it works.

I have a new requirement, where the variables to be used in a particular program (not conventional programming like C/C++/Python - but some text based file) would be listed in the first column of the CSV file. All those variables will start with a ":"(semicolon).

I want emacs to use auto complete the conventional way (i.e, auto complete the variables used in the current file) plus fetch these variables from the first column of the CSV file.

I do not know if this such a thing has got a name or not for this. Also, I have no idea on how I could point the CSV file to use from the current file.


texts: Executing emacs shortcuts when keyboard is set to Greek

texts:
Writing Greek in emacs is proving to be quite inconvenient. If my keyboard is set to Greek, normal shortcuts do not work and I have to switch to latin just to navigate around the buffer.

As an example, let's say I'm writing a Greek sentence and I want to go back a character to fix a mistake. The usual way is to press C-b, but because my keyboard is set to Greek, emacs actually receives C-β and gives me an error: "C-β is undefined". What I have to do next is press alt-shift to switch to latin, enter C-b again, and switch to Greek once again with alt-shift. Quite a hassle.

Is there a way around this? I could, of course, map C-β to do what C-b does, but I'd have to do that for hundreds of shortcuts.

It'd be nice if the solution worked for evil-mode, too.


texts: How can I automatically swap frame buffers if the buffer is already open?

texts: I've seen the https://www.emacswiki.org/emacs/buffer-move.el script, but I'm trying to something a bit different. Suppose I have a frame with a buffer from file A.h in it and A.cpp in another frame somewhere else. If I currently have A.h selected and try to open A.cpp from it (using either C-x C-f or projectile open), I would want the frames containing A.h and A.cpp to simply swap buffers with each other. Is there a library or something that already does this? I'm trying to do it myself based on buffer-move.el, but I can't find any of the hooks I need or the ability to search for a frame containing a buffer with a specific name.


texts:
I installed auctex from Ubuntu's software center, and then I installed a newer version of auctex from emacs.

I then uninstalled the auctex installed by Ubuntu's software center. I found that it didn't uninstall the one I installed from emacs.

How does emacs manage its packages?

Are there no interference between emacs and Ubuntu in managing installation and uninstallation of emacs packages?

If I am correct, a few years ago, there was no way to install packages within emacs?

Thanks.


texts: Missing color support (for exa) in eshell

texts: I just started using eshell. But the color support for some commands seems to be missing. For example I like to use the command exa, because of its nice colors. But in eshell it is all black.


texts: How to undo one elfeed search key binding

texts:
The elfeed package binds b to something like this

;; https://github.com/skeeto/elfeed/blob/master/elfeed-search.el
(defvar elfeed-search-mode-map
  (let ((map (make-sparse-keymap)))
    (prog1 map
      (suppress-keymap map)
      (define-key map "q" 'elfeed-search-quit-window)
      (define-key map "g" 'elfeed-search-update--force)
      (define-key map "G" 'elfeed-search-fetch)
      (define-key map (kbd "RET") 'elfeed-search-show-entry)
      (define-key map "s" 'elfeed-search-live-filter)
      (define-key map "S" 'elfeed-search-set-filter)
      (define-key map "b" 'elfeed-search-browse-url)
      (define-key map "y" 'elfeed-search-yank)
      (define-key map "u" 'elfeed-search-tag-all-unread)
      (define-key map "r" 'elfeed-search-untag-all-unread)
      (define-key map "n" 'next-line)
      (define-key map "p" 'previous-line)
      (define-key map "+" 'elfeed-search-tag-all)
      (define-key map "-" 'elfeed-search-untag-all)))
  "Keymap for elfeed-search-mode.")

In my prelude personal.el, I want to "free up" the b key.
Because I want the letter b to be available for a custom use.

How can I tell emacs to not respect the b binding of elfeed?


texts:
How do you wrote an abortable function, so that
when user presses C-g during execution,
this function is "stopped"

;; my function so far
(defun my/elfeed-extra-info-2 ()
  (interactive)
  (next-line)
  (message "here1")
  (sleep-for 0.5)
  (next-line)
  (message "here2")
  (sleep-for 0.5)
  (next-line)
  (message "here3")
  (sleep-for 0.5)
  (next-line)
  (message "here4")
  (sleep-for 0.5)
  (next-line)
  (message "here5")
  (sleep-for 0.5)
  (next-line)
  (message "here6")
  (sleep-for 0.5)
  (next-line)
  (message "here7")
  (sleep-for 0.5)
  (next-line)
  (message "here8")
  (sleep-for 0.5)
)


texts: How to indent back one level when writing a newline?

texts:
I'm using Emacs to write LaTeX. For example, in the following code, I have write to the level 3. When I press C-j, the cursor will indent to the third level. I what the newline to be indent at level 2.

How would I be able to do this?

\level 1
\level 1
  \level 2
  \level 2
     \level 3
     \level 3
  \level 2 % <- I want to end up here

Update: Thanks, I'm using sdaps package to write a survey. Here is a question example. BTW, I don't know list environment yet. Is it related to this?


texts:
I am looking for a way to bulk generate emails in emacs.

Is there any plugin I am not aware of?
I need to read 'name', 'surname', 'email', and an additional field from a CSV and place those values in a template and send them out.

Would be very grateful for help.


texts:
I would like to unfill all paragraphs before sending a message with mu4e. This is because format=flowed is not respected by all platforms (particularly Gmail).

I figure that message-send-hook is the right place to put it, but I do not know of a reliable way to select the whole message programmatically without unintentionally capturing the message headers or quoted citations.


texts:
Is there an easy way to highlight all the words in a line with just one command? I'm trying to write an elisp function to achieve this but my knowledge is pretty rudimentary. So far, I can only move the point to the beginning of the line and highlight the word there:
(defun hx ()
  "Highlight all words in a line."
  (interactive)
  (beginning-of-line)
  ;; Split string based on comma-separator
  (let ((mylist (split-string (thing-at-point 'line t) ","))))

  (highlight-symbol-at-point)

)

I was hoping to iterate over mylist and use re-search-forward to find the first occurrence of each word in the list, move the point to that word and then highlight it. However, mylist contains an empty list. Even if mylist contained a list of words, I don't know if the above approach would actually work.


texts: How to generate and display tags in treemacs (for JavaScript)?

texts:
I'd like to generate a set of tags and then view them in Treemacs, ideally whenever I open a file that I can generate tags for.

The docs for Treemacs' tag view say:

  Treemacs is able to display
  not only the file system, but also tags found in individual files. The
  tags list is sourced using emacs’ builtin imenu functionality, so all
  file types that emacs can generate an imenu index for are supported.

  Imenu caches its result, so to avoid stale tag lists setting
  imenu-auto-rescan to t is recommended. Tags generated with the help of
  semantic-mode are likewise supported.

I looked around and it appears that js-mode does offer imenu support.

I'm at a loss for how to actually connect these two - how do I get js-mode to create the imenu index so that treemacs can actually use it?


texts: Point belongs to window - mark belongs to buffer

texts:
In Emacs the point belongs to a window: this allows a buffer to be displayed in two different windows at the same time.

The mark belongs however to the buffer.

Conceptually the mark and a point determines a region. Since the mark belongs to the buffer and not the window, it is not possible to have two independent regions.

What are the benefits of associating the mark with a buffer?

Is there any discussions of this design decision (an old mailing list perhaps)?


texts:
Linux Mint 20
Emacs 26.3
I installed package dired-icon (https://www.topbug.net/dired-icon/) and restarted Emacs. I then did
M-x dired-icon-mode

But icon in dired mode does not show and in the mini buffer the following message is shown:
Opened text-plain.png in external program

In my init.el file:
(add-to-list 'load-path "~/.emacs.d/elpa/openwith")
;; https://github.com/emacsmirror/openwith
(require 'openwith)
;; Settings for package "openwith"
(when (require 'openwith nil 'noerror)
  (setq openwith-associations
        (list
     (list (openwith-make-extension-regexp '("doc" "docx" "rtf")) "word" '(file))
     (list (openwith-make-extension-regexp '("mpg" "mpeg" "mp3" "mp4" "avi" "wmv" "wav" "mov" "mkv")) "vlc" '(file))
     (list (openwith-make-extension-regexp '("pdf")) "FoxitReader" '(file))
     (list (openwith-make-extension-regexp '("bmp" "gif" "jpeg" "jpg" "png" "tif")) "xnview" '(file))
     (list (openwith-make-extension-regexp '("rdp")) "Remote Desctop Connection" '(file))
     (list (openwith-make-extension-regexp '("xls" "xlsx")) "excel" '(file))
         ))
  (openwith-mode 1))


texts: Smartparens generates nested quotes instead of overwriting final quote if backspace used in between quotes

texts:
The relevant section in my .emacs file looks as follows:

(require 'smartparens)
(smartparens-global-mode t)
(require 'smartparens-config)
;; for erb
(sp-pair "%" "%" :wrap "C-%")

I am often getting extra sets of quotes when typing the final quote in a pair rather than the final quote being overwritten, as expected and am trying to figure out what the cases this happens in are, and if there is a resolution.  I a big part of the problem is that the closing pair member is the same as the opening pair member.

Example:

Type "<any single character><backspace>"

Typing the first quote generates the second, but when typing the above sequence, I would expect for the final quote to be overwritten, as it does when you omit the <backspace> keystroke.

Another example:

Type "" Outputs: """"

I'm not really sure if there is a good, general solution to this, as there may be cases in which this behaviour is desired.  Feel free to edit this question with more examples.


texts: Shell mode does not do autocompletion for loaded functions

texts:
When running in a terminal, the shell does auto-completion even for loaded functions:

$ check-<tab><tab>
check-bios-nx           check-dirty             check-language-support  check-manifest

And check-dirty is a function:

» type check-dirty
check-dirty is a function
check-dirty ()
{
    is-older-than 24 ${REPO_LIST} || refresh-repo-list;
    cat ${REPO_LIST} | while read dir; do
        cd $dir;
        test -z "$(git status --porcelain)" || printf "%-50s : dirty\n" "$dir";
        cd - > /dev/null;
    done
}

But in emacs, the completions buffer show me a different list:

Click on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
check-bios-nx
check-language-support
check-manifest

The function is also loaded in the emacs shell buffer. In fact, the whole environment is exactly the same as the environment in the shell in the terminal (except minor things like TERM)

Why is my loaded function not being shown in auto-completion in emacs? Is there a "bash compatibility mode" for the shell mode?

It is this small inconsistencies in behavior which prevent me for going full emacs, and I keep using other tools (in this case bash in a terminal) for different tasks.


texts: Simple ways to copy/paste files and directories between dired buffers

texts:
Is there a simple M-w C-y approach to copy paste files and directories between two dired buffers?

I mean marking some items (files and buffer) by m then copying them by M-w (or another shortcut), then going to another dired buffer (which is not necessarily in a window side-by-side by the window of previous dired buffer(s)) then yanking all copied file by C-y (or another shortcut) there? This is a simple task that many file explorers in different OS can do.

The problem with the classical Copy option C in dired is that as soon as it is pressed, it asks for the destination. If the path of the destination buffer is very long or there are too many opened dired buffer, this approach is complicated.

I am looking for a solution to first copy the items then to paste them at an appropriate dired buffer.

There is a related question How to quickly copy/move file in Emacs Dired?
which uses the classical approach of pressing C when two dired windows separated vertically using the option (setq dired-dwim-target t).

What are the ways to achieve this?


texts: Separate Environments for each emacsclient

texts:
I have a single emacs server that I use for all of my work. It is located on a machine that I ssh into from every location.

My 'browse-url is set to run a bash script that ssh's into the machine I am running emacsclient on and opens Chrome. However, this only works if I use emacs from one machine.

I need a method for my emacs server to change its behavior based on the emacs client (whether it is an environmental variable, a variable that gives the hostname of the client, or anything else). I can't seem to find anything right now.


texts:
I'm using org-mode and doing an ssh multihop into a remote server from our faculty.

:PROPERTIES:
:header-args: :dir "/ssh:user@remote|ssh:user@remote2:/home/user"
:END:

#+BEGIN_SRC sh
ls -al
#+END_SRC

I notice that Tramp hangs forever and then quits with a "File not found" error when trying to read back results into the org-buffer. I also notice that the problem goes away when I remove my .bashrc file on the remote server.

I fear that the problem has to do with my PS1 and PS2 prompt settings on the remote, because they contain some escape sequences to change the prompt coloring - which I believe Tramp doesn't understand.

Is there a way to ask Tramp not to read my .bashrc?! Is that even possible?
Do you guys have any recommendation on the best way to approach my problem?


texts:
I can run the Bash shell that comes with Git for Windows. I put this in my .emacs:

(defun git-bash () (interactive)
  (let ((explicit-shell-file-name "D:/Program Files/git/bin/bash"))
    (call-interactively 'shell)))

Then M-x git-bash and voila, bash is running but with some weirdness:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
^[]0;MINGW64:/c/Users/M??rton^G
MĂĄrton@Marci MINGW64 /c/Users/MĂĄrton
$

and it prints that line, beginning with ^[], after every command I run. Also the encoding is messed up. How can I fix this in .emacs?


texts:
Is there an easy way to create a list of "to-do" items on-the-fly when writing code? For example, suppose that I am writing a function write-this-now when I realize that I am also going to need to write a support function write-this-later.

(defun write-this-now ()
  (unless (write-this-later) ...

Instead of pausing to go create write-this-later, I charge ahead as if it already existed.  However, I also want to make a note for myself that I still need to come back later and create it.

One solution that I have used in the past is to add a comment with the word TODO

(defun write-this-now ()
  (unless (write-this-later) nil))  ; TODO create function `write-this-later`

Now I can come back at some later time and search the file for occurences of the word TODO, and I will find this little note that I left for myself.

Are there any packages or extensions out there to facilitate easy creation and tracking of TODO items within a file or project?

Can I aggregate all of my TODO items from the current project into a single to-do list?  Can I add bookmarks in my to-do list that link back to the locations where I wrote the TODO items?


texts: How to use a prompting interactive function in an elisp source file

texts:
I've seen this, but it doesn't work for this case.... Basically, I want to do a load-file on an .el file containing

(add-file-local-variable-prop-line "eval" "(set-input-method 'TeX)")

and have it add

;;-*- eval: (set-input-method 'TeX)  -*-

at the top of that same file; instead, it inserts

;; -*- "eval": "(set-input-method 'TeX)"; nil
-*-

which is mangled and doesn't work. Obviously, the double-quotes  (and the nil too?) render it bad. But then using no quotes and single quotes to satisfy the two interactive prompts produce errors. How can I do this non-interactively "batch" style?


texts: Can hash-table entries have property lists?

texts:
Q: Can hash-table entries have property lists and, if no, what are the idiomatic alternatives?

As the manual explains, symbols can record miscellaneous information via symbol properties.  I'd like to know if this applies to hash tables with symbols as keys.

Here's a toy example:

(setf hash-1 (make-hash-table)
      hash-2 (make-hash-table))

(puthash :key-1 "val-1" hash-1)
(puthash :key-2 "val-2" hash-2)

Can I attach symbol properties to :key-1 -- and, particularly, different properties for the two hash tables -- for later inspection?  I'm guessing no, as neither gethash nor puthash seem to offer facilities for manipulating the key -- only the value.  (See also this thread.)

If that's correct, what is the idiomatic alternative to symbol properties for hash-table entries?

I could, for example, assign an alist as the value of a hash entry:

(puthash :key-2 '((:val "val-3") (:prop prop-1)) hash-1)
(puthash :key-2 '((:val "val-4") (:prop prop-2)) hash-2)

And then each entry has a value list and a "property" list:

(assq :val  (gethash :key-2 hash-1))    ; => (:val "val-3")
(assq :prop (gethash :key-2 hash-1))    ; => (:prop prop-1)
(assq :val  (gethash :key-2 hash-2))    ; => (:val "val-4")
(assq :prop (gethash :key-2 hash-2))    ; => (:prop prop-2)

That seems a little convoluted, however.  Is there a cleaner way to do this?


texts: M-x replace-regexp uppercases words in replacement text based on the first letter present in the line

texts:
So, I have the following buffer:

1234
Red
blue
green
yellow

# colors

orange

Now, if I run M-x replace-regexp I get odd results. If I have the search string: ^\(.+\)$ and the replacement string: example string:\1 I get the following output:

example string:1234
Example String:Red
example string:blue
example string:green
example string:yellow

example string:# colors

example string:orange

As can be seen, I get Example String:Red instead of the expected example string:Red. What's the deal with this behavior?


texts:
I put the following in my .init file:
(defun ndk/org-refile-candidates ()
  (directory-files  "/home/rob/Dokumente/todo/" t ".*\\.org$"))

(add-to-list 'org-refile-targets '(ndk/org-refile-candidates :maxlevel . 3))

It does work when evaluating manually with C-x C-e, but not when I restart Emacs.
I get the error:

Symbol's value as variable is void: org-refile-targets
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

Why isn't it setting the value of the variable like when I do it manually? Does it get overwritten by some default somehow? Can somebody point me into the right direction?


texts: Error (initialization): User ... has no home directory

texts:
I just installed GNU Emacs 23.1.1 on a new machine and copied my ~/.emacs and ~/.emacs.d/ from another machine where I'm running emacs 25.1.1.

When I launch emacs it writes Error (initialization): User <my_id> has no home directory into a buffer. Not surprisingly, it also has not read .emacs.

One thing odd about this machine is that home directories are stored in /home/, rather than in /mxhome/ like in the rest of my work environment, and this new machine has a symlink from /mxhome -> /home. I don't know if that is important.

UPDATE: launching with emacs -q -l /home/my_id/.emacs filename loads the .emacs file and avoids the error, although I don't know if it solves the problem entirely.

Emacs administration is largely a mystery to me. Can anyone help?


texts: How can I use occur (M-s o) to search for a string that contains a backslash, e.g. \def?


texts: Color code different types of org abbrev links

texts:
I use org-link-abbrev-alist to create abbreviations to common links I use. For example:  ("wiki" . "https://en.wikipedia.org/wiki/%s") so I can have [[wiki:Emacs][Emacs]] for one of my wikipedia links in my org files.
I'd like to be able to color code these links to help differentiate their destination.
Is there a function or setting that I can add to my configuration to do something like this:
(setq org-link-abbrev-faces  ;;
        '(("wiki" . "#F78200") ;; orange
          ("file". "#E23838")  ;; red
          ("http" . "#973999") ;; purple
          ("https" . "#009CDF") ;; light blue
          ))

So that all abbrev links that begin with that type would have a matching color?
Many thanks


texts:
I have this elisp code from yasnippet:
`(progn (goto-char (point-min)) (unless (re-search-forward
"^using\\s-+namespace std;" nil 'no-errer) "std::"))
`cout << $0${1:} << "${2:\n}";

which will print:
cout << ... << "\n";

when you type cout and TAB to complete.  Note that ... is where my cursor will be.
If I don't have using namespace std in my C++ code, then the insertion becomes:
std:: cout << ... << "\n";

Instead of the newline character, \n, I tried to modify so that endl is printed instead. In other words:
cout << ... << endl;

and
std::cout << ... << std::endl;

Question
How to have std:: inserts at both cout and endl if no using namespace std; is found?
Attempts
I tried the followings, none of them work:
 `(progn (goto-char (point-min)) (unless (re-search-forward
    "^using\\s-+namespace std;" nil 'no-errer) "std::"))
    `cout << $0${1:} << endl;

This only prints std:: to the front, cout if I do not have the using namespace std;.
`(progn (goto-char (point-min)) (unless (re-search-forward
        "^using\\s-+namespace std;" nil 'no-errer) "std::"))
        `cout << $0${1:}
`(progn (goto-char (point-min)) (unless (re-search-forward
        "^using\\s-+namespace std;" nil 'no-errer) "std::"))
        'endl;

This previous code just prints out:
cout << ...
`(progn (goto-char (point-min)) (unless (re-search-forward
            "^using\\s-+namespace std;" nil 'no-errer) "std::"))
            'endl;


texts:
Window 10 (64 bit), Emacs 26.1

When in *scratch* buffer I run:

M-x package-install multiple-cursors

I get error No match

But when I go to package manager I success found and install package multiple-cursors

So why I get error: No match

Also I try autocomplete. But it not found this package


texts: How to temporarily change the definition of a function?

texts:
In the following code the function foo calls the outer f2 function. How to make it call the anonymous function bound within the let?
(defun f2 ()
  (message "outer f2"))

(defun foo ()
  (f2))

(let ((f2 (lambda ()
            (message "inner f2"))))
  (foo)) ;; `foo' does not call `f2' in the `let', i.e. prints "outer f2"


texts: What happens when there is more than one custom-set-variables?

texts:
a quote from my init.el:

;; custom-set-variables was added by Custom.
...
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.

What exactly will happen? I've found no hint in custom-set-variables' documentation...

Background: I have multiple custom-set-variables in order to share common configuration and separate special settings among a few hosts. The whole emacs setup is in a git repository and in init.el I do this:

(load (concat my-emacs-dir "config/" (system-name)  ".el" ) )
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file)

It works more or less ok. I can use the customize interface (which I like) and settings go to ~/.emacs.d/custom.el. Special settings go manually to <hostname>.el

Only when merging stuff between hosts, I see that some settings to go where I would like to have them and I have a bit of additional work. To improve that, I would like to understand the details of custom-set-variables.


texts: Incremental Search across Projectile project

texts: How do I perform isearch over a whole projectile project, so that I can cycle through all occurrences of a string? This would be equivalent to multi-isearch-file for all files in the projectile project.


texts:
I find myself consistently zooming out (C-x C--) in every buffer that I am using in order to see more lines of code that I'm working on.

Is there a way to set the zoom level in my .emacs, not interactively?
Or should I look into setting the fontsize?
I've been using the zoom, because it's been the easiest/quickest solution, but I'd rather find a more permanent solution.  Are there disadvantages or advantages to using one versus the other?  I am unclear on the differences.


texts: Web-beautify JS code on Windows (js-beautify for unminimifying)

texts:
I'm trying to un-minimify JS code on Windows.
I've installed web-beautify from MELPA.
I also installed Node.js for Windows, which is a dependency of this package.
I then ran npm -g install js-beautify as instructed. The command completed well.
Howevever, calling web-beautify-js on a js buffer still does not work.

The program js-beautify works on my command-line tools, but not in my Emacs Shells, even though the variables (PATH and exec-path) are well set. I suspect this comes from the fact that js-beautify is in fact a Batch script which calls the program node, with an argument. I don't know why, but the batch script does not work from an emacs shell - except if I call it from its directory

It is possible though to reproduce the behaviour of the script in an Emacs Shell anywhere. For instance, although typing js-beautify  does not work, the following command worked:

node <path-to-npm>\node_modules\js-beautify\js\bin\js-beautify.js <file>

However, I have no idea how to go any further. What I want is not to be able to call js-beautify from an Emacs shell, but to be able to call web-beautify-js from any js buffer.
Has anyone found a clean hack to do this?

(Error message on web-beautify-js:

'js-beautify' is not recognized as an internal or external command,
operable program or batch file.

)


texts: Conditionally calculate the sum of a column depending on a fields value in another cell of the same row

texts:
In orgmode, I do have a table like the following to track my overall working time a day. It is not important for which tasks or projects or even which client I spent my time on, just if I was in office or worked from remote.

The table looks like this:

| Day | Start |   End | Home |   Sum |
|-----+-------+-------+------+-------|
|   1 | 09:00 | 17:00 | No   |  8.00 |
|   2 | 09:00 | 12:00 | No   |  3.00 |
|   2 | 13:00 | 20:00 | Yes  |  7.00 |
|-----+-------+-------+------+-------|
|     |       |       | 7.00 | 11.00 |
#+TBLFM: @2$5..@-1$5=$3-$2;t

Now I need a formula that calculates the fields @<$4 and @<$5 as sums, while in @<$4 the values of $5 are summed when in that row $4 is Yes and in @<$5 the values of $5 shall be summed when $3 of that row is not Yes.

Instead of Yes/No I can switch to any other kind of marker as well.


texts: org-mode: adding a new heading creates some anomalous activity. What is the right variable to check

texts:
When I create a new orgmode heading with C-<RET>, orgmode will add a new outline entry at the current hierarchy level. However in my current setup, whenever I push C-<RET> it creates the new entry as well as adding a timestamp on the line below.

So instead of:

** {blank}

I get:

** {blank}
[2017-12-28 Thu 16:23]

I would like to get the entry without the timestamp.

Does anyone know the correct variable or setting to change? According to the manual the correct function is org-insert-heading-respect-content but there is no mention in the manual about timestamps in reference to this function.

Note I am using an orgmode config that I did not write myself--got from a blog post. So I am not sure about everything going on in the config. That is why I am trying to adjust this behavior.


texts: EXWM Fails to Start on Ubuntu Based System (Linux Mint)

texts:
I'm trying to use Emacs as my X Window manager. However, it doesn't seem to work properly. My X server did start and so did Emacs. However, I always got the error

  Warning (emacs): [EXWM] EXWM fails to start (invalid-slot-name: (# cl-slot-descriptor))

in Emacs.

I followed the instructios at https://github.com/ch11ng/exwm/wiki, here's my
~/.xinitrc file:

# Disable access control
xhost +SI:localuser:$USER

# Make Java applications aware this is a non-reparenting window manager.
export _JAVA_AWT_WM_NONREPARENTING=1

# Themes, etc
gnome-settings-daemon &

# Fallback cursor
xsetroot -cursor_name left_ptr

# Keyboard repeat rate
xset r rate 200 60

# Start Emacs
exec dbus-launch --exit-with-session emacs

and here's what I put in my init.el:

(require 'exwm)
(require 'exwm-config)

(exwm-config-default)

Here's how I started the X server:

After login to gnome session, press Ctrl-Alt-F1
Login to virtual console
$ xinit -display :1 -- :1 vt1

Instead of running:

xinit -display :1 -- :1 vt1

I've also tried:

sudo service mdm stop
xinit -- vt01

With the exact same results.


texts: I want to be able to switch between "Consolas-12" and "Georgia-13" using key bindings. Can I do that? How?


texts:
I'm new to Emacs as well as to Linux. Being a fan of Total Commander, I want to achieve something similar using Emacs. Sunrise Commander with Tabs extension really saves the day - but with one limitation: regardless which tabs I had before exiting Emacs, I always start Sunrise Commander with two home panels without other tabs after restart.
The desired behavior may vary, depending on what is easier to achieve:

Setting some sort of "favorite tabs" list (maybe just inside the init file), so that listed tabs are auto loaded on startup. No session saving is implied in this case. This scenario is, actually, the preferable one. Maybe that can be accomplished with sunrise-checkpoint, though I found no documentation on that.
Session saving. I know that there are ways of saving sessions, but I wish only for Sunrises' tabs to be saved, without other buffers. Moreover, I want to be able to have several Emacs sessions at once with no contradictions.

How can one do any of that?


texts: Autocomplete environments like in TeXStudio

texts:
TeXStudio autocompletes environments.  How can I get AUCTeX to do the same?

I can begin typing an environment name (say myenvironment) and, after entering a part of it (my, myenv, etc.), I hit Control-Alt-Space, and TeXStudio autocompletes the environment (asking if there are multiple possibilities), and sets the point between \begin{myenvironment} and \end{myenvironment}.

I tried yasnippet mode, but this works only for predefined snippets. So I have, for example, to define a keyword myenv and it will only autocomplete the snippet for the environment if myenv + TAB is entered and not when only my + TAB is entered (with a list of possible completions) or if I type myenvi + TAB.

I also tried predictive-mode which seems to complete only words.

EDIT: I know the AUCTeX way to do this via C-c C-e. The difference to the desired TeXStudio approach is that you have to give a key sequence first and then input a few letters of the environment name, whereas in TeXStudio it is the other way around (which is what I am asking here).


texts: M-x shell truncates commands to 4096 characters

texts:
Using M-x shell, I have encountered a problem with commandlines being truncated to 4095 characters.

Steps to reproduce:

perl -e 'print "0" x 5000 . "\n"'
Select output for next command
echo <5000 zeros> > /tmp/emacs_5000

Expected behaviour:

wc /tmp/emacs_5000 should return

1    1 5001 /tmp

Current behaviour:

4090 zeros are output into the shell.

Interpretation: only the first 4095 characters (4090 output + 'echo ') are passed to the shell process.

Is my interpretation correct?

Is the a way to fix it?


texts: How can I refer to the system default (Windows) proportional font?

texts:
Let's say I want to write a package which uses proportional font. But I don't want to hardcode a specific font, because the user may not have it installed.

How can I refer to the system default proportional font which can be configured by the user?


texts: Append shell-command output to named buffer

texts:
In my init file I have a function that runs a shell-command everytime I open emacs. I rarely need to look at the out put of this command, so having it pop up in the *Shell Command Output* buffer every time I open emacs is unnecessary, and also means that I always have to take an extra step to get rid of that window.

From the documentation for shell-command, I have learned that I can provide an OUTPUT-BUFFER argument and direct the output where I want it to go. Sending it to the *Messages* buffer is almost the perfect solution for me, because it means I don't need to think about the output of the script, but if I do need to find it, I can find it in *Messages*, which seems to be a logical place to look for it.

My only problem is that adding the OUTPUT-BUFFER argument will make it so that whatever messages are in the *Messages* buffer at the time the command is run will be replaced by the shell-command output. I rarely look at the *Messages* buffer unless I need to, but I want to make sure I don't remove anything important just in case. Is there any way for me to append the output of shell-command to this buffer rather than replacing the buffer's contents? Any push in the right direction would be appreciated. Thank you!


texts: Equivalent of add-face-text-property for overlays?

texts:
add-face-text-property is very convenient for adjusting the face of text based on text properties (Changing Text Properties).

Q: Is there an existing equivalent to add-face-text-property to add face properties to overlays?

Otherwise something like this should be sufficient (and maybe should be a feature request):

(defun my/add-face-overlay-property (overlay face &optional append)
  "Add the face property to OVERLAY.  FACE specifies the face to add.
It should be a valid value of the `face' property (typically a
face name or a plist of face attributes and values).

If the overlay already has a non-nil `face' property, those
face(s) are retained.  This is done by setting the `face'
property to a list of faces, with FACE as the first element (by
default) and the pre-existing faces as the remaining elements.

If optional fourth argument APPEND is non-nil, append FACE to the end
of the face list instead."
  (overlay-put overlay 'face
               (if (plist-member overlay 'face)
                   (if append
                       (list (plist-get overlay 'face) face)
                     (list face (plist-get overlay 'face)))
                 face)))


texts: Open Emacs GUI from terminal (keep process running in terminal)

texts:
Sorry, but I will probably be not using the correct terminology in this post.

I used to be able to open Emacs from my terminal and the terminal process would stay open (I would not be able to navigate anywhere else using the terminal unless I opened a new tab of quit Emacs). It would look something like the following:

MacBook-Pro:~ User$ emacs

# and down here would just be open space

But now when I open Emacs, the terminal reverts back to where I can navigate to another directory or whatever:

MacBook-Pro:~ User$ emacs
MacBook-Pro:~ User$

However, I prefer the terminal process to stay open which allows me to easily close Emacs when it freezes (by just exiting the terminal) instead of powering off my computer. I am not sure what I did to cause this change in behavior.


texts: Get value of a variable from another session in org-mode

texts:
How to share variables' values in org-mode between different sessions?

Simple example: in session one I create _gpg_tmpdir

#+name: make_temporary_directories
#+begin_src bash :session *one*
_gpg_tmpdir="$( mktemp -d )"
#+end_src

and need to clean up it in session two:

#+name: clean_temporary_directories
#+begin_src bash :session *two*
rm -rf $_gpg_tmpdir
#+end_src

The example is for the demonstration purpose only.
The question is what is the less painfull way to share variables between different code sessions (perhaps with different code languages) in org-mode.


texts: M-x shell doesn't know about installed apps

texts:
I have to launch almost any application by specifying the whole path which is annoying.

For example, git works fine, but lua does not. Both are installed in the same place:

$ which git
/usr/local/bin/git
$ which lua
/usr/local/bin/lua

How to make M-x shell behave like my standard shell? Or maybe there's a decent shell emulator as a package?

echo $SHELL outputs /bin/bash.


texts: auto kill a shell buffer when command finishes

texts:
i have this function you guys helped me write

 (defun z/dired-shell-other-window-beets ()
   (interactive)
   (let ((command (concat "beet import " (format "%S" (dired-get-filename)))))
     (switch-to-buffer (shell)
       (insert command)
       (comint-send-input))))

is there a way to 1. rename the buffer to beets when created and 2.auto close (kill) the beets buffer when the command i run beet import finishes running?


texts: What functionality is missing in GNU Emacs when compared to XEmacs?

texts:
In terms of functionality, what are the key points that presently distinguish XEmacs from GNU Emacs?

To account for the different release schedules the most recent development version of each Emacs flavor should be considered as the basis for comparison.

We should avoid arguments about historical/organizational/philosophical/... issues, so please only mention purely functional/technical differences.


texts: How to make Isearch highlight more matches when I scroll?

texts:
upon having used Isearch or C-u C-s to highlight a word, when I use then C-v or M-v for scrolling the highlights remain due to setting
    (setq-default
     isearch-allow-scroll t
     lazy-highlight-cleanup nil
     lazy-highlight-initial-delay 0)

But isearch only highlights words which were visible when the search was triggered, and if I scroll up or down identical words are not highlighted. How can I change this behavior?


texts: Outputting figure from R to LaTeX in source block with caption

texts:
I am trying to run a source code block and have the outputted figure go into a LaTeX document as a figure. Basically I am doing this in a way slightly similar to Jupyter notebooks, but with the ability to work in org and have access to LaTeX export.

I have already come across this answer which does an example for Python, which does not seem to resolve my issue and I still have a problem with the Python version of this answer.

My MWE for the org file is:

* Testing source

#+NAME: fig:20170117
#+BEGIN_SRC R  :file test.png :session org_org :results graphics
x <- c(0, 3, 8, 9, 0)
y <- c(1, 4, 5, 6, 7)
plot.new()
plot(x, y, xlab="test_x", ylab="test_y")
mtext("Some plot")
#+END_SRC
#+CAPTION: Output caption
#+LABEL: fig:20170117
#+ATTR_LATEX: :width 0.75\textwidth
#+RESULTS: fig:20170117
[[file:test.png]]

#+NAME: fig:org_fig
#+BEGIN_SRC python :file org.png  :session org_py :results graphics
clf()
plot(np.sin(np.arange(0,7,0.1)))
plt.savefig('org.png', transparent=True, bbox_inches='tight')
'org.png'
#+END_SRC
#+CAPTION: Org Fig
#+LABEL: fig:org_fig
#+ATTR_LATEX: :width 0.5\textwidth
#+RESULTS: fig:org_fig
[[file:org.png]]

And exporting both of these gives the LaTeX body with the code but not the correct labels or either of the figures. If I comment out the #+RESULTS: line I will get the figures, but without the captions and labels.:

\section{Testing source}
\label{sec:orge034bc3}

\lstset{language=r,label=org47910a7,caption= ,captionpos=b,numbers=none}
\begin{lstlisting}
x <- c(0, 3, 8, 9, 0)
y <- c(1, 4, 5, 6, 7)
plot.new()
plot(x, y, xlab="test_x", ylab="test_y")
mtext("Some plot")
\end{lstlisting}
\lstset{language=Python,label=org677e653,caption= ,captionpos=b,numbers=none}
\begin{lstlisting}
clf()
plot(np.sin(np.arange(0,7,0.1)))
plt.savefig('org.png', transparent=True, bbox_inches='tight')
'org.png'
\end{lstlisting}


texts:
When using artist-mode I often find I want to create several equally sized boxes for a diagram.

Is there an easy way I can copy an existing shape on my page and drag it out to a new place?

Or a way to make consistently sized rectangles instead of drag and drop.


texts: helm-mini doesn't show .org files in recentf

texts:
helm-mini has suddenly (since 2 days) stopped showing all .org files under the recentf category. However, my recentf file correctly records all the .org files that I have opened. I do not have this problem with files with other extensions saved in recentf, and helm-mini shows them all under recentf. I am using the latest (non-stable) version of helm from MELPA.  I am flummoxed and will appreciate any help.

My recentf config:

(require 'recentf)
(recentf-mode 1)
(setq recentf-max-saved-items 100)

My helm config:

(require 'helm-config)
(helm-mode 1)
(helm-autoresize-mode t)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "M-y") 'helm-show-kill-ring)
(global-set-key (kbd "C-x b") 'helm-mini)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(global-set-key (kbd "C-c SPC") 'helm-all-mark-rings)


texts: Trying to refactor the code where I customize faces

texts:
I'm trying to switch to another Emacs theme, and I noticed I had several hard coded color strings which I used with my previous theme. I'm looking for a way to use :inherit and thus have those hard coded strings in one place.

(make-face 'me/header-face)
(set-face-attribute 'me/header-face nil
                    :background 'unspecified :foreground solarized/blue
                    :italic nil :underline nil :weight 'bold)

(set-face-attribute 'helm-source-header nil :inherit 'me/header-face)

But some additonnal style is being applied to 'helm-source-header.

It appears that the Solarized theme applies his own attributes. How do I tell I only want my own definitions ?


texts: Export org-mode subtrees at chapter level for LaTeX

texts:
I have a DATE_TREE logbook within an org-file that I would like to export to Latex, keeping the years at a level of a chapter:

* Logbook
:PROPERTIES:
:DATE_TREE:
:END:
** 2016
*** 2016-10 October     :ignore:
**** 2016-10-13 Thursday
***** Some logged thing

I have set up the ignore tab so that the desired LaTeX export would be

\chapter{2016}
\section{2016-10-13 Thursday}
\subsection{Some logged thing}

However, the default behavior of org-mode export is to have the first level of export be a section, so I get \section{2016}.

Is there a way to change this export behavior only for this Logbook tree, and not for the entire buffer?


texts: Deleting temporary files left over from inferior-python-mode

texts:
I am using emacs on a server so files in /tmp are not automatically cleared down.  Every time inferior-python-mode runs, it leaves files in /tmp (e.g. /tmp/py15458epk).

I'm looking for a more elegant way to delete these temporary files when they're no longer needed.  I assume these files are only needed by the shell to load and could, in theory, be deleted immediately afterwards but I don't know how to achieve this.  As a compromise, I delete all my /tmp/py* files when I kill emacs:

;; cleanup on aisle 6
(add-hook 'kill-emacs-hook
  (lambda ()
    (shell-command "find /tmp -maxdepth 1 -name 'py*' -type f
                   -user \"$LOGNAME\" -print0 | xargs -0r rm -f")))

This seems a bit drastic and could very well delete a temporary file that is still needed by something else.  How can I delete these files more precisely?

EDIT: Am using emacs 24.3, GNU tell me this is a known bug and does not exist after 25.1.  Is anyone able to suggest a more elegant workaround until we upgrade?


texts: Saving and restoring mutiple window layouts

texts:
I'm using the latest version of Emacs on Linux. I'm having trouble saving and restoring various window layouts and buffer states across multiple projects.  For example:

Project A: 3 window layout / 3 specific buffers
Project B: 4 window layout / 4 specific buffers
Project C: 2 window layout / 2 specific buffers

I've been using revive.el and I like that it saves and restores not only the window layout, but also the files I was working on in that project, including the last point I was at in those files. Unfortunately, revive only seems to recall just one window layout for one set of files (i.e., toggle on or off).

Looking for a complete solution, I found windows.el (seemingly bundled somehow with revive) but I'm not exactly clear what it does. It's not on melpa, looks rather dated, so I assume it's not even maintained. Then I found workgroups.el but it gives me all kinds of warnings after installing from melpa. I also tried workgroups2 but I have similar issues with warnings. Any suggestions?


texts: Idiomatic way to count org-mode subtrees?

texts:
Is there an idiomatic way to count org-mode subtrees?

I searched here on emacs.sx and other search engines, but I could not find an answer.

I know one could easily count subtrees with a regex, but I was wondering if the org API has means to fulfill more sophisticated counting needs, like,

How many second-level headlines under current tree?
How many third-level headlines in total in the current buffer?


texts: Tramp session fails to recover from inactivity

texts:
When a Tramp session over SSH has been inactive for some time, it fails to wake up again and just hangs Emacs. How can I ensure that Tramp will either renew the connection, or time out before too long?

The hang is evident from the minibuffer message:

  Decoding remote file ‘/ssh:foohost:/home/bignose/barfile.txt’ using ‘base64 -d -i >%s’

and an animated spinner, that spins endlessly for tens of minutes without result.

During this, Emacs is hung: it doesn't respond to any commands or keys, not even keyboard-quit (C-g).

This is Emacs version 25.2.

How can I convince Emacs that Tramp sessions should be re-established when they time out, instead of waiting forever?


texts:
In coq-mode for typeclasses in shifts the braces:
Class Group G : Type :=
  {
    e : G;
    mult : G -> G -> G;
    inv : G -> G;
  }.

Is it possible to disable the braces indentation and make it like this:
Class Group G : Type :=
{
    e : G;
    mult : G -> G -> G;
    inv : G -> G;
}.


texts: How to use counsel-git-grep for string search that has space?

texts:
I am using counsel-git-grep to grep for a string in the current Git repository.
Lets assume I am searching string " hello world ".
In order to obtain correct results I have to provide input as " hello  world " ; where   should be double space   . I haven't seen this behavior on the default usage of grep.
Is there any way achieve the grep results without using double space (  ) for single space ( ) ?

config file:
(setq counsel-git-grep-cmd-default "git --no-pager grep -F -n --no-color -I -e \"%s\"")


texts: Emacs c++ cannot use semantic and company-semantic to complete  library function

texts:
system: linux mint 18.1

Eamcs version: 25.2

semantic configuration：

(global-semanticdb-minor-mode 1)
(global-semantic-idle-scheduler-mode 1)
(semantic-mode 1)

create a cpp file and include vector,map std library:

But not work for string library:

checksemantic-dependency-system-include-path:("/usr/include" "/usr/lib/gcc/x86_64-linux-gnu/5/include/" "/usr/local/include/" "/usr/lib/gcc/x86_64-linux-gnu/5/include-fixed/" "/usr/include/x86_64-linux-gnu/" "/usr/include/" "/usr/include/c++/5/" "/usr/include/x86_64-linux-gnu/c++/5/" "/usr/include/c++/5/backward/")

I found a file named "string" in /usr/include/c++/5 and it only includes some head files.

Then I found a head file basic_string.h from /usr/include/c++/5/bits/ and it includes some functions for c++ string library. semantic-dependency-system-include-pathshows that /usr/include was already included. How can I figure out this problem? Thank you very much!


texts: How can I make abbreviations expand instantly?

texts:
Is there a way to make emacs expand abbreviations as soon as I finish typing them, rather than having to use a key combination, tab, or space?

For example, I want "`a" to expand to "\alpha". It would be nice if it could expand as soon as I type the "a".

I have tried abbrev-mode, but I can't figure out how to do expansions without typing a space (or other expansion character) after the abbreviation. The EmacsWiki explains how to prevent the expansion character from appearing after typing it, but that's not what I want. I also tried yasnippet, but it requires a trigger key, as far as I can tell from the documentation.

My specific motivation is to reproduce Vim-LaTeX-Suite macros, similar to this more general question asked here before.


texts: Org-mode headings in multiple places at once? (transclusion)

texts:
I'd like to organize my headings in multiple ways at once. (with the same degree of flexibility that I have when organizing things in any one place - e.g. more than the Agenda provides)

Ideally I'd be able to make a heading in part of a document, and then create a "hard link" to the heading somewhere else, which would update both as the content of heading changed.

Next best would be "soft links" which only store the heading content in one canonical location, and just show it in the other location (and if you edit it in either, it just updates in the canonical location).

Right now the best I know how to do is just create normal links, which I need to manually follow to see the content. Is there any way to do better than this?


texts: Persistent transient keymap for mouse scrolling

texts:
I'm trying to create a transient keymap that calls calls quick-peek-hide on any key except mouse scrolling, which should function normally.

I've got the following:

(let ((map (make-sparse-keymap)))
  (define-key map [mouse-4] #'mwheel-scroll)
  (define-key map [mouse-5] #'mwheel-scroll)
  (define-key map [t] #'quick-peek-hide)
  (set-transient-map map <keep-pred> <on-exit>))

And don't know what should be the values of <keep-pred> and <on-exit> should be.

If keep-pred is t, wouldn't the transient map remain active forever because we define the default key [t]? If on-exit is #'quick-peek-hide, scrolling would invoke quick-peek-hide instead of simply doing mwheel-scroll.

Update:

A few observations:

The default keybinding [t] does not keep the transient map active.

(let ((map (make-sparse-keymap)))
  (define-key map [t] (lambda ()
                        (interactive)
                        (message "default!")))
  (set-transient-map map t))

Activating the above transient map causes the next key to message default!, but exits the transient map thereafter.

Mouse events are preceded by down- mouse events, so it is not sufficient to bind [mouse-4], [mouse-5], etc.

For example, describe-key for a mouse scroll down gives:

  <mouse-5> (translated from <down-mouse-5> <mouse-5>) at that spot runs the command mwheel-scroll

So scrolling down with the following:

(let ((map (make-sparse-keymap)))
  (dolist (scroll-key (where-is-internal #'mwheel-scroll))
    (define-key map scroll-key (lambda ()
                                 (interactive)
                                 (message "scroll-key!"))))
  (define-key map [t] (lambda ()
                        (interactive)
                        (message "default!")))
  (set-transient-map map t))

Does not message scroll-key!, but default!.

Hacking the following together:

(let ((map (make-sparse-keymap)))
  (dolist (scroll-key (where-is-internal #'mwheel-scroll))
    (define-key map scroll-key (lambda ()
                                 (interactive)
                                 (message "scroll-key!"))))
  (define-key map [t] (lambda ()
                        (interactive)
                        (message "default!")))

  (define-key map (kbd "<down-mouse-5>") (lambda ()
                                           (interactive)
                                           (message "down-mouse-5!")))
  (set-transient-map map t))

The first scroll down message down-mouse-5! and scroll-key!, but the next one messages default and exits the transient map.

So the question is: what keys/events need to be bound to prevent scrolling from exiting the transient map?.


texts:
Is there a way to get completion-at-point to work inside edebug-eval-expression (i.e. similarly to the way it works in eval-expression)?  Presently, when I press tab inside of a call to edebug-eval-expression, there are no completion candidates despite tab being bound to completion-at-point.

This behavior occurs even in vanilla Emacs 25.3.1 without any configuration.  Does anyone know of a workaround?


texts: quickly switching to a buffer with a particular file name/mode

texts:
G'day!  it's my "learn some more Elisp" day.

I'm trying to make a shortcut that opens my main org file.
I've made it this far

(global-set-key (kbd "C-c h") 'switch-to-most-recent-org-file)

(defun switch-to-most-recent-org-file ()
  (interactive)
  (message "hi"))

Instead of (message "hi"),  I want emacs to switch to the .org file
in the Buffer List.  Sometimes there will be multiple .org files in
the Buffer List, in that case go for the one at the top.


texts: Is it possible to change to Emacs input mode with Doom Emacs?

texts:
It's default input mode is vim. Didn't find the toggle option like Spacemacs with M-m t E.

https://github.com/hlissner/doom-emacs


texts: How to know if emacs is running as a daemon?

texts: I want to know if emacs is running as a daemon, so I can load some parts of my configuration according, I want to know this from within emacs.


texts: Searching for multi-line text in many files

texts:
I have a phrase, e.g. This is an example phrase, and a collection of text files (coll.d/a.txt, coll.d/b.txt, etc.), and I'm looking for the former in the latter.

The thing is, maybe my pattern is splitted over several lines of text, so plain grep isn't so simple.
I like the way C-s deals with spaces, case, the kill-ring, and so on, and look for such behaviour.

So how can I search many files with it ?

Certainly an answer is burried somewhere in documentation or manuals but rgrep, find, replace, regexp, and occur somewhat complicate the search, without even mentionning all things dired.


texts: How to match the URL component from a markdown link?

texts:
I've been trying to hide the URL component of the markdown links in my buffer.

I could select the markdown links using

"\\(\\[.+\\]\\)\\((.+)\\)"

However, I just want to capture the second half (the URL component) of the links and fade them away in the buffer.

I have tried every possible documentation available but with no avail. Please help.


texts:
How can I make emacs execute a script every time when a latex-compilation (via auctex and latexmk) finished successfully? In particular I want to send a SIGHUP signal to mupdf to make it reload my pdf file.

I know that the sighup can be send when using latexmk from commandline with -pvc option and that in this case also a general post compile hook is supported (https://tex.stackexchange.com/questions/299822/post-compile-hook-latexmk), however latexmk -pvc doesn't integrate well in auctex (https://github.com/tom-tan/auctex-latexmk/pull/11), so I am looking for an emacs way for a post compile hook.


texts:
Q: can I set an org-mode link to visit a file in read-only mode?

I want to store a link to another file in an org-mode document,
but, when following the link, I want org to visit the file in
read-only mode so that I don't go on autopilot and accidentally
edit the linked file.

Is it possible to annotate the link so org knows to visit it in
read-only mode?  Hypothetically:

[[read-only-file:somefile.txt][A file that opens in read-only mode]]


texts:
I'm looking for a way to organize and share my LaTeX macros file. Ideally, I would like to write an org-mode file to export

as a documentation file in html or pdf for sharing
as a bare macros.tex containing only the macros

For instance, the org-file would look like

* Number sets

lorem ipsum

#+BEGIN_SRC latex
\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}
#+END_SRC

The output in LaTeX would contain only

\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}

The output in html would display

  Number sets

  Lorum ipsem

\def\R{{\mathbf R}}
\def\C{{\mathbf C}}
\def\N{{\mathbf N}}

Any idea ?


texts:
When I'm capturing an appointment tomorrow at ten, I have
to
write + 10:00.  That seems a bit excessive; is there no
better way?


texts: How can I get completion and tooltips based on company mode in Emacs Ipython Notebook?

texts:
I am using Emacs 24.5.1 and John Miller's fork of the Emacs IPython Notebook (EIN) client. The documentation indicates support for auto-completion based on auto-complete mode. As I am a company-mode user, I would like to use this mode for auto-completion, but I'm stuck on how to do this.

Within regular Python files I use the Python mode of python.el (sometimes with or without Elpy) and it works perfectly. When typing a dot, I get nice tooltips (and additional documentation strings) shown. In addition, I can get documentation on every Python function easily with C-c C-d.

Is there any way to get this working in EIN? Any help is appreciated!


texts:
Given the code:
def main(args=None):
    if args is None:
        args = sys.argv[1:]
    load_data()

Calling indent-region on the code (under python mode), the output would be:
def main(args=None):
    if args is None:
        args = sys.argv[1:]
        load_data()

load_data is unexpectedly indented.


texts:
I'm working with Emacs on several different projects with several different languages. I'm seeking for solution that could help manage project as workspace.

Meaning

Understand language in use and load appropriate modes (to reduce startup time, I'm trying not to load all at start)
Restore last buffers and their ordering (last workspace setup)
Restore default buffers and their ordering (default workspace setup)
Restore buffers and their ordering in pre-defined setup (special workspace setup, for debugging, for tracing)

Please suggest solutions or point to a way how can I achieve this


texts:
I'm on Debian Jessie 8.5,GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5), and I installed irony-mode as the author said here:

irony-mode author's repository

I mean, I typed M-x package-install RET irony RET. After that, I configured my ~/.emacs file like this:

(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)

;; replace the `completion-at-point' and `complete-symbol' bindings in
;; irony-mode's buffers by irony-mode's function
(defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))
(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)

After restarting Emacs, I opened a .cpp file, I typed M-x irony-install-server RET, and it compiled perfectly. Then, I typed irony-cdb-autosetup-compile-options, but irony doesn't work, when I try to call a function from a class included by its .h name, and I press TAB, nothing appears. And Irony mode is perfectly enabled.


texts: Use template in the middle of a sentence

texts: tempo-define-template allows defining a custom template, and one can use it with <key + TAB; however, this works only in the beginning of the line, it there a way to do that in middle of a sentence?


texts: Can the format of a timestamp in an org-mode document be locally adjusted for export?

texts:
I have an org document:

#+Title: Birthdays of The Beatles

John Lennon was born on <1940-10-09 Mon>.

Each member of the Beatles had a birthday.

| Beatle          | Birthday         |
|-----------------+------------------|
| John Lennon     | <1940-10-09 Mon> |
| Paul McCartney  | <1942-06-18 Thu> |
| George Harrison | <1943-02-25 Thu> |
| Ringo Starr     | <1940-07-07 Sun> |

which exports to ascii as

               __________________________

            BIRTHDAYS OF THE BEATLES

                   Me
               __________________________

John Lennon was born on <1940-10-09 Wed>.

Each member of the Beatles had a birthday.

 Beatle           Birthday
-----------------------------------
 John Lennon      <1940-10-09 Wed>
 Paul McCartney   <1942-06-18 Thu>
 George Harrison  <1943-02-25 Thu>
 Ringo Starr      <1940-07-07 Sun>

I want to alter the formats of the dates so that the dates in the body and the dates in the table are different:

               __________________________

            BIRTHDAYS OF THE BEATLES

                   Me
               __________________________

John Lennon was born on <Wed Oct-09 1940>.

Each member of the Beatles had a birthday.

 Beatle           Birthday
-----------------------------------
 John Lennon      <Oct-09>
 Paul McCartney   <Jun-18>
 George Harrison  <Feb-25>
 Ringo Starr      <Jul-07>

Is this possible?


texts: How can I make hl-line mode not override the color of rainbow-mode?

texts:
Is there an non-intrusive way to do this?

I've made a fork of rainbow-mode that uses overlay instead of text properties, which solves this :)

https://github.com/amosbird/rainbow-mode


texts: How to set English as the default input method?

texts:
For some reason I cannot set english, only british as the input method.
I am writing a function to switch language from spanish-postfix to english, but english is not working, only british.
I have tried (set-input-method nil) instead (set-input-method english) but it doesn't work. Only (set-input-method british) works but the # is replaced with £ and you have to press it two times to get #: that's not good at all.
Any advice how to be able to switch to default US keyboard?
Because nil is not working when jumping from spanish or other language to nil.


texts: Noweb references in sh blocks breaks the syntax highlighting

texts:
I use noweb references inside sh code blocks, for example:
#+begin_src sh
  echo "test"
  <<some-ref>>
  echo "test"
#+end_src

But this causes syntax highlighting to be broken because << gets interpreted as here document by the sh syntax highlighter and rest of the document (line 3 for the example above) becomes non-highlighted.
How can I fix this?


texts:
So I just switched from autocomplete to company-mode. I followed the steps outlined on http://company-mode.github.io

and added these lines to my .emacs

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

but even then I get no autocomplete suggestions when I type any sort of string.

To debug this I ran a vanilla emacs init file with essentially only company mode and nothing else:

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

After this I opened a simple test file to test company mode

monkey = 3
donkey= 4
elephant= 3

def fox():
    return

I tried typing the string "mon" in the editor waiting for some sort of autocomplete popup and nothing appeared. I even trying typing M-x company-complete

but it did nothing

Is there something really trivial I'm missing?


texts: Semantic Idle Service Error semantic-idle-summary-idle-function

texts:
Context
Hey, I've discovered semantic and how useful it is when writing coding, it provides some handy features. I'm mostly using it for C/C++ programming, although there's a bug that kept on showing, and it's bothering me a lot. I've debugged it for several days now, but as you may tell, still no use. Now the issue is with semantic-idle-summary-function.
Suppose I have the following
(setq semantic-idle-summary-function 'semantic-format-tag-summarize-with-file)
(setq semantic-idle-scheduler-queue
      '(semantic-idle-completions-idle-function
          semantic-idle-summary-idle-function
          semantic-idle-local-symbol-highlight-idle-function
          semantic-idle-breadcrumbs-idle-function))

I don't think I messed the configuration somehow, since I've tried resetting and trying different summary configurations, but as you can guess with no use.
Please feel free to correct me if I'm wrong in something about semantic or idle (I'm don't know much).
Issue
The issue is when I'm over some expression like
using func = std::function<bool(int)>;
      ^

This error showed up in *Messages* when loading the corresponding .[hc]pp files and keep on showing up in the minibuffer as long as I'm over the tag.
Idle Service Error semantic-idle-summary-idle-function: "#<buffer xargs.hpp> - Wrong type argument: listp, \"void\""

Now everything is working fine, until something breaks and semantics stop showing any idle summary until I restart Emacs again. Although the error just disappears when I'm on something else like a function prototype.
However, I figured out that the bug is triggered even comments, since if a symbol was in the comment it is summarized as if it was syntax. Does anybody know what the wrong or how to fix it? Thanks!!


texts: difference between properties and tags in the upper right corner

texts:
I dont get the difference between the actual property, enabling the respective funtionality and the tag on the right upper side?
*** Number 5                                         :B_example:
:PROPERTIES:
:BEAMER_env: example
:END:

5 can only be divided evenly by 1 or 5, so it is a prime number.

Can someone explain that to me?


texts: I use subword-mode when I'm editing Python and C++ code, and it's jarring when deleting a word backwards/forwards (Ctrl+Space and Ctrl+Delete) works one way in the source code buffer and a different way when I'm in the minibuffer. Is there a way to make it consistent? I've never tried having a minor mode active in a minibuffer before.


texts:
In org-mode I frequently want to move one (top-level) tree to another file. I can do this by first calling org-cut-special (C-c C-x C-w) in the source file, then switching to the target file and calling org-yank (C-y) there. But this is rather tedious.

Is there a simpler way to do it?


texts:
I have configured yasnippet and auto-complete bindings so it won't collide, auto complete uses <tab> and yasnippet uses <backtab>:

(add-to-list 'load-path
         "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(setq yas-snippet-dirs
      '("~/.emacs.d/snippets/snippets"
        "~/.emacs.d/snippets/yasmate/snippets"
        ))
(yas-global-mode 1)

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

I also added yasnippet source like this to the ac-sources as recommended in this question.

(defun add-yasnippet-ac-sources ()
  (add-to-list 'ac-sources 'ac-source-yasnippet))
(add-hook 'web-mode-hook 'add-yasnippet-ac-sources)

I created two yasnippets one with the key lorem_dummy and the other with the key lorem_image, one of the examples:

# -*- mode: snippet; require-final-newline: nil -*-
# name: lorem_image
# key: lorem_image
# binding: direct-keybinding
# --
<img src="http://lorempixel.com/${1:width}/${2:height}/${3:$$(yas-choose-value '("abstract" "city" "animals" "food" "people" "transport" "business" "sports" "technics"))}/${4:text}" alt="$3">

So, the problem is that with this init.el AC it simply doesn't works with yasnippet. The autocomplete won't popup with the snippets.
If you want to watch exactly what its going on you can watch this video:

video with update and comments


texts: Custom theme based on major mode or file type

texts:
How can I customize emacs to use a different theme based on major mode or file-type? And, could it work to have different themes active in different windows?

My use case would be: have (1) one general them for code and stuff and (2) one special theme (leuven) for org-mode only.


texts: Look up the key bound to a definition in a specific keymap, ignoring indirect bindings

texts:
How can I look up what key(s) are bound to a particular definition in a keymap? Basically the converse of lookup-key.
where-is-internal is almost the answer I'm looking for, but it doesn't seem to work in all cases.
(defvar my-map (make-sparse-keymap))
(define-key my-map [1] 'one)
(define-key my-map [2] [two])
(list (where-is-internal 'one my-map)
      (where-is-internal [two] my-map))

Expected result:
(([1]) ([2]))

Actual result (with Emacs 26.3):
(([1]) nil)

It seems that where-is-internal can't find a definition that is a vector. A list works, so it's not because the definition is compared with eq (and checking the source code, it does use Fequal). I guess that a vector is interpreted as an indirect binding of some kind, but passing non-nil values for the noindirect and no-remap parameters ((where-is-internal [two] my-map nil t t)) doesn't help.


texts: Address autocompletion doesn't work after compiling `elc` files for `mu4e`

texts:
After compiling elc files for mu4e in /usr/local/share/emacs/site-lisp/mu4e (Ubuntu 20.04) with
sudo emacs -Q -batch -L . -f batch-native-compile *.el

I get this error when writing an address of the To: field
Company: backend company-capf error "Symbol’s function definition is void: start" with args (prefix)

Prior to elc compiling mu4e everything worked alright. So I guess some bits of the config are out of sync now. Grateful for any tips.
(Note that in mu4e address auto-completion is enabled by default, i.e., mu4e-compose-complete-addresses is set to true)
I'm using mu4e 1.5.11 on Emacs 28.0.50 with native compilation.


texts: How can I dynamically set the column width that I'd like to font-lock?

texts:
My init currently has the following:

(defun font-lock-width-keyword (width)
  "Return a font-lock style keyword for a string beyond width WIDTH."
  `((,(format "^%s\\(.+\\)" (make-string width ?.))
     (1 font-lock-warning-face t))))

(font-lock-add-keywords 'c++-mode (font-lock-width-keyword 80))
(font-lock-add-keywords 'python-mode (font-lock-width-keyword 79))

Is there any way to change the line font-lock-add-keywords to be dynamically called with the python mode hook, but to try to locate the dominating .pylintrc file, check if it has a line with max-line-length=x, and set the width to x, with a fallback of 79? I'm unfamiliar with elisp config-parsing.


texts:
I am using Vincet Goulet's modified version of Emacs that use site-start.el.

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

I have read the description of its use but I don't understand exactly what conditions may affect choosing site-start.el over init.el. Can someone clarify a rule of thumb on this?


texts: dired alternative to openwith: how to open file per extension?

texts:
openwith seems to kill replying in mu4e.

Is there a similar/alternative solution for easy defining default apps per extensions in dired?


texts: decrease initial delay for line-up/line-down movement

texts: so every time I press C-n or C-p for moving the point up and down and keep pressing n or p I move several lines. However, after the first line move, there is a delay before the point is moving down in a faster pace. How can I decrease this so that the movement it more rapidly?


texts: How to get release note of updated package in Spacemacs

texts: In spacemacs, you can update all the installed package. However, is there a way to get a release notes for each package which have been updated ?


texts: Current directory of Emacs in batch mode

texts:
I run Emacs in batch mode to execute some scripting actions. I'd like to get paths of files relative to where Emacs got started in batch mode:

(file-relative-name (buffer-file-name) directory-where-emacs-was-started)

I do not know how to find out directory-where-emacs-was-started. default-directory does not work because it defaults to buffer file directory and (default-value 'default-directory) is nil.

How to find out what I'm looking for?

Edit: clarification, I need as elisp variable the value that pwd will print just before running Emacs in shell invocation like this:

pwd && emacs


texts: Debug why a function is removed from post-command-hook

texts:
I am trying to implement the auto-indentation snippet posted by @Malabarba in one of the emacs SE questions.

From that post, below is the function that I am trying to add to the post-command-hook:

(require 'cl-lib)
(defun endless/indent-defun ()
  "Indent current defun.
Do nothing if mark is active (to avoid deactivaing it), or if
buffer is not modified (to avoid creating accidental
modifications)."
  (interactive)
  (unless (or (region-active-p)
              buffer-read-only
              (null (buffer-modified-p)))
    (let ((l (save-excursion (beginning-of-defun 1) (point)))
          (r (save-excursion (end-of-defun 1) (point))))
      (cl-letf (((symbol-function 'message) #'ignore))
        (indent-region l r)))))

But emacs is removing it from that hook as it seems to be causing some error.

If I call the function using M-x, it runs fine and doesn't throw any error; it just doesn't run when executed via the post-command-hook.

Question: How can I find what's causing the removal of that function from the hook?

I am using the following code to add that function to the hook only for elisp mode:

(defun endless/activate-aggressive-indent ()
   "Locally add `endless/indent-defun' to `post-command-hook'."
   (add-hook 'post-command-hook
             #'endless/indent-defun nil 'local))

 (add-hook 'emacs-lisp-mode-hook
           #'endless/activate-aggressive-indent)


texts: When to call package-refresh-contents in init.el

texts:
I have found the following lisp code in an init.el file. I am wondering if this code logic is correct. I am learning Elisp and have reviewed the documentation and searched Stack Overflow. If this is too basic a question to ask, please direct me to a source:

(when (not package-archive-contents)
  (package-refresh-contents))

My understanding is that logic says that if there is no package-archive file, then refresh the cache .

Following are my questions:

Does Emacs download a cache for each of the sources in the package-archive list?
If package-refresh-contents is called only if the cache is absent, how do we (Emacs) keep the archive current? Do we have to manually use M-x package-refresh-contents?


texts:
I'm fill my org-mode file with Cyrillic tasks names, and when i try generate TaskJuggler export file i'm got error:

org-taskjuggler-compile: TaskJuggler failed with errors: Error: UTF-8 encoding
error in line 11:   task __________ "<?><?><?><?><?><?><?><?><?><?><?><?><?><?><?><?><?><?><?><?> <?><?><?><?><?><?><?>
<?> <?><?><?><?><?><?><?><?><?><?><?><?><?><?><?><?>" {

Not sure so its related with TaskJuggler but i'f found this line in source code on github.

And second, from command line exported file *.tjp to html report going fine.
Maybe i must something configure in the SpaceEmacs?


texts: How can I determine which function was called interactively in the stack?

texts:
Say I have two functions

(defun tmp:a ()
  (interactive)
  (tmp:b))

(defun tmp:b ()
  (message "called from %S" "?"))

If I call M-x tmp:a, how can I determine this from tmp:b?


texts:
Upon reading GNU Emacs Manual #rectangle register

  When you are collecting text using append-to-register and prepend-to-register, you may want to separate individual collected pieces using a separator. In that case, configure a register-separator and store the separator text in to that register. For example, to get double newlines as text separator during the collection process, you can use the following setting.

   (setq register-separator ?+)
   (set-register register-separator "\n\n")

I assumed that only the first line is enough as

(setq register-separator "\n]n")

What does ?+ mean? and the extra (set-register register-separator "\n\n")


texts: How to format (print) output of the shell-command function

texts:
I have this

(defun insert-dateutc ()
  (interactive)
  (shell-command "printf %s $(date +\"%Y-%m-%dT%H:%M:%S\")" t))

which I want to use in this

(defun foo1 ()
  (format "this is the date-time %s" (insert-dateutc)))

but the output is the elisp id number of the function call (yes?)

(foo1)
==> "this is the date-time 1185"
2015-11-18T20:31:30 ; <-- inserted

with the actual desired return left outside. I need to suppress that number and get the actual date-time output. Gosh, I know it's something simple...


texts: Org-mode: Can you set up context-dependent refile targets?

texts:
I'm new to org-mode (and emacs in general), and have been trying to follow the tutorials and manuals to set up a GTD-like system.

I currently have an "inbox.org" file with two first-level headings ("Inbox" and "Processing"). I also have a "todo.org" file with a "Projects" heading.

I've set up org-refile-targets so that any task in inbox.org can be refiled to todo.org. When I refile something, it shows me all the headings in all my org files to choose.

However, what I'd really like to do is have the refile targets change based on the heading or file I'm currently in.

So, for example, for tasks under the "Inbox" heading, the only refile target available should be "Processing".

For tasks under "Processing", the only refile targets available should be "Projects", "Someday" (goes to a someday.org file), or "Reference" (goes to a reference.org file).

This way, I can create sort of a directional "workflow" to enforce the GTD decision model. Is it possible to set this up with org-mode?