texts: Using R double colon operator messes up the indentation in emacs

texts:
Using R double colon operator messes up the indentation in ess/emacs. For example,

df <- map(
    xyz,
    something
)

vs.

df <- purrr::map(
                 xyz,
                 something)

where the first style is what I want. My settings are as follows:

'(ess-indent-from-lhs t t)
'(ess-offset-arguments (quote (prev-line 2)) t)
'(ess-offset-arguments-newline (quote (prev-line 2)) t)
'(ess-set-style (quote RStudio-))

How can I get ESS to treat package::function() the same as function()?


texts: Eshell-print only works when called from eshell

texts:
The function eshell-print has some weird behavior, as it only seems to work when called as a part of an eshell process. All other times it throws the error

  wrong type arguments: arrayp, nil

Try to execute this function inside the scratch buffer:

(defun test ()
  (eshell)
  (eshell-print "Hello world"))

(test)

This doesn't run, even without an init file. If you try this, however, it works:

(progn
   (eshell)
   (eshell-return-to-prompt)
   (insert "test")
   (eshell-send-input))

Does anyone know why it exhibits this behavior?


texts: Bind a key to the search of a specific word in Emacs

texts:
I would like to bind Ctrl + F aka C-f to find the first occurrence of the word "fun". Basically, I was this key to do the same thing as pressing C-s and typing "fun"<Enter>. Here's what I tried:

(global-set-key (kbd "C-f") (lambda () (interactive) (isearch-forward "fun")))

But this simply runs the isearch-forward command without the "fun" argument.


texts: How to make org-mode understand alternate day/month abbreviations?

texts:
Q: How can I make org-mode understand alternate day/month abbreviations?

org-mode uses the function org-read-date when entering timestamps, scheduling dates, and creating deadlines.  One may enter three-letter day or month abbreviations (e.g., "sun" for Sunday, "oct" for October), and org-read-date recognizes them.

But: a few common abbreviations are longer than three letters -- e.g., I almost always write "tues" (rather than "tue") for Tuesday, "thurs" (rather than "thu") for Thursday, "sept" (rather than "sep") for September, and so on.  The problem is that, the instant one gets past the third letter, org-read-date no longer recognizes the abbreviation.

So the question is: how can I tell org-read-date to accept these longer abbreviations in addition to the three-letter versions?

NB: I realize, of course, that I could just stop typing at the third letter, but the muscle memory is strongly-ingrained and I often don't realize I've used the longer abbreviation until much later when the item does not show up on the correct date in the agenda.


texts: unwrapping org links to leave just the link text

texts:
Is there quick and dirty way to convert:

[[http://foo.com][everything you need to know about foo]]

to simply:

everything you need to know about foo


texts: detect if inside a LaTeX ``quote'' and return its bounds?

texts:
Q: how can I test if point is inside LaTeX ``quotes,'' and how can I get the bounds of that quote?

LaTeX quotation marks are kooky, typesetting ``text inside a double-quote'' and `text inside a single-quote' for the standard "text inside a double-quote" and 'text inside a single-quote'.

I'd like to detect if point is inside such a quote (either single or double) and, ideally, return the bounds of the quoted passage.   However, syntax-ppss does not appear to recognize such passages as strings (re: elements 3 and 8 in the returned list; see parse-partial-sexp for details).

Is there a predicate function baked-in to AUCTeX to do so?  Many of their functions also have   curious naming conventions, so I may have missed it.  If no such function already exists, what alternatives would work?


texts:
everyone. I am new to debugging with dap-mode and i can't figure out
how to pass arguments.

I tried by creating a template

(dap-register-debug-template
  "GDB::Mine"
  (list :type "gdb"
        :request "launch"
        :args "/home/george/Documents/Repos/pop/encoder/OBJs/Buddha.obj"
        :name "GDB::Mine"
        :target nil
        :program "/home/george/Documents/Repos/pop/encoder/build/addon"
        :cwd "/home/george/Documents/Repos/pop/encoder/"))

but it doesn't work. It gives me

No source file named /home/george/Documents/Repos/olive/app/main.cpp.
Program exited with code 0377
undefinedPlease give path to .obj file.

I actually don't know why it tells that there isn't an olive/app/main.cpp file since that's not the project i'm trying to debug.

What am i supposed to do?


texts: Handle notes and documentation in long source blocks (split variable definition in org-babel)

texts:
I discovered the feature of literate config files with org-babel.
Some variable definitions can get pretty long, for example org-agenda-custom-commands if there are many custom agendas.
At the moment I am learning and discovering emacs functionality and I would like to make notes on how specific configuration lines work, where I got them from and maybe a link to the help files.
I noticed that its not possible to store a link to a specific line in the source code, only to the heading containing the block.
So my general question is how to deal with the need to (sometimes wordly) describe lines in the code in the most accessible/clean way in an .org-file?
Is it possible to split a variable definition up into multiple org-babel source blocks (without breaking the code)?


texts:
How do I add fontification of additional keywords ?
This does not work:
(add-hook 'c++-mode-hook
  (lambda ()
  (font-lock-add-keywords
   nil
   '(("^\\(trn\\|def\\|mem\\)\\>" . 'font-lock-keyword-face)))))

I am using a variant of the C++ language, where trn def and mem are also kewywords and should be fontified as such (purple). The above code seems not to have any effect. They are instead fontified as types (green).
Using Emacs 26.1


texts: Launch Emacsclient in ansi-terminal mode?

texts:
I connect to an emacs server via emacsclient. Frequently the first thing I want open is a new buffer with an ansi-terminal in it.

Is there a way to launch emacsclient and to send the command "open a new buffer with an ansi-terminal"?

EDIT: Or better yet, is there a way to launch emacsclient with the command "if a buffer is already open with ansi-terminal, then go to that buffer; otherwise, launch ansi-terminal in a new window"?


texts: Adding custom text above and below a buffer

texts:
Is there an easy way to wrap a buffer in emacs with text of my choice? For e.g if my selected buffer is like this,
This is the first line of a verse with ।
And here comes the second line ॥ 1.2 ॥

I want to add custom markers to the top and bottom of the verse like this:
\begin{myverse}
This is the first line of a verse with ।
And here comes the second line ॥ 1.2 ॥
\end{myverse}

I'm running evil mode in emacs 27.1 on OSX. Right now I copy each of the tags \begin{myverse} and \end{myverse} into named vim buffers, move the cursor to the right location and paste the desired text. I'm hoping there's a faster way of accomplishing this and am open to any solutions in emacs or vim.
EDIT 1: I believe there's an emacs way to move to the beginning of a buffer, add a newline insert some text, again move to the end of that buffer, add a newline and insert text.


texts:
I would like to create a yasnippet snippet as follow: pressing weather I would like that would be inserted the following text current weather = with the cursor after the = (this can be done with current weather = $1).
I would so like that a context menu with some suggestion will appear, like sunny, rainy, and so on.

How can I do this? Have I got to use in some ways autocomplete or company?
Thank you.


texts: How to properly specify defcustom default list of heterogeneous types?

texts:
How to properly write the default value for a non-trivial defcustom form for something like I have below: a list of 3-element lists, with choices of the types?

The defcustom form is:  defcustom option standard doc [keyword value]...

The following defcustom works fine as long as:

it's default is nil
it's a list of one or several elements of the first type

It fails with a "mismatch" warning in the customize buffer as soon as the default is a list of heterogeneous types (e.g. one element is from the  second or third choice).

#1: My defcustom form: (with a nil default, it works fine)

(defcustom pel-key-chords nil
"..."
:group 'pel-pkg-for-key-chord
  :type '(repeat
          (choice
           (list
            :tag "expansion-keys"
            (symbol       :tag "mode           " :value global)
            (string       :tag "the 2 keys     ")
            (repeat
             (key-sequence :tag "key")))
           (list
            :tag "command"
            (symbol       :tag "mode           " :value global)
            (string       :tag "the 2 keys     ")
            (function     :tag "command        "))
           (list
            :tag "lambda"
            (symbol       :tag "mode           " :value global)
            (string       :tag "the 2 keys     ")
            (function     :tag "elisp code     "
                          :value (lambda () (interactive) <YOUR CODE HERE>))))))

If, instead of nil as the default I write a list with several items of different types, the customization menu fails with a mismatch and does not to properly show the widgets to enter new entries. If the list contains elements  of the first type, it's fine.

#2: My defcustom form: (same code, but with an explicit default that works fine: a list of elements of the first choice:

(defcustom pel-key-chords
'((global   "<>"  ("<>\C-b"))
  (global   "[]"  ("[]\C-b"))
  (c++-mode "{}"  ("{\n\n}\C-p")))
"..."
...

#3: My defcustom form: (same code, but with an explicit default that fails with a mismatch: a list of 3 elements of the first choice, then 1 element of the second choice:

(defcustom pel-key-chords
'((global   "<>"  ("<>\C-b"))
  (global   "[]"  ("[]\C-b"))
  (c++-mode "{}"  ("{\n\n}\C-p"))
  (global   ".;"  pel-search-word-from-top))
"..."
...

Interesting note: Additions of second and/or third type elements via the customize buffer while the default has accepted data (as in #2 above), are accepted, saved to the custom-set-variables form properly and restored properly back in the customize buffer!

This is a copy/paste of the content of the relevant portion of my custom-set-variables form after manually adding the last list element (global   ".;"  pel-search-word-from-top) via the customize buffer and then saved it gives:

 '(pel-key-chords
   (quote
    ((global "<>"
             ("<>^B"))
     (global "[]"
             ("[]^B"))
     (c-mode "{}"
             ("{

}^P"))
     (c++-mode "{}"
               ("{

}^P"))
     (global ".;" pel-search-word-from-top))))

I can then read it back without any mismatch.  If I try to put this inside the default I get the mismatch warning...

I read Emacs Lisp Customization Settings section and some code like the dump-jump.el code that defines some complex data with initialization. I assume I must identify some keywords in my declaration of the default, but for some reason I can't find the proper syntax for initializing the data I defined above.

Note: this question evolved from my previous question How to properly specify defcustom default value for non-trivial data type?


texts:
In web-mode, indentation for markup gets set to 8 when I open a new buffer.

I have set web-mode-indent-markup-indent-offset via customize to 2. When I check it outside of a web-mode buffer, it is set to 2.

Lines concerning web-mode in my .emacs:

(mapcar (lambda (plugin-dir)
          (add-to-list 'load-path (concat "~/.emacs.d/plugins/" plugin-dir)))
        '( ;; ... some more plugins
          "web-mode"))

(add-hook 'web-mode-hook 'zencoding-mode)

(custom-set-variables
 ;; ...
 '(web-mode-markup-indent-offset 2)
 ;; ...
 )

(require 'web-mode)

(mapcar (lambda (file-ending)
          (add-to-list 'auto-mode-alist (cons file-ending 'web-mode)))
        '("\\.php\\'" "\\.ejb\\'" "\\.django\\'" "\\.tt\\'" "\\.html\\'"))

(define-key web-mode-map (kbd "C-c /") 'web-mode-element-close)

(defun expand-for-web-mode ()
  (when (equal mode-name "Web")
    (make-local-variable 'yas-extra-modes)
    (setq yas-extra-modes
          (let ((web-lang (web-mode-language-at-pos)))
            (cond
             ((equal web-lang "html")       '(html-mode))
             ((equal web-lang "css")        '(css-mode))
             ((equal web-lang "javascript") '(javascript-mode))
             )))))

(add-hook 'yas-before-expand-snippet-hook 'expand-for-web-mode)

Furthermore, I use expand-region. It sets a hook to web-mode, but the hook just adds web-mode-mark-and-expand to a local er/try-expand-list variable.

I have tried a "minimal" configuration, by starting Emacs via emacs -q and just loading and requiring web-mode and setting the variable to 2 - same result.

Every time I enter a web-mode buffer it gets set locally to 8.

I know I could use a hook like this:

(add-hook 'web-mode-hook
  (lambda () ""
    (setq web-mode-markup-indent-offset 2)))

To set it to 2, but that defeats the purpose of customize.


texts: How to change mu4e headers such that it only highlights the current line?

texts:
The mu4e *mu4e-headers* mode looks something like this by default,

Notice how the text in the current line is underlined while the entire length of the line is highlighted? It is also showing the cursor which is not very visible but you can move the cursor left and right as well.
I'd like to only highlight the current length of the line and not underline the text or show the cursor (since IDK if the being able to control the column position matters).
Something like this,

If you use Treemacs, the current line in its buffer is highlighted like I want the current line to be highlighted here. I am not very mu4e or emacs font face savy so I am not sure where to even start?


texts: How to handle & differentiate both click & drag mouse button events?

texts:
Is it possible to handle both click and drag for keymaps in emacs?

Click: Press and release with no motion.

Activates action A.
Drag: Press & move (beyond a threshold).

Activates another action B, which can be interactive, using the release event to finish.

Note that emacs built in drag events only activates on final release, which is different to the kind of drag I'm asking about.


texts: Elpy doesn't recognize I have virtualenv installed

texts:
I am trying to get started with elpy but any python file I open elpy will complain and say

  eldoc error: (error Elpy necessitates the ’virtualenv’ python package,
  please install it with ‘pip install virtualenv‘)

Even if I am editing files in a directory with a virtualenv and I have $WORKON_HOME set to that directory.


texts: does tramp actually copy file from remote to local?

texts:
when working in terminal with ssh I think what gets transferred is just the characters of the screen in view.

while in emacs tramp mode working with remote files, I'm not sure, does it copy files to cache in local ?

what are the background mechanisms ?

did the scp / ssh during open specify how it works ? or how do they different with each other ?


texts: GAP mode (interactive mode for working with GAP) swallows first lines of output

texts:
On Windows 10, I have emacs under cygwin which works well. In particular, I am running GAP in emacs using gap-mode and everything is OK.
Now to use some other apps, I was forced to install another emacs under mingw64, and want to switch to it. GAP works there too, except for one nuisance: the first line of the interactive output is not shown. For example, Print("x"); produces no output at all, while Print("\nx"); outputs x.
Can you advise how to debug this situation? How to find what is wrong and how to repair it?


texts:
I want to know what happens if I click on a button (a link) in an Emacs buffer, so I type C-h c (describe-key-briefly) and click the button, but all I'm told is:

<mouse-2> (translated from <down-mouse-2> <mouse-2>) at that spot runs the command push-button

C-h k (describe-key) shows me the documentation of push-button, which is not what I'm after.

To find out what actually happens when I click, I need to perform the same lookup that push-button does, and then look at its documentation rather than invoking the function. That is to say, look at the text's action (or mouse-action for a mouse click), and run describe-function on that.

Is there a convenient way to do that? Ideally, I'd like describe-key to show the description of the action in addition to (or even instead of) the description of push-button.


texts: How to replace the first element of the `kill-ring` by a modification of it?

texts:
I am trying to modify the string that is to yanked
My goal is to modify certains paths before yanking, in order to transform them in relative to path actual buffer file.
Following this post, I tried this simple script :
(setq tmp (car kill-ring-yank-pointer))
;;(message tmp)

(defun replace-in-string (what with in)
  (replace-regexp-in-string (regexp-quote what) with in nil 'literal))
(replace-in-string "C:\\Users\\Julien Fernandez\\Dropbox\\JULIEN" "../.." tmp)
(message tmp)

In my kill-ring, I have right now :
C:\Users\Julien Fernandez\Dropbox\JULIEN\Screenshots\Emacs\2021-02-03_16-48-43 - Code.png

I get as a result :

Where the file name has been modified, but obviously not as intended.
What should I do ?
PS : I discovered that I did not have to substitute every \ in `'/' in the path, something like :
../..\Path\to\file.txt

works fine ...


texts: How to view diff when emacs suggests to recover this file?

texts:
Sometimes it happens: emacs prompts you about recovering unsaved changes to a file, but you cannot remember if you want those changes or not.

Starting at the recover-this-file buffer, is there a way to view a diff or otherwise directly see the changes?

For example, something like what magit-mode gives when tabbing on a edited file in the status buffer.


texts: How can I turn a string into its literal representation?

texts:
(mystery-function "a neat\nstring\"")
=> "\"a neat \\nstring\\\""

This question was asked on freenode#emacs by user dropdrive.  How could I write (or use) a function that takes a string literal and returns the string literal that, when read, would return the original string?  That is,

(let ((s (any-string)))
  (should (equal s (read (mystery-function s)))))

Note that this let-form is a bit misleading – the session at the very top of this question should be used for testing. Sorry for any confusion!


texts: describe-bindings not working as expected

texts:
Spacemacs Help SPC h d b (describe-bindings) is not working as expected.
I type SPC h d b, and then enter the bindings:

SPC f e d   not listed in the minibuffer, but the binding works
SPC f e R   not listed in the minibuffer, but the binding works
SPC r e     not listed in the minibuffer, but the binding works
SPC r y     not listed in the minibuffer, but the binding works
SPC h d b   is listed in mini buffer, but I have to scroll down to see it.
SPC r m     when attempting this, minibuffer says, "SPC r m is undefined"
SPC r r     when attempting this, minibuffer says, "SPC r r is undefined"

The last two do not work, but the Spacemacs Registers bindings are listed in https://github.com/syl20bnr/spacemacs/blob/master/doc/DOCUMENTATION.org#registers

They all list several key bindings, but not the one I entered:

How to find keybindings in the Emacs help?

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


texts: Setting C-p as helm-projectile-find-file

texts:
I put this at the very end of my config file:

(global-set-key (kbd "C-p") 'helm-projectile-find-file)

On Emacs start I can see that it is getting assigned using C-h k C-p. Then when I actually load a project, it gets overwritten and becomes evil-paste-pop

How can I make this to stay set as helm-projectile-find-file?


texts: Curly braces inside a body of the org-mode inline source block

texts:
I would like to use curly braces inside a body of the org-mode inline source block. Since the body itself is delimited with curly braces it seems impossible.

The problem occurs when additional pairs of curly braces are used inside the body. For instance the following LaTeX code

src_latex[:results raw]{$x=\frac{1}{2}$}

when executed (with C-c C-c) gets broken into

src_latex[:results raw]{$x=\frac{1} $x=\frac{1{2}$}

Of course this can be easily overcome with the classic (multiline) form of the source block, but the inline counterpart would be more convenient for me.

Is there any other way to solve this problem?

I use Gnu Emacs 25.1.1 with Org-mode 8.3.4.

UPDATE:

It turns out (after short discussion on #org-mode IRC) that this issue does not apply to the Org Mode version 9.0.3 (at the time of writing this, 9.0.3 is the latest version available on Melpa). In fact, after upgrading my Org Mode the problem disappears!

Beware of this issue when updating to 9.X version!


texts:
I am looking to create some customized settings for a specific file. I think I want to add a hook for that file, or something that will create a few settings when that file loads.

For example, I have a file "really-long-lines.org", where every time I open it, I run M-x toggle-truncate-lines. By default, I have all files under org-mode open with (toggle-truncate-lines 0) set. But for this one file, I want it to be set to (toggle-truncate-lines 1). My first approach would be to create a mode for this one file, really-long-lines-mode, and run something like this:

(add-hook 'really-long-lines-mode
          (lambda()
            (toggle-truncate-lines 1)))

But is there a way to add a hook for a specific file? Or whatever solution works best.


texts: Use command other than \item to render lists in LaTeX export

texts: I am trying to come up with a template for moderncv package. I would like to be able to render org-mode lists using \cvitem for example.  Better yet, if I could choose the LaTeX command for rendering list items (there are several available in this package).  I know about :environment and :options but these don't really help.  I would really prefer to make this as much independent of the export back-end as possible, so that it would be less painful to export the same document as HTML if need be.


texts: Debugging a function called when hovering with the mouse over an org link

texts: I am trying to debug a function called when hovering with the mouse over an org link. For example, I instrumented bibtex-completion-apa-get-value with edebug-defun. However, when I hover over an org-ref's citation link, the help echo appears (showing the entry produced using bibtex-completion-apa-get-value) without going into an edebug session. So, how can I debug what's going on when I hover over an org link?


texts: Why does forward-word stop at this quotation mark?

texts:
Minimal example code, run it from emacs -Q.  Note the use of unicode RIGHT SINGLE QUOTATION MARK (’) not APOSTROPHE (').

(modify-syntax-entry ?’ "w p" text-mode-syntax-table) ; that's the same syntax as '
(progn
  (switch-to-buffer "test")
  (text-mode)
  (insert "this isn’t a word character?")
  (goto-char (point-min))
  (forward-word 2))

In my Emacs (version 24.5.1) this leaves point on the RIGHT SINGLE QUOTATION MARK in “isn’t”.  Why?  Shouldn't it move point between “isn’t” and “a” instead?


texts: Passwordless `smtpmail-send-it` and queue

texts:
my current mu4e setup uses MSMTP utility to send out emails. Unfortunately if I want to use queues I have to use smtpmail.el which requires me either to (1) save my password in cleartext in .authinfo, (2) enter my password every time, (3) enter my PGP passphrase when using .authinfo.gpg. None of these solutions is very convenient.

Is there a way to convince smtpmail.el to retrieve my password from an Emacs lisp function, possibly without storing it for too long? I have an Emacs lisp function that extract the password from the keychain, so that would be ideal.


texts: Org-mode agenda clocktable report properties columns broken?

texts:
I'm using a customized clockreport as shown below, it worked for over a year but now the selected properties column values are not shown in the agenda clockreport anymore. Do I need to change something? The properties columns are showing but not the values of them. Everything else in the table looks normal.

(setq org-agenda-clockreport-parameter-plist (quote
 (:lang "de" :maxlevel 6 :fileskip0 t
 :properties ("Auftragsnummer" "Leistungsart" "Abgemeldet")
 :indent t :narrow 80!)))

Org mode Example

** [[./2017/XXXXXXXXXXXX_123456789]] :SOMETAG:SOMETAG:SOMETAG:SOMETAG:
:PROPERTIES:
:Auftragsnummer: 123456789
:END:
*** Tätigkeiten
**** ERLEDIGT Done Something
:PROPERTIES:
:Abgemeldet: Ja
:Leistungsart: ABCDE01
:END:
CLOCK: [2017-05-20 Sa 10:00]--[2017-05-20 Sa 11:00] =>  1:00


texts: How to setup VS2015 developer shell for cygwin emacs?

texts:
I have cygwin emacs running on a machine with Microsoft Visual Studio 2015 installed. I would like (for a number of reasons) to set it up as a shell, so that i would be able to run its developer commands from inside emacs

As far as i know, in previous Visual Studio versions, there were a number of environment variables set up in a  scenario file, which could be replicated in emacs configuration. However, in Visual Studio 2015, shell is being launched just as executable with a certain flag passed (in my case, one for 64 bit).

So, how can i go about that?


texts: I was wondering if there is any way to write something like a quotation or a motto in org mode, in a way that is differentiated from the rest of the text. For instance, it could be indented with a specific number of spaces, and has some sort of "padding" from the rest of the text. Thank you.


texts: (org-do-promote) on keyboards without arrow keys

texts:
I'm using a keyboard without arrow keys because well... its Emacs!
However, I realized that (org-do-promote) is bound to M-left.
I find it hard to accept this 'tragic' situation ;D
Do I really have to custom global-set-key this?
Ideas on keybindings are also very welcome
Thanks in advance


texts: Searching in a subtree in orgmode without narrowing

texts: Is there a way to search in org mode in emacs in a certain subtree without narrowing or "narrowing" and "widening" the way to go?


texts:
How do I avoid byte-compiler warnings Unused lexical variable in functions defined using macros expanding to defun?

E.g., macro defun-rcirc-command in
rcirc.el
uses the target variable which is not used by several invocations.

In Common Lisp I can use the
ignorable
declaration: (declare (ignorable target)).

Bad solutions:

Add something like (setq target target) to all the users of
defun-rcirc-command which do not use target: that requires
modifying many macro invocations.
Prefixing the ignorable variable with an underscore - _target - does not help because _ means ignore, not ignorable, i.e., when it is used, I get variable '_target' not left unused.


texts: How to get emacs to keep cursor in the middle of buffer during search?

texts:
(I am using Aquamacs 3.5 which is based on GNU Emacs 25.3.50.1, in case this matters.)

While searching (isearch-forward) in a buffer it often happens that I need to see some lines before/after the matched string.  It happens regularly (as shown in the screenshot below) that the matched string appears at the bottom of the buffer.  In that case I was searching for [h!] and there is not even one line showing below the matched line.

I tried to customise the variable list-matching-lines-default-context-lines without success.  In the screenshot above list-matching-lines-default-context-lines was set to 5.
I suspect that isearch does not pay attention to that variable.

list-matching-lines-default-context-lines is a variable defined in ‘replace.el’.
Its value is 5
Original value was 0

Documentation:
Default number of context lines included around ‘list-matching-lines’ matches.
A negative number means to include that many lines before the match.
A positive number means to include that many lines both before and after.

Is there a variable I can set to get the desired behaviour?


texts: How to remove indent on left margin and vertical line from src block when exporting org-mode to ascii?

texts:
When I export an org file to an ascii file, using org-export-to-ascii, I get some annoying lines on the left margin and an indent
,----
|  .class{
|  background:red;
|  }

This is what I'm after:

.class{
background:red;
}

I'm using some code to remove headings before export (same issue with or without that code), and more code to export the ascii file with a .css extension rather than .txt.
The idea is to use org-mode rather than origami for folding css files, and it works beautifully...when I export without SRC blocks and prepend lines of text with // or enclose text with /* */
Of course, I'd prefer to export with SRC blocks so I can toggle src fontification.
Any quick and easy ideas?
Here is a sample org-file.org
#+OPTIONS: toc:nil H:0  num:nil todo:nil <:nil author:nil ^:{}
#+OPTIONS: \n:t LaTeX:nil stat:nil tasks:nil @:nil

* scss styling I'm exporting to a .scss

$font-family: Arial;

.sample-class{
background: $red;
}

This exports fine after setting these variables and executing following function:

(setq org-ascii-global-margin 0)
(setq org-ascii-inner-margin 0)
(setq org-ascii-text-width most-positive-fixnum)

(defun my-headline-removal (backend)
  "Remove all headlines in the current buffer.
BACKEND is the export back-end being used, as a symbol."
  (org-map-entries
   (lambda () (delete-region (point) (line-beginning-position 2)))))

It gives this:
$font-family: Arial;

.sample-class{
background: $red;
}

Which is exactly what I want in _org-file.scss (the file I'm exporting it to)
Now I would prefer to have an SRC block, to get sass fontification (or any fontication actually). So I export like this:

#+OPTIONS: toc:nil H:0  num:nil todo:nil <:nil author:nil ^:{}
#+OPTIONS: \n:t LaTeX:nil stat:nil tasks:nil @:nil

* scss styling I'm exporting to a .scss

#+BEGIN_SRC sass :tangle no

$font-family: Arial;

.sample-class{
background: $red;
}

#+END_SRC

This produces the following:
,----
|  $font-family: Arial;
|
|   .sample-class{
|  background:red;
|  }

Those lines don't allow the .scss file to process (also I have proper spaces between the class identifier and the bracket)


texts:
I have downloaded and put the dired+.el file into

/Users/ri/.emacs.d/elisp

and added the following code to the init file

(add-to-list 'load-path "/Users/ri/.emacs.d/elisp")
(require 'dired+)

When I start Emacs there are no errors, everything loads as it should. But whenever I try to run

M-x diredp-dired-for-files

it asks me for a buffer name and I type something like new and then it loads what it looks like regular Dired. When I C-g, the system prints in the minibuffer

Reading buffer: No such file or directory, /Users/ri/new

How can I run Dired+ properly?

EDIT (after reading the answers here and reading up on Dired and Dired+)

(the original question was "How to run Dired+?")

My original thinking was that Dired+ was another program, basically like PathFinder to MacOS built-in Finder. That's why I thought I needed to launch it, and the most "obvious" command seemed to be M-x diredp-dired-for-files
Now I see that this is an "extension" to Dired that enhances its features. So i guess the proper question that I wanted to ask is:

How to make sure I'm running Dired+?

Is there a command or a feature that tells me that I successfully loaded and using Dired+?

For example when I run Sunrise Commander, the interface is completely different so it visually tells me that the extension is running.


texts: Org agenda view: how to turn of visibility of category/filename?

texts: I am using Emacs with org mode. When asking for agenda view (C-c a), each todo line item is started with the name of the org file the item belongs to, or possibly, the category defined for the todo. This visibility consumes horisontal space, and I do not need this info. How can I turn that visiblity off?


texts: Is there a way to run a shell command on a previously compiled C org source block?

texts:
If i have the following block:

#+NAME: my-code
#+BEGIN_SRC C
#include <stdio.h>

int main ()
{
  printf("Hello, World!");
  return 0;
}
#+END_SRC

How can I use the compiled output in another source block?

#+BEGIN_SRC sh :noweb yes
file <<my-code()>>
#+END_SRC


texts: How to delete menu item defined in a parent major from within derived mode?

texts:
I'm creating custom major mode derived from js-mode which comes with it's own menu entry "Javascript" (top-level entry, between Tools & Help (sorry, not sure what the correct name for that UI element is)).

I would like to hide/remove that menu since I don't have need for it (deriving from js-mode mostly for indentation settings which I know is probably an overkill).

I found this piece of information here:

(define-key global-map [menu-bar words] nil)

so I have tried calling

(define-key global-map [menu-bar javascript] nil)

from inside define-derived-mode and my-mode-hook, but neither option worked (javascript menu bar name was guessed based on the UI label as I am not sure where can I check the actual name).

Any ideas on what I'm doing wrong with this approach? Or perhaps there is another way to hide/remove menu items?


texts:
My screen is a bit small and dividing it in two vertically to see a pdf while editing it  leaves a lot to be desired. However, if pdf-tools or pdf-view mode had the option to hide a % of the empty white margins for each page of the document it would fit just right. It is possible to do this?

PocketBook reader for android has this feature and you only see the parts of a pdf with actual characters on them.

bonus: It is possible to run pdf-view-fit-width-to-window automatically?


texts: Possible to view more options in helm-bibtex?

texts:
When I use helm-bibtex, I get a screen showing some of the properties of the articles in my .bib file. For example, I get some sort of table where the columns are

|author | title | year | articletype|

I was wondering if I could edit this so that I could remove the last column and replace it with some other property of my choosing, such as a tags property.


texts: How can I apply a frame register (saved via desktop.el) to the current frame instead of opening a new frame?

texts:
I am using desktop.el and I saved a few frame configurations in my registers. But when I jump to a saved register (C-x r j), Emacs opens a new frame instead of applying that setting to the current frame. If the register is saved in that session then it works as I expect, ie, the frame configuration is applied to the current frame. I want Emacs to always apply the frame register to the current frame. Is that possible?

The only variable I found that could be related is desktop-restore-reuses-frames but that is set to t (ie, reuse frame), and a search with customize-apropos for register and frames did not give me anything I thought could help.

This question and its answers could be a clue, but I couldn't figure out

This answer could also give a clue. The function jump-to-register has a prefix argument that deletes the other frames, but I couldn't figure out how to make this work (I tried C-u C-x r j R and C-u 0 C-x r j R and C-u 1 C-x r j R but neither worked). I am not even sure this is what I want anyway.

I also looked into the library frameset.el and checked the helm-apropos for frameset but couldn't figure out how to do what I want. Help greatly appreciated.


texts: Save and load different desktop files based on the mode

texts:
I would like to keep distinct desktop files in order to be able resume sessions based on the mode.

When I open Emacs it should load the desktop file for the mode it starts with and when I run, say, M-x latex-mode it should load (and later overwrite) another desktop file. In my noobness I had hoped a

(setq desktop-path '("~/.emacs.d/desktops/plain" ~/.emacs.d/desktops/latex-mode"))
(defun my-TeX-hook ()
  (desktop-change-dir "~/.emacs.d/desktops/latex-mode"))
(add-hook 'TeX-mode-hook 'my-TeX-hook)

in my .emacs would work, but it didn't.


texts: How can I configure hideshow to hide comments in longer programs only?

texts:
If I start Emacs 25 with an init file (.emacs) containing

(package-initialize)
(load-library "hideshow")
(add-hook 'python-mode-hook (lambda () (hs-minor-mode 1)) )
(setq hs-minor-mode-hook  'hs-hide-initial-comment-block)

then the initial comments in every Python program I load or view are hidden. I can easily unhide them with hs-toggle-hiding (C-c @ C-c). Yet hiding the comments do not help, but rather get in the way, when the file is brief enough to be displayed in its entirety.

How do I configure hideshow to hide the initial comment block only if the file loaded is longer than a specific number of lines?


texts:
I opened a serial-term to /dev/ttyUSB0. I can't quit it. C-x k results in the following message:

term-quit-subjob: Process /dev/ttyUSB0 is not a subprocess


texts: Use `git commit -p` or `git add -p` with magit

texts:
How do git commit -p in magit?

Not have this section in man page


texts: Directly transfer underlined phrases from pdf to org-mode?

texts:
I'm learning emacs (on spacemacs) and focusing on orgmode.
Is there a way to transfer what you underline in a pdf (like in skim) directly as text in orgmode. In other words, when you underline a phrase in your pdf it appears directly in your opened orgmode buffer.
I tried the following things:

org-mac-grab-link you can transfer the underlined pdf section to orgmode. Nevertheless, I would like to have something that does it directly while I'm reading and underlying my pdf.
I've heard about org-noter. However, from what I gather is more for summarizing a pdf, since you can export the skeleton/headings to your buffer.

Any advice would be useful!


texts: How do I suppress indentation after labels in Groovy?

texts:
I'm writing some Groovy code, and in my unit tests I have something like the following:

def testFoo(){
    given:
    //setup statement 1
    //setup statement 2
    //...

    when:
    //Execute code

    then:
    //check results
}

The problem is that emacs, by default, autoindents so that the code looks like the following:

def testFoo(){
    given:
        //setup statement 1
    //setup statement 2
    //...

    when:
        //Execute code
    //Execute code 2

    then:
        //check results
    //check results 2
}

That is to say, emacs is indenting the first statement underneath the label.

How do I prevent emacs from doing this? I've tried running M-x c-set-offset <RET> label and setting the indentation to both 0 and - to no avail. Which offset should I be customizing?

EDIT: More generally, how do I see which indent rule is in effect at the point?


texts: flycheck cannot use gfortran, executable not found

texts:
Previously I had been able to use flycheck for fortran files, but something seems to have broken perhaps during an update.
Mac OSX catalina (latest)
gfortran 9.3.0 from homebrew
emacs 26.3 from homebrew

When I call flycheck-select-checker and then select fortran-gfortran I get the following error buffer:
Syntax checker in buffer test.f90 in f90-mode:

  fortran-gfortran (disabled)
    - major mode: `f90-mode' supported
    - may enable: Automatically disabled!
    - executable: Not found

Flycheck cannot use this syntax checker for this buffer.

Flycheck Mode is enabled.  Use M-x universal-argument C-c ! x to enable disabled
checkers.

--------------------

Flycheck version: 32snapshot (package: 20191108.2129)
Emacs version:    26.3
System:           x86_64-apple-darwin18.2.0
Window system:    ns

perhaps relevant is that it cannot find gfortran from within a shell inside emacs, but it is available from a regular mac osx terminal


texts: Spacemacs fails to load after installation on Arch Linux

texts: I have been trying to use spacemacs on Antergos (Arch Derivative) but when I start emacs it doesn't load spacemacs. it used to work before just fine but not anymore. I'm also very new to emacs so I would appreciate some guidance.


texts: Include host in buffer name for all files opened with TRAMP

texts: I frequently use TRAMP with emacs to edit files remotely. However, I sometimes have files open from both my production and development server. When I have the same file open on both servers, TRAMP will name the buffers bar</ssh:stable:> and bar</ssh:dev:>. Is there a way I can get this behavior for all buffers, even if they’re currently only open from one of the servers? For instance, if I’m visiting /foo/bar on only the development server and /baz/qux on only the production server, I would like the buffers to be named bar</ssh:dev:> and qux</ssh:stable:>, respectively.


texts: How do I insert a breakpoint so that edebug starts only when that point is reached

texts: I want to instrument a function so that edebug gets control when that point is reached.  I can insert (edebug) in the code, however, unless the function is instrumented with edebug (C-u M-S-x), that will be interpreted as (debug), which I don't want.  But if the function is instrumented with edebug, then a break occurs everytime the function is called, not just when the particular point in the function is reached.  I only want the break to occur (and get control with edebug) when a particular place in the function is reached.


texts:
I have a link in my org file such as [[https://google.com][mylink]]. When I put the point over "mylink" and run M-x browse-url-at-point my browser opens "http://mylink.com".

Is there a different function or option I should be using to open the link url instead of the link text?


texts: How to run shrink-window-horizontally multiple times, or how to repeat a function multiple times in general?

texts:
I wanted to define a function to execute a command multiple times and ended up using fset:
(fset 'my-shrink (kbd "C-u 43 C-x {"))

Now, I want to include this in a function, like this:
(defun my-todo ()
  (interactive)
  (find-file "~/Dropbox/orgfiles/tasks.org")
  (split-window-right)
  (my-shrink)             ; this won't work
  )

but it failed with "Invalid function: my-shrink". Apparently, my-shrink is not a function, so I can I call it in a function? Or, alternatively, how to do something similar to my-shrink in a function? BTW, all my-shrink does it to run shrink-window-horizontally 43 times.


texts: superscript or subscript inside italics in org buffer does *not* change text appearance

texts:
I was trying to write 2 raised to 3 in italics inside an org-mode buffer and it did not work (i.e., no visual change happens to the text in the buffer).  That is:

The text does not change to italic
The ^ does not disappears and the superscript letter does not become a superscript like in a word document.

I tried both:

/2^3/
/2^{3}/

Could you suggest a solution?

(PS: I have tried toggling C-c C-x \)


texts: How do I turn off syntax coloring for lines that exceed the word-limit in prelude?

texts:
I'm using Prelude v 1.0.0. I want to turn off the syntax coloring when my lines exceed a certain word-limit. I don't know where that setting is set. Thanks!

EDIT: I should be more precise. Prelude, by default, sets the color of the text from it's "normal" color to a brighter, more annoying color when it exceeds a certain word-limit. I'm trying to figure out where to tweak it in prelude. I'll give the below suggestion a whirl though.


texts:
Sometimes I want to call unload-feature to unload a library… and it a library depends on it… and another library depends on that library…

How can I unload a library and all the libraries that depends on it, without walking through the dependency tree manually?

A common use case is to unload all the libraries of a package (e.g. when upgrading or uninstalling), so if there's a way to do that, it would be good enough.


texts: Can I display org-mode attachments as inline images in my document?

texts:
I have image files that I have included as org-mode attachments. I would like to display them inline in emacs (as I could a hyper-linked external image).

Is there some standard way to do this?


texts:
I'm developing a major mode for a language that has doc comments. They look like this:

(** Foos three bars.
    Better call this as [foo 1 b c].
    Though of course [foo a b 1] works as well. **)
Definition foo a b c := a + b - c.

In that context [ and ] work as sorts of unescapes: anything between them is really code, not comments.

Is there a generic approach this? IOW, is there a way to tell font-lock: in comments, treat anything between [] as code?

I can see a bunch of cool applications for this beyond my major mode: for example doctests in python (where >>> should introduce code), or javadoc, or doxygen, etc.

"""Foos the bars
>>> foo 1 2 3 # should be highlighted as code
0
>>> foo 4 5 6 # should be highlighted as code
3"""

I considered making [ a comment closer, and ] a comment opener, but it looks very brittle: it will confuse navigation commands, and nested comments, and will require a strange comment setup to allow multiple closers per opener; and it won't work outside of comments, either.


texts:
Does elisp have the "runtime code swapping" feature?

mentioned in slide at 27:14
https://www.youtube.com/watch?v=3TlEqzptWr0&t=27m14s

    Hot code loading is the art of replacing an engine from a running car without having to stop it.

Definition of code hot swapping from the PhD of Don Stewart:

  Definition Hot swapping is the replacement of existing code fragments at
  runtime without loss of the environment (state) associated with that code.

Further below he explains:

  The goal of code hot swapping is to allow for upgrades to components
  without observable loss in availability.


texts:
I have a set of org files all in one directory, as follows

'(org-agenda-files (quote ("~/GTD/ActiveProjects/")))

I would like to have an agenda that excludes one file Home.org so that I don't see it when I'm at work. Here is my current custom agenda setup

 '(org-agenda-custom-commands
   (quote
    (("n" "Today's agenda and all next actions for current projects"
      ((agenda ""
           ((org-agenda-ndays 1)
        (org-agenda-time-grid nil)))
       (tags-todo "CALL|URGENT"
          ((org-agenda-overriding-header "Urgent Home tasks")
           (org-agenda-files
            (quote
             ("~/GTD/OtherAORs/Home.org")))))
       (tags-todo "-NEXTMONTH-SOMEDAY-SCHEDULED-DEADLINE"
          ((org-agenda-overriding-header "All next actions except those under NEXTMONTH or SOMEDAY "))))
      ((org-agenda-compact-blocks t))
      ("~/Dropbox/org-mode/work-agenda.txt")))))

This does what I want it to do, that is it shows me all the work TODOs in the last command, and in the second-last command it shows TODOs from Home.org but only CALLs and URGENTs.

But I would like to have the Home.org (for re-fileing into it) in the same folder as the other org files, and set the org-agenda-files to all org files in the ~/GTD/ActiveProjects/ directory except Home.org

I've read about seq-filter and remove-if and to use them in a custom org-agenda-files something like this:

       (tags-todo "-NEXTMONTH-SOMEDAY-SCHEDULED-DEADLINE"
          ((org-agenda-overriding-header "All next actions except those under NEXTMONTH or SOMEDAY "))
(org-agenda-files
            (quote
             ("~/GTD/OtherAORs/Home.org")))))

What's the easiest way to do this?


texts: Are there any good resources that anyone can suggest. I rate myself 3 out of 10 when it comes to using editors like vim


texts: how to generate tags and find mark-whole-buffer definition

texts:
I am following the Introduction to Programming in Emacs Lisp tutorial built in in Emacs and have arrived at the Buffer Walk-through section.

In the 4.1 Finding more information the function xref-find-definitions is mentioned. As suggested - I try to find the definition of the mark-whole-buffer function.

when I run the function by typing M-. and mark-whole-buffer
it returns:

No definitions found for: mark-whole-buffer

Before that I have done/tried the following

Installed ctags.io like so: brew install --HEAD universal-ctags/universal-ctags/universal-ctags
run the ctags command in my ~/.emacs.d/ folder like so: ctags -R also tried ctags -R *.el - it generates a TAGS file and I can open it in Emacs and search with C-s and there is no mark-whole-buffer entry in there.
tried similar approach in other folders (running Emacs on macOS)

in the /Applications/Emacs.app/Contents/ folder - using same commands as in the .emacs.d folder
in the /Applications/Emacs.app/Contents/Resources/lisp folder - using same commands as in the .emacs.d folder

something else that I have tried is M-x visit-tags-table and when trying on for example the contents folder like Visit tags table (default TAGS): /Applications/Emacs.app/Contents/ it returns File /Applications/Emacs.app/Contents/TAGS is not a valid tags table

Can you please clarify the two following points?

Where to find the mark-whole-buffer function definition
How to do so from within Emacs


texts: Directory tracking in remote shell buffer

texts:
I use the shell command via C-u M-x shell to open a shell on a remote server by giving as default directory the path to the remote server (e.g /user@myserver.com:/home/user) (which should have the same effect as the method described in this answer).

The directory of the buffer is at the beginning in sync with the directory of the shell (/user@myserver.com:/home/user`), and  tab completion works as expected giving me choices from the remote directory.

However, when you issue

cd ~

in the remote  shell, the buffer directory is set to the local home path, so that I get tab completion for local directories which obviously does not make any sense in the remote shell.

How can I keep the directory tracking in sync even when I use cd in the remote shell? - I'm using GNU Emacs 23.1.1 on Centos, remote machine is Linux too.


texts:
How can I modify the default FILES pattern in rgrep for C++ mode?

For C mode the default is *.[ch]. For C++, it is *.cc *.cxx *.cpp *.C *.CC *.c++.

I would like to change it to *.cc *.[ch]xx *.[ch]pp *.[CHh] *.CC *.HH *.[ch]++.


texts: How do I set Icicles’s default sort order for filenames?

texts:
In general, Icicles sorts things in alphabetical order. However, something I can’t find has made it so filenames are sorted in descending alphabetical order (z, y, x … b, a). I can use C-M-, to reverse it so it’s in ascending order. On the other hand, if I hit C-,, it says (NOW: alphabetical); if I then select alphabetical, it changes to the correct order. The value of icicle-sort-comparer is icicle-case-string-less-p. My custom.el doesn’t contain any variables whose names include icicle.

I’m using commit 9e9c37d from the GitHub mirror right now, but I’ve been seeing this for a while now, just wasn’t thinking about it.

How can I make it so Icicles sorts filenames (e.g. in icicle-find-file) in ascending alphabetical order by default?


texts: emacs Imagemagick apply color transformation

texts:
I was looking to apply color transformation to images displayed in emacs. For example, with imagemagick, the following will invert image color.
convert input.png -channel RGB -negate -modulate 100,100,180 output.png

Is there a way to pass these to imagemagick and then displaying image in buffer?


texts: Turning off visual text replacement in Latex/P mode

texts:
In this mode some latex content is visually replaced with something that looks similar to the final output, like making a superscript show up as superscript in the source.
It's doing this with \par, but it replaces it with just a space. A hidden \par was the cause of some unwanted vertical space that I couldn't find the source of. I'm not sure what the name of this feature is. Does anyone know what this is called or how I can turn it off?


texts: How to get org-agenda to prefer split-window-right

texts: After upgrading to Emacs 24.4.1, when I call org-agenda with no splits it will show on the bottom half of the frame.  Previously, it would show on the right half.  How do I configure this behaviour?


texts: Spaceline: Disable dimming of segment in inactive windows

texts:
I have the window-number segment enabled for the spaceline package on Melpa.  On a frame with 3 windows, I will see the window number displayed only on the currently selected window's modeline.  I would like that segment to not be dimmed in inactive windows.
Is it possible to configure one segment to keep the highlight face even in inactive windows?


texts:
I would like to automatically add spaces between braces and content when using emacs, for example:

std::vector<std::string> values{"content", "moreContent", "andMoreContent"};

becomes

std::vector<std::string> values{ "content", "moreContent", "andMoreContent" };

when pressing }. I'm already using autopair-mode which automatically pairs braces and quotes.
Another example, when declaring variables:

int myVar{5};

becomes

int myVar{ 5 };

How do I do this?


texts: How can I bind the Ctrl-} key for a LaTeX command?

texts:
When working in LaTeX (specifically, with AUCTeX), I want to bind the following functionality to the C-{ and C-} keys:

C-{: insert \begingroup followed by a newline
C-}: insert \endgroup followed by a newline

As per this thread on LaTeX Stack Exchange I've tried the following:

(eval-after-load "latex"
  '(progn
     (define-key LaTeX-mode-map (kbd "C-{") "\\begingroup\n")
     (define-key LaTeX-mode-map (kbd "C-}") "\\endgroup\n")))

It doesn't work, however, and if I try C-h k C-} nothing happens.  How can I make my keybindings work?

I have tested the above behavior in at least three modes, Emacs-Lisp, LaTeX (AucTex) and XML mode.

I am using GNU Emacs 24 in Ubuntu 14.04.

UPDATE 1

I completely emptied my init file and then restarted emacs. The odd behavior persists.

UPDATE 2

All the proposed solutions, including my original one, has started to work.

I am without a clue.


texts:
Since I find myself writing a lot of matrices and tables, I'm looking for a way to align numbers nicely in Emacs (similar to the align package in vim). I found that there is align-regexp, but I couldn't get it to work the way I wanted. Is there a way to align numbers at their decimals --- and if there are no decimals align in front of the other decimals. It would also be nice to be able to align at 'thousands'-separators and align complex numbers. Preferably with two whitespaces in-between numbers for readability. Here is an example:

Input:

A = [-15 9 33.34;...
1.0 0.99 1+3i;...
13,000 2 11 ];

Desired output:

A = [   -15     9     33.34 ;...
          1.0  -0.99   1+3i ;...
     13,000     2     11    ];

Alternatively, to make it a bit easier (without 'thousands'-separator and complex numbers):

Input:

A = [-15 9 33.34;...
1.0 0.99 1;...
13000 2 11 ];

Desired output:

A = [  -15     9      33.34 ; ...
         1.0   0.99    1    ; ...
     13000     2      11    ];

Thanks a lot.


texts: Adjust scrolling after font increase/decrease

texts: After text-scale-decrease or text-scale-increase scrolling (e.g. with space, scroll-down) does not seem to take the text scaling into account. Is there a way to adjust the scroll commands to reflect these sorts of changes in text size?


texts: List of GNU Emacs enhancement requests, bugs, and milestones at any given time

texts:
In GitHub one can often find, for a given open-source project, the list of issues that have been reported and the estimated time-horizon that is considered for a given fix or enhancement.

Is there an equivalent repository where feature requests and bugs for GNU Emacs are collected and prioritized? Do the developers group them into specific milestones per version?


texts: Make fill-paragraph in *raw* python docstring leave the triple-quotes on separate line

texts:
This is almost the same question as this one, but not quite. I happen to like the docstring style

def f():
    """
    docstring

    another line
    """

so in emacs I have python-fill-docstring-style set to (quote django). Works great. But it doesn't work with this:

def f2():
    r"""
    A raw docstring with \n and \t and other symbols in it.

    Another line.
    """

If I run fill-paragraph on the first paragraph of this docstring, it turns it into:

r""" A raw docstring with \n and \t and other symbols in it.

If I run it on the second paragraph, it becomes

Another line.  """

Is this a bug or is there a customization setting I'm overlooking? The same problem arises if the docstring starts with b""" or u""".


texts: Org-agenda is building endlessly when org-id-link in header. How to fix?

texts:
A strange problem occurs when I add ord-id-links to my org-headers. My org-agenda is building endlessly.
As an example, when I try to build an org-agenda for a file with following content, it takes endlessly:
* School
** TODO [[id:1b4b87ba-76b6-42c3-8897-7e587176d546][Physik]]
   DEADLINE: <2020-08-16 So +1w>

As soon as I replace the id-link with a direct file-link, the org-agenda builds as normal:
* School
** TODO [[file:~/org/school.org#Physik][Physik]]
   DEADLINE: <2020-08-16 So +1w>

Currently, I'm using spacemacs.
I searched for org-agenda and org-id-links, but I couldn't find anything with similar issues.
I may also be a spacemacs specific bug. Haven't tested with vanilla emacs.
Do you know this behaivior? What could I try to fix the problem (setting some magic custom variable or so)?
UPDATE
  accept-process-output(#<process emacsql-sqlite3<1>> 30)
  #f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x1b6f265>)(#<emacsql-sqlite3-connection emacsql-sqlite3-connection>)
  apply(#f(compiled-function (connection &optional timeout) "Block until CONNECTION is waiting for further input." #<bytecode 0x1b6f265>) #<emacsql-sqlite3-connection emacsql-sqlite3-connection> nil)
  emacsql-wait(#<emacsql-sqlite3-connection emacsql-sqlite3-connection>)
  #f(compiled-function (connection sql &rest args) "Send SQL s-expression to CONNECTION and return the results." #<bytecode 0x1c76c7d>)(#<emacsql-sqlite3-connection emacsql-sqlite3-connection> [:select [file] :from headlines :where (= id $s1)] "49a9a162-2476-44e1-8596-565781663e62")
  apply(#f(compiled-function (connection sql &rest args) "Send SQL s-expression to CONNECTION and return the results." #<bytecode 0x1c76c7d>) #<emacsql-sqlite3-connection emacsql-sqlite3-connection> ([:select [file] :from headlines :where (= id $s1)] "49a9a162-2476-44e1-8596-565781663e62"))
  emacsql(#<emacsql-sqlite3-connection emacsql-sqlite3-connection> [:select [file] :from headlines :where (= id $s1)] "49a9a162-2476-44e1-8596-565781663e62")
  apply(emacsql #<emacsql-sqlite3-connection emacsql-sqlite3-connection> [:select [file] :from headlines :where (= id $s1)] "49a9a162-2476-44e1-8596-565781663e62")
  (if (stringp sql) (emacsql (org-roam-db) (apply (function format) sql args)) (apply (function emacsql) (org-roam-db) sql args))
  org-roam-db-query([:select [file] :from headlines :where (= id $s1)] "49a9a162-2476-44e1-8596-565781663e62")
  (car (org-roam-db-query [:select [file] :from headlines :where (= id $s1)] id))
  (car (car (org-roam-db-query [:select [file] :from headlines :where (= id $s1)] id)))
  (or (car (car (org-roam-db-query [:select [file] :from headlines :where (= id $s1)] id))) (if strict nil (org-id-find-id-file id)))
  (let ((file (or (car (car (org-roam-db-query [:select [file] :from headlines :where ...] id))) (if strict nil (org-id-find-id-file id))))) (if file (progn (org-id-find-id-in-file id file markerp))))
  org-roam-id-find("49a9a162-2476-44e1-8596-565781663e62")

It looks like org-roam causing the loop.


texts: Move point to the end of a live window using elisp

texts:
I want to move the point to the end of a window using elisp.
The following code snippet:

(set-buffer "buffer-name")
(goto-char (point-min))

does not visually change the location of the cursor on the window visiting the buffer "buffer-name". This is because windows and buffers are separate concepts.

I found the function set-window-point documented at https://www.gnu.org/software/emacs/manual/html_node/elisp/Window-Point.html, but I am not able to use it. Its signature is:

set-window-point window position

What does the first argument, window mean?

I tried running the command (set-window-point "buffer-name" (point-min)), but it returns the error Wrong type argument: window-live-p, "buffer-name", which I guess, means that the window named "buffer-name" is not showing on the screen.

Purpose: I have multiple eshell windows on the screen that are logged in via ssh to remote machines and I have written an elisp function to run a single command on all the eshell buffers. I am able to run the command, but can't see the output because the windows do not auto-scroll. I have to switch to the windows and scroll down.


texts:
helm-themes loads the themes present in
custom-load-themes which are coming from custom-theme-load-path (as per C-h f helps)

After installing themes mega-pack, the list is the following :

Available Custom Themes:
[ ] spacemacs-dark -- Spacemacs theme, the dark version
[X] spacemacs-light -- Spacemacs theme, the light version
[ ] adwaita -- Face colors similar to the default theme of Gnome 3 (Adwaita).
[ ] deeper-blue -- Face colors using a deep blue background.
[ ] dichromacy -- Face colors suitable for red/green color-blind users.
[ ] leuven -- Face colors with a light background.
[ ] light-blue -- Face colors utilizing a light blue background.
[ ] manoj-dark -- Very high contrast faces with a black background.
[ ] misterioso -- Predominantly blue/cyan faces on a dark cyan background.
[ ] tango-dark -- Face colors using the Tango palette (dark background).
[ ] tango -- Face colors using the Tango palette (light background).
[ ] tsdh-dark -- A dark theme used and created by Tassilo Horn.
[ ] tsdh-light -- A light Emacs theme.
[ ] wheatgrass -- High-contrast green/blue/brown faces on a black background.
[ ] whiteboard -- Face colors similar to markers on a whiteboard.
[ ] wombat -- Medium-contrast faces with a dark gray background.

How is it possible to have access to all the other themes available here http://themegallery.robdor.com/

Are they not in the mega pack ?


texts: mu4e does not retrieve emails from remote email server

texts:
I currently have my mu4e setup and working properly, except for one thing. Using the "U" key in mu4e in emacs does not seem to retrieve the emails using mbsync. I am using spacemacs (in case that is relavent).

This is my emacs configuration:

(defun dotspacemacs/user-config ()
  (setq mu4e-reply-to-address "my.email@website.com")
  (setq mu4e-get-mail-command "mbsync -a")
)

The interesting part is that when using the "U" keybinding, mu4e does index my new emails, but it does not retrieve them, despite having set the mbsync command above.

It should be noted that when I run mbsync manually from my terminal I am able to retrieve the new emails successfully (I first send an email from another account, run mbsync from terminal, then index from mu4e, and all is well), so my wager is that something is incorrectly configured within mu4e itself, and not mbsync. I will also note that my mail directory is set at ~/Maildir/ within my mbsyncrc configuration file.

What steps could I take to retrieve emails using the mu4e "U" keybinding using mbsync?


texts:
When I press C-cC-xC-r to print the clock report I get something like the following:

Clock summary at [2014-11-05 Wed 13:33]

| Headline     | Time   |
|--------------+--------|
| *Total time* | *0:01* |
|--------------+--------|
| test         | 0:01   |

The problem is that I have many entries at the same level. Like:

     * test
     CLOCK: [2014-11-05 Wed 13:13]--[2014-11-05 Wed 13:13] =>  0:00
     CLOCK: [2014-11-05 Wed 13:08]--[2014-11-05 Wed 13:09] =>  0:01
     CLOCK: [2014-11-05 Wed 13:08]--[2014-11-05 Wed 13:08] =>  0:00

Org-mode only recognizes details in sub-trees like:

* Haha
  #+BEGIN: clocktable :maxlevel 2 :scope subtree :timestamp t
  Clock summary at [2014-11-05 Wed 13:44]

  | Timestamp            | Headline     | Time   |      |
  |----------------------+--------------+--------+------|
  |                      | *Total time* | *0:03* |      |
  |----------------------+--------------+--------+------|
  |                      | Haha         | 0:03   |      |
  | 2014-11-05 Wed 13:40 | \__ test     |        | 0:03 |
  #+END:

Is there a way to print all the details within the same level, that is, all the clock entries and the length of each period?


texts: Mark package to never be considered for upgrade

texts: list-packages prompts you to upgrade packages when newer versions are available. How do you tell package.el to never consider a particular package for auto-upgrades? There are some packages which I have minor customizations for and don't care about newer versions of them.


texts:
I am trying to get code folding to work in Elpy. I have turned the folding module on already. However, I still seem to be unable to fold code. When I click on the first line of a while loop, I get the following message:

Debugger entered--Lisp error: (invalid-function hs-life-goes-on)
  hs-life-goes-on(nil)
  elpy-folding--click-text((mouse-1 (#<window 3 on while-loops.py> 94 (32 . 80) 18555047 nil 94 (4 . 5) nil (4 . 10) (7 . 14))))
  funcall-interactively(elpy-folding--click-text (mouse-1 (#<window 3 on while-loops.py> 94 (32 . 80) 18555047 nil 94 (4 . 5) nil (4 . 10) (7 . 14))))
  call-interactively(elpy-folding--click-text nil nil)
  command-execute(elpy-folding--click-text)

When I try to use the code folding option from the Elpy drop-down menu, I get the following error:

Debugger entered--Lisp error: (invalid-function hs-life-goes-on)
  hs-life-goes-on(nil)
  elpy-folding-toggle-at-point()
  funcall-interactively(elpy-folding-toggle-at-point)
  call-interactively(elpy-folding-toggle-at-point nil nil)
  command-execute(elpy-folding-toggle-at-point)

When I try to use the shortcut for the elpy-toggle-at-point function, I also get an error similar to the one above:

Debugger entered--Lisp error: (invalid-function hs-life-goes-on)
  hs-life-goes-on(nil)
  elpy-folding-toggle-at-point()
  funcall-interactively(elpy-folding-toggle-at-point)
  call-interactively(elpy-folding-toggle-at-point record nil)
  command-execute(elpy-folding-toggle-at-point record)
  execute-extended-command(nil "elpy-folding-toggle-at-point" "elpy-folding-toggle-at")
  funcall-interactively(execute-extended-command nil "elpy-folding-toggle-at-point" "elpy-folding-toggle-at")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

It seems that hs-life-goes-on from hideshow.el, which controls the "HideShow" minor mode is the problem. When I went to the function definition in hideshow.el.gz, this is what I found:

(defmacro hs-life-goes-on (&rest body)
  "Evaluate BODY forms if variable `hs-minor-mode' is non-nil.
In the dynamic context of this macro, `inhibit-point-motion-hooks'
and `case-fold-search' are both t."
  (declare (debug t))
  `(when hs-minor-mode
     (let ((inhibit-point-motion-hooks t)
           (case-fold-search t))
       ,@body)))

I am honestly not sure what is going on here.

As a last resort, I uninstalled Emacs and reinstalled it. I am currently using Emacs 28 on MacOS Catalina. My previous Emacs was 26.3. Both of these versions were obtained from HomeBrew. Emacs 26.3, my previous version was obtained from brew cask. My latest one, Emacs 28, was this version compiled from HomeBrew using the --with-cocoa option. Reinstallation did not fix the problem.

A similar question has been asked before, but the error I am getting is quite different from the one that the person asking that question got. In my case, I have also attempted to fix the problem by trying different methods to get code folding to work and managed to track down the code behind the function which seems to be breaking. That is why I think that this question is distinct enough from the aforementioned question to be posted separately on StackExchange, and should not count as a duplicate.

May I know what I can do to solve the problem?


texts: Hacking a "line-below" version of indent-relative

texts:
From indent.el:

(defun indent-relative (&optional unindented-ok)
  "Space out to under next indent point in previous nonblank line.
An indent point is a non-whitespace character following whitespace.
The following line shows the indentation points in this line.
    ^         ^    ^     ^   ^           ^      ^  ^    ^
If the previous nonblank line has no indent points beyond the
column point starts at, `tab-to-tab-stop' is done instead, unless
this command is invoked with a numeric argument, in which case it
does nothing.

See also `indent-relative-maybe'."
  (interactive "P")
  (if (and abbrev-mode
       (eq (char-syntax (preceding-char)) ?w))
      (expand-abbrev))
  (let ((start-column (current-column))
    indent)
    (save-excursion
      (beginning-of-line)
      (if (re-search-backward "^[^\n]" nil t)
      (let ((end (save-excursion (forward-line 1) (point))))
        (move-to-column start-column)
        ;; Is start-column inside a tab on this line?
        (if (> (current-column) start-column)
        (backward-char 1))
        (or (looking-at "[ \t]")
        unindented-ok
        (skip-chars-forward "^ \t" end))
        (skip-chars-forward " \t" end)
        (or (= (point) end) (setq indent (current-column))))))
    (if indent
    (let ((opoint (point-marker)))
      (delete-region (point) (progn (skip-chars-backward " \t") (point)))
      (indent-to indent 0)
      (if (> opoint (point))
          (goto-char opoint))
      (move-marker opoint nil))
      (tab-to-tab-stop))))

How would I modify this function so that it aligns the current line with the indentation point in the next, as opposed to the previous, line?


texts: Org-mode not following certain http links correctly

texts:
I have borrowed some code for using org-capture to take notes on elfeed entries. I press v on an elfeed entry I want to save to an Org file and it creates an entry with a link to the article in the headline.

It works quite well for almost all of my elfeed sources, except the ones that come from ScienceDirect. For these entries, pressing b in elfeed goes to the correct page, and the link inserted in the Org file appears right (works if I copy and paste the URL into Firefox, or call browse-url directly), but following the Org-mode link doesn't work (i.e. clicking the link or RET with org-return-follows-link set to t).

Here's an example (sorry about the long link, it's much nicer looking in org):

**** [[http://rss.sciencedirect.com/action/redirectFile?&zone=main&currentActivity=feed&usageType=outward&url=http%3A%2F%2Fwww.sciencedirect.com%2Fscience%3F_ob%3DGatewayURL%26_origin%3DIRSSSEARCH%26_method%3DcitationSearch%26_piikey%3DS1090780717301180%26_version%3D1%26md5%3D1f7dfc606454d64bd8ab5e855b764438][A special JMR issue: Methodological advances in EPR spectroscopy and imaging]]
 :PROPERTIES:
 :CREATED:  [2017-06-03 Sat 23:37]
 :END:

At least for me, clicking the above link in org takes me to an error page, and the URL makes it look like Org is clipping the URL short. The behavior persists using emacs -q.

My question is, what is causing this behavior, and how can I fix it?

In case it's relevant: I'm using Emacs 26.0.5 and Org 9.0.5 (Org 8.2.10 with emacs -q).


texts:
I use mouse-2 quite often for mouse-yank-primary. However, if I am at the start of an org-mode headline, instead of yanking from my cut buffer, it toggles the level of the headline. For example, if I have the cursor at the start of a level 1 headline(| used to represent cursor):

* |

Press mouse-2 and it becomes:

** |

...instead of yanking the text I want as the headline. Then if I press mouse-2 again, it becomes a level 1 headline again, and will keep toggling between the two on subsequent presses. How can I change this behavior to yank instead of changing the headline level? Normally I can figure these things out on my own, but I have had trouble in the past when it comes to changing the behavior of mouse buttons.

Update:

I tried describe-key before asking this question, and it seemed like mouse-2 should do what I want, but I just noticed at the bottom of the describe-key description for theup-event it says:

  <mouse-2> at that spot runs the command (lambda (e) (interactive "e")
  (mouse-set-point e) (org-cycle)), which is an interactive Lisp function.

  It is bound to <mouse-2>.

  (anonymous E)

  Not documented.

I assume this is what is causing my issue, but it doesn't seem clear to me where this is coming from.


texts: org mode table row number grow automatically?

texts:
recently I am using table to do some statistics, and I want the first column of the table to indicate the row number, as this.

   |  | title|
   |--| -----|
   | 1| A    |
   | 2| B    |

and I want the number of first column grow automatically after creating a new row.

Are there good suggestions about it?


texts:
To enable copy and paste between X11 and emacs in terminal, I installed xclip via M-x package-install. There is xclip-1.4 in ~/.emacs.d/ with the following files:

xclip-autoloads.el  xclip.el  xclip.elc  xclip-pkg.el  xclip-pkg.elc

I also checked the variable load-path which has "~/.emacs.d/elpa/xclip-1.4/".

But when I type M-x xclip-mode I constantly get Searching for program: xclip, no such file. Writing (xclip-mode 1) to ~/.emacs comes to the same result. Can anyone help me debug this?


texts: How to add timestamps for todo items in agenda view?

texts:
This is my first post here. I'm quite new to emacs and currently using doom emacs with some my own configs. I'm trying to customize my own agenda view these days, and what I want is to add timestamps(schedule or deadline) to each todo item in the agenda view.
Currently, I use agenda-and-all-todos and it looks like this:

I've found something like this (the '1 d. ago' and 'in 2 d.')

where I wish to add the same column of my scheduled tasks or tasks with deadlines while keeping showing the ordinary todos without timestamps. How should I achieve this?
PS: I've tried org-agenda-columns and it turns out to be ugly, see

Thus, I'm looking for a better solution here.


texts: advise around org-add-note behaves differnt in Windows and macOS

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

(defun my::with-no-drawer (func &rest args)
    (interactive "P")
    (let ((org-log-into-drawer (car args)))
      (funcall-interactively func args)))

  (advice-add 'org-add-note :around #'my::with-no-drawer)

The idea is that if I do M-x org-add-note then org-log-into-drawer is nil and so the note is added in the main body of the TODO item, but if I do C-u M-x org-add-note then the note would be added to the LOGBOOK drawer.

This works fine in Linux and macOS systems, but has no effect in a Windows installation (the note is always placed in the drawer).

Any idea why? The init.el is identical across all systems.


texts: Is it possible to disable the startup screen only when emacs opens a file?

texts:
Whenever I issue $ emacs, I am greeted by the startup screen. I like this.

However, when I issue $ emacs foo.txt, emacs opens foo.txt and the startup screen in a split screen. I do not like this.

Is it possible to disable the startup screen only when emacs is used to open a file?

I am not asking whether or not I can disable the startup screen (this is addressed here)


texts:
Being fairly new to GNU Emacs and intend to use it as a replacement to vi/vim where possible, I came across an obstacle, I seem not be able to overcome.

In vim (similar to less) you can provide a command line argument to open the editor already highlighting the first occurrence of a search.

Searching my ways through man pages, reading help files, going through the built-in tutorial and looking on the net, all I found was specific line numbers (and columns) to jump to.  However, what I am typically looking for is not at a line number I know of when opening files.

Is there an Emacs way to invoke an (incremental) search right at the start when opening a file, something along the way of emacs --search <search_term> <file>?


texts:
I want to globally replace C- with SPC in emacs. This should make almost all emacs bindings not awful chords, and should completely avoid colliding emacs with evil/vim. It should also be able to be done globally and automatically so you don't have to futz with new plugins to make them compatible with evil (unless they use things like single characters to do things). This also seems like a single consistent change, so there is a chance that it is not hard to do.

For example, C-x f becomes SPC x f, C-x C-f becomes SPC x SPC f. Perhaps M- becomes SPC SPC, so M-x is SPC SPC x.

I have two questions:

Are my assumptions correct? They are: this will make emacs and vim not collide, this will make most plugins compatible with evil out of the box.
How do I actually do it?


texts: File Mode Specification Error: (void-function nil) after opening python file

texts:
every time I try to open a python file I get the following message on the minibuffer:

File Mode Specification Error: (void-function nil)

I turned on the debug mode but I honestly don't understand what is going on or how to narrow down the error:

Debugger entered--Lisp error: (void-function nil)
nil()
run-hooks(change-major-mode-after-body-hook prog-mode-hook python-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook python-mode-hook))
run-mode-hooks(python-mode-hook)
python-mode()
set-auto-mode-0(python-mode nil)
set-auto-mode()
normal-mode(t)
after-find-file(nil t)
find-file-noselect-1(#<buffer flasktest.py> "~/tmp/flasktest.py" nil nil "~/data/tmp/flasktest.py" (8388619 2052))
find-file-noselect("/home/srp/tmp/flasktest.py" nil nil)
ido-file-internal(raise-frame)
ido-find-file()
call-interactively(ido-find-file nil nil)
command-execute(ido-find-file)

I went through my init.el but didn't find any suspicious with respect to python mode. Here are the relevant lines:

;; Package Management
(require 'package)
(add-to-list 'package-archives
         '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
...
...
;; PYTHON IDE
;; Install rope, flake8, importmagic, autopep8 via pip
(elpy-enable)
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
(autoload 'pylint "pylint")
(add-hook 'python-mode-hook 'pylint-add-menu-items)
(add-hook 'python-mode-hook 'pylint-add-key-bindings)
(add-hook 'python-mode-hook (highlight-indentation-mode 0))

Does anyone know how to fix that error?


texts: org-mode backend: how to find tags of enclosing headline?

texts:
I am trying to write on org-mode backend to generate Jupyter Notebook, specifically optimized for producing slides using RISE (see https://github.com/hkarl/org-juslides if interested).

Suppose I have a src-code block. How can I find out the tags of its enclosing headline (if any tags exist)?

The closest thing I found is this How can I get the tags for a headline in a clock report formula?,
 and Org-mode backend: access properties in heading - but they are after somewhat different problems.

I know how to get at attributes of the src-block itself, but I'd rather not have to repeat a "skipslide" tag already set in the headline.

I suppose it would be possible traversing org-element-lineage, but that seems like vast overkill. Is there any simpler option?

Any pointers much appreciated!

(defun org-juslides-src-block (src-block contents info)
  (let ( (code (org-export-format-code-default src-block info))
     (animate (org-export-read-attribute :attr_juslides src-block :animate))
     )
    (print "src block")
    (print (org-element-lineage src-block '('heading) ))
    (print animate)
    (org-juslides-cell "code"
               (if animate
               "fragment"
             "-")
               code)
    )
  )


texts: how to search and replace an entire word?

texts:
I know the command isearch-forward-word, but there doesn't seem to be an isearch-replace-word. I'd like to search and replace every instance of a certain word in a buffer. For instance, search for every instance of i and replace with I.

I found this answer, which seems to allow a digit argument, but I just want to replace every instance in my buffer.


texts: Is there a gdocs-mode or something I could use to edit Google Docs?


texts: Disable minor mode when in another minor mode

texts:
I'm running a distribution of spacemacs and am currently working in clojure's cider debugger, and an issue I've run into is that several of the cider--debug-mode keybindings are shadowed by evil-mode. I've tried a few things with my configuration so far, including adding a hook on the cider--debug-mode which defines a keybinding to allow me to use the keys for their intended purpose again, which didn't work, and I've also simply called (evil-mode) in the lambda as well since just calling the function with no args will toggle the mode. However I've continued to experience the shadowed keybinds regardless. When I manually disable evil-mode before beginning debugging it works as intended, so it seems to me almost as if the hook isn't running properly.

Why might that be?


texts: How to sync customize interface with external config file?

texts:
I would like to have an interface in customize for a package I'm writing.  Whenever I set the values it should update an external config file, too. So the values should be saved in the emacs custom file and in an additonal external file.

For the external file the values set by the user have to be transformed to a slightly different format.

In turn when the external file was manipulated manually the customization interface should reflect this changes and load the current values of this external file.

Is this possible and if so can anyone give me some pointers how I could approach this?


texts: How to load personal prolog.el only if system's one is outdated?

texts:
I need to use a version of prolog.el not older than 1.25, so I defined the function maybe-reload-prolog-el:

(defun maybe-reload-prolog-el ()
  (when (version< prolog-mode-version "1.25")
    (add-to-list
     'load-path
     (file-name-as-directory (concat my-lib-path "prolog-el")))
    (load-library "prolog"))))

...which adds the path to my personal copy of prolog.el to load-path (and then reloads prolog) if it detects that prolog-mode-version is too old 1.

Then I put a call to maybe-reload-prolog-el in a hook I already had for prolog-mode:

(add-hook 'prolog-mode-hook
  (lambda ()
    ;; ;; some keyboard settings, like
    ;; (local-set-key [f10] ...)
    ;; (local-set-key  [f9] ...)
    ;; ;; etc
    (maybe-reload-prolog-el)))

The main problem with this approach is that prolog.el is responsible for more than prolog-mode.  For example, it has the code for the autoloaded function run-prolog, which I use to run a Prolog sub-process in an Emacs buffer.  AFAICT, prolog-mode-hook does not get triggered when I run run-prolog, so I end up running an outdated version of it.

Is there some way to trigger maybe-reload-prolog-el right after prolog.el is loaded, before any of its code gets executed?

BTW, as currently written, maybe-reload-prolog-el can run only after prolog.el is loaded, because it relies on the variable prolog-mode-version, which is defined in prolog.el, to decide whether to load my local copy of prolog.el.  IOW, if I simply put the following code in my init file

(if (version< prolog-mode-version "1.25")
  (add-to-list
   'load-path
   (file-name-as-directory (concat my-lib-path "prolog-el"))))

...it fails with:

Symbol’s value as variable is void: prolog-mode-version

If there were some way to test the version of the default prolog.el's version before loading it (let's call this method PROLOG-OLDER-THAN-1.25-p, then I would just put this in my init file:

(if (PROLOG-OLDER-THAN-1.25-p)
  (add-to-list
   'load-path
   (file-name-as-directory (concat my-lib-path "prolog-el"))))

Please let me know if there's a way to implement a PROLOG-OLDER-THAN-1.25-p that does not require prolog.el to be loaded.

Of course, I know that I can always use my copy of prolog.el, unconditionally.  IOW, I can just put this in my init file:

(add-to-list
 'load-path
 (file-name-as-directory (concat my-lib-path "prolog-el"))))

This approach works in the short-term, of course, but it requires more maintenance long-term.

1 Please let me know if what my maybe-reload-prolog-el function does is the best way to conditionally reload prolog.el.  I'm not too confident that (load-library "prolog") is the right thing to do here.


texts:
Update 2020-12-22: I have answered the question. Please see below.

I have fcitx installed on a Linux environment.
According the to fcitx-diagnose it is correctly
installed.
I am using the us-alt-intl keyboard to access diacritics in other language as a default keyboard. But it imposes extra-typing in standard
vim or evil mode. Typically,accessing registers or moving to marks adds an extra space, which on
extensive usage is somewhat a burden.
I'd like to switch back to a standard us keyboard when not in  insert mode. As it turns
out that is a common issue for CJK users.
The Chinese layer and the mozc package relies on fcitx to do that job. First, I have not been able to make them work on my installation.
I have attempted to create a layer to that intent.
Being new to layer creation, I have followed the  is my packages.el:
(setq fcitx-packages
          '((fcitx :toggle fcitx-enable-fcitx)
            org))

(defun fcitx/init-fcitx ()
      (use-package fcitx
        :init (fcitx-evil-turn-on)
        :config
        (progn
          (setq fcitx-active-evil-states '(insert emacs hybrid))
          (fcitx-default-setup)
          (fcitx-prefix-keys-add "M-m" "C-M-m")
          (when fcitx-fcitx-use-dbus
            (setq fcitx-use-dbus t)))))

This is probably overkill as
adding the fcitx package to the .spacemacs file
could perhaps be enough
dotspacemacs-additional-packages '(fcitx
                                      mozc
                                      mozc-im
                                      mozc-popup)

How can I add the keyboards in that code (which is faulty anyway).


texts: How to turn in and off the #+INCLUDE on org-mode?

texts: I have many lines that include external files in my main .org file. Sometimes I need to export the main file to pdf (and latex) without including the external files. So, I would like to know how to efficiently turn in and off lines that include external file that uses the #+INCLUDE: command in my main .org file.


texts: Ignore both uppercase and lowercase versions of the extensions listed in completion-ignored-extensions

texts: How can I get Emacs to ignore, say, both .pdf and  .PDF files without listing both ".pdf" and  ".PDF" in completion-ignored-extensions?


texts: Conflict in package installed with both package and el-get?

texts:
I list my packages:

;; List all packages installed with el-get-install (look for "installed" to find installed packages)
(el-get-list-packages)

;; List packages installed with "package-install"
(package-list-packages)

And I see that the package projectile (which is not working fine) is installed both with el-get and package-install.

Does this mean the package is duplicated?
Which installation takes precedence?
How do I uninstall packages installed with el-get-install?
How do I uninstall packages installed with package-install?
Is it possible to globally disable all packages installed with package-install?
Is it possible to globally disable all packages installed with el-get-install?


texts: emacs 27.0.50 term.el doesn't play well with zsh

texts:
I used to compile emacs from the master branch every month or so and looks like there has been a lot of changes to term.el (move to lexical binding) and when I open term or ansi-term there is always a % character at the end of every command i execute in term.

Have anybody else run into this issue? If so any fixes ? I'm reverting back to using emacs 26 RC until then.


texts: Emacs connect to MySQL (MariaDB) non-interactively

texts:
I am looking into sql.el, and I can't find a way to bypass creating comint buffer and setting some global variables in order to connect to the database.

This is less than ideal because I know the credentials, but I don't want to alter global variables which might be used for something else, and there is no way to just create a process and interact with it, or so it seems.

Ideally, I'd like to have a MySQL process, with which I could interact programmatically in an asynchronous way. I.e. the intent is not to let the user write queries, but rather to translate user's input into queries and to execute them as the program sees fit.


texts: Extra indentation for argument lists beginning on a new line

texts:
I'm fine-tuning my C++ style using c-add-style, but I've reached an impasse where I cannot convince Emacs to (extra) indent arguments where the first argument starts on a new line.

When I'm forced to start argument lists on a new line I prefer to indent the arguments an extra level to distinguish them from the function body:

void particularlyLongFunctionName(
        particularlyLongTypeName &particularlyLongArgumentName) {
    foo(particularlyLongArgumentName);
    bar();
}

My configuration, on the other hand, indents the argument list no more than the following code block:

void particularlyLongFunctionName(
    particularlyLongTypeName &particularlyLongArgumentName) {
    foo(particularlyLongArgumentName);
    bar();
}

Which field in the c-style-alist controls this setting?


texts: setting up Gnus 5.13 with OfflineIMAP and Dovecot

texts:
I am trying to set up Gnus 5.13 to access a local maildir (created by OfflineIMAP) via Dovecot.  I know I could access OfflineIMAP's maildir directly, but as far as I know, this causes problems with syncing Gnus' flags.  So I set up OfflineIMAP (it works) and I have this in my ~/.gnus.el:

(setq gnus-select-method '(nnimap "Mail" (nnimap-stream shell)))
(setq nnimap-shell-program "/usr/lib/dovecot/imap")

I also tried this instead of the second line:

(setq imap-shell-program "/usr/lib/dovecot/imap")

However, when I start Gnus, I get the following error message:

  Couldn't open server on Mail

  Warning: Unable to open server nnimap+Mail due to: Buffer  *nnimap Mail
  nil  *nntpd** has no process

Does anyone know how to get this working or at least how to figure out what that error message means?


texts:
Since I moved to emacs 25 (25.3.2 at the moment) in every context (org-mode, gnus, latex, browsing url, direct access to file) I access pdf-files in emacs, they are displayed in doc-view. I basically would want in all cases except the last one display them in my system pdf viewer or the viewer in my mailcap file. And I would prefer an easy way to achieve this.

I found four suggestions so far to achieve this. Three of them work well for org-mode, browsing, not so well for gnus and not at all for latex.

You find them here: https://lists.gnu.org/archive/html/info-gnus-english/2016-04/msg00001.html (adding "(require 'mailcap)" before), here: https://lists.gnu.org/archive/html/info-gnus-english/2016-04/msg00002.html and here: Org-mode: How to disable automatic doc-view on emacs-25

All three proposals work well for org-mode and browsing, but for gnus there is an annoying problem: If I click on a pdf link in gnus the pdf file is displayed twice. (Also: internal and external view lead to the same external viewer. I would prefer if external view would lead to my system choice and internal view to doc-view, which would be consistent with the idea of "internal" and "external".)

None of the three proposals lead to a change in the case of the display of pdf files in the context of latex. For this (fourth suggestion) I have to install auctex and set the variable "TeX View Progam Selection" for "output-pdf" to the desired program.

Any suggestion how I could have pdf files displayed in my external viewer of choice in org-mode, url-browsing and gnus, but shown only once in all cases, including gnus?

Any suggestion how I could I revert in a simple way to a situation where pdf files a are never shown in doc-view but always in my system choice or my mailcap file? (Of course allways only once.)

Any suggestion how I could achieve in a simple way the ideal solution: org-mode and url browsing display pdf files with my system/mailcap viewer; gnus display pdf files with my system/maildcap viewer if I click them or if I ask for external view, but with doc-view if I ask for internal display; latex displays compiled pdf files in my system/mailcap viewer; opening a pdf file directly in emacs opens it in doc-view.


texts: Can I use an image in my modeline lighter?

texts:
My modeline is cluttered. Can I make it display pictures instead of mode names?

I could use unicode Emoji (such as  for Python or  for Coq), but some machines on which I use my Emacs config do not have the right fonts pre-installed (ideally, I'd also like to reuse this technique in a mode that I'm writing, so I can't expect users to have the right font setup).

I tried adding an :image display property to the modeline lighter of a toy minor-mode, but nothing appeared in the modeline:

(define-minor-mode my/test-mode
  "Test mode."
  :lighter (propertize " " 'display '(image :type imagemagick
                                             :file "/home/clement/.emacs.d/rooster.png")))


texts:
I noticed something that might be a feature, but I find it rather annoying. Say I have a piece of code:

some_function = (x, y) ->
  z()

and I wish to add a new function call one indentation level deeper than the z(). To illustrate it I will use indenting.

some_function = (x, y) ->
  z()
foo()

This is with no indentation

some_function = (x, y) ->
  z()
->foo()

Pressing tab once, places two spaces in front of foo()

some_function = (x, y) ->
  z()
foo()

Pressing tab again does not do the expected behavior of adding two additional spaces. Instead, it de-indents back to the beginning.

Is there a way to override this?

EDIT:

Here's my relevant configuration stuff

(custom-set-variables
   '(coffee-tab-width 2)
   '(coffee-indent-like-python t)
)

(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq tab-always-indent t)
(electric-indent-mode 1)


texts:
Currently, ruby-mode in Emacs 27 indents the following snippets like this:

expect(foo).to match(
                 bar
               )

expect(foo).to \
              match(bar)

Is there a way to have them indented like this, to avoid overly long lines?

expect(foo).to match(
  bar
)

expect(foo).to \
  match(bar)

EDIT: I am not sure I understand how this relates to paren-less method calls. The indentation for the following has all the parens present and is indented in the same way.

expect(foo).to(match(
                 bar
               ))

The example with the line continuation (\) on the other hand is unambiguous, correct? "Indent one level further than the previous non-whitespace line" should cover all cases, unless I am missing something.

The first two examples in this question, which are the default in current ruby-mode both get flagged by RuboCop in the default config with Indent the first parameter one step more than the start of the previous line. I suppose this is not a dead-set argument for or against a particular indentation style. But it might be worth considering providing it as an option given RuboCop's popularity.


texts:
Whenever I save my main.el file, I get the following error.

apply: Args out of range: #("Git@" 0 4 (help-echo "Locally added file under the Git version control system" face vc-locally-added-state)), 0, 7

The debug stack looks like this:

Debugger entered--Lisp error: (args-out-of-range #("Git@" 0 4 (help-echo "Locally added file under the Git version control system" face vc-locally-added-state)) 0 7)
  vc-git-mode-line-string("~/emacs_environment/elisp/main.el")
  apply(vc-git-mode-line-string "~/emacs_environment/elisp/main.el")
  vc-call-backend(Git mode-line-string "~/emacs_environment/elisp/main.el")
  vc-mode-line("~/emacs_environment/elisp/main.el" Git)
  vc-find-file-hook()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer main.el> "~/emacs_environment/elisp/main.el" nil nil "~/emacs_environment/elisp/main.el" (4325419 2050))
  find-file-noselect("~/emacs_environment/elisp/main.el" nil nil)
  ido-file-internal(raise-frame)
  ido-find-file()
  funcall-interactively(ido-find-file)
  #<subr call-interactively>(ido-find-file nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> ido-find-file nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (ido-find-file nil nil))
  call-interactively(ido-find-file nil nil)
  command-execute(ido-find-file)

I get the same error whenever I open the buffer. The message displays and the buffer loads, but it doesn't open in the current window. I have to do that explicitly with C-x C-b.

My .emacs looks like this.

(add-to-list 'load-path "~/emacs_environment/elisp")
(require 'main)

This loads the main.el library for me, which itself loads more specific .el libraries. I do it this way so that I can sync the emacs_environment directory across computers.

I get the same error even if I comment out everything in the main.el file.

My emacs_environment directory is a Git repository, and I have magit installed.

My Emacs version is GNU Emacs 25.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2015-01-09 on lgw01-05.

How can I eliminate the error and have my main.el file open normally?


texts: Having org-mode beamer / latex to ignore below a certain tag

texts:
I want to speedup compilation by instructing org-mode/latex/beamer to ignore everything coming after it.

My document takes a bit of time to process code with pigment and the like

Is it possible to do so ?


texts:
Recently I started using minimap-mode, but it has been a bit buggy as sometimes when I split the window and open two different buffers, it won't let me go back to a buffer with code (and minimap).

So I when I do C-x o, it goes to the other buffer for a second, the minimap appears, but suddenly it disappears and emacs sends me back to the previous buffer.

It is strange, since it is not happening always, so I really don't know what can be causing it.

Any ideas?


texts: How to improve flyspell performance loading files?

texts:
On loading large files (~2000+ lines for example), flyspell takes a few seconds to Run.

Is there a way to have flyspell delay applying to the entire buffer on load?

Only run on visible text for instance? Or run multiple processes to get the job done faster?

Edit: this was caused by:

(add-hook 'flyspell-mode-hook 'flyspell-buffer)

Think this question should be closed.