texts: Indentation with reader macros: common lisp in emacs

texts:
Okay, I'm not sure whether this question is more relevant to Common Lisp, or to Emacs.

I have reader macros in Common Lisp (found them here), that allow the declaration of hash-tables by:

#{'a 'b,
'c 'd}

I'd like it to be indented as (both in emacs, and REPL - slime / portacle in particular):

#{'a 'b,
  'c 'd}

And I'd like some guidance. I looked at the top of this, but I don't quite understand how to do it for reader macros as well.

My current (relevant) code is as follows:

(defun read-left-brace (stream char n)
  (declare (ignore char))
  (let ((*readtable* (copy-readtable)))
    (set-macro-character +comma+ 'read-separator)
    (loop
      for key = (read-next-object-for-hash-table +right-brace+
                                                 +comma+
                                                 stream)
      while key
      for value = (read-next-object-for-hash-table +right-brace+
                                                   +comma+
                                                   stream)
      collect (list (eval key) (eval value)) into pairs
      finally (return (make-hash pairs)))))


texts:
Sometimes Emacs stops responding to keyboard input. It responds to mouse input though. If I do killall -s SIGUSR2 emacs, the debugger shows this (but remains unresponsive to keyboard):

Debugger entered--entering a function:
* company-pre-command()
  recursive-edit()
  debug(lambda)
* company-pre-command()
  recursive-edit()
  debug(lambda)
* eldoc-pre-command-refresh-echo-area()

This happens every few days and I end up having to kill emacs and restart. How can I fix it?

GNU Emacs 26.1 running emacsclient

Ubuntu 18.04

system-configuration-options: "--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs26-pCvJBp/emacs26-26.1~1.git07f8f9b=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie'"

system-configuration-features: "XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2"


texts: How to impliment a “with-undo-collapse” macro using change group feature?

texts:
Recently emacs has a feature undo-amalgamate-change-group which can be used to merge multiple actions into a single undo step.

How can this be used to make a with-undo-collapse macro similar to this one, which:

Handles errors.
Forwards the result of the body of the macro.

This is a basic version, however I'm not sure how it should work when there is an error in the body of the code which runs in this block.

(defmacro with-undo-collapse (&rest body)
  "Execute body, then collapse any resulting undo boundaries."
  (declare (indent 0))
  `(let ((cg (prepare-change-group)))
     (progn ,@body)
     (undo-amalgamate-change-group cg)))


texts: from the spacemacs shell, how do I edit a file in a new buffer in the main window?

texts:
I open a new shell using space-'. From that shell window I can type ls to see files. Let's say I want to edit ~/.zshrc. From the shell prompt, what do I type to edit that file in a new buffer in the main window?

Note - I do not want to browse to the file location again using space-f-f, as I might be several dirs deep. And typing emacs <filename> opens a new instance of Emacs. vim <filename> works close to what I want.

I'm using Macos with the d12frosted homebrew install of Emacs.


texts: How do I build a regexp that enables Emacs to set all words to the left of an equal sign a specific font-lock-*-face?

texts:
Following some help provided by Tobias, I am trying to assign a font-lock-keyword-face to all text (:alpha:) to the left of an equal sign (=) in a new Tecplot major mode. I read through the regexp section of elisp.pdf and came up with [^# ][[:alpha:]] =", but this only matches the first two letters to the left of the equal sign and the equal sign. In my code:

# To ensure all the data needed is displayed, activate the surfaces of
# each zone, and extract from the auxilary data, the number of zones
# in the data set. This number is used throughout this macro to control
# various operations.

$!System "echo \" \" "

$!If "|AuxDataSet:SolverName|" == "OVERFLOW"

  $!FieldMap [1-|NumZones|]  Surfaces{SurfacesToPlot = BoundaryFaces}
  $!FieldMap [1-|NumZones|]  Surfaces{IRange{Max = 0}}
  $!FieldMap [1-|NumZones|]  Surfaces{JRange{Max = 0}}
  $!FieldMap [1-|NumZones|]  Surfaces{KRange{Max = 0}}

$!Else

  $!FieldMap [1-|NumZones|]  Surfaces{SurfacesToPlot = BoundaryFaces}

$!EndIf

the "ax =" and "ot =" are getting the font. However, I do not want to include the equal sign but I do want to include the entire word, such as "Max" and "SurfaceToPlot". How do I get just the word to the left of the equal sign.


texts: Why is Emacs asking me to save changed buffers, when I install a package?

texts:
Every time when I change something in a buffer, and then I decided to install a package from packages.el, Emacs is repeatingly asking me if I want to save the other buffers, because it's changed.

I fail to understand the relation between this buffer and the installation of a package. On the internet I found no suitable answer.

Anyone care to explain the logic behind this?

Thanks in advance.


texts:
What is the proper way to install, configure and activate folding of R script files?

I followed emacswiki.org/emacs/FoldingMode but it doesn't seems to work. I installed folding.el to .emacs/lisp/. I tried to define folding as { and } as you would expect in R. I work a lot with R6 classes, so folding body of methods is quite essential for navigation in class definition.
My current config for folding:

; folding
(add-to-list 'load-path' "~/.emacs.d/lisp/")
(load "folding" 'nomessage 'noerror)
(folding-mode-add-find-file-hook)
(folding-add-to-marks-list 'r-mode "{" "}" nil t)

Ideally I would like to replicate RStudio folding in Emacs ESS.


texts:
I would like to understand the internal architecture and strategy used by org-mode.

how does org-mode avoid re-parsing the document after every change?

For example, let's say I have a 2 meg org-mode file/buffer.

There is a TODO in the middle of the file.

I accidentally put a space in the middle of "TODO", so it becomes "TO DO".

After that insert, org-mode needs to remove that TODO (and possibly its children) from its internal data structures. However, from what I can tell, org wouldn't know what the change was. It would have to reparse the whole buffer and then compare the old tree with the new tree. Any agenda views would also have to update after this single keystroke.

How does org-avoid having to perform such an expensive computation for every key stroke?


texts:
I would like to exchange on Freenode using ERC, however I do not know how to authenticate with SASL as required.

-xxxxxx.freenode.net- *** Lookup up your hostname...
-xxxxxx.freenode.net- *** Checking Ident
-xxxxxx.freenode.net- *** Found your hostname
-xxxxxx.freenode.net- *** No Ident response
-xxxxxx.freenode.net- *** Notice -- You need to identify via SASL to use
            this server

==> ERROR from irc.freenode.net: Closing Link:
xxxxxxxxxxxxxxxxxxxx.xx     (SASL access only)

Connection failed!  Not re-establishing connection.

*** ERC terminated: connection broken by remote peer

I looked quickly the ERC manual and the EmacsWiki website. I also noticed that Emacs has a SASL library. Moreover, a developer was proposing a SASL extension for ERC on a GitHub repository.

I am looking for a solution as well as an explanation (or overview) to facilitate a possible inspection of the source code. Eventually, you can specify how to proceed for other IRC clients (rcirc,...).


texts:
I'm currently using emacs24 and multi-term, my frame is split in two windows, top for buffers and the bottom terminals.

When I need to open a new file I have to go to buffers and C-x C-f, I'm wondering if there's a way to avoid this and instead send files from current terminal path to buffers.

EDIT:

What I want to do is be able to open a file from the current pwd in multi-term and send it to the top window, avoiding to create a new one.


texts: Inferior Python Shell - Windows - not printing results

texts:
I'm trying to use inferior python shell to run ipython commands interactively. I am able to connect but it doesn't print the results of my statements except when I use print statements

In [1]: a = 10

In [5]: a

In [6]: a.real

In [12]: print "hello"
hello

I am using the latest version of spacemacs with the Python layer and the following user configuration settings:

(setq python-shell-completion-native-enable nil)
(setq python-shell-interpreter "ipython")
(setq python-shell-interpreter "python.exe"
    python-shell-interpreter-args
    "-i c:\\Users\\me\\AppData\\Local\\Continuum\\Anaconda2\\Scripts\\ipython-script.py")

Thanks in advance!


texts: A single Key Binding for several commands

texts:
I want to set a key binding to both open and close nodes in origami-mode.

This is my attempt

(require 'origami)
(defun open-close-node ()
  (interactive)
  (origami-open-node)
  (origami-close-node))

(global-set-key (kbd "C-c C-f") 'open-close-node)

When pressing C-cC-f the "Messages" buffer return this:

open-close-node: Wrong number of arguments: (2 . 2), 0


texts: Priority of the executation of two functions with the same name from two different packages

texts:
General question: two packages have the same name for a certain function. When both packages are installed, which one has the priority to execute that particular function.

Particular situation: I am talking about two packages goto-last-change and goto-chg. The function goto-last-change is present in both packages.


texts:
I have this configuration init.el file:
    ;; for org-journal
    (setq org-journal-dir "~/Desktop/doctorado")
    (setq org-journal-date-format "%A, %d %B %Y")
    (setq org-journal-file-type 'yearly)
    (setq org-file-format "Diary %Y")
    (require 'org-journal)

    ;; package manager
    (require 'package)
    (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

    ;; package initialization
    (package-initialize)

I want to open my journal with C-c C-j when opening emacs. However now I have to open init.el and do M-x ev-b before it works.
Why is this happening? How can I solve it?


texts:
When you push a branch with Magit (with P P) and the branch has no
upstream, Magit asks you the name of the branch you want to push to.
That's great.

Once you set the upstream for a branch, however, Magit no longer asks
you where you want to push it. This is usually convenient (you don't
want to be asked every time), but it makes it difficult to push a
branch to a different remote branch.

Is there a way to have Magit ask me again about the destination
  branch, even if the current branch already has an upstream?

Use-case

It's quite common that I have a branch like this:

Local:    issue-30 ~/Git-Projects/repo/
Remote:   issue-30 @ origin (git@github.com:.../repo.git)
Head:     ebe4054 Some commit message

and I want to change both Local and Remote branches to issue-30-and-34. If I just rename the Local branch, I'm left with this:

Local:    issue-30-and-34 ~/Git-Projects/repo/
Remote:   issue-30 @ origin (git@github.com:.../repo.git)
Head:     ebe4054 Some commit message

Even if I delete origin/issue-30, doing P P on issue-30-and-34
will simply recreate the origin/issue-30.

What I end up doing is the following, but it feels rather roundabout for something that can be done in a single git command:

Create a new branch called issue-30-and-34
(instead of renaming the old one),
delete both Local and Remote versions of issue-30,
push issue-30-and-34 (since it has no upstream yet, Magit will ask me where to push).


texts:
I'm trying to open a file with a given encoding and running into the problem that C-m is the same as RET.  There is an answer here.  However, I don't want to bind a specific function; I want to restore all C-x C-m key bindings to their intended behavior; so, the next time I look up how to do something, it just works.

This raises the question of why there even are C-x C-m bindings if they don't work.  Note I'm assuming this documentation is correct.  I don't know how to look up the command for the binding.  If I use C-h k to describe the command, I'm still stuck with the problem of how to type C-x C-m!

I also looked at this answer, but I'm not clear if he's saying it can't be done, or is it only in a terminal that it's a problem?  I'm only using emacs in a GUI; I can't remember the last time I used it in a terminal.  I'm open to workarounds, such as using a different key.  The trouble with this is I won't remember it has been remapped unless I use it frequently...


texts: Proper way to bind multiple commands to the same key

texts:
I am curently redoing my Emacs config and I am switching from autocomplete to company-mode.
I want to toggle company-complete with TAB. The issue is that when I do so all the other TAB commands do not work anymore (for example the TAB command is used a lot in org-mode).
Did anyone else have the same issue ?
My config can be found here.
For now I use the following:

(defun company_tab_behaviour()
  (interactive)
  (indent-for-tab-command)
  (company-complete))

(add-hook 'company-mode-hook
  (lambda () (local-set-key [tab] 'company_tab_behaviour)))


texts: Using tab as indentation in anaconda-mode with spacemacs

texts:
I recently installed spacemacs with the python mode and would like to change the default indentation to be TAB instead of four spaces.
What I did is I added (setq-default indent-tabs-mode t tab-width 4) to my just after(setq initial-major-mode 'text-mode) in my config.el. Unfortunately, when I open a python file, I can see that indentation is still done with 4 spaces instead of one TAB. Did any of you come across this issue before ?
Thanks in advance


texts: Simple method for creating multiple eww buffers

texts:
M-x eww prompts for url or keywords and opens a new *eww* buffer.  In eww-mode, G is bound to eww, which replaces the content of the single eww buffer.

To make multiple buffers for different webpages, I've resorted to creating a new buffer, setting eww-mode manually, then pressing G (or M-x eww) to visit a URL.

I can easily write a function that does all this for me, but I'm surprised this functionality isn't just built-in.  Am I just missing it?


texts: After enabling ivy-mode, `dired-create-directory' does not allow me to choose an entry not in the completion list

texts: Is there any way to allow me to type in a new dir name that is not in the completion list generated by ivy-mode?


texts:
I'm using org-babel with python source blocks to put break my code into sections.  The issue I'm having is I don't get any autocomplete suggestions based on the code in other blocks.

Is there any way to have elpy recognize the code in the other blocks? I get this could be difficult so my other hope was to have it recognize the code that's already been run in the buffer attached to the source code block?


texts: copying into emacs from clipboard garbled

texts:
When I copy data from outside to my emacs, it is garbled

(venv)  tree ./scripts
scripts
├── foo.sh
├── bar.sh
├── start.sh
├── stop.py

However, when I paste this in emacs, I get this:

(venv)  tree ./scripts
scripts
\u251c\u2500\u2500 foo.sh
\u251c\u2500\u2500 bar.sh
\u251c\u2500\u2500 start.sh
\u251c\u2500\u2500 stop.py

I thought this was due to simpleclip.
But I also get this in my magit when I issue git standup (using : standup from within emacs)

  0 git … standup
[31mbe041bb[m - fix sort by name; closes #636 [32m(21 hours ago) [1;34m<darshanime>[m
[31mfa80601[m - change vul order [32m(22 hours ago) [1;34m<darshanime>[m

which should be:

(venv)  git standup
be041bb - fix sort by name; closes #636 (21 hours ago) <darshanime>
fa80601 - change vul order (21 hours ago) <darshanime>


texts: Is it possible to mark all unread messages as read with a single key? r marks only the selected message as read.


texts: How to get flycheck to do a syntax check immediately after opening a file?

texts:
I can't get flycheck to do its thing immediately after opening a file.
It will check/find errors if I save the file.
And it will check/find errors if I execute the M-x flycheck-mode command twice (i.e. - disabling then re-enabling flycheck mode).

I'm guessing there're some subtle timing issues between add-hook, eval-after-load, and with-eval-after-load that I don't fully understand?

The relevant (I think) lines from my ~/.emacs.d/init.el file:

;; Global Flycheck
(global-flycheck-mode)

(setq flymake-no-changes-timeout nil)
(setq flymake-start-syntax-check-on-newline nil)
(setq flycheck-check-syntax-automatically '(save mode-enabled))

(add-hook 'literate-haskell-mode-hook
          '(lambda () (flycheck-select-checker 'haskell-stack-liquid)))
(add-hook 'literate-haskell-mode-hook 'flycheck-mode)


texts: How to checkout a specific commit using Magit?

texts:
When using M-x magit-checkout, I can only select a branch.
Is it possible to visit a commit (the stage at the commit) using Magit?
Thanks!


texts: Open buffer in external application using xdg-open

texts:
I want to open the currently viewed buffer in an external application using "xdg-open". What I tried is:

(start-process "" nil "xdg-open" (buffer-file-name))

But that only returns #<process >.

If I replace "xdg-open" with the actual application (in my case it's xppaut) everything works. That seems only to happen with programs that I call through the terminal. If I want to open the currently viewed buffer in another editor, everything works with xdg-open, i.e. I change the default application for that file extension to gedit then.

But at the same time xdg-open works when I try to call open a file with xppaut through Gnome Files (Nautilus). So I'm not really sure if that is an Emacs issue or xdg one.


texts: How do I get all the tags on a headline, including the inherited ones?

texts:
The Org Manual says that a child headline will inherit all the tags from its parent.

What function should I use to give me a list of all these tags?

org-get-tags and org-get-local-tags both seem to be giving me only the tag that is present only on the current headline.


texts:
I have downloaded my emails using getmail and indexed them by mu. The problem now is that my mu4e has around 50000 emails that are marked as unread: is there a simply way to mark the entire Maildir as read?
I have tried a couple of scripts external to emacs adding the flag "S" to all the emails, then when I open mu4e they all still have unread flag.


texts:
I try to disable this via

(recentf-mode -1)
(setq recentf-mode nil) ;; mysteriously switches to t after some time

but it keeps automatically turning on after some time and is causing problems for me (see here).


texts:
After initialising pallet for my package managment I forgot to add the requisite line to my init.el :(

Having now added:

(pallet-mode t)

To my init.el is there a way to diagnose which (if any) packages are not under pallet and cask's control?

Thanks


texts: Use iconv directly on the selected region to convert codes

texts:
I copied and pasted the C code as:
int main(void)
{
   statements
   return 0;
}

to org's babel code block, when strike  C-c C-c, it report error:
/tmp/babel-uaYVXU/C-src-Pd1SZs.c:11:6: error: stray ‘\240’ in program
   11 |    statements
      |      ^
/tmp/babel-uaYVXU/C-src-Pd1SZs.c:12:1: error: stray ‘\302’ in program
   12 |    return 0;
      | ^

Then I have to create a new file and employ iconv to tackle the problem as:
iconv -f utf-8 -t ascii//translit input.c > output.

Is it possible to use iconv directly on the region of selected codes?


texts: Enable smerge-mode for already opened file

texts: smerge-mode doesn't always get enabled for git merge conflicts. I think this happens when I visit a file using emacsclient which is already opened in a buffer. Something (maybe magit?) is causing the file to be auto-reverted from the filesystem, so the conflict markers appear, but unfortunately the presence of the conflict markers do not cause smerge-mode to be activated. How can I make smerge-mode be activated as soon as conflict markers appear in the file, regardless of whether it's freshly opened or just reverted?


texts: How to access Query-replace history in replace format (for eg: "ABC → XYZ")

texts:
I have enabled query replace save history as below. When I am in query-replace mode, I see previous search-replace patterns of the current session in the form "ABC -> XYZ". But the search-replace patterns from previous emacs sessions dont show up as "LMN -> PQR" instead they show up as LMN for search pattern and then I need to again search for PQR as replace pattern. Is there a way to improve this?

;;Save Search history
(setq savehist-additional-variables
      '(search-ring regexp-search-ring compile-history)
      savehist-file "~/.emacs.d/savehist")
(savehist-mode t)


texts: Org Mode Default to Alt-Enter for Bullets

texts:
I want org-mode to default to alt-enter when under bullets, so that for bullets I can just press enter to make a new bullet.

So for instance:

Banana
Apple
Kiwi [MOUSE CURSOR HERE]

When I press enter, I want the following behavior (which happens when I press M-enter):

Banana
Apple
Kiwi
[MOUSE CURSOR HERE]

Instead of:

Banana
Apple
Kiwi

[MOUSE CURSOR HERE]

That is the default for most other applications, but why not for org-mode?

This would greatly improve my workflow. But I don't know how! Thanks in advance.


texts: Fix for "Invalid function:" error when external function become a macro

texts:
For:

(defun my-w3m-view-url ()
  (interactive)
  (browse-url (w3m-anchor)))
(eval-after-load 'w3m
  (define-key w3m-minor-mode-map (kbd "RET") #'my-w3m-view-url))

when byte-compiled I get error on key binding RET usage:

my-w3m-view-url: Invalid function: w3m-anchor

This because w3m-anchor isn't a function but become macro. I try to add:

(eval-when-compile
  (require 'w3m-util nil :no-error))

before lines that uses w3m-anchor. But this doesn't help me.

I load .emacs-my.elc file made by:

emacs -Q --batch --eval='(byte-compile-file "~/.emacs.d/.emacs-my")'

UPDATE As suggest @Iqbal Ansari I further debug issue. For some reason byte compiled file have function call instead of expanded macro:

$ strings .emacs-my.elc | grep w3m-anchor
840:(defalias 'my-w3m-view-url #[nil "\300\301 !\207" [browse-url w3m-anchor] 2 nil nil])

Full .emacs-my file source code is available at https://sourceforge.net/u/gavenkoa/dot-emacs/ci/default/tree/.emacs-my Corresponding installation steps are available at https://sourceforge.net/u/gavenkoa/dot-emacs/ci/default/tree/Makefile


texts:
What is the difference between iedit and multiple-cursors?

As far as I can tell they provide basically the same functionality.


texts: Set mode for new Tex files in a directory

texts:
How to change the default mode for new Tex files in a directory? I tried putting this into a .dir-local.el:
((nil
  (tex-default-mode . context-mode)
  (TeX-default-mode . context-mode)))

but newly created files are still opened in latex-mode. The two variables are correctly set to context-mode in the buffer though.


texts: Emacs Key Combinations with Arabic characters

texts:
I am new to emacs. I am using two keyboard layouts Arabic & English. I need a way to execute key combinations without the need to change to English layout.
Right now I got something like this:

C-ء is undefined

I need something like key-translation-map but for all emacs key combinations using arabic characters.


texts:
Is there a package that will gray out or hide the false portion of a c preprocessor macro?

#define ENABLE 1
#if ENABLE
    bool hide = false;
#else
    bool hide = true;
#endif

In the above example, I want bool hide = true; to be grayed out or hidden.

I've looked at Hide If Def, but it doesn't produce my desired effect.  Executing M-x hide-ifdefs hides  bool hide = false;, but I would expect bool hide = true; to be hidden.

The functionality I am looking for would be similar to what NetBeans does.


texts: Apply ANSI color escape sequences for Org Babel results

texts:
Feature

There is a nice built-in Emacs feature to colorize strings with ANSI color escape sequences. So evaluating the following Elisp code, will insert the "Test text" at the point with proper colors.

(require 'ansi-color)
(insert (ansi-color-apply "^[[33mTest text^[[0m"))

Problem

I tried to use the ansi-color-apply function to colorize the results of my Org Babel code blocks using :post with the following filter block.

#+name:ansi-colorize
#+begin_src emacs-lisp :var input="[33mTest text[0m" :results raw

    (ansi-color-apply input)

#+end_src

#+RESULTS: ansi-colorize
Test text

Which only removes the color escape sequences, but the inserted text has no proper face attributes.:

Notes:

Since ansi-color-apply is a pure function, therefore does its job right and returns with:

#("Test text" 0 9 (font-lock-face (foreground-color . "#E6DB74")))

Which does not have the expected effect when the result is inserted by Org Babel


texts: Hunspell: encoding of personal dictionary

texts:
I am using hunspell 1.3.2 (on Windows) for spell checking, and I've been trying to make a personal dictionary. It works just fine, except the encoding is garbled. Whether I encode the personal dictionary in UTF-8 or ISO-8859-1 (I'm using the French dictionary as the main one, and it's encoded with that), words with accents are not recognized correctly (words without accents work just fine). What should I do to make it work?

Note: it seems to work fine when I fire up hunspell in a terminal.

Even stranger: when I put in the personal dictionary a word containing a character not present in ISO-8859-1 (eg. ć), then spell checking works for that word!


texts: How do I select a region that has been syntax highlighted?

texts:
In a buffer with source code that has already been syntax highlighted (eg some Python code in python-mode), how do I access the results of the syntax parsing to select text from elisp that is a particular syntax?

For example if I want to select the next keyword, or select all of the current comment around the point, or all of the string around point.

Thanks


texts:
I'd like to be able delete the innermost brackets around the current point.

What's a good way to do this?

While the evil-surround package can do this, it needs to take a bracket type as input, so can't remove the inner-most brackets (without some extra code).


texts: What difference does it make changing the order of arguments to 'append'

texts:
I want to understand the implications of append's property that "All arguments except the last one are copied, so none of the arguments is altered." (from the Elisp manual)
Say I have a list mylist (the order of its elements is irrelevant),
(setq mylist '(a b))

First, I want to add a couple of elements to it. Using append I can do
(setq mylist
      (append mylist '(c d)))

or
(setq mylist
      (append '(c d) mylist))

If I understand right, the resulting list is
mylist
|
|     --- ---      --- ---      --- ---      --- ---
 --> |   |   |--> |   |   |--> |   |   |--> |   |   |--> nil
      --- ---      --- ---      --- ---      --- ---
       |            |            |            |
       |            |            |            |
        --> a        --> b        --> c        --> d

in the first case and
mylist
|
|     --- ---      --- ---      --- ---      --- ---
 --> |   |   |--> |   |   |--> |   |   |--> |   |   |--> nil
      --- ---      --- ---      --- ---      --- ---
       |            |            |            |
       |            |            |            |
        --> c        --> d        --> a        --> b

in the second case. Both settings leave nothing else in memory, right?
Second, I want to concatenate mylist and another-list (again invariant wrt to the order of its elements),
(setq another-list '(0 1))

(I'll use the first value of mylist). I can do
(setq another-list
      (append mylist another-list))

or
(setq another-list
      (append another-list mylist))

In my reasoning the first setting yields
another-list
|
|     --- ---      --- ---      --- ---      --- ---      --- ---      --- ---
 --> |   |   |--> |   |   |--> |   |   |--> |   |   |--> |   |   |--> |   |   |--> nil
      --- ---      --- ---      --- ---      --- ---      --- ---      --- ---
       |            |            |            |            |            |
       |            |            |            |            |            |
        --> a        --> b        --> c        --> d        --> 0        --> 1

while mylist still resides unaltered somewhere in memory. The second setting yields
another-list              mylist
|                           |
|     --- ---      --- ---   -> --- ---      --- ---      --- ---      --- ---
 --> |   |   |--> |   |   |--> |   |   |--> |   |   |--> |   |   |--> |   |   |--> nil
      --- ---      --- ---      --- ---      --- ---      --- ---      --- ---
       |            |            |            |            |            |
       |            |            |            |            |            |
        --> 0        --> 1        --> a        --> b        --> c        --> d

which is all the code I've used has put in memory, which is to say that compared with the first setting of another-list I've spared one copy of mylist. Is this right?
Last thing, when Emacs evaluates (append mylist '(c d)) and (append '(c d) mylist), what do they look like in memory? Can you show it with a cons cells diagram?


texts:
I've got this from EmacsWiki:
(defun my/open-current-file-in-vim ()
  (interactive)
  (async-shell-command
   (format "gvim +%d %s"
           (+ (if (bolp) 1 0) (count-lines 1 (point)))
           (shell-quote-argument buffer-file-name))))

I've tried replacing gvim with vim but it opens Vim within Emacs. Is it possible to open Vim in external terminal and not show *Async Shell Command* buffer at all?


texts: Disable ipython show output in minibuffer

texts:
I am using Ipython 3.6.3 with Emacs(elpy enabled) 25.2.2 on Kubuntu 17.10.

I realize that sometimes output of Ipython keep showing at minibuffer, which is very annoying.

But, I cannot find the value for customizing this feature. So, could you please give me a hint on this issue?


texts: Running an external shell command after org export

texts:
I'm writing a paper using org-mode, using the LaTeX export function to generate the .tex file I need to submit to the journal.

How can I run an external shell command every time I to the C-c C-e l l for LaTeX export?  I need to apply a patch to the generated .tex file.


texts: markdown inline preview like it is done with preview-latex

texts:
I am completely new to markdown and would like to know if there is any package/mode which allows to live preview only parts of the document (mainly equations, tables and images) like it is possible with preview-latex?

Until now, I could only see the preview in a different buffer.

Thanks!
Fab


texts:
I'm trying to post a babel src block that contains a babel definition since I am documenting some babel source blocks in a Hugo post written in org mode.

What I want to do is the following:

#+BEGIN_SRC
#+BEGIN_SRC dot :file my_output_file.png :cmdline -Kdot -Tpng
digraph G {
  my_start -> one_branch;
  my_start -> another_branch;
}
#+END_SRC
#+END_SRC

And the output I'd like to achieve when exporting is:

#+BEGIN_SRC dot :file my_output_file.png :cmdline -Kdot -Tpng
digraph G {
  my_start -> one_branch;
  my_start -> another_branch;
}
#+END_SRC

BUt what I get instead is

#+BEGIN_SRC dot :file my_output_file.png :cmdline -Kdot -Tpng
digraph G {
  my_start -> one_branch;
  my_start -> another_branch;
}

Since the first #+END_SRC finishes the code block.

Is there any way to escape the #+END_SRC so I can have my src block as I expect?

Thanks a lot!


texts: How to not load font faces from desktop files?

texts:
I use desktop-save and desktop-change-dir a lot. Recently, I upgraded my hardware and now have a screen with way more DPI. This forced me to increase the font size in emacs.

Unfortunately, all my desktop files contain a font definition:

(setq desktop-saved-frameset [frameset 1 (22300 50983 182648 566000) (desktop . "206") "horazont@sinistra.sotecware.net" nil nil ((((font-backend xft x) (font . "-unknown-DejaVu Sans Mono-normal-normal-normal-*-11-*-*-*-m-0-iso10646-1") (font-parameter) […]

Is there a way to make emacs ignore the font from desktop files, and ideally, not store it there at all?

I could hack up a sed-call to fix my desktop files, but I really would prefer emacs not to save the font at all.


texts: Including pip-installed libraries on emacs python shell

texts:
I recently found out you can run python from emacs (Python Mode -> py-shell) and I've been running my scripts through the py-shell due to only needing to C-c C-c, but I've been running into a problem:

I import requests among other external libraries I have installed (through pip), but the python shell in Emacs can't find the modules. Is there a way I can change PATH variables in such a way that Emacs finds these modules?

Here's the error the python shell gives (not sure if it helps, but this runs on the "Py:run Shell-Compile" buffer):

exec(compile(open(r'/Users/r/Desktop/name.py').read(), r'/Users/r/Desktop/name.py', 'exec')) # PYTHON-MODE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/r/Desktop/name.py", line 1, in <module>
    import requests
ImportError: No module named requests

(As proof that I do have requests installed, I ran this on the terminal with python name.py and it worked as expected)


texts: How to resume an INCOMPLETE keyboard macro recording?

texts:
Classic use-case:

You start recording a macro: C-x (
You do some stuff, let's say hello.
You run a command that throws an error, let's say C-g (e.g. you mistakenly run C-s and you have to cancel that with C-g, now your work is lost).

Now your recording so far is lost.

I would like to resume where I left off before I ran a command which interrupted my recording. I looked at C-h f start-kbd-macro, but it's written in C, so I can't tweak it. I also hunted around for a variable like current-kbd-macro, but found none so far.

Can it be recovered?

Update:

I couldn't figure out why C-u C-x ( wasn't working for me, but I've discovered it's because I was testing with C-g.

It turns out that C-g is special -- if you trigger a different kind of error e.g.

C-x ( M-: (signal 'quit nil)

Then this will stop the recording, but last-kbd-macro will contain "M-: M-( signal 'quit nil", but with

C-x ( C-g

This stops recording and discards anything recorded. As a C-g-happy user (as are at least two of my friends), this is a rather unfortunate distinction. I tried editing keyboard-quit, but there's nothing I can do in there.

It looks like the only way to recover this is via recent-keys and automatically figuring out where a start-kbd-macro (or similar) was called, as in kmacro-edit-lossage.


texts: Is there a set of holidays.el definitions for United Kingdom holidays?  I don't want to maintain the list of holidays myself.  I would like to use them in org-agenda, but that's not the focus of the question.


texts: How can I fill the entire line number bar with a custom background color?

texts:
In the screenshot below I have simply set the background of the linum face to some color, however there is a blank region at the end of the buffer and there are gaps between the lines when line wrapping (global-visual-line-mode) is enabled:

Ideally the whole left side should be in a uniform color. Is this possible? I know some Elisp, so if it’s possible, I could maybe write a fix myself with some instructions.


texts:
I am in a .py file with python major mode (syntax highlighting is working).  I am trying to just use the TAB key to indent a code section. Nothing happens.

Now it would be nice for emacs to do intelligent formatting. I am not even asking that! Just asking it to move text (code) over whatever the predefined number of spaces.

I can not paste the code.  The disable aggressive python indentation has been added but it did not work.

At this point, I just want a way to "indent no matter what" ..


texts:
I'd like to have small tables being shown side by side instead of one under the other, when I export to PDF.

Is there an easy way to do that ? Like a break between tables ?


texts: Can I set a particular file to automatically and silently accept changes?

texts: That is, can I specify for a particular file that I don't want Emacs to notify me that the file has changed on disk and prompt me about whether I want to accept changes or not?  I don't want to do this globally, just for files I know will frequently be changed outside of Emacs (in particular, calendar-related Org files).


texts: cons a symbol with a variable and return as a symbol

texts:
How can I make fun2 return as the same as fun1?

(defun fun1 ()
  '((hello . "test"))) ; <= returns ((hello . "test"))

(defun fun2 (str)
  '((hello . str))) ; <= this is wrong! should return ((hello . "test"))


texts: Scroll only current line when truncating lines

texts: When using (set-default 'truncate-lines t), and when moving to the end of the long line, is it possible to make Emacs scroll only that line, while the other lines stand still? nano does this.


texts:
Is it possible to force Emacs to only take into account the last (resp. the first) appearance of a customization?

For example if there are the following lines in the init file, is there a way that Emacs only takes into account the second (resp. the first) one?

(set-frame-height (selected-frame) 36)
(set-frame-height (selected-frame) 46)


texts: Open helm search result in a new window?

texts:
Commands like helm-projectile-grep, helm-swoop, projectile-find-file are extremely useful for jumping around code. However, so far I've not found how I can open a search result in a new window (instead, right now pressing RET with a search result highlighted opens the search result in the window from which the original search command was executed).

I want to be able to optionally open a search result highlighted in the *helm grep* mode either in a horizontally or a vertically tiled window. For instance, I'd like the following functionality:

Pressing RET opens the highlighted result in the current window
Pressing C-c h RET opens the highlighted result in a new, horizontally tiled window
Pressing C-c v RET opens the highlighted result in a new, vertically tiled window

Here's an illustration:

Is something like this possible? Thanks for your time!


texts: How to yank text to search command (after "/") in evil-mode?

texts: Is it there any way to yank in the search command (after press "/") in evil-mode?


texts: switching from tmux + terminal emacs to Emacs only

texts:
I am thinking of switching from tmux + terminal emacs (emacs -nw) to just pure emacs. The only thing that is holding me back is tmux offer switching between sessions without switching the terminal window itself (C-b s). For instance, if I have tmux session 0 and tmux session 1. If my current tmux session is attach to session 0, I can easily switch to session 1 by using the keybinding (C-b s 1) without leaving my current Xterm window. I know that there are frames, windows, buffer and server in emacs, but I still can't find anything equivalent to this (swap between frame/server without leaving my main GUI).

UPDATE:

I found something pretty close to what I need by starting two emacs server:

In xterm1:

emacs --daemon="one"

In xterm2:

emacs --daemon="two"

By doing this, I can group all the file buffers and ansi-term by projects in each emacs server. However, are there any easy way to switch between daemon (the help page use the term "socket") within the Emacs without leaving the GUI?


texts: Make "org-edit-special" not insert spaces at the beginning of the line

texts:
The problem
When editing code blocks, I usually opens a new buffer by pressing C-c ' (i.e. executing org-edit-special). The problem is that when I finish editing the buffer, two spaces are inserted to the beginning of each line which is something I don't want so I would like to make org-edit-special not insert those spaces after finishing editing the buffer that it opens.
In the gif shown below, you can see how two spaces are inserted at the beginning of each line after exiting the buffer that org-edit-special opens.

Some notes

I started emacs with emacs -Q to avoid my configuration interfere with the default functionality oforg-mode.
The gif starts when the black box appears  at the right top corner and finishes when the C-c / key is pressed (it is shown by screenkey).


texts: Display errors and warnings in an org-mode code block

texts:
I would like to be able to report warnings and errors when evaluating a Python code block in an Org file.

When a code block has Python syntax errors, Org helpfully pops them up in a separate buffer called *Org-Babel Error Output*.  It would be nice to be able to send my own warnings there too, while retaining the ability to return an array result to Org mode as a table using :results value.

To be clear, here is a dummy example of the kind of thing I thought might work:

#+BEGIN_SRC python
    import sys
    sys.stderr.write('Warning.\n')
    sys.stderr.flush()
    return [['Table', 'header'], ['table', 'data']]
#+END_SRC

#+RESULTS:
| Table | header |
| table | data   |

Edited to add: This discussion on the org-mode list suggests that error output is only displayed when the code-block evaluation fails.  So it looks like this is possible, but only by aborting the evaluation using exit(1) or similar.


texts: Reverting back a buffer to what it was x minutes ago

texts:
This question is inspired by https://stackoverflow.com/a/726942/.
I am wondering if it is possible to revert back a buffer to its state of x minutes ago.


texts:
How can I let-bound a face-attribute locally.
E.g. I want to:

(set-face-attribute 'query-replace nil :background "OrangeRed3")
(perform-replace "bar" "foo" t t nil 1 nil (point-min) (point-max))

and then restore the default query-replace background color. Is the a way to use let to do that?

EDIT. I need a solution that will restore the default value even if I quit the command perform-replace.


texts: Cannot export org mode to collapsible HTML

texts:
I am trying to have basic collapsing/folding functionality for sections in the HTML file that has been exported from org-mode, since the files I want to share are very large. I am using Emacs 26.2 (9.0) and Org 9.1.9 on a Mac. I am not able to get this previous solution to work in 2019.

This seems like a built in feature but it seems like the underlying javascript code has a bug. I also saw another tool mentioned on the mailing lists, but without any examples I don't know how apply it to a specific org file I have.

For example, the following file is converted to HTML here

#+Title+: JS test
#+INFOJS_OPT: path:/~ksb/js/org-info.js
#+INFOJS_OPT: toc:nil ltoc:nil view:overview mouse:underline
#+INFOJS_OPT: home:https://orgmode.org buttons:nil
* Chapter 1
** Section 1
*** Part 1
 - csp
** Section 2
 - cs2p

I have a freshly-downloaded copy of js/org-info.js.

UPDATE: there is a javascript error being raised by org-info.js

Uncaught TypeError: Cannot read property 'cloneNode' of undefined
    at Object.initFromTOC (org-info.js:82)
    at Object.init (org-info.js:49)
    at OrgHtmlManagerLoadCheck (org-info.js:289)
    at <anonymous>:1:1


texts: failed compile command runs on exit, prevents exit – how to track down?

texts:
I'm on a new system (Amazon Linux 2015.9), and my emacs config seems to not like the stock install (Emacs 24.3.1) or vice-versa.

When I do C-x C-c it runs save-buffers-kill-terminal.

But this fails, and writes Wrong type argument: listp, "make -k " to the minibuffer.

I have determined that whatever value I set for compile-command will appear in the message.  For example, I can make emacs fail to exit with the message Wrong type argument: listp, "foobar " or Wrong type argument: listp, "".

But I can't figure out what it causing a compile to run on exit or how to shut it off.

Is there a hook that lives somewhere?  Does anyone have any ideas for tracking this down?

At the moment I can only quit by backgrounding the process and doing kill %1.


texts:
The emacs initialization file states:

When Emacs is started, it normally tries to load a Lisp program from
an initialization file, or init file for short. This file, if it
exists, specifies how to initialize Emacs for you. Traditionally, file
~/.emacs is used as the init file, although Emacs also looks at
~/.emacs.el, ~/.emacs.d/init.el, ~/.config/emacs/init.el, or other
locations. See Find Init.
You may find it convenient to have all your Emacs configuration in one
directory, in which case you should use ~/.emacs.d/init.el or the
XDG-compatible ~/.config/emacs/init.el.

On my system I do not have any of ~/.emacs ~/.emacs.el ~/.emacs.d/init.el ~/.config/emacs/init.el.
I do have a ~/.emacs.d/init.el but that only has an auto-save-list directory in it.
Somehow when in emacs I can run M-x load-theme and can load manoj-dark successfully. Such a theme is in the themes directory /usr/local/share/emacs/27.2/etc
So what is the linkage between emacs and this directory? Is it hardcoded as I don't see any way the theme can be picked up.
Quote Reply


texts: Org mode italic does not work with some popular fonts in Linux

texts:
In org mode /word/ will display the word in italic. For me on Linux, that works for some fonts like Liberation or DejaVu but doesn't work for others, like Monaco, Noto, Inconsolata. I think fonts were installed correctly since I can use them in other applications.

When I use Monaco on an OS X in org-mode italic works just fine.

Any ideas what might be wrong? Is the problem likely to do with the fonts or some org mode configuration?


texts:
After googling and being recommended projectile as project navigation, I ended up trying that. I'm now frustrated by the lack of tutorials and/or explanations on how it works, so I was hoping somebody here knew how to handle it. Here is my current problem:

I can't understand how to use the .projectile file. Now, it works in my other project, but here is just completely fails to ignore files. I've tried C-c p i to clear countless times.

How does projectile work, and why doesn't the file actually ignore those files? And as a sidenote, could anyone recommend anything more reliable than projectile, if this is just how unreliable it is?


texts: "py-hungry-delete-backwards" instead " backward-kill-word" in python-mode.el

texts:
How can I replace py-hungry-delete-backwards for the traditional backward-kill-word in python-mode.el? I tried to define the C-DEL key in the python-mode hook but it just get ignored.

This is, I want to use the backward-kill-word command with C-DEL in a python environment.

Thanks!


texts:
I recently started using the fish shell. I tried using it in term-mode in Emacs. One characteristic of this shell is that it shortens the current working directory before printing it as the prompt. For example, if the current directory is /media, the prompt will contain /media but if the current working directory is /media/directory, the prompt will be /m/directory.

Because of this, Dirtrack mode in Emacs cannot keep track of the current directory, so default-directory is not updated. This affects some commands like C-c C-f which, as a prompt, suggests default-directory. Since this variable is not updated, the prompt will be the directory from where I started term-mode and not the current working directory in the shell.

I want default-directory to be updated when I change directory in the shell just like how it works with bash. How can I do this?

Caveats:

I like this shortening feature of fish-shell and I don't want to change the prompt style.
Since Emacs sends every key-stroke to the shell (with some exceptions), I thought to run a function every time <Ret> is pressed. But I couldn't find out how this can be done. Suggestions on this approach are welcome.


texts: Remote machine: Your terminal lacks the ability to clear the screen or position the cursor

texts:
Linux Mint 18.1 (64 bit) Xfce, Emacs 25.3

If I want to connect(via ssh) to remote Linux macnine I do next step:

Open terminal
ssh -oStrictHostKeyChecking=no mylogin@192.xxx.xxx.16

As result I success connect to remote machine.
In remote machine I start Midnight Commander by mc. And it's start success.
Nice.

So I want to do same steps by Emacs 25.3

My steps:

M-x shell
ssh -oStrictHostKeyChecking=no mylogin@192.xxx.xxx.16

As result I success connect to remote machine.
But when I try to start Midnight Commander by mc I get error:

Your terminal lacks the ability to clear the screen or position the cursor.


texts:
I'm trying go get the src block contents with (org-element-property :value (org-element-at-point)), but when I apply this on a block like:

#+BEGIN_SRC emacs-lisp
(print "foo")
#+END_SRC

the result is (print \"foo\"). How can I get the exact contents from the block as a string ?


texts: Spacemacs evil-window key bindings not working?

texts:
I have these keybindings in my dotspacemacs/user-config function:

;; Modify evil-mode keybindings from hjkl motion to jkl;
;; Motion mappings
(define-key evil-motion-state-map "H" 'evil-window-bottom)
(define-key evil-motion-state-map "L" 'evil-window-top)
;;
(define-key evil-motion-state-map "h" 'evil-repeat-find-char)
(define-key evil-motion-state-map "j" 'evil-backward-char)
(define-key evil-motion-state-map "k" 'evil-next-line)
(define-key evil-motion-state-map "l" 'evil-previous-line)
(define-key evil-motion-state-map ";" 'evil-forward-char)
;; Window mappings
(define-key evil-window-map "J" 'evil-window-move-far-left)
(define-key evil-window-map "K" 'evil-window-move-very-bottom)
(define-key evil-window-map "L" 'evil-window-move-very-top)
;;
(define-key evil-window-map "j" 'evil-window-left)
(define-key evil-window-map "k" 'evil-window-down)
(define-key evil-window-map "l" 'evil-window-up)
(define-key evil-window-map ";" 'evil-window-right)

However, when I do SPC w, the evil-window-* bindings aren't what I've defined them as here. They are still mapped to hjkl, instead of jkl; like I'd prefer. The motion mappings work just fine. I'm not really sure what to do here.


texts: How to enable treemacs visibility on by default?

texts: I have treemacs setup and currently using s-1 for toggle. But I would like to display the treemacs window always during startup. How to make it visible?


texts: Show siblings of visible headers after hide-other

texts:
I'm using Outline mode (usually the minor mode, but it shouldn't matter) or Org mode. I have a file that looks like this:

    -*-outline-*-
* Chapter 1
** Section 1.1
*** Subsection 1.1.1
foo
*** Subsection 1.1.2
bar
** Section 1.2
baz
* Chapter 2
** Section 2.1
qux
** Section 2.2
wib

I'm editing subsection 1.1.1 (“foo”). I want to focus on this section, so I run C-c C-o (hide-other). This is what I see:

    -*-outline-*-
* Chapter 1
** Section 1.1
*** Subsection 1.1.1
foo...
* Chapter 2...

In the old days of Emacs 19 (the behavior changed after 19.34 and before 20.7), I saw this:

    -*-outline-*-
* Chapter 1
** Section 1.1
*** Subsection 1.1.1
foo
*** Subsection 1.1.2...
** Section 1.2...
* Chapter 2...

The difference is that the headers for Section 1.2 and Subsection 1.1.2 are shown, because they're a sibling of Section 1.1 which contains Subsection 1.1.1 which I'm viewing. I like that. How can I get this behavior in a modern Emacs?

What I'm mainly looking for is a way to make hide-other (or a separate command) show all siblings of all visible headers (if I'm in Subsection 1.1.1, I want to see the headers for Section 1.2 and Subsection 1.1.2, and so on). More generally, I'd like a command outline-show-all-siblings-of-visible-headers. Is there such a thing?


texts:
I am trying to add an agenda custom command that shows me a sparse tree of items contain either NEXT or TODO using occur-tree.

When I run M-x org-occur RET NEXT\|TODO manually, it works fine.  However, when I try to add it as an agenda command as following

(setq org-agenda-custom-commands '(("n" occur-tree "NEXT\|TODO")))

it doesn't match anything. I tried several combinations such as "NEXT|TODO", "NEXT\\|TODO", "\(NEXT\|TODO\)" etc. and none of them worked.


texts: Emacs term in character mode still catching my keymap

texts:
I have the following code in my init.el

(defun my-foo (arg)
  (interactive "^p")
  (message "We got hit")
  )

(defvar my-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "C-r") 'my-foo) map))

(define-minor-mode my-mode :keymap my-mode-map ())
(defun turn-mode-on () (my-mode +1) )
(define-globalized-minor-mode my-global-mode my-mode turn-mode-on)
(my-global-mode t)

In it, I define a global mode with a keymap so that C-r displays the message "We got hit". If I open Emacs's term and hit C-r in character mode I get the message "We got hit"!

I was under the impression that in character mode Emacs just relays the keys that I press to the shell without interpreting them. Is this not the case? How can I fix this while still maintaining my global keymap?


texts: In js2-mode, is there a way to goto the other brace/bracket/paren in the pair?

texts:
eg. if I have

{ foo: "bar",
     fu: {"baz": bar}
}

And I have my cursor on the last brace, is there a command that will goto the first brace?
Also open to more general packages if there is one that does this better.


texts: Emacs: function to make a file with date/time as filename, and a shortcut for it

texts:
I need to generate text files with the following name format:
YYYYY-MM-DD--hh-mm-ss.org. How can I use the capture funtionality for this? That is, instead of making one entry per capture in a single file, the function should make one single file per capture, and hopefully with all the possibilities within the capture mechanism.


texts: How to write to LOGBOOK drawer in org-mode

texts:
I like to have the creation time of my tasks in org-mode.  To that end, I used this reference to setup a hook to add the create time to a new entry. It's working pretty well but I find I'd actually like to log this in the LOGBOOK drawer instead.

This answer (which was actually referenced by the first answer) shows how to insert the CREATED property into the PROPERTIES drawer but for the life of me I can't find how I would modify that to insert into the LOGBOOK drawer instead.

As a follow-up, if someone can tell me where I could have found this that would be awesome.  I looked all through the org-mode docs but couldn't really find a complete reference.  The worg site has a great reference for hooks and though it says it includes commands, I'm not sure it does (e.g., org-entry-put).


texts: transient-mark-mode highlighting doesn't work until buffer display is refreshed

texts:
I recently upgraded to Emacs 25.1.2, and transient-mark-mode no longer works properly - sometimes.

The behavior I see is that pressing C-spc and moving the cursor to select an area of text doesn't automatically highlight the area. If I move to another window and return, or switch to a different window and come back, I see the selection highlighted.

I also see the section highlighted if the cursor comes across a parenthesis. Since I have show-paren-mode turned on, the parens get highlighted, and the selection also gets highlighted.

It's suddenly working as expected as I type this, but it wasn't working for the past couple of days, in spite of restarts.

How do I debug what might be happening?


texts:
I have headers at the top of the file that look like:

 #+TITLE: A Good Explanation

That looks like all the examples I can find browsing various web pages.

When I go to export in either LaTeX or HTML I see an error about

Wrong type arguement: listp, #("A Good Explanation" 0 24 (:parent (#0))

Yet headers for LATEX_CLASS: work as expected.  In fact the headers that don't work are grey and the ones that do, like LATEX_CLASS are colored reddish.

How do I put in headers for Title, Author, Email etc?


texts:
In Mac OS X Lion and above, scroll bars can "float" on top of the content and only appear when scrolling. This provides insight on where you are in a document as well as the size of the document, without the scroll bar taking up room.

Emacs by default does not respect this system setting. For the Emacs GUI, is there any way to enable this?


texts: Delete duplicate lines, with partial match

texts:
Sample text:

This is first line.a
This is over_second line.
This is over_fourth line.
This is third line.
This is over_fourth delete it.
This is over_fourth and one more.
This is over_second with another text.

Need to delete lines where partial match occur, i.e if over_second occurs in another line, then whole line should get deleted. So output will be as follows;

This is first line.
This is over_second line.
This is third line.
This is over_fourth line.

I could only come up with: over_\w+ for selecting section of text. But don't know how to recognize duplicates, and delete whole line.


texts: Multiple cursors has undefined variables

texts:
I installed multiple cursors mode.  My init.el has the following at the bottom:

(require 'bytecomp)
(require 'multiple-cursors)
(multiple-cursors-mode 1)

(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)

However, every time I open emacs, I see the following:

Warning (bytecomp): reference to free variable ‘multiple-cursors-mode’
Warning (bytecomp): reference to free variable ‘mc--read-char’
Warning (bytecomp): assignment to free variable ‘mc--read-char’
Warning (bytecomp): reference to free variable ‘multiple-cursors-mode’
Warning (bytecomp): reference to free variable ‘mc--read-quoted-char’
Warning (bytecomp): assignment to free variable ‘mc--read-quoted-char’
Warning (bytecomp): reference to free variable ‘rectangular-region-mode’

What did I forget to add?


texts: How to open a message/mime digest (within Gnus?), like ~/mail/Incoming

texts:
Recently I did some shit within Gnus: I deleted a lot (thousands) of mails, trying to respool them in another group and rename it to the first group after having deleted it (i.e. to prepend an old mailing-list group to the new one that changed name)… but well I got a backup but quite old… and since it’s mailing-lists I hope to get back some mails asking to other people subscribed to send them to me…

Waiting for that, what interest me now are recent mails: and I just noticed that I still have a lot of Incoming<code> within my ~/mail, and I think that could make a backup: do someone know how to “re-receive them”? aka exctract from these digests the mails of theses groups and respool them into them? I tried to open groups like nnmbox:Incoming<code> but it doesn’t work (“No such group”).

So how to open/respool that? It should be easy it’s just a digest of a lot of MIME messages…

PS: I also tried to see what does functions like nnmail-split-incoming but couldn’t figure out how to use it.


texts: Stop reftex-toc from opening a new window if only one window is currently open

texts:
Currently when I choose an entry from RefTex's table of contents (opened using the C-c = keybinding), if I only have a single window open, the chosen file is opened in a new window to the right of the current document.
I read the documentation for reftex-toc but couldn't find a way how to replace the file of the current window when pressing the ret key instead of opening a new window.
Is this possible? If yes, can anyone be so kind to share the code how to do it?
Edit: The document I am using is a multi-file. The new section I choose is in another file than the one I am currently in. For example, if I am in main.tex and I choose the Introduction section, the file Sections/introduction.tex is opened in a new window.
The below is the settings I have in my init.el in relation to LaTeX
(use-package auctex
  :defer t
  :ensure t
  :config
  (setq TeX-auto-save t)
  (setq TeX-parse-self t)
  (setq-default TeX-master nil)
  (setq reftex-plug-into-AUCTeX t)
  ;; Set default reference format to \ref
  (setq reftex-refstyle "\\ref")) ; Set default reference format to \ref

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)


texts:
I am totally new to Emacs (I just began some days ago) and my purpose is to use it for Latex. I tried to install package auto-complete-auctex doing this :

1) I copy file auto-complete-auctex.el to my /.emacs.d folder ;

2) In Emacs shell I did M-x load-file and then put the path to the auto-complete-auctex.el file.

3) Then I get the message

Cannot open load file: aucun fichier ou dossier de ce type, tex

It seems that the way to install package is not direct one for me, as I am so new to Emacs...


texts: How can I display a list of all buffers when clicking on the buffer name?

texts: Is there a way to do this? Currently, the click events are bound to previous/next buffer, but I would rather like to see a list of all buffers when I click the buffer name. Perhaps, it could make use of a simple OS native context menu similar to the major and minor mode buttons:


texts: How can I force "list-buffers" to use the other window

texts:
When I type C-x C-b (i.e. the command list-buffers), how can I force it to list buffers in the other window? i.e. I typically have my screen split into 2 buffers. I am editing one buffer. I want a command which always lists buffers in the other window.

p.s. list-buffers used to always do this. But somewhere between emacs 24.3 and 24.5 it changed, so now it sometimes puts the buffer list in the current window.


texts: How to choose between nil and 0, or t and 1 when setting variables or enabling modes

texts:
I understand that nil, 0 and/or -1 are used for disabling some features and t, 1 and/or +1 are used for enabling some features.  When assigning variables or enabling/disabling minor modes, which should I choose?

I have seen all of these variations used at one point or another. It leads me to wonder if there's actually a difference between them. I have seen that sometimes using 0 doesn't work for me, while nil does. Are there differences of where they are used?


texts: Put placeholder and default value in yassnippet

texts:
I would like to create a yassnippet with a placeholder, so something like

value = $1(insert_value)

with the meaning that I would like to see the text "insert value" but when I press TAB and then type something, the text is replaced.

I would also like that the placeholder actually becomes a real text if I do not press TAB or I press TAB twice.

How these things can me done?
Thank you


texts: How to suppress `When done with a buffer, type C-x #` warning message?

texts:
When I open a buffer I keep seeing following message: When done with a buffer, type C-x # in the minibuffer.
=> Is it possible completely to suppress this message?

I am using emacsclient -t -q to open GNU Emacs 26.3.
Following lines are in the .zshrc file.
export ALTERNATE_EDITOR=""
export EDITOR="emacsclient -t"


texts: In Gnus, for a specific group, can I have all incoming messages automatically marked as read?

texts:
My specific use case concerns the "All Mail" folder exposed by Gmail over IMAP.  I keep the folder permanently visible so I can search it when I need to, but I'm tired of pressing c (gnus-group-catchup-current) every time it gets new mail.

I looked for a relevant group parameter in the manual, but couldn't find it.

I can write an appropriate function and either add it to gnus-group-update-group-hook or set the gnus-group-update-group-function, but first I thought I'd ask.

Is there a more idiomatic way?


texts:
I've never tried IPython Notebook so I thought I would try EIN.

I installed ipython via dnf on Fedora 23 with all of the dependencies.

Then I installed ein via M-x list-packages through elpa.

But when I added (require 'ein) to my init.el I am getting the following error running emacs with --debug-init.

Debugger entered--Lisp error: (file-error "Cannot $
  require(ein)
  eval-buffer(#<buffer  *load*> nil "/home/myusername$
  load-with-code-conversion("/home/myusername/.ema$
  load("/home/myusername/.emacs.d/init" t t)
  #[0 "^H\205\262^@     \306=\203^Q^@\307^H\310Q\2$
  command-line()
  normal-top-level()

I'm not sure what to look into to help me debug this. I saw a few compilation errors during installation of ein with elpa but when I relaunched and looked at M-x list-packages then it says it is installed. Is that somtehing I should be worried about?


texts:
I've tried whitespace-mode, but I can't configure it the way I want. There are others, but some of them are obsolete and I don't want to try them all.

I always indent via tabs and can't stand trailing whitespace. I never combine tabs and spaces (which means that with tabwidth=4 I can indent only multiples of 4, that's fine). I don't want non-indenting spaces to be highlighted as it's highly disturbing. I don't want any non-indenting tabs as there are always an error.

The following pattern express it maybe more clearly

^\t* + - indenting space
[ \t]+$ - trailing space or tab
[^\t\n]+\t - non-indenting tab

It should work for all buffers and ideally use some nasty color.

I'm looking for either a package allowing exactly this or a hint what could I modify to get it in the easiest way. I used to hack emacs a lot some 15 years ago, but that's too long ago.


texts: If I insert text before playing a sound, why do I not see the text inserted until the sound finishes?

texts:
I'm trying to, in a buffer, insert some text, then play a sound. Sample code is as follows:

(progn (insert "this won't be inserted until after the sound")
       (play-sound '(sound :file "/home/zck/Documents/countdown.el/Ovation-Mike_Koenig-1061486511.wav")))

Put the path to a wav file in the argument to play-sound. I've tried multiple files, but this is the one I'm using.

The result is that I hear the sound, then the text is inserted. How can I invert that?


texts:
Looking for a tool to programmatically generate SVG images, I found that
Emacs 26 can do it out of the box!

Example adapted from the Elisp reference manual:

(require 'svg)
(let ((svg (svg-create 400 400 :stroke-width 10)))
  (svg-gradient svg "gradient1" 'linear '((0 . "red") (100 . "blue")))
  (svg-circle svg 200 200 100 :gradient "gradient1" :stroke-color "green")
  svg)

Now how do I save that to an SVG file?

I’m using Emacs 26.1 in the Termux terminal emulator on my phone,
so no graphics.


texts: Setting hl-line-mode for programming modes

texts:
In my init file I have this:

(add-hook 'prog-mode-hook (lambda () (linum-mode 1)))

So it shows line numbers only for programming modes. I tried to do the same with hl-line-mode, but it does not work:

(add-hook 'prog-mode-hook (lambda () (hl-line-mode 1)))

Why is that? Both are buffer-local minor modes, according to the documentation.

Thank you.


texts: How can I get a prompt for deleting index.lock file in magit?

texts: This is a long standing issue https://github.com/magit/magit/issues/2708 . I feel that a prompt for deleting the transient file would compensate in most cases. Is there a reliable way to achieve this? Thanks!


texts: Why does magit-git-lines differ from git output in this case?

texts:
~/github/hub $ git rev-parse HEAD
4777bd363058213605ebb292b35ef1a6edb3663c

~/github/hub $ git --no-pager log \
                --grep='\[ci skip\]' --invert-grep \
                --format=oneline --max-count=1
cbf7ab1ba3fa91287085ce0cbebdc11c84388888 Improve `hub merge` to not generate leftover remote refs

~/github/hub $ (magit-git-lines "log"
                "--grep='\\[ci skip\\]'" "--invert-grep"
                "--format=oneline" "--max-count=1")
("4777bd363058213605ebb292b35ef1a6edb3663c Update `merge` documentation")

The repository I'm working with is github/hub.  I can only assume I'm misapplying the arguments, but I can't see my error.


texts: Python mode - custom syntax highlighting

texts:
I am an Emacs newbie and trying to work out how to implement custom colors.

Currently  I have a conditional statement and a while statement which both use the same face (font-lock-keyword-face).  Is it possible to create my own face for the while statement which uses custom colors?


texts: Org Beamer Presentation: blocks do not work?

texts:
I'm using Emacs 25.1 and the most recent orgmode. My problem is that I tried compiling one of the examples on Worg, but the content that's supposed to be displayed in a block is displayed on its own slide:

#+STARTUP: beamer
#+TITLE:     Writing Beamer presentations in org-mode
#+AUTHOR:    Eric S Fraga
#+EMAIL:     e.fraga@ucl.ac.uk
#+DATE:      2010-03-30 Tue
#+DESCRIPTION:
#+KEYWORDS:
#+LANGUAGE:  en
#+OPTIONS:   H:3 num:t toc:t \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
#+OPTIONS:   TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:http://orgmode.org/org-info.js
#+COLUMNS: %40ITEM %10BEAMER_env(Env) %9BEAMER_envargs(Env Args) %4BEAMER_col(Col) %10BEAMER_extra(Extra)
#+BEAMER_FRAME_LEVEL: 2
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+LINK_UP:
#+LINK_HOME:

* A Presentation
** A more complex slide
This slide illustrates the use of Beamer blocks.  The following text,
with its own headline, is displayed in a block:
*** Org mode increases productivity               :B_theorem:
    :PROPERTIES:
    :BEAMER_env: theorem
    :END:
    - org mode means not having to remember LaTeX commands.
    - it is based on ascii text which is inherently portable.
    - Emacs!

    \hfill \(\qed\)

Did I miss something? Or is the example simply outdated, and I have to do something else?


texts:
I switched to Org Mode and Emacs few weeks ago. I find it incredibly better than my previous (simple but effective) setup based on markdown files and VS Code editor.

I'm learning new features everyday but there's one thing from VS Code that I really miss and I can't think how to reproduce it in Emacs:

I'd like to open a specific directory (like /OrgMode) like a "workspace" and then be able to launch a command to find a file in the directory itself. Really simple. In VS Code I used to launch CMD+P (macOS) or CTRL+P (Win) to open a Spotlight-like file search. It was incredibly quick, useful and powerful.

It placed most opened files at the top of the list, updating the order dynamically. But it's OK if I can't reproduce it exactly in Emacs right now. All I want is an effective way to find a file based on my (partial and not necessarily using the beginning part of the filename) keyboard input.

Can you help me?

** Clarifying Edit **
I want to open a directory as the active workspace. Then, I need a command that will ask for my input so that I can quickly open a file within the directory itself.

Example:

Directories on my disk:
/OrgMode/Projects.org
/OrgMode/Todo.org
/OrgMode/MonkeyIsland.org
Then: M-x command-im-looking-for
I type isl
A list containing MonkeyIsland.org appears
RET visits the file.


texts: Unable to use git in shell inside a buffer

texts:
I used 'M-x shell' to start a shell inside a buffer. Then I tried to run git diff

After I press the space bar a few time, the lines 29-69/69 line is printed a few and the shell has stopped responding.

Why it is the case? Is there anything to fix it?

EDIT

Did not see this error message when I used shell last time:

(I alias g to git)

Now I am not able to use git diff at all.


texts: How remove all rows contain specific text?

texts:
Windows 10, Emacs 25.1
Suppose I has the next text

111111111111111111

hello

22222222

aaaahello

3333333333333333333333333333333

aabbbbbbbbhellocccccdddddddd

aaaaaaaaaaaaaaa

cccccccccccccccc

dddddddd

rhellorraaaa111111111

I want to delete all rows that contain text hello.
How I can do this?
Thanks.


texts: emacs tramp/CyberArk detailed walkthrough

texts:
Edit: Solved...
I'm using emacs 26.2, tramp 2.5.0, on OSX High Sierra 10.13.6...
The server login requires:

A normal password
A passcode from a phone call
The user has to specify a reason for the login

A successful login on a normal terminal looks like this:
$ ssh username@target-username@hostname@psmpprod.corp.company-name.com
Enter your Windows domain password:
RADIUS challenge: authfactor.call.prompt Enter '0' to abort.
You are required to specify a reason for this operation:
bla bla bla bla bla

Connection string:
First, in formatting the ssh string for tramp, I found that I couldn't use the -l argument in the ssh call. Found that I would get:
$ ssh -l username@target-username -e none hostname@psmpprod.corp.company-name.com

Enter your Windows domain password:
RADIUS challenge: authfactor.call.prompt Enter '0' to abort.
Failed to obtain account. Error: [010E Retrieve target account [__ADBRIDGE_TARGET_USER_TOKEN__] with address [target-username] failed. Error: [076E Password object was not found (Diagnostic Info: 5). Please check that there is a password object that answers your query in the Vault and that both the PSM SSH Proxy and the Vault user have the appropriate permissions needed in order to use the password.]] (Diagnostic Info: 1)

But, when you format as one string as at the beginning of the post, it works. So the correct thing to do in init.el to define a method psmx which would work as /psmx:target-username@target-hostname was as follows:
(add-to-list 'tramp-methods
             '("psmx"
               (tramp-login-program "ssh")
               (tramp-login-args
                (("-p" "%p")
                 ("%c")
         ("-e" "none")
                 ("username@%u@%h@psmpprod.corp.company-name.com")))
               (tramp-async-args
                (("-q")))
               (tramp-remote-shell "/bin/sh")
               (tramp-remote-shell-login
                ("-l"))
               (tramp-remote-shell-args
                ("-c"))))

Multi-hop error
Then, in tramp debug log I observed an error related to multi-hops.
Host name ‘hostname’ does not match ‘\`\(127\.0\.0\.1\|::1\|[myhostname]\|localhost6?\)\'’

I crudely solved it by commenting out the following lines in tramp.el:
(unless
  (member
   '("%h") (tramp-get-method-parameter item 'tramp-login-args))
...
(tramp-user-error
  vec "Host name `%s' does not match `%s'" host previous-host))

Parsing strings
Then, so that tramp could read the authfactor prompt and reason for operation, I modified tramp-password-prompt-regexp to include authfactor.call.prompt and operation.
I found out that there were some weird characters in the prompt asking for reason for operation. Wouldn't work unless I put all these junk regex character sets in below:
(setq
 tramp-password-prompt-regexp
 (concat
  "^[[:space:][:ascii:][:nonascii:][:cntrl:]]*.*"
  (regexp-opt
   '("passphrase" "Passphrase"
     "password" "Password"
     "authfactor.call.prompt"
     "operation") t)
  ".*[[:space:][:ascii:][:nonascii:][:cntrl:]]*"))

This worked, I was prompted for the second authentication step, and the reason for operation, and everything worked out.


texts: How can I connect to a Jabber group chat through a bookmark with jabber.el?

texts:
How can I connect to a group chat using a bookmark with jabber.el? I figured out how to look at the bookmarks via M-x jabber-edit-bookmarks, but I can't find any commands to actually use them! (Actually editing bookmarks seems unsupported, at least in my version of jabber.el.)

I have a few bookmarks already set up with another service that do show up in the Jabber bookmarks buffer, but I have no idea of how to actually connect through them.


texts: How to load only a subset of installed packages

texts:
I ran into a bug that involved an interaction between several packages. In order to report the bug, I need to provide a reproducible recipe illustrating the problem. This requires loading the appropriate packages, but nothing else from my init, and no other packages. What is the best way to do this?

UPDATE

To clarify, I am familiar with the concept of sifting through my .emacs in a binary search to identify the code causing a problem. In this situation, I know exactly what packages are causing the problem already. What I don't know, is how to use the package- system to load just those few packages.

(package-initialize) will load the packages, but also everything else in my .emacs.d/elpa directory. package-load-list allows me to specify particular versions of packages to load, or particular packages to explicitly exclude. I need the reverse - how to supply Emacs with a list of packages to include, without loading any other packages in the elpa/package system.


texts: How do I add a keybinding to use during an interactive isearch, `C-s ...`

texts:
Can I assign a key binding starting with C-s such as:

(global-set-key (kbd "C-s C-w") 'isearch-forward-symbol-at-point)

but I want to keep (kbd "C-s") for i-search.

I am having following error:

error: Key sequence C-s C-w starts with non-prefix key C-s

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.


texts: Loading ~/.emacs: cannot open load file, php-mode

texts:
GNU Emacs 24.5.1, installed MELPA, installed php-mode. The directory ~/.emacs.d/elpa/php-mode-20180105.541/ exists.

I added the following lines to .emacs:

(add-to-list 'load-path "~/.emacs.d/elpa")
(require 'php-mode)

I presume it's that last line that's triggering the error. I ran C-h v load-path and it includes ~/.emacs.d/elpa/php-mode-20180105.541/

emacs --debug-init didn't help me.

Any suggestions?


texts: How to allow tag inheritance only for headlines that have tags themselves?

texts:
Consider the following headline structure with tags:

* Recipes :recipe:

** Pizza :unhealthy:
*** Ingredients
*** How to

** Burrito :unhealthy:
*** Ingredients
*** How to

** Salad :healthy:
*** Ingredients
*** How to

Let's assume I want to get all my unhealthy recipes. So I filter my agenda for the tags :recipe:unhealthy:. The problem is, now I get Pizza and Burrito, but also their sub headlines Ingredients and How to, which I am not really interested  in at this moment. I just want to get my unhealthy recipes, right?

Result should be:

Pizza :recipe:unhealthy:
Burrito :recipe:unhealthy:

Is there a way, so that tags are only inherited on the headlines that themselves also have a tag? In this case, :recipe: will only be inherited to Pizza, Burrito and Salad, but not to Ingredients and How to. The tag :unhealthy: will also not be inherited to Ingredients and How to, as they do not have any tags.

I do not really want to use tag hierarchies, because not everything that will be tagged with :unhealthy: is a recipe.

I am also happy with other ways of solving this problem.


texts:
I've been an emacs user for about a year now and I use it for Haskell programming. I chose to go the vanilla emacs route and customized a plain init file as I went along.

Over time, however, I realise that emacs started getting quite sluggish on my computer. The computer is not the bottleneck: its a powerful machine with 32GB of RAM.

My suspicion is that I have too many modes enabled, and hence my question: how do I debug where the modes are being enabled from?

For example; the current list of emacs modes I have enabled in a Haskell buffer are:

Enabled minor modes: Async-Bytecomp-Package Auto-Composition
Auto-Compression Auto-Encryption Autopair Autopair-Global Blink-Cursor
Cl-Old-Struct-Compat Company Desktop-Save Diff-Auto-Refine Dimmer
Display-Line-Numbers Eldoc Erc-Button Erc-Fill Erc-Irccontrols
Erc-List Erc-Match Erc-Menu Erc-Move-To-Prompt Erc-Netsplit
Erc-Networks Erc-Noncommands Erc-Pcomplete Erc-Readonly Erc-Ring
Erc-Sound Erc-Stamp Erc-Track Evil Evil-Commentary Evil-Local
Evil-Surround Evil-Visual-Mark File-Name-Shadow Flx-Ido Flycheck
Font-Lock Frames-Only Global-Display-Line-Numbers Global-Eldoc
Global-Evil-Surround Global-Font-Lock Global-Git-Commit
Global-Magit-File Global-Undo-Tree Haskell-Indentation
Highlight-Indentation Hindent Ido-Everywhere Intero Intero-Global
Line-Number Magit-Auto-Revert Magit-File Mouse-Wheel Override-Global
Popwin Projectile Rainbow-Delimiters Recentf Shell-Dirtrack Subword
Tooltip Transient-Mark Undo-Tree Which-Key Winner Yas

I can spot multiple ERC related modes which seem to be enabled, and they make no sense since:

ERC is not running at this time
I'm in a Haskell buffer

Moreover, I'm not too keen on starting over with a vanilla emacs configuration for 2 reasons:

If this has happened now, it will likely happen again in future
I'd like to dig into what enables these ERC modes

My init file as a gist

Can anyone help?

EDIT 2:
I experienced a crash recently.
The stacktrace doesn't really say much.


texts: How to diff one file against another branch with Magit

texts:
I want to see the differences of a file in another branch. With git I can simply do: git diff otherbranch: path-to-file.

In magit this seems trickier as the file may not be dirty and not showing up in magit-status. I have been looking in the manual and I think I need to revert the buffer's minor mode but I have not found how to do this? As a bonus I would also like to ignore whitespaces in my diff.

PS I recently ran a melpa update on my magit package, version is listed below.

magit-annex        20190421.241  available  melpa      Control git-annex from Magit


texts: Emacs continuously asking for input and not sure what is the cause

texts:
I have this function implemented to basically compile and run the cpp file I am writing. Some files needs input (cin) so running this function will not stop and would continuously showing this message:

emacs Enter a positive, odd integer (-1 to exit program): Only digits are allowed!

Not sure what is wrong:

  (defun run-it ()
    "Run it on the current file."
    (interactive)
    (save-all-buffer)
    (let ((file-name (file-name-nondirectory buffer-file-name)))
    (shell-command
     (format
        (concat "g++ -std=c++11 " file-name " -o " file-name ".o; "
                 "./" file-name ".o;")))
         ))


texts: helm-grep-do-git-grep - search only in current dir

texts:
Windows 10, Emacs 25.1, Helm

If I run command M-x helm-grep-do-git-grep  it's search text in current folder and all subfolders. But I need to search text only in current folder.

How I can do this?


texts: Aliases on minibuffer for quick switching of directories

texts:
I would like to know if there is an easy way for me to jump to specific folders when specifying paths in the minibuffer.

For example, when I do find-file and my current directory is in ~ and I want to go to /mnt/c/development/downloads. Instead of typing the whole path, maybe I could just type downloads and it would automatically complete the whole path for me.

With this kind of system, I could just specify directories somewhere downloads="/mnt/c/development/downloads", dropbox="/mnt/c/Dropbox", etc, and I only need to type the specific alias to quickly jump to them.

I'm open to any suggestions. It does not have to be exactly how I describe, I'm pretty flexible as long as I can be able to jump quickly from one directory to another.


texts: Add a background image to pdf export of an org-beamer file

texts:
I'd like to add a background image to a single page in a pdf I am creating with M-x org-beamer-export-to-pdf using the Metropolis theme (no relation). The use of the theme doesn't appear to be the root of the issue, but I'm mentioning it for completeness.
I have tried
#+LATEX_HEADER:\mode<beamer>{\usetheme[numbering=none, progressbar=frametitle, titleformat=smallcaps]{metropolis}}
* Heading
** Page title
\usebackgroundtemplate{\includegraphics[width=\paperwidth]{nifty-image.jpg}}
  - First list item
  - Second list item

and variation on this approach, including placing \usebackgroudimage on the Heading or Page title lines, prepending it with #+LATEX_HEADERS: and wrapping it in curly braces. The best result I can get is having the image displayed on the page, but it either covers the text instead of showing up behind the text, or it appears above or below the text.
Is there a way to either add transparency to the image and simply do an \includegraphics or to  change how I use \usebackgroundtemplate to display the image, well, in the background?


texts: How convert milliseconds to human readable format in org mode table?


texts:
I've started to get the following errors when running package-list-packages. Searching online hasn't come up with anything. If anyone can suggest a cause and/or a solution I'd be very grateful.

Importing package-keyring.gpg...done

error in process sentinel: Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed "failed with code 113

" :host "elpa.gnu.org" :service 80)

error in process sentinel: Error retrieving: http://elpa.gnu.org/packages/archive-contents (error connection-failed "failed with code 113

" :host "elpa.gnu.org" :service 80)

Package refresh done


texts:
I've followed everything here in order to set up ipython in org mode. But I keep getting the error:

...executing Ipython code block...
apply: Searching for program: no such file or directory, ipython

when I try the sample code block

#+BEGIN_SRC ipython :session myip
  %matplotlib inline
  import matplotlib.pyplot as plt
  import numpy as np
#+END_SRC

Other samples don't work either. I've gotten ipython from Enthought, which should have all the necessities. Starting ipython from my (Ubuntu) terminal brings up:

Python 2.7.11 | 64-bit | (default, Jun 11 2016, 10:32:30)
Type "copyright", "credits" or "license" for more information.
IPython 4.1.2 -- An enhanced Interactive Python.
...

as it is on my path. I even installed exec-path-from-shell to make sure Emacs would see my path. Not sure how to proceed.


texts: Does Org-mode support display inline images for format like svg, gif?

texts:
How does Emacs display inline image for svg and gif formats in Org-mode? With imagemagick or something else? I know [C-c C-x C-v] toogle inline image display.

I found in Emacs 24.3 old version, I can inline view svg and gif images in Org-mode, but in Emacs 25.1, it can't, it will auto open svg and gif image link ([[file:/path/to/file.gif]]) with external program.
Does Emacs added some new options for this?

I just want Emacs can inline display support those image formats.

Found config in my init file which cause this problem:

(add-to-list 'openwith-associations '("\\.gif\\'" "gwenview" (file)))
(add-to-list 'openwith-associations '("\\.svg\\'" "feh --magick-timeout 5" (file)))


texts: Use structured template in numbered list

texts:
Is there any way to include a structured template (#+Begin/end_SRC) in the middle of a numbered list without ruining the numbering?

Here is a MWE:

1) First question

#+begin_quote
    Quote needed for first question
#+end_quote

1) Second question

When I try to export it or update the numbering, the second question is assigned number 1.


texts:
So, sometimes when I go into a buffer that has a [ as the first character (such as .ini files) emacs suddenly starts typing everything backwards. In other words, if I press the keys y e s I get out s e y.

After a little time investigating the behavior it seems that what is actually happening is that after typing any character the cursor immediately jumps to the beginning of the line. This means that if I press Ctrl+e after every character I can type forwards. This behavior persists across all buffers once it happens and the only way for me to type normally again is to completely exit out of emacs and restart it.

Does anyone out there have any idea why or how this is happening? For reference, here are my config files https://github.com/blarghmatey/dotfiles/tree/master/home/.emacs.d and the list of packages that are referenced are as follows:

ac-capf
ac-inf-ruby
ac-js2
ag
ahg
anaconda-mode
anaphora
ansible
assemblage-theme
async
auto-complete
auto-complete-exuberant-ctags
auto-complete-rst
bundler
chruby
coffee-mode
color-theme
color-theme-approximate
color-theme-monokai
color-theme-sanityinc-solarized
color-theme-solarized
color-theme-twilight
column-marker
command-t
company
company-anaconda
company-inf-python
company-inf-ruby
company-tern
company-ycm
concurrent
css-eldoc
csv-mode
ctable
ctags
ctags-update
cython-mode
dakrone-theme
dark-souls
dart-mode
dash
dash-at-point
dash-functional
deferred
direx
discover
discover-js2-refactor
discover-my-major
distinguished-theme
docean
dpaste
ein
elpy
elscreen
epc
epl
eproject
ess
evil
evil-leader
evil-surround
f
fill-column-indicator
find-file-in-project
findr
flx
flx-isearch
flycheck
flycheck-color-mode-line
fold-this
fringe-helper
fuzzy
gerrit-download
gh
git-commit-mode
git-gutter+
git-gutter-fringe+
git-rebase-mode
goto-chg
haml-mode
helm
helm-ag
helm-aws
helm-cmd-t
helm-company
helm-dash
helm-flycheck
helm-git
helm-proc
helm-projectile
helm-pydoc
helm-spotify
heroku
highlight-indentation
history
idomenu
iedit
inf-ruby
inflections
jedi
jedi-direx
jinja2-mode
js2-mode
js2-refactor
js3-mode
json-mode
json-reformat
json-rpc
json-snatcher
jsx-mode
jump
kivy-mode
late-night-theme
lentic
let-alist
lice
logito
logstash-conf
lush-theme
m-buffer
magit
magit-filenotify
magit-gerrit
magit-gh-pulls
makey
markdown-mode
mkdown
mmm-mode
multi
multi-term
multi-web-mode
multiple-cursors
neotree
nginx-mode
nodejs-repl
nose
org
org-jira
paradox
pcache
pep8
php-mode
pip-requirements
pkg-info
polymode
popup
popwin
powerline
projectile
projectile-rails
puppet-mode
puppetfile-mode
py-autopep8
py-import-check
py-isort
pymacs
python-django
python-environment
pyvenv
rainbow-delimiters
rainbow-mode
rake
request
rinari
ruby-compilation
rvm
s
sass-mode
scss-mode
simple-httpd
skewer-mode
smartparens
smeargle
smex
soothe-theme
sphinx-doc
sr-speedbar
stekene-theme
sx
tern
tern-auto-complete
tree-mode
undo-tree
vagrant
virtualenvwrapper
wakatime-mode
web-mode
websocket
wgrep
wgrep-ag
windata
workgroups2
xlicense
yaml-mode
yasnippet
ycm
zeal-at-point


texts: Ubuntu Emacs Meta Key problem related to keys

texts:
I'm using emacs 24.5.1 on ubuntu 16.04 on a Vaio x64 pc. earlier I ran the emacs tutorial and got through it completely no problem. Then I started playing with the "replace-string" command and now my Meta key no longer works so SOME but not all key commands. M-f, M-b, M-a and M-e work fine and so does M-x

But when I do M-> or M-< I get the following messages (see below). No amount of C-g'ing or hitting the ESC seems to help. What happened? How do I get out of it? How do I avoid getting back into this?
Thanks!

user-error: No M-x tags-search or M-x tags-query-replace in progress [3 times]
Quit [3 times]
completing-read-default: Command attempted to use minibuffer while in minibuffer [2 times]
Quit
completing-read-default: Command attempted to use minibuffer while in minibuffer [2 times]
user-error: There is no default tag


texts:
I'm seeing rather bizarre behavior. I have the following code:

(defun set-mode-line-face ()
  (let ((color
          (pcase (random 6)
            (`1  '("#586e75" . "#eee8d5"))
            (`2   '("#859900" . "#eee8d5"))
            (`3  '("#93a1a1" . "#073642"))
            (`4  '("#268bd2" . "#eee8d5"))
            (`5 '("#dc322f" . "#eee8d5"))
            (other    '("grey70" . "black")))))

    (set-face-attribute 'mode-line nil
      :background (car color)
      :foreground (cdr color))

    (set-face-foreground 'mode-line-buffer-id (cdr color))))

;; Change modeline color by Evil state
(add-hook 'post-command-hook #'set-mode-line-face)

Strangely enough, this causes emacs to become nearly unusable (~0.2s delays abound). Is the overhead of setting a face really that high? Is there any way I can fix it?

This is Emacs 24.5 on a graphical Linux frame.


texts: How to have fill-paragraph/fill-region break the line after a period?

texts:
I'm having trouble getting Emacs to properly fill a section of text when the last word of a suitable line ends with a period. Emacs seems to think that words separated by a period (and space) are joined.

For example, if I set the fill-column to 10 and enable auto-fill-mode, and I enter this text:

Look up. See the sky?

I'd expect that emacs would break the line and it would end up...

Look up.
See the sky?

Instead, Emacs always breaks the line before the word that ends with a period.

Look
up. See
the sky?

Any ideas how to fix this? I appreciate the help!


texts: Why does `M-x shell-mode` now always/usually open in a different window?

texts:
Since a relatively recent laptop re-install, whenever I M-x shell-mode (usually with the default shell buffer already running somewhere), the shell doesn't appear in the currently active window, instead it opens in a different one. Almost entirely always the one I don't want it to open in.

This seems to be new behaviour - my iMac that shares the same .emacs.d doesn't do this.

I can't find any obvious config variable to change this behaviour.

Help :)


texts: Browse and search text snippets in emacs and insert them as LaTeX input

texts:
Suppose I have a lot of small text snippets (including some LaTeX-code).

Now I want to create a LaTeX document with emacs which includes some of the text snippets. I know yasnippet which can expand keywords to the snipped but that's not what I want. Instead I am looking for something like this:

Invoke an emacs command insert-snippet
Then I can browse, search filter and select one (or at best also multiple snippets)
The snippets should not be copied to the file but included via an LaTeX input statement say \input{snippet1} (or if multiples are selected: \input{snippet1} \input{snippet5}.

If I edit the main file and point is on say \input{snippet3} there should be a command to view the content of this snippet (any maybe replace it by another one).

The approach described above seems to require that each snippet is saved in a separate file - otherwise the \input statement wouldn't work. However this seems to make it harder to edit the snippets. Maybe one option would be to edit them using the multifiles package (then you can edit them just as they where one file) or just grep them with helm-do-grep and browse it with executing helm-persistent-action...

Another idea would be to use another command instead of \input like \ExecuteMetaData[inputfile]{mytag1} from the catchfilebetweentags package. Then you could store them in one file.

Another option would be to store the snippets in one file like

\newcommand{\mysnippet1}{
Snippet Text
}

Some text or comments.

\newcommand{\mysnippet2}{
Snippet Text
}

And then input \mysnippet2 instead of \input{mysnippet2}.

If no library exists which does what I want, what would you suggest where to start to realize this by myself?


texts: Switch README from Markdown to Org, having problem with image rendering

texts:
I have a repository on Gitlab, I'm trying to change my README from  Markdown to Org,  I'm fully able to make the changes, but for reasons the the images are  having some sizing issues, they expand outside of the document itself.  I'm trying to figure out how to fix this?
Here is a screenshot to help  explain the situation better,

As you can see the image is exceeding the width of document, and page is scroll-able horizontally.
This screenshot is from a private test repository, I was testing how Org renders before I update my original repository.
Here is the code where I add this image,
#+CAPTION: Screenshot of SampleHive
#+ATTR_HTML: :alt logo-hive :title SampleHive Logo :align left :width 500
[[file:assets/screenshots/screenshot-hive.png]]


texts:
Is there a function to ensure (or at least try) that a given window has a height of N lines, by shrinking it (or enlarging it) as needed?

If N is too much (or not enough) for a given scenario, then a reaching best-effort value of M lines is ok.
It's safe to assume that there are multiple, stacked windows (one is above the other, instead of side to side)


texts:
I'm following an entry-level tutorial on rspec here, and I've created a very simple test at spec\lib\zombie_spec.rb:

require "spec_helper"
describe "A Zombie" do
  #Your 'examples' (tests) go here.
  it "is named Ash"
end

If I run this test from the gnome-terminal, everything works as expected:

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) A Zombie is named Ash
     # Not yet implemented
     # ./spec/lib/zombie_spec.rb:4

Finished in 0.00049 seconds (files took 0.09118 seconds to load)
1 example, 0 failures, 1 pending

However, if I try to run the same code from emacs' shell or ansi-term, I get this:

The program 'rspec' is currently not installed. You can install it by typing:
sudo apt install ruby-rspec-core

After installing ruby-rspec-core and trying to run the test again, I get this:

/home/adc/odin-project/web-development-101/20-code-school-rspec/zombie/spec/spec_helper.rb:48:in `block in <top (required)>': undefined method `shared_context_metadata_behavior=' for #<RSpec::Core::Configuration:0x00000000eed1d0> (NoMethodError)
    from /usr/lib/ruby/vendor_ruby/rspec/core.rb:97:in `configure'
    from /home/adc/odin-project/web-development-101/20-code-school-rspec/zombie/spec/spec_helper.rb:19:in `<top (required)>'
    from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:1295:in `block in requires='
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:1295:in `each'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration.rb:1295:in `requires='
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration_options.rb:109:in `block in process_options_into'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration_options.rb:108:in `each'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration_options.rb:108:in `process_options_into'
    from /usr/lib/ruby/vendor_ruby/rspec/core/configuration_options.rb:21:in `configure'
    from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:105:in `setup'
    from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:92:in `run'
    from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:78:in `run'
    from /usr/lib/ruby/vendor_ruby/rspec/core/runner.rb:45:in `invoke'
    from /usr/bin/rspec:4:in `<main>'

How can I fix this so that rspec runs successfully from within the emacs shell?