texts: w32-short-file-name: multi-OS user-configuration -- silence byte-compiler

texts:
I have a multi-OS user-configuration.  On OSX, when I byte-compile, the function w32-short-file-name is not defined (which is okay).  What is the proper way to silence the byte-compiler for this message which will not affect the ability to use this user-configuration on Windows?

In end of data:
lawlist-dired.el:13754:1:Warning: the following functions are not known to be defined:
  w32-using-nt (3046),
  w32-short-file-name (370674)

[I am assuming I can apply the same answer to w32-using-nt.]


texts: Regex to handle unicode strings in evil mode

texts:
I'm using evil mode on Emacs2 27.1 on OSX. My goal is to search and replace some text containing unicode strings using either of emacs' replace-regex or vim's search/replace functionality.
To begin with, let me showcase the example in vim without the use of unicode characters:
My text file has plenty of markers (let's say the unicode char । i.e U2404) and I need to wrap the marker along with its preceding word into \mbox{}
E.g input text
This is a string।
This is another (string) ।
One more example string here    ।

This regex does the job for me in vim: %s/\((\?\w*)\?\)\s*।/\\mbox{\1 ।}/g
Output
This is a \mbox{string ।}
This is another \mbox{(string) ।}
One more example string \mbox{here ।}

Now, onto solving the real problem with unicode chars. Sample text:
This is a नमस्ते।
This is another (नमस्ते) ।
One more example string नमस्ते    ।

The above vim regex does not work because \w does not match unicode chars. However, I can use \S, which denotes any non-space character, in the regex to apply the search/replace with pattern %s/\((\?\S*)\?\)\s*।/\\mbox{\1 ।}/gc
This regex does not work in emacs' evilmode. Is there such a thing as \S in emacs' regex repertoire? I glanced through emacs' regex syntax and couldn't find anything.
What's the regex to use to obtain the same results as with the vim command %s/\((\?\S*)\?\)\s*।/\\mbox{\1 ।}/gc?


texts:
Like most Emacs users I've customized a mode by changing the variables. What never occurred to me is the whole programming mentality behind having customizable this-and-that. I realized this when I started looking at some of the source code for eshell. I'm not an elisp programmer, but specifically em-ls.el seems to use defcustom, defgroup, etc. This would seem to be a shadow-world of globally-defined variables that the elisp code uses. So one question would be, Is the use of defcustom another way of doing (customizable) global variables?

Can anyone point me to lit on how to properly use (first understand) the whole idea behind defcustom, when to use, why, when not? Maybe a beginner example for a elisp beginner.


texts: Is there an idiomatic way of reading each line in a buffer to process it line by line?

texts:
In Python I'd do the following to process a file line by line:

with open(infile) as f:
    for line in f:
        process(line)

Trying to look up how to do the same in elisp (with buffers instead of files), I found no obvious way.

(What I want to end up with is two ordered datastructures of lines, one with all the lines matching a regex, the other containing those that did not match.)


texts: Helm find-file foreground face for interactive current directory in minibuffer

texts:
I'm using Spacemacs with

$ emacs --version
> GNU Emacs 24.5.1

On OSX 10.10.5

Using C-x C-f to find files shows a minibuffer like:

I have been able to get rid of the ugly green foreground color for highlighting the matching results by changing the face with:

M-x set-face-foreground

then searching for helm and selecting helm-match

But I can't seem to find the correct face to modify to change the current directory displayed at the top. In the image, it's the Find file: / bit I'm talking about.

Using 'C-c C-x =' when in the minibuffer in this mode only brings up a cursor position, but no information about the face.

So my questions are:

1) What is this particular face I need to modify?

2) More generally, how would I find out which face this is?


texts: How can I answer a minibuffer prompt from elisp?

texts:
I occasionally find myself using interactive functions inside of a function that I'm writing for my own use. If a function asks for some information (e.g. "Output file: ~/") is there a general elisp way to add text to the minibuffer and then press enter so that the user doesn't have to do so?

As an example, suppose that I want to run org-latex-export-to-pdf inside of a function but I don't want the user to have to specify a file name. Running (org-latex-export-to-pdf) will move the point to the minibuffer, but putting something like (insert "filename.tex") on the next line doesn't seem to work.


texts: Browse url at point when clicking and pressing super

texts:
I am trying to make emacs open the url displayed under the current point when I left click and press the super key at the same time.

I am trying with this code but it does not work

(global-set-key (kbd "<s-mouse-1>") #'(lambda ()
                                   (interactive)
                                   (browse-url)
                                   (kbd "<return>")))

The (kbd "<return>") part would be used to invoke to invoke a return in the mini-buffer: when browse-url is called the user must confirm to open the url by pressing return in the mini-buffer.


texts: How integrate quickjumps/bookmarks in Dired window?

texts:
Last time I saw a screenshot of Emacs-nav:

 /// My attention was directly shifted to the left corner in the bottom, called "Quickjumps". I assume this is sort of bookmark list.

When I open Dired, I often find myself switching between various directories, before I land on the directory that I want. So the idea of integrating frequently directories in your file explorer find I very neat.

When googling around, it seems there is no any option to integrate a sort of bookmark/quickjump in the Dired buffer? I'm open for any suggestion in this case.


texts:
I'm using define-error to throw custom errors.
But it looks like this function wasn't yet implemented in emacs-24.3, for instance.

It still seems to work for emacs-24.3 if I write this:

