texts: Command history not saved while using GDB from Emacs

texts:
I usually debug in console gdb and now I'm trying to move to Emacs. In my ~/.gdbinit I have the following lines setting up history:

# save history of unlimited size, write always to ~/.gdb_history
set history save on
set history size unlimited
set history filename ~/.gdb_history

And in console gdb history works perfectly. show history result there:

(gdb) show history
+show history
expansion:  History expansion on command input is off.
filename:  The filename in which to record the command history is "/home/ars/.
gdb_history".
save:  Saving of the history record on exit is on.
size:  The size of the command history is 10000000.

If you wonder, history size is 10000000 instead of unlimited because I have $HISTSIZE=10000000.

In Emacs, I successfully search for old commands from ~/.gdb_history with comint-history-isearch-backward-regexp. However, the problem is that commands entered while debugging from Emacs are not appended to ~/.gdb_history. I can still search through them in the current session, i.e. they are saved somewhere in memory, but they will not be written to the file and as a consequence I don't see them in the following sessions.

While GDB starts inside Emacs, I see that the config is read:

...
+set history save on
+set history size unlimited
+set history filename ~/.gdb_history
...

And show history output there is exactly the same like in console GDB:

show history
+show history
expansion:  History expansion on command input is off.
filename:  The filename in which to record the command history is "/home/ars/.gdb_history".
save:  Saving of the history record on exit is on.
size:  The size of the command history is 10000000.
(gdb) +info break

I start gdb with command like (gdb "gdb -i=mi $PROGTODEBUG") and finish debugging with quit, typed manually or via C-d. Then I kill the buffer with kill-this-buffer and exit Emacs. GNU Emacs version is 25.1.


texts: Merge org-mode headings without breaking links

texts:
I have a large collection of notes in org-mode, each with it's own heading and org-id. For example

* Note one
  :PROPERTIES:
  :ID:       403847B2-3D4C-4EFB-96DE-E0C5C52A02B5
  :END:

* Note two
  :PROPERTIES:
  :ID:       3F6CD10D-3DE9-4585-8E8F-845F6B5CBA60
  :END:
* Etc.

Invariably, I now find that some of these overlap and could be merged or otherwise refiled. The trouble is that many of these notes are linked to from other points in the document, so if I now combine Note oneand Note two under a single Note one/two heading, I will more than likely be breaking (at least some of) the links that point to these topics.

Is there a function or workflow for merging headlines that will also update links pointing to them? Or perhaps a way to assign both org-ids to the same headline? Something like this, perhaps:

* Note one/two
  :PROPERTIES:
  :ID:      403847B2-3D4C-4EFB-96DE-E0C5C52A02B5; 3F6CD10D-3DE9-4585-8E8F-845F6B5CBA60
  :END:
* Etc.


texts: assign meaningful names to buffers in helm-mini?

texts:
org-attach creates a directory for an entry in the entry.

In helm-mini this directory shows as a long sequence of numbers and letters, thus meaningless and impossible to quickly identify different directories.

Is it possible to assign some useful name in helm-mini so that when I launch it I can quickly know which directory is which?


texts: Update variable value without eval again

texts:
Let's say, If I have a directory variable named a-directory with its value. Also I have another variable named b-directory which gets its value from the previous variable.

(setq a-directory "C:/Users/Paper")
(setq b-directory (expand-file-name "org-mode.org" a-directory))

Every time when I change the value of a-directory, I need to eval the b-directory again to get its new value. So here comes the question: How can I get the updated value without evaling b-directory when changing the value of a-directory?


texts: How can I execute a function every time I insert certain characters in the buffer?

texts:
I write a lot of text in German and English and I'm getting tired of switching the dictionary of my spell-checker all the time.  In true Emacs spirit, I decided to do something about this and dusted off my grandpa's parentheses.  The code I wrote guesses the language of the current paragraph and then changes the language in ispell and typo-mode.  It also reruns flyspell on the current paragraph, but only on that paragraph because sometimes I also write documents in multiple languages.

All this is working really nicely and I will publish this code after some more testing, so other people can use it, too.  However, I want the process of switching languages to be fully automatic so I don't have to think about it at all.  This means that my function should run every once in a while during text editing.  Perhaps it's overkill to run it on every key stroke but I thought it might be good to run it every time I start a new word, i.e., when I enter a space or newline.  Alternatively, it might also be enough to run it only when I enter punctuation marks.

My question: How can I fire off the function when certain characters are inserted in the buffer?  Is there a hook for that?  Thanks for your help.

FYI: Here is my code: https://github.com/tmalsburg/guess-language.el


texts:
In my emacs setup, if I have smartparens-mode enabled with   smartparens-latex and I open a latex document, type some text then select it and type any latex special command (such as $, ", \{, etc...) the text gets surrounded by these symbols as expected.

However, if I have delete-selection-mode enabled, then the text is deleted instead. Other symbols like {, (, [ still work as expected even when delete-selection-mode is enabled.

The weird thing is that this used to work flawlessly before a recent update that I cannot quite track. In fact a question was posted here in 2016 and an update to AUCTeX was supposed to fix this issue.

Below is the minimum init.el code that produces this problem

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "https://melpa.org/packages/") t)

(defun require-package (package)
  "Install PACKAGE unless already installed."
  (unless (package-installed-p package)
    (package-install package))
  )

(package-initialize)
(package-refresh-contents)
(require-package 'auctex)
(require-package 'smartparens)
(require 'smartparens)
(require 'smartparens-latex)

(delete-selection-mode t)

(defun latex-mode-defaults ()
  (smartparens-mode)
  )

(add-hook 'LaTeX-mode-hook 'latex-mode-defaults)


texts: How to define a keybinding with a key-down/up (Alt-Tab-like) behaviour

texts:
The usual behavior of Alt-Tab in window managers is that as long as Alt is pressed, the user can Tab or Shift-Tab through the list of windows, and then when Alt is released the currently selected window is made active.

Can this be replicated with Emacs? AFAIK, keybindings are activated on key-down, and there is no way to say: enter a mode where additional  switch through a list and exit (and activate) when Alt is released. (Replace <alt> and <tab> with a modifier + key of choice, I understand that Alt-Tab may be fully under the WM's control.)


texts: Seeking scheme for readonly viewing email messages, i.e. *.eml

texts:
Because I used helm's helm-source-mac-spotlight I often get email files in my result lists.  This is great.  It often surfaces old discussions about the issue I'm working on.

But, these files have the raw message in them.  Plenty of headers and mime parts.

I don't do my mail handling in emacs usually.  It's been decades since I last set up a reasonable system for doing that.

I'm seeking a more friendly view the *.eml files.

I did notice that people often set the .eml files to have mail-mode or mail-message-mode, but neither of these appear to lead to a friendly end result.

Suggestions?


texts: Can org-babel 'result' not insert a newline at the end?

texts:
When I run a snippet of code (C-c C-c) (e.g. for making a PlantUML diagram), there is a trailing new line in the results, e.g.:

#+BEGIN_SRC plantuml file hello.png
...
#+END_SRC

#+results
[[img]
   <<<<<<< new line here :-|

I then have to manually delete that line as it messes with some of my header formatting.

[edit]
As per comment below, I tried:

#+NAME: diagram123
#+BEGIN_SRC plantuml :file ./img/img_2015_03_11__09_32_36.png
start
:meh;
end
#+END_SRC

#+CALL: diagram123()

But this generates a result block with a new line at the end also :-|


texts:
windows 10, emacs 26.1

Open *scratch* buffer and do next:

(/ 15 6) press C-x C-e

Result is in minibuffer:

2 (#o2, #x2, ?\C-b)

As you can see the result is INTEGER value. But I need correct value = 2.5

How I can do this?


texts: why doesn't emacs support key up/down events

texts: AFAIK emacs does not support keyup/keydown events, only keypressed. An example of a consequence is that when we want to mark a region we have to first set a mark set-mark-command and can then mark the region by moving around the point. While this is really an interesting feature as you don't have to hold a shift key pressed while marking the text, sometimes it would be desirable to have the same behavior like in other editors. This question is to understand why emacs doesn't support this feature and why this is considered better. Also is there an ideomatic approach how we could solve this in emacs?


texts: Export beamer handout or presentation function in org-mode?

texts:
I'd like to be able to call a function to export to pdf (via latex beamer) from an org subtree. Right now I have properties set up like so:
:PROPERTIES:
:EXPORT_LATEX_COMPILER: xelatex
:EXPORT_LATEX_HEADER: \input{beamer-preamble.tex}
:EXPORT_OPTIONS: H:2
:EXPORT_FILE_NAME: path/to/pdf
:EXPORT_LATEX_CLASS: beamer-presentation
:END:

I have two latex classes I've added to org-latex-classes -- "beamer-presentation", which allows notes and incremental lists, and "beamer-handout", which has no notes and collapses all incremental slides to single slides. Right now if I want to change to presentation or handout I change the :EXPORT_LATEX_CLASS: property to the relevant class. Everything works fine. However, I'd like to be able to do this from an elisp function I could just call to export the subtree, and without having the :EXPORT_LATEX_CLASS: property set manually. But I can't seem to find any way to do this. I would have thought the following would work:
(defun cpm/org-export-beamer-presentation ()
  (interactive)
  (progn
    (setq org-latex-default-class "beamer-presentation")
    (org-open-file (org-beamer-export-to-pdf nil t))))

  (defun cpm/org-export-beamer-handout ()
    (interactive)
     (progn
       (setq org-latex-default-class "beamer-handout")
       (org-open-file (org-beamer-export-to-pdf nil t))))

However, in both cases the function simply export the subtree with the default (i.e. not either of my custom classes) beamer presentation class. Any tips on what to do here are appreciated (and I know that there is at least one other way to deal with this issue. But I'm curious why my approach fails. I am not adept with elisp, so that may be the explanation. Advice appreciated.


texts: How do I insert the buffer's name at the beginning of the buffer?

texts:
I am trying to write a function that prints the name of the current buffer to the file in the current buffer in its first line. For example, if the file is called "test.el", when invoking such function, the result should be:

test.el
; rest of file

However, I am stuck with the following non-working function:

(defun my-heading ()
  "Write the name of the present file on the first line."
  (append-to-file (point-min)   ; start: beginning of buffer
                  200           ; end: I don't know when to stop
                  (buffer-name) ; filename
))

Moreover, in the manual page for the function append-to-file, it is written:

  Don’t use these functions [append-to-fileand write-region] to write to files that are being visited; that could cause confusion in the mechanisms for visiting.

So, how can I write a function that appends text to the beginning of my current file?


texts: Annoying error message when using Atomic Chrome

texts:
I'm using Atomic Chrome. Atomic Chrome lets one associate a text area in a browser page with an Emacs buffer, so that one can edit the browser text area directly within Emacs. This involves installing the Chrome extension Atomic Chrome. However, I'm using it with Chromium. I also had to install the atomic-chrome Emacs package via Melpa (I think). Version 2.0.0 is installed. The description given for the atomic-chrome Emacs package is "Edit Chrome text area with Emacs using Atomic Chrome".
I am running Debian 10.7 Buster/stable. Both Emacs and Chromium are official Debian packages. My Emacs version is 1:26.1+1-3.2+deb10u1. My Chromium version is 83.0.4103.116-1~deb10u3.
It's working correctly. I have the following lines in my ~/.emacs.
(require 'atomic-chrome)
; Uncomment if using Atomic Chrome.
(atomic-chrome-start-server)

However, if I have the last line uncommented, whenever I start up Emacs, the following message pops up in a buffer
Warning (initialization): An error occurred while loading ‘/home/faheem/.emacs’:

File error: Cannot bind server socket, Address already in use

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.

Starting Emacs with the "--debug-init" option, I get the traceback
Debugger entered--Lisp error: (file-error "Cannot bind server socket" "Address already in use")
  make-network-process(:name "websocket server on port 64292" :server t :family ipv4 :noquery t :filter websocket-server-filter :log webso$
  websocket-server(64292 :host local :on-message atomic-chrome-on-message :on-open nil :on-close atomic-chrome-on-close)
  atomic-chrome-start-websocket-server(64292)
  atomic-chrome-start-server()
  eval-buffer(#<buffer  *load*> nil "/home/faheem/.emacs" nil t)  ; Reading at buffer position 13313
  load-with-code-conversion("/home/faheem/.emacs" "/home/faheem/.emacs" t t)
  load("~/.emacs" t t)
  #f(compiled-function () #<bytecode 0x1dda91>)()
  command-line()
  normal-top-level()

Note: if I have no Emacs instances running, this error message doesn't show up. But it does if I have no Emacs instance running, and start up another Emacs instance.
How can I stop this message from appearing?


texts: Turn off global-flycheck-mode for org-mode?

texts:
Given I'd like to keep using global-flycheck-mode, how can I make sure flycheck is automatically disabled when editing org-mode documents? Or maybe is just activate it for code blocks?
I found this discussion but I admit I don't know what to do with this information. :\

ORIGINAL QUESTION:
I'm trying to create a timestamp with both date and time in org-mode (without adding to agenda), and I read from the docs that I should be using this cord:

C-u C-c !

However, I get this in my minibuffer:
screenshot http://zc.d.pr/NxKK/56UjyS0K+
Seems like its waiting for more input. I'm an Emacs n00b so I'm not really sure what's happening here. I get the same behavior with

C-c !

Both versions with . work fine, though:

C-u C-c .
C-c .

What's happening here?

UPDATE: Thanks to suggestions from the comments below, I've determined Flycheck is doing something to screw this up: here's my flycheck config
(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))
(add-hook 'after-init-hook #'global-flycheck-mode)

Where can I look to find if there is a colliding key binding?


texts:
This question is a derivative of Export to multiple files according to tags. I wish to export to different files, according to tags.

To achieve this goal, I wrote some lines of code :

(defun export (tagname)
   "Export to a file named tagname.pdf all the headlines tagged with tagname"
          (let ((org-export-select-tags (list tagname)) (async nil) (subtreep nil) (visible-only nil) (body-only nil) (ext-plist '()))
               (org-export-to-file 'beamer (concat tagname ".tex") async subtreep visible-only body-only ext-plist (lambda (file) (org-latex-compile file))))
)

(export "s1")
(export "s2")

where s1 and s2 are the tags to generate files from.

This is working as expected and generates files "s1.pdf" and "s2.pdf" correctly.

However, when I change  (async nil) to  (async t), the tag selection is not used anymore and two identical pdf files are generated, containing all headlines.

I would like to know if in async export, the variable org-export-select-tags is used and, if not, if it is possible to reduce the async export scope.


texts: View all scheduled tasks that have a specific state

texts:
I'm using Org-mode 8.2.10 on Xubuntu 16.04 and despite having tried many combinations, I can't manage to view all scheduled tasks that don't have "DONE" and "CANCELLED" as a state. For example,

(setq org-agenda-custom-commands
  '(
     ("+" "Scheduled"
       ((todo ""
         ((org-agenda-overriding-header "\nScheduled")
          (org-agenda-skip-function '(org-agenda-skip-entry-if 'notscheduled 'todo '("DONE" "CANCELLED")))
         )
       ))
     )
   )
)

shows all scheduled tasks but including (instead of excluding) those with "DONE" and "CANCELLED" states...


texts: How to enable the breaking of code blocks in a PDF?

texts:
As shown here, Control's code (and the code of the sections after it) are on subsequent pages. I want the code to be shown directly in the same subheading.

My subheadings look like this:

*** ~Code file header~
#+CAPTION: ~Code file path~
#+BEGIN_SRC scala -n
Scala code
#+END_SRC


texts:
In Vim, if I want search for all variable names LX where X is a number, I can simply type /L\d. However, this doesn't seem to work with evil.

Is there another syntax for regular expressions in Evil mode, or will I have to fall back on some Emacs functionality for search and replace using regular expressions?

I am using spacemacs, and I am pretty clueless regarding most things in Emacs, happily staying in Evil mode all day :).


texts: disable auto-completion for all buffers by default in spacemacs

texts:
Is there a way to keep auto-completion enabled as a layer, but have it disabled by default in spacemacs?

For example, I want to have the auto-completion layer enabled in dotspacemacs-configuration-layers, but I want auto-completion to start disabled whenever I open up a new buffer.

Currently, whenever I open a buffer, I need to press SPC t a (which calls spacemacs/toggle-auto-completion) to disable auto-completion.  I'd like this to be the other way around.  I'd like for auto-completion to be disabled by default.  I'd like to be able to press SPC t a to enable auto-completion.

I'm a beginner with emacs/spacemacs, so I'm not sure how I would express this, but one thought would be to call spacemacs/toggle-auto-completion-off whenever I open a new buffer.  How would you write this in elisp?


texts: How to disable auto indentation in asm-mode

texts:
When programming in extended assembler (using asm-mode), auto indentation insists on indenting compiler directives, such as #define, #if and #endif, how can I disable this?

Emacs version: 0.300.0@26.3 (spacemacs)


texts: How do I permanently change my emacs load-path?

texts:
Having searched for advice on how to change the load-path, I found this answer in the EmacsWiki:
https://www.emacswiki.org/emacs/LoadPath
I have evaluated a similar command in the minibuffer:
(add-to-list 'load-path "/usr/share/emacs/27.1/lisp/6502")

The intention is to add a 6502 major mode to emacs found here:
http://www.tomseddon.plus.com/beeb/6502-mode.html
Once I have entered that expression, querying the load-path variable confirms it has changed.
When I then test the change by quitting and restarting emacs I see an error which says
File is missing: Cannot open load file, No such file or directory, 6502-mode

When I then query the load-path again the change I made was forgotten.
How do I make changes to the load-path permanent?


texts:
Is there some way in org-mode to keep track of people mentioned in an outline?
Sometimes I use an @ in front of a person's handle to keep a note of who was the source of a piece of information, or who to ask about a particular question, or even who is responsible for a delegated TODO. This personal syntax looks like this:
* Earth orbits Sun
This was originally proposed by @copernicus.
* TODO ask @galileo about this
* TODO @newton works on an alternative formulation

I can then search for those specific strings in the file or the whole folder. I could use tags for the same, but then I could not use them in body text, only on headings, and only at the end of the sentence ... Also, I feel like a tag should represent a cross-hierarchy category for a heading, but not specifically a person.
The things I am missing with my ad-hoc solution are:

org agenda functions to filter only tasks that mention specific people, or that mention people at all,
maybe some type of columnar view that shows all people mentioned in a larger body of text

Does anyone know if there is an org-mode syntax for this that I may have overlooked, or else a package that provides this functionality?


texts: org-mode: link to tag/target inside a source code block

texts:
I'd like to place a link to a tag or target inside a source code block.

#+BEGIN_SRC emacs-lisp
  (use-package evil
    :ensure t
    :config
                      ; enable per default
    (evil-mode t)

                      ; <<evil-bindings>>
    :bind ("C-^" . evil-buffer)  ; Switch to another buffer quickly
#+END_SRC

*** Key bindings

See [[file:::/<<evil-bindings>>/]]

Ideally this should jump the to position of ; |<<evil-bindings>> inside the source block when followed via C-c C-o.

I've tried See [[<<evil-bindings>>]] before I tried "Method 2" in the answer from user Melioratus in How to reference source blocks in org text. My first try just prompts with No match - create this as a new heading? (yes or no) in the minibuffer. The "Method 2" just calls occur as mentioned in the answer. But there's another problem. When going from my first try and editing the link via C-c C-l and answering either just file::: or file:::/regexp/ to the Link: prompt, it errors out with org-insert-link: Args out of range: "file:::/<<evil-bindings>>/", 5, 4. (I then activated     and edited the link manually.)

NB: I haven't configured anything related to org-mode yet (not even (require 'org) in my init.el). My emacs and org-mode version:

GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) of 2019-09-23, modified by Debian
Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.1/lisp/org/)

Greetings,
 AWG


texts: How to set set both frame title and name when creating a frame?

texts:
I'm trying to create a frame with the following params

(make-frame `((name . "Foo")
              (title . "[%F] %b)))

to try and create a frame with the title [Foo] buffer_name. But it seems only the name parameter is used and the frame title is only Foo.

Does title param get ignored if name is specified? The docs aren't very clear about it.

I'm using Emacs for OS X.


texts:
I have started using Emacs a couple weeks ago and so far I got it to do pretty much everything I wanted. Recently, I started using Emacs and AUCTeX to write a GUI specification document. For each GUI element I have a corresponding LaTeX snippet that I can insert in the specification to start from, like this, for example:

\item \texttt{Button}
    \begin{description}
        \item[Label]    Here I add a description for the wanted button label...
        \item[Readonly] etc...
        \item[Enabled]
        \item[Visible]
        \item[Tooltip]
        \item[Alternate control]
        \item[Events]
        \item[Misc]
    \end{description}

To include it in the specification, I cut and paste it from another document. Copying and pasting works, but is tedious. What I would like to achieve with Emacs and AUCTeX is to type, from within Emacs, something like M-x button so that it adds the corresponding code snippet directly from the current cursor position. I'd like this snippet to be available only when a .tex file is opened.

How can I do this?


texts: Does autoload load all functions in the file or just the one specified?

texts:
I have developed some private extensions to some major modes, and I would like to load those extensions only when the given major mode is actually used by the user. The extensions consists of a set of functions confined to a single file. For example, for emacs-lisp-mode, I have developed a file "~/emacs/my-emacs-lisp-mode-hook.el, here is a minimal example for illustration purposes:

(defun my-emacs-lisp-mode-hook ()
  (my-hook-func))

(defun my-hook-func ()
  (message-box "This is my hook function"))

And then, in my Emacs init file ~/.emacs I have:

(autoload 'my-emacs-lisp-mode-hook "~/emacs/my-emacs-lisp-mode-hook.el" "My Emacs Lisp mode hook" nil nil)
(add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-hook)

Note that I do not have an autoload call for the function my-hook-func.
The question is: If it is sufficient to call autoload only for the function my-emacs-lisp-mode-hook, or if I have to call autoload for each function in the file "~/emacs/my-emacs-lisp-mode-hook.el? The idea is that, the other functions in the file will never be used unless a buffer switches to major mode emacs-lisp-mode and the hook function my-emacs-lisp-mode-hook has run.

Currently, this strategy seems to work (I get the message box created in my-hook-func even if I have no explicit autoload statement for that function). But I could not find a clear statement of this behavior in the manual. So is this a viable strategy? (It would certainly allow me to simplify my code, that is: not having to add autoload cookies for each function, and not call update-file-autoloads and so on..)


texts: Match paren problem in the GUI version of Emacs

texts:
I use the built in parentheses match (show-paren-mode t).
But there seems to be somewhat of a glitch when it highlights the matching parentheses, because it moves the bottom lines further apart when the highlights appear.
Like this:

Is this a bug or an intended effect? If the former, how would I go about fixing it?
* Solution in comments


texts: How can I split a window so that the cursor ends up in the right / lower window?

texts:
The functions I have found for splitting windows are (split-window-right) and (split-window-below). When these are evaluated the cursor ends up in the right window in the case of (split-window-right)or the upper window in the case of (split-window-below).
I want to have functions that split a window and puts the cursor in the right or lower window.
I wrote the following myself, but it unfortunately does not move the cursor as I expected. Instead it just behaves as if (split-window-right) was called by itself.
(defun olav-split-window-left ()
  (interactive)
  (split-window-right)
  (windmove-right))


texts: Css mode break indent region for javascript-mode

texts:
I have css-mode and javascript-mode and if I open css file the indent-region-function is set to css-indent-region which break javascript-mode indent region, how can I fix that? the workaround is to execute:

(setq indent-region-function nil)

after I switch to css-mode, is there a way to fix this without this hack?

Calling this:

(defun css-indent-mode-fix ()
  (setq indent-region-function nil))

(add-hook 'css-mode-hook 'css-indent-mode-fix)

Disable indent region in css mode.


texts: Showing different project-trees in different instances of emacs daemon

texts: At this point I usually hook up into my emacs-daemon using emacsclient -a "" -c "$@". When I also want to display my project using Neotree, this works well for only one instance but if I open a file in another folder using this command, NeoTree stays at showing the structure of the folder I first startet my session in. Is there any way to always have it display the path in which the file I am editing is locating at while also using emacs as a daemon?


texts: use-package: How to defer loading a command when depending on other deferred packages?

texts:
I would like to autoload the command f-join from f.el using use-package. Note that the package f.el depends on the packages dash.el and s.el. Here is a minimal example:

(setq debug-on-error t)
(let ((default-directory  "~/test/emacs")
      (packages (list "dash.el" "f.el" "s.el" "use-package")))
  (dolist (package packages)
    (add-to-list 'load-path (expand-file-name package))))

(eval-when-compile
  (require 'use-package))

(use-package dash
  :defer t)

(use-package f
  :after (s dash)   ;; make loading order-independent
  :commands f-join  ;; add autoload for f-join
  :defer t)

(use-package s
  :defer t)

(f-join "a" "b")
(message-box "Everything ok")

Running this with emacs -Q -l gives error:

Debugger entered--Lisp error: (void-function f-join)

Changing :defer to :demand on the dependent packages dash.el and s.el eliminates the error message, but now the packages are no longer autoloaded, which is what I wanted to avoid.


texts: How to set the default of `truncate-lines` for dired buffers to `truncate`?

texts:
How can I set the default of truncate-lines for dired buffers to truncate?

I.e. when I open a new dired buffer it should show the directory truncated and not wrapped into the next line.


texts: Is there a way to generally search package or language documentation within emacs?

texts: In this case, I'm most interested in Rust's documentation, which lives at doc.rust-lang.org/std. eww is incompatible with JS, so the documentation doesn't play nice, thus my general current soln is to just pop over to a browser. I'd be interested to know what other people do for documentation reading.


texts: Which keymap variable contains the bindings for `M-x`?

texts:
The Help for key M-x key says
M-x runs the command execute-extended-command (found in global-map),
which is an interactive compiled Lisp function.

It is bound to <execute>, <menu>, M-x.

But in the global-map there is no entry for M-x, there are only entries for execute and menu. Where is the M-x binding present ?


texts: ANSI coloring in emacs start-process output buffer

texts:
I am running a process from within emacs which uses ANSI color codes in its output.

I'm using start-process to create the process, and provided a custom buffer name for the process's output

(start-process "foo" "*Foo*" foo-command foo-args)

If I open *Foo* buffer, the ANSI color codes are printed in their raw format to the buffer

^[[36msome output message^[[m
^[[1;35msome output message^[[m
^[[1;34msome output message^[[m

I see in this SO answer it is possible to add colorization to a buffer; however I'm unsure as to how to do it with a buffer created using start-process

Is it possible to convert those ANSI color codes to colorised output in my *Foo* buffer?


texts: Set python interpreter on a per project bases

texts:
I know i can set an interpreter with the code below, is there a way i can set this per project so that when I open emacs with a specific project it selects the interpreter for that project.

(setq python-shell-interpreter "/docker:root@django_web_1:/usr/local/bin/python")

currently i am doing this manually and want a better way as each project runs in its own containers and I often switch projects.


texts:
For example, I have the following code snippet:

$query = 'SELECT  SUM(T01.foobar)
          FROM   db_foo.bar T01
            WHERE   T01.fooID = 1
           AND    T01.barID = 2
           AND  T01.foo IS NOT NULL'

I would like to align it as:

$query = 'SELECT   SUM(T01.foobar)
            FROM   db_foo.bar T01
           WHERE   T01.fooID = 1
             AND   T01.barID = 2
             AND   T01.foo IS NOT NULL

This is a very common operation, that I would like to devise a function or align
regelar expression for it. I spent too much time to align it every time

The M-x align-regexp RET didn't help me out here. When I make a rectular
selection block around the SQL query, and align it on tabs, it doesn't align.

Anyone have better suggestion to let Emacs align this as I mean?


texts:
I got my command for Ctrl+C - c - t (i.e. invoke org-capture) slightly wrong (i.e. missed a key or something when trying to type it). I know I got it wrong because it didn't work but instead changed something in one of my open buffers slightly (sorry, I can't remember what, and I don't know what key I mistyped). Now, if I try to use Ctrl+C-c-t again, it's giving me the following debug error:
Debugger entered--Lisp error: (error "Selection owner couldn't convert" UTF8_STRING)
  x-get-selection-internal(CLIPBOARD UTF8_STRING nil nil)
  #f(compiled-function (selection-symbol target-type &optional time-stamp terminal) #<bytecode 0x1fe12375f05f>)(CLIPBOARD UTF8_STRING)
  apply(#f(compiled-function (selection-symbol target-type &optional time-stamp terminal) #<bytecode 0x1fe12375f05f>) (CLIPBOARD UTF8_STRING))
  gui-backend-get-selection(CLIPBOARD UTF8_STRING)
  gui-get-selection(CLIPBOARD UTF8_STRING)
  gui--selection-value-internal(CLIPBOARD)
  gui-selection-value()
  current-kill(0)
  org-capture-fill-template()
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

This is entirely opaque to me -- any idea what it might be and how to fix it?


texts: Org-mode - What internals make python session mode so picky with blank lines?

texts:
I understand and work around the limitation of session mode python code blocks. But why is it like this?

Is it possible that this could be fixed so that people don't have to adjust their usage patterns?

Another thing is output e.g.:

#+BEGIN_SRC python :session py1 :results output raw
  d = 0
  for a in range(3):
      pass

  print "oh yeah"

#+END_SRC

#+RESULTS:

... ... >>> oh yeah

All the ellipses and prompts are quite annoying.
I understand that this is not a trivial matter but session mode is so powerful and I want to see it be as good as possible.

Can someone please explain the reason for these blemishes?


texts:
Recently when running compile, the error messages don't get hyperlinked properly.  I get this type of error message:

../build/obj/DerivedClass.cpp:45:18: error: expected type-specifier

The buffer hyperlinks only part of the path:

ss.cpp:10148:18

Any suggestions on how I can fix this?

EDIT:

I get the same problem when performing rgrep or grep.

EDIT 2:

Following Drew's comment.  I ran emacs -Q.  The paths hyperlinked correctly.  I then loaded the init file, load-file, expecting the paths to be hyperlinked incorrecty.  However, they remained correct. Restarting emacs with no options had broken hyperlinks.

I then ran emacs --no-desktop to try and isolate if the problem existed in the init file or the desktop file.  Paths were hyperlinked correctly.  So the problem must be in the desktop file. I did not want to lose my buffer states stored in the desktop file by performing desktop-clear.  Instead I performed desktop-read, saved the desktop, quit emacs, then started emacs without and optiong: emacs.  Paths are hyperlinked correctly.  The problem appears to be fixed.  I can restart emacs several times without seeing the problem.

My assumption is that something in the desktop file was causing the bug.  Hind sight tells me I should have saved a copy of the desktop file and then done a diff after fixing the problem to see what caused it.


texts: How to insert strings from a string list in one file into another file, with a Helm-like insert functionality?

texts:
How can I insert one or more pre made text strings, stored in one storage file, into any text file where I need these strings? The text strings are stored as one string per line in the storage file.

When in a file where I need to insert my strings, I would like to call a function that opens a Helm-list of all the strings available in the storage file. Further, I must be able to chose more than one string (by the space bar), and insert the chosen strings either vertically (one string per line), or horizontally, where the strings are separated with space.

Thanks in advance for all suggestions, either to available methods for doing this, or new code!


texts: When elpy-shell-send-region-or-buffer finishes, source buffer closes

texts:
And the first thing I do is to reopen the file.
elpy-shell-send-region-or-buffer is bound to C-c C-c.  This sends the buffer to an ipython buffer.  I've set a breakpoint with pdb.set_trace() and it stops there.  I use c (continue), with no further breakpoints, and the program ends. But the source buffer closes.
I'd like to find some way to keep the source buffer open.
I did it a long time ago, but I'd assume this one code from my .emacs should be what's necessary to set up sending from the source buffer to ipython:
(elpy-enable)
(add-hook 'python-mode-hook 'elpy-mode)


texts: Disable highlighting "info" warnings on flycheck

texts:
I'm using flycheck with pylint3 (emacs 24.5) and it creates lots of "info" errors (for things like violating whitespace and capitalization conventions). I know I can disable them on a per-error basis by editing .pylintrc, but I'd rather just disable all info errors.

I can customize the flycheck group which has the settings Flycheck Error List Minimum Level and Flycheck Navigation Minimum Level, which let you disable "info" in the error list and when jumping between errors, respectively. Is there an equivalent setting for controlling which errors are highlighted in the buffer?

(I was thinking that I could change the face of "info" errors to be the normal face, but that would still have some artifacts of flycheck, like displaying the warning in the echo area. If there isn't a "proper" way to disable info, this may be the next-best option.)


texts: How to debug Emacs to find out why Emacs doesn't open external browser?

texts:
In Emacs (27.1) on the orgmode when I RET on HTTP link, Emacs doesn't open it on any browser (chromium, firefox, ...).
I've set these variable in my spacemacs user config:
  (setq browse-url-browser-function 'browse-url-default-browser
        browse-url-generic-program "chromium-browser")

  (setq org-return-follows-link t)

I tried this function, but it didn't work for me:
(browse-url "http://www.google.com")

How can I debug Emacs to diagnose the problem?


texts: How to prevent line wrapping in code, but allow it in help/info buffers?

texts:
I'm quite new to emacs (coming from vim), and I'm struggling to figure out how to configure sane line-wrapping/truncation behavior.

For the most part, I'd like to prevent wrapping, so I put this in my init file:

(setq-default truncate-lines t)

But for help/info buffers, I do want wrapping.

Basically, I want truncation in buffers that contain code, and wrapping in buffers that contain text. What's a sensible way to achieve this? I imagine I want to keep the above default, but override it for certain major modes (e.g. Help), but I'm not sure how to do that.

update based on Kaushal Modi's answer

(defun my-truncate-lines-disable () (setq truncate-lines nil))
(add-hook 'help-mode-hook #'my-truncate-lines-disable)


texts: Wrong letter spacing when using certain fonts

texts:
I'm using Classic Console font in buffers. Unfortunately for some reason letter spacing is terrible in Emacs while being correct in Konsole and other programs.

Text in Emacs:

Text in Konsole (using the same font and size):

Any idea how to fix this?

Another case with Courier Prime:

'(default ((t (:family "Courier Prime" :foundry "QUQA"
               :slant normal :weight normal :height 83
               :width normal :spacing 10))))

:spacing 10 did not work.


texts: Is there a way to restrict history in shell-mode?

texts: I run lots of test in shell-mode because I love being able to search through the history.  However, some of these tests print lots of info to stdout and will cause my memory usage to go through the roof after a long period of time.  I have to manually delete the history to keep the memory in check.  Is there a way to tell shell-mode to discard old messages after so many lines?


texts:
in AucTex math mode several symbold are already defined. Fom latex.el:

(defconst LaTeX-math-default
'((?a "alpha" "Greek Lowercase" 945) ;; #X03B1
(?b "beta" "Greek Lowercase" 946) ;; #X03B2
(?g "gamma" "Greek Lowercase" 947) ;; #X03B3
(?d "delta" "Greek Lowercase" 948) ;; #X03B4
(nil "sum" "Var Symbol" 8721) ;; #X2211
(nil "prod" "Var Symbol" 8719) ;; #X220F
(nil "coprod" "Var Symbol" 8720) ;; #X2210
(nil "int" "Var Symbol" 8747) ;; #X222B
(nil "oint" "Var Symbol" 8750) ;; #X222E)))

The characters with nil have no shortcut. How do I access them? Do I really have to redefine them in latex-mode-list?

The documentation of auctex and latex-mode-list[1] says:

  First, the key to be used after LaTeX-math-abbrev-prefix for macro insertion. If it is nil, the symbol has no associated keystroke (it is available in the menu, though).

But how can I bring up this menu? And as a second question, what is the best practice to redifine the shortcut of already defined symbols?

Thanks!

EDIT:

From the comments:

1) The menu the manual is referring to is in the menu bar and just called Math.

2) Entries can be added by editing LaTeX-math-list, which will override an entry with the same symbol present in LaTeX-math-default.

[1] https://www.gnu.org/software/auctex/manual/auctex/Mathematics.html#Mathematics


texts:
I'd like to use ATTR_REVEAL: :frag (roll-in) to display images in a reveal.js slideshow that are created using dot source blocks.

So far I've tried source block headings of:

#+BEGIN_SRC dot :file test.png :results show :exports results
This shows the test.png in the slideshow, but doesn't roll it in

#+BEGIN_SRC dot :file test.png :results none :exports results
This does not show test.png in the slideshow

#+BEGIN_SRC dot :file test.png :exports none
This does not show test.png in the slideshow either.

Is what i'm trying to do here possible? If so, what heading parameters should I use to export to the reveal.js slideshow?

Here is the slideshow source if it helps you understand things:

#+REVEAL_THEME: sky
#+OPTIONS: toc:nil num:nil
#+TITLE: Cool title
#+AUTHOR: That guy

* Slide 1
#+ATTR_REVEAL: :frag (roll-in)
- List item 1
#+BEGIN_SRC dot :file test1.png :results show :exports results
digraph auth {
rankdir=LR;
node [shape=record];
1->2;
2->3;
3->1 [label="bleh!", fontcolor=red];
}
#+END_SRC

#+RESULTS: [[file:test1.png]]

- List item 2
#+BEGIN_SRC dot :file test2.png :results none :exports results
graph pres {
rankdir=LR;
node [shape=record];

1--2--3--4;
}
#+END_SRC

* Slide 2
* Slide 3


texts:
I am browsing the differences between two branches of a repository via

git diff --name-only branch1 branch2

I also use the --name-status option sometimes, since I may need to see what sort of difference there is for a given file. Plodding along with plain old git will do the job, but there are some obvious deficiencies. The main ones are: no color, no Emacs operations, and you cannot collapse directories. It makes this diff rather cumbersome to work through. Moreover, both branches are large and there are many differences between them.

Does Magit have some sort of diff interface that allows you to use --name-only & --name-status? I don't see any switches or options for doing this in *magit-diff-popup*.


texts: Stop GNU Emacs (GUI) on macOS from quitting

texts:
Is it possible to stop Emacs on macOS from quitting? This may sound like a weird request, but numerous times I may accidentally quit Emacs and the whole GUI app exits -- which means I then have to restore the session as it was before (which is a pain).

Or maybe there's another way to solve this problem: is it possible to have Emacs' session restore to exactly where it was when the app quit?


texts: How to change to evil-insert mode when there is no hook?

texts:
I'm trying to change evil-org to evil-insert-state when I add a note to my org files. I've tried to look it up, but can't figure it out. I've configured org-mode to always query me for a note after clocking out with (setq org-log-note-clock-out t), and I'd like to switch to evil-insert-mode after this happens.

The function org-add-log-note seems to be doing the work, but it doesn't define an after hook. So I guess the more general question is: how do I hook a function to another function call?


texts: Test whether org-mode heading or list is folded

texts:
How can I test in elisp whether an org-mode tree node (either a heading or a list item) is folded?

Looking at the code it seems the logic is a little complicated and only in org-cycle-internal-local, with no public API?

I've sometimes wished for this when writing small functions to navigate the tree and change its folding state - e.g. today when attempting to answer this question.

Note that if the node has no children, for my purposes I'd either need that to be regarded as folded, or to be able to find out explicitly whether there are children.  Otherwise I can't keep org-cycleing until the node is folded.


texts: Magit equivalent of `git branch -D -r origin/feature/someLabelHere`

texts:
On the command-line, I often do this

git branch -D -r origin/feature/someLabelHere

to remove a remote branch after a pull request from that branch has been merged into master.  I know now to do

git branch -d feature/someLabelHere

in magit, but not the -D -r equivalent.   How can one?

Simply pressing k to ask for removal on the displayed remote branch gets
an error message and reference to the process buffer where one sees e.g.

  1 git … push origin :bugfix/someLabelHere
error: unable to delete 'bugfix/someLabelHere': remote ref does not exist
error: failed to push some refs to 'git@github.com:eddelbuettel/somerepo.git'

Edit: It may have been an 'order of commands' issue.  Deleting in magit before removing the remote branch at github seems to do the trick.


texts: Use adaptive wrapping only in one specific major mode

texts:
I am using adaptive wrapping (see Correct indentation for wrapped lines) but it applies to all major modes. I would like to only use it for html. What I have tried so far is adding the following to my .emacs file:

(add-hook 'html-mode-hook
           ;;(setq-default adaptive-wrap-extra-indent 2)
           (add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)
           (global-visual-line-mode +1)
           ;;(setq adaptive-wrap-prefix-mode t)
           )

This does not work since the adaptive line wrap is still active in all major modes. How should I change the snippet to make it work?


texts:
I would like to ask for some help with the following code.
(This question was also posted here)
(defvar test--var1 nil)

;; From https://github.com/raxod502/radian/blob/cb1dda7c8a697b2d6e3b2683805df6a085aed1c7/emacs/radian.el#L194
(defmacro my-when-compiletime (cond &rest body)
  "Like `when', but COND is evaluated at compile time.
BODY is only compiled if COND evaluates to non-nil."
  (declare (indent 1))
  (when (eval cond)
    (macroexp-progn body)))

(defmacro my-log (s &rest args)
  "Log to *Messages*."
  `(when t
     (message
      (concat (propertize "the value is: " 'face 'font-lock-comment-face)
              (when (bound-and-true-p test--var1)
                (propertize
                 (format "[%s/%s] "
                         (substring (symbol-name (car test--var1)) 1)
                         (cdr test--var1))
                 'face 'warning))
              ,s)
      ,@args)))

;; input should be an unquoted list like (:a b c) and c can be and often is nil.
;; The variable f is included here for completeness but does not do anything.
(defmacro my-macro (input &rest body)
  (let ((c (car input))
        (m (car (cdr input)))
        (f (cdr (cdr input))))
    `(my-when-compiletime t
       (let ((test--var1 `(,,c . ,',m)))
         (message "test--var1 is %s" test--var1)
         (my-log "We are in my-macro")
         ,@body))))

;; This works as expected
(my-macro (:a b)
          (my-log "%s" test--var1))
;; => test--var1 is (:a . b)
;; => the value is: [a/b] We are in my-macro
;; => the value is: [a/b] (:a . b)
;; => #("the value is: [a/b] (:a . b)" 0 14 (face font-lock-comment-face) 14 20 (face warning))

;; This does not work as I expect
(my-macro
 (:a b)
 (defun test-fun1 ()
   (my-log "hey"))
 (run-with-timer 0.1 nil #'test-fun1))
;; => test--var1 is (:a . b)
;; => the value is: [a/b] We are in my-macro
;; => [nil 24719 64999 224627 nil test-fun1 nil nil 964000]
;; => the value is: hey

So, the idea is that test--var1 is usually nil and only bound via let. my-log should print out more information when test--var1 is bound. my-macro should combine the other macros.
The first example works as I thought it should work. The let-bound variable test--var1 is passed on through all the macros. But the second example doesn't and I don't understand why test--var1 is now nil and its value is "forgotten". My understanding is that when my-macro is expanded, let-bound variables keep the defined values and this gets passed on (like in example 1).
Why is test--var1 nil?


texts: Proper reinitialization of a list? What is happening under the hood?

texts:
I'm teaching myself some more elisp and have encountered the following problem:

If I want to reset a list variable it won't get updated after the first evaluation. Here is some example code:

(defun initilize ()
  (setq example '(3)))

(defun modify ()
  (initilize)
  (message "%S" example)
  (setcar example 2))

; M-x eval-buffer RET
(modify) ; message --> (3)
(modify) ; message --> (2)
(modify) ; message --> (2)

I'm interested in two things. The first is to learn more about what is happening "under the hood" so why does it work the first time and fails on subsequent calls?

The second and more practical question is how to reinitialize the list properly or is there another common way of doing something like that?

One workaround I found myself is to use a quoted list and evaluating
the content like this:

(setq example `(,3))


texts: bibtex-reformat and bibtex-sort hangs emacs

texts:
I am running emacs 25.3 and have been having issues with my bib files.  Whenever I edit the bib file and reformat/sort the entries it takes a long time to carry out the reformatting (15-20 seconds) and after it is finished emacs hangs.  I noticed CPU usage on one core goes to 100% while reformatting and stays there after completion.  I need to kill emacs to get out of this loop.

The bib file I have is not terribly large, several hundred entries with a total of ~8k lines.  I ran a test on a smaller bib file (~2k lines) and experienced the same issue.  Are my bib files too large?  Is there a way to identify which part of the reformat/sort is causing it to hang?


texts: Spacemacs issues since upgrading to v.0.2.00.5

texts:
I’ve had some issues with Spacemacs since upgrading. I don’t know if these are genuine bugs or if it’s in my configuration. I’m using Windows 7 and my version of emacs 25.0.92.1
1. I get the following warnings on start up:

- Unknown layer unimpaired declared in dotfile.
- tern binary not found!

[edit: To fix turn follow these instructions - https://simpletutorials.com/c/2784/How+to+setup+JavaScript+auto-complete+in+Spacemacs+on+Windows]

Space Space gives the message: SPC SPC undefined
I thought it had changed from evil-avy-goto-word to M-x

[edit: My .spacemacs was at fault. I was using a version pre version 2. Reinstalling fixed this]

When using a search engine I added (SPC a / Search engine select) I get an error: wrong type argument: commandp, engine/search-mySearch, though this worked before the upgrade.
This is how my search is configured -

;;Search Engines
(push '(mySearch
      :name "mySearch"
      :url "http://mySearch/%s")
      search-engine-alist)

Are these genuine bugs or is there something I need to correct?


texts: Auto-refresh magit status only when magit is running

texts:
I've seen the post Magit: Auto-refresh “magit-status”, and tarsius recommends the same method from the Magit manual to set magit-after-save-refresh-status to non-nil to the after-save-hook:

(add-hook 'after-save-hook 'magit-after-save-refresh-status t)

This is a great solution when a Magit buffer is available. However, if this setting causes some noisy warnings when saving a file when a Magit buffer is not available:

run-hooks: Symbol’s function definition is void: magit-after-save-refresh-status

How can I get around this such that this setting is active only when there is a Magit buffer available?


texts: Specifying a refiling target at the file level

texts: I have a question about refiling under orgmode.  For a certain file, I want a different set of refiling targets that what I have in general (specifically, only refiling within this document itself). I'm hoping there is a header setting I can use to override the refile target for a given file, but I haven't been able to track it down despite much search. Any help much appreciated.


texts: How to add 'timestamp' and 'owner' to 'bibtex-clean-entry'?

texts:
I am a recent and happy user of BibTeX mode (bibtex.el), but there is one thing I can't get to work as I wish. When I create a template, I can enforce insertion of timestamp and owner with:

(defun current-date ()
    (format-time-string "%Y.%m.%d"))
(setq
    bibtex-user-optional-fields '(
                                 ("timestamp" "Time the entry was created" current-date)
                                 ("owner" "Owner of the entry" user-login-name)
)

Is this possible to have the same behavior with bibtex-clean-entry (C-c C-c), which would automatically add the timestamp and the owner if they are not already set?

The rationale behind that is that I'm using biblio.el for automatic download of references (e.g. via DOI), and I set it to run bibtex-clean-entry right away with:

(setq biblio-cleanup-bibtex-function #'bibtex-clean-entry)

Being able to have the behavior described above for this function would actually save me a lot of time… and make sure I don't forget to add both fields.


texts: Consistent way to represent key sequences?

texts:
The macro kbd doesn't work for all desired input. For example, this results in an error:

(kbd "C-H-left")
edmacro-parse-keys: C-H- must prefix a single character, not left

and should be written as:

(kbd "C-H-<left>")

There is an alternative (vector) syntax:

[?\C-\H-x home]

but this representation also isn't unique: the vector above has the same meaning as

[(control hyper x) home]

Also, (kbd "RET") isn't [return], but ?\C-m. Same with (kbd "DEL") and others.

Forms (kbd "\e\eq") and [?\e \?M-q] represent the same key sequence, but have different values:

(kbd "\e\eq")  ; evaluated to "^[^[q"

[?\e \?M-q]    ; evaluated to [27 134217841]

Are all these syntax rules available in Emacs >= v22.x?

Which syntax is consistent and regular? Which mini-language describing key sequences has fewer special cases?

I found that I need to consult references every time I make a new key binding. Consider binding ESC M-H-kp-2 C-PgUp or similar.


texts:
Here's my Semantic config:

(semantic-mode 1)

So my config probably isn't the issue.

Whenever I try to use Semantic commands in an elisp file, I get the message Buffer was not parsed by Semantic.. So I tried doing semantic-force-refresh and it says, Buffer reparsed. (no errors). But it still throws the "not parsed" error when I try to use a semantic command.

$ emacs -Q --eval "(semantic-mode 1)" has the same issue.

Everything works as intended in c-mode and c++-mode. What gives?

Version info:

CEDET Version:  2.0
            Requested   File        Loaded
  Package       Version     Version     Version
  ----------------------------------------------------------
  cedet:        2.0     nil     ok
  eieio:        1.4     nil     ok
  semantic:     2.2     nil     ok
  srecode:      1.2     nil     Not Loaded
  ede:          1.2     nil     ok

I usually use Emacs in Cygwin:

GNU Emacs 24.4.1 (i686-pc-cygwin) of 2014-10-21 on desktop-new

But I have the same problem on my Arch VPS:

GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3) of 2014-10-21 on bitzer.hoetzel.info

EDIT: I discovered that (semantic-active-p) returns nil in elisp buffers. I'm not sure why.


texts: Find position in file by character number

texts:
When an error occur in compiling a program in Ghostscript, the error message  gives a "Current file position is ..." with a number. I use emacs to edit the program file, so I would like to be able easily to find that position in the file (if that is indeed what it is). Please how do I do that?

Sorry I can't find a more appropriate tag.


texts: Emacs 27 MELPA connection failure on macOS

texts:
I have been trying to install packages ivy, counsel, and swiper on Emacs 27 prelude. Starting Emacs results in the following error:

Warning (initialization): An error occurred while loading ‘/Users/username/.emacs.d/init.el’:

error: Could not create connection to melpa.org:443

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.

Any ideas on why startup fails?

I was using the following init file as a reference point: https://github.com/sitesonix/emacs-prelude-personal/blob/26dab880d0d096a1f04e81b9ee6ba470563aef8f/rtg-init.el.


texts: Ediff directories with remote path (and Prelude?)

texts:
I need to compare from time to time the contents (source code) of a remote directory with a local one.  And I would like to mark for hiding those files/subdirs that are identical (that is, use the =h command).  But in the list of diff sessions, the remote files are marked as *remote file* instead of appearing the time stamp, and =h does simply nothing.

I found a hack in the web, to try to handle this situation (in fact, to handle tramp and ediff interaction).  The code is:

(defun ediff-listable-file (file-name)
  (let ((handler (find-file-name-handler file-name 'file-local-copy)))
    (or (null handler) (eq handler 'dired-handler-fn) (eq handler 'tramp-file-name-handler))))

(defun ediff-same-file-contents (f1 f2)
  "Return t if files F1 and F2 have identical contents."
  (if (and (not (file-directory-p f1))
           (not (file-directory-p f2)))
      (let ((res
         (apply 'call-process ediff-cmp-program nil nil nil
            (append ediff-cmp-options
                            (list (if (tramp-tramp-file-p f1)
                                      (tramp-handle-file-local-copy f1)
                                    f1)
                                  (if (tramp-tramp-file-p f2)
                                      (tramp-handle-file-local-copy f2)
                                    f2))))))
    (and (numberp res) (eq res 0)))))

The problem with this code is that with command =h I get now the error message Symbol's function definition is void: tramp-handle-file-local-copy, meaning that the mentioned function is not existing.

Could anybody please help me with this?  I'm using GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) (with Prelude Emacs configuration).

Thanks!

Update

As pointed out by the selected answer contributor, the problem is the Prelude environment.  I have tried to find out were to touch without generating a disaster, and I found that Projectile might be the problem.  But, after updating the Prelude configuration system (with a simple git update in .emacs.d), everything seems to work nicely, including the ediff-directories and the =h command.

Sorry, I shoud have tried that first!


texts:
I have a buffer with terminal escape codes in it and I want them to be colored:

I was able to do this with (ansi-color-apply-on-region (point-min) (point-max)):

However, my file is really big and that command is really slow.  Is there any mode that colors terminal escape codes with font lock?  I imagine that would be much faster.

NOTE: What I am looking at is a log file, not a shell buffer, so solutions involving M-x shell output are irrelevant to me.


texts: How to add a time and a time interval in calc-mode?

texts:
How do I use calc to add a time interval to a moment in time (i.e., a date, or a time)?

For instance, say I want to know what the time and day will be 8,000 minutes into the future?

I know that t N will push the current moment onto the stack. And I know that I can enter a small, HMS-normalized interval like 10 minutes by typing 0@10'0" (for zero hours, ten minutes, and zero seconds), and that I can then add them by typing +.

But this isn't very useful if I want to add arbitrary time intervals specified by combinations of days, hours, minutes, and seconds that have not been normalized. Sadly calc throws an error of "Bad Format" if you try to enter an interval like 0@8000'0" to represent 8,000 minutes.

Does calc mode itself have a facility for entering, non-normalized time intervals?


texts: How to run multiple instances of Emacs with a different icon attached to each one of them?

texts:
It could be a solution for Plasma or Gnome Shell or Xfce or even a windows manager like i3 or bspwm. I am interested in the mechanism of how to do it - so any solution will suffice.

For example, I want the first instance to have the standard icon, the second a different icon and the third a different icon.


texts:
I have org-log-refile set to 'note which works great when moving tasks around. However, when I'm capturing, I'd like this behavior disabled.

I tried the following with org-capture-mode-hook, org-capture-after-finalize-hook, org-capture-before-finalize-hook, and org-capture-prepare-finalize-hook to no avail.

;; Record time and note when a task is refiled
(setq org-log-refile 'note)
;; Disable when refiled from org-capture
(add-hook 'org-capture-mode-hook (lambda ()
                                   (setq-local org-log-refile nil)))


texts: How to find in which hook(s) a certain function is called?

texts:
I'm using the lsp layer on Spacemacs with javascript-backend 'lsp and it activates two modes I don't like: lsp-ui-mode and eldoc.

I found lsp-ui-mode inside lsp-mode-hook and added (remove-hook 'lsp-mode-hook 'lsp-ui-mode) to my init.el, which fixed that.

But I can't find where eldoc-mode is being called. How do I search for it within (all?) hooks?


texts: Why doesn't electric-indent-mode indent in comments?

texts:
I've defined my own major mode using define-generic-mode, and in the setup function I have (set (make-local-variable 'indent-line-function) 'my-indent-function).

This works fine in general code, however it is not called at all when I'm inside a comment, as defined by the syntax table with:

;; // Comments (style a)
(modify-syntax-entry ?\/ ". 124" (syntax-table))
(modify-syntax-entry ?\n "> " (syntax-table))
;; /* Comments (style b) */
(modify-syntax-entry ?* ". 23b" (syntax-table))

Either // line comments or /* Java comments */ are allowed.

I've tried setting comment-line-break-function as I saw that it is set in Java mode, but this doesn't have any effect. I also tried setting comment-indent-function to nil, but again I couldn't see any effect.

EDIT: Added example minimal repro.

To test, just run emacs -Q, paste the following into a buffer and run eval-buffer, then open test.tmp. Every time you hit return not inside a comment you will see "Called indent-line!" in the mini-buffer. Inside a comment you will not. This is my question.

(define-generic-mode
    tmp-mode ; mode name

  ;; comments
  nil

  ;; keywords
  '("if" "then" "else")

  ;; other things to highlight
  nil

  ;; auto mode alist
  '("\\.tmp?$")

  ;; other function to run
  (list 'tmp-mode--setup-function)
  "A mode for tmp files")

(defun tmp-mode--setup-function ()
  (modify-syntax-entry ?_ "w" (syntax-table))
  ;; // Comments (style a)
  (modify-syntax-entry ?\/ ". 124" (syntax-table))
  (modify-syntax-entry ?\n "> " (syntax-table))
  ;; /* Comments (style b) */
  (modify-syntax-entry ?* ". 23b" (syntax-table))
  (modify-syntax-entry ?@ "_" (syntax-table))

  (set (make-local-variable 'indent-line-function) 'tmp-mode/indent-line))

(defun tmp-mode/indent-line ()
  (message "Called indent-line!"))

(provide 'tmp)


texts: Configuring Emacs as a CMake based C/C++ IDE

texts:
I have been interested in Emacs for a while, since I have seen some great articles on the Internet, which demonstrates the usage of Emacs as a C/C++ IDE. Those projects are awesome, yet they are not easy to be implemented by a novice Emacs user. I got problems with whichever of them I tried to implement. I searched the Internet a lot and a lot to solve my problems. One of my problems was solved accidentally by a coincidence, it was related to ELPA. After that new problems came out. I am really stuck right now. I want to use cmake-ide package (here) or cpputils-cmake package (here). Could you demonstrate how to use them assuming I only have Emacs and those packages from MELPA installed, or provide some resources to know learn which are prerequisite for using them?

note1: I am using "GNU Emacs 24.5.1" on ArchLinux.

note2: I could have installed those packages. My problems start afterwards.


texts: How do I configure first emacs frame position on startup?

texts:
When coding I prefer to have my screen split vertically in two with my editor on the right and reference material or browser opened on the left. This saves me from physically switching workspaces or windows more often than I find necessary.
I have therefore configured my emacs frames to take that position on the right when started. I acheive that with this code in my init.el:
; Frame
(use-package frame
  :ensure nil
  :custom
  ;(initial-frame-alist (quote ((fullscreen . maximized))))
  (initial-frame-alist (quote ((top . 0) (left . 748) (width . 84) (height . 30))))
  (default-frame-alist (quote ((top . 0) (left . 748) (width . 84) (height . 30))))
  :config
  (blink-cursor-mode -1)
  (when (member "OperatorMono NF" (font-family-list))
    (set-frame-font "OperatorMono NF-14:weight=regular" t t))
  (defun my/disable-scroll-bars (frame)
    (modify-frame-parameters frame
                             '((vertical-scroll-bars . nil)
                               (horizontal-scroll-bars . nil)
                               (left . 748))))
  (add-hook 'after-make-frame-functions 'my/disable-scroll-bars))

When I start emacs for the first time however, I see two different frames flash briefly on the top left of the screen, each with a different size before finaly respecting the settings in my config.
Is there a way to set the very first frame that shows up to take up the correct postion on the screen instead of starting from the top left of the screen?


texts: Pressing RET inserts unnecessary whitespace

texts:
My Emacs  inserts whitespace on the next line if the current line starts with whitespace. IE

   a<RET>
   <--- whitespace

This happens across modes (python, text-mode, fundamental-mode), and versions (24.5, 26.3). How do I get turn this off? (to be more like nano or pico behavior)? This messing with my terminal's copy-paste


texts: How do I edit files on an SFTP server, connecting from Mac OS X?

texts:
At work I'm connecting to a server that only accepts SFTP connections.  I can connect from the command line just fine.  I'd like to use TRAMP or Ange-FTP or something similar from within Emacs, but I'm stuck.

When I say C-x C-f /sftp:user@host: I expect to get a prompt for a password but instead I get back Unknown method "sftp" in the echo area.

I'm using the TRAMP that came with Emacs, and I notice that tramp-methods does not contain anything for sftp.  Do I need to add something there?


texts:
I'd like a way to lazily activate certain ~/.emacs.d/elpa packages. I notice some of them have so many autoloads (which require other packages recursively from their *-autoloads.el), that you might as well just (require 'them).

Can I, for example, activate all except certain packages? I see you can set package-load-list to (all) or a list of names and versions, but I can't see anything like (all-but ,(alist)) in the docs.


texts: Check what triggers flymake-mode activation

texts:
Question: Flymake is being activated and I don't seem to find anything that triggers it in my configuration. Is there any way to get kind of a backtrace of what triggered such activation or in which hook it has been added?

Explanation of what is happening to me:

I'm currently using Emacs to edit Rust code. I have lsp activated, cargo package, racer and rust-mode. I have also installed and use flycheck-rust and I think that's all I have related with Rust in my config:

;; Rust
(use-package lsp-mode
  :ensure t
  :init
  (add-hook 'prog-major-mode #'lsp-prog-major-mode-enable)
  :config
  (setq lsp-rust-rls-command '("rustup" "run" "nightly" "rls")))

(use-package lsp-ui
  :ensure t
  :init
  (add-hook 'lsp-mode-hook 'lsp-ui-mode))

(use-package rust-mode
  :config
  (setq rust-format-on-save t)
  (define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
  (setq company-tooltip-align-annotations t)
  (add-hook 'rust-mode-hook #'flycheck-mode)
  (add-hook 'rust-mode-hook 'hs-minor-mode)
  (add-hook 'rust-mode-hook 'lsp))

(use-package flycheck-rust)
(with-eval-after-load 'rust-mode
  (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))

(use-package racer
  :diminish racer-mode " ® "
  :config
  (add-hook 'rust-mode-hook #'racer-mode)
  (add-hook 'racer-mode-hook #'eldoc-mode)
  (add-hook 'racer-mode-hook #'company-mode))

(use-package cargo
  :diminish cargo-mode " CRG "
  :config
  (add-hook 'rust-mode-hook 'cargo-minor-mode))

The problem is that whenever I open a .rs file, Flymake gets activated (as well as flycheck but flycheck is wanted). I get all this minor modes activated:

Enabled minor modes: Async-Bytecomp-Package Auto-Composition
Auto-Compression Auto-Encryption Auto-Revert Blink-Cursor Cargo
Column-Number Company Delete-Selection Diff-Auto-Refine Display-Time
Eldoc Electric-Indent File-Name-Shadow Flycheck Flymake Font-Lock
Global-Company Global-Eldoc Global-Flycheck Global-Font-Lock
Global-Git-Commit Global-Linum Global-Magit-File
Global-Prettify-Symbols Hs Line-Number Linum Lsp Lsp--Managed Lsp-Ui
Lsp-Ui-Doc Lsp-Ui-Sideline Magit-Auto-Revert Magit-File Menu-Bar
Mouse-Wheel Override-Global Projectile Racer Rainbow-Delimiters
Recentf Shell-Dirtrack Show-Paren Tooltip Transient-Mark


texts: Search and replace through a multifile project in AUCTeX?

texts:
I am about to adopt Emacs to be the only editor I use in all what I am writing including LaTeX documents. I came from WYSIWYG editor which served that purpose fairly nice, namely TexStudio or TXS for short. For the transition from TXS to Emacs I am still missing the way TXS deals with executing massive regexp query search & replace with highlighting the matches and restriction of the search to only those project-related .tex files. I deeply miss that in Emacs now. See a screenshot of TXS below:

TeXStudio Query in a Multifile LaTeX Project

I would like to emphasize the points in the workflow to be achieved in Emacs:

RegExp Query Search and Replacement only in the project-related .tex files.
Highlighting the matches
An overview of the highlighted results all together in a manageable layout (similar to the log view of Magit in Emacs when you press l followed by another l or simply like C-x d in Dired mode
How to know how much replacement or inspection matches done with or remaining and a way to resume query in case it is broken by a clumsy keystroke that stops the query
A clean way out of this messy query by closing and saving all related files and back to the state before invoking this query

I read this post but my intention is to be more like CW that anyone can share his best workflow to get this common job done. My current approach(es) as follows:

First Workflow

Dired mode % g will mark all files containing that regexp. Cons: this will include even file unrelated to the project including non .tex files.
C-x 3 opens a new buffer while keeping an eye on the first buffer as my orientation overview of what marked files I have to query in the new buffer individually
Running the query by C-c q. It has very nice switches like ! replace all without asking plus highlighting matches within the opened file. But this means I have to run the same query each time and for every marked file.
After doing all marked files I hit C-x s ! to save all in one keystroke. Phew!

Second Workflow -- preferred

Marking all .tex files using % m within Dired-mode by regexp in order to mark only .tex files so basically running \.tex will get me there.
C-x 3 same as above to keep one buffer for overview and the other for query
Executing Q within Dired which is query replace regexp in marked files only. Alternatively A is only regexp search query. A full-fledged query will be executed and a help menu by ? is generously provided
C-x s ! save and close all the mess. Otherwise I had to close the opened files one by one which is tedious. I hope there is a way to close only those we bothered.

How do I approximate TXS's regexp search/replace query in multifiles?

Note

Emacs 24.4 on Windows 7


texts: Format strings for org-agenda-prefix-format

texts:
I want to customize org-agenda-prefix-format but am unable to find something in the reference explaining the syntax and the format strings I can use.

The manual simply states:

  You can also customize the prefix using the option org-agenda-prefix-format. This prefix is followed by a cleaned-up version of the outline headline associated with the item.

However, it doesn't explain the exact syntax one needs to use. I also didn't find any references to the syntax when I searched for the issue online.

Can someone point me to a resource that explains the syntax and the format strings one needs to use?


texts: Org-mode unexpected LaTeX conversion: package and spacing issues

texts:
I am writing a paper in Org-mode and I will need a PDF output through LaTeX. Though, I had issues with spacing (had too large gaps), so I checked the .tex file generated by Org-mode. Apparently, it added \\ at the end of every line, which made the gaps huge (probably making it think a new paragraph is created). Plus, it loaded a number of the packages I employed twice. I am sharing both the .org and the .tex files here (a simplified version of the original document).
.tex file that I manually fixed
.org file
produced .pdf
.tex file generated by Org-mode


texts: I want shell code blocks executed via emacs org babel to be verbose, stoppable, interactable, asynchronous

texts:
I want shell code blocks executed via emacs org babel to be

a) verbose - output should be shown live
b) stoppable
c) interactable
d) asynchronous

Has this been already done by a third party package/extension perhaps?

I also filed this as a feature request with a bounty.


texts: How do I start a shell automatically after starting emacs

texts:
One of my main reasons for using Emacs is to get a powerful environment after sshing into a remote machine. The first thing I do after starting Emacs is to run M-x shell to get a command line. As it takes a little while for Emacs to start it would be very convenient to have an option to ask Emacs to start a shell when I run it, after parsing my initialization file (I have some shell hooks set up to do one thing and another). Ideally I'd like to be able to run it with an additional option so I wouldn't have to add anything specific to my initialization file on the remote machines (I could set up a bash alias if I wanted to). Something like this:

emacs afile1 afile2 -startShell

In fact, given that establishing the secure connection takes about 30 seconds, what I'd really like to do is build the "start a shell" into the ssh command itself, using ssh with -t to start a screen-based program.

ssh -t me@remote emacs afile1 afile2 -startShell

I took a look at the command line arguments documentation for Emacs but I'm still starting out on Emacs and Lisp and customization and it wasn't immediately obvious how to proceed to deal with command line arguments. How would I go about doing this?

(Related question on eshell mentioned by user @Name.)


texts: What happened to org-habits from 8.2 to 9.1?

texts:
Orgmode's org-habits appear broken following the upgrade of emacs from version 25 to 26 and orgmode from 8.2 to 9.1 along the way.

Specifically, all of my habits don't show as habits in the org-agenda any more. Now they show as regular tasks, they cannot be hidden from the agenda view with Shift-K.

I have noticed the :PROPERTIES: drawer now need to be higher up to the heading to be effective. OK, I have moved it up: right below the SCHEDULED: and above :LOGBOOK: - that makes no difference. Moving  :PROPERTIES: above SCHEDULED: seems to render a task unscheduled thus removing it from agenda.

Is there anything else to try?


texts: tramp seems to always use out-of-band methods for a simple copy or rename, despite both files being remote

texts:
I noticed a huge slowdown when renaming a remote directory via tramp in dired mode, especially pronounced when the remote host had a slow internet connection.

I investigated and saw tramp was first transferring the directory to my local machine in /var/folders/... with scp, then transferring it back with scp under the new name.

I looked into tramp.el and saw this behaviour is by tramp-do-copy-or-rename-file-out-of-band. However the comments indicate if both files are tramp files, and use the same method (scp in my case), it should use a simple mv or cp on the remote host. So not sure why the out-of-band choice is being used. I also tried to access the remote host with the ssh method, but this too did not work as expected; tramp started doing a deep copy file-by-file, instead of using mv.

Are there some options I can use to configure this? (I have captured a log-level 6 trace of this happening)

Example of the rename filepaths (as seen from inside emacs / tramp / dired):

from: /scp:hyper-m.wan:/sw/ucspi
to:   /scp:hyper-m.wan:/sw/ucspi-tcp-0.88

The excerpt from the log is

12:17:47.525836 tramp-do-copy-or-rename-file-out-of-band (6) # scp -p -q -r -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no hyper-m.wan:/sw/ucspi/ /var/folders/nl/41nwsxpn57jffks3qyn6q0r00000gn/T/tramp.pGOoQn/ucspi-tcp-0.88
[...]
12:17:49.238779 tramp-action-out-of-band (3) # Process has finished.

12:17:49.248955 tramp-do-copy-or-rename-file-out-of-band (6) # scp -p -q -r -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no /var/folders/nl/41nwsxpn57jffks3qyn6q0r00000gn/T/tramp.pGOoQn/ucspi-tcp-0.88/ hyper-m.wan:/sw/ucspi-tcp-0.88
[...]
12:17:51.002051 tramp-action-out-of-band (3) # Process has finished.

Thanks for any pointers.


texts: Python RuntimeError freezes the whole Emacs!

texts:
This happens to me almost every time after i have broken an infinite loop (RuntimeError: maximum recursion depth exceeded while getting the str of an object) in the Inferior Python process with C-c C-c. The whole emacs will get unresponsive, the only way will be killall emacs from terminal!
Maybe i can provide more information if it would be helpful.


texts: Need help with `expand-region`: Symbol’s function definition is void: org-outline-overlay-data

texts:
If I try to use er/expand-region but it fails with Symbol’s function definition is void: org-outline-overlay-data.

org-version :
Org mode version 9.2.2

In the release notes for the current org (9.2), it says that org-outline-overlay-data has been removed.

But there is no org-outline-overlay-data in the expand-region code when I search the package directory.

#### System Info
- OS: gnu/linux
- Emacs: 26.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. fba6d38bf)
- Graphic display: t
- Distribution: spacemacs


texts:
According to the org-mode manual (emphasis added by me):

The tags that exclude a tree from export (org-export-exclude-tags). The default value is :noexport:. Entries with the :noexport: tag will be unconditionally excluded from the export, even if they have an :export: tag. Code blocks contained in excluded subtrees will still be executed during export even though the subtree is not exported.

However, I have an org mode document featuring python code blocks for which code blocks in :noexport: headings does not execute on export:
* Setup Code             :noexport:
Here's some general text!
#+BEGIN_SRC ipython :session :exports none :tangle ./politics.py
  %matplotlib inline
  import matplotlib.pyplot as plt
  # . . .
  # . . .
#+END_SRC

* Introduction
. . .

When I export, it throws python throws NameError: name 'plt' not defined. Clearly org isn't executing blocks in these :noexport: headings on export. It does work when I remove the :noexport: tag. Am I missing something, or is this an error in the documentation?
I'm using org 8.2.10


texts: Spacemacs: Layout specific python processes?

texts:
In the same spirit that Org Mode allows us to have multiple python SRC BLOCKS with different sessions running independently, is it possible to have multiple Python shells running in different Layouts with Spacemacs?

(Or not necessarely with spacemacs)

I know it is possible to start multiple shells by renaming the * Python * buffer. What happens then is that code is always sent to the new shell, so the old one becomes sort of useless.


texts: Change location for straight.el working directories?

texts:
I’d like to put my dotConfig files into DropBox, including my .emacs.d folder.  I’d like to use these across computers and across OS’s.  I’ve split out part of my init.el into per-computer files (whose location is specified with an environment variable) to help its this.
Is there a way to tell straight.el to save the working files somewhere other than ~/.emacs.d/straight?


texts: How to keep underscores in Python within a word boundary?

texts:
When writing code in python-mode my preference would be to include underscores within a word boundary, so variable_with_underscores is treated as a single word.

How would I limit my word preference only to python-mode?


texts: How to maximize my Emacs height on start-up?

texts: emacs -fh would start emacs in window mode using full height available from the desktop environment. I'm tired of typing this -fh every time yet there doesn't seem to exist a command that does the same as -fh


texts: How does one access the actual arguments to an Emacs Lisp function from the `*Backtrace*`?

texts:
I am trying to debug a problem in some elisp and don't understand how to access the information I want from the Emacs Debugger.
Specifically, my backtrace looks like:
⋮
  #f(compiled-function (hover) #<bytecode 0x26f7872a3e8bae1>)(#<hash-table equal 1/1 0x1fe85528cbdf>)
  apply(#f(compiled-function (hover) #<bytecode 0x26f7872a3e8bae1>) #<hash-table equal 1/1 0x1fe85528cbdf>)
  #f(compiled-function (&rest args) #<bytecode 0xe8a92e4d3997328>)(#<hash-table equal 1/1 0x1fe85528cbdf>)
  #f(compiled-function (result) #<bytecode -0xd842d2c46378a2f>)(#<hash-table equal 1/1 0x1fe859656ddf>)
  #f(compiled-function (result) #<bytecode -0x6d44600f4b68ed1>)(#<hash-table equal 1/1 0x1fe859656ddf>)
  funcall(#f(compiled-function (result) #<bytecode -0x6d44600f4b68ed1>) #<hash-table equal 1/1 0x1fe859656ddf>)
⋮

and I want to examine those #<hash-table…> values.
How do I access those? That is, if I wanted to call (hash-table-keys #<hash-table…>), how would I do that from the *Backtrace* buffer?
(At least some of the functions are generated by complicated macros, so I can't just use Edebug—at least not easily.)


texts:
Is it possible to make blank lines at the end of tree part of that tree? So I can heave two headings like this:

* Heading1
* Heading2

without space between them, but when Heading1 is expanded there is a blank line at the end that does not propagate upwards. Like this:

* Heading1

  * Subheading1
  * Subheading2

* Heading2

It find it visually pleasing to have a blank line between Subheading2 and Heading2 but when Heading1 is collapsed I do not want to have a blank line between Heading1 and Heading2 ( I use org-indent-mode).

Currently I can have only the version without blank line at the end and without blank line between Heading1 and Heading2:

* Heading1

  * Subheading1
  * Subheading2
* Heading2

or version with blank line at the end of expanded Heading1 BUT that blank line propagates upwards and it appears between Heading1 and Heading2:

* Heading1

* Heading2


texts:
Is there any way to have time constant in an Org spreadsheet formula? For example, i would like to have something like this:

@>$3=@>$5-'08:00:00'*vcount(@2..@-1)

to calculate how much longer I've been at work than I have to be :) The @>$5 is the total sum of hours I've been at work and @2..@-1 are the rows with days I've been working.


texts: How to make new text highlighted as well?

texts:
Run in *scratch*:

(progn (fundamental-mode) (hi-lock-mode 1) (highlight-regexp "." 'hi-pink))

Result:

If I add text it is not highlighted depending on where I add it:

How can I make all newly added text be highlighted?

Note that it is OK for me to use something other than hi-lock-mode, as long as I can quickly toggle highlighting / the face of all characters.

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


texts: Can icomplete mode be enabled selectively, only for certain commands?

texts: I'd like to use icomplete-mode for certain commands, but not for everything. Is there a way to enable it for just a list of commands I specify?


texts:
I load multiple daemons service at startup with systemd.
The purpose of this is to have each one for different applications, one for C coding, one for Ocaml, one for Org...

I have a configuration file for each client which is passed to -e with load-file when running the daemon.
I want to set the dedault major mode of the scratch buffer for each one of them, so in the config file I have, for the ocaml config as example :

 (setq initial-major-mode 'tuareg-mode)
 (setq initial-scratch-message "\
 (* This buffer is for notes you don't want to save, and for OCaml code.
 * If you want to create a file, visit that file with C-x C-f,
 * then enter the text in that file's own buffer. *)")

The message is written but the major mode is still lisp.

What happens and how I can I fix that ?


texts:
Is there a way to highlight and quickly evaluate a simple math expression without using elisp notation? For example, we can already evaluate the elisp expression (+ 1 1) in the following text snippet by putting point behind it and pressing C-x C-e.

Here is a math equation: (+ 1 1)

But can we also do

Here is a math equation: 1 + 1

And get its result?


texts: Upcase whole buffer but ignore quoted strings

texts:
I want to type everything in lowercase, but have a command to turn the whole buffer into uppercase except for quoted strings.

What is the command to tell emacs to ignore quoted strings?


texts:
When I use Reftex to insert a reference (i.e., M-x reftex-reference or C-c )), I am prompted to select a label type in a new window:

  SELECT A LABEL TYPE:
  --------------------
  [ ]   any
  [e]   eqnarray equation Beqnarray subequations xxalignat xalignat alignat flalign multline gather align
  [f]   figure* figure wrapfigure \subfigure subfigure* subfigure SCfigure sidewaysfigure tabwindow figwindow floatingfigure
  [i]   enumerate
  [l]   minted lstlisting
  [n]   \footnote
  [N]   \endnote
  [s]   section
  [t]   table* table \ctable wraptable supertabular SCtable sidewaystable       longtable

How do I choose "any" - what does [ ] mean?

Is it possible to remove this step and always choose the "any" ?


texts:
I have the following:

int main()
{

  int a = 1;
      int b = 2;
  return 0;
};

I am expecting some lint to align the indentation.  My file is open with (C/*l AC Abbrev).

I try C-c . which asks me:

  Which C/*l indentation style?

I select k&r and hit enter.  Then nothing happens.  I try the others, awk, or python, and same thing, no linting occurs to tab the int b back over.  When I try again with C-c . it asks again but never lints my code.

What should I do to get formatting in C in emacs?


texts: Can twittering-mode be used with GNU Social, and if so, how? If not, any alternatives?

texts: I have an account on GNUSocial, and I want to be able to control it from Emacs. However, I haven't found a way to do so yet. I can control my Twitter just fine through twittering-mode, and was wondering if it could be extended to control my GNU Social also. If not, is there a way I can control my GNU Social account through Emacs?


texts:
Use emacs-lisp, how to match the same variable assign statement?

for example:

below lines should be matched:

abc = abc
xyz = xyz
weeoof = weeoof

But below lines should not be matched:

abc = abd
xyz = zxy
weeoof = fwexxx

I am trying re-search-forward but don't know how to do it!


texts:
Good day,

I wanted to use the helm-org-in-buffer-headings function. Yet for some reason helm-org layer is missing. If I install it manually via package list packages it gets deleted with the next start of spacemacs.

How could I get helm-org to work? Maybe I should completely reinstall helm? If I put helm in configuration layers unfortunately helm-org doesn't install.
The helm besides the helm-org seems to work fine.


texts: How should I bundle json with my elisp package?

texts:
I wish to distribute an elisp package that uses json.el (http://edward.oconnor.cx/2006/03/json.el). I need this to work for versions of emacs that do not come with json pre-installed (such as OSX, which ships with emacs 22.1). Is there a recommended way for me to ship a third party package like json with my package?

I am going to be distributing this in source form directly to clients.


texts: Is it possible to create an org-mode *scratch* buffer?

texts:
While working on a document in emacs I often find myself opening a new buffer, doing something in org-mode, copying the org-mode content, and pasting it into my document. I used to create a new org-mode document every time I needed to do this. Now I have a file ~/.scratch.org where I keep my this work.

Would it be possible to create an *org-scratch* buffer that behaved analogously to the *scratch* buffer?


texts: `lsp` does not start on python-mode-hook

texts:
I am using lsp under Python.lsp does not start when a Python file is opened, I have to do M-x lsp for each file I open. Also when I switch from find-file to another file I have to do M-x lsp all over again.
I have followed: https://emacs-lsp.github.io/lsp-mode/page/installation/
(require 'lsp-mode)
(add-hook 'python-mode-hook 'lsp)
(add-hook 'python-mode-hook #'lsp-deferred)

What may be the reason for this? Is there any way to force lsp to start on all Python file whenever I open them?

I observe that when I start running emacs in the ibuffer there is python files that are located under the parent folder where those won't run LSP when I open them. But when I open another file in sub-folder it loads LSP by defualt.
example

emacs -nw ~/home.py and do M-x find-file ~/repo/work.py => lsp than M-x find-file ~/repo/work1.py ; lsp is enabled automatically right away.

But if I do emacs -nw ~/repo/work.py ; than M-x find-file ~/repo/work1.py ; lsp is not enabled by default for both.

I have following files all has import os in it. I am coming on top of os and do xref-find-definitions.
~/file1.py

.repo
├── file1.py
├── file2.py
└── file3.py

I do emacs -nw ~/file1.py and find-file repo/file1.py and LSP works. But afterwards when I do find-file to repo/file2.py now it does not :-(


texts: In the "org-capture-templates", is there a way to ask for certain items before, but place them later?

texts:
I created an "org-capture-templates" item used as a inbound call template, which contains several prompts.  While they are all at the proper position inside the template, I would like to be asked in a different order.  A slightly simplified snippet of my template:
* Time: %^{Type}: %^{problem}
Name  : %^{Name}
Number: %^{Number}

Is it possible with a fine-tune to be asked for the type first, then the name and number and finally the problem or would that need extensive extra scripting to realize?


texts: How to get semantic syntax highlighting on emacs for C/C++ code

texts:
I'm new to emacs and programming in general so please bear with me. I'm trying to use emacs as my C/C++ IDE, and I noticed that in CC mode the variables/functions seemed to be highlighted only during declaration. My question is

Is it possible to highlight variables, and functions on an entire cpp file
If possible, what needs to be added to the .emacs file

Thank you


texts: Problem with Image-Dired: image display does not follow point in the thumbnail buffer

texts: I typed "C-t d" after marking files in Dired, or "M-x image-dired" followed by a directory name, to display thumbnails in a thumbnail buffer. After highlighting a thumbnail in the thumbnail buffer, I typed RET to display a sized version of highlighted image in another window (image-dired-display-image). The problem is that no matter what image is selected in the thumbnail buffer (either using the left/right arrow followed by RET, or using space/backspace, as instructed in the Emacs manual), the display-image window always displays the same image, which is the image opened first in this way in an Emacs session.


texts: Search for occurrence of character within a string without using the common lisp library?

texts:
I need to extract certain information from buffer names, and I'm doing so by extracting substrings based on the position of unique characters within a buffer name string.

So, I currently am doing something like this:

(substring (buffer-name) (1+ (search "%" (buffer-name))) (search "&" (buffer-name)))

But when I do flycheck it complains: "function 'search' from cl pacakge called at runtime".

Is there a good method of search for the first occurrence of a character within a string that I can use that doesn't require calling (require 'cl-lib) [or (eval-when-compile (require 'cl-lib)), which produces the same complaint]? Or would I have to write the string out to a temporary buffer?


texts: Write a function using org refile interface to jump to item, with destination as an argument

texts:
I would like to create a function that uses the refile interface to jump to a heading (C-u C-c C-w or 'Refile-Goto'), where I can enter the filename and Heading as arguments.
Following instructions here - org-refile to a known fixed location , I have written the following function that successfully refiles subtrees with arguments.
;;Org-Refile with parameters
(defun my/refile-params (file headline)
(interactive)
  (let ((pos (save-excursion
               (find-file file)
               (org-find-exact-headline-in-buffer headline))))
    (org-refile nil nil (list headline file nil pos))))
(map! :leader :desc "file away" "zf" (lambda () (interactive) (my/refile-params "~/orgnotes/casenotes.org" "Destination")))

I have created another function that successfully calls Refile-Goto, but requires manually enter the destination.
;;Org-Refile-Goto without parameters
(defun my/refile-goto ()
  (interactive)
  (setq current-prefix-arg '(4))
  (call-interactively (org-refile)))
(map! :leader :desc "file away" "zn" (lambda () (interactive) (my/refile-goto)))

All seems good, but when I combine the two as below, instead of just jumping, it refiles, and throws up a Wrong Type Argument error to boot.
;;Org-Refile-Goto with Parameters *Not Working*
(defun my/refile-params-goto (file headline)
  (interactive)
  (setq current-prefix-arg '(4))
  (call-interactively (my/refile-params file headline)))
(map! :leader :desc "Go to @In-Progress" "zg" (lambda () (interactive) (my/refile-params-goto "~/orgnotes/casenotes.org" "Destination")))

All help greatly appreciated.
NB: Using doom, if that helps understanding the keyboard mapping. Including the mapping lines, as they include 'lambda', which is mysterious black magic to me, so I may be getting it wrong.


texts:
revert-buffer is often slower than closing an opening the same file.

I've noticed - for example, I can undo to the state of the file before reverting.

While this might be useful in some cases, I would like to clear undo history and load the file as if I'd just opened emacs.

Some possible solutions:

Fast Revert

Disable undo.
Clear undo history, jump list ... etc.
Clear the buffer.
Load the data from the file into the buffer.
Re-enable undo.

Fake Revert

Store the scroll & cursor position.
Close the buffer.
Open the buffer.
Restore the scroll & cursor position.

While I could write this, it seems like there may be a more elegant solution then writing my own fast-revert-buffer function.

Does Emacs provide a way to do this already?


texts:
I am trying to navigate a C project that has lots of preprocessor directives like this:

#ifdef SOME_COMPILE_TIME_VARIABLE
    for ( idx=0; idx<FOO; idx++ ) {
#else
    for ( idx=0; idx<BAR; idx++) {
#endif
        var[idx] += data[idx];
    }

Unfortunately, this seems to break many editor features.  By far the worst symptom is that indentation becomes broken from that point all the way to the bottom of the buffer because there seems to be an unmatched open brace.  Other features that break include code folding and semantic navigation (e.g. c-end-of-defun)

I can imagine some ways of working around this problem by editing the code itself.  Like this for example:

#ifdef SOME_COMPILE_TIME_VARIABLE
    for ( idx=0; idx<FOO; idx++ )
#else
    for ( idx=0; idx<BAR; idx++)
#endif
    {
        var[idx] += data[idx];
    }

But since the code does not belong to me, I do not have the option of editing the entire code base so that it plays nicely with my editor.  And in many cases, this would not be practical even it were permissible.

Is there a way to mitigate the negative effects of mismatched parentheses and braces like this, which are due to precompiler directives?


texts: Is there an Emacs mode which highlights differences from the committed version?

texts:
One feature that Xcode has which I think is pretty neat is a "Comparison" mode, which continually shows differences between the current buffer and the most recent commit.

Is there anything like this for Emacs?  I don't really care about the simultaneous side-by-side views.  Just highlighting the background of any lines that were changed would be a great help.

I know I can always do C-x v =, but it's a static view of one point in time, and only shows the diffs.  I want to see my entire file, editable, with the diffs highlighted.


texts: Weird autocompletion when writing a decimal number in helm-mode

texts: I am using Emacs Prelude with Helm activated. While using Emacs IPython Notebook and julia-mode, I get an annoying auto-complete buffer pop up, when I am trying to type a decimal number, see figure below. how to stop this weird behavior?