texts: Search files by content using full boolean expressions

texts: Suppose I want to find all *tex files recursively from a given directory containing foo and bar but not doe. I am looking for something like helm-do-ag, but that doesn't seem to support the not operator. So is there anything like that which supports search queries with full boolean operations, i.e. something like: "find all tex files containing (apple AND orange) OR (banana and pear) not apricot".


texts:
Irony install server yeilds this error every time i try an installation. Clang requirements are all installed.

Can someone please help me out.

-*- mode: compilation; default-directory: "/tmp/build-irony-server-1.3.1/" -*-
Compilation started at Sat Jul  6 08:23:45

cmake -DCMAKE_INSTALL_PREFIX\=/home/aviik/.emacs.d/irony/  /home/aviik/.emacs.d/elpa/irony-20190703.1732/server && cmake --build . --use-stderr --config Release --target install
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at /usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake:581

(message):
  The imported target "clang_shared" references the file

     "/usr/lib/llvm-9/lib/libclang_shared.so.9"

but this file does not exist.  Possible reasons include:

* The file was deleted, renamed, or moved to another location.

* An install or uninstall procedure did not complete successfully.

* The installation package was faulty and contained

"/usr/lib/llvm-9/lib/cmake/clang/ClangTargets.cmake"

but not all the files it references.

Call Stack (most recent call first):
  /usr/lib/cmake/clang-9/ClangConfig.cmake:19 (include)
  src/CMakeLists.txt:4 (find_package)

-- Configuring incomplete, errors occurred!
See also "/tmp/build-irony-server-1.3.1/CMakeFiles/CMakeOutput.log".

CMakeOutput.log


texts: How define a function key in keychord/key-seq?

texts:
I have the following configuration for keychord:

(key-chord-define evil-normal-state-map "fk" 'evil-window-up)`

With the timing option, I'm still able to do some operations with the original f function, like find character k with f, after waiting 0.4 seconds. If I do fk inside 0.4 seconds, then he will go the adjacent window up.

Now I want to bind the keysequence f and f9 to do something.

When I configure this:

(key-chord-define evil-normal-state-map "f<f9>" 'evil-window-up)`

Then I get an error: (error: "Key-chord key must have two elements").

Another suggestion, to let keychord accept these keys?


texts: Are there TRAMP mode log files? If so, how to access them?

texts:
Having here some troubles with TRAMP mode and already set (customize-set-variable 'tramp-verbose 6 "Enable remote command traces") in .emacs file.

But main problem is that Emacs is stuck in TRAMP mode, and debug buffer can't be accessed.

Hangs while copying large files via scp to remote to local network, it hangs on Encoding in base64. Already set (setq tramp-inline-compress-start-size "800000000"), (setq tramp-copy-size-limit "800000000") and (customize-set-variable 'tramp-verbose 6 "Enable remote command traces").

Anyway there would be log files to access?


texts: how to move a line from one window to another?

texts:
I have two files open, shown in two windows.
Some lines in one file belong in the other file.
I could cut the line here, move to the other window, paste there, and come back. That's a lot of work with so many lines to go through.
There does not seem to be any existing command that would do the work, so how do I write an elisp function (or macro?), and bind it to an available key/chord, to do that?
This is similar to the problem solved by diff-mode and the like, but the files here are not related, so a diff doesn't make sense.
[edit 1]
very good point raised by @StarBug. I see several possibilities (a configuration variable?), listed from top to bottom: a. move at the top, b. move at point, c. move to 'same' line on screen, d. move to bottom.
[edit 2]
fixed the confusion between frame and window.


texts: Why does printf not work in Emacs octave-mode?

texts:
I've recently started using Emacs octave-mode and discovered that when using printf Emacs seems to block and I have to kill the execution of an Octave script with C-g.

I can reproduce that problem by having a file testprintf.m with just that single following line:

  printf("Test");

or, alternatively, more authentical:

  printf("Test: %d", 10);

Then, I execute this file with C-c C-i a (or, if you like, just that line with C-c C-i l) and I am seeing the mouse pointer turning into the waiting symbol signalling me that this Emacs command seems to hang. C-g terminates the command and allows further editing of the buffer. The  Inferior Octave buffer does not show any output during and after this action.

Converting printf into a disp statement works but I'd like to make use of the convenient C-style formatting, Octave offers. Also, the same printf command works when directly copied into the Inferior Octave buffer with the expected out. I am using GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11) and Octave 4.4.1. I have also tried it without my ~/.emacs with the same result, the mouse pointer turning into the waiting symbol.


texts: Activating the region without altering the mark ring

texts:
Setting the mark and moving point activates the region, which appears highlighted (assuming transient-mark-mode is enabled). Once the mark is set it's location is sent to the mark ring, thus changing it.

Is it possible to activate the region without altering the mark ring? I.e. making a selection as in other programs, such as your browser, to leave the region active and call other commands on it (kill, etc.).

The idea is to create a function to be implemented in new commands (something such as my-set-mark), not to change the default Emacs behavior for existing commands/functions.


texts: Tabs bar (for accessing windows/buffers) as a single, one-line bar

texts:
Is there a solution to create and manage window/buffer tabs on a single one-line tabs bar?

I tried Elscreen, but it creates an annoying bars all over the buffers.


texts:
I am refactoring legacy code. Looks like:

for (int i = 0; i < something.length; i++) {
    ....
    ....
    lots of code here
    ....
    if (a.good != b.bad) {
       ....
       ....  ....
       ....
       lots of code here
       ....
       if (foo.bar == spam.something && something else) {
           ....
           ....
           lots of code here
           ....
           I AM HERE SOMEWHERE.
           ....
       }
    }
}

What happens a lot is, I am at a point in code and all I can see is basically small portion of the code. So I have to scroll to get the global context.

       if (foo.bar == spam.something && something else) {
           ....
           ....
           lots of code here
           ....
           I AM HERE SOMEWHERE.
           ....
       }

What I would like to see is something like:

for (int i = 0; i < something.length; i++) {
    ...
    if (a.good != b.bad) {
       ...
       if (foo.bar == spam.something && something else) {
           I AM HERE SOMEWHERE.
           // code
       }
    }
}

I want emacs to collapse code between conditionals, loops and functions. If this happens automatically then that would be great. How can I do that?


texts: Registering a custom link protocol as an image

texts:
In org mode, is there a way to define how #+CAPTION: ... would work for custom link types? i.e, make org refer to them as images.

I created a custom link type called tex-fig (using org-link-set-parameters, as described here) that has custom behaviors when exporting to LaTeX and HTML, and I'd like to have figure captions for these tex-fig links.
Currently, just doing

#+CAPTION: caption caption
[[tex-fig:path/to/file.tex]]

doesn't work when exporting to either backend. How can I define caption/float behavior for custom link types?

I've searched for hours, and it seems that the caption is handled through element properties, which are inaccessible through the :export callback when defining links by org-link-set-parameters (as the callback is given only literal strings, not elements or positions in the document). What are the alternative ways?


texts:
I installed Emacs 25.1.2 on Windows 10 machine, then installed yasnippet library from Elpa. Copied all my snippets from Linux machine. But for some reason none of them work. When I open a file I get this error:

File mode specification error: (wrong-type-argument integerp nil)
[yas] Loading for `cperl-mode', just-in-time:
      (lambda nil (yas--load-directory-1
          (quote D:/me/.emacs.d/yasnippets/cperl-mode) (quote cperl-mode)))!
[yas] Loading compiled snippets from D:/me/.emacs.d/yasnippets/cperl-mode
while: Wrong type argument: integerp, nil

Maybe, something is wrong with installed library?


texts:
How do you get gtags working with Lua?
I want to be able to have same tags functionality for Lua like with C/C++, i.e. find definitions of functions, function references, symbol references, etc.
I have universal ctags and gtags on my system and tried the ctags and new-ctags options when doing ggtags-create-tags, but when I try using ggtags functions nothing happens on Lua functions & variables.


texts:
When I write lisp code that contains errors, I debug it with toggle-debug-on-error. Unfortunately, once a certain function triggers the debugger once, Emacs stops launching the debugger on errors in subsequent calls to that function, giving only a summary in the echo area instead.

Is there any way I can have the debugger always invoked on error?


texts: How is the key  defined; how to obliterate it; and how to create a new one from scratch?

texts:
Logos
Basically what I've been doing the past couple of weeks is trying to customize my keybinds one mode at a time; thus I've been going through each mode one-by-one and completely clearing its keymap individually. And then binding the functions that I find useful.
I'm also doing this for educational purposes to learn more about the inner-workings of keymaps, how they relate, how to manipulate them, etc.

But what has me stuck, is how some keys (or functions/macros; I'm not sure what they should be called) are defined. For example <backtab>, <C-return>, <C-tab>, <C-iso-lefttab>, etc.

I have unbound every function key in both function-key-map and local-function-map using the command: (setf (cdr <keymap>) nil)

But yet these keys still seem to persist in existence.

Perhaps I'm just confusing myself by trying to wrap my head around the multiple levels of abstraction all at the same time..

Question
So how would I completely obliterate these keys, so that I can start from first principles and create them myself (with their own custom names and functionality)?

Bonus Question
Why is it (define-key input-decode-map [?\C-i] (kbd "<C-i>")) creates an abstraction that interprets the keys C-i and <C-i> differently?
Control+i == C-i == ^I == TAB
Control+i == <C-i> != TAB
Does this perhaps have something to do with the paradigm shift of my thinking that needs to happen in order to better understand keymaps?

I think it would really help me and people in the future if someone could make a trivial and complex example in a format like this (assuming current major mode is text-mode):

keypress Control+Backspace ->
local-function-keymap Control+Backspace=<C-backspace> ->
text-mode-map <C-backspace>=nil ->
global-map <C-backspace>=backward-kill-word

UPDATE
I found that you can (kind of) obliterate the functions and then rebind them to their corresponding ASCII keys like so:

(setf (cdr x-alternatives-map) nil)
(setf (cdr function-key-map) nil)
(setf (cdr local-function-key-map) nil)
(define-key local-function-key-map (kbd "<tab>") [9])
(define-key local-function-key-map (kbd "<return>") [13])
(define-key local-function-key-map (kbd "<escape>") [27])
(define-key local-function-key-map (kbd "<backspace>") [127])

But even if I never rebind the keys, for some reason unbeknownst to me, the modifiers of the keys still work. So is there a keymap that I'm just not aware of?

if <tab> = undefined
C-<tab>  = defined


texts: Export alphabetical org lists as alphabetical html lists

texts:
This is a follow up to a previous question.

When exporting an alphabetically sorted org-list to html ((setq org-list-allow-alphabetical t)), the list is converted to a numerically sorted list.

Any ideas why that happens? Is there a way to change this behaviour?

Minimum org-file example:

A. this
B. is
C. a
D. test

And the (relevant part of the) resulting html:

this

is

a

test

Expected output:

this

is

a

test


texts: Stupid question, but: how to press C-( (this is a default bind in Prelude Emacs for Smartparens's sp-backward-slurp-sexp)? On my keyboard i have such bracket only in same key with 9.


texts: Has Emacs same tool as "screen" in Linux?

texts:
Linux Ubuntu, Emacs 26.1

I use tool "screen" in Linux. It's very comfortable.
Has Emacs any some kind of tool?


texts: How to use imenu with tsx (typescript and jsx) files?

texts:
I would like to use imenu with .tsx files, but it doesn't seem to work. imenu does work with other file types (I have tested with .el, .py, .js), but not with .tsx.
How can I get imenu to work with .tsx files?
By the way, I wouldn't mind if there is another solution to quickly viewing and navigating to definitions (functions, methods) in the file.


texts:
I have a file that I want to turn into a (local) package containing (inter alia) the code:

(defun tl-sort-regexp-fields (reverse record-regexp key-regexp beg end)
  "Extended sort function."
  (interactive "P\nsRegexp specifying records to sort: \nsRegexp specifying key within record: \nr")
  (if (string-match "\\`\\(?:-\\\\[1-9]\\|\\(?:-?\\\\[1-9]\\)\\{2,\\}\\)\\'" key-regexp)
      (let
          ((i (length key-regexp)))
        (while (> i 0)
          (let ((key-reverse (and (> i 2) (= (aref key-regexp (- i 3)) ?-)))
                (key (substring key-regexp (- i 2) i)))
            (sort-regexp-fields (if reverse (not key-reverse) key-reverse) record-regexp key beg end)
            (if key-reverse
                (setq i (- i 1)))
            (setq i (- i 2)))))
    (sort-regexp-fields reverse record-regexp key-regexp beg end)))

(dolist (i '(("Apples"  "^\\([-+ ]\\)\\([^\t]+\\)\t\\([0-9]+\\)\t.*$"                                            "\\2\\3-\\1")
             ("Bananas" "^\\([-+ ]\\)\\([0-9]+\\)\t.*$"                                                          "\\2-\\1")
             ("Oranges" "^\\([-+ ]\\)\\([0-9]+\\)\t.*$"                                                          "\\2-\\1")
             ("Pears"   "^\\([-+ ]\\)\\([^\t]+\\)\t\\([^\t]+\\)\t\\([^\t]+\\)\t\\([^\t]+\\)\t\\([^\t]+\\)\t.*$"  "\\2\\3\\4\\5\\6-\\1")
             ("Kiwis"   "^\\([-+ ]\\)\\([0-9]+\\)\t.*$"                                                          "\\2-\\1")))
  (fset (intern (concat "tl-sort-" (downcase (nth 0 i))))
        `(lambda (beg end)
           ,(concat "Sort region according to primary key of table " (nth 0 i) ".")
           (interactive "r")
           (tl-sort-regexp-fields nil ,(nth 1 i) ,(nth 2 i) beg end))))

This generates (one plus) five functions named tl-sort-apples, etc.

I can easily prepend ;;;###autoload to tl-sort-regexp-fields's defun to have it produce the proper autoload for tl-sort-regexp-fields, but how can I do the same for the "generated" functions while keeping the code DRY, i. e. not adding a ;;;###autoload (autoload 'tl-sort-apples […]) for every function?

If I prepend ;;;###autoload to dolist (on a separate line), the code is executed once when the autoloads are loaded and once when the file is loaded. If I prepend ;;;###autoload on the same line, i. e. writing:

;;;###autoload (dolist (i '(("Apples" "^\\([-+ ]\\)\\([^\t]+\\)\t\\([0-9]+\\)\t.*$" "\\2\\3-\\1") ("Bananas" "^\\([-+ ]\\)\\([0-9]+\\)\t.*$" "\\2-\\1") ("Oranges" "^\\([-+ ]\\)\\([0-9]+\\)\t.*$" "\\2-\\1") ("Pears" "^\\([-+ ]\\)\\([^\t]+\\)\t\\([^\t]+\\)\t\\([^\t]+\\)\t\\([^\t]+\\)\t\\([^\t]+\\)\t.*$" "\\2\\3\\4\\5\\6-\\1") ("Kiwis" "^\\([-+ ]\\)\\([0-9]+\\)\t.*$" "\\2-\\1"))) (fset (intern (concat "tl-sort-" (downcase (nth 0 i)))) `(lambda (beg end) ,(concat "Sort region according to primary key of table " (nth 0 i) ".") (interactive "r") (tl-sort-regexp-fields nil ,(nth 1 i) ,(nth 2 i) beg end))))

this would (only) define the functions when reading the autoloads (which in this case would probably be fine because the functions are short and few), but the code looks simply illegible and the solution not very universal.

What is the preferred pattern for declaring autoloads for "generated" functions?


texts: Tramp is operating on host filesystem instead of container filesystem

texts:
I'm using a slightly modified version of the usual docker tramp integration (below) which works fine to complete up to /docker:container_name: but where it goes wrong is it opens files on the host computer, and performs completion from the host file-system instead of in the container. Can anyone help me fix this?

(require 'tramp)
(setq tramp-verbose 10)

(push
 (cons
  "docker"
  '((tramp-login-program "docker")
    (tramp-login-args (("exec" "-it") ("%h") ("/bin/bash")))
    (tramp-remote-shell "/bin/bash")
    (tramp-remote-shell-args ("-i") ("-c"))
))
 tramp-methods)

(defadvice tramp-completion-handle-file-name-all-completions
    (around dotemacs-completion-docker activate)
  "(tramp-completion-handle-file-name-all-completions \"\" \"/docker:\" returns
    a list of active Docker container names, followed by colons."
  (if (equal (ad-get-arg 1) "/docker:")
      (let* ((dockernames-raw (shell-command-to-string "/usr/local/bin/docker ps | awk '$NF != \"NAMES\" { print $NF \":\" }'"))
             (dockernames (cl-remove-if-not
                           #'(lambda (dockerline) (string-match ":$" dockerline))
                           (split-string dockernames-raw "\n"))))
        (setq ad-return-value dockernames))
    ad-do-it))


texts: How to prevent a function being called multiple times? (locking)

texts:
With a function that calls an asynchronous process, it's possible to call the same function multiple times.

What is a reliable way to avoid this that properly handles quit and errors being raised?

Is there an lisp convention for how to handle this?

This is an example of locking function, I'm wondering if there are better ways to handle this (existing macros or conventions for e.g).

(defvar my-fn--lock nil)

(defun my-fn ()
  (unless my-fn--lock
    (unwind-protect
        (progn
          (setq my-fn--lock t)

          ;; Code body.
          (do-stuff))

      ;; Protected.
      (setq my-fn--lock nil))))


texts: How to perform incremental search inside math environments in tex/latex documents

texts:
Is there a way to perform incremental search that filters out all non-math environments (i.e., only searches within $...$, $$...$$, and if possible other relevant \begin{..}..\end{..} environments)?

Note: a similar question provided an answer without the incremental part.


texts: customize-face and themes bug: workaround?

texts:
I'm seeing the following issue with emacs 25.

I'm confident there must be a workaround for this because I'm in the process of rewriting my emacs configuration, and my old, ugly configuration with the same version of emacs does not have this problem.  Still, while with some effort I've been able to create a minimal failing case (see below), I've not yet been able to create a minimal working case.

Can anybody guess a workaround?  I suspect the problem is related to the fact that monokai-theme configures the whitespace-space face with some custom elisp.

(By the way, I'd like to report this as a bug but I'm not sure if it's a monokai-theme issue or an emacs issue: any pointers there?)

customize-face and monokai-theme don't seem to be getting along for me with emacs 25:

Create ~/.emacs.d/init.el as quoted below and ensure no ~/.emacs exists
Ensure ~/.emacs.d/custom-settings.el does not exist
Start emacs (I'm using the daily emacs 25 snapshots from https://launchpad.net/~ubuntu-elisp/+archive/ubuntu/ppa on ubuntu xenial)
Open init.el
M-x customize-face <RET> whitespace-space <RET>
Edit foreground colour and "Save for future sessions" (I had to edit the colour in monokai-theme's lisp code to do this: that lisp code appears in the customize UI)
All good in custom-settings.el: my customization appears there
Quit emacs
Start emacs
No errors in Messages (and custom-settings.el is unchanged), but whitespace-space text now looks the way it did before I customized it, so...
M-x customize-face <RET> whitespace-space <RET>
Edit foreground colour and "Save for future sessions" (this time, the foreground colour appears in the UI explicitly and the lisp code is gone)
This time customize reports state "THEMED"
init.el buffer STILL lacks my customization
On "Save for future sessions", custom-settings.el was reset to an empty state (and no I didn't hand edit it!)

here is the "empty state" custom-settings.el I refer to above:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

and here's the init.el:

(require 'package)
(setq package-enable-at-startup nil)
(setq custom-file (concat user-emacs-directory "custom-settings.el"))
(load custom-file t)
(setq package-archives
      '(("gnu" . "http://elpa.gnu.org/packages/")
        ("melpa" . "http://melpa.org/packages/")))
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(setq use-package-verbose t)
(setq use-package-always-ensure t)
(require 'use-package)

(use-package monokai-theme)

(use-package whitespace
  :init
  (global-whitespace-mode 1))


texts:
Is there a way to reflect the navigation commands in the current window in another visible window. I have two related LaTeX files displayed in two windows and would like to scroll through them simultaneously to get an overview of the differences. I currently use a macro to automate scrolling in one buffer, moving to the other window, and scrolling and then moving back.

Ediff has an inbuilt way of doing this in ediff-scroll-vertically bound to v , so I was wondering if emacs already has one built in. Ideally I would like a minor mode that mirrors navigation in all visible windows.


texts: Org-mode tell paragraph position in subtree

texts:
Is there a quick way to show where a paragraph is sitting in the document structure hierarchy?

* Chapter 1
...
* Chapter 5
** Section 4
...
paragraph X

I would like to tell that paragraph X is sitting under Chapter 5, Section 4 without having to navigate the cursor away from the text.


texts:
Today I went to the EMACS org wiki http://orgmode.org/manual/Setting-up-capture.html#Setting-up-capture

and copy/pasted this directly into my .emacs file

(setq org-default-notes-file (concat org-directory "/notes.org"))
     (define-key global-map "\C-cc" 'org-capture)

Now I'm getting this:

  Warning (initialization): An error occurred while loading
  ‘/home/kantuck/.emacs’:

  Symbol's value as variable is void: org-directory

  To ensure normal operation, you should investigate and remove the
  cause of the error in your initialization file.  Start Emacs with the
  ‘--debug-init’ option to view a complete error backtrace.

I also tried a fresh .emacs file in case of conflicts, and put only that into it, and still it's giving me that error.

Any idea what's going on?


texts: using global-linum-mode with ess with a latex/R knit file

texts:
When using global-linum-mode with a latex file that has blocks of R code (*.rnw file) moving in and out of the R code blocks cause the line numbers to disappear until the cursor is moved again. Is there a way to stop the disappearing line numbers or just to turn off the line numbers for *.rnw files, but not in pure LaTeX ESS files?

Using
Aquamacs 3.2
GNU Emacs 24.4.51.2
ESS-Version 15.09-2


texts: Retouching syntax highlight of major mode

texts:
I am writing a minor mode to complement haskell-mode,
and I am trying to color subwords in camelCased identifiers with slightly different shades of the same color.

Perhaps this can be done by "recoloring" identifiers, that is, running a hook which redefines the font-locking after the major mode does its work.

But I have no idea how this can be achieved.

Any ideas or references are very welcome!

Edit: @phil's suggestion is working for me, so in the interest of saving time, I am leaving the minor-mode project on hold for now.


texts: Why does emacs use both property lists and association lists?

texts:
http://www.gnu.org/software/emacs/manual/html_node/elisp/Plists-and-Alists.html gives some supposed differences between plists and alists. Basically it comes down to:

Alists can be used as stacks, where values are updated by adding a cons cell, allowing to restore previous values by deleting the topmost cons cell.
Plists are faster for storing information about symbols because they are typically short compared to storing everything (for all symbols) in a single alist.

The first point makes sense. While the implementation of plist-get allows using plists in such a stack-like manner, by adding new values with

(push VALUE PLIST)
(push KEY PLIST)

removing such a pair would be more involved compared to alists where one can just write

(setq ALIST (delete (assq KEY ALIST) ALIST))

though even that could be changed by defining a function for it.

The second point however seems incorrect too me, as the same advantage would apply for alists, if there was a symbol-alist function instead of symbol-plist. Additionally, in my experience plists are typically a bit slower than alists of the same size.

Hence I was wondering why emacs uses both conventions for storing key-value pairs, when using one would suffice.

Clarification Since it was raised in the comments: It seems largely a historical issue (emacs lisp was able to do both well, so people did both), but I'd still be interested in whether there was some rationale in the development of emacs to include builtin functions for handling both. Of course my view may be strongly colored by the Zen of Python (13th line) here to even raise the question.


texts: Search forward for the FIRST space character and stop there

texts:
I recently upgraded from Windows Emacs 19.x to Windows 26.3.1 and have a problem.

in the old version 19 if I did a search forward for a space, (C-s) it skipped forward to the FIRST space character and stopped there.  If I typed a second space character, the search became a search for two space characters in a row, and would find the first instance of two spaces, and point to the second character.  I have dozens of functions and macros which depend upon this operation and now none of them work.

What I'm seeing with version 26.3.1 is that when I search for a space, if it finds multiple spaces in a row, it positions on the LAST space, which is (1) not what I want and (2) really strange behavior and (3) breaks all my functions.

I need the behavior for any and all forward searches in any and all files to be to find the first instance and STAY THERE and NOT move to the last of a series of characters, whitespace, etc.

How do I disable this "feature" where it skips to the LAST of a series of characters, and go back to the way Emacs used to work?  Is there something I can put in the default.el file (yeah, another great change I found out about the hard way) so that for EVERY file I open the operation is to find the first space?


texts: Fancy splitting in gnus based on subject of message

texts:
I'm trying to write fancy split that puts any message with "[foobar]" in the subject into a specific folder but nothing seems to work.

I have:

(setq nnimap-split-fancy '(|("subject" "\\[foobar\\]" "INBOX.foobar")
                          (...))
                          "default")

but it still ends up in the "default" mailbox.

If I change the regexp to just "foobar" it works (but then it matches other messages I don't want included). I think it's something to do with the escaping of the brackets. I've tried a couple of different of variations of escaping but there's something I'm missing. Or maybe I'm not fancy enough.


texts: Python for set globals()[''] variables having undefined name warning message

texts:
I am using flycheck for for Python. For global files that I set using ( globals()['variable']), and later used, it gives the following warning message: undefined name <variable> [F821]
Example:
globals()['var1'] = "hello_world"
print(var1) # undefined name 'fID' [F821]

It underlines and colors it with red color.

Added lines to .emacs
(require 'flycheck)
(add-hook 'after-init-hook #'global-flycheck-mode)
(setq-default flycheck-flake8-maximum-line-length 160)
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
(setq flycheck-emacs-lisp-load-path 'inherit)


texts: White space being inserted before a semicolon in asm-mode

texts:
When I try to insert a semicolon in my code (in asm-mode) it seems to indent a certain number of tabs like this (usually 4 it seems):

D               ;

And if I put another semicolon on the next line it will indent one tab so it looks like this and add another semicolon even though I only pressed it once:

D               ;
    ;;

I am sure this is some helpful auto-complete technique, but I am just trying to do commands with a semicolon inside of it like 0;JEQ but since I am an Emacs noob I don't know where to look to deactivate this. I searched with different queries looking for this problem, but I am having trouble finding it which is weird since everything else I looked up was easily answerable either from the Emacs manual or some other site. Can anyone point me to which option I can change so no white space is inserted?

Edit:
Here is what option I changed my comment button to:

Is this correct? Basically, I just deleted the comment char which was ";" to what it is now which is "/", but like I say the same problem happens where when I press the semicolon key I get a slash instead and my slash key still gives me a slash.


texts: A screenshot that links to a page from PDF

texts:
Suppose that I have a link to a screenshot of part of a PDF page in an org buffer. How can I change the behavior of the link so that, when the displayed inline image is clicked, instead of opening the image file, the PDF file from which the screenshot was taken would be opened?

One possible direction I thought about was to define my own link type, which would encode both the image's and the PDF's file names and the page number in the PDF, something like pdfscreenshot:image-file-name--pdf-file-name--page-number. I would then be able to define its :follow action to open the required page of the PDF. However, how will I cause this link to behave as an image link, such as being displayed when org-startup-with-inline-images is set?


texts: How to run sudo commands using shell-command?

texts:
When I run any sudo command using shell-command—for example, (shell-command "sudo ls")—I get the following error:

sudo: no tty present and no askpass program specified

How can I get around this? I'm guessing it should be possible to tell Emacs somehow what my askpass program is?

By the way, the correct askpass program is currently stored in the environment variable $SSH_ASKPASS.


texts:
The unix tree command gives a very good overview of the project/dir structure. Even Windows has its own version of tree.

When I run tree command in eshll on Windows, I got this error:

$ tree
Spawning child process: exec format error

It seems that eshell doesn't support the system (Windows) command. What should I do? Or is there any implementations for eshell?


texts: open the shell buffer in the same frame as compilation buffer -- C compilation

texts:
I'm regularly compiling some C programs and one thing is annoying : after I've compiled, I'm opening a shell with M-x shell ./foo, but the shell open in place of the source code's window.
I would like the shell buffer to open in place of the compilation window, which I don't really need anymore. Otherwise, it's an overkill.

I've read about this topic open buffer in a specified frame but my emacs lisp competence are not that great and I can't adapt it to my case.

Thanks in advance! I guess I'm not the only one it can help.

EDIT

I've added a screenshot to make things clearer.
Let's call the above window "A" and the below "B". When I call the shell, i.e M-x shell (I rather use M-x term but that the same here), A has the focus, which is probably the reason why the shell window open in place of A. I want it to open in place of A (originally the compilation window).


texts:
I want to track my cash flow and growth in text files.

Here is the sample table and formula.

Networth = sum of all accounts
Growth = previous month networth - current month networth
Growth % = Growth / prev. month networth

I am planning to simply append a column for every month.

    | Accounts    | June 2019 | July 2019 |
    |-------------+-----------+-----------|
    | cash        |       100 |       110 |
    | stocks      |       200 |       205 |
    | gold        |        10 |        10 |
    | Liabilities |       -20 |        -5 |
    |-------------+-----------+-----------|
    | Networth    |       290 |       320 |
    |-------------+-----------+-----------|
    | Growth      |           |        30 |
    | Growth %    |           |      10.3 |
    #+TBLFM: <what should I put here?>

What TBLFM should I use?


texts: emacs font/theme issues in osx (cocoa client)

texts:
My emacs configuration seems to be causing a strange issue where the frame font is changed to a non-monospaced font whenever I disable the first theme that was loaded.

Because I run emacs from the command line as a daemon and connect using emacsclient, I have to use an after-make-frame hook to set the font/theme (setting these during daemon start has no effect).

EDIT: I have isolated the code that is causing the problem:

(package-initialize)

(defun set-my-font-for-frame (frame)
  (interactive (list nil))
  (set-frame-font "Monaco for Powerline-12" nil t))

;; This is needed because you can't set the font at daemon start-up.
(add-hook 'after-make-frame-functions 'set-my-font-for-frame)
(add-hook 'after-make-frame-functions (lambda (frame) (load-theme 'solarized-dark t)))

If I run emacs with the above code and then disabled the solarized-dark theme, the frame font is changed.


texts: Org-mode spreadsheet time diff elisp formula or GNU Calc

texts:
I wish to substract from a start time an end time in my org-mode spreadsheet. My times strings look like this (only the inline code):

starttime: 9:42 or 09:42
endtime: 18:20

So it's 24h format.

I wrote the following functions in my init.el:

;; TIME TRACKING

;; NOTE: The following functions are used for time tracking in
;; org-mode spreadsheets! That is why they might be a bit specific.
(defun fill-time-tuple (time-tuple fill)
  (mapcar (lambda (x) (or x fill))
          time-tuple))

(defun seconds-to-hours-and-minutes (seconds)
  (let ((hours (/ seconds 3600)))
    (let ((remaining-seconds (- seconds (* 3600 hours))))
      (let ((minutes (/ remaining-seconds 60)))
        (list hours minutes)))))

(defun time-tuple-diff (time-tup-start time-tup-end)
  (truncate
   (float-time
    (time-subtract (apply #'encode-time (fill-time-tuple time-tup-start 0))
                   (apply #'encode-time (fill-time-tuple time-tup-end 0))))))

With this, I evaluated the functions and also restarted Emacs, to make sure the functions are defined. However, the following table still gives an error, when I try to make use of the functions:

| _ |       | starttime | updatetime | endtime | spenttime |
| # | times |      9:28 |      18:20 |    9:10 | #ERROR    |
#+TBLFM: @2$5=$updatetime::@2$6='(seconds-to-hours-and-minutes (time-tuple-diff (parse-time-string $endtime) (parse-time-string $starttime)))

Specifically, if I debug:

Substitution history of formula
Orig:   '(seconds-to-hours-and-minutes (time-tuple-diff (parse-time-string $endtime) (parse-time-string $starttime)))
$xyz->  '(seconds-to-hours-and-minutes (time-tuple-diff (parse-time-string 9:10) (parse-time-string 9:28)))
@r$c->  '(seconds-to-hours-and-minutes (time-tuple-diff (parse-time-string 9:10) (parse-time-string 9:28)))
$1->    '(seconds-to-hours-and-minutes (time-tuple-diff (parse-time-string 9:10) (parse-time-string 9:28)))
Result: #ERROR
Format: NONE
Final:  #ERROR

My guess is, that somehow the functions I defined are not available to spreadsheet calculation.

This is my guess, because the code actually works inside a source block:

#+BEGIN_SRC elisp
(seconds-to-hours-and-minutes
 (time-tuple-diff
  (parse-time-string "10:30")
  (parse-time-string "09:20")))
#+END_SRC

#+RESULTS:
| 1 | 10 |

How can I get my functions working for the spreadsheet formula evaluation?

Alternatively I could live with a simple GNU Calc formula to substract times. That is what I was initially looking for, but could not find. Then I switched to "OK I'll write an Elisp formula then!"


texts: Convert regexp list so that each member has word boundaries

texts:
I have several lists with regexp matching categories of file extensions:

(let* (
    (txt-regexp '("txt" "md" "log" "org" "conf" "rtf"))
    (el-regexp '("el" "lisp"))
    (tex-regexp '("tex"))
    (pdf-regexp '("pdf"))
    (image-regexp '("tif" "bmp" "jpg" "png" "gif"))))

I would like to match only extensions with word boundaries -- e.g., \\btxt\\b for file extensions ending in txt.  However, I would like to avoid writing every file extension with \\bname-of-extension\\b.  An example of how to convert each category of lists into extensions with word boundaries would be great:

Example:

(txt-regexp '("txt" "md" "log" "org" "conf" "rtf"))

would be converted into

(txt-regexp-modified '("\\btxt\\b" "\\bmd\\b" "\\blog\\b" "\\borg\\b" "\\bconf\\b" "\\brtf\\b"))


texts: Encoding in buffers not associated with files

texts:
I use Magit to manage Git repositories.
Some of these repositories have collaborators whose names contain accented characters.
In a freshly-started Emacs, everything looks fine.
In a long-running Emacs process, such accented characters eventually start being rendered incorrectly.
These characters appear in a magit buffer

which is not associated with a file
in a special portion of the buffer which is not accessible with the usual Emacs navigation commands, search commands, etc.

How should I go about understanding and fixing this problem?


texts: What are the differences between helm-ag and helm-do-ag from a user perspective? I see that helm-do-ag shows the results immediately and helm-ag not. But are there other differences and when is it better to use helm-ag instead of helm-do-ag and vice versa?


texts: linum-mode not working in OSX built in emacs version 22.1.1

texts:
I'm running emacs through my terminal on OSX and was trying to get my line numbers on here. Ran the command M-x linum-mode with a [No match] result. Tried global-linum-mode, same result.

emacs --version shows GNU Emacs 22.1.1.

Is this just not a supported feature for 22.1.1 or is there something I don't know about when running emacs via OSX terminal?


texts: Schedule repeating Org event for day of month

texts: Is it possible to schedule something in Org for the 2nd Sunday of every month, or some criteria like this?


texts: How to hide TODO state and Priority in org-agenda-custom-command?

texts:
I do not want TODO states ("TODO, DONE") and priorities ("[#A]") for tasks to be displayed in one of my custom agenda views. I have not been able to find any settings that would accomplish this. Is there any way this can be achieved?

Ideally, I would like to be able to toggle the visibility of TODO states and priorities separately.


texts: How to do date calculations in org-mode tables

texts:
I would like to enter a date (as active or inactive timestamps) in column 1 ( eg [2020-02-02 Sun] ) and a number of days in column 2 ( eg as 5d for 5 days) and then let something like:

#+TBLFM: $3=$1+$2

calculate the resulting date after adding the days of column 2 to the date in column one. What I get as a result in column 3 is

 [2020-02-02 Sun] + 5 d

Any idea how I can get instead someting like

[2020-02-07 Fri]


texts: In org-mode how to break current section and escape to upper level

texts:
In org-mode, normal hierarchy goes like :

* Section 1
  Content of section 1

  ** Section 1-1
     Content of section 1-1

  ** Section 1-2
     Content of section 1-2

As I understand it, everything after a header belongs to that section until it meets another (higher or lower) header.

But is it possible to break the current section without using another header, and to continue the content of the previous section? Something like :

* Section 1
  Content of section 1

  ** Section 1-1
     Content of section 1-1
  ** Section 1-1 end

  Content of section 1 continues ...

  ** Section 1-2
     Content of section 1-2
  ** Section 1-2 ends

  Content of section 1 continues ...


texts: Debugger entered--Lisp error: (invalid-read-syntax ")") read(#)

texts:
Launch Emacs using runemacs --debug-init and the following error occurred. any idea on how to locate the file/script of the error or how to fix it?  Thanks in advance.

Debugger entered--Lisp error: (invalid-read-syntax ")")
  read(#<buffer  *load*>)
  eval-buffer(#<buffer  *load*> nil "c:/Users/user/.emacs" nil t)  ; Reading at buffer position 1709
  load-with-code-conversion("c:/Users/user/.emacs" "c:/Users/user/.emacs" t t)
  load("~/.emacs" t t)
  #f(compiled-function () #<bytecode 0x1000be22d>)()
  command-line()
  normal-top-level()


texts: Get current time zone in IANA time zone format (a.k.a. Olson format)?

texts: I know that current-time-zone can be called to obtain the current time zone. On my system, this returns (-25200 "PDT"). However, I would like to get the current time zone in IANA format, which for me would be "America/Los_Angeles". Is there a way to do this from Emacs? On Unix-based systems, I can read the current target of the symlink /etc/localtime, as explained in https://unix.stackexchange.com/a/451925. However, is there a more Emacs-native way to do this?


texts: Using `emacsclient` as `git config core.editor` and invoking `git commit` as `shell-command` in Emacs?

texts:
I am trying to use Emacs 25.1.1 (graphical version, Windows 10) as both the primary editor and the editor for git operations.

In my workflow, I invoke git through M-x shell-command.

I tried the following two options so far:

git config --global core.editor "emacs -Q"

With this, M-x shell-command RET git commit works just fine, as a new light-weight instance of emacs is used.

Downside: Completion with M-/ aka dabbrev-expand is less useful than it could be.
git config --global core.editor "emacsclient --no-wait --create-frame"

With this setting, trying to execute git synchrnously as
M-x shell-command RET git commit
on the other hand causes the emacsclient and server emacs processes to hang indefinitely, until `emacsclient is killed, while the asynchrnous invocation
M-x shell-command RET git commit &
works, but this setup is too brittle, as forgetting the & causes Emacs to all but crash.

Is there some way to use emacsclient as git editor, that is compatible with M-x shell-command?


texts: Simultaneously compiling two or more projects with Compilation Mode

texts:
I haven't found a way to use Compilation Mode in two projects simultaneously.  Starting compilation in a second project kills the compilation of the first.

Is it possible to run two compilations simultaneously, perhaps with separate buffers *compilation* and *compilation<2>?

I'm compiling with command helm-make-projectile: https://github.com/abo-abo/helm-make
What I'm describing may not be a limitation of Compilation Mode but rather helm-make-projectile.


texts:
When I C-s I can search. How should I do a function which I could bind for example to C-r which would let me search in the results of some predefined search query?

Like contents of window would be:

function xyz(a, b)
  return a + b
end

I can C-M-s with function.* as a query and the result will be function xyz(a, b).

I want to have a function where I could enter a query and search in those results(which would be generated behind my eyes automatically).

UPDATE

Thank you all for the solutions. occur, helm-occur also works very well, but I have accepted Jordon Biondo answer because he provided the code I needed to answer my question fully.


texts:
Is there a straightforward way to make all text with a given face invisible? I don't believe I can make invisibility be intrinsic to the face, but can I perhaps specify a minor mode that makes sure all appropriate text is invisible?

By "invisible" here I mean the text works as if you'd set the invisible property, so the text in question doesn't even take up an horizontal space.


texts: How can I change the behavior for python-shell-send-buffer?

texts:
I am using the default python.el python-mode for my Python development in Emacs. When I run the command python-shell-send-buffer with C-c C-c, it prompts me by default with:

Run Python: /usr/bin/python -i

I would like this to default to /usr/bin/python3 without the -i option. Is there a variable where I can set for the path that shows up for the python-shell-send-buffer command? I have looked through the completions for python-shell- but couldn't find what I am looking for. Thank you!


texts: Prevent org-mode from swallowing file-local variables

texts:
It is sometimes convenient to define file local variables with
comments such as the following, which must be at the end of a file.

# Local Variables:
# fill-column: 80
# End:

However, in org-mode buffers, this comments are considered to be
“inside” the very last headline. For instance, in the following
buffer, the comments will be hidden whenever subtrees C or B are
hidden.

* A
* B
** C

# Local Variables:
# fill-column: 80
# End:

I don’t really mind this hiding.
The real problem is that the comments will get carried along whenever I move the C subtree somewhere else.
For instance, if I call org-refile on C, or if I move it around
with org-metaup (and the likes), the comments are moved along with
the subtree, and then they obviously stop working.

Is there a way to tell org-mode to stop doing this?


texts: How do I get HTML/CSS-stylized pandas dataframes in Emacs Ipython Notebook?

texts:
How can I see pandas dataframes (or series) as html-formatted tables in EIN? I'd like them to look like they do in the browser version of the notebook.
what I see in EIN:

What I'd like to see in EIN but can only see in browser version:


texts: How to remove line breaks but retain paragraphs

texts: I have fill-column set to 75 by default and use fill-paragraph to insert line breaks in the paragraphs of text that I write. On certain occasions though, I need to remove the line breaks but want to retain the spacing between the paragraphs. Up until now I used to set fill-column to a very large number, then filled the entire selected region, and then went back to the default 75. Is there a better way to do this?


texts: Display all local variables within a edebug session

texts:
When using edebug one can get a local variable by command describe-variable (C-h v), but are there any ways to display all local variables?

For example in Python you can call locals() in a pdb session, which returns all the local vars in dictionary. Does Elisp have a similar function?


texts: Disable scroll inertia in Emacs for macOS (Sierra)

texts:
The title pretty much sums it up, I'd like to avoid that the scroll continues when I release the touchpad. Here's my custom variable about the mouse wheel behaviour:

'(mouse-wheel-scroll-amount '(1 ((shift) . 5)))
'(mouse-wheel-progressive-speed nil)

To be honest, I'm not sure whether this is is actually inertia or the scroll operations stack up and get executed with some delay hence causing the effect.

The behaviour is observed with emacs -q as well.


texts: Why does local-key-binding return a 1 for a key with no local binding

texts:
When I evaluate (local-key-binding key) for any arbitrary key that does not have a local binding, I expect a return value of nil, but I almost always get a 1.  If the key actually does have a local binding (say from a major mode) in the current buffer, then local-key-binding behaves as expected and returns the function to which the key is bound.

My question then, is why does local-key-binding often return 1 when there is in fact no local binding for the given key?

As an example, after opening emacs with emacs -Q, type

(key-binding (kbd "C-h h"))
(local-key-binding (kbd "C-h h"))

in the scratch buffer and evaluate each of the forms. Notice that key-binding returns view-hello-file, and local-key-binding return 1.  The binding for C-h h is defined globally, not locally, so I expect local-key-binding to return nil.  Now try

(local-set-key (kbd "C-h h") 'describe-bindings)
(key-binding (kbd "C-h h"))
(local-key-binding (kbd "C-h h"))

and evaluate each of the forms.  Notice that both key-binding and local-key-binding return describe-bindings.  Now try

(local-unset-key (kbd "C-h h"))
(key-binding (kbd "C-h h"))
(local-key-binding (kbd "C-h h"))

and evaluate each of the forms.  Notice that key-binding has gone back to view-hello-file, and local-key-binding now shows nil.


texts: How to always display inline images by default? Existing solutions don't seem to take effect

texts:
I'm trying to always display inline images in my org mode files.

I have images inserted as [[my-image.png]].

What I have already tried:

Set startup variable (see this answer:

(setq org-startup-with-inline-images t)

Set inline config (see this comment):

(setq org-display-inline-images t)
(setq org-redisplay-inline-images t)
(setq org-startup-with-inline-images "inlineimages")

None of the two above (or any combination of) work. When I open the file, I always see the text [[my-image.png]] instead of the image. Using C-c C-x C-v works but I need to do it every time.

I have actually another related problem which is I can't set visual-line-mode by default at startup either. Maybe I have an issue with my org-mode settings? I can't figure out what is causing these issues.


texts: [Solved]org-mode failing to export to html "Undefined Org macro: comment; aborting"

texts:
I copied my old org-mode file to a new Debian 9.x machine and it appears I may have missed something.

When I try to C-c C-e h h I see the following error

Undefined Org macro: comment; aborting

my previous setup did not have any Macros configured and I cannot seem to find this exact error looking around.  Previously I have never experienced an error in the export however the previously machine was Debian 8.x

I learned that html export works with other org files except the one that I want.

Am I missing something obvious?


texts: Can a function or macro specify byte-compiler warnings?

texts:
I'm writing a function which, in principle, takes an arbitrary number
of arguments. In practice, however, it should only ever be passed an
even number of arguments, and will produce undesirable results
otherwise.

Here's a dummy example for context:

(defun my-caller (&rest args)
  (while args
    (call-other-function (pop args) (pop args))))

When an elisp file is byte-compiled, the byte-compiler throws a
warning when it sees a function being invoked with the wrong number of
arguments. Obviously, that's never going to happen with my-caller,
since it's defined to take any number.

Still, maybe there's a symbol property I can set, or a (declare) form I can
add to its definition. Something to notify the user that this function should only be given an even number of arguments.

Is there a way to inform the byte-compiler of this restriction?
If not, Is it possible with a macro, instead of a function?


texts: Why does GNU Emacs use ksi(ξ) as its logo?

texts:
Why does GNU Emacs use ksi(ξ) as its logo, while most Lisp dialects use lambda(λ) as their logos?

not mean this one:


texts:
So, after adding fallowing line in to my .emacs file I see no result, whether I'm running emacs in the X window or an terminal.

(custom-set-variables
 ;;; CUSTOM-SET-VARIABLES INSTANCE
 ;; Init file should contain only one such instances.
 ;; If there is more than one, they won't work right.
 '(custom-enabled-themes (quote (misterioso)))
 '(scroll-bar-mode nil)
 '(tooltip-mode nil)
 '(tool-bar-mode nil))

I been trying this pretty long time ago and I still see no explanation to where I could make an error in this short line ('(tooltip-mode nil)). The emacs debug shows no errors, every thing else runs well in my .emacs file and that tool-tip is turning me mad covering the top of my small laptop screen. If that helps, I'm running Emacs 24.5.1 on Debian 9.

SCREEN:


texts:
windows 10 (64 bit), emacs 26.1

I try to connect by Tramp mode from Windows to remote Linux machine.

I use this command:

C-x C-f

and then ip of remote machine (ip address):

 /xxx.xxx.xxx.xxx:

but I get error:

Error running timer: (user-error "Not a Tramp file name: \"/xxx.xxx.xxx.xxx:\"")


texts: org-babel evaluation of code block always creates new window

texts:
Running org-ctrl-c-ctrl-c to evaluate a src block in an org file behaves strangely with windows. With a single window in the frame, it spawns a new window looking at the same buffer in a split and moves focus into the new window. When I have two or more windows open, eval-ing still moves focus to the furthest (last created) window.

What could be causing this, or how should I troubleshoot it?

Env info:

GNU Emacs 25.0.50.1 (x86_64-apple-darwin15.0.0, NS appkit-1404.00 Version 10.11 (Build 15A282)) of 2015-09-27

Org-mode version 8.3.2 (8.3.2-10-g00dacd-elpaplus)

This behaviour occurs with no other config on emacs -Q and loading only org-mode.


texts: Can I alias a language for org-babel SRC blocks?

texts:
I've got a new language I'm working on that I'm documenting in an Org file.  Code samples for this language can be written in lisp-mode, but I want to use the new language's name for the SRC blocks for when I eventually write an Emacs mode for the language.

How can I alias #+BEGIN_SRC my-new-lang to open in lisp-mode?


texts: Changing the default binding to open a link in an org mode file using RET

texts:
To open a link in an org-mode file one normally types C-c C-o. I find this rather cumbersome. I would like to rebind the command org-open-at-point to RET but only when the cursor rests on the link.
I am not using evil.


texts:
As per the Google style guide (but this is a generally recognized as good practice) the CSS declarations should be sorted within rules blocks.

So given the following code:

.ruleOne {
  width: 40px;
  text-align: center;
  background-color: blue;
}

 .ruleTwo {
  position: relative;
  width: 40px;
  background-color: red;
}

What would be a good way (keyboard macro, defun, etc.) to end up with this?

.ruleOne {
  background-color: blue;
  text-align: center;
  width: 40px;
}

 .ruleTwo {
  background-color: red;
  position: relative;
  width: 40px;
}


texts: Helm completion no longer used for M-x or find-file

texts:
Tonight I started Emacs, and helm-mode is no longer used for certain actions. So far I have found that, for me, M-x and find-file don't use helm anymore, which they have since I first started using helm. I can clearly see Helm displayed in my mode-line, but when I hit M-x or C-x C-f, Helm disappears from my mode-line.

For me these have always worked automatically, I haven't configured these commands to use helm explicitly. Other commands continue to use helm, e.g., describe-variable and describe-function still use helm for completion.

Normally, I would assume that I messed up my configuration file or that an update to helm changed something. However, all my configuration files are under version control, and nothing has changed. Also, I think I might have updated helm yesterday through MELPA, but I can't imagine that I would have gone all day without using find-file or M-x without noticing that they had changed. Also, on the helm github page, I cannot see any indication that these things have been changed recently.

Starting Emacs with the -Q option to bypass my init file, activating packages with package-initialize and running M-x helm-mode to activate helm gives me the same results: helm completion is used for e.g., describe-variable and describe-function, but not for M-x or find-file other commands might be affected as well, but this is what I have found so far. Is anyone else experiencing this behavior? Does anyone know what is going on?

To be clear, helm-find-files and helm-M-x commands still work, so I could bind them to C-x C-f and M-x, but I am curious what happened, to the previoius behavior.


texts:
I use Emacs for Android development and this has been bugging me lately.

I'm trying to get the following indentation behaviour:

submitBtn.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View v) {
    submitEnquiry();
  }
});

and with my current setup I'm getting this:

submitBtn.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      submitEnquiry();
    }
  });

Quite a specific case I know, but one that I'm running into very often. I'm using Emacs 24.4 and I'm only modifying c-basic-offset in my java-mode-hook at the moment.


texts: Symbol's function definition is void: rtags-enable-standard-keybinding

texts:
I have just started using emacs and I wanted to setup RTags.

Looking at the Usage section int the github repo here, I added the following line to my config

(rtags-enable-standard-keybindings c-mode-base-map "\C-xr")

On starting emacs I get the following error

  Symbol's function definition is void:rtags-enable-standard-keybindings

I searched for configs and all of them seem to use the same.

My configs are as follows

(add-to-list 'load-path "/home/user/emacs_packages/neotree")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)

(add-hook 'after-init-hook 'global-company-mode)
(add-hook 'c++-mode-hook 'company-mode)
(add-hook 'c-mode-hook 'company-mode)
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 2)

(setq rtags-completions-enabled t)
(eval-after-load 'company
  '(add-to-list
    'company-backends 'company-rtags))

(setq rtags-autostart-diagnostics t)
(rtags-enable-standard-keybindings)
(rtags-enable-standard-keybindings c-mode-base-map "\C-xr")


texts: Show custom key-bindings in the list of commands

texts:
I'm using merlin in Emacs, and in my init.el file I have the following :
(global-set-key (kbd "C-c t") 'merlin-type-expr)

But when I press M-x and type merlin to show the list of commands (via helm), some have shortcuts assigned to them, but not merlin-type-expr, even if the shortcut works.
You can see that here : https://imgur.com/a/1Jr2Ttr
What should I do in order to see it? (if it is possible).
I'm using emacs 26.3 with helm and merlin.


texts: Is there a way to call M-x my-org-babel-block?

texts:
I have a named org-babel source block like this:
#+NAME: my-org-babel-block
#+BEGIN_SRC elisp :results output
(print org-babel-load-languages)
#+END_SRC

Is there any way to call this block with M-x my-org-babel-block?


texts: Usually when I start to do something, then call org-clock-in on task in Org Mode. Sometimes when changing tasks I forget to call org-clock-in. How can I make org-clock-out for the current task and org-clock-in for the following with a custom time?


texts: How to match more than one instance of a single subexpression?

texts:
I'm trying to use a regular expression of the form "foo\\(?:\\(bar\\)\\(baz\\)\\)*\\(quux\\)", but I want the inner two subexpressions to retain all of their matches, not just the first one.  I realize this may be impossible to achieve as stated, so I'll give more detail about why I want this to work.

My specific case is that I'm trying produce a major mode for editing and highlighting Dwarf Fortress "raw" files.  The regular expression I'm having this trouble with is

"\\(\\[\\)\\([_A-Z]+\\)\\(?:\\(:\\)\\([^][:]*\\)\\)*\\(\\]\\)"

, which successfully matches a single complete raw tag with all of its parameters; however, capturing groups 3 and 4 only end up containing the last parameter (after having successfully matched all the previous ones), and therefore all but the last parameter is not highlighted by font-lock.  I understand why this is the case, but I'd like to know if there is a way to get around it, or to otherwise enable my desired behavior.


texts: How does priority work with multiple checkers in Flycheck mode?

texts:
I have multiple syntax checkers installed for Flycheck (specifically javascript-eslint and javascript-standard).

The way I have them set up is not compatible (one demands semicolons, one prohibits them etc.) and my question is how does flycheck pick which one to use?

Currently their "predicate"s are both found and they are both enabled.

The only way I have found to make sure standard is used, is to disable eslint in my .emacs and close and reopen emacs.

Additionally, once I have done that, disabling standard and enabling eslint doesn't appear to do anything (even very obvious errors are not flagged).

Could I have some help on how to quickly switch between the two modes (or at least switch after visiting a buffer) and how to tell which checker is currently active?


texts:
I've read the documentation about customizing but I think my knowledge of Lisp is limiting things a bit. I want to bind a in command mode to move-beginning-of-line and QWERTY q (Dvorak) to move-end-of-line. I tried adding this to my init file:

(define-key xah-fly-key-map (kbd "a") 'move-beginning-of-line)

And, as in "Xah Fly Keys Customization" documentation:

(setq my-nice-keymap (make-sparse-keymap))
(define-key my-nice-keymap (kbd "a") 'move-beginning-of-line)

But none of this worked for me, a in command mode stills gives me the same as M-x. Any suggestion?


texts:
I can't seem to get abbrevs working in ess-mode when editing .R files.

I have ess-mode hook to activate abbrev-mode, but I get no expansion for my global abbrevs.

When I do add-mode-abbrev I can add an abbrev, but it is not written to my abbrev file and of course doesn't get ever expanded (after read-abbrev-file or restart).

If I by hand add something like this into my abbrev file and reload:

(define-abbrev-table 'ess-mode-abbrev-table
'(
    ("-=" "<-" nil 0)
))

it doesn't work either.

How can I make ess-mode aware of my abbrevs?


texts:
One way to look into the source code of any function in Emacs is to use the M-. (find tag). When I do this in Windows platform Emacs 24 I get Find tag: in the minibuffer asking to enter the name of a function like for example, forward-paragraph function I don't get any. It seems there is no TAGS file there. When I wanted to create one, using M-x compile RET etags *.el RET, of no avail. Can you pls help me figure out what is the right way to get TAGS file in Windows?

Update
I managed to make TAGS file in c:\GNU Emacs 24.3\ from Windows Terminal: etags -o c:\GNU Emacs 24.3\TAGS c:/GNU Emacs 24.3/lisp/*.el. After some googling, and the -o option is to tell where to write the generated TAGS file (destination). But, first as nanny pointed out, this should be run where etags.exe file resides. So I ran this from the c:\GNU Emacs 24.3\bin\. My questions:

Where to put the TAGS file, what is the best practice?
Why pressing M-.: find tag, then asks about table tags and I should point out to same dir where TAGS is, that is too much, how to make emacs automatically recognize TAGS?
Even after finding TAGS by emacs, the function forward-paragraph was not among the  completion items? How to cover all .el files given a default dir structure of Emacs in Windows platform?
I found beside etags  there is exuberant ctags, which one is better in Windows?


texts: Why do we have [:word:] but not [:symbol:]?

texts:
I'd like to use [[:symbol:]]+ in a regular expression but this does not exist in Emacs, see ad-hoc section in the manual.

Q1: what is the rationale behind this? I'm always happy to understand the design decisions that gave us the beautiful beast that is emacs.

Q2: is there something that works like [:symbol:] would? At the moment I use ugly handmade regexes like [[:word:]_+=], listing just a few specific symbols that I know will occur in my application.


texts: How to write a hook to transform each image reference on export?

texts:
This question
https://emacs.stackexchange.com/a/27065/13217 explains perfectly how to embed base64 image inside of an HTML exported document, and it works great.

I wonder now how could I automate this process for each image file referenced in my document ?

Adding a pre-export task replacing all file references with the base64 encoded image seems the way to go, but I don't have any practice with elisp. Can anyone help me out ?

I found out some ideas in this documentation : http://orgmode.org/manual/Advanced-configuration.html which seems a good starting point. But I fail to manipulate correctly the input text.

This is what I came out with :

(defun html-base64-images (text backend info)
  (when (org-export-derived-backend-p backend 'html)
    (message "The text is: %S" text)
    (setq filename (replace-regexp-in-string "\\\"\(.*\)+\\\"" "\1" text))
    (message "The filename is: %S" filename)
    (setq output-text (replace-regexp-in-string "img src=\".*\"" "img src=\"data:image/png;base64," text))
    (concat output-text tob64(filename))
    (message "The new text is %S" output-text)
    output-text
    )
  )

(add-to-list 'org-export-filter-link-functions
             'html-base64-images)

So in the Messages buffer I can see my messages, but I have problems to manipulate the TEXT string correctly. The output looks like :

The text is: ""
The filename is: ""
The new text is ""

I need to :

get the filename
replace it with my base64 URI

I'm not used to elisp at all ... maybe I'm doing it the wrong way ...


texts: Email Code Snippets through Emacs (with Mutt)

texts:
Frequently, I find myself having to send code snippets to teammates, etc.

Therefore, I decided to write the following elisp to simplify the process. I am using mutt as the email client, but the only issue with this is the fact that the code is not properly formatted in the email.

(defun email_mark (addr subj)
   (interactive "sEnter email address: \nsEnter email subject: ")
   (let ((fname "~/.emacs.d/files/email.txt"))
     (write-region (region-beginning) (region-end) fname)
     (shell-command (format "mutt -e 'set content_type=text/html' -s '%s' -- '%s' < %s" subj addr fname))))

(global-set-key "\C-x\m" 'email_mark)

Screenshot of email sent using this function:

Any suggestions?


texts: Evil: How to add keybinding for changing buffers?

texts:
With Evil mode, :bn shows the next buffer, and :bp shows the previous buffer. I wish to define a custom keybinding where <Space>n shows the next buffer, and <Space>p shows the previous buffer.

In Vim, this can be accomplished using:

nnoremap <leader>n :bnext<cr>
nnoremap <leader>p :bprevious<cr>

where <leader> is Space.

How can I define these keybindings for Evil mode?


texts: Source of "Pattern t is deprecated. Use `_' instead" message

texts:
Loading a certain file (that shall remain nameless) generates the message:

Pattern t is deprecated.  Use `_' instead

No position information is given that would identify what expression generates the message. This looks to be from a library, rather than Emacs Lisp. What might be the source of this message (if possible to identify without source code)?


texts: Shell mode - clear screen but keep scrollback

texts:
When using a normal terminal application (like Konsole, for example), I regularly use Control-L or the clear command to clear the terminal's contents, leaving the cursor on the top. When I do this, I can still scroll up and read the output of the commands I ran previously (they are not discarded).

In Emacs shell mode (M-x shell), I've been using comint-clear-buffer to clear the contents of the terminal and leave the point (and prompt) on the top. The problem with this command is that it also discards the output of all the commands I have run up to that moment. Using recenter-top-bottom doesn't help, because when I use it to position the point and prompt at the top, as soon as I input a command and hit ENTER, the point 'jumps' back to its original position.

The question I would like to ask is: is there a command similar to comint-clear-buffer that doesn't discard the output of previous commands?


texts: Why AUCTeX/pdflatex show me help in Japanese?

texts:
I had this error message displayed to me by AUCTeX (already corrected using \ddot{\boldsymbol x})

ERROR: Extra }, or forgotten $.

--- TeX said ---
<recently read> }

l.51 \[ \boldsymbol M\ddot\boldsymbol
                                      x + \boldsymbol K\boldsymbol x =
--- HELP ---
括弧または数式モードのデリミタが正しく対応していません．おそらく{・\[・
\(あるいは$のうちのいずれかを書き忘れたのでしょう．

Google's Translate says it's Japanese...

In the *scratch* buffer I have

(getenv "LANG")
"C.UTF-8"

I'm on Debian Sid with an updated Debian TeXLive and auctex-12.1.2 installed with elpa

What's going on?

Addendum

I had consistently the help message in Japanese using either pdflatex or xelatex or luatex while from the shell I had, in all cases, the help message in English.  Both in Emacs and the shell I have LANG set to C.UTF-8.

The problem was solved (so to say) restarting Emacs.  In a new copy of Emacs, with a new instance of AUCTeX I have again the help messages in English.

The strange behaviour I experienced is likely due to a casual interaction between the user and Emacs/AUCTeX and I don't expect that we can find what happened, on the other hand I don't want to remove the question but it's fine if you close it.


texts:
Q: how do I teach setf about new places it can set?

In common lisp, one uses the
macro defsetf to tell
setf about new places it can set.

In elisp, that macro exists in in the cl library, but, as far as
I can tell, has not been ported into the updated cl-lib library.
However,
we're not supposed to use the old cl library:

  Since the old cl.el does not use a clean namespace, Emacs has a
  policy that packages distributed with Emacs must not load cl at
  run time. (It is ok for them to load cl at compile time, with
  eval-when-compile, and use the macros it provides.) There is no
  such restriction on the use of cl-lib. New code should use
  cl-lib rather than cl.

Does defsetf (or a substitute) exist somewhere else?  How else
should I tell setf about new places?


texts: Re-map evil-commentary key in dired mode

texts:
I am trying to re-map a key in evil-mode/evil-commentary-mode when in dired-mode. I tried to add a hook to dired-mode to disable the minor commentary mode, but it disables it for other major modes as well. I've tried the following as well but it doesn't work (I've also tried it with evil-normal-state-map):

(add-hook 'dired-mode-hook
  (lambda ()
    (define-key evil-commentary-mode-map (kbd "g") 'revert-buffer)))


texts: How can I use Emacs in a SSH sever that I logged in through emacs terminal?

texts:
I really like the emacs terminal but each time I use it to log into my server. I don't know how to use emacs to edit files on the server.

Or it is not possible to do it? I can only edit files on server via ssh edit? However, in the latter case, how can I edit file as root user?


texts: How to display text in colored overlay in an Emacs buffer

texts:
I made a link selector for Eww (working version here) that looks at all links in the visible part of the buffer, assigns hints to them and prompts the user to select one. I wanted to display the hints so that they would both stand out and be easy to remove, so I decided to use overlays. After some tinkering I was able to display the hints using empty overlays and the after-string property. Problem is, only the text got displayed, not the color settings. My understanding is that the face property applies only to the overlay (which in this case is empty), not the text inserted after it. I was not able to make an overlay that would actually allow me to insert text inside it.
Below is a snippet taken from my current solution.
...
(let* ((label (car link))
       (pos (getf (cdr link) :position))
       (ov (make-overlay pos pos)))
  (overlay-put ov 'after-string
               (format "[%s]" label))
  (overlay-put ov 'face `(:foreground "black" :background "yellow")))
...

When I tried making a non-empty overlay, it would actually span the text already present in the buffer. Is there some way to do it, that would allow me to color the text I'm inserting and make it easily deletable?


texts: How to cite author-date including page number in org-mode?

texts:
I am using org-ref in org-mode. I want to cite a book like this:

    \citep[p. 1445]{Fong:2006}

but I am only getting citep:Fong:2006. How can I include page number?


texts: Passing a symbol as an argument to a function

texts:
I'm trying to understand why this doesn't work, and how to make it work:

(defvar test/var-1 nil)
(defvar test/var-2 nil)

(defun make-setter (var-to-set)
  (lambda (val-to-set)
    (setq var-to-set val-to-set)))

(defun do-the-thing ()
  (let ((the-val 5))
    (funcall (make-setter test/var-2) the-val)))

(do-the-thing) ;; After this function is called, I'd expect
               ;; test/var-2 to have the value 5, but it's nil.

I assume the problem is that the call to setq is setting the value of the symbol var-to-set, overwriting the previous value of test/var-2 with 5. How do I pass in the name of the variable to set and and set the value of that variable?


texts:
Lets say I have these strings: "foo", "fooo" and "fo". And this line of code:

(query-replace-regexp "\\<fo+\\>" "foo" nil (point-min) (point-max))

I'd like to skip the query-replacement for the matched string "foo" because it would be replaced by an identical string.

In other words I'd like to skip query-replacements if the matched string matches a string (or a regexp).

I figured out it could be done with a lambda function but I have no idea how to implement this idea. May be something like:

(query-replace-regexp "\\<fo+\\>"
                      '((lambda (data count)
                          (if (string= (match-string 0) "foo")
                              (skipping-function)
                            "foo")))
                      nil (point-min) (point-max))

a sort of skipping-function should do the trick.


texts: Why did I get an error message: wrong-type-argument stringp user-init-file

texts:
I have (set-register ?E '(file . user-init-file)), so that I can easily jump to my config file.  Previously I used a string to specify the path to my init file, but I figured I'd tidy it up a bit.

However, it doesn't work, and emacs complains about (wrong-type-argument stringp user-init-file), giving the following stack trace with debug-on-error enabled.

Debugger entered--Lisp error: (wrong-type-argument stringp user-init-file)
  expand-file-name(user-init-file)
  find-file-noselect(user-init-file nil nil nil)
  find-file(user-init-file)
  ad-Orig-jump-to-register(69 nil)
  jump-to-register(69 nil)
  call-interactively(jump-to-register nil nil)

For reference, this happens if I load emacs with -Q, and then eval the set-register... and then attempt to jump to the register.

What's going on here? Things like (find-file user-init-file) don't throw this error.


texts: What does a byte compiled Emacs file contains and how is it executed?

texts:
I didn't know byte compiled emacs files (.elc) were actually version-specific until Malabarba pointed that to me.

So this made me ask what do those files actually contain and how does their execution compare to the execution of normal .el files? What is the benefit of compiling an emacs file and how does emacs takes advantage of this?


texts: Problem with giving inputs to a function programmatically

texts:
Some programs take user inputs, for example by calling the interactive function `sunrise-sunset', two arguments are taken from the user. Assume that the inputs are 0.0098 and 51.4934 (these are longitude and latitude of Greenwich).

It would be interesting to call this function programmatically, but after evaluating the following

(call-interactively 'sunrise-sunset "0.0098" "51.4934")

one gets the error message Wrong type argument: vectorp.

How to correct this?


texts: Automatically enable a mode with dir-locals.el

texts:
I'm trying to achieve the effect of automatically calling M-x importmagic-mode whenever I open a python file, but I need to do this in a directory specific way, using dir-locals.el.
I have this in dir-locals.el:
((python-mode . (
                 (eval . (importmagic-mode 1))
)))

But I still have to M-x importmagic-mode every time I open a python file. What am I missing to make this automatic?  Is my syntax just wrong?


texts: package-install tries a URL whose content is not found

texts:
I want to install the package running:

M-x package-install RET markdown-mode RET

And I get the following error

package-install-from-archive: https://melpa.org/packages/markdown-mode-20180904.1601.el: Not found

Which is true, since doing via Firefox I get 404 error.

I have the following version of Emacs:

GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK + Version 3.22.30)
  of 2018-07-05

How can I install it?


texts: Windows 10, Emacs 25.1, shell: Grep not work immediately

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

I has Android application. And in console I start Android command "adb logcat" to show logs from Android device.
But it's show many text. And I want to filter to show only lines that I need.

So. I want in console to show only lines that content text "com.android.testproject".

First I show text without filter:

Emacs: run shell (M-x shell)
Run android command : adb logcat

Here result. Show all text (no filter)

OK!
Now I want to filter.

My steps on Windows console:

Open windows console: "cmd.exe"
Enter command: adb logcat|grep com.android.testproject
Result is show only lines that content text "com.android.testproject".

It's work. OK.

Here screenshot.

Now I want to do same (filter) on Emacs.
My steps:

Open shell: "M-x shell"
Enter command: adb logcat|grep com.android.testproject
But nothing happend. Why?

But if I press "C-c C-c" (Break) then in shell success show filtered text.

Question: Why Emacs not immediately  filter text?


texts: What is the difference between writing and saving a file in Emacs?

texts:
What is the problem if I keep writing a file while editing it instead of saving it?
What exactly am I going to lose? Some sort of backup? Is this a "bad" practice?


texts: How to prevent some files from showing up on the Ibuffer list?

texts:
On my IBuffer I keep seeing *lsp-log* and *pyls::stderr* files.
[ Default ]
 *% *lsp-log*                516 Fundamental
 *% *pyls::stderr*           264 Special          (pyls stderr open)

Is it possible to prevent these file to be hidden in the Ibuffer or basically hide or remove  them.
My approach does not make any change:
(recentf-mode 1)
(setq recentf-max-saved-items 50)
(setq recentf-max-menu-items 50)
(setq recentf-exclude '("*lsp-log*"
                        "pyls::stderr"
                        ))

More general question should be as: how can I prevent some files show up on the Ibuffer list.


texts: How change the contents of a package (header2.el)?

texts:
I found the package Automatic File Headers, I cheered and installed it with MELPA.
I have found file headers to be very valuable in project development.  I always know who has been where and how many times they were there. Most often, I also know what they did. The update count and last modified date are very useful in determining the proper version of a file to use.

There is one thing that I couldn't figure it out.

For example, after installing header2 from MELPA, declare it in your dot-emacs:

;; To have Emacs update file headers automatically whenever you save a
;; file, put this in your init file (~/.emacs):

(autoload 'auto-update-file-header "header2")
(add-hook 'write-file-hooks 'auto-update-file-header)

;; To have Emacs add a file header whenever you create a new file in
;; some mode, put this in your init file (~/.emacs):

(autoload 'auto-make-header "header2")
(add-hook 'emacs-lisp-mode-hook 'auto-make-header)
(add-hook 'c-mode-common-hook   'auto-make-header)

So when you create a new file in Emacs, for example foobar.el. You see a header. And it will automatically update when you write the file. Okay, let's assume I would like to change the text Last-Updated: into Foo-Last-Updated.

So I did a grep on Last-Updated from the package header2 and replaced all occurences with Foo-Last-Updated. I restarted Emacs to be sure. And there is still Last-Updated displayed instead Foo-Last-Updated.

Any suggestion, in order to change the header contents? I found nothing in the manuals.


texts: after-make-frame-functions does nothing for an otherwise working function

texts:
I am using workgroups and I have the following code in my init.el:

 (defun my-start-emacs (_)
   (interactive)
   (message "HI")
   (sleep-for 1)
   (if (daemonp)
       (progn
         (if (not (boundp 'server-wg))
             (progn
               (wg-create-workgroup "server")
               (setq server-wg (wg-current-workgroup)))
           (progn
             (setq current-wg (condition-case nil
                                  (wg-current-workgroup)
                                (error nil)))
             (if (not current-wg)
                 (wg-switch-to-workgroup server-wg)
               (if (not (eq current-wg server-wg))
                   (wg-switch-to-workgroup server-wg))))))))

 (add-to-list 'after-make-frame-functions #'my-start-emacs)

The my-start-emacs function creates the "server" workgroup if it does not exist, and loads it if it does. Using it manually via M-x my-start-emacs works perfectly, however for some reason even though it is called when I start the emacsclient -t (attach to server after emacs --daemon), nothing happens (i.e. the server workgroup is created, but is not changed to)... Why?


texts: Is it possible to retain outline overlay when switching modes

texts: I want to switch between org-mode and c++-mode on top of a single file. I use org-mode syntax inside c++ comment blocks. In Org-mode I have foldable sections while in c++-mode I use hide/show for blocks. When switching mode the outline overlay is reset and everything is made visible. Is it possible to somehow prevent this and retain the visibility state?


texts: Modifying task reveal behavior with state changes in org-agenda

texts:
In org-mode 9.3.6 and GNU Emacs 26.3, marking a task as done in org-agenda also reveals the task in its buffer. Only the task subheader itself is shown. Here's an example:

Before (buffer left, agenda right):

After changing task state to DONE in agenda:

I'd like to know if this behavior can be modified so that 1) org-mode does not reveal the task in its buffer or 2) org-mode reveals the full parent-child header structure with the task. For example, something like this:

Any help is very much appreciated - thanks!


texts: Org-mode inline .eps images display error. (.eps created by AI ok, .eps created by matplotlib no)

texts:
As I basically use Org to take note and export LaTeX files, I find displaying eps files as inline image to be important for me.I have my emacs compiled with ImageMagick support, and added the following codes in the .emacs file to enable inline preview support of .eps files link in Org-mode

(add-to-list 'image-type-file-name-regexps '("\\.eps\\'" . imagemagick)  )
(add-to-list 'image-file-name-extensions "eps")
(setq org-image-actual-width '(400))

I have tested an .eps file created by matplotlib using Agg backend, which the rendered inline image is blank.
However when converting the eps file using Adobe Illustrator to Illustrator EPS (I have tried several versions from AI 3 to AI CC) and the converted eps file can be successfully shown as inline image.

Since the org-display-inline-images function only takes the image created by ImageMagick to make the overlay,
this problem seems to be due to be caused by ImageMagick failing to render the matplotlib version eps file. However if using the ImageMagick from system command line like convert -density 300 test.eps test.png will correctly create the png file which can be opened by system preview.

The question is, what exactly is the difference between the eps created by matplotlib and AI?

  The test is done in OS X El Capitan with emacs 25.1.1, org-mode 8.2.0, matplotlib 2.0.0b4 and Adobe Illustrator CC 2015.  The sample files (.org + .eps files created by matplotlib and AI)


texts:
Is there a way to replace an item in a list?
(replace-element-in-list (elem-src elem-dst ls &optional times comparison-fn))
 ;; ...
 )

Example use:
(replace-element-in-list 1 100 '(3 2 1)) => '(3 2 100)


texts: What features differentiate Spacemacs from other editors and IDEs in terms that someone unfamiliar with both Vim and Emacs can understand?

texts:
I am in the position of onboarding junior developers to Spacemacs but I am unable to find a detailed, canonical description of Spacemacs that is geared toward beginners.

Specifically, I don't find the Spacemacs documentation sufficient. "Emacs advanced Kit focused on Evil" tells the novice nothing useful, and the rest of the docs are equally lacking beginner context — they are solely written for an audience of current Emacs / Vim users.


texts:
Many people are advertising nlinum over linum. I had a configuration for linum copied from the linum-off.el script you can find on internet:

(require 'linum)

(defcustom linum-disabled-modes-list '(eshell-mode wl-summary-mode compilation-mode org-mode text-mode dired-mode doc-view-mode image-mode)
  "* List of modes disabled when global linum mode is on"
  :type '(repeat (sexp :tag "Major mode"))
  :tag " Major modes where linum is disabled: "
  :group 'linum
)
(defcustom linum-disable-starred-buffers 't
  "* Disable buffers that have stars in them like *Gnu Emacs*"
  :type 'boolean
  :group 'linum)

(defun linum-on ()
  "* When linum is running globally, disable line number in modes defined in `linum-disabled-modes-list'. Changed by linum-off. Also turns off numbering in starred modes like *scratch*"

  (unless (or (minibufferp)
              (member major-mode linum-disabled-modes-list)
              (string-match "*" (buffer-name))
              (> (buffer-size) 3000000)) ;; disable linum on buffer greater than 3MB, otherwise it's unbearably slow
    (linum-mode 1)))

(provide 'linum-off)

I wonder if it is possible to achieve the same thing with nlinum, knowing that there is no nlinum-on function to override. I am mostly interesting by this because I want to disable nlinum for the buffers starting with a * and for a few very specific files/buffers.


texts: How to bind C-h to delete-backward-char when doing isearch?

texts:
I use C-h as an alias for delete-backward-char everywhere.

But when I do isearch it exits the search instead of deleting the character before the cursor.

I tried binding C-h in isearch maps, but that didn't work:

(define-key minibuffer-local-isearch-map (kbd "C-h") 'delete-backward-char)
(define-key isearch-mode-map (kbd "C-h") 'delete-backward-char)

Character gets deleted, but it is deleted in the buffer, not in the isearch prompt.

Is there a way to rebind C-h so it works in isearch prompt?


texts:
I'm working in a codebase with an extensive use of function macros and I'm having some difficulty finding the correct way to set indentations with them.
Specifically, we pass a lot of statement lists { //body } into these macros, and the nicest way to read them is when they sit flush with the calling macro start column.

What happens right now is

if (cond)
{
  SomeMacro(i, j, k,
            {
              // Do stuff
            });
}

But what I would like to be able to do is

if (cond)
{
  SomeMacro(i, j, k,
  {
    // Do stuff
  });
}

I've tried doing C-c C-o and running c-show-syntactic-information but it doesn't seem like it even recognizes that these are macro calls.  Which is fine, but it doesn't seem to recognize them as anything, it just tells me the first thing above it (in this example it says statement-block-intro and highlights the opening if bracket)

EDIT So I was able to set the arglist-cont-nonempty symbol to 0 indent and that works, but the new problem is that it no longer indents argument lists that go into the next line even if they aren't a statement body.  e.g.

SomeMacro(i, j, k,
          a, b, c);

will now indent as

SomeMacro(i, j, k,
a, b, c);

Is there a way to differentiate between a continued arglist of regular variables and one that is a statement body?

EDIT2: So here's where I've gotten to:

(defun c-lineup-macro-body (langelem)
  (save-excursion
    (if (and (eq (car langelem) 'arglist-cont-nonempty)
             (progn (back-to-indentation)
                    (= (following-char) ?{)))
        (let* ((relpos (cdr langelem))
               (curcol (progn (goto-char relpos)
                              (current-column))))
          (- (current-column) curcol))
      (c-lineup-argcont langelem))))

(c-set-offset 'arglist-cont-nonempty 'c-lineup-macro-body)

This will line up the macro body argument { //body } correctly, but I still have the problem where all other argument lists (including operators being fed into array indices that break lines) will line up with the previous starting line column as well.

My hope was with (c-lineup-argcont langelem) as the else condition would trigger the default behavior, but it does not.  Is there some way to insert this function as a conditional hook so that it performs the default indent behavior unless the specific condition is met?


texts: How can I define `search-whitespace-regexp` so it accepts a Unicode "no-break space"?

texts:
I'm writing a lot of Markdown for input to pandoc, so my files contain a lot of Unicode non-breaking spaces (U+00A0).  I'd like those to search as whitespace with isearch-forward, so I tried adding the character to my search-whitespace-regexp variable.  But it doesn't work.  I suspect there might be a UTF-8 issue somewhere.

I've tried

(set (make-local-variable 'search-whitespace-regexp)
 "[ \t\r\n\f~\u00a0]+")

and I've also tried just hard-coding the character between the square brackets.  Neither works.  By contrast, I can search the ~ character as white space just fine---so I know something is working.

How can I persuade Emacs that the U+00A0 should be accepted as a space character, for purposes of search?

I'm running Emacs 24.5, a stock Emacs from Debian jessie.

Edited to add: following a comment from steveooo, I've determined that

M-x eval (search-forward-regexp "cise[ \t\r\n\f~\u00a0]6")

correctly finds the string I'm looking for, but isearch-forward still does not work.

Edited to add: In Emacs 25, nothing seems to have changed.


texts:
I'm sure emacs used to do it my way, but things appear to have changed (probably years ago, I've just been living with the pain).

I want this (to conform to corp. standards):

MULTIFORM=$(
    curl -k -A http://foo.com |
    grep -m1 multiform |
    tr '=' '\n' |
    tail -1 |
    cut -d "'" -f 2
)

But emacs-25.1 insists that this is the right way to indent:

MULTIFORM=$(
    curl -k -A http://foo.com |
        grep -m1 multiform |
        tr '=' '\n' |
        tail -1 |
        cut -d "'" -f 2
         )

... quite apart from our standards, it's ugly.

I've tried messing around with sh-learn-line-indent and it offers rules like:

close-all ")"
list-intro ";"

... but playing with them gives no joy at all.

Any ideas?


texts:
How do I make ae in evil insert mode produce æ?
This would be the equivalent of inoremap ae æ in vim.
(I tried
(define-key evil-insert-state-map (kbd "ae") (kbd "\C-kae")),
but after this typing a (without an e after it) didn't
produce an a, but rather the error a is undefined.)


texts:
I would like to change the "electric-indent" behavior in emacs, at least in the LaTeX major mode, but possibly in some other ones as well.  What I would like is to retain the behavior that when hitting return, the next line is automatically indented to the level that the previous line was indented, but to disable all other ways of setting off auto indentation.  So for example, in LaTeX mode, when I type \begin{equation} followed by return, the next line should not be indented automatically any further than the \begin{equation} may have already been.  But after I manually indent the next line, the following line would then be indented to that level.  E.g.:

\begin{equation} % No *auto* indent when hitting 'return' on this line
  y = f(x), % Manually indented; but now 'return' should indent next line
  x \in D
\end{equation}

This is the behavior I'm used to from using TeXShop.  It also seems to be the behavior of emacs in the Text major mode.

If it helps I should note that I am a new emacs user (I've gone through the very first tutorial, am currently going through the "Emacs Lisp Intro", and have cut-and-paste lisp code into my .emacs file from various places online to get certain customized behavior, but do not understand all of it yet).

I have searched through other questions, and there are many similar ones, for example this, this, this, this, and this, but I couldn't find something exactly fitting this one.  But it could be I missed it, or simply didn't understand how to adapt one of the answers to these to my situation.

Finally, this should perhaps be a separate question, but if anyone could recommend to me a good way to learn how emacs works, something appropriate to my experience level, I would appreciate it.


texts: Latest Magit expands hunks after staging

texts:
With the latest version of Magit (20180410.432) I feel that the staging behavior has somewhat changed. Before, I used to expand the unstaged files in the Status Buffer, then stage the hunks one by one. As hunks dropped into Staged section, they became collapsed – that is, only the name of the file was visible. I got used to this behavior, as it allowed me to treat the Unstaged section as a backlog. Now it is visually confusing whether some hunk is already staged or not when it stays expanded after staging.

Has anything changed in Magit regarding this, or am I imagining things? If the former, is there a way to revert the old behavior locally?


texts: condition on "if the source code block is tangled"

texts: is there a way to query if the current source code block is tangled and if so, to execute e.g. shell stuff depending on if it was or not? I know I can make tangling conditional, but can one also do the other way around?


texts: Gnus fails to connect to GMail AUTHENTICATIONFAILED

texts:
How can I debug what exactly is being sent and where?
The account I'm trying to connect has "two-step" authorization enabled.  However, I've checked that IMAP access is enabled and that "less secure" applications are allowed to access my account.

I thought, that if two-step authentication was a problem, I should be seeing a different error message, however, what I see is:

  nnimap (gmail) open error: 'NO (AUTHENTICATIONFAILED) Invalid credentials (Failure)'.

I'm absolutely sure that the details I provided in ~/.authinfo.gpg are correct.

My nnimap settings:

(setq gnus-select-method
      '(nnimap "gmail"
               (nnimap-address "imap.gmail.com")
               (nnimap-server-port 993)
               (nnimap-stream ssl)
               (nnir-search-engine imap)))

I'm able to connect with same configuration to another GMail account (by changing the details in ~/.authinfo.gpg).


texts: Why multiple-cursors NOT mark all text between all square brackets?

texts:
emacs 26.1

I want to downcase all text between all square brackets. So I try to use multiple-cursors for this:

here text:

CREATE TABLE [CIndicators] (
[ID] INTEGER  NOT NULL PRIMARY KEY AUTOINCREMENT,
[CODE] VARCHAR(1)  UNIQUE NOT NULL,
[DESCRIPTION] VARCHAR(255)  NULL,
[DESCRIPTION_RO] VARCHAR(255)  NULL,
[DESCRIPTION_RU] VARCHAR(255) NULL
);

Mark first open square bracket and use mc/mark-all-like-this

here result:

Nice.
Now move cursor one char forward:

Nice. And now use mark-sexp (C-=) to mark all text inside square brackets.

But as you can see it mark only text in first square brackets (CIndicators). But why multiple-cursors not mark all another text in another square brackets, like CODE, DESCRIPTION and so on?


texts: html to orgmode via pandoc- get rid of all #+BEGIN_HTML blocks

texts:
i tried converting html webpages to org mode file using a simple pandoc command:

pandoc -o output.org R\ Seminar:\ Introduction\ to\ ggplot2.htm

this works quite well but im left with tons of html blocks that look like this

#+BEGIN_HTML

#+END_HTML

#+BEGIN_HTML

#+END_HTML

#+BEGIN_EXAMPLE
    #declare data and x and y aesthetics, but no shapes yet
    ggplot(data = Milk, aes(x=Time, y=protein))
#+END_EXAMPLE

#+BEGIN_HTML

#+END_HTML

#+BEGIN_HTML

#+END_HTML

#+BEGIN_HTML

#+END_HTML

any clue how to get rid of these annoying #+BEGIN_HTML blocks during conversion?


texts: How to automatically select an option in a specific prompt?

texts:
When I'm programming Python, I will use rope to rename variables (using ropemacs). rope-rename pops up a dialogue after you provide a new variable name, where you can preview the change, cancel, or perform the refactoring.

For example:

Choose what to do: [perform]  {perform | preview | cancel}

"perform" is always the default option. 90% of the time, I don't want to go through this menu, I just want to to select the default option.

Is there any way to advise a command to automatically choose a specific (or the default) dialogue option so I can skip this menu? Is there maybe a package that allows me to specify automatic selections in dialogues matching certain conditions?