(when (version< emacs-version "24.4")
  (defun define-error (name message &optional parent)
    "Define NAME as a new error signal.
MESSAGE is a string that will be output to the echo area if such an error
is signaled without being caught by a `condition-case'.
PARENT is either a signal or a list of signals from which it inherits.
Defaults to `error'."
    (unless parent (setq parent 'error))
    (let ((conditions
           (if (consp parent)
               (apply #'nconc
                      (mapcar (lambda (parent)
                                (cons parent
                                      (or (get parent 'error-conditions)
                                          (error "Unknown signal `%s'" parent))))
                              parent))
             (cons parent (get parent 'error-conditions)))))
      (put name 'error-conditions
           (delete-dups (copy-sequence (cons name conditions))))
      (when message (put name 'error-message message)))))

Is this the proper way to get define-error in older Emacs? What was used before it was implemented?


texts: How to keep mode-line in title bar even in new poped up frames?

texts:
I am using the following code to keep the org-pomodoro clock in the title bar,
(setq frame-title-format '("" invocation-name "@" system-name " " org-pomodoro-mode-line))

It works most of the time but whenever I start using org-note or anything else which pops up a new frame, the title bar changes to a new name and the org-pomodoro clock disappears.
How can I keep the org-pomodoro clock all the time in my title bar even in new poped up frames?
I had a similar issue with scroll-bar. It was set to be zero (disabled) but whenever a new frame was opened the scroll-bar reappeard again. I solved that issue by the following code,
(defun my/disable-scroll-bars (frame)
(modify-frame-parameters frame
                       '((vertical-scroll-bars . nil)
                         (horizontal-scroll-bars . nil))))
(add-hook 'after-make-frame-functions 'my/disable-scroll-bars)

Hoenstly, I don't know how to use the second code to solve my intiail problem.


texts: Differences between setting major mode keys with a hook versus adding them to the mode map

texts:
Assume that I have downloaded a major mode called magical-mode, and it has its own magical keymap called magical-mode-map.  This mode also provides a hook magical-mode-hook which is run each time magical-mode becomes the major mode of a buffer.  Now I want to modify my init file to add a few custom key bindings to use in that mode.

It seems that there are (at least) two ways to set up custom key bindings for magical-mode.  The one that I see most commonly is this:

(defun my-magical-keys ()
  (local-set-key (kbd "C-i") 'previous-line)
  (local-set-key (kbd "C-k") 'next-line)
  (local-set-key (kbd "C-j") 'backward-char)
  (local-set-key (kbd "C-l") 'forward-char))
(add-hook 'magical-mode-hook 'my-magical-keys)

But it is also possible to do it this way:

(define-key magical-mode-map (kbd "C-i") 'previous-line)
(define-key magical-mode-map (kbd "C-k") 'next-line)
(define-key magical-mode-map (kbd "C-j") 'backward-char)
(define-key magical-mode-map (kbd "C-l") 'forward-char)

The second method actually seems cleaner to me.  Are there any advantages to doing it one way over the other?


texts:
I want to use org-wikinodes (http://orgmode.org/worg/org-contrib/org-wikinodes.html)
Org wikinode is activated :

(setq org-modules (quote (org-wikinodes)))

I can follow wikinodes links with C-c C-o.
However, the wikinodes links are not clickable. In addition, when I open an org file, I have the following message :

"Failed to add wikinodes to ‘org-font-lock-extra-keywords’."

I saw in the org-list that this problem was resolved before (https://lists.gnu.org/archive/html/emacs-orgmode/2015-06/msg00738.html)
Emacs version:

GNU Emacs 25.2.1 (x86_64-apple-darwin15.6.0, Carbon Version 157 AppKit 1404.47) of 2017-02-15
Org mode version 9.0.5 (9.0.5-elpaplus @ /Users/sam/.emacs.d/elpa/org-plus-contrib-20170210/)

Does anybody have the same issue?
Best,


texts: I want to have ido-ubiquitous available in every buffer at all times, but I can't find what I have to add to my .emacs to do it. Could someone please point me in the right direction?


texts: Open folder in emacs and type name to match file

texts:
I have this line in my init.el:
(global-set-key (kbd "C-c g") (lambda() (interactive) (find-file "~/Dropbox/myorgfiles")))

So when I type C-c g I get the directory contents of the myorgfiles folder.
But I would like to be able to start typing and get search results for that pattern within that myorgfiles folder.
How could I manage to do this? At the moment the individual keyboard strokes have different functions.


texts: Remove tabs from pasted text automatically?

texts: I have emacs configured to refrain from inserting tabs for indentation purposes already. But this does not have any effect when I paste text containing a tab (from an external application, Google Chrome). How can I ensure that tabs are always replaced with spaces in pasted text?


texts: pandoc-mode ignores the pdf-engine option

texts:
I'm using the pandoc-mode package for easy conversion between multiple formats.
I set the pdf-engine option in pandoc-mode to xelatex, but when I am trying to convert a markdown file to a PDF, pandoc-mode always uses the latex PDF engine, which, by default, does not include support for UTF-8 characters.
How can I make pandoc-mode use xelatex?
Information:

GNU Emacs 27.1 on macOS 11.2.3 arm64
latest pandoc-mode from MELPA
pandoc 2.12 from mactex


texts: What best tool to find files with content?

texts:
Windows 10, Emacs 26.1.

I need to find all files that content specific text ,e,g. ("hello").
I need to specify:

is case sensitive
is search also in all subfolders
to find by some text and by regexp
The result must show in separate buffer (e.g. Result)
does not depend on the external grep tool

I know about grep tool. But it not very comfortable.


texts: Spacemacs - start popup terminal window in evil-normal-state

texts:
I've added these keybinding configuration in my Spacemacs dot file, so that I can toggle the terminal by press the \ key.

;; Keybindings
(define-key evil-normal-state-map (kbd "\\") 'spacemacs/default-pop-shell)
(define-key evil-motion-state-map (kbd "\\") 'spacemacs/default-pop-shell)

By default, the terminal starts in evil-insert-state. However, I have to go to evil-normal-state to close the terminal window with  \, which means, when I open the terminal again, it would be in evil-normal-state.

This inconsistence makes me feel bad. How can I make the popup terminal start in evil-normal-state?


texts: Using evil and org-mode, as my file size grows, there is increasing delay in any command that changes text

texts:
There is only delay when changing text: navigation all works instantly, as normal.

The delay has gotten to about one full second now, it's getting pretty bad. The file is around 15,000 lines long, the delay appears to scale linearly with the size of the file (when I open a small file the delay disappears).

I'm using Termux, if that makes a difference.


texts:
After updating my Emacs packages, org capture templates fail with Capture template `a': outline-show-all, where a is the capture keystroke.

Backtrace:

Debugger entered--Lisp error: (error "Capture template `a': outline-show-all")
  signal(error ("Capture template `a': outline-show-all"))
  error("Capture template `%s': %s" "a" outline-show-all)
  byte-code("\301p!\203�\302\303\304 \"\203�\305p!\210\306\307\310!!\210\300\311\307\312!A@#\207" [error buffer-base-buffer string-match "\\`CAPTURE-" buffer-name kill-buffer set-window-configuration org-capture-get :return-to-wconf "Capture template `%s': %s" :key] 4)
  org-capture(nil)
  #<subr call-interactively>(org-capture nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> org-capture nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (org-capture nil nil))
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

I am also getting org-agenda-change-all-lines: Symbol's function definition is void: org-get-at-eol.

I have tried recompiling all packages with M-: (byte-recompile-directory package-user-dir nil 'force), but no improvement.

I am using Emacs 24.5.1 and Org version 8.2.10.


texts: Make a call to katex to render LaTeX from Org to HTML

texts:
This would allow the resulting HTML buffer to be viewed in eww, then allowing org-preview-html to work with LaTeX equations.

Any inline LaTeX equations in the Org document ($eq$ and etc) can be passed in the stdin of katex, and multiline/"display style" equations (\[ eq \] and etc) are passed to the stdin of katex -d.

Is there a way to override the LaTeX ⇒ HTML transformation that will let me do this?


texts: getting Jedi to work with type hinting (Python)

texts:
I am trying out the Python 3 type hinting with this example:

from typing import List

def greeting(names: List[str]) -> str:
        return 'Hello, {}'.format(', '.join(names))

greeting(['jane', 'john', 'judy'])

greeting([1,2,3])

What I should see is an error on the last method call, but no error on the first. However, on both I see the error deferred error : (error "\"TypeError('expected string or buffer',)\"")

Is there another package that can do type hinting/way I can fix Jedi here?


texts: Check whether a string is spelled correctly

texts:
I need to check whether a string is spelled correctly from my ELisp code. This is what I am trying:

(ispell-start-process)
(ispell-send-string "Check this")
(ispell-accept-output)

The last call freezes, although an ispell process seems to be running, since (ispell-process-status) returns 'run and Fly-Spell is working properly (though in a different buffer). All I need is a boolean result showing whether a given string is spelled correctly or not. How do I achieve this?


texts: tsun in inferior term prompts each character of input

texts:
I came across a problem when I run tsun in an inferior ansi-term (or term, eshell) buffer of emacs(24.4.1) in Debian 8.5. The tsun REPL echos every character while I input as shown in the following picture.

Meanwhile, the similar issues occur with comint-run, ts-node, etc.
How should I fix such a mess?


texts: centered cursor with evil-window-bottom and evil-window-top

texts:
I'm trying to achieve both:

persistent centered cursor (cursor stays in center of a window except when near the line 0 and count-lines-page
augment the way evil-window-bottom and evil-window-top work so that calling those functions scrolls to the corresponding position, then subsequently "re-centers" the cursor. This would be similar to a full page down, divided by 2

How can I do this?
I'm on Emacs version 26.3, and evil-mode version evil-git-af6ca28, although I don't think these matter much.
I found a centered cursor implementation which works well enough for me (with the exception that it entirely breaks evil-window-bottom and evil-window-top):
(setq scroll-preserve-screen-position t
      scroll-conservatively 0
      maximum-scroll-margin 0.5
      scroll-margin 99999)

evil-window-bottom (keybind L) and evil-window-top (keybind H) no longer work because they depend on scroll-margin. I'd like to create new functions (and bind them to the same keys, L and H) such that (move-to-window-line -1) (for window bottom) or (move-to-window-line 0) (for window top) moves to the cursor position (centered in the window).
I've tried modifying scroll-margin, but I don't think this can be done interactively, and doubt this is the best approach anyway. Next I'm literally looking at just overriding / replacing the definitions for the evil-window-bottom and evil-window-top functions. How should I do that? I could almost just override the functions, hardcoding scroll-margin with 0, but this wouldn't handle the cursor position (I think). What is the recommended approach?


texts: Defining key-bindings within `helm-map`: getting a `void-variable helm-map` error

texts:
Am going through this Helm tutorial at the moment; I pasted in the code verbatim (for now, I'll adapt it to suit my preferences later).

I did a quick google search for this particular error but it doesn't seem common.

For context, prior to adding the elisp code from the tutorial, I was indeed able to use the helm mini-buffer (i.e., helm is indeed installed correctly; i did it through MELPA).

Am including below the full error message that I see after running emacs --debug-init - please see top two lines.  (The initialization looks a bit funky in the lines further down because I have Emacs load from the init.el file in my Dropbox.)

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


texts: Eshell: run function when changing directory

texts: I'd like to run a function whenever the current directory in eshell changes (like a eshell-chdir-hook, but that doesn't exist). How can I do this?


texts: TeX input method is fine — except for underscore

texts:
Most(?) programming languages permit to use Unicode in comments, strings
and, partially, variable names. It is handy to be able to write comments
like

# DETERMINATION OF CONSTANTS OF INTEGRATION, substituting Λᵢ in M(L)=0

etc, and it's very handy (at least for me) to use TeX input method for that.

In the above example I had to type …\Lambda_i… and that's fine, but when I type regular program text, like n_intervals what I get is nᵢntervals...

It is perfectly possible for me to type n^Q_intervals and get n_intervals
(typing n_<space><backspace>intervals works too)
but I'd like to either

reverse the behaviour, i.e., typing \Lambda^Q_i to have Λᵢ and
n_intervals to get n_intervals or
typing n__intervals (have you seen _ and _?) to get n_intervals.

BTW I'm not restricting your answers to the alternatives above.


texts:
Been looking for a solution to this for a while now. On OS X minors mode fill the menu bar with useless menu items. Here's a screenshot:

If you can't tell, Emacs menu items are blocking the rest of my menu bar. Is there a way to tell Emacs to not use the menu bar?

I'm using this port of emacs.


texts:
When using an external monitor/projector with Emacs, I use the Extend option (rather than Duplicate). Then I duplicate my work frame with C-x 5 2, that is make-frame-command, and I move the duplicate frame to the projector screen.

I further use activate hl-line-mode and

(setq cursor-in-non-selected-windows 'bar)

With this setting what I write on my laptop frame is mirrored on the projector frame, provided the it is  set to the same buffer.

My problem is that I can't mirror the selection highlight, which unfortunately is shown only in the frame where I am actually writing/selecting.

Any possibility to do this?


texts: Detect interactive use of `kill-buffer` in `kill-buffer-hook`

texts:
As per title, I want to define a kill buffer hook with the variable kill-buffer-hook and the function should be able to detect when (kill-buffer ) has been called interactively.

Is this possible?

The use case is in that I'd like to control the buffer displayed after killings.
Anyway, there are a lot of hidden buffers opened and killed in the background, which should not trigger the hook actions.


texts: Skim: search backward generates shell buffer in Emacs

texts:
I have configured forward and backward search between Emacs and Skim (MacOS) for my LaTeX work. While the search works fine, every time I do an backward search from Skim, an additional shell buffer opens in Emacs besides my .tex file. This is somewhat annoying and I would like to avoid it if possible. My backward search configuration as suggested on the Skim website is as follows:

;; Auto-raise Emacs on activation
(defun raise-emacs-on-aqua()
(shell-command "osascript -e 'tell application \"Emacs\" to activate' &"))
(add-hook 'server-switch-hook 'raise-emacs-on-aqua)

How can I avoid the shell buffer from opening when I do backward search from Skim?


texts: Is there a generic toggle-previous-window function?

texts: Some major modes have code and key-bindings to toggle focus back and forth between their inferior processes and the major-mode buffer. Is there an Emacs function which lets me do this between the current and previous window such that calling the function repeatedly would only switch back between the last two used windows?


texts: How can I tail/stream output when evaluating org babel shell blocks?

texts:
I learnt about asynchronous execution of org babel shell code blocks,
thanks to:

How is #+BEGIN_SRC sh :results drawer different to #+BEGIN_SRC sh

I want to know if it's possible to tail/stream the output.


texts: Can the ring data structure really be rotated?

texts:
According to the doc page describing Emacs Lisp's ring data structure, rings "support [...] rotation".  However, the word "rotate" appears nowhere else on the page, and none of the documented interface functions appear to perform it.
When I visit ring.el I find this in the header comments: You can insert to, remove from, and rotate a ring.  But again, the word "rotate" appears nowhere else in the file, and none of the functions defined there (some of which are not mentioned on the web page above) do rotation, as far as I can tell.
Am I missing something, or is the documentation wrong?
Obviously a one-place rotation in one particular direction is possible by doing (ring-insert ring (ring-remove ring)), and probably quite efficiently at that, but it seems like a far cry from "supporting" rotation.


texts: Are there any libraries in Emacs or the wider package system for automatically persisting variables

texts:
I have a number of variables that store useful state that would be nice to persist across restarts of Emacs. Are there any libraries that allow this to be done simply so I can avoid a bunch of boilerplate for each variable?

I've considered the customise framework but that implies putting everything in one file and it would be nice to specify a specific state file for a given set of variables so they can easily be blown away when required.


texts: Display projectile root in spaceline mode line

texts:
I use spaceline configured in the following way;

(use-package spaceline
  :ensure t)

(use-package spaceline-config
  :ensure spaceline
  :config
  (spaceline-helm-mode 1)
  (spaceline-emacs-theme))

According to the Spaceline documentation the projectile-root segment is defined but not used in the default themes. I tried to enable this with

M-x spaceline-toggle-projectile-root-on

but this has no effect. Is it possible to enable this in the default themes or do I have to build my own mode line?


texts: How to stop Emacs from highlighting Linux Tab characters?

texts:
So I opened a c++ script made in Xubuntu and every tab character was highlighted with grey.
That doesn't happen when I open scripts made on Windows. How do I stop Emacs from highlighting them, it's very distracting?
Here is a picture of what it looks like:


texts:
I am trying to use sudo emacs with no luck so far. When I run with --debug-init I get the following.

Debugger entered--Lisp error: (file-error "Cannot open load file" "no such file or directory "web-mode")

Why would it be different when I am using sudo emacs? Regular emacs runs fine.


texts: I want to have the  tags for my blog written in org-mode

texts:
I write and publish my blog with org-mode and org-page. The thing is that I want to write about Emacs and, I would like to have the keystrokes highlighted as Stack Exchange does with the <kbd> tag. Getting this: C-x C-f instead of something else!

In which way or how could I achieve this?


texts: How to 'modify-syntax-entry' for a major mode?

texts:
Following this answer, when I type (modify-syntax-entry ?_ "w")
and do M-x eval-region, it has the effect I'm looking for, albeit only for that buffer. I've put (modify-syntax-entry ?_ "w") in my .emacs file, however and after restarting, it's not having effect in my C/C++ code.

I'm using Emacs GNU Emacs 26.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.13) of 2019-12-11.  My OS is: Fedora release 31 (Thirty One).

There are questions with nearly the exact same title, but their accepted answers do not work for C/C++ mode, so this is a different question.


texts:
Can Emacs be used to browse a cpio archive?

I've tried to open a cpio file in Emacs in Ubuntu 15.04 (Vivid), but it simply shows me its content as is, not allowing to browse it as a directory of files.

(Actually, I wanted to browse the initrd.img, which is a compressed cpio archive.)


texts:
I just recently found the "rainbow-delimiters-mode" package and found it quite useful, however I seem to have run into a snag with it when using it in C-like languages:

Naturally, I'd prefer to enable it for all programming modes, so I added the following to my config:

(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)

This apparently worked fine for everything but C-like languages.

I guess cc-mode is derived from prog-mode, hence prog-mode-hook is run before cc-mode, overriding some settings. The cc-mode settings I want are basically the ones in this snippet:

(defun my-cc-mode-common-hook ()
  "Setup common utilities for all C-like modes."
  (setq-local c-doc-comment-style
        '((java-mode . javadoc)
            (pike-mode . autodoc)
            (c-mode    . javadoc)
            (c++-mode  . javadoc)))
  (face-remap-add-relative 'font-lock-doc-face
           :foreground (face-foreground font-lock-comment-face)))
(add-hook 'c-mode-common-hook 'my-cc-mode-common-hook)

However, with the rainbow-delimiters-mode in prog-mode-hook, the above snippet breaks. I thought I could fix this by temporarily disabling the mode at the beginning of the hook and then re-enable it again at the end:

(defun my-cc-mode-common-hook ()
  (rainbow-delimiters-mode 0)
   ;; ...
  (rainbow-delimiter-mode))

This doesn't work at all however, so I guess I have to do something else to enable the configuration in cc-mode to fix this issue. Anyone have any ideas?

Also, simply disabling rainbow-delimiters-mode doesn't re-enable the cc-mode settings I listed above, that is:

(defun my-cc-mode-common-hook ()
  (rainbow-delimiters-mode 0)
   ;; ...
  )

Doesn't work, at least not on it's own.

I should note that it is possible to fix this by not having rainbow-delimiters-mode in the prog-mode-hook and instead place it in c-mode-common-hook or any other major-mode hook. It does however seem like a hassle to add it to every new programming mode instead of fixing it where it breaks.


texts: What is the proper way to pass variable strings to `shell-command-to-string`?

texts:
I have a shell script

$ cat ~/foo.sh

#!/bin/bash

echo $1 $2

I'm trying to call this from emacs. My elisp function is

(defun foo (word1 word2)
  "Print these two words."
  (interactive
   (list
    (read-string "Enter first word: ")
    (read-string "Enter second word: ")))
  (shell-command-to-string "bash ~/foo.sh %s %s" word1 word2))

This, however, yields an error. What am I doing wrong?


texts:
I need to display word-diffs of a number of small strings.

That is, I have a list of pairs similar to the following:

"aaa bbb ccc" . "aaa vv ccc"
"abcd ef ghkl" . "ghkl"
"a (u -> h)" . "(a -> g) (u -> h)"

In each case I'd like to highlight changed or added text. I can do this with many calls to the diff command, but I'm afraid of the cost.

Are there elisp libraries that I could use for this purpose?


texts: Automatic detection of master files not working in AUCTeX

texts:
I have the following two questions:

1) Is it still recommended these days to use the guess-TeX-master snippet from AUCTeX wiki?

2) If yes, could someone provide some hints on why it doesn't work in the following config of mine?

(use-package tex
  :ensure auctex
  :defer t
  :mode ("\\.tex\\'" . latex-mode)
  :init
  (declare-function my-guess-TeX-master "init.el")
  (declare-function my-latex-mode-hook "init.el")
  :custom
  (TeX-auto-save t)
  (TeX-parse-self t)
  (reftex-plug-into-AUCTeX t)
  (latex-run-command "pdflatex")
  (TeX-source-correlate-method 'synctex)
  :config
  (setq TeX-outline-extra '(("[ \t]*\\\\\\(bib\\)?item\\b" 7)
                            ("\\\\bibliography\\b" 2))) ; adding own headings to outline minor mode
  (defun my-guess-TeX-master (filename)
    "Guess the master file for FILENAME from currently open .tex files."
    (let ((candidate nil)
          (filename (file-name-nondirectory filename)))
      (save-excursion
        (dolist (buffer (buffer-list))
          (with-current-buffer buffer
            (let ((name (buffer-name))
                  (file buffer-file-name))
              (if (and file (string-match "\\.tex$" file))
                  (progn
                    (goto-char (point-min))
                    (if (re-search-forward (concat "\\\\input{" filename "}") nil t)
                        (setq candidate file))
                    (if (re-search-forward (concat "\\\\include{" (file-name-sans-extension filename) "}") nil t)
                        (setq candidate file))))))))
      (if candidate
          (message "TeX master document: %s" (file-name-nondirectory candidate)))
      candidate))
  (defun my-latex-mode-hook ()
    (turn-on-auto-fill)
    (abbrev-mode)
    (LaTeX-math-mode)
    (outline-minor-mode)
    (setq TeX-master (my-guess-TeX-master (buffer-file-name))))

  (add-hook 'LaTeX-mode-hook #'my-latex-mode-hook)
  (add-hook 'LaTeX-mode-hook #'reftex-mode)
  (add-hook 'LaTeX-mode-hook #'turn-on-reftex))

For instance, I have a file named main.tex and has local variables indicating it's the master file, then I create a new file dummy.tex and upon creation I'm prompted to indicate which is the master file. It seems that guess-TeX-master is either not working or not guessing properly the master file.


texts: Modify org-mode's definition of comment lines?

texts:
Q: how do I change org-mode's definition of a commented line?

According to the manual, org-mode comments work as follows:

  Lines starting with zero or more whitespace characters followed by one '#' and a whitespace are treated as comments and will never be exported. Also entire subtrees starting with the word ‘COMMENT’ will never be exported. Finally, regions surrounded by '#+BEGIN_COMMENT' ... '#+END_COMMENT' will not be exported.

I'd like to adjust the single-# notation to allow multiple #s so that Emacs will correctly fontify such lines as comments:

I'm doing this because I have timestamp blocks at the top of the file that start with multiple comment characters:

However, I can't figure out which variables I need to adjust.  I've tried modifying comment-start, comment-start-skip, and even comment-padding, but with no luck (org-comment-string appears not to be relevant here).

So: how can I get org-mode to treat lines starting with multiple #s as comments?


texts:
I would like to see the content of the untracked files, so I could see what's there and possibly stage only some lines.
I have status.showUntrackedFiles = all, so in magit I can see the files inside a folder that is untracked, but I cant show the content using TAB like I can with tracked files.


texts: Downgrade emacs from 25.0.50 into 24.5.1 introduce error on startup

texts:
The error is as follows

Warning (emacs): Unable to activate package `flycheck'.
Required package `seq-1.11' is unavailable
Warning (emacs): Unable to activate package `beacon'.
Required package `seq-1.11' is unavailable
Warning (emacs): Unable to activate package `flycheck'.
Required package `seq-1.11' is unavailable
Warning (emacs): Unable to activate package `beacon'.
Required package `seq-1.11' is unavailable

Is that the only way to deal with it is to recompile the .emacs.d file?
If yes, how can I do that. Thank you


texts: Exiting emacs without confirmation to kill running processes

texts:
It turned out not to be the same problem as Kill process buffer without confirmation?: emacs asks for different kind of confirmations when exiting and when just killing a buffer.

How to specify for all or specific processes (e.g. one launched with run-scheme) to be killed without confirmation on exiting emacs?


texts: Keep helm from picking up symbol at point

texts:
helm seems to implicitly insert the current symbol at point as an initial query.

(For reference, this is helm-omni from here)

Note how the minibuffer is empty, yet helm is already searching for idle-require.

This has some performance implications that I'd like to avoid. Is there any way I can turn this behavior off?

(Probably will require advice, as Helm's author says he doesn't want to add an option to turn it off).

There has been a lot of interest in this (but nothing's come of it yet):

helm #648
helm #658
helm #876


texts: emacs (v24.3.1): command line '--' before the file name

texts:
I have a RHEL 7 box, and I've installed emacs onto it (v24.3.1). This version of Emacs seems to be broken. You used to be able to edit by entering a command like this:

emacs -- somefilename.txt

and the Emacs editor would open up with somefilename.txt ready for editing. Now it's just showing the *GNU Emacs* screen and then open the file within Emacs for editing.

Normally, I don't use -- (dash dash) before the filename, but unfortunately when using visudo, it execs the command emacs -- /etc/sudoers.tmp leads to the problem mentioned above. Does anyone know how to fix this?


texts:
When in org-mode, running the export command will open a windows with all the export options. However, my mouse scroll behaves erratically and I am not able to scroll down or move at all, not even by clicking on the scroll bars. (The problem is recurrent in both Linux and OS X, using org-mode version 8.2.10-30-gca21b7-elp, and GNU Emacs 24.4.1.)

See screen capture here:

How can I fix this problem?


texts: jit-lock message "it does not work in indirect buffer" does not allow me to use org-goto function

texts:
I am having some trouble with that jit-lock message: it does not work in indirect buffer.

I think it is not related with my config files in .emacs because I tried the function without loading my .emacs and the issue persists.

So, I need a direction about what to do and what information should I provide you in order for helping me to fix that issue that's stopping me from using the org-goto function.

Please, note I understand very little about lisp-emacs, I usually grab some snippets from internet. That's why I am not very sure about what information should I provide.


texts: Swap Shift/non-shift key behavior for particular mode

texts:
I want to press - on my keyboard and have _ be inserted and vice-versa only for a particular mode.
The following does this globally using the post-self-insert-hook,  It checks the character just inserted and makes a replacement accordingly:
(defun my-swap-dash ()
  "Make dash insert and underscore and vice-versa."
  (interactive)
  (let ((just-inserted (char-before (point))))
    (cond
     ((equal just-inserted 45) ;; '-'
      (progn
    (delete-backward-char 1)
    (insert "_")))
     ((equal just-inserted 95) ;; '_'
      (progn
    (delete-backward-char 1)
    (insert "-"))))))

(add-hook 'post-self-insert-hook #'my-swap-dash)

How could I get this same behavior for only python-mode?
My first thought is to define a minor mode and then enable it through the python-mode-hook.  However, using the post-self-insert-hook means the replacement must happen globally.
As a work-around, I created a method of toggling the behavior manually:
(defvar swap-dash-state-p nil
  "Is swap-undash enabled?")

(defun toggle-swap-dash ()
  "Toggle `my-swap-dash'."
  (interactive)
  (if swap-dash-state-p
      (progn
        (remove-hook 'post-self-insert-hook #'my-swap-dash)
        (setq swap-dash-state-p nil))
    (progn
      (add-hook 'post-self-insert-hook #'my-swap-dash)
      (setq swap-dash-state-p t))))

Thoughts and coding style comments welcome!


texts: Tab or auto completion of command while editing a .tex file

texts:
Seeing if there is a way for auto or tab complete specifically while editing a .tex file.  For example

\text....   (tab or autocomplete) in some editors will allow you to quickly choose from '\textbf' '\textit' '\textregistered' etc.

Or similarly '\begin{'

I have tried using 'M-TAB' but this does not seem to be working for me.

Any ideas? Thanks


texts: org-habit - Can I arrange for a habit to take place n times during a week, but on indeterminate days?

texts: In some habit-tracking apps nowadays, the user can set for the activity to take place on indeterminate days, as long as it's done n times a week in total. So for example if I want to go to the gym 4 times a week, I wouldn't care if I went there on certain specific days during the week. Is there a similar functionality in org mode/org-habit? It seems that "+1d/2d" style of scheduling is really the closest thing I can get, but that doesn't exactly achieve the same thing as described above.


texts: how to have EMACS use the right alt key the same as the left alt key

texts:
I regularly use the  backspace key to delete whole words at a time to the left of the cursor, but this would be a MUCH easier keystroke if it could be done one-handed. For that to happen - I would need to use the right  key.  But when I do this from EMACS' response it is clearly interpreting this key as being different form the left  key.

In this answer the poster identifies a method to achieve this outcome of changing the keymap:
https://stackoverflow.com/questions/10257352/right-alt-key-not-working-as-meta-key-in-emacs

I would like to do this by "tweaking" emacs rather than change my keymap in the OS.

Does anybody know how to tell emacs that right alt is the same as left alt?

I am using Windows 10 as my OS

I am accessing EMACS through PUTTY: Release 0.70

onto a Red Hat Enterprise Linux Workstation release 7.6 (Maipo)

EMACS Version: GNU Emacs 24.3.1

This is on my Universities linux Lab - so I am not likely to have a lot of ability to edit config files for EMACS either...


texts:
So in ediff I can press m to widen the frame but if I quit before pressing it again to restore to the original size, then the frame stays that size. I'd like to automate this so that if I forgot to press m before quitting ediff, it will "press" m for me.

I found some elisp that claims to do this:

(add-hook 'ediff-cleanup-hook
  (lambda () (if ediff-wide-display-p 'ediff-toggle-wide-display)))

However, it doesn't seem to be having any effect. Can this be done after all?


texts: How do I enable indentation in an inferior scheme?

texts:
There doesn't seem to be any indentation in the default inferior scheme. At least, when I do M-x run-scheme the resulting repl doesn't indent my code at all.

How can I change this? Preferably without anything like geiser or other wrappers.


texts: Weird message when trying to upgrade all packages

texts:
From a previous question of mine, I've included the following function in my .emacs to quickly update all installed packages:

(defun endless/upgrade ()
  "Upgrade all packages, no questions asked."
  (interactive)
  (save-window-excursion
    (list-packages)
    (package-menu-mark-upgrades)
    (package-menu-execute 'no-query)))

I recently installed openSUSE (came from Windows), and running that command does not currently work. I'm getting an error message in the minibuffer area (I think) that looks more or less like this:

progn: Wrong number of arguments: #[nil "ÆÇ!
ÈÉ!ÊebmUÊfË=OÊÌ*`Í\"²   Î=DÏ@!ÐA!B
BO  Ñ=O@BÊy)}ÒGÓUjÔÕ@\"tÔÖG×ÏØ##!}ÙÚ\"
ÙÒ
GÓUÔÛ
@@)
@A#¢ÔÜ
G×Ý
Ø##!Õ
Ê(Ñ(@Þ)*Â) Çßàá)(A(¯*ÙÈâ!
ääã
ìóäå\"öæç!," [id cmd delete-list install-list x elt derived-mode-p package-menu-mode error "The current buffer is not in Package Menu mode" ...] 9 ("/usr/share/emacs/24.3/lisp/emacs-lisp/package.elc" . 51221) nil], 1

With debug-on-error toggled on, I get the following after the error message:

package-menu-execute(no-query)
(progn (list-packages) (package-menu-mark-upgrades) (package-menu-execute (quote no-query)))
(unwind-protect (progn (list-packages) (package-menu-mark-upgrades) (package-menu-execute (quote no-query))) (set-window-configuration wconfig))
(let ((wconfig (current-window-configuration))) (unwind-protect (progn (list-packages) (package-menu-mark-upgrades) (package-menu-execute (quote no-query))) (set-window-configuration wconfig)))
endless/upgrade()
call-interactively(endless/upgrade record nil)
command-execute(endless/upgrade record)
helm-M-x(nil "endless/upgrade")
call-interactively(helm-M-x nil nil)

After re-loading package.el I get a different error message:

1 package can be upgraded; type `U' to mark it for upgrading.
1 package marked for upgrading.
progn: Wrong number of arguments: (lambda nil "Perform marked Package Menu actions.
Packages marked for installation are downloaded and installed;
packages marked for deletion are removed." (interactive) (if (derived-mode-p (quote package-menu-mode)) nil (error "The current buffer is not in Package Menu mode")) (let (install-list delete-list cmd id) (save-excursion (goto-char (point-min)) (while (not (eobp)) (setq cmd (char-after)) (if (eq cmd 32) nil (setq id (tabulated-list-get-id)) (cond ((eq cmd 68) (setq delete-list (cons (cons ... ...) delete-list))) ((eq cmd 73) (setq install-list (cons (car id) install-list))))) (forward-line))) (if install-list (progn (if (yes-or-no-p (if (= (length install-list) 1) (format "Install package `%s'? " (car install-list)) (format "Install these %d packages (%s)? " (length install-list) (mapconcat (quote symbol-name) install-list ", ")))) (mapc (quote package-install) install-list)))) (if delete-list (progn (if (yes-or-no-p (if (= (length delete-list) 1) (format "Delete package `%s-%s'? " (caar delete-list) (cdr (car delete-list))) (format "Delete these %d packages (%s)? " (length delete-list) (mapconcat (function ...) delete-list ", ")))) (progn (let ((--dolist-tail-- delete-list) elt) (while --dolist-tail-- (setq elt (car --dolist-tail--)) (let (...) (if debug-on-error ... ...)) (setq --dolist-tail-- (cdr --dolist-tail--))))) (error "Aborted")))) (and delete-list (null install-list) (package-initialize)) (if (or delete-list install-list) (package-menu--generate t t) (message "No operations specified.")))), 1

Did I miss installing something I need? I can still update packages manually with list-packages etc.


texts: Syntax highlighting for shell code blocks when exporting org-mode files to Latex using listings

texts:
I'm using the LaTeX package listings for exporting code blocks in org-mode to latex files.
I've defined a latex template with the =org-latex-classes= feature as described in https://so.nwalsh.com/2020/01/05-latex .
This works well for python code blocks, i.e.
#+begin_src python
import pandas as pd
#+end_src

However, org-mode uses the "shell" keyword to define "sh/bash" code block. The "shell" keyword is not defined for the LaTeX listings package (but "sh" and "bash" is). Thus, exporting org-mode "shell" code blocks does not work, i.e:
#+begin_src shell
conda install pandas -y
#+end_src

does not work.
Is there a workaround to either make listings accept the "shell" keyword, or org-mode to accept "sh"/"bash" as keywords?


texts: Start Emacs with gdb with a different main source file

texts:
I often run Gdb in a dedicated Emacs session. I have code to run gdb when Emacs start and set up Many-Windows mode.
For one particular project, there are many programs, all written in C, that share a main() function but where the interesting part is in a separate source file whose base name is the same as the executable: hello is built from hello.c and main.c, foo is built from foo.c and main.c, etc. Gdb sees the main() function in main.c and therefore opens main.c initially, which makes perfect sense. But for this project, main.c is mostly irrelevant and I want to start with the program-specific source file open, e.g. hello.c.
I want to either instruct Gdb to consider a different file to be the “main” source, or instruct Emacs to display a different source file initially.
I wrote the code below to instruct Emacs to display a different source file. It doesn't work, and I don't understand why.
;; Specific code for my project, where the main() function is in a boring
;; file that is shared between many executables and the interesting source
;; file is the one based on the executable name.
;; The code here is simplified from my real code and only works if all the
;; files are in the current directory.
(defvar actual-source-file (concat default-directory "/"
                                   (car command-line-args-left) ".c"))
(defun visit-actual-source ()
  (interactive)
  (gdb-display-source-buffer (find-file-noselect actual-source-file)))
(add-hook 'window-setup-hook 'visit-actual-source)

;; Don't ask for confirmation on exit even if a process is running.
;; This doesn't have any impact on the question, but makes testing easier.
(defun clear-buffer-process-query-on-exit-flag ()
  (let ((proc (get-buffer-process (current-buffer))))
    (if proc
        (set-process-query-on-exit-flag proc nil))))
(defun clear-gdb-inferior-process-query-on-exit-flag ()
  (if (equal (process-name (get-buffer-process (current-buffer))) "gdb-inferior")
      (clear-buffer-process-query-on-exit-flag)))
(add-hook 'comint-exec-hook 'clear-gdb-inferior-process-query-on-exit-flag)
(defadvice gud-common-init
    (after gud-common-init-set-process-query-on-exit-flag activate)
  "Don't ask for confirmation if exiting Emacs during the debug session."
  (clear-buffer-process-query-on-exit-flag))

;; Run gdb.
(let ((command-string (combine-and-quote-strings command-line-args-left)))
  (set-frame-name (concat "gdb: " command-string))
  (gdb (concat "gdb -i=mi --args " command-string)))
(setq command-line-args-left nil)

;; Set up a nice window configuration.
(gdb-many-windows)

Set up a test environment:
cat <<'EOF' >main.c
void do_stuff(void);
int main() {
    do_stuff();
    return 0;
}
EOF
cat <<'EOF' >hello.c
#include <stdio.h>
void do_stuff(void) {
    puts("Hello world");
}
EOF
cc -g -o hello hello.c main.c

Then run Emacs with the Lisp code above in gdb-alternate-source.el.
emacs -q -l gdb-alternate-source.el hello

Desired effect: display the 6 windows of Gdb Many-Windows mode, with hello.c in the middle left window.
Actual effect: display the 6 windows of Gdb Many-Windows mode, with main.c in the middle left window. hello.c is open but not displayed.
If I run M-x visit-actual-source after Emacs starts, it has the desired effect: hello.c becomes displayed instead of main.c.
If I add (recursive-edit) after (gdb-many-windows) or before the call to gdb-display-source-buffer in visit-actual-source, then after I exit the recursive edit, hello.c replaces main.c in the middle left window and *GNU Emacs* (“Welcome to GNU Emacs …”) replaces *gud-hello* in the top left window. On the other hand, adding (force-window-update) or (redisplay) doesn't make any difference.
I guess I need to add some code to update something related to the window configuration, but what? How do I get the desired file displayed automatically when Emacs starts?


texts: How do I make emacs find `ac-source-pycomplete`?

texts:
I followed Jessica Hamrick's emacs setup before adding evil. This means that there is a lot of specific configuration issues in my ~/.emacs.d/ which I don't necessarily understand, shame on me, but specifically I have checked that both python-mode and auto-complete were installed using el-get, and yet the python-mode-hook complains that it does not know about ac-source-pycomplete:

auto-complete error: (void-variable ac-source-pycomplete)

The symbol is explicitly added (with other symbols) to ac-sources as part of 'python-mode-hook, because pycomplete thinks it's clever enough for all auto-completion tasks and removes all other sources from the ac-sources.

(add-hook 'python-mode-hook
      (lambda ()
         (setq ac-sources '(ac-source-pycomplete
                            ac-source-yasnippet
                            ac-source-abbrev
                            ac-source-dictionary
                            ac-source-words-in-same-mode-buffers))))

How do I get Emacs to know pycomplete in a clean-ish way?


texts:
Windows 10 (64 bit), Emacs 25.1.

I try to open in Emacs some web page. E.g. www.google.com.

So M-x eww

Enter URL: www.google.com

But I get error: libxml2 library not found


texts: How to strip decorations (text properties) from a string?

texts:
By a "decorated string" I mean something like

#("foo" 0 4 (fontified t face font-lock-function-name-face))

...as opposed to the "plain string"

"foo"

(If Elisp code reads a string directly from a buffer, it may be decorated like this.)

What's the simplest way to convert a decorated string to a plain one (by stripping all the decorations)?


texts:
I write a lot of documents using Markdown in VS Code and it is convenient because you have live preview capabilities and also live preview math formulae, using, if I am not mistaken, KaTeX, and without needing to run any command or press any keys. The part about math preview is especially important because as I have seen other solutions may need to have LaTeX installed.

As I already use Org Mode as a calendar I would prefer to be able to write documents in it, as I do in VS Code, but I haven't found any solution for the previewing, and especially for the math formulae without needing to install LaTeX and without needing to press keys every time. Is there any?


texts: How can I run GUI emacs (using a shortcut) in a very light xmonad installation?

texts:
I am trying to launch Emacs through a keyboard shortcut on my Debian/xmonad system. Relevant lines from my xmonad.hs:

~$ cat .xmonad/xmonad.hs
import XMonad

...

main =
  xmonad =<< xmobar
  (defaultConfig {modMask = mod4Mask, terminal="gnome-terminal"}
   `additionalKeysP`
   [ ("M-e", spawn "emacs"),
     ...
   ])
...

~$ xmonad --recompile
~$

(and even restart, I'm just proving minimal sanity here)

When I use the keyboard shortcut, nothing happens and if I inspect my .xsession-errors I can see:

~$ tail -n1 .xsession-errors
emacs: standard input is not a tty

If I just start Emacs from the terminal I go in "terminal mode".

Finally:

~$ echo $DISPLAY
:0.0

How can I further debug this?

Further version info:

$ apt-cache policy emacs
emacs:
  Installed: 46.1
  Candidate: 46.1
  Version table:
 *** 46.1 995
        995 http://ftp.se.debian.org/debian testing/main amd64 Packages
[...]
$ apt-cache policy emacs-nox
emacs-nox:
  Installed: (none)
  Candidate: 46.1
  Version table:
     46.1 995
        995 http://ftp.se.debian.org/debian testing/main amd64 Packages
[...]
$ emacs --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.


texts:
Since an emacs upgrade I made a long time ago (or was it when I changed my laptop, or when I changed my Ubuntu release? I can't remember), emacs keeps opening new windows whenever I click into a file link in grep-mode (for example). Before, I had this behavior:

I have a window open (window 0)
I run a grep command
I get a new window, with the grep result (window 1)
I select any line in the grep result, and a new buffer is opened in window 0

Which is what I want: maximum two windows opened, and I get to see around 30 lines per window. Now, instead, I get:

I have a window open (window 0)
I run a grep command
I get a new window, with the grep result (window 1)
I select any line in the grep result, a new buffer is opened in a new window (window 3). The windows have 30, 15, and 15 lines.

So now I have 3 windows instead of 2, with too few lines. This happens again, until a maximum of 4 open windows. To keep my windows at a minimum height, I need to keep on manually closing windows, which is very annoying.

I guess this has to do with the minimum height of the window, and how many lines the frame has, but I am unable to find the exact settings.

How can I tell emacs to open at most 2 windows in the active frame?


texts:
When using describe-variable, often the value for a variable is listed as:

Its value is t

What does that mean and why specifically t?


texts:
I have a short snippet template which I use to document my patient’s encounter in org-mode.
It consists of

 * Subjective
$1
* Objective
- Examination: $2
- Investigations seem : $3

*  Assessment
- $4
* Plan
- Investigations suggested
   - $5
- Treatment
   1. $6

But when I use M-RET (runs org-meta-return) within the snippet to create a new item, the snippet exits (the fields are no longer TABable, the message [yas] Snippet 0 exited. appears in the *Messages* buffer). How can I prevent this?
Kindly note I am not a programmer


texts: emacs mark from point to start of buffer?

texts:
I know one can mark the whole buffer with mark-whole-buffer.

but how does one mark from point (that line) to start of buffer?


texts: dired: different action from same bind based on file type (extension), maybe hydra?

texts:
i really would love to have the option to launch different apps for a specific file type. for example if i have a .jpeg file i would want an option to launch in gimp, inkscape etc.
Ideally i would love to have a keybind that launches a menu (maybe using hydra?) that will present the launch options. if this could be dynamic based on a file type (extension maybe?) that would be amazing, but i'll also be glad with maybe just a general menu with all available actions.
any ideas?


texts: How remove active date from a dynamic block using columnview

texts:
This post explains how you can setup dynamic blocks to create tables based on meeting minutes.

In short, you can extract the TODOs of the minutes and put them in a table of actions like so:

* Actions
#+BEGIN: columnview :id global :match "/TODO|DONE" :format "%ITEM(What) %TAGS(Who) %DEADLINE(When) %TODO(State)"
| What                     | Who          | When            | State |
|--------------------------+--------------+-----------------+-------|
| Inventory of equipment   | :@Fred:      |                 | TODO  |
| Definition of main goals | :@Sara:      |                 | TODO  |
| Talk to companies        | :@Lucy:@Ted: | <2020-03-01 So> | DONE  |
#+END:

This uses the columnview dynamic block to automatically generate and keep the table up-to-date.

It works well except for the date. It extracts the active date in the <2020-03-01 So> format. This causes the insertion of an empty duplicated entry in my agenda view for this date.

Is there a way to convert the date to inactive, so it is displayed as [2020-03-01 So] in the table?


texts:
I occasionally find myself using Nautilus instead of dired to search for files and would like to change that. When looking for a file, I often don't know the capitalization of its name which is why I like case-insensitive searches. Additionally, I almost always search for something in the middle of the file's name.

I think I can likely (i.e. p > .4) figure out myself how to write a function which always gives the same directory to find-name-dired and adds stars to both ends of its argument (so I can search for any substring).

However, I do not know how tell find-name-dired to tell find to ignore case. Basically I want find-name-dired to pass -iname to find instead of -name.

My question isn't necessarily about making find-name-dired do that. If there is a better way to achieve my goal, please tell me about it. It doesn't need to involve find-name-dired.


texts:
I want to write a elisp script to filter a log command to output specific logs only.

The log command will never exist till user press 'C-q'.
The log output will be filtered by regex such as "test.*".
The filtered output print to emacs buffer.

How can I implement that? I know shell-command-to-string but it's not proper since the log command not exit at all.


texts:
I make intensive use of org-mode and it boosts my productivity significantly. But I'm missing the possibility to adjust the space between headings automatically.

On the one hand I want to define the number of lines between headings and subheadings, so that for example headings of the same level are delimited by 1 empty line and headings of different levels by 2.

On the other hand, the text inside headings is to be positioned consistently.
It would be ideal If could distinguish between the space that is to be inserted after a heading and the space before. So I can define that the text after a heading starts after 2 lines and the heading after a text has 4 preceding empty lines.

The perfect solution would be If I could add that function to org-cycle-hook.


texts: If I wanted to make a video game with emacs what are my options? Are there frameworks? What graphics capabilities does emacs have? Can I make 3D first person shooters with emacs?


texts: How are file paths mapped to subdirectories in .dir-locals.el?

texts:
I like the idea of .dir-locals.el.  I have my own .dir-locals.el file in my home directory that should set all the variables for directories/files that I open unless there is .dir-locals.el closer to the directory I open the file in.  However, even though the file is recognized, directory variables for subdirectories are not applied to opened files.
This is my ~/.dir-locals.el:

(("dev/school" .
  ((indent-tabs-mode . nil)
   (c-basic-offset . 4)))
 ("dev/test" .
  ((indent-tabs-mode . nil)
   (c-basic-offset . 4)))
 (c-mode .
  ((c-file-style . "linux")
   (c-basic-offset . 8))))

When I open file ~/dev/test/test.c the variable indent-tabs-mode is set to t and c-basic-offset is 8.
(describe-variable 'c-basic-offset) in that file tells me it is set to 8 from ~/.dir-locals.el.
(describe-variable 'indent-tabs-mode) in that file says it's value (t) is just in its default state.
Can I somehow achieve the desired behaviour?  What am I doing wrong?  How are file paths mapped to subdirectories in ~/.dir-locals.el?
Edit:
As Jonathan suggested, I also tried:
(;; dev/school subdir
 ("dev/school" .
  ;; dev/school specification for all modes
  (nil . ((indent-tabs-mode . nil)
          (c-basic-offset . 4)))))

and even what add-dir-local-variable added:
(("dev/school"
  (indent-tabs-mode)
  (c-basic-offset . 4)))

Unfortunately, none of those work either.


texts: specify base/initial path for company-files completion?

texts:
I've set up company-mode in emacs and enabled the company-files backend, and am now able to start typing in code which looks like this:

import Foo from '../

and have company provide some auto-completion options, resulting in e.g.:

import Foo from '../../baz/bar/Foo.js

.  Is it now possible to configure company-files to begin its process in some other directory (e.g. ../../baz), so that I can write code that looks like this:

import Foo from 'bar/Foo.js';

and still get autocompletion along the way?

Ideally I'd like a way to tell company-mode "traverse up the filesystem tree from this file's location until you find a directory containing a file named 'package.json' and begin auto-completion from there", but providing an absolute filesystem path string would be okay too.

thanks!


texts: clocktable report - not display file without clocked time


texts: Override particular range of code points with a non-default font

texts:
Is it possible to override glyphs at some range of code points, that the default-font already covers, with ones from a non-default font?

For instance, I'd like to use Arial only except for the uppercase letters, which I want to use Cooper Black for. How can I achieve this?

I know that I can override some rage of code points whose glyphs are missing in the default font, but I'm failing to do the same for the code points whose glyphs exist in the default font.

Here's what I tested.

(set-face-attribute 'default nil :family "Arial")
(let (
(my-upper-case-font "Cooper Black")
(font-sets '(
               "fontset-default"
               "fontset-standard"
               "fontset-startup")))
(mapcar
(lambda (font-set)

(set-fontset-font font-set '(#x00. #x17F) my-upper-case-font)
;I set the range wider for the sake of testing.
;This doesn't work and when I inserted "t" after "font-set",
;a message showed up saying "Wrong type argument: frame-live-p, "Cooper Black""
)
font-sets))


texts: How to get mouse copy like done on Lisp Machine Zmacs/ZWEI?

texts:
I'd like my emacs v25.3.1 running on Mac OS X to have a mouse middle button functionality that copies what you mouse middle on to the insertion point in your buffer.  This is great when writing code and you want to quickly grab a section of code already in your file by pointing with your mouse.  This is the way the old Lisp Machines worked with Zmacs and the ZWEI editor.  You click a point and it copies an sexp you point to or you click drag to specify an exact range of characters to copy, or you click at end of line to copy a whole line.

I've had doing this on my own, but it always breaks going to a new version of emacs, so it would be nice if there was built-in code to do this or an add-on that is supported.

I found Mouse Copy but that project appears untouched since 2012.


texts: keybinding to switch to specific application

texts:
I'm running Emacs in a GUI, and I like having a keybinding that quickly switches me to a terminal. Yes, I know there's eshell, term, and shell in Emacs, but I still prefer a dedicated terminal emulator for a lot of my work.

When I'm on macOs, I use a function that switches application focus to iTerm,

(defun os-switch-to-term ()
  (interactive)
  (when (display-graphic-p)
    (do-applescript "tell application \"iTerm\" to activate")))

I'm pretty sure I lifted this from doom-emacs. I'm now spending most of my time in Linux, so I'm searching for a way to translate the above functionality to something that will work in a different desktop environment (I'm currently using Gnome on Ubuntu, and gnome-terminal, though I'm still hunting for a terminal emulator I like better).

I imagine the options will depend on the flavor of Linux, and which window manager and/or desktop manager you're using, but as a start, how might I translate this to a Gnome environment w/gnome-terminal?


texts: Why does inserting a new R chunk inside `ess-noweb-mode` give me a leading @ symbol?

texts:
I am writing a statistical report using .Rnw buffer and enjoying the very nice ess-noweb-mode, which I see very promising indeed, but what struck me is the strange behavior when I hit the keybinding to insert a new chunk M-n i it will introduce an extra @ symbol at the very beginning of the chunk, is this an expected behavior or am I missing some point here? your input would be much appreciated.

@
<<anyChunkName>>=
R code goes here
@ %def

I had to delete that leading @ each time writing an R chunk to appear like this:

<<anyChunkName>>=
R code goes here
@ %def

Note
I am using ESS vesrion 15.09-2 patched


texts: Cleaning the buffer-undo-list of unwanted entries

texts:
When multiple-cursors is deactivated, I would like to remove from the buffer-undo-list all entries that look like this:

(apply activate-cursor-for-undo 40)

(apply deactivate-cursor-after-undo 38)

How can I remove all such entries in one fell swoop?

BACKGROUND:  I am storing the buffer-undo-list and buffer-undo-tree in the desktop restore file, and I'd like to make it smaller so that Emacs will handle starting and shutting down more efficiently.


texts:
Is there a possibility to save the Emacs Calculator Trail (as a file) and to  restore it later? If not, should it be feature?

For example, when I have an incomplete calculation but have to shutdown my Emacs, it would be great if i can continue afterwards.

Second case: I do some calculations and want to store how I did it, to later check if I did it correctly or need to modify it.

The second reason is why I use MATLAB (I know, too much) for little calculations, just so i can restore them. But I would like to use Emacs Calc only!

Thanks for the answers


texts: Is there a way to disable multi-line string literals in c++-mode?

texts:
Suppose I have a short string in C++ and I accidentally delete the double quote that ends it. What Emacs does is highlight the rest of the code as a single very long string, which messes up all the formatting until I put the double quote back in. It also feels a little slow when it's refontifying the whole buffer.

I skimmed through cc-mode.el, but I couldn't find the setting for it or the place where string fontification happens.

Is there a way to tell c++-mode (or font-lock maybe?) that my strings never contain newlines and it should never look beyond the first newline if it finds an unterminated string literal?


texts: What's the point of `save-excursion` twice in `copy-to-buffer`?

texts:
Here is the official definition of copy-to-buffer in Emacs 26.1 (the doc string part is omitted for brevity)

(defun copy-to-buffer (buffer start end)
  (interactive "BCopy to buffer: \nr")
  (let ((oldbuf (current-buffer)))
    (with-current-buffer (get-buffer-create buffer)
      (barf-if-buffer-read-only)
      (erase-buffer)
      (save-excursion
        (insert-buffer-substring oldbuf start end)))))

I don't understand why it's necessary to use save-excursion in conjoint with with-current-buffer? As far as I'm concerned, the former is equivalent to a combination of save-excursion and set-buffer, so the current point would be saved and restored anyway.

In other words, I'm wondering why don't the Emacs implementers use the following piece of code, which after some experiments appears to be functionally identical to the current one.

(defun my-copy-to-buffer (buffer start end)
  (interactive "BCopy to buffer: \nr")
  (let ((oldbuf (current-buffer)))
    (with-current-buffer (get-buffer-create buffer)
      (barf-if-buffer-read-only)
      (erase-buffer)
      (insert-buffer-substring oldbuf start end))))


texts: `pop-to-buffer` in other frame if file is already visited

texts:
Say I have two frames open. Frame A is visiting a file foo.org. Calling (pop-to-buffer "foo.org") in the other frame (B) opens foo.org in frame B instead of moving the focus to frame A where that buffer is already open. Can this be configured (and how) to "jump" to frame A?
I appreciate that there are other functions that allow me to jump "across frames" but I'd like to adapt the behaviour of pop-to-buffer specifically.


texts:
When running M-x shell I get strange additional characters.

It looks like this,

I should look similar to how it does in the terminal,

I am very new to Emacs. Hopefully there is a simple fix.

I am running Fedora 25 and GNU Emacs 25.1.1


texts: Org-mode spreadsheet: operate on range of fields

texts:
I am having hard time trying to figure out how to add contents of multiple fields.

It isn't quite obvious from Org mode manual as issue like this should be.

I'm trying to find a formula to sum the entry in fields @2$5 to @5$5 and make an entry of the sum in @6$5.

Now I found that something like @2$5..@5$5 can be used to refer to range of fields, but how do I find the sum of them?

I tried sum(@2$5..@5$5) and add(@2$5..@5$5), but apparantly there's no such functions.


texts: Unexpected "secondary" line number labels in org-mode

texts:
In .org files—I've seen it only in a file with over 1k lines—emacs sometimes displays a secondary "line number" next to certain headings, like so:

The left-most gutter is populated by linum+, but the digit 8 on line 7 is what confuses me. The heading has no contents, just an empty line (line 8).

I believe the extra / floating digit gives the final line number of the collapsed heading...but what caused the number to show up in the first place? What mode is this coming from? Why doesn't it happen to all headings?

And so on. Thanks!


texts: Running Emacs server from snap installation

texts:
I've installed Emacs 26.2 using snap on Lubuntu 18.04. I'm trying to figure out how to get the server/client/daemon going.

I've done as instructed on EmacsWiki: "Emacs Client" by putting (server-start) in .emacs.el.

I've followed the examples on EmacsWiki: "Emacs as Daemon" by putting this in ~/.config/systemd/user/emacs.service:

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

When I tried to enable the unit by running:

systemctl enable --user emacs
systemctl start --user emacs

I got an error message about where Emacs lives on my filesystem, so I substituted /usr/ with /snap/. I restarted my system (don't know if that was necessary, or if merely logging out and back in again would have been sufficient) and looked at my process list to see that /snap/emacs/45/usr/bin/emacs --daemon is indeed there, so I figure all is well. An entry for Emacs (Client) has appeared below the original Emacs one in my launcher (though not with the right icon, but that's trivial).

Crucial questions

Is that pretty much all there is to it, or is there anything I should change?
How do I actually run Emacs now? When I click on Emacs (Client) in the launcher, the pointer whirls for a bit and then stops. No window shows up.

Definitely not crucial, but just because I'm curious

Where did the launcher get the actual text Emacs (Client) from?
If I do decide to change the icon, how do I do so?

Responding to @alpaice

Freshly rebooted, ran htop and found two processes: /snap/emacs/45/usr/bin/emacs --daemon. I tried $ emacsclient -c .profile and it came up beautifully! I've tested couple of other things, like opening a file from the file browser (PCManFM) while an Emacs Client frame is already open. I discovered that I had to use "Open With..." once and choose "Emacs (Client)" which worked fine. I then right-clicked a different file and saw that PCManFM had added "Emacs (Client)" to the list (clever thing).

Unfortunately, this didn't work when there wasn't already an Emacs frame open. Much icon whirling, then nothing. I'm wondering if perhaps a bash script might be needed to determine if a frame is already open. My knowledge of bash is next to nothing, but I'm currently trying to learn it.

I didn't know about unsquashfs. Thanks, I'll add it to my reading list.

Thank you for your help!


texts: Update DEADLINE: time and to do state on parent header after org-capture finishes

texts:
I have a couple of org-capture templates that insert tasks/notes under a header called re-organize, I'm looking to update the to do state and deadline of that re-organize header after org-capture finishes.
to illustrate, let's say the current file content looks like this:
* header 1
* header 2
* header N
* DONE re-organize
DEADLINE: >a timestamp of yesterday at 5pm<
** task/note to refill 1

and then if I insert task/note to refill 2 via one of my org-capture templates this should result in this file structure:
* header 1
* header 2
* header N
* TODO re-organize
DEADLINE: >a timestamp of today at 5pm<
** task/note to refill 1
** task/note to refill 2

How can I achieve this?


texts: Focus-hook: attenuate colours when losing focus

texts:
How can I use the focus hooks to attenuate all colours in visible buffers when the Emacs frame loses focus?

I tried using the following code:

(set-frame-parameter (selected-frame) 'alpha '(100 80))

To make the frame become translucent, but it would flicker when I hit Ctrl (apparently that's because I let GNOME highlight the mouse cursor when I hit Ctrl).

Making the frame transparent isn't what I want anyway.  Is it possible to desaturate all colours instead?

EDIT:  a less ambitious goal is to change/attenuate the colours of the mode line on focus change and restore them to normal when focus returns.  With two monitors I often find myself typing into the void when Emacs is displayed but not focussed, so I need some better visual indicator of focus.


texts: How do I insert a heading above the current one in org-mode?

texts:
I'm currently running Spacemacs+evil and pressing C-RET calls evil-org-org-insert-heading-respect-content-below, which inserts a a heading below the current one.

I couldn't find a dual/mirror command that would create a heading above the current one, though. Is there one, or what's a good implementation that does this?

Note: I'm self-answering with my solution, which is the first elisp I've ever written and is very tied to Spacemacs+evil, but I would love it if others could chime in with snippets that don't depend on Spacemacs nor evil and are as such more useful to the general org-mode user. Thanks!


texts:
Often I need to use regular expressions to match strings across multiple lines. In python and other languages, it's possible to ask that dots match newlines (as opposed to the default behavior). Is it possible to do this using the default regexp utilities without hacking the source?

I know I can use a negated character class, which will consume newlines if the newline is not in the class, but this is too limited since what I really want is to just match any character at all.


texts: What are the main differences between latexmk and C-c C-a from Auctex?

texts:
I was wondering if anyone knows if C-c C-a in AucTeX is using behind the scenes latexmk or not? I've tried looking into the source files for both C-c C-c and C-c C-a but I couldn't find in any those traces of latexmk.

On a side note what best way to integrate latexmk in AucTeX workflow?


texts:
Say I have a shell command foo that I want to bind to a key. I could do for example:

(global-set-key (kbd "C-c f") (lambda () (interactive) (shell-command "foo")))

I would like to be able to pass an argument to foo. An argument will be the name of a file in the current directory, so I would like to take an advantage of shell auto-complete. The preferable behavior would be for C-c f to open shell in the minibuffer with foo already entered so that I can just add the filename and hit RET. How can I achieve that?


texts: How to scroll immediately by a pixel offset?

texts:
I was looking for a replacement to scroll-up / scroll-down that operates in pixel units.

pixel-scroll-mode animates the scroll, I didn't see any functions that apply an offset directly.
set-window-vscroll

Uses absolute position.
It needs the scroll to be split into pixels & characters
It doesn't handle moving the cursor.
Moving the cursor afterwards resets the scroll position.

So it seems like it's lower level than a scroll operation.

Is there a function where you can run:

(scroll-down-by-pixels 40)

To scroll which handles constraining the point by scroll margin for eg?


texts: Spacemacs menu in mini-buffer displays Dired+ "C-x D A" command unreliably

texts:
Two weeks ago I installed Dired+.

I successfully used Dired+ C-x D A (diredp-add-to-dired-buffer) command.
But the Dired+ C-x D A command is not always available.
Sometimes after C-x, the D appears in the Spacemacs menu, in the minibuffer, like this:

D -> +prefix

Other times D is missing from the Spacemacs menu.
Although the Dired+ help displays as expected:

SPC SPC diredp-dired-plus-help

The inclusion of D in the menu seems random.

Also, when C-x D A is not available, it is not found in SPC h d k.

However, M-x diredp-add-to-dired-buffer works as expected.

I tried rebooting.

Like Drew said, maybe some other package I use might be grabbing the key binding.  I haven't checked that yet.

Maybe I installed Dired+ the wrong way.
My .spacemacs file contains dired+ twice:

(defun dotspacemacs/layers ()
  (setq-default
..
   dotspacemacs-additional-packages '(dired+)
)
..
(custom-set-variables
 '(package-selected-packages
   (quote
    (disaster dired+

What else could be causing the intermittent spacemacs-menu behavior?

I contacted the author of Dired+, but he doesn't know Spacemacs.

I am using Emacs 25.2.1 with Evil Spacemacs and Ivy on Linux.


texts: Remove Task state keywords (TODO/DONE) from clocktable reports?

texts:
Org-mode's Clocktable reports show the task state "TODO/OPEN/DONE" at the beggining of the headline:

like so:

|          | TODO  Bug 459487 - [GTK] Replace...     | 7:38    |      |
|          | OPEN Black Pomodoro App                 | 1:15    |      |

I want to remove these keywords as I don't want them in my weekly reports that I publish to our group.

I looked at the clock table reference but could not find a way to filter them out. Perhaps there is some way to write a filter-function.
Would anyone be able to point me in the direction of how I could write this feature?


texts: how to reveal function names that are bound to mouse buttons (eg )?

texts:
Emacs buttonizes specific expression in the buffers. For example, email ids, urls attachments in gnus buffer, and [back], [forward] in help buffers and so on. When we click on those with mouse, they act appropriately.

How to know which function is called when clicking (with mouse) on such a buttons?

C-h k isn't of much help here.

Edit: this question is already answered. The reason I wanted to know is to bind keys like firefox to go back and forth in the history of help buffer.

Now I have the following in my .emacs

(define-key help-mode-map (kbd "M-<left>") 'help-go-back)
(define-key help-mode-map (kbd "M-<right>") 'help-go-forward)


texts:
Emacs 26.3, Org 9.3

When using python src block, it changes 8 spaces to tab.  When tangling this, python errors with "inconsistent use of tabs and spaces in indentation".  How fix it?


texts: Orgmode : exporting agenda with sexps to ics

texts:
This year, I am having classes with complex descriptions, such as "every 1st and 3rd friday between 2016-11-18 and 2017-5-19", so I chose to use org-mode agenda combined with sexps to describe them easily:

*17:00-19:00 Name of the class
 <%%(and
      (diary-block 11 18 2016 5 19 2017)
      (or
        (diary-float t 5 1)
        (diary-float t 5 3)
      ))>

Now, I want to export my schedule in the iCalendar format, to be able to use it in Lightning and/or Google Calendar. However, when I export it with C-c C-e c f (ie "Export current file to iCalendar"), I only get the events I input in classical timestamp format, e.g. *Name of class <2016-12-12 Mon>, although org-icalendar-include-sexps evaluates to t.

I also tried to use the agenda view exporting utility C-c a e, but encountered the same problem.

P.S. : I finally tried the alternative solution of directly importing my schedule to Google Calendar using org-gcal (https://github.com/myuhe/org-gcal.el), to no avail.


texts:
I see lots of folks posting animated GIF's showing off Emacs features, but I haven't seen a nice walk through on creating one. Is there any code that tries to link the keyframes of the gif to keypresses in Emacs? Is there any elisp packages or functions to automate the process? I'd love to be able to press a key to start recording, press it again to stop, and have it prompt for a filename to save the gif to.

Related question, is there a package for recording longer screencasts from within Emacs?


texts: Shortening trees list with (setcdr (nthcdr 2 trees) nil)

texts:
I am starting to learn elisp and working through this tutorial https://www.gnu.org/software/emacs/manual/html_node/eintr/kill_002dnew-function.html
and I do not understand this basic example:

 (setq trees '(maple oak pine birch))
      ⇒ (maple oak pine birch)

 (setcdr (nthcdr 2 trees) nil)
      ⇒ nil

 trees
      ⇒ (maple oak pine)  ;I was expecting: (pine)

How does (setcdr (nthcdr 2 trees) nil) remove the last element from the trees list?

Here is the same example manually expanded from the inside out:

 (setq trees '(maple oak pine birch))
      ⇒ (maple oak pine birch)

 (nthcdr 2 trees)
      ⇒ (pine birch)

 (setq trees '(pine birch))
      ⇒ (pine birch)

 (setcdr trees nil)
 trees
      ⇒ (pine)

Where did I go wrong expanding the example?


texts:
Is there any sort of markup in org-mode to get multiple lines of text to be bold, italics, etc?

*This is what I want to be bold and I only want lines to
be a certain length so that this doesn't work.*

I know about using visual-line-mode as an alternative to fill-paragraph which would solve this problem, but I like M-q too much and I want to try and keep my files at a certain width.

Snippets welcome. I don't know Elisp so I can't do it myself. But I guess this would ruin export too.

I'm thinking something like:

#+BEGIN_BOLD
  All my text in here would be super bold
  and would be very nice.
#+END_BOLD


texts: Hiding items in org-agenda view and calendar

texts: When I still used Emacs Diary as my default organizer I valued its ability to mark items on the calendar. One could also make an entry that was NOT so marked by placing an ampersand before the entry. The entry would appear in the diary but would not be marked in the calendar. I have since switched to org-agenda and have set up calendar (and also calw-org) to display my org-agenda files. However, there are certain appointments I would like to hide from being marked in the calendar. How does one do this with an org-file?


texts: The proper order of time stamp and content under a heading in org mode

texts:
I just wonder whether there is some instruction on the proper order of the time stamp and the contents under one heading.

For example,

Style 1:

* Heading 1
  <2015-11-13 Fri 10:30>
  Some contents.

Style 2:

* Heading 1
  Some contents.
  <2015-11-13 Fri 10:30>

Which style is the proper one?


texts: helm-projectile-ag use thing-at-point as input?

texts:
I want to use the current word as the input when I do helm-projectile-ag. That saves me the typing work. I didn't see this option in customize.

How would I implement that?


texts: orgmode latex export: How to create repeatable labels?

texts:
Every time I export org-mode document to LaTeX, most sections get new and unique labels, e.g.,

\section{Introduction}
\label{sec:orge0665da}

The next time I export the document, the label will change, e.g.,

 \section{Introduction}
 \label{sec:orgcd0c5bf}

If I want to do a diff of the LaTeX documents to a previous version, I get a ton of changed labels that hide the changes I have made to the text. Sometimes this confuses latexdiff as well.

Is there a way to ensure that the exported labels are the same between exports? At least for as long as the number of (sub)sections does not change? Set a seed to a random number generator? Write a hook function that returns a label given a section?

I am aware of Is there a way to suggest label names in org-mode latex export?, that solves the problem for a specific label, but not the (in org-mode) un-labelled sections.


texts: Relative file paths in included begin_src blocks

texts:
I have this file structure:

.
├── main.org
└── part1
    ├── img/
    └── part.org

main.org:

* Main file
** Part 1
#+include:part1/part.org

part1.org:

#+begin_src gnuplot :exports none :results file :file ./img/fig1.png
plot x**2
#+end_src

#+name: fig1
#+caption: Plot
[[./img/fig1.png]]

I want to be able to export to latex both main.org and part.org (basically what org-thesis does) and also to generate figures only in their respective part*/img/ folder.

The problem is: when I export main.org org-mode changes [[./img/fig1.png]] to [[part1/img/fig1.png]] but ignores :file ./img/fig1.png.

If I create img/ on the same level as main.org then org-mode correctly generates figures in that folder (but tries to use those in part1/img/).

So is there a way for :file filename to have the same behaviour as [[filename]]?


texts: Suppress message in minibuffer when a buffer is saved?

texts:
Whenever a buffer is saved, a message is displayed in minibuffer.

  Wrote foo.bar

I use real-auto-save to save modified buffers every 5 seconds. Due to this minibuffer is getting spammed. Sometimes, when I am looking at useful info(like signature,  errors or something else), this message overrides it.

Is there a way to disable printing this message in minibuffer?


texts: Why emacs multiplication performance is so bad?

texts:
I compared two versions of loop in emacs and in C.
Emacs byte-compiled version gives 4.5 seconds, C version gives 0.22 seconds. Why so slow? How to optimize it?

Emacs version:

;; -*- lexical-binding: t -*-

(defun test-me ()
  (let ((i 0) (j 0) (t1 (float-time)))
    (while (< i 100000000)
      (setq j (* i 7))
      (setq i (+ i 1)))
    (- (float-time) t1)))

C version:

#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int main(int argc, char **argv) {
    int i = 0;
    int j = 0;

    clock_t start = clock();
    while(i < 100000000) {
        j = i * 7;
        i = i + 1;
    }

    clock_t end = clock();
    float seconds = (float)(end - start) / CLOCKS_PER_SEC;
    printf("%f\n", seconds);

    return 0;
}


texts: Force twittering-mode links to always open in a specific frame?

texts:
My (simplified) setup: one frame for twittering-mode and another for w3m, among others, all inside tmux.

While in the twittering-mode frame, C-m on a link does one of two things.  Sometimes, the link loads in the w3m frame.  Other times, the twittering-mode frame switches to a w3m buffer, so I have to type C-x b C-m to return to twittering-mode after each link I open.

Is there any way to guarantee that the first behavior occurs?  It makes browsing Twitter for articles to read very convenient.  (Load several, read one, type B to read another.)

I have tried playing with display-buffer-alist, as suggested here, here, and here, all to no avail.

((".w3m.*"
  (display-buffer-reuse-window)
  (reusable-frames . "visible")))

Is this not possible?


texts: What's the fastest way to reload my .emacs file when I make changes so all my affected buffers will pick up those changes?

texts: I'm aware of C-x C-e which is eval-last-sexp and M-x eval-buffer, but these aren't always sufficient to pick up all changes. Sometimes you need to actually close buffers that are in the modes who have had their configuration changed, and other times you need to restart emacs entirely. Is there a more general way of handling this problem? Alternatively, is there a way to restart emacs without losing the existing opened buffers and the interactive history?


texts: How to animate GIFs in org-mode in emacs?

texts: I inserted a GIF in my org file, but it was static, I want to animate it, how can I do it?


texts:
I have yapf installed, and would like to run it automatically. Documentation says there is a way: http://elpy.readthedocs.io/en/latest/ide.html#command-elpy-format-code but I don't see it in the source code.

PS. It's not important that it come from Elpy. If there's an alternative ready-made solution, it's just as good.


texts: Prevent abbrev-mode from expanding on underscore

texts: Abbrev-mode seems to think an underscore signals a new word, which is not the case in many programming languages. I want it to expand after spaces, newlines, and tabs; not after underscores. Is there a way to tell abbrev-mode not to expand when I type an underscore?


texts: can't follow cite links with org-ref and can't open PDFs with helm-bibtex

texts:
I'm working with org-ref, helm-bibtex (and org-roam and an org-roam-bibtex if that's relevant).
I've somehow broken my config and would really appreciate any help gathering the pieces...
I can see my various references using helm-bibtex, and I can insert bibliography links with org-ref-insert-link. However, when hitting 'return' with the point on a cite link, instead of a menu with options about the source,  I get a message saying: "wrong type argument stringp, nil", with no reference to the function that throws the error, so I don't even know where to begin investigating... querying what 'return' does in that context only gives the general "org-dwim at point".
Additionally, I can't get helm-bibtex to open the related pdf in emacs (something which used to work for me and broke somehow), but only the related DOI site.
These are the relevant lines from my config (relating to org-ref and helm bibtex) :
(require 'org-ref)

(setq
 org-ref-bibli ography-notes "~/google_drive/.notes/.bibliography/bibliography_notes.org"
 org-ref-default-bibliography "~/google_drive/.notes/.bibliography/references.bib"
 org-ref-pdf-directory "~/google_drive/.notes/.bibliography/bibtex_pdf/"
 org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex
 org-ref-note-title-format "* TODO %y - %t\n :PROPERTIES:\n  :Custom_ID: %k\n  :NOTER_DOCUMENT: %F\n :ROAM_KEY: cite:%k\n  :AUTHOR: %9a\n  :JOURNAL: %j\n  :YEAR: %y\n  :VOLUME: %v\n  :PAGES: %p\n  :DOI: %D\n  :URL: %U\n :END:\n\n"
 org-ref-notes-directory "~/google_drive/.notes/literature-notes/"
 org-ref-notes-function 'orb-edit-notes)

(setq bibtex-completion-pdf-open-function
  (lambda (fpath)
    (start-process "open" "*open*" "open" fpath)))

(setq
    bibtex-completion-bibliography "~/google_drive/.notes/.bibliography/references.bib"
    bibtex-completion-library-path '( "~/google_drive/.notes/.bibliography/bibtex_pdf/")
    bibtex-completion-notes-path "~/google_drive/.notes/literature-notes/"
    bibtex-completion-pdf-field "File"
    bibtex-completion-find-additional-pdfs t)

(use-package org-roam-bibtex
  :after (org-roam)
  :hook (org-roam-mode . org-roam-bibtex-mode)
  :config
  (setq orb-preformat-keywords
   '("=key=" "title" "url" "file" "author-or-editor" "keywords"))
  (setq orb-templates
        '(("r" "ref" plain (function org-roam-capture--get-point)
           ""
           :file-name "${slug}"
           :head "#+TITLE: ${=key=}: ${title}\n#+ROAM_KEY: ${ref}
- tags ::
- keywords :: ${keywords}
\n* ${title}\n  :PROPERTIES:\n  :Custom_ID: ${=key=}\n  :URL: ${url}\n  :AUTHOR: ${author-or-editor}\n  :NOTER_DOCUMENT: %(orb-process-file-field \"${=key=}\")\n  :NOTER_PAGE: \n  :END:\n\n"

           :unnarrowed t))))

I'd appreciate any help, thanks!


texts:
I maintain a log in org-mode that checks for the current date through a grep '^* 2017-11-14', I keep track of stuff I read, write, code samples, data tables etc.

However, when I want to use ** or deeper levels of the org-tree, I have the problem that everything after the last **..* heading gets caught in the last part of the tree.

For example:

In the above example, is there a way to put a delimiter after the ** TODO ... list?

My workaround has been to put a final item in the list that just says ** notes so that it doesn't get mixed with other specific items.


texts: How do octave functions work in org-mode code blocks?

texts:
I tried to define and use a simple matlab/octave function within an org-mode code block as shown follows.

#+name: test-octave-function
#+begin_src octave
  function s = my_sum(x, y)
  s = x + y;
  end

  my_sum(1, 2)
#+end_src

The code works if put inside a .m file. However, in a code-block, it generates this error in Org-babel output:

  warning: function name 'my_sum' does not agree with function filename
  ''

  error: 'my_sum' undefined near line 1 column 1

I understand functions defined for use in other files need to have the same name as the .m file. But how do filenames work for a code block. Also, I called the function my_sum in the same code block, why is it undefined?

Related to this, how can I define and use multiple functions in a code block?

(This is with the stock Emacs 26 of Ubuntu 20.04)


texts:
I have recently switched from obsolete ibuffer-mode to ido mode, and it replaced C-x C-f command to ido-find-file with completions. I don't need it. How to revert it back to simple find-file?

I tried to set in configs:

(global-set-key (kbd "C-x C-f") 'find-file)

But it didn't help.


texts: How can I associate hbs file with handlebar mode?

texts:
hbs are file extension for handlebar template files

When I tried to open the file, spacemacs automatically associate it with 'Web' mode.

Is there a mode for handlebar? If so, how can I change the mode by default for hbs files?


texts: Left-align text with `visual-line-mode` and `adaptive-wrap-prefix-mode`

texts:
When I use visual-line-mode in conjunction with adaptive-wrap-prefix-mode, the wrapped text is not perfectly left-aligned (i.e. the text is not on a straight edge). Instead, it looks like this:

Is it possible to make adaptive-wrap-prefix-mode properly left-align the first word of each new line?
Thanks!


texts: org-open-at-point (follow link) works for .org file, but not .org_archive

texts:
I had a link to a headline in another org file that worked fine, but then I archived that subtree. I thought that updating the file to reflect the "_archive" part of the name would work, but C-c C-o does not work for such files. It does for .org files.

That is:

[[file:notes.org::*test%20heading%20here][this link works when the heading is there]]

[[file:notes.org_archive::*test%20heading%20here][this one doesn't, even if the heading is there]]

I'm on Windows and it looks like emacs is looking for another program to handle a org_archive file. How can I tell emacs/org-mode to treat .org_archive files like .org files?


texts: How does autoload cookie work on non defun form

texts:
sometimes I see a "unkosher" use of autoload coookie, for example:

;;;###autoload
(add-hook 'some-hook 'some-fun)

How will the above work? Will it add a hook just by being installed (as autoloads get loaded automatically)?


texts: How do I get my initial frame to be the desired size?

texts:
I have the following in my .emacs file:
    (when window-system
      (set-frame-position (selected-frame) 0 0)
      (set-frame-size (selected-frame) 91 63))

The value of 63 is supposed to make my initial frame take up the full vertical height of my screen.
However, the result is not actually a frame of 91x63. Instead, I get a frame of only 51. Likewise, increasing 63 to 70 doesn't get me a taller frame either. Initially, I see the frame popup with the full screen height, but then it shrinks down to a much smaller size. I believe this may be related to the fact that I have a configured font face and font size and the frame size is taking effect before the font size is set. So when the frame size is initially set, the frame is too large to fit on the screen so the size is shrunk and then later the font face and size are set, but now there is enough room to grow the frame. Do I need to some how control the order of these settings? If so, how do I do that? Currently, I have the font face and size set in the custom-set-faces block. Is there a better way to change the frame size so that it happens after the font face is set?
By the way, this code came from the Emacs wiki on Frame Size.
This is under Ubuntu Linux, and I'm using the PPA for Emacs 24. I am not using any Xresources.
For reference, here's my custom-set-faces block:
    (custom-set-faces
     '(default ((t (:inherit nil
            :stipple nil
            :background "white"
            :foreground "black"
            :inverse-video nil
            :box nil
            :strike-through nil
            :overline nil
            :underline nil
            :slant normal
            :weight normal
            :height 95
            :width normal
            :foundry "unknown"
            :family "DejaVu Sans Mono")))))


texts: Make "text-scale-increase" increase font by one?

texts: Currently for me "text-scale-increase" and "C-X X-+" increase the font size by very high number- so it is either super big, or super tiny. How do I make it to increase it by 1?