texts: How to display Unicode UTF-8 as Unicode?

texts:
I have some UTF-8-encoded text files which display strange escape codes in Emacs. For instance, this text:

  In ista quaestione primo exponam quid intelligendum est per hoc nomen
  ‘Deus’; secundo, respondebo ad quaestionem.

Shows like this in Emacs:

This only happens in Emacs. Other editors show the text correctly. How can I fix this problem?

Update 1

If I call revert-buffer-with-coding-system and select utf-8 the file get read correctly. So, as Gilles has correctly guessed, Emacs isn't detecting the file encoding. If I add the code ; -*- coding: utf-8 -*- to the file, Emacs opens and displays it correctly.

Update 2

I reencoded the file in "UTF-8 with BOM encoding," and now it displays alright in Emacs. I don't know what's the difference between the two types, but Emacs seems to be aware of the BOMed one only.


texts:
In trying to learn Emacs Lisp on Emacs 25.3.1, I decided to implement a minimal version of fic-mode. Following is the code:

(defun todo/pos-in-doc-or-comment-region-p (pos)
  (memq (get-char-property pos 'face)
    '(font-lock-doc-face font-lock-comment-face)))

(defun todo/search-for-keyword (limit)
  (let ((original-match-data nil))
    (save-match-data
      (while (and (null original-match-data)
          (re-search-forward "TODO([^)]+?):" limit t))
    (if (and (todo/pos-in-doc-or-comment-region-p (match-beginning 0))
         (todo/pos-in-doc-or-comment-region-p (match-end 0)))
        (setq original-match-data (match-data)))))
    (when original-match-data
      (set-match-data original-match-data)
      (goto-char (match-end 0))
      t)))

(defvar todo/keywords
  '((todo/search-for-keyword . font-lock-warning-face)))

(font-lock-add-keywords nil todo/keywords 'append)

When I run the function todo/search-for-keyword in a Elisp buffer containing the comment

;; TODO(me): Hey

the function does the right thing (finds the comment and puts cursor after the colon). However, when I put the whole code in my .emacs, the TODO(me): does not get colored.

The following even simpler version does work but not in comments (which is the whole point of this exercise):

(defvar todo/keywords
  '(("\\(TODO(\\)\\([^)]+?\\)\\():\\)" .
                 ((1 font-lock-warning-face)
                  (2 font-lock-variable-name-face)
                  (3 font-lock-warning-face)))))
(font-lock-add-keywords nil todo/keywords 'append)

It seems like Emacs already decides to render the text as a comment before my keyword even comes into picture. How can I override Emacs so that parts of comments get highlighted in different way according to my rules?

PS: Here is the documentation for Search-based fontification.


texts: how to find the detail of auctex startup?

texts:
when i open a .tex files, i always see

Applying style hooks...done
Sorting environment...done
Removing duplicates...done

yes, i use

(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

in .emacs

now, i want to know:

which "duplicates" found and removed ?
which "style hooks" applied ?
which "enviroment" sorted ?


texts: How to clear cache of projectile file in spacemacs?

texts:
I am using spacemacs and often use the SPC p f key binding to find files in a projectile project. But even after removing a file from a git, SPC p f will show me that deleted file.

I tried using SPC p I to invalid the cache, but that didn't work.

How to resolve the problem?


texts: How to view the errors from all buffers?

texts:
Is it possible to view all errors?

flycheck-list-errors only show errors for current buffer


texts: Exiting from outer calling functions on error

texts:
Consider the following:

(defun my-divide-by-0()
  (condition-case nil
      (/ 1 0)
    (error (progn (message "Could not evaluate: 1/0") nil))))

(defun my-test()
  (interactive)
  (my-divide-by-0)
  (message "Continued"))

When I do M-x my-test, the message Continued appears. How do I modify the error handling in my-divide-by-0 so only the message Could not evaluate: 1/0 would appear and the execution of my program would stop without the necessity to check error conditions in my-test? I tried throwing, but then the message Arithmetic error appears...


texts: How can I turn off numbering for figures?

texts:
MWE

#+CAPTION: Lisp is a language of timeless elegance.
https://imgs.xkcd.com/comics/lisp_cycles.png

Export as HTML will look something like this (depending on CSS):

I just want

  Lisp is a language of timeless elegance

to appear under the image.  How can I get rid of the numbering?


texts: previous-line function in term-char-mode

texts:
Since emacs 26.1 (changeset 8a1576cc03) I can't do M-x previous-line in term-char-mode. The cursor always returns to prompt line.
On the other side, if I use the mouse or M-x scroll-down the cursor stay at the target point.

I try to write a function whitch can go up line by line in term-char-mode but without success.
If someone has an idea, thanks.


texts:
I'm trying to define a new major mode using define-generic-mode and want to try reusing c-indent-line-or-region for my indent-line-function. I've inserted

(set (make-local-variable 'indent-line-function) 'c-indent-line-or-region)

in the initialisation part of define-generic-mode and it is correctly set. However, when I hit enter in a buffer using that mode I get an error:

c-indent-line-or-region: Variable binding depth exceeds max-specpdl-size

I've searched around and found suggestions to enable debug-on-error, which I have done, but the *Backtrace* buffer is always empty and accompanied by a message

Lisp nesting exceeds max-lisp-eval-depth'

How should I go about debugging this?


texts: How to install a color theme for Emacs 24?

texts:
Recently, I found a website providing many color themes for Emacs, so I decided to install one. However, I was confused by some instructions from web or other forums and I couldn't manage to install anything.

So I come here to ask for help, hope someone could help me install a color theme for Emacs!

My OS is Ubuntu.

PS: I have downloaded one color theme, extract it to a folder called elisp, and wrote the following command in the .emacs file

(add-to-list 'load-path "~/elisp/black-theme-master")
(require 'blackboard-theme)

when I open Emacs,  it gives me an error warning.

Warning (initialization): An error occurred while loading `/home/shieh/.emacs':

File error: Cannot open load file, blackboard-theme

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

the theme I got is here: Blackborad theme


texts:
How do I undo the effects of edebug-defun?  In other words, how do I rescind the directive that causes edebug to enter debugging mode when a particular function is invoked?

Also, I'd really like to know where the answer to this question is in the documenation.  I've looked for it far longer than one would think would be necessary...


texts: visual-line-mode adaptively wrapping when changing font size

texts:
visual-line-mode works fine for line wrapping in eww-mode. However, when I type C-x C-+ / C-x C-- to change the font size, the line wrapping does not adjust accordingly.

Does anyone know how can this be achieved?


texts: Ignore file- and directory-variables when using "emacs -Q"?

texts:
I am using emacs -Q as editor for git, because my startup is too heavy for "quick editing" use and using emacsclient will hang when git is invoked with M-x shell-command. However, as a consequence I keep getting prompted to confirm directory variables, when I have custom variables in a repository.
Is there some way to make emacs -Q ignore directory variables, it doesn't know about?


texts: Copy to kill-ring selected file names/full path

texts:
windows 10, emacs 25.1, dired+

Suppose in folder I select 3 files.
Something like this:

Now I want 2 options:

Copy to kill-ring the selected files names.
So the result must be:

ic_contact_us_write_us.png

ic_in_store_green.png

ic_m_brands_active.png
Copy to kill-ring the full path of selected files names.

So the result must be:

d:/TEMP/1/drawable-hdpi/ic_contact_us_write_us.png

d:/TEMP/1/drawable-hdpi/ic_in_store_green.png

d:/TEMP/1/drawable-hdpi/ic_m_brands_active.png

Is it possible?


texts:
Is there a way to have predefined helm-occur searches so that I can then bind them to a key?

I have some frequently and hard-to-type searches that would benefit from this.

(I used to do this easily with helm-swoop but it seems to be abandoned)


texts: Yasnippets: How to add if statements that check for regex?

texts:
I would like to replicate some of the snippets shown in
this blog post

Some of the snippets shown in that post involved if statements that check for regexp in snippet fields as well as checking for regex before a snippet

Can yasnippets do the same? If yes, then how?

I did not see anything like that in the documentaion


texts:
I'm relatively new to Emacs, so apologies if I'm using any terminology incorrectly.
I have installed Doom Emacs in Evil mode, so command shortcuts are commenced with SPC instead of Meta. When entering a key sequence, a menu pops up to show me the available options for the next key (I believe this is provided by the which-key package).
What I would like to be able to do is to go back a step if I haven't found what I'm looking for in the current "menu", rather than having to abort and start from the beginning with a new key chord.
E.g.: I enter SPC h d (help -> doom). How can I delete the d to return to the first level menu, as opposed to starting again with ESC SPC h?


texts: Strange toolbar icon in AUCTeX mode (on Mac)

texts:
I notice there is a strange box-shaped icon in the toolbar in the AUCTeX mode (circled in the picture below).

It should be a toolbar separator (for example, on Linux):

I am using GNU Emacs 26.1 with AUCTeX 12.1.1 on macOS 10.13.6. This problem seems to have existed for many years. The exact same problem was reported in 2011. Does anyone know what causes this problem and how to fix it?


texts: auto export to ICS when specifc orgmode file is saved?

texts:
i would like to have a way to save a function every X hours and to a user defined directory
so far i have this

(defun z/save-meeting-to-ics ()
    "If the current file is in '~/.dotfiles', the code blocks are tangled"
    (when (equal (buffer-file-name)
                 (expand-file-name "/home/zeltak/org/files/agenda/meetings.org"))
      (org-icalendar-export-to-ics)
      (message "exported to ics")))

this does save the org file "meetings.org" to an ICS file in the same

folder as the file. but i want to do 2 additional things:
1)save the resulting ICS file to a different directory
2)run this function every X hours (lets say every 2 hours)

any clue?


texts: Standard way of reporting user errors to user?

texts:
I am writing an emacs package which provides some commands to the user. The user can run things like M-x foobar and M-x eggsspam. However, some of these commands can fail. As an example, without running M-x foobar once, M-x spameggs will make no sense and has to report an error.

What's the right way to signal such errors to the user? Should I use (message...) or (user-error ...) or something else?


texts: Is it possible to DISABLE auto-reverting remote file?

texts:
Emacs 26.3
Linux Mint 19.3

I work with my Google drive. I want to disable auto reverting mode for remote files. Is it possible?


texts:
Is there a way to run ielm, but with variables bound to a certain buffer?

I know about M-:, but having a shell like ielm to inspect things would be much easier.


texts: How to setup default windows at startup?

texts:
Every time I open up Emacs I tend to set up 3 windows by doing C-x 3 (split-window-right) and then C-x2 (split-window-below). After that I have to switch to each window to open the files I want to edit.

How can I set this to be done automatically?

Is there a way to have Emacs recover the same screen organization (windows and files) from last use?


texts:
Does org-mode use some markup language? What is the language called?
I found that it is similar but different from Markdown. Thanks.


texts:
Here my kbd macros in mycustom.el

(fset 'keep-tv-channels-names
   (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ([134217848 107 101 return 69 88 84 73 78 70 return 134217848 81 85 69 82 return 46 42 44 return return 33 24 19] 0 "%d")) arg)))

And when I apply it on first file it's correct work.
Nice.
But if I want again to apply it to another file I get error:

After 0 kbd macro iterations: read-kbd-macro: Variable binding depth exceeds max-specpdl-size


texts: I know that to repeat the last command, there is C-x z and then to keep using z to easily keep the last command in operation, but what can be done for the 2nd or 4th last command? Or is that information lost?


texts: Show top of *Async Shell Command* buffer

texts:
Is there a way to get to the top of a buffer that is not necessarily active?

What I want to do is run a shell command on the word at point and then show the top of the output in the *Async Shell Command* buffer (if the output is longer than the screen).

What I have now is:

(evil-leader/set-key "l"
  (lambda ()
    (interactive)
    (async-shell-command
     (concat "parse " (thing-at-point 'word 'no-properties)))))


texts: How to prevent ispell from checking inside mathematical formulae

texts:
By invoking M-x ispell, ispell says that 'ij' in the following formula is incorrect. How to permanently prevent ispell from this behavior.

$\phi_{ij}$


texts: Is there a way to use spacemacs with emacs 24.3 version?

texts: I am working in a cluster environment, where the default emacs version is 24.3. Unfortunately spacemacs support only from >24.4. Administrators refuse to update the version. They asked me install my own emacs using conda. I did that. But, for some reason I am not able to get the spacemacs working. I am not able to change font. Its not recognising the system fonts at all. Also, the display gets scrambled often like the one in the picture.


texts:
Is it possible to do row operations of the following form in org-mode?

|  x1 |  x2 |  x3 | x4 | z1 | z2 | b |
|-----+-----+-----+----+----+----+---|
|   2 |   1 |  -7 | -1 |  1 |  0 | 0 |
| -39 |  -7 |  39 |  2 |  0 |  1 | 0 |
| -46 | -43 | 271 | -8 |  0 |  0 | 0 |

get's transformed to

| x1 |    x2 |   x3 |   x4 |   z1 | z2 | b |
|----+-------+------+------+------+----+---|
|  1 |   0.5 | -3.5 | -0.5 |  0.5 |  0 | 0 |
|  0 | -12.5 | 19.5 | 21.5 | 19.5 |  1 | 0 |
|  0 |   -20 |  110 |  -15 |   23 |  0 | 0 |

The first row gets scaled by 0.5. Subtract 39 times the first row from the second row. Add 46x first row to the third row.

Context: I'm trying to make Simplex tableaus in org-mode. There are other uses of such a feature like doing gaussian-elimination etc. I could only find table features that would let you sum along a column and write it in the bottom row and not a feature that would let you replace the contents a row with an equation of other rows. Is this possible?


texts: Add a border around the region by inserting a given character


texts: org-mode: force heading subtree to start folded

texts: I know :ARCHIVE: does this, but I use that tag to mean the subtree is essentially useless now. I want sth like :FOLD:.


texts: How to tweak dired-create-empty-file to facilitate the easy creation of files

texts: I currently have bound the command dired-create-empty-file to f7. Emacs then prompts me for a file name. When I press f7 I would like Emacs to automatically create an ORG file and automatically generate a file name for it based on the date and time and then open the new file for editing. I find I prefer to rename files later if necessary than take the time to devise a name for them at the start.


texts: Reverting an incomplete set of operations

texts:
What is the preferred method of reverting a partially applied set of operations within a function?  For example in a function that kills some text, performs some intervening operations, and then yanks the earlier killed text-- if one of those intervening operations throws an error the originally killed text should be restored by the function.

Are there are any generalized solutions like SQL transactions for this?    I know Emacs has a powerful undo system, but I have not used it programmatically.


texts: pdb hangs through gud on emacs when path has `@` symbol

texts:
more tests

I've now confirmed this behavior in Emacs 24.5 on a linux machine. Basically, if there is an @ symbol in one of the parent directories, gud will hang.

the first update

I've actually discovered what the issue is, but don't know how to fix it.

My current laptop is a company issued laptop and my username/home directory is defined like so: /Users/myname@mycompany.com/

If the python file I'm debugging with gud/pdb is under that path, pdb fails to launch properly. Any other path, and it launches fine.

So I'm guessing that @ symbol is the source of the current problems.

Is there any way to modify some variable or gud so that it can work with that @ symbol in the path?

the original post

I'm not even sure how to even begin to debug or diagnose this issue. And searching turns up nothing.

Basically, M-x pdb will create a buffer and display Current directory is XYZ and then just stop there.

I've used M-x pdb successfully many times in the past but I recently switched to MacOS Catalina and also updated emacs to 26.3. I installed python 3.7.7 via homebrew.

Here's what I've tried so far

disable .emacs
use homebrew emacs
use the emacs at emacsformacosx.com
update python from 3.7.3 to 3.7.7
remove all python packages

None of them work. And it's not a pdb issue because I can enter pdb fine from any regular shell. I just can't get pdb through gud.

Is there a solution? Or is there a way I can at least debug the gud/pdb launch process?


texts:
I have some frames in emacs window, and I want in one of them having open agenda (org mode) but often emacs replaces me content of this frame (for example if I use list packages, rgrep etc).

How to make this frame (and maybe one-two more) inviolable? Something like left panel of neotree.


texts: Commands in Python-Mode not working (py-shell and C-c C-c)

texts:
I just installed python-mode using melpa and therefore I must be on the latest version.

My .emacs init file consists only of the following lines :

(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

I try to execute a program that runs fine in the terminal, but when I hit C-c C-c, ie. py-execute-buffer, there's the following error:

py-choose-shell-by-path: Wrong number of arguments: #[nil

followed by a trail of gibberish:

The command py-shell will result in the similar error message.

Emacs v24.5
OS X Yosemite 10.10.4


texts: How do I simultaneously view multiple diffs with Magit?

texts:
How can I simultaneously view multiple diffs with Magit? I want to view A..B in one window, and A..C in another window (B and C are diverged branches).

I can run magit-diff-dwim on A..B to view the first diff, but when I run it the second time on A..C, it appears to reuse the same buffer, replacing the A..B diff with A..C. I want to see A..B and A..C side by side to help resolve a merge conflict.


texts: ' versus #' what are the differences and when should I choose one over the other?

texts:
Both seem to work equally well when mapping a function over a list, for example.

(mapcar #'1+ (list 1 2 3))
;; => (2 3 4)
(mapcar '1+ (list 1 2 3))
;; => (2 3 4)


texts: Never "Keep current list of tags tables also"

texts:
If I'm working in a directory with its own TAGS file, and then I move to another directory, with its own TAGS file, I always get asked this question:

Keep current list of tags tables also? (y or n)

I never want to bring the list of tags tables with me between directories, so I'd like to default the answer to this question to n, how can I do that?


texts: What tool shall I use to make a personal note book?

texts:
When I learn to use linux, Emacs, and programming, I asked and googled a lot of How-to's. I would like to note them down for furture reference. The tools should be:

Use plain text file, perhaps with some mark-down.
able to generate output, in html/pdf.
able to search by text strings.

Is there such tool-chains works well with Emacs? I've heard about org-mode, can it fulfill my requirement?


texts: Can I make projectile open a default file when I switch to a project?

texts:
I'm using helm-projectile in spacemacs.
SPCpp runs helm-projectile-switch-project, which gives me a helm completion buffer for projectile projects.
When I choose a project and hit enter, I then get a completion buffer to choose which file I want to open in that project.
I'd like to skip that second step, and just have a default file associated with a project that always opens first when I open that project.  Is that possible?


texts: Why do paths start with "c:/c/..." in windows emacs when I use 'next-error'?

texts:
I'm using native windows emacs together with mingw. When there's a compile error, the *compilation* buffer looks like this:

make -C ..
make: Entering directory `/c/Users/m.grunwald/Documents/Projects/aaaa/bbbb/cccc/dddd'
compiling Update.c
../Source/Update.c: In function 'SetMessage':
../Source/Update.c:52:1: error: 'd' undeclared (first use in this     function)
 d

When I use (next-error), emacs prompts me to "Find this error in...:" and the path it suggests is

c:/c/Users/m.grunwald/Documents/Projects/aaaa/bbbb/cccc/dddd/

Now this is neither a valid windows nor a valid mingw path and it makes compiling tideous. How do I get rid of the leading "C:" ?

Please note that the path that "make" prompts in the 2nd line is correct.

The linked topic "C:/c/user/...my-folder/ isn't an existing directory" error is about the same problem, but fixes it only in magit. I have no idea where I should tackle the problem for compile-mode and this is the wrong aproach, IMHO. It should be possible to fix this in emacs itself and only once, not once in each mode...


texts:
I just started using spacemacs, and I would like to achieve the following:
press f then d, and this for example types the word "fraction". I know package key-chord does this, but I think this is not compatible with spacemacs because it key-chord uninstalls when spacemacs is started


texts: Preventing Helm C-k from deleting entire minibuffer

texts:
Probably a very simple answer, but when I use helm-find-files, I often accidentally hit C-k (helm-delete-minibuffer-contents) instead of C-j (helm-execute-persistent-action), deleting the entire minubuffer instead of navigating into a directory.

I noticed that the variable helm-delete-minibuffer-contents-from-point exists, which when, the documentation states,

is non-‘nil’, delete minibuffer contents from point instead of deleting all. Giving a prefix arg reverses this behavior. When at the end of minibuffer, deletes all.

So I've tried in my init to set

(setq helm-delete-minibuffer-contents-from-point t)

but still C-k produces exactly the same behaviour of deleting the entire minibuffer. What gives? Am I doing something totally stupid?


texts: How to use font-lock to set other text properties (particularly keymap)?

texts:
I'm trying to make a mode where certain strings in the buffer have a special keymap active when the point is inside them. The documentation for font-lock-extra-managed-props and the Elisp info manual section Search-based Fontification suggest this is possible:

  However, FACESPEC can also evaluate to a list of this form:
  (face FACE PROP1 VAL1 PROP2 VAL2...)
  to specify the face FACE and various additional text properties to
  put on the text that matches.  If you do this, be sure to add the
  other text property names that you set in this way to the value of
  ‘font-lock-extra-managed-props’ so that the properties will also be
  cleared out when they are no longer appropriate.  Alternatively,
  you can set the variable ‘font-lock-unfontify-region-function’ to a
  function that clears these properties.

Unfortunately the documentation isn't very clear on the format of FACESPEC--I've tried variously quoted versions and none have the desired effect of a keymap active only in a certain area. So here's a simplified version of my code:

;;; Face to highlight trigger zone
(defface trigger-zone-face '((t (:foreground "gold" :background "red")))
  "Highlight a trigger zone.")
;;; Function to trigger
(defun trigger-zone-function ()
  "Function to test trigger zones."
  (interactive)
  (message "Trigger-zone activated!"))
;;; Map active in trigger zone
(defvar trigger-zone-map
  (let ((keymap (make-sparse-keymap)))
    (define-key keymap (kbd "C-c i") #'trigger-zone-function))
  "Map to activate in trigger zone.")
;;; Font locking
(setq trigger-zone-highlights
      '(("trigger-zone" face trigger-zone-face keymap trigger-zone-map)))
;;; Trigger zone mode
(define-derived-mode trigger-zone-mode text-mode "trigger"
  "Major mode to trigger commands from text."
  (setq font-lock-extra-managed-props '(keymap help-echo))
  (setq font-lock-defaults '(trigger-zone-highlights)))

Anybody have any idea what I'm doing wrong? I think I may be formatting the FACESPEC wrong, but I can't find any documentation to clarify e.g. what parts of the list should be quoted.


texts: Cyrillic and other characters show as numerals enclosed in \ slashes

texts: When I use Cyrillic characters, a pound sign (£), degree sign and others, they appear as figures enclosed by forward slashes when I open the file again. How can I prevent this?


texts: How does this forward-sexp-function in hs-special-mode-alist work?

texts:
I wanted to look up the different hs-special-mode-alist forward-sexp functions for inspiration to create my own and this is what the python forward-sexp looks like on my setup:

;; (MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC)

((python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
  #[257 "\300 \207"
                    [python-nav-end-of-defun]
  2 "\n\n(fn ARG)"]
 nil)

The thing that starts with #[257 "\300 \207" and ends with ARG"] is supposed to be a function for moving forward with forward-sexp. What the h is it showing? Is that valid elisp? Is it compiled code? Just gibberish?


texts:
How to detect if the point is at a closing delimiter?

For example:

in Elisp: )
in LaTeX: }


texts: Looking for a shortcut to select the function/method at point

texts:
I have this problem in JavaScript, but I understand the solution to it could me more general. My cursor (point) is on the name, or on the body, of a function, like this :

function test() { // My cursor is here or anywhere between "function" and "}"
console.log("test");
}

I would like to quickly select function test, in order to move it somewhere else in the code, or remove it completely. Is there a function, in js2-mode or anywhere else, which would allow me to do that?


texts: compiling emacs without dump/unexec enabled

texts:
Is there a way of configuring the emacs build to produce an executable that does not use dump/unexec functionality?

I'm trying to compile emacs with ASAN, clang and gcc's address sanitizer, enabled.

However, ASAN is an invasive compiler plugin and it's disturbing Emacs' unexec/dump functionality.

I'm using the following script to compile a "debug Emacs" from a release tarball.

#!/bin/bash

oldpwd="$(pwd)"

echo "${make_args[@]}"

tar -xvf "$oldpwd"/emacs-26.1.tar.xz

mkdir -p "$oldpwd"/out

(
        cd ./emacs-26.1
        ./configure --prefix="$oldpwd"/out
        make 'CC=gcc' 'CFLAGS=-O0 -fsanitize=address -g' 'LDFLAGS=-lpthread -lasan'
        make install
)

I get the following stack trace while building emacs. The stripped-down interpreter temacs works fine, but crashes when it tries to dump its state.

==28019==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fffef4c899e bp 0x7fffffffca90 sp 0x7fffffffca70 T0)
    #0 0x7fffef4c899d in malloc_set_state (/lib64/libc.so.6+0x8599d)
    #1 0x83c053 in malloc_initialize_hook ~/Downloads/emacs-26.1/src/alloc.c:164
    #2 0x7fffef4c7d0e in ptmalloc_init.part.7 (/lib64/libc.so.6+0x84d0e)
    #3 0x7fffef4c81dc in malloc_hook_ini (/lib64/libc.so.6+0x851dc)
    #4 0x7fffef4c69ba in malloc_get_state (/lib64/libc.so.6+0x839ba)
    #5 0x83c077 in alloc_unexec_pre ~/Downloads/emacs-26.1/src/alloc.c:190
    #6 0x7349a0 in Fdump_emacs ~/Downloads/emacs-26.1/src/emacs.c:2218
    #7 0x88c739 in eval_sub ~/Downloads/emacs-26.1/src/eval.c:2237

As far as I can tell, the offending line is in alloc.c

      if (malloc_set_state (malloc_state_ptr) != 0)
        emacs_abort ();
# ifndef XMALLOC_OVERRUN_CHECK
      alloc_unexec_post ();
# endif
    }

Where malloc_state_ptr doesn't acquire a sensible value when -fsanitize=address is enabled. I'm not sure why the normal path works, but I don't have enough familiarity with the Emacs source to figure it out.


texts: Insert url link with org-ref-insert-cite-link

texts:
I am using org-ref to insert citations in org files from a BibTeX file. In this BibTeX file, all entries have a "url" field.
As I am sharing these files on Gitlab with people not using emacs, I would like to define a function that mimics org-ref-insert-cite-link, but that would include the url from the corresponding BibTeX entry in the final link, resulting in something like
[[http://url-from-key.com][cite:key]]

so that "cite:key" appears as a link that points out to the online version of the paper linked from the BibTeX entry.
Is there a built-in function in org-ref that would allow doing such a thing, and if not how should I go about defining a function that have the behavior I just described?


texts:
I have run the macport emacs 27 on macOS.
The bindings of my keys as as per mac-keys-mode (and aquamacs) and have Command key acting as alt.
Thus all my key bindings are A-key
This normally works.
However (iso-transl-ctl-x-8-map) copies the ctl-x-8-map into alt key bindings thus wiping out my bindings.
How do I stop iso-transl being run.
On the latest time this happend the debug stack shows
Debugger entered--entering a function:
* iso-transl-define-keys((("* " . [160]) (" " . [160]) ("*!" . [161]) ("!" . [161]) ("\"\"" . [168]) ("\"A" . [196]) ("\"E" . [203]) ("\"I" . [207]) ("\"O" . [214]) ("\"U" . [220]) ("\"a" . [228]) ("\"e" . [235]) ("\"i" . [239]) ("\"o" . [246]) ("\"s" . [223]) ("\"u" . [252]) ("\"y" . [255]) ("''" . [180]) ("'A" . [193]) ("'E" . [201]) ("'I" . [205]) ("'O" . [211]) ("'U" . [218]) ("'Y" . [221]) ("'a" . [225]) ("'e" . [233]) ("'i" . [237]) ("'o" . [243]) ("'u" . [250]) ("'y" . [253]) ("*$" . [164]) ("$" . [164]) ("*+" . [177]) ("+" . [177]) (",," . [184]) (",C" . [199]) (",c" . [231]) ("*-" . [173]) ("-" . [173]) ("*." . [183]) ("." . [183]) ("//" . [247]) ("/A" . [197]) ("/E" . [198]) ("/O" . [216]) ("/a" . [229]) ("/e" . [230]) ("/o" . [248]) ("1/2" . [189]) ("1/4" . [188]) ...))
  byte-code("\301\10!\210\302\303!\207" [iso-transl-char-map iso-transl-define-keys provide iso-transl] 2)
  map-keymap(#f(compiled-function (key item) #<bytecode 0x1fe107d7ed09>) iso-transl-ctl-x-8-map)
  keymap-canonicalize(iso-transl-ctl-x-8-map)
  describe-buffer-bindings(#<buffer file-management.org> [24])
  which-key--get-current-bindings([24])
  which-key--get-bindings([24] nil nil)
  which-key--create-buffer-and-show([24])
  which-key--update()

SO in this case which-key called describe-buffer-bindings but it could be something else. I do not need or want these extra key bindings


texts: What is the difference between #+TBLNAME and #+NAME in org-mode

texts: What is the difference between giving a table a name using #+TBLNAME and #+NAME in org-mode?


texts: Ensuring binary packages with use-package

texts:
I just started organizing my packages with use-package because I need the simple transition between few computers. I use few binary programs asynchronously, and been therefor searching for solution that lets me maintain them along Emacs packages.

It seems pretty easy with use-package, but I am constantly getting errors like:

Error (use-package): Cannot load ag

I tried to supply optional installation command as second argument to the keyword :ensure-system-package, still error is the same for my setup.

(use-package ag
  :ensure-system-package (ag . "wajig install ag")
  :config
  (use-package helm-ag-r :ensure t))


texts: How can I position \label outside \caption in LaTeX export of figures?

texts:
Say you have a figure in your org-mode file like the following one:

#+NAME: fig:first-figure
#+CAPTION: Some caption
#+BEGIN_figure
This is a figure.
#+END_figure

This is exported to LaTeX code where \label is put inside the argument of \caption:

\begin{figure}
This is a figure.
\caption{\label{fig:first-figure}
Some caption}
\end{figure}

However, this may cause problems in some templates such that the references to the figure will be ill-formed. This can be repaired by putting the \label command outside and after \caption:

\begin{figure}
This is a figure.
\caption{Some caption}
\label{fig:first-figure}
\end{figure}

Right now, I'm using macros to achieve this in the LaTeX file, but this doesn't feel right...

How can I adjust the export routine to change the order of \label and \caption?


texts: How can I get working motion keys with `emacs -nw`?

texts:
when I start Emacs without windowing system (-nw), the motion keys are not working. Instead, I get (parts of) the escape sequences, like:

;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with C-o and enter text in its buffer.

[C[B[D[A[A[C[B[D[4~[C][B][A][A]

Thats four cursor keys, some function keys, home, end...

Edit:
I see this on my debian buster machine as well as in termux on android. Both share the same configuration.
Running emacs like emacs -nw -Q gets rid of the problem…


texts: Anonymizing text using emacs (replace all non-whitespace characters by x)

texts:
Suppose I select some text in an emacs buffer using point and mark.
How do I tell emacs to replace each non-whitespace character with x, say? For concreteness, that I select the text using point and mark.
Also, for clarity, I consider newlines to be whitespace for the purpose of this question.

The idea is to keep the structure of the text intact, but remove all information. My current use case is a LaTeX MWE document.


texts: How does web-mode recognize the php code or html code

texts:
It looks a quite magic that the web-mode could mix with php mode.
A major mode could contain another major mode. This seems amazing.

(add-to-list 'auto-mode-alist '("\\.php\\'" . php-mode))
(add-to-list 'auto-mode-alist '("\\.blade\\.php\\'" . web-mode))

If I have a file named "portal.blade.php",  how does web-mode recognize the internal php code?


texts:
I used to be able to scale down an inline image in org-mode with

#+attr_html: :width 650 px
[[file:~/org/def/202a3-9.jpeg]]

But now it doesn't work anymore, presumably because of an update to 8.3.5.  What to do?


texts: How to include an index in a list generated by mapcar?

texts:
This statements generates a list of (list filename buf),
How could this be written to include an index as well?

eg: (list index filename buf) where the index would be a counter, starting at zero, increment 1 for each item.

(mapcar
  (lambda (buf) (list (buffer-file-name buf) buf))
  (seq-filter 'buffer-file-name (buffer-list))))


texts: I would like to modify how mime/html entities are transformed to text in Wanderlust. At the very least removing background colors and excessive spacing. Is there any simple way to do so?


texts: How to detect keystrokes which don't edit the buffer?

texts:
What's the best way to detect keystrokes (e.g. via a hook) which don't edit the buffer? I mean things like arrow-keys for point motion, calls to beginning-of-buffer, etc.

The reason for this is that I'm working on some ycmd bindings for emacs, and I'd like to be able to detect (at least heuristically) when the user has stopped editing and is moving around the buffer. This is a good time for shipping the buffer contents off for parsing. The vim client does this when the user exits insertion mode, and I'm trying to emulate that behavior.


texts: eval-when-compile: Is my understanding correct?

texts:
I want to build a ring of symbols in my init.el for the purpose of rotating themes. I could do it like this:

(let* ((themes '(doom-one zenburn leuven))
       (ring (make-ring (length themes))))
  (mapc (lambda (x) (ring-insert ring x))
        themes)
  (setq my-theme-ring ring))

which results in the following data-structure

(0 3 . [doom-one zenburn leuven])

Or, I could build it more directly:

(let* ((vector [doom-one zenburn leuven])
       (ring `(0 ,(length vector) . ,vector)))
  (setq my-theme-ring ring)

The first approach goes through the ring.el public API and makes no assumptions about its implementation.

The second approach does less work, but could break if ring.el changes its implementation.

I think I can use eval-when-compile to get the best of both worlds:

(setq my-theme-ring
      (eval-when-compile
        (let* ((themes '(doom-one zenburn leuven))
               (ring (make-ring (length themes))))
          (mapc (lambda (x) (ring-insert ring x))
                themes)
          ring)))

Or maybe even:

(eval-when-compile
  (let* ((themes '(doom-one zenburn leuven))
         (ring (make-ring (length themes))))
    (mapc (lambda (x) (ring-insert ring x))
          themes)
    (setq my-theme-ring ring)))

When I compile my init file, it will iterate over the themes and add them one-by-one to the ring. When I start Emacs and load my already compiled init file, however, it will just read the already populated ring that resulted during compilation.

Is that right? And if so, can I nest the setq call within the eval-when-compile body too, as I've done in the last code snippet, or can I only use the compiled result for the value it returns?


texts:
My understanding is if that I use any of :commands, :bind, :bind*, :bind-keymap, :bind-keymap*, :mode, or :interpreter, then it will create a corresponding autoload and defer loading of the package until that autoload is triggered.

I'm confused about the situations in which the package will load given that I don't use any of the above sections and I set it to :defer t.

I see this in the readme:

  Typically, you only need to specify :defer if you know for a fact that some other package will do something to cause your package to load at the appropriate time, and thus you would like to defer loading even though use-package isn't creating any autoloads for you.

If I know for a fact that package X has "built-in" autoloads (i.e. autoloads defined by the package author), then can I simply set :defer t and rely on those to load the package at the appropriate time?


texts: Copying text selected by multiple cursors to a new buffer

texts:
Say we want to kill the region selected by all cursors in multiple-cursors, and yank it all to a new, empty buffer. How do you do that with multiple-cursors?

Note that a simple copy and paste of the text on the new buffer does not work, since it only yanks the region from the first cursor (as reported here).

Note: This question is motivated by the answer and problem presented in:
Keeping only the lines with the cursors in multiple-cursors


texts: Org-Mode: Keep a daily, repeated task marked as done until the next day

texts:
I have a checklist of daily tasks like so:

* TODO Brush Teeth
SCHEDULED: <2016-05-15 +1d>

* TODO Exercise
SCHEDULED: <2016-05-15 +1d>

Normally, if I mark an item as done, org-mode increments the date counter, logs the item as done and keeps the items marked as TODO.

* TODO Brush Teeth
DEADLINE: <2016-05-16 Mon +1d>
:PROPERTIES:
:LAST_REPEAT: [2016-05-15 Sun 15:37]
:END:
- State "DONE"       from "TODO"       [2016-05-15 Sun 15:37]

Is there a way to keep an item marked as DONE until the next day?


texts: Is everything in Emacs made of functions?

texts:
Being more used to Vim, I know that it was correct to think "everything in Vim is a macro" but what about Emacs?
Is it fine/correct to think that everything is a function in Emacs?


texts:
I want to emulate (and even replace) some electric modes (eg. cperl-electric, ruby-electric) with my own custom templates using yasnippet, but it doesn't seem to be possible - can someone enlighten me?

So in addition to normal templates triggered by TAB, I'd like to have some snippets triggered simply by a space, eg. typing "forSPACE" should fire a snippet instead of having to type "forTAB".

Is that possible?

Update: I also realise that for some "electric" features I want some patterns to fire without any sort of trigger key - eg. like cperl-mode turns { into a paired {} with the insertion point in the middle, I'd like to do the same for single and double quotes. (Of course in this case what I really want is paren-mode to work with syntax less regular than lisp, but I fought that battle some years ago with only limited success!)


texts: Implementing (org-agenda) sort comparison function in terms of presence of list items

texts:
I want to implement an org-agenda-cmp-user-defined for use with org-agenda-sorting-strategy and user-defined-up / user-defined-down.

In order to do that, I have two lists of tags I need to compare, from the two items to be sorted passed to org-agenda-cmp-user-defined.  I want the function to compare based on a particular order of tags, say:

("spam" "ham" "eggs")

So that the items are sorted by whether they have tag "spam" first, then breaking ties by whether they have tag "ham", etc.

How can I do that, in good elisp style?  I'd like it to be reasonably CPU-efficient, since org-agenda already does quite a bit of work building its views.

I'm aware that org agenda has a built-in way of sorting based on the first tag on each item: note this is different from that behaviour.

For example, these sets of tags are sorted according to the priority list above (("spam") and ("lettuce" "spam") are equal for sorting purposes, the others are all distinct for sorting purposes):

("spam" "ham" "eggs")
("spam" "ham")
("spam")
("lettuce" "spam")
("ham")
("eggs")
nil

Of course, org-agenda-cmp-user-defined would see only one pair of these values at a time.


texts: Scrolling during isearch stops searching, losing matches

texts:
I use C-s to search for a string. All matches are highlighted.
Then I would like to scroll down by C-v, but all matches disappear.

I know keeping C-s will move to the next match, but it is too slow. How shall I do then? Thanks.


texts: Convention about using C-x or C-c as prefix keys

texts:
What are the conventions for using C-x, C-c, or M- as prefix keys?

For example: is C-x, etc., for saving or visiting buffers?  Is C-c, etc., for text editing?

Background

Maybe this is a silly question.  I use a Spanish keyboard, and sometimes redefine keybindings that are common for an English (QWERTY) keyboard.  For example: shell command is bound in vanilla Emacs to M-!.  I bind it to M-¡ instead, because M-! is M-shift-1, which I cannot press easily.  I'm wondering if there are conventions that I am overriding when I make these kinds of changes


texts: org-capture prompt for headline after content

texts:
I want to create a capture template for my org-based journal. But I do not want to worry about entering a title straight away.

How can I setup my capture template so that org-capture prompts me for the title only after I finish writing my journal entry?

Thanks!


texts: Combining magit with undo-tree for easy history navigation

texts:
I love undo-tree (screenshot below). It provides an easy way for navigating through different versions of a file (top window) by letting the user move around the file's history tree in a separate window (bottom window) with simple keys such as n, p and C-b and C-f to  switch across descendants of the same parent.

Most notably, undo-tree updates the buffer holding the file with the corresponding version based on the selection in the tree view, automatically.

Of course, magit is phenomenal for git, and it would be amazing if it had a similar ability, i.e. letting users navigate a file's git history interactively while simultaneously updating the buffer holding the file automatically.

Is this at all possible with magit today?


texts: Passing a string with substitutions to the "perform-replace" command

texts:
I want to generalize this query-replace regexp:

(perform-replace "Geophysical[\s\t\n]*Research[\s\t\n]*Letters"
                 "Geophys.\\\\ Res.\\\\ Lett."
                 t t nil 1 nil (point-min) (point-max))

that replaces "Geophysical Research Letters" with "Geophys.\ Res.\ Lett." in my LaTeX code,
with a function that I figured out to call later with mapcar on a list of pairs of values.

I wrote this function:

(defun ExtendedJNameAbbreviator (COUPLE) ; 13/07/2017
  (interactive)
  (let* ((case-fold-search nil)
     (ExtendedName (car COUPLE))
     (ExtendedName (replace-regexp-in-string "[\s\t\n]"
                                             "[\s\t\n]*" ExtendedName t))
     (Abbreviation (nth 1 COUPLE))
     (Abbreviation (replace-regexp-in-string "\\."
                                             ".\\\\\\\\" Abbreviation t)))

    (perform-replace ExtendedName Abbreviation t t nil 1 nil (point-min) (point-max))
    ))

That works. You can test it with:

(setq mycouple '("Geophysical Research Letters"
                 "Geophys. Res. Lett."))

(ExtendedJNameAbbreviator mycouple)

But I don't understand "how it works". I mean why

(Abbreviation (replace-regexp-in-string "\\."
                                        ".\\\\\\\\" Abbreviation t)))

works? I tough it should be:

(Abbreviation (replace-regexp-in-string "\\."
                                        ".\\\\\\\\\\\\\\\\" Abbreviation t)))

instead if I put:

(read-string Abbreviation)

just before the perform-replace line it return:

"Geophys.\\ Res.\\ Lett.\\"

Should't it be

"Geophys.\\\\ Res.\\\\ Lett.\\\\"

as the direct perform-replace command?

More: I want to remove the last backslash in the replacement string. But if I wrote:

(defun ExtendedJNameAbbreviator (COUPLE) ; 13/07/2017
  (interactive)
  (let* ((case-fold-search nil)
     (ExtendedName (car COUPLE))
     (ExtendedName (replace-regexp-in-string "[\s\t\n]"
                                             "[\s\t\n]*" ExtendedName t))
     (Abbreviation (nth 1 COUPLE))
     (Abbreviation (replace-regexp-in-string "\\."
                                             ".\\\\\\\\" Abbreviation t))

     ;; To remove last \ in replacement string:
     (Abbreviation (replace-regexp-in-string "\\\\\\'"
                                             "" Abbreviation t)))

    (perform-replace ExtendedName Abbreviation t t nil 1 nil (point-min) (point-max))
    ))

I get

Invalid use of `\' in replacement text

I can't fix that. Do I need to set some string property? Do I miss something in the escaping logic? I think I don't understand the logic of the string sub-replacement in these cases.

Edit. Ok, I made it working but yet I cant understand why it works like that. This is the working code. (I realized that perform-replace and replace-regexp-in-string have slight differences in the rexexps management).

This is wy working code:

(defun ExtendedJNameAbbreviator (COUPLE) ; 13/07/2017
      (interactive)
      (let* ((case-fold-search nil)
         (ExtendedName (car COUPLE))
         (ExtendedName (replace-regexp-in-string "[\s\t\n]"
                                                 "[\s\t\n]*" ExtendedName t))
         (Abbreviation (nth 1 COUPLE))
         (Abbreviation (replace-regexp-in-string "\\."
                                                 ".\\\\\\\\" Abbreviation t))

         ;; To remove last \ in replacement string:
         (Abbreviation (replace-regexp-in-string "\\\\\\\\\\'"
                                                 "" Abbreviation t)))

        (perform-replace ExtendedName Abbreviation t t nil 1 nil (point-min) (point-max))
        ))


texts:
I am not sure if that is a problem on my site or more people are experiencing this. I thought at first that I broke something in my config file, but after loading by backup .emacs.d, the error is the same.

I put use-package ensuring magit up to my .init.el so it looks like so:

;;; PACKAGES CONFIGURATION
(require 'package)
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
             ("melpa" . "https://melpa.org/packages/")
             ("marmalade" . "https://marmalade-repo.org/packages/")
             ("melpa-stable" . "https://stable.melpa.org/packages/")
             ("elpy" . "https://jorgenschaefer.github.io/packages/")))
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

'(use-package-compute-statistics)

;; Ensure system binaries keyword
(use-package use-package-ensure-system-package
  :ensure t)

(use-package auto-package-update
  :ensure t
  :config
  (setq auto-package-update-delete-old-versions t)
  (setq auto-package-update-hide-results t)
  (auto-package-update-maybe))

(use-package magit
    :ensure t
    :pin melpa)

;; Evaluation of packages and all personal configuration is exported
;; to  `~/.emacs.d/myinit.org`.
(org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))

(provide 'init.el)
;;; init.el ends here

I get also this list of unable to activate packages at startup in *Messages* buffer:

Unable to activate package ‘ghub’.
Required package ‘graphql-0.1’ is unavailable
Unable to activate package ‘magit’.
Required package ‘ghub-2.0.1’ is unavailable
Unable to activate package ‘ghub’.
Required package ‘graphql-0.1’ is unavailable
Unable to activate package ‘ghub’.
Required package ‘graphql-0.1’ is unavailable
Unable to activate package ‘ghub+’.
Required package ‘ghub-2.0’ is unavailable

If nobody finds an answer here, I will rise an issue as it can be matter of a bug.


texts: Running a command in term from eshell with arguments

texts:
Basically I want to run watch from eshell.

Simply running watch date (for example) doesn't work (only the first header line is displayed).  Apparently I should run it with term or ansi-term but these two commands take only one argument -the command, which would be watch - and I don't know where to put the arguments (i.e. date in the example above).

So, I guess my question is: What is the proper way to run watch date (or any other watch such as watch "make myprog && ./myprog") from eshell?


texts: Convert list to subtree without eating newline before next tree item

texts:
Say we have this file:

* A
  - L1
  - L2
* B

If we execute org-list-make-subtree on any position within the list (the two lines with L1/L2), we get

* A
** L1
** L2* B

So the conversion "eats" the newline after the last list item.

When having an additional newline before, it still eats the newline:

* A
  - L1
  - L2

* B

After conversion:

* A
** L1
** L2
* B

It happens at any level in a tree, and no matter whether the list is indented or has further levels.

Whether you always use a newline before a new heading or not - I don't see a reason for this behaviour to be useful because you manually have to add the newline to restore your previous layout.

Why is that so and how can it be prevented? Should it be filed as a bug?

Emacs version: 26.1 (with Spacemacs 0.200.13.x)


texts: This may be a silly question, but how can I make a buffer unreachable? I have enabled live-py-mode. Every time I try to edit my python file it evaluates the code, which is a well and good but it's a little annoying how it switches focus from the source file to the eval result. Is there a way I can prevent changing focus from source to result?


texts: I use an auto complete tool in emacs, which can complete brackets. But I want to find out that how it determines whether it should complete the bracket. For example, assuming | stands for the point. In the case of |  abc, when typing (, it will auto complete to (|)  abc. In another case of |abc , when typing (, it will not auto complete just like what sublime does.


texts: What happened to magit-remote-update in version 2.1

texts:
The previous version of Magit had a remote update command to replicate

  git remote update

What is the replacement command?


texts: How to delete all instances of a character in a bunch of files?

texts:
I was given a directory of files in which I was asked to make some systematic changes. Because it was a one-off task, and because there were only a few hundred files I thought I'd use an Emacs keyboard macro.

My macro, in addition to making the desired changes, placed a bunch of ! in the buffer (since I was trying to answer a query about whether to replace an instance of pattern match with a declaration tell emacs to replace all instances, and if no instances were found it just inserted an !).

Is there a nice simple way of getting rid of all these ! using another keyboard macro and/or some simple elisp?


texts:
I've just began playing with org-taskjuggler
http://orgmode.org/worg/org-tutorials/org-taskjuggler.html
Although I've tried all sorts of .org examples, every time I end with efforts of length zero.  As show in the above tutorial I provided various values for the "Effort" property like
** Specification
   :PROPERTIES:
   :Effort:   20d
   :END:

Where does this come from?  What do I have to do to fix this?
Using tj3 v3.6.0


texts:
I have a situation where there is one primary author and a few more secondary authors.  I only want to specify the email of the primary author, but it gets appended to the last author mentioned.

Beside the original question: is there a better way of specifying multiple authors than:

#+author: First author, \\ second author \\ etc.

This line gets too long when you need to specify the titles of people involved.  It also interferes with the generated table of contents.


texts: How to swap words `true` and `false` in buffer text?

texts:
I found myself switching the text true to false, and vice versa, while coding very often. It's quite tedious to mark the entire thing and replace it with opposite. It would be great to have a function that replaces word under the cursor to true if it was false and vice versa.
Is there any existing solution to solve that? If not how this can be implemented.


texts: Installing Emacs from source: 'make' fatal error: 'libxml/tree.h' file not found

texts:
I wish to run Emacs from the latest development version.

I've downloaded the latest Emacs development version from https://savannah.gnu.org/projects/emacs (with git clone -b master git://git.sv.gnu.org/emacs.git), ran autogen.sh as suggested here, then followed the instructions on the screen: after autogen.sh I executed ./autogen.sh git, then ./configure, and finally make (if I run make install instead, I get the same error message as below). All the steps except make seemed to finish successfully.

As for make, it started off well enough, but at some point it stopped with the following error message:

xml.c:23:10: fatal error: 'libxml/tree.h' file not found
#include <libxml/tree.h>
         ^
1 error generated.
make[1]: *** [xml.o] Error 1
make: *** [src] Error 2

My path includes /usr/local/Cellar/libxml2/2.9.4_3/include/libxml2, and this directory in turn contains libxml/tree.h.

How can I fix the problem?

I run macOS Sierra version 10.12.5 .


texts:
I am using Ubuntu 15.10 and Emacs 24. but recently when i open a Python source file in Emacs or create a new one, i get an error:

  symbol's function definition is void: format-message

The file is opened as a Fundamental.


texts: How to make a diff tool ignore asterisks?

texts: I want to compare and merge some org files. How can I make a diff tool assume that some tasks or notes are identical, even if they are on different levels, i.e. strings only differ in the number of asterisks (*) at the beginning? I would then collapse those strings and consider merging only the rest that really differ.


texts: Order of evaluation of nested macros and backquotes

texts:
I read https://github.com/lunaryorn/blog/blob/master/posts/byte-compiling-eval-after-load.md which contains this code:

(defmacro stante-after (feature &rest forms)
  `(,(if (or (not byte-compile-current-file)
             (if (symbolp feature)
                 (require feature nil :no-error)
               (load feature :no-message :no-error)))
         'progn
       (message "stante-after: cannot find %s" feature)
       'with-no-warnings)
    (eval-after-load ',feature
      `(funcall (function ,(lambda () ,@forms))))))

I read (info "(elisp)") but can't find a strict statement that the inner macro is expanded before the outer one. I can't find the semantics of nested backquotes.

I understand that ,(lambda () ,@forms) has a comma before lambda in order to mark the form as functional and that triggers byte-compilation, but I can't figure out in which order that comma is interpreted by the backquote macro.


texts:
I have always found TRAMP to be crazy slow (5+ secs to fetch a directory listing) so I've avoided it for years. Time to figure out what is going on. I'm always connecting via ssh, using declarations in ~/.ssh/config. The connections are fine, I've survived buy running remote emacs sessions in a terminal.

I figured out how to turn on tramp debugging but not sure how to read the output. It appears that there might be a delay before tramp starts doing anything? Perhaps tramp is conflicting with some other mode?


texts: Getting a speedbar to display a tree for org-mode headings

texts:
Is there a way I can get speedbar to give a complete top level tree and click through to lower levels?
treemacs does it (but doesn't have buffer, info, etc minor modes) ...
speedbar can produce a tree of headings for org-mode files although the default settings need a slight tweak:
;; default is (speedbar-prefix-group-tag-hierarchy speedbar-trim-words-tag-hierarchy)
(setq speedbar-tag-hierarchy-method '(speedbar-trim-words-tag-hierarchy))

For example, for this org-file:
* Places
** Queensland
*** Tamborine
foo bar
*** Gold Coast
**** Various
bar foo
**** Restaurants
foobar
*** Days out

...

The default settings give this:
~/Sync/
0:[-] bh.org *
1: {-} *  (Places)
2:  > * Places
2:  > * Recipes
2:  > * Health
2:  > * Lists
2:  > * Things
2:  > * Fotki
2:  > * Probus
2:  > * Ironies
1: {-} **
2:  {-} **
3:   {+} ** A
3:   {+} ** B
3:   {+} ** C to ** G
3:   {+} ** H to ** L
3:   {+} ** M
3:   {+} ** N to ** R
3:   {+} ** S to ** Wheelbarrow

... a rather mangled list, and the top level headings are truncated to the first 8, but at least a tree. With the tweak above, I get this:
~/Sync/
0:[-] bh.org *
1: > * Places
1: > ** Queensland
1: > *** Tamborine
1: > *** Gold Coast
1: > **** Various
1: > **** Restaurants
1: > *** Days out

... at least it's in the original order and not truncated - but it's totally flat - the tree structure has gone.


texts:
Trying to magit-bisect-start in Emacs source code with the bad commit being emacs-24.5 and good being emacs-25.1 does not seem to work. Nothing is shown in the Magit buffer.

Doing the same with other repos works fine.

Is there an issue with Emacs sources having too many commits or something?


texts:
From SPC f f (counsel-find-file) minibuffer, open Hydra with C-o (hydra-ivy/body).
This is what hydra looks on my system:

The Hydra right column has "[m] matcher: order".
Pressing 'm' rotates matcher between "other" and "ivy".
How to active "other" or "ivy"?
Why does "order" not appear in the rotation?

Some of the Hydra commands in the menu are not obvious (not to me).
Where are the Hydra commands documented?

I am using Emacs 26.1 with Evil Spacemacs 0.200.13 and Ivy.

UPDATE 1:

The screenshot of my Hydra matches the Spacemacs Hydra documentation at:
https://github.com/syl20bnr/spacemacs/blob/c7a103a772d808101d7635ec10f292ab9202d9ee/layers/%2Bspacemacs/spacemacs-completion/packages.el > define-transient-state ivy

Seems that my:

Hydra menu is for Spacemacs mode
Hydra is not running Spacemacs mode
Hydra *help* does not describe Hydra Spacemacs mode

Three examples follow.

1) Hydra menu says:

[f] case-fold: auto

Pressing 'f' toggles between 'nil' and 'auto'.
In the help, hydra-ivy/body says:

"f": ‘ivy-alt-done &optional’
Exit the minibuffer with the selected candidate.

2) Hydra menu says:

[TAB] alt done

Pressing TAB opens *ivy-occur counsel-find-file ""*<2> like this:

In the help, hydra-ivy/body does not mention "TAB".

3) Hydra menu says:

[c] & cont

Pressing 'c' opens *ivy-occur counsel-find-file ""*<2>.
In the help, hydra-ivy/body says:

"c":    ‘ivy-toggle-calling’

UPDATE 2:

posted issue: Hydra key behaviors do not match the Hydra menu in Spacemacs.

UPDATE 3:

From C-h f hydra-ivy/body RET:

hydra-ivy/body is an interactive autoloaded compiled Lisp function in
‘ivy-hydra.el’.

(hydra-ivy/body)

Call the body in the "hydra-ivy" hydra.

The heads for the associated hydra are:

"h":    ‘ivy-beginning-of-buffer’,
"j":    ‘ivy-next-line’,
"k":    ‘ivy-previous-line’,
"l":    ‘ivy-end-of-buffer’,
"o":    ‘keyboard-escape-quit’,
"C-g":    ‘keyboard-escape-quit’,
"i":    ‘nil’,
"C-o":    ‘nil’,
"f":    ‘ivy-alt-done’,
"C-j":    ‘ivy-alt-done’,
"d":    ‘ivy-done’,
"g":    ‘ivy-call’,
"C-m":    ‘ivy-done’,
"c":    ‘ivy-toggle-calling’,
"m":    ‘ivy-rotate-preferred-builders’,
">":    ‘ivy-minibuffer-grow’,
"<":    ‘ivy-minibuffer-shrink’,
"w":    ‘ivy-prev-action’,
"s":    ‘ivy-next-action’,
"a":    ‘ivy-read-action’,
"t":    ‘(setq truncate-lines (not truncate-lines))’,
"C":    ‘ivy-toggle-case-fold’,
"u":    ‘ivy-occur’,
"D":    ‘(ivy-exit-with-action (lambda (_) (find-function (quote hydra-ivy/body))))’

The body can be accessed via ‘hydra-ivy/body’.


texts:
WHAT WORKS FINE.

When I compile a .tex file with C-c C-c, emacs knows that it should use pdflatex.  I don't really know how, because I don't see pdflatex in my .emacs nor init.el (I can't find an .emacs.el file).  On the other hand, which pdflatex returns the absolute path /Library/TeX/texbin/pdflatex so emacs knows where to find it.

WHAT I CAN'T MAKE TO WORK.

I recently package-install'ed markdown-mode, as well as pandoc using brew install pandoc.  When I run C-c C-c m to compile, I get markdown failed with exit code 127.  I think it means that emacs is not able to find pandoc.  For one thing, pandoc is not listed under package-activated-list, but I guess it could never be there since pandoc is not an elisp package (is that correct?).  On the other hand, which pandoc returns the absolute path /usr/local/bin/pandoc so it's not a problem of pandoc not being able to be found.

Following this answer
I could add
(setq pandoc-binary "/usr/local/bin/pandoc") in my .emacs, but I am not sure where since I don't see any other non-elisp packages included there. But again, I don't see any such line for pdflatex in my configuration files (.emacs or init.el), so this wouldn't answer my question:

How does emacs know to use pdflatex and not pandoc?  In other words, which other files contain further configuration parameters?


texts: How to remove trailing whitespace in mail signature

texts:
I'm trying to get rid of the auto-inserted trailing whitespace in message-mode signature. I have tried the advice below.

(defadvice message-insert-signature (around +amos*message-insert-signature activate)
  (let ((old-insert (symbol-function 'insert)))
    (flet ((insert (str) (eval-when-compile (require 'subr-x)) (funcall old-insert (string-trim-right str))))
      ad-do-it)))

But it doesn't have any effect.


texts:
I am trying to use Jabber to connect to Google Hangouts.

My configuration looks like this:

(setq jabber-account-list '(("[myusername]@gmail.com"
                             (:network-server . "talk.google.com")
                             (:connection-type . ssl))))

When I invoke jabber-connect-all and type in my password, I get the following error message:

[myusername]@gmail.com: connection lost: `exited abnormally with code 1'

How can I fix this?


texts:
Exporting to odt used to work fine in the past, until today, where I suddenly experienced the following error:

OpenDocument export failed: You’re not in a project

What could the source be?
What shall I do to remove this message?


texts: replace-string has the DELIMITED parameter, which can be used to replace only whole words. replace-in-string does not have such a parameter. Is there an easy work-around besides creating a temporary buffer and using replace-string?


texts: Show something in active mode line instead of all mode lines

texts:
I set up an org-timer indicator in the mode line with this.

(setq-default
 mode-line-format
 (quote
  (
   ;; org-timer
   (:eval
    (unless (not org-timer-countdown-timer)
      (propertize (let* ((rtime (decode-time
                                 (time-subtract
                                  (timer--time org-timer-countdown-timer)
                                  (current-time))))
                         (rmins (nth 1 rtime))
                         (rsecs (nth 0 rtime)))
                    (format " %d:%d" rmins rsecs))
                  'face '(:foreground "cyan" :weight bold)
                  'help-echo "org-timer")))

   )))

I want this org-timer indicator to be shown in the active mode line only, instead of all mode lines. How to do it?


texts: Send org-capture tasks to different files, depending on which file org-capture is called from

texts:
I am beginning to use org-mode as an electronic lab notebook, which is working very well. I work on a number of different projects, each of which has its own directory. When I use org-capture, I want the task, etc., to be written to an .org file in the directory for the current project.

So if I am working in my org lab notebook for Project A and I capture a task, I want that task to go to the capture.org file in the directory for Project A, but when I capture a task from my notebook for Project B, I want the task written to capture.org in that directory instead.

It seems like I could do this with different templates, using something along these lines.

(setq org-capture-templates
'(("t" "Todo" entry (file "~/project_a/capture.org")...)
  ("u" "Todo" entry (file "~/project_b/capture.org")...)
  ("v" "Todo" entry (file "~/project_c/capture.org")...)))

The downside of this is that I have to remember or check a lot of different templates each time, making it more distracting to capture something, especially when I'm working on a lot of different projects.

An alternative would be to always insert the capture into the buffer I'm currently working on, but I'd rather not do that.

I think I could also just have a small piece of executable code at the beginning of each notebook that defines all the captures, but there must be a better way than that.

I suspect that there may be some way to do this by giving the target as a function, but I can't figure out how to do that, and I'm not sure whether it's the best way.

What would be ideal is that any capture done in ~/project_a or any of its subdirectories would go to ~/project_a/capture.org, but I can easily live with the customization applying only to the specific file (~/project_a/notebook.org) that I use as my notebooks, since I'll almost always have that open.


texts: org mode babel use contents of block as file in another block

texts:
I'm trying to define some data in json file and use the file name in another bloc as command parameter. Something like that:

The data:
#+BEGIN_SRC json
{
  "Foo": "Bar"
}
#+END_SRC

... and the script
#+BEGIN_SRC json
do_something_with_json $the_data
#+END_SRC

Is it possible?


texts: Unable to change cursor type in terminal

texts:
I'm trying to change the cursor type in Emacs. Here are the steps I'm following,

C-h v cursor-type
check the value of cursor type. It is set to t.
start emacs with emacs -nw -Q and type (setq cursor-type 'bar).
move the cursor to the end of the line and press C-x C-e
check the value of cursor type. It is set to bar.

What result I'm expecting?
The cursor type to change to bar.

What result I'm seeing?
The cursor type remains default style.

I have tested the same steps with GUI version of Emacs. Launched via emacs -Q from terminal. I'm able to change the cursor type.

I have Mate desktop environment and running this in mate-terminal. The TERM is set to xterm and i have also tried with setting TERM to xterm-256color.

I'm using debian and my emacs version and configuration are as follows,

```

In GNU Emacs 25.0.94.1 (i686-pc-linux-gnu, GTK+ Version 2.24.25)
 of 2016-08-30 built on hari-laptop
System Description:     Debian GNU/Linux 8.5 (jessie)

Configured using:
 'configure --with-xpm=no --with-jpeg=no --with-gif=no --with-tiff=no'

Configured features:
PNG SOUND GSETTINGS NOTIFY FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK2
X11

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Making completion list... [2 times]

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired format-spec rfc822 mml
mml-sec password-cache epg epg-config gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns help-mode easymenu
cl-loaddefs pcase cl-lib mail-prsvr mail-utils term/xterm xterm
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cl-generic cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote inotify dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 8 91186 5077)
 (symbols 24 19688 0)
 (miscs 20 34 138)
 (strings 16 14444 3826)
 (string-bytes 1 410993)
 (vectors 8 10488)
 (vector-slots 4 397081 4396)
 (floats 8 167 500)
 (intervals 28 192 14)
 (buffers 520 12)
 (heap 1024 30704 569))

```


texts: Resolve git merge conflict by applying diff hunk to different file

texts:
I have refactored a file by splitting into two files in one git branch, and someone else has made a different change to the original file on another git branch. This has produced a merge conflict in git when I tried to merge the second git branch into the first (which I did using magit). I have configured git to produce a 3-way diff surrounded by conflict markers in the file, and I have used C-c ^ = > to diff the original contents of the file and the second branch changes, which produces a vc-diff buffer.

How can I apply this vc-diff buffer to the second file, not the first file - either one hunk at a time, or all at once? I don't mind which way it is done, but I would prefer to do it one hunk at a time. (Bearing in mind that the line numbers will probably be different, but the surrounding text will be largely the same.)


texts: How to run emacsclient from applescript?

texts:
I am using https://github.com/sprig/org-capture-extension which is a cool Chrome extension to capture links while browsing. The setup on OS X requires defining an Applescript application which is called by the extension. Here is the code I use:

on emacsclient(input)
    display dialog input
    try
        do shell script "/usr/local/Cellar/emacs-plus/25.2/bin/emacsclient -n '" & input & "'"
    on error e number n
        my logit("OOPs: " & e & " " & n, "Emacsclient")
    end try
end emacsclient

to logit(log_string, log_file)
    do shell script ¬
        "echo `date '+%Y-%m-%d %T: '`\"" & log_string & "\" >> $HOME/Library/Logs/" & log_file & ".log"
end logit

on open location input
    emacsclient(input)
end open location

on open inputs
    repeat with raw_input in inputs
        set input to POSIX path of raw_input
        emacsclient(input)
    end repeat
end open

on run
    do shell script emacsclient("")
end run

There is an Emacs running in daemon mode which is started upon initial login in the system. The problem I have is the emacsclient run in the script cannot find the server's socket: This socket is located inside my $TMPDIR which is set by OS X and is not available to scripts run through applescripts shell script action.

How can I solve this conundrum? I need either to run the daemon with a fixed socket file so that I can pass that to the client, or retrieve $TMPDIR from within applescript.


texts: Limit magit to showing status of 1 directory

texts:
I'm working on a large repo with many folders, and showing the status is slow (just plain git takes a long time).

I am really only interested in one directory, how can I constrain magit to only seek the status of one directory so it will be fast.

I am specifically not looking to filter directories after the status is displayed (for an answer to that question see here: Magit show status on selected directory)


texts: How to add a macro to helm mode tex insert macro?

texts:
I am new to helm-mode. When I use it with LaTeX-mode for editing TeX files, and type backslash I get the following helm buffer:

Now, I would like to insert the \num command (from the siunitx package). However, the command num is not recognized, so nonumber is selected by default each time, and I then need to press arrow-up to select it and then press enter.

Is there a way to make num become the default cadidate? (Assuming I type num much more often than nonumber)

Alternatively, is there a way to make TeX-insert-macro History (see above screen shot) the default helm source instead of the current TeX-insert-macro?


texts:
Q: how can I get ESS (R) to plot directly to an Emacs buffer?

When interacting with R through ESS, R defaults to spawning a separate graphics window outside of Emacs to draw its plots.  (One can, of course, choose other graphical devices, which is how we plot to PDF, etc.)  Two issues: first, the new window steals focus from Emacs, and second, it sure would be nice to keep everything nice and tidy within the Emacs ecosystem.

So: is there any way to plot "directly" (or even indirectly) to an Emacs buffer and, more importantly, do so without a lot of manual intervention by the user?

There had been some prior discussion in this old Stack Overflow thread, but the partial solutions proposed are not ideal.  They mostly involve changing the plotting device in R (say, to PNG), plotting to a temporary file, and then manually visiting that file in an Emacs buffer.  That all strikes me as very clunky, especially if the goal is to use the plot window/buffer interactively and draw many plots in a session (or add layers to them on the fly).

I'm speculating here, but it strikes me that, since both R and Emacs support SVG, that might be a useful format to use.  However, it's not clear to me if/how one could hook into the R process to communicate on the fly.  Is there a way to have R spit SVG code directly into an Emacs buffer, or would it need to go through the intermediary of a temporary file?  How could one convince Emacs to visit a new temporary file automagically when R creates it, or update such a plot buffer when the temporary file gets updated/overwritten by a new plot?


texts:
I tried these two, but none of them worked.

(if (looking-at "\[") (insert "f"))

(if (looking-at "[") (insert "f"))

How can I escape square brackets in emacs regexp?


texts: How to access mouse event coordinates? (conveniently)

texts:
When getting events from (read-event) it's possible to access only  mouse events using (mouse-movement-p event).

Inspecting the events I've found I can get the Y pixel location using (cdr (nth 2 (nth 1 event)) however this seems overly cryptic.

What is a good way to access data in mouse motion events?


texts:
The Org Mode section on including files:

https://orgmode.org/manual/Include-files.html

seems to be missing a detail. It appears that relative paths are allowed, I
assume they would be relative to the directory of the parent file.

That is to say if I have file monday.org including file sunday.org, and they
are in the same folder, then I could use this syntax:

#+INCLUDE: "sunday.org"

Is that correct?


texts: Replacing the font of a character using a BDF's glyph

texts:
I am trying to create some custom glyphs inside a BDF font file and want to use these inside Emacs afterwards.
In order to get started I'd like to change one character (I used the greek alpha character) of the current fontset so it uses the glyph of a given BDF font.
But I have problems getting this to working and need a hints...
I tried several BDF font including the font '9x18.bdf' from https://www.cl.cam.ac.uk/~mgk25/ucs-fonts.html.
Inside that bdf-file I replaced the font family name Fixed by kuhn so I can easily select it in Emacs via the :family.
So after setting up the font on my system (Linux Mint) I used
(list-fonts (font-spec :family "kuhn"))

and the font shows up perfectly. Also directly setting the font via face attributes works - e.g. if the first character of my buffer is an alpha:
(add-face-text-property 1 2 '(:family "kuhn"))

But trying to replace the font used for alpha via
(set-fontset-font t #x3b1 (font-spec :family "kuhn"))

nothing happens (also if I replace t by "fontset-default"). Doing the same e.g. with a different font
(set-fontset-font t #x3b1 (font-spec :family "FreeMono"))

works fine and all alphas will get replaced. I also tried (add-to-list 'bdf-directory-list ...) to add the folder of the font file as well as using create-fontset-from-fontset-spec to setup a complete new fontset. This didn't work.
What am I missing or doing wrong?


texts: Trying to upcase single character (or region) selected *with multiple-cursors active*

texts:
I'm trying to get used to multiple-cursors. It's super useful but the way it interacts with many emacs builtin functions seems weird - perhaps I just don't quite understand how it works.

Eg. my current goal was editing a bunch of constants to add a k in front, easily done, but then the next character is currently lowercase and I want it to be upcase. upcase-word won't work because I want it to retain the camelcase chars in the word - so I can select a region with C-[:space:] C-f and now have a disjoint region covering all the characters to uppercase. But then upcase-region does nothing :(

Can someone explain what I'm missing?


texts: How do I remove all the trailing dashes in the mode line of terminal Emacs?

texts:
In terminal Emacs:

Look at the mode line. Notice that there are lots of dashes (hyphen-minuses, to be precise) (-----) at the end of the mode line (after "(Lisp Interaction)"). How do I remove these dashes?
These dashes only seem to appear in terminal Emacs but not in GUI Emacs.
(I am using GNU Emacs 25.2 on Ubuntu 18.04 bionic beaver).


texts:
Prelude has enabled a lot of very useful features, esp. auto complete. For some reason auto complete uses only lower case letters, which is not very helpful with camel-case class or function names.

For example, given the function name handleNewMessage, auto complete suggests handlenewmessage:

How can I get suggestions in camel case?


texts:
Newer versions of org-mode remap C-up to org-backward-paragraph.

I would like C-up not to be remapped (and continue to use the standard Emacs' backward-paragraph instead).

But the standard ways of avoiding this remap do not work with org-mode (i.e., (local-unset-key [C-up]) and (define-key org-mode-map [C-up] 'backward-paragraph)) don't do anything).  It seems that org-mode achieves this by remapping functions, not key bindings.

How to disable org-mode from remapping C-up?

Many thanks!


texts: How to stop execution of keyboard macro?

texts:
I mistakenly ran a keyboard macro with an Infinite Argument, which made the macro execute endlessly. Take the following example, which just inserts the character a:

C-x ( a C-x )

If I then run:

C-u 0 C-x e

in the *scratch* buffer, the newly defined keyboard macro will be executed over and over again.

I tried C-g several times, as well as ESC-ESC-ESC, but the execution did not stop, and I had to kill Emacs, as it was not responding. Is there any way to halt the execution of a macro without losing the Emacs session?

In case it makes a difference, the Emacs version I tried is 24.3.1.


texts: Unmapping Treemacs `` and `` (Page up and Page down)

texts:
I'm trying to unmap the <next> and <prior> key-bindings from Treemacs, because I find counterintuitive that it's the only place where they scroll a different window instead of the current one.

I've found that they are mapped inside keymap treemacs-mode-map, so in my .spacemacs user-config section I call this:

  (with-eval-after-load 'treemacs
    (unbind-key (kbd "<next>") treemacs-mode-map)
    (unbind-key (kbd "<prior>") treemacs-mode-map))

But when I try to open the treemacs panel I get this error message:

Wrong type argument: stringp, [next]

I also tried with (unbind-key <next>  or (unbind-key next or (kbd "PageDown" and nothing is working.


texts: Re-creating .vimrc key mappings in Emacs

texts:
I've been using vim for a while (though I'm only a basic user) and I've been trying out Emacs (specifically spacemacs).

I have remapped H and L to go to the start / end of the line by adding the following at the end of ~/.emacs.d/spacemacs/config.el

(define-key evil-normal-state-map "H" "^")
(define-key evil-normal-state-map "L" "$")

I have other mappings in my .vimrc that I really want to transfer for familiar functionality, but I'm not sure how to do this.

For example I have tried adding the following line to ~/.emacs.d/spacemacs/config.el (which doesn't work)

(define-key evil-insert-state-map "jf" "<ESC>")

How could I transfer that and the rest of my mappings over to emacs/spacemacs?


texts:
I am hoping to figure out how to do a query search that will comment out a line instead of query replace.  That is, do an interactive query search, and if I say yes, comment out the line the match is on.

Does this command exist?  If not, how would I write it?  I'm new to elisp, and don't know how to program my own functions.


texts: How can I kill a runaway/hung remote shell process from Org-Babel

texts:
I am using org-babel for literate programming and enjoying it so far.  The major issue I have run into so far though is killing a runaway/hung remote shell command (short of exiting Emacs altogether).
A trivial example:
#+begin_src bash :session mysesh
ssh myserver
vim
#+end_src

#+begin_src bash :session mysesh
ls
#+end_src

Obviously the vim command causes it to hang (and lockup emacs).  Using C-g will allow me to regain control of emacs, but the underlying session/ssh process is still locked up. This causes any subsequent commands that share that session (like ls in this example) to also lock up as the underlying session/ssh connection are still waiting on vim to finish.
Ideally I would like a way to send the equivalent of SIGINT/ctrl-c (from a terminal) to the session process so I could regain control of the session.  Despite scouring the documentation however, I can't figure out how to do this.  I am a little surprised, as I would have thought killing a hung session would be a pretty standard feature for something like babel.


texts: Magit blame only last commit (or range of commits)

texts:
Can I have magit-blame somehow only show the changes introduced with the last commit?

EDIT: what have I attempted?

I've looked at the docs of magit-blame and explored all flags in the magit-blame interface. Essentially I've inherited a repository and I want to see the changes introduced by a commit whilst being able to continue working on the code. That's why I would like to have magit-blame-addition overlays and not a simple diff.


texts: Working with LaTeX in Spacemacs: can PDFs be seen in a buffer, rather than via external PDF reader?

texts:
I have been using the latest version of Spacemacs, with AUCTeX. However, when I compile the .tex file into a .pdf file, it opens in my default external PDF viewer software. Is there a way to make LaTeX compile into pdfs that get opened in another Spacemacs buffer and framewindow?

My computer runs Windows 10 64 bits.


texts: How can I bind `C-c C-j` to always do `org-journal-new-entry`?

texts:
I did:
(use-package org-journal
  :ensure t
  :defer t
  :config
  (setq org-journal-dir "~/org/journal/"
        org-journal-date-format "%A, %d %B %Y"
        org-journal-time-format "%I:%M %p"))
(global-set-key (kbd "C-c C-j") 'org-journal-new-entry)

in my init.el file. However, C-c C-j seems to be bound to org-goto instead of C-c C-j for some reason. Why is this?
I got this idea from: (global-set-key (kbd "C-c C-r") 'ivy-resume) suggested in the Ivy docs and wanted to have a similar global shortcut to get into Org Journal. What is the best way to do this?u


texts:
What would be the an efficient/concise way to replace a sub-list with another list?

Example function call:

(replace-list-list-with-list '("A" "B" "C" "D") '("B" "C") '("NEW" "TEXT"))

Would result in:

'("A" "NEW" "TEXT" "D")


texts: Sorting an org-table numerically, ignoring commas (org-table-sort-lines)

texts:
I have the following org-table:

| Row # | Facility                 | Recycled Off-site |
|-------+--------------------------+-------------------+
|     1 | 1234, 12th st, jamestown |           216,574 |
|     2 | 1234, 12th st, jamestown |               760 |
|     3 | 1234, 12th st, jamestown |                 0 |
|     4 | 1234, 12th st, jamestown |               464 |
|     5 | 1234, 12th st, jamestown |                 0 |
|     6 | 1234, 12th st, jamestown |             2,280 |

and I want to sort the table by the last column. I perform M-x org-table-sort-lines n to sort the column numerically, and here is my output:

| Row # | Facility                 | Recycled Off-site |
|-------+--------------------------+-------------------+
|     3 | 1234, 12th st, jamestown |                 0 |
|     5 | 1234, 12th st, jamestown |                 0 |
|     6 | 1234, 12th st, jamestown |             2,280 |
|     1 | 1234, 12th st, jamestown |           216,574 |
|     4 | 1234, 12th st, jamestown |               464 |
|     2 | 1234, 12th st, jamestown |               760 |

Unfortuntaly, the commas are a thousands place holder, not a decimal. Is there a setting where I can have org-table sort the rows using the commas as a thousands placeholder? For example, here is my desired result:

| Row # | Facility                 | Recycled Off-site |
|-------+--------------------------+-------------------+
|     3 | 1234, 12th st, jamestown |                 0 |
|     5 | 1234, 12th st, jamestown |                 0 |
|     4 | 1234, 12th st, jamestown |               464 |
|     2 | 1234, 12th st, jamestown |               760 |
|     6 | 1234, 12th st, jamestown |             2,280 |
|     1 | 1234, 12th st, jamestown |           216,574 |


texts:
org-mode automatically indents description lists, but it uses two different schemes. For short labels, the second line of the description is aligned with the first character of the description. For long labels, the second line of the description is indented to five spaces, regardless of the first line. e.g.:

- short label :: description description description description
                 description description description description

- very long label :: description description description description
     description description description description

This produces ugly formatting for lists with a mix of description lengths. How can I control this behaviour for consistent indenting?


texts: Better display of local time in message-insert-formatted-citation-line?

texts:
The default behavior in emacs-25 for the following code is for message citation lines to display the time in UTC, even if (current-time-zone) returns a local time zone such as (-18000 "EST"), and even though (current-time-string) correctly returns a result in local time, and even though my "TZ" environment variable and /etc/localtime are properly set to my local time zone ...

(setq message-citation-line-format "On %a %d-%b-%Y at %T %Z, %f wrote:\n")
(setq message-citation-line-function 'message-insert-formatted-citation-line)

If I want the citation line to show the time in local time instead of UTC, I have to wrap message-insert-formatted-citation-line as follows ...

(defun my-message-insert-formatted-citation-line ()
  (message-insert-formatted-citation-line nil nil (car (current-time-zone))))
(setq message-citation-line-function 'my-message-insert-formatted-citation-line)

However, even with this hack, the citation line shows the time zone as a number (e.g., "-0500") for both the %Z and %z format characters.

I'd like the citation line to show the time zone using the actual timezone ID from (cdr (current-time-zone)) instead of a number. In my case, that would be "EST".

In other words, I'd like the citation lines to look something like this:

On Thu 04-Jul-1776 at 12:34:56 EST, Thomas Jefferson <tommy@colonies.uk.gov> wrote:

Note the "EST", which now can only appear as "-0500".

If I pass (cdr (current-time-zone)) as the final argument to message-insert-formatted-citation-line, it is ignored, and the time is once again displayed in UTC.

Does anyone know of an already-existing alternative function for creating citation lines, which doesn't default to UTC, and which properly shows the local time with the actual name of the time zone?

I know I could copy the message-insert-formatted-citation-line function from gnus/message.el to a new function called my-message-insert-formatted-citation-line and change how it handles its "tz" parameter. However, that is a long, complicated function, and I'd rather make use of something that has already been written, if such a function exists anywhere, than to hack this existing function.

Does anyone know of a pre-existing alternative to message-insert-formatted-citation-line that works the way I'd like?

Thank you very much, in advance.


texts:
I am generating a slideshow using org-reveal, and have links to other web-pages.  During the presentaion (conducted from the browser), I would like clicking on these links to result in opening the link in a new browser tab.

I tried the docu, but couldn't find anything.  Any suggestions?


texts: How to set mode hook with lambda using use-package

texts:
I'm attempting to set the following hook using use-package, but it's not getting applied.

Normal elisp:

(add-hook 'org-mode-hook (lambda () (org-bullets-mode 1)))

Using use-package:

(use-package org-bullets
  :ensure t
  :after org-plus-contrib
  :hook (org-mode . (lambda () (org-bullets-mode 1))))

Its value is:

(flyspell-mode org-eldoc-load #f(compiled-function
                 ()
                 #<bytecode 0xbdabad>)
           #f(compiled-function
          ()
          #<bytecode 0x4fd045>)
           org-babel-result-hide-spec org-babel-hide-all-hashes)

What's the correct way to do this with use-package :hook?


texts: Automatically don't save buffers before compiling

texts:
I often have buffers from unrelated projects open. Before compiling I use projectile-save-project-buffers to save all relevant buffers. If other buffers happen to contain unsaved modifications, however, I will still be prompted about them, before I can compile.

Now there is compilation-ask-about-save:

compilation-ask-about-save is a variable defined in ‘compile.el’.
Its value is t

Documentation:
Non-nil means M-x compile asks which buffers to save before compiling.
Otherwise, it saves all modified buffers without asking.

You can customize this variable.

[back]

The problem is, that I don't want to save those unrelated buffers. Is there another variable that I'm missing? Can I configure emacs in a way so that it just compiles the current saved state without further prompts?


texts:
Weirdly when I try to log onto freenode using ERC, a ` is added to my nickname, which results in the name not being found on the server. I get the following output in the Messages buffer - I have replaced my real nick with nickname.

Connecting to irc.freenode.net:6667... ...done
Logging in as 'nickname'...
Logging in as 'nickname`'... done

Using ERC 5.3 on Emacs 24.3.5.1 on OS X


texts: How can I reliably create latex classes in org mode?

texts:
I'm trying to modify my .emacs to create my own classes,

I tried this article and using org-latex rather than ox.

I also tried this different approach.

I tried enclosing the above classes with with-eval-after-load 'org-latex as suggested in another post.

Yet I can't seem to have my classes working when I input : #+LATEX_CLASS: myclass in an org file. (In my case, #+LATEX_CLASS: notes)

Using either "notes" or "article" in the \documentclass{} does not change anything.

I only get the same message all the time :

user-error: Unknown LaTeX class ‘notes’

N.B : Here is my init file


texts: Making forward search behave (a bit) like backward search

texts: When I do reverse incremental search, the cursor is placed at the beginning of a match for my search, and stays there as I type further characters that match. With forward search, on the other hand, the cursor moves forward as I continue to type matching letters. Is there a way to do a forward search that behaves like backward search in this respect? (To place the cursor at the beginning of a match, I first do a forward search, then do a reverse search. I'd like to avoid this, if possible.)


texts:
I have problem starting shell in Emacs.
When I do "M-x shell", this error message come up in shell buffer:

  no sessions

  open terminal failed: terminal does not support clear

  Process shell finished

So please help.
My Emacs version is 25.2.2 on Ubuntu


texts: Git: is it possible to stage a selected region directly from the file buffer?

texts:
With Magit you can open the magit status buffer, press TAB to expand the diff (or RET to bring up a separate diff buffer), mark parts of a hunk and press s or u to stage/unstage the region. Really nice.

I'd like to know if it's possible to:

edit a file
select a region, hunk or several hunks right inside the file buffer
stage/unstage the selected region or the hunk around point


texts: The insert function seems to be inheriting the read-only property

texts:
I'trying to insert a row of characters into a buffer, where the first four characters should be read-only. Here's the relevant part of the code :

(insert (propertize "cn) " 'read-only t))
(insert (propertize (format "%s\n" hanzi) 'face 'kaiti-red))

When this code is run, I get a "Text is read-only" message, the buffer holds just the "cn) " string, read-only as expected, but nothing can be inserted after.

It seems that the second 'insert' is inheriting the read-only property, even though the "Stickiness of Text Properties" node in the emacs lisp manual says "The ordinary text insertion functions, such as insert, do not inherit any properties."

Can someone please explain what's going on here ? I'm using Emacs 26.2 on Windows 7.


texts:
I've been having trouble setting up ditaa to work in emacs,
I got my copy of the ditaa jar from here
And I've been trying to run this code block
#+begin_src ditaa :file hello.png :exports results
  +----------------+
  | Hello World!!! |
  |                |
  +----------------+

#+end_src

When I evaluate it with C-c C-c I  get
A blank png buffer and this:
 Error: Unable to access jarfile /home/nalis/emacs-custom-packages/ditaa/ditaa.jar

in a buffer called Shell Command Output
I've tried moving the jar files to shorter names, putting their location in my system path, and running ditaa outside of emacs to my success.
My Current configurations for my org group are:
Org Ditaa Jar Path: ~/emacs-custom-packages/ditaa/ditaa.jar
Org Babel Ditaa Java Cmd: java
Org Ditaa Jar Option: -jar

And I am running:
GNU Emacs 24.5.1 (x86_64-unknown-cygwin, GTK+ Version 3.14.13) of 2015-06-23 on desktop-new


texts: emacs remove macOS Tags when resave the file

texts:
I found emacs cannot save the macOS tag when the file changed and save from buffer

I create a empty file with macOS tag

and use emacs to open it and write something

use C-x C-s to save and the tags in Finder disappeared

How could I have a method to reserve these tags when I resave it?


texts: Emacs invokes default system email client when trying to send via MSMTP

texts:
I'm using notmuch message mode in emacs and I'm trying to send a message using msmtp. When I try to send a mail from within emacs it suddenly opens my default system email client, Evolution, and creates the new mail in that, complete with the text that I'd just entered into emacs-notmuch. I want it to just send the mail from within emacs.
I know this isn't a problem with msmtp because I can send emails via msmtp from the command line. And when I check my msmtp logs, the attempts to send from emacs aren't there. It isn't getting that far.
I wonder if this is a permissions issue of some kind, because in /usr/bin, msmtp shows up with a GID bit set. I am new to GID settings but it seems to be the only file that has it.
Can anyone point me in the right direction?
Here is the relevant bit of my emacs config:
(setq send-mail-function 'sendmail-send-it
     sendmail-program "/usr/bin/msmtp"
     mail-specify-envelope-from t
     mail-envelope-from 'header
     message-sendmail-envelope-from 'header)


texts:
I'm trying to enable agenda-view and use agenda features under org-mode.
As per the org-mode manual - Agenda section pressing the key sequence Ctrl + c + a followed by a to create calendar like agenda.

I tried this and it did not work. Then I saw the link for Activation to activate agenda view and also updated the .emacs file as shown below

;; This is for org-mode agenda view activation
 '(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
 ;; This is for key bindings to invoke agenda mode (see line-2)
 '(global-set-key "\C-cl" 'org-store-link)
 '(global-set-key "\C-ca" 'org-agenda)
 '(global-set-key "\C-cc" 'org-capture)
 '(global-set-key "\C-cb" 'org-iswitchb)

I restarted emacs twice. But nothing seems to work. I was following this YouTube video in order to see if I can make use of agenda feature in org-mode