texts: url-(https)-file-exists-p: ignore interactive behaviour when called programmatically (insecure TLS connection)

texts:
I want to use url-file-exists-p (or more precisely, the underlying url-https-file-exists-p) to detect possible broken links. However, some https link makes url-file-exists-p require interaction (This even happens when url-file-exists-p is called programmatically):

when the TLS connection is insecure: a buffer named *Network Security Manager* pop up to show certificate information and a prompt is waiting for input as below;

(below is the result of the help).

ask for user-name and password.

I'm looking for a way to

prevent the buffer *Network Security Manager* pop up
send input to the prompt whenever is needed
return different values/symbols depending on the context

t: secure connection, no prompt showed up
nil: connection failure
TLS: 'always, 'session and 'no: depending on the input (2.) sent whenever a prompt requires one
username/password: 'ignored if username/password are not sent to the prompt causing failure.


texts: How can I replace grep with sift or ag in helm-grep? (Not helm-do-ag)

texts:
I've currently got a custom function that I use to grep through files in helm.

;; Search for the thing that the cursor is on or that's already hilighted. If there's nothing,
;; switch back to searching for text interactively.
(defun search-for-region-or-word()
  "Uses helm to search for the currently marked region, or the word under the cursor."
  (interactive)
  (require 'helm-files)

  (let ((search-text nil))

    ;; If the region isn't active, activated it by selecting the word under the cursor.
    (if (not (region-active-p))
        (setq search-text (thing-at-point 'word 1))
      (setq search-text (buffer-substring-no-properties (region-beginning) (region-end)))
      )

    (deactivate-mark)

    (if (not (string= search-text ""))
        (helm-do-grep-1 (list "e:/path/to-files/") '(4) nil '("*.cpp" "*.h" "*.foop" "*.moo") nil search-text)
      (project-search)
      )
    )
  )

I'd like to keep using helm-do-grep-1, but I'd like to use sift or ag instead of grep. helm-do-ag doesn't seem to have support for feeding it arguments like the search text non-interactively.

I've tried swapping the other search methods in, but all I ever end up with is a blank search that never terminates on its own, so I suspect that I'm giving helm-grep output in a way that it can't parse properly. (Alternately, I'd take advice on how to make helm-do-ag do what I want. It's not a very well documented extension, unfortunately, and I don't really want to pick apart the elisp myself. :P)

Edit:
Here's the grep command:

grep -a -d recurse %e -n%cH -e %p %f

Here's what I'm trying for the sift command:

sift -ars --line-numbers --nogroup --stats -e %p -f %f

I've also tried:

sift -ars --line-numbers --nogroup --stats %s %s (this works in helm-do-ag)


texts:
I want to enter tab literally by control + v . But, control + v is already emacs key-binding.

How can I invalidate a key-bindings temporally ?


texts:
I compiled Emacs 27.1 with --with-x-toolkit=lucid, now the menus are blank.
I tried setting the colors in ~/.Xresources:
Emacs.pane.menubar.background: black
Emacs.pane.menubar.foreground: white
Emacs.pane.menubar.buttonForeground: white

But that only turned the menus black, I still see no text.
I started Emacs with xrdb ~/.Xresources && emacs -Q. GTK and Motif menus work fine.


texts: How to get an audible feedback when the current task is overrun?

texts:
In org-mode when a task is overrun - when the clocked time is bigger than the effort, there is a visual feedback in the mode-line. I am looking for a way to get an audible one as well.

I couldn't find any hook for this event. As for the implementation of org-clock it appears to be only providing an extra string to display on the mode-line.

  "Extra mode line text to indicate that the clock is overrun.
  The can be nil to indicate that instead of adding text, the clock time
  should get a different face (org-mode-line-clock-overrun').
  When this is a string, it is prepended to the clock string as an indication,
  also using the face org-mode-line-clock-overrun'." (from org-clock-task-overrun-text)

Has anyone managed to find a way to get an audio feedback when the clock has just overrun?


texts:
How can I navigate to a certain paragraph number?

If I want to move to the 33rd line in a file, I execute M-x goto-line <RET> 33, but there does not seem to be an equivalent goto-paragraph function.

I could write a function to do this for me (i.e. go to beginning of file, then execute forward-paragraph X number of times), but I am wondering if there is a built-in function for this already.


texts: A command to get buffer content centered in the window

texts:
I'm looking for the built-in command, probably a minor mode, that got my text unstuck from the left border of the window and showed more or less horizontally centered.
The command doesn't modify the text in the buffer, just the view of it.
I got this command while reading the manual, then lost it and now I'm failing to find it back again.


texts:
I want to iterate over a list with both the index and the value in the loop.

Currently, the code looks like this:

(let ((my-list '(a b c)))
  (cl-loop for index below (length my-list)
           for item = (seq-elt my-list index)
           do (insert (format "index=%s, item=%s\n" index item))))

but calling seq-elt each time is not reasonable.

Another solution looks like this:

(let ((my-list '(a b c)))
  (cl-loop for item being the elements of my-list using (index index)
           do (insert (format "index=%s, item=%s\n" index item))))

But the documentation seems to indicate its obsolete (at least in Common Lisp).

I can't use seq-do-indexed because it was introduced after Emacs 25 with which I would like to keep backward compatibility until 27 is released.

Here is a home-made version that works, but I would prefer a builtin solution if one exists:

(let ((my-list '(a b c))
      (index 0))
  (dolist (item my-list)
    (insert (format "index=%s, item=%s\n" index item))
    (cl-incf index)))

Here is the actual code I'm not satisfied with.


texts:
I'd like to use one hotkey for continuing running (gud-cont) and starting running (gud-run). How can I check if gdb (or other debugger, if possible) is running a program right now? Is there a debugger-independent variable?
Currently my function looks as follows:

(defun gud-run-or-cont (arg)
  "Run or continue program with numeric argument ARG."
  (interactive "p")
  (when (boundp 'gdb-thread-number)
    (if (eq gdb-thread-number nil)
        (gud-run arg)
      (gud-cont arg))))

but it does work with gdb only.

And, BTW, how to properly bind this function to key (i.e. for gud buffers and source buffer, but for no one else)?


texts:
IDO had this disable the special mode and fall back to vanilla find-files. It was useful to be able to use environment variables and their expansion in path names for example.

Is there something similar for helm-find-files (a key to hit during helm-mode-find-file which falls back to find-files?

Moreover, my C-x C-f is not bound to helm-find-files, yet I still get helm-mode-find-file when I hit C-x C-f (or when M-x find-file for that matter). Also puzzled by this. Any ideas?


texts:
I just updated to Mojave. I used to use emacs-mac from https://bitbucket.org/mituharu/emacs-mac/ but with Mojave I just get blank window for emacs. I also tried emacs-plus and building on my own both which had the same issue.

The installation from https://www.gnu.org/software/emacs/
and emacs in the terminal seems to work fine. But I need dvisvgm support which neither has.

Please let me know if you would need more information.

HELP!


texts: dired-listing-switches -- time-style format (with a space)

texts:
My version of ls supports a time-style format (with a space) as follows:

--time-style=+%m-%d-%Y %H:%M:%S

The entire dired-listing-switches looks like this:

"-alh --group-directories-first --time-style=+%m-%d-%Y %H:%M:%S"

The space between the date and the time breaks the functionality.  Any ideas on how to use (setq dired-listing-switches . . .) with a space between the date and time would be appreciated.

I've tried single quotes and I've tried \" but that format is rejected.

EDIT (October 28, 2014)

I've tried single quotes:

--time-style='+%m-%d-%Y %H:%M:%S'
'--time-style=+%m-%d-%Y %H:%M:%S'

I've tried escaped double quotes:

--time-style=\"+%m-%d-%Y %H:%M:%S\"

\"--time-style=+%m-%d-%Y %H:%M:%S\"

Based on Drew's suggestion below, I tried an escaped space:

--time-style=+%m-%d-%Y\ %H:%M:%S

The following link is the thread for the new Emacs bug report that I filed today:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18875

EDIT October 29, 2014:  For clarification purposes, the proposed dired-listing-switches string will either generate an error, or it will omit hours:minutes:seconds.  Although dired-mode does not support a list for switches when using dired-insert-directory, it is interesting to note that insert-directory from files.el permits a list format which works.  The following screen shot was generated with insert-directory using a list format for the switches argument.  I have already updated the bug report to mention the following expression (which bypasses dired-mode altogether).

(insert-directory "/" '("--dired" "-alth" "--time-style=+%m-%d-%Y %H:%M:%S") nil t)


texts:
I recently started using C++17, which brings constexpr if. This however screws up c++-modes default indentation.

// emacs 25.3.2 with --no-init
if constexpr (n == 1) {
    // Why?
  } else if constexpr (n == 2) {
    // This is a mess...
  } else {
  // and it keeps getting weird
}

Does anyone either

Know of a simpler alternative to cc-mode?
Know how i can fix this particular issue?


texts: Getting Rid of Constant "Recentf Changed On Disk" Error

texts:
I use spacemacs. It seems like every time I switch windows from spacemacs and come back to it I get the annoying error

recentf changed on disk; really edit the buffer?

I have tried disabling recentf mode, but other modes turn it back on automatically (i.e., helm or ido). I need those modes for my workflow.


texts: Adding a "difficulty" marker to Org TODOs

texts:
I want to add difficulty markers to TODOs similar to how priorities are added. For example, the one below is a normal task with a priority of "A" assigned.

** TODO [#A] Ask at StackExchange on how to add difficulty markers
** TODO [#B] Work on adding difficulty markers

What I want is something like the one below:

** TODO [#A][1] Ask at StackExchange on how to add difficulty markers
** TODO [#B][9] Work on adding difficulty markers

The numbers denote how difficult the task will be.

Is there an easy way to do this? Is there a package that does something similar that I can look into?


texts: include notes in table environment below tabular when exporting from org-mode

texts:
Is there a way to put notes below a table in org-mode that are exported into the table environment but are not part of tabular when exporting to LaTeX?

E.g., I export a lot of regression tables and need to export some table explanations below the table body. If those are not included in between \begin{table} ... \end{table} they are not part of the float environment and end up somewhere in the text, not below the table.

#+NAME: tab:direct_xtivreg_de
#+CAPTION: Contribution explained by lagged received punishment (Panel *unclustered Std.Err.*)
|                   | (1)       | (2)             | (3)       |
| VARIABLES         | contrib   | L.realPunRecSum | contrib   |
|-------------------+-----------+-----------------+-----------|
| L.realPunRecSum   | -0.216*** |                 | -1.150*** |
|                   | (0.0433)  |                 | (0.0894)  |
| L.predPunRecSum31 |           | 1.084***        |           |
|                   |           | (0.0395)        |           |
| Constant          | 12.46***  | 0.414***        |           |
|                   | (0.115)   | (0.0592)        |           |
|-------------------+-----------+-----------------+-----------|
| Observations      | 2,016     | 2,016           | 2,016     |
| R-squared         | 0.014     | 0.296           | -0.242    |
| Number of subj.   | 224       | 224             | 224       |
| F test model      |           |                 | 165.3     |
|-------------------+-----------+-----------------+-----------|
\parbox{.8\textwidth}{\footnotesize Standard errors in parentheses, *** p<0.01, ** p<0.05, * p<0.1}

Update: I added a code example. I would like the parboxpart to be within the table environment as well.


texts: C-/ results in backspace in the Linux console

texts:
I am using emacs on many machines, and always use C-/ for undo.  However, I started working on a Raspberry Pi with Arch Linux recently, using a local text terminal - X is not installed.  Here, C-/ has the same effect as Backspace, instead of 'undo.  How can I get an 'undo when I press C-/?  I'm using emacs-nox-26.2.

Note, this question was also asked on SuperUser, but without a (to me) satisfactory answer.  I'd like to reconfigure emacs, not my spinal cord ;-)


texts: Getting proper indentation for Python Flask templates

texts:
I've started using the Flask Python framework, and I'm having trouble getting indentation to work properly in the template .html files.  I use web-mode, and it seems to really not want me to indent without opening a new html tag. For instance, this is the default indentation:

{% extends "base.html" %}

{% block content %}

Sign in

<form action="" method="post" name="login">
    {{ form.hidden_tag() }}

        Please enter your OpenID:

        {{ form.openid(size=80) }}

        {% for error in form.openid.errors %}
        [{{ error }}]
        {% endfor %}

{{ form.remember_me }} Remember me

<input type="submit" value="Sign in">

</form>
{% endblock %}

Ideally I would indent code within the for loop so that I can more clearly view the structure of my code, but web-mode won't let me Tab that line over, no matter how many times I try. I couldn't find any other packages for Flask, but maybe I'm in the wrong place.  Is there a way to get web-mode and Flask to play nicely?


texts:
I just upgraded from Fedora Linux 32 to Fedora 33 and I think this updated emacs as well because I now see some new behaviours.
I have set:
(global-set-key (kbd "<f6>") 'org-todo-list)
so that I can press F6 to open the TODO list and it used to open on the right, which is what I want.
Now it opens below.
I did some research and found:
(setq split-width-threshold 1)
Which does open the TODO list on the right.
BUT when I middle-click on a TODO item in the list, in order to bring the cursor to my org file, in order to mark a TODO item as DONE, sometimes (this seems like a weird behaviour) emacs will open a new window/frame with the org file to the right of the TODO list.
So now I have:
| org file | todo list | same org file |
side by side.
I have been searching for other ways to fix this, but found nothing.
Any help is much appreciated.


texts: Re-apply table formulas on org-mode export

texts:
I'm using an org-mode file to do some filesystem monitoring. To that purpose I have a table in which I'm calling code blocks through org-sbe in the formulas. It looks like this:

#+NAME: part-size
#+BEGIN_SRC bash :var mach="" :var part="" :var bs="TB" :exports none :results silent
 tmp=($(df -B ${bs} /net/${mach}/${part} | tail -1 ))
 bc -l <<< "scale=2; ${tmp[1]}/1024/1024"
#+END_SRC

#+NAME: part-used
#+BEGIN_SRC bash :var mach="" :var part="" :var bs="TB" :exports none :results silent
 tmp=($(df -B${bs} /net/${mach}/${part} | tail -1))
 bc -l <<< "scale=2; ${tmp[2]}/1024/1024"
#+END_SRC

| machine | partition | size[TB] | used[TB] | available[TB] |
|---------+-----------+----------+----------+---------------|
| mach1   | part1     |     60.0 |     56.0 |           4.0 |
| mach1   | part2     |     15.0 |     12.5 |           2.5 |
| mach2   | part1     |     40.5 |     10.5 |          30.0 |
|---------+-----------+----------+----------+---------------|
| total   |           |    115.5 |     79.0 |          36.5 |
#+TBLFM: @>$3..@>$5=vsum(@I..II)::@2$3..@9$3='(org-sbe part-size (mach $$1) (part $$2) (bs \"1MB\"))::@2$4..@9$4='(org-sbe part-used (mach $$1) (part $$2) (bs \"1MB\"))::@2$5..@9$5=$-2 - $-1

My problem is that I export that file regularly and automatically to a web page but the content of the table doesn't get updated. So I'd like to know if there is a way to automatically re-apply the table formulas on export in the same way that you can run code blocks on export.


texts: eval-last-sexp produces unnecessary void-variable error when using a macro containing eval

texts:
Suppose I have defined the following macro:

(defmacro mymacro (a) "" (eval a))

If I then use eval-last-sexp (i.e. C-x C-e) to evaluate the following,

(defun somefcn (b) "" (mymacro b))

I get the error (void-variable b). However, if I evaluate the definition another way (e.g. using eval-expression), it evaluates fine and works fine.

Note that the following expression evaluates without a problem

(defun somefcn (a) "" (mymacro a))

What is going on?


texts:
I'm using phpunit package
https://github.com/nlamirault/phpunit.el and it works great with php files.
But I have a simple php blog about refactoring ex: http://phprefactor.com/refactorings/decompose-conditional and I would like to run phpunit test in org-mode src block. That would be extremely usefull in blogging about php :)


texts: How to diagnose emacs hanging and 100% cpu on startup?

texts:
How can I diagnose this issue?

I've tried using strace and I see the following that seems to be stuck in a loop:

recvfrom(5, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 567516, 0, NULL, NULL) = 567516
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 567516
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
brk(0x39f4000)                          = 0x39f4000
brk(0x3873000)                          = 0x3873000
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLOUT}])
writev(5, [{iov_base=".\0\2\0\273\2\340\3-\0\22\0\274\2\340\0039\0-a-misc-cinzel"..., iov_len=88}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 88
poll([{fd=5, events=POLLIN}], 1, -1)    = 1 ([{fd=5, revents=POLLIN}])
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1
recvmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\330\tO\0\3\0\377\377\0\0\0\0\20\0\5\0\0\0\0\0\0\0\4\0\23\0\23\0\20\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 4096
brk(0x3934000)                          = 0x3934000
recvfrom(5, "\0\0\0\0\0\0\0\0\1\0\v\0\v\0\20\0\5\0{*\0\0\t\0\t\0\20\0\5\0P$"..., 782684, 0, NULL, NULL) = 782684
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 782684
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
brk(0x39f4000)                          = 0x39f4000
brk(0x3873000)                          = 0x3873000
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLOUT}])
writev(5, [{iov_base=".\0\2\0\274\2\340\3-\0\24\0\275\2\340\3D\0-a-misc-cinzel"..., iov_len=96}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 96
poll([{fd=5, events=POLLIN}], 1, -1)    = 1 ([{fd=5, revents=POLLIN}])
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 1
recvmsg(5, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\1\0\333\tO\0\3\0\372\377\0\0\0\0\20\0\6\0\0\0\0\0\0\0\4\0\26\0\26\0\20\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 4096
brk(0x3934000)                          = 0x3934000
recvfrom(5, "\0\0\0\0\0\0\0\0\1\0\7\0\7\0\20\0\6\0\375\34\1\0\v\0\v\0\20\0\6\0{*"..., 782684, 0, NULL, NULL) = 782684
--- SIGIO {si_signo=SIGIO, si_code=SI_KERNEL} ---
rt_sigreturn({mask=[]})                 = 782684
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
recvmsg(5, {msg_namelen=0}, 0)          = -1 EAGAIN (Resource temporarily unavailable)
brk(0x39f4000)                          = 0x39f4000
brk(0x3873000)                          = 0x3873000
poll([{fd=5, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=5, revents=POLLOUT}])
writev(5, [{iov_base=".\0\2\0\275\2\340\3-\0\23\0\276\2\340\3=\0-a-misc-cinzel"..., iov_len=92}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 92
poll([{fd=5, events=POLLIN}], 1, -1strace: Process 12237 detached


texts: Why isn't this variable being set although it is set in my .emacs?

texts:
In my init.el file I have the following line (setq js2-basic-offset 2)

The last line in my .init.el file is

(add-hook 'after-init-hook
         (lambda ()
           (message "Welcome home %s" (user-login-name))))

When I start emacs and go to the *Messages* buffer, I see:

Loading c:/Users/user/.emacs.d/.mc-lists.el (source)...done
[yas] Prepared just-in-time loading of snippets successfully.
Welcome home user

However, when I do C-h v js2-basic-offset I get

js2-basic-offset is a variable defined in ‘js2-mode.el’.
Its value is 4

  This variable is an alias for ‘js-indent-level’.

Documentation:
Number of spaces for each indentation step in ‘js-mode’.

You can customize this variable

If I go to my init.el file and re-load it, the variable gets set to it's correct value of 2.

Does anybody have any solution for this issue?


texts:
(defun print-org-element()
  (interactive)
  (message (format "%s" (org-element-type (org-element-at-point))))
  (message (org-element-property :title (org-element-at-point)))
  (message (org-element-property :parent (org-element-at-point))))

If caret is on headline, why this func can't print it's parent?


texts:
I want to configure my Emacs install to work with Gmail and I need to find my install location to configure it.

I installed Emacs on my Mac using Homebrew. Where would the install be located it? How can I find it?

Is there any other way to configure Emacs?


texts: Electric/smart parentheses: allow wrapping in a nontransient way

texts:
I like smart parentheses as much as the next person, but there is one situation in which I often get frustrated.  Suppose I have a TeX line reading:

Lorem ipsum dolor sit amet

Now I wish to \emphasize dolor.  Hence I go before it and write \emph{, resulting, with electric-pair-mode and the likes, in:

Lorem ipsum \emph{}|dolor sit amet

(where | is the point).
Now the behavior I'd like to have, is that if I only thereafter move then insert }, then the automagically inserted } is removed.  Graphically, I'd like to end up with:

Lorem ipsum \emph{dolor}| sit amet

rather than:

Lorem ipsum \emph{}dolor}| sit amet

Question: Is there a mode that implements that behavior?  Note that I don't want to use the transient mark.


texts: org html export heading numbers with dot

texts:
I would like to have heading numbers ended with dot in html:

* Heading
* Another heading

to be exported as

1. Heading
2. Another heading

Is there any setting I can use?


texts: Ocaml merlin binary not found / weird string being prepended to merlin-opam-bin-path

texts:
Using spacemacs with the ocaml layer and I get the following error when I edit a source file:
Error from syntax checker ocaml-merlin: Searching for program: No such file or directory, alias: Expected at most 2 args, got 3
/home/username/.opam/default/bin/ocamlmerlin

after describing the variable: merlin-opam-bin-path I get the following:
("PATH=alias: Expected at most 2 args, got 3
/home/username/.opam/default/bin")

Seems like a function is returning an error and the error message and the actual path are being concatenated which results in this error.
This is on spacemacs develop branch, the issue persists in master and in doom-emacs. Not sure how to proceed since I am an emacs newbie.


texts:
Emacs 27.050
Windows 10

Hello.

I want to export python code block from my org file to the file.

When executing block there is the following result:

#+BEGIN_SRC python :session  :results output :exports code :file example.py
print ("foo"+ "bar")
#+END_SRC

Here is what is written to the file example.py
==> foobar

How can I export source code to the file?


texts: (wrong-type-argument stringp nil) [36 times] when loading emacs, even with init.el commented out

texts:
I'm definitely loading the correct file. There's no rogue ~/.emacs or byte compiled file.

When I load emacs, even with my entire init.el commented out, the first line in *messages*, the first line is messages is (wrong-type-argument stringp nil) [36 times].

If I run emacs with my init.el totally commented out, and --debug-init, I don't get backtraces for these errors.

If I invoke emacs with -q, I don't get these errors at all in *messages*.

I'm not sure how to proceed in debugging this, but there are more normal problems too, so I can't just ignore. For example, zenburn won't load - it too fails with (wrong-type-argument stringp nil), but I can get a backtrace for this, and it's related caused by file-name-directory receiving nil.

If I 'manually' load my commented-out init file, by running emacs -q -l init.el there are no complaints about (wrong-type-argument stringp nil) [36 times]
What could be causing these initial, non debug-on-initable stringp errors, and how can I fix them?

EDIT - New information. Deleting every .elc in elpa seems to fix this problem, and recompiling the .elc files re-introduces it.


texts: Preserve original line numbering for a narrowed region

texts: I noticed that whenever I narrow a region in emacs, the line numbering is relative to the narrowed region rather than being relative to the original file. Is there any way I can preserve the line numbering from the original buffer ?


texts: Jump to a bookmark+ dired bookmark from Lisp code

texts:
According to the docu of Bookmark+ this code:

(bmkp-dired-jump BOOKMARK-NAME &optional FLIP-USE-REGION-P)

should allow to quickly jump to a dired buffer that has been bookmarked.

I try to eval (bmkp-dired-jump d_zh_tmp)
thinking it should jump to a bookmark called d_zh_tmp but instead I get an error:

eval-buffer: Symbol's value as variable is void: d_zh_tmp

Any clue what I'm missing here?


texts: How to fix problem with fuzzy matching in helm-recentf

texts:
Something changed recently with Helm and now the matching order of helm-recentf has become less useful.

For instance, in the latest version of Helm (just downloaded from Melpa) if the last visited file was ~/.emacs.d/init.el, and in helm-recentf I type "ini", the first matched file will be ~/bin/unison (or some other file containing "i", "n", and "i").

The logical first match should have been ~/.emacs.d/init.el, as this is the most recently visited file and it has the three letters I'm typing together.

How can I go back to the previous (and correct) behavior?  I imagine that this could be achieved by disabling fuzzy matching in helm-recentf or by changing the scoring rule.  Is there an easy way to achieve any of this?


texts:
I am trying to display images in org files. I have used links such as

[[file:~/path/to/image.png]]

When I click on the link, it gives me another buffer in which there are only symbols. When I put the cursor on the link and type C-c C-x C-v, there is an error message in the minibuffer saying

  No images to display inline

I tried to enable iimage-mode but it doesn't work neither. So, I wonder if there is a problem with the org version installed with Emacs (I am using Emacs 24.4 with Org 8.2.10 and I am on Windows) or is there any configuration that I should do?


texts: Append to exec-path the absolute file names of directories that match a regexp?

texts:
As explained here, by

(setq exec-path (append exec-path '("/sw/bin")))

one can append the directory name /sw/bin to  exec-path.

Is it possible to append to exec-path the absolute file names of all directories on the local machine that match a certain regular expression? (for example to append (full) directory names that begin with some string to exec-path)?


texts: Org function to estimate number of hours of all remaining tasks

texts:
I use Org mode for my todo-list and to track habits. I find it great to look at the past and review the time I spent on each task. I am looking for something that does the same for tasks yet to finish, for example compute the average time taken by completed tasks at level 2 (** DONE ...) and multiply it by the number of level 2 tasks remaining (** TODO ...).

This would help me prioritize, as I have a sense that the amount of tasks that I commit to has been steadily growing.

Does this functionality exist natively or in a package?

Update with example

Here is an example of an Org buffer:

* sprint
** TODO task 1

** TODO task 2

** TODO task 3

*** TODO sub-task 31

*** TODO sub-task 32

** DONE task 10
CLOSED: [2019-12-19 Thu 12:17]
:LOGBOOK:
CLOCK: [2019-12-14 Sat 18:37]--[2019-12-14 Sat 19:37] =>  1:00
:END:

** DONE task 11
CLOSED: [2019-12-19 Thu 18:39]
:LOGBOOK:
CLOCK: [2019-12-19 Thu 17:24]--[2019-12-19 Thu 19:24] =>  2:00
:END:

*** DONE sub-task 12
CLOSED: [2019-12-22 Sun 18:22]
:LOGBOOK:
CLOCK: [2019-12-22 Sun 18:01]--[2019-12-22 Sun 19:01] =>  1:00
:END:

A level 3 task with *** DONE takes on average 1h, a level 2 task alone with ** DONE takes on average 1h30. I would like an output such as:

Org buffer <name>:
1 level 3 task(s) completed, 1:00 on average
2 level 2 task(s) completed, 1:30 on average (2:00 with children)

2 level 3 task(s) remaining, 2:00 left (estimated)
3 level 2 task(s) remaining, 4:30 remaining (6:30 with children)


texts: How to see brief location in the code in C/C++ mode

texts:
While editing a long C++ file, I use rtags to jump around. It would be very handy for me to know where I am in terms of where the cursor is relative to the classes-functions. For example, it would be great if I could have something similar to imenu that would echo Class A -> function F for the current position of the cursor.
I believe that some version of this does exist even in vanilla Emacs, it's only that I cannot find it.


texts: evil mode: switch back to normal mode automatically after inaction

texts:
I was wondering if anyone has ever looked at a way to switch back to normal mode automatically after inaction?  In Vim, there are several methods to do that, such as:

http://vim.wikia.com/wiki/To_switch_back_to_normal_mode_automatically_after_inaction


texts: Expand LOGBOOK on 2nd Tab press? (hook for 2nd org-cycle?)

texts:
In org-mode..

I store lots of state-change messages and timing info in the LOGBOOK drawer.

Most of the time, I don't look into the LOGBOOK drawer, but once in a while when following up on a pending task, I peek into the LOGBOOK drawer to see my note.

I'm looking for a quick-way to expand the drawer using TAB on the head-line.
Currently, 1st tab expands the entry, 2nd tab expands entry + subentry but not the LOGBOOK drawer.

Ideally, I'd like to:

First tab expands the entry,
Second tab expands sub-headings including LOGBOOK drawer (but not PROPERTIES or other drawers).

So I'm trying to tie in a function into the org-cycle-hook, but I have an issue:

(defun my/expand-logbook-drawer ()
 "Expand the closest logbook drawer"
 (interactive)
 (search-forward ":LOGBOOK:")
 (org-cycle)
)

(add-hook 'org-cycle-hook
  (lambda (my/var/curr-state)
    (interactive)
    (message "State changed")
    (when (= my/var/curr-state "all")   ;This comparison doesn't work, error: wrong argument, number-or-marker-p
      (my/expand-logbook-drawer)
    )
  )
)

It seems my comparison function doesn't work. Thoughts?

Note, the org-mode-cycle docu is here


texts:
I'm using doom emacs.
my ~/.doom.d/config.el is -
(use-package! lsp-mode
:hook
(haskell-mode . lsp)
:commands
lsp)

(use-package! lsp-ui
:commands
lsp-ui-mode)

(use-package! lsp-haskell
:after haskell-mode
:config
(setq lsp-haskell-process-path-hie "ghcide")
(setq lsp-haskell-process-args-hie '())
(add-hook 'haskell-mode-hook #'lsp)
)

(use-package! haskell-mode
:mode "\\.hs$"
:config
(rainbow-delimiters-mode)
;; (setq haskell-font-lock-symbols t)
;;(add-to-list ("<>" . "⊕"))
(setq haskell-font-lock-symbols-alist
        (-reject
        (lambda (elem)
        (or))
        haskell-font-lock-symbols-alist)))

whenever i open haskell file i get error File mode specification error: (void-variable lsp-csharp--action-client-find-references) -

OS details -
$ lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description:    Fedora release 32 (Thirty Two)
Release:        32
Codename:       ThirtyTwo

emacs details -
$ emacs -version
GNU Emacs 27.1

How can I solve this issue?


texts:
I use split-frame (split-window-right in setup) for most things but would like Emacs to open some file types (specifically PDF files) in a new frame when using find-file.

Other files (for example .org files) should be opened in split-frame as before. I use pdf-tools for viewing PDFs.

Any suggestions welcome.


texts: Incorrect Line Spacing in (term-mode, ansi-term, eshell, shell) Output

texts:
The output of certain commands in multiple major modes (term-mode, ansi-term, shell, eshell) is incorrectly spaced (see images). This occurs for numerous commands and does not occur in other emulators (such as xterm) or a tty. It even happens when I've launched Emacs without loading an init file (using the -q flag). Does anyone know what might be causing this behavior?

EDIT: I've also tried adding colors to less (through bash and zsh) to no avail within Emacs but it works perfectly within xterm. I believe this is the same issue but hopefully it'll help someone help me.


texts: Disable auto id generation in org-mode html export

texts:
How can I disable inclusion of ids when exporting file as html

Say for example, in the following file I have disabled toc

#+TITLE: Using org-mode
#+HTML_DOCTYPE: html5
#+OPTIONS: toc:nil html-style:nil html-scripts:nil

* Where to start
** Let’s begin here

Now if I export it with M-x org-html-export-to-html, I get the following output:

...

1 Where to start

1.1 Let’s begin here

...

I would like to not add the id attribute at all unless a CUSTOM_ID property is set or toc is enabled.

These randomly generated ids break when regenerated and thus make it less useful as an id that can be linked from some other source.

As a side note, this results in unnecessary noise in commits (that's the primary reason I'm trying to avoid this).


texts: How do I make ido switch to the buffer suggested by the tab-completion candidate?

texts:
I use ido for switching buffers, and it is awesome. I also have (flx-ido mode t) in my init file.

I have run into a problem that causes me to switch to a buffer different from what I was expecting. I will explain with an example:

Say I have two buffers, EmacsBuffer, and EightyMegabytesAndConstantlySwapping. I switch to a different buffer, e.g. *scratch*, and now I want to get back to EmacsBuffer, so I do C-x b and start typing: e m a c... This is what I see:

Buffer: emac[sBuffer]{EightyMegabytesAndConstantlySwapping}
EmacsBuffer

As you can see, the candidate for tab-completion is EmacsBuffer, as I would expect. However, because I have flex enabled, the other buffer is fuzzy-matched, and so it is the candidate to immediately switch to. Since I usually am looking only at what I am typing, I see that EmacsBuffer is the candidate for tab-completion, so I immediately hit RET, and am surprised when it switches to EightyMegabytesAndConstantlySwapping. How do I change this so that the immediate-switch buffer is the same as the tab-completion buffer?

I could just disable flex, but I do find it useful, because e.g. if I don't have a buffer named EmacsBuffer, I like that e m a c s matches EightyMegabytesAndConstantlySwapping.


texts:
I'm fresh to emacs and following manual to practice Query-Replace operation. But I find it not work at all. Type C-h l where it shows ESC 5 seems my OS swallow some key input or emacs parse input occurred some error.

S-M-f also has the problem.

Besides, I'm use emacs -nw to open emacs in terminal. In emacs GUI App, Shift works well.

Thanks


texts: replace all '*' with spaces EXCLUDING org headers?

texts: I converted a file to org-mode, but have a lot of extra asterisks.  I want to replace each * with a space, but I want to exclude the * in a header line.  How do I do this?


texts: how to properly move forward to the next sexp

texts:
I was expecting a similar result with the two snippets below, but this is what I've got:

(with-temp-buffer
  (insert "(a)(b)(c)")
  (goto-char (point-min))
  (list
   (prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
   (prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
   (prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))))

;; result: ((1 (a)) (4 (b)) (7 (c)))

and

(with-temp-buffer
  (insert "(a) (b) (c)")
  (goto-char (point-min))
  (list
   (prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
   (prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))
   (prog1 (cons (point) (cons (sexp-at-point) nil)) (forward-sexp))))

;; result: ((1 (a)) (4 (a)) (8 (b)))

I'm using GNU Emacs 26.3.

How can I get something similar to ((1 (a)) (? (b)) (? (c))) on the second snippet? I think there is a proper way to parse things like this.

There is a caveat, if it matters, the buffer is and must remain read-only.


texts:
Every morning I have the tedious task of staring a dozen or more service on my macOS.

During the day I might want to stop/kill a few of them

Some services error out on startup. I would like to inspect the stdout/stderr.

Sometimes I want to tail the service stdout/stderr.

It would also be cool to be able to freeze/suspend all services,
  for example to allow sufficient cpu for a live video streaming session.

Can emacs help me with this?

Some of the services I start daily:

neo4j start
node server.js
bundle exec rails server -p 3000
bundle exec rails server -p 3001
memcached -d
elasticsearch -D
/Applications/Postgres.app/Contents/Versions/9.6/bin/pg_ctl start -D '/Users/username/Library/Application Support/Postgres/var-9.6'


texts: (emacs:28245): GLib-GObject-WARNING **: IA__g_object_notify: object class `GtkMenuItem' has no property named `label'

texts:
working on Red Hat Gnome 2.16.0 (pretty old, I guess).
Whenever I launch emacs 24.4.1, i keep getting these warnings
popping on the terminal I launched it from.

Can anybody either point me to a possible cause of the issue,
or suggest how to turn these warnings off?

They tend to clog my terminal...


texts:
I've setup the indentation for tabs in Rust to be 2 whitespaces. That's what I want. And in my config it looks like this:

(add-hook 'rust-mode-hook
  (lambda ()
    (setq indent-tabs-mode nil)
    (setq tab-width 2)
    (setq rust-indent-offset 2)))

What's the difference between tab-width and rust-indent-offset or <lang>-indent-offset?


texts: When to specify a package name in use-package's :ensure tag?

texts:
use-package lets you automatically install packages by using the :ensure tag. You can do that as follows

(use-package <package>
  :ensure t)

But for some packages that doesn't work, such as auctex. In those cases you can specify the package to ensure as follows

(use-package tex
  :ensure auctex)

According to this blog/tutorial/site, the reason is

  because, once installed, auctex overrides the tex package.

What does that mean and how can I tell when to do that for other packages?


texts:
When I open SVG files in Emacs they appear blurry. The SVG files themselves are fine (when I open them in Firefox they scale perfectly). My Emacs is compiled with svg support (librsvg), so it should use that for rendering, right?

(init-image-library 'svg)

returns t.

Additionally, I looked at the image overlay properties with describe-char and I'm seeing

(image :type svg :file "/home/matt/src/blog/org/img/test.svg" :scale 1.726482213438735)

which as far as I can tell looks right.

I did notice that display-mm-width and height were way too big and I thought that might be giving librsvg a wrong DPI, so I changed them with

(setq display-mm-dimensions-alist '(t . (126 . 37)))

But that had no effect, even after clearing the image cache.

I also thought maybe imagemagick was getting in the way, so I disabled imagemagick for svg with

(add-to-list 'imagemagick-types-inhibit 'SVG)
(imagemagick-register-types)

but that also had no effect.

How can I get SVGs to display properly?

I'm using Emacs v28, although I had the same issue with 27 and if I remember correctly, 26 as well. In any event I don't think it's a version issue.

Edit:
I was able to get this to work by changing the dvisvgm command options I was using to generate the file. I still don't understand what the issue was because firefox was able to display the SVG fine in either case.

Edit 2:
Here's a MWE of the issue. Note the comment above is wrong, I'd simply changed the dvisvgm scale with the -c flag. This hides the issue, but doesn't seem to fix it and messes up image sizes.

I start with a tex document input:

\documentclass{standalone}
\usepackage{xcolor}

\begin{document}
$a=b+c$
\end{document}

then convert it to pdf with

pdflatex file.tex

and then use dvisvgm with

dvisvgm --pdf file.pdf -n -b min -c 1 -o file.svg

Here's how it appears in an emacs buffer after several image-increase-size commands:

Here's the same file zoomed to 300% in my browser

In reference to the first edit, here's what happens when I change the dvisvgm scale (-c) to 10

That looks nice now, but its much larger and when you zoom in you start to see the blurriness reappear


texts:
I would like to be able to manage external processes from Emacs, in a way that is:

(a) safe w.r.t. arguments escaping for the shell,
(b) efficient both for local and remote processes (using TRAMP w/ ssh).

Here are two solutions I can think of to implement calling a possibly remote process:

using shell-command: this has the advantage that it is fast (meets criterion b), but one needs to pass a full shell command (fails for criterion a).
using start-file-process as recommended by the TRAMP documentation: this is nice in terms of arguments handling (criterion a), but a new SSH connection seems to be called for each process, which dramatically slows things down in remote configurations (criterion b).

NB: these solutions also differ in that (1) is synchronous whereas (2) is asynchronous, but I don't mention it because (a)synchronicity doesn't matter for my application.

It looks like option (2) is slow because it spawns a new ssh process, whereas option (1) reuses an already existing one. Is there any high-level function allowing to call a possibly remote process, while still being efficient by reusing an existing connection if possible?

Below is the code I used to benchmark both solutions:

(let ((test/remote-buffer (find-file "/xxx.xxx.xxx.xxx:/home/LOGIN/"))
      (test/output-buffer (get-buffer-create "*hostname*")))
  (with-current-buffer test/output-buffer
    (erase-buffer))

  (with-current-buffer test/remote-buffer
    (setq test/begin (current-time))
    (shell-command "hostname" test/output-buffer)
    (message "1-Elapsed: %f" (float-time (time-subtract (current-time) test/begin))))

  (with-current-buffer test/remote-buffer
    (setq test/begin (current-time))
    (set-process-sentinel
     (start-file-process "hostname" test/output-buffer "hostname")
     (lambda (p e)
       (message "2-Elapsed: %f" (float-time (time-subtract (current-time) test/begin)))))))

yielding output:

1-Elapsed: 0.010178
Tramp: Opening connection for xxx.xxx.xxx.xxx using scp...
Tramp: Sending command `exec ssh -q   -o ControlPath=/tmp/tramp.12155IuC.%r@%h:%p -o ControlMaster=auto -e none xxx.xxx.xxx.xxx'
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on `xxx.xxx.xxx.xxx'
Tramp: Opening connection for xxx.xxx.xxx.xxx using scp...done
2-Elapsed: 1.116449

In the case of local processes, both implementations take a similar elapsed time, which is negligible (and often faster for solution 2).


texts:
I have written a simple Python 3 script:

#!/usr/bin/env python3

print('Hello world!')

The script works from the shell:

$ ./hello-world
Hello world!

Then, I have written some Lisp to run the script:

(defun hello-world-process-sentinel (process event)
  (message "Process: %s; Event: %s" process event))

(defvar hello-world-process (make-process :name "hello world"
                                        :buffer (get-buffer-create "*hello world*")
                                        :command "hello-world"
                                        :sentinel #'hello-world-process-sentinel))

(process-status hello-world-process) returns run, but the *hello world* buffer stays empty, and the sentinel doesn't get called.


texts: Cannot enable org-roam mode - No EmacSQL SQLite binary avaiable

texts:
I've installed org-roam (Windows 10, 26.3 x86_64-w64-mingw32) but when I try to call org-roam... then Emacs show:

Loading d:/MEGAsync/Emacs/config/init.el (source)...done
Could not find C compiler, skipping SQLite build
Org-roam initialization: (error "No EmacSQL SQLite binary available, aborting")
Could not find C compiler, skipping SQLite build
emacsql-sqlite-ensure-binary: No EmacSQL SQLite binary available, aborting

Please help :-)


texts:
window 10, Emacs 26.1, Dired+

Suppose I open in Dired+ mode some folder:

d:/TEMP/test_folder/folder2/

I need next:

When press button "End" then go to the last file in the folder. Like this:

When press button "Home" then go to the first file in the folder. Like this:

When press button "Backspace" then go to the up folder. Like this:


texts: How can I add Oauth2 to `smtpmail-auth-supported`?

texts:
My organisation has switched to advanced security methods for authentication. Say a user has the following information they use to download email,
oauth2_client_id
oauth2_client_secret
oauth2_request_url
oauth2_refresh_token

How can I add the oauth2 to smtpmail-auth-supported? Its current value is (cram-md5 plain login). I am looking for a way to authenticate while sending email using Emacs.


texts: How to return to previous point after `org-clock-goto`?

texts:
In org-mode, C-c C-x C-j executes org-clock-goto, jumping the cursor to the currently active or most recently used clock.

After using this, I almost always want to go back to the point where I was, often another buffer.  I would expect running org-clock-goto a second time would get me there, toggling back to where I started. But unfortunately, that doesn't work. org-clock-goto does only what the name says.

In search of a solution, I came up with a pair of simple elisp functions:

(defun my/org-clock-goto ()
  (interactive)
  (bookmark-set "before goto clock")
  (org-clock-goto))

(defun my/org-clock-return ()
  (interactive)
  (bookmark-jump "before goto clock"))

This only works if I am starting off in a buffer which is a file (not *scratch* for instance). But more importantly, what I really want is a single function bound to C-c C-x C-j that will let me jump between the original point and the last clock.

Any hints?


texts: simple function in dired to create a dir with current date?

texts:
so im trying to create a simple script to create a directory in dired with a pre defined string (the current date). i have another script that inputs the current date in a format i want

(defun z-insert-date (&optional addTimeStamp-p)

"Insert current date and or time. In this format yyyy-mm-dd.
 When called with `universal-argument', insert date and time, e.g.    2012-05-28T07:06:23-07:00
Replaces text selection.See also `current-date-time-string'."
(interactive "P")
(when (region-active-p) (delete-region (region-beginning) (region- end)   ) )
(cond
((equal addTimeStamp-p nil ) (insert (format-time-string "%d%m%Y")))
(t (insert (current-date-time-string))) ) )

now im struggling how to bring it all togheter. i have this

(defun z/dired-insert-date-folder ()
 ""
 (interactive)
 (dired-create-directory (z-insert-date))
 )

but this dosent work and dosent seem the proper way to do it :)

can anyone point me in the right direction? maybe the z-insert-date function isnt really needed (i want my date to have the format of %d%m%Ythough


texts: python: flake8 ignore __main__ scope in function's scope

texts:
I am getting following warning message for the following code: F821 undefined name 'variable'. // variable becomes color red.
#!/usr/bin/env python3

def doo():
    print(variable)  # <= F821 undefined name 'variable'

if __name__ == "__main__":
    doo()

But if I create variable in __main__ the warning message is gone, but still variable in undefined under the doo() function.
#!/usr/bin/env python3

def doo():
    print(variable)

if __name__ == "__main__":
    variable = 100
    doo()

[Q] Is there any way to prevent this error message where main's scope would be ignore in functions' scopes?

Setup:
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(require 'flycheck)
(require 'flycheck-mypy)

(add-hook 'python-mode-hook 'flycheck-mode) ;(add-hook 'after-init-hook #'global-flycheck-mode)
(add-hook 'python-mode-hook
          (lambda ()
            (setq flycheck-python-pylint-executable "~/venv/bin/pylint")
            (setq flycheck-pylintrc "~/.pylintrc")))


texts: How can I run (recenter) after (call-interactive ...) that jumps to a buffer?

texts:
I would like to jump to a buffer using rtags for eg.

Example snippet:

(defun generic-lookup () "Follow link/goto line."
  (interactive)
  (cond
    ((string= major-mode "c-mode")
      (progn
        (call-interactively 'rtags-find-symbol-at-point)
        (call-interactively 'recenter)))))

However this gives the error:

progn: ‘recenter’ing a window that does not display current-buffer.

How to recenter after calling a function that opens a new buffer?


texts: Can't type unbalanced closing curly brace in Clojure mode

texts:
When I open a Clojure file, and I'm not using Paredit, I expect to be able to type unbalanced parentheses and brackets. I can type any of these characters: ()[]{, balanced on not. But if I try to type a } that has no matching start {, it won't let me.

Why is this? And how do I turn it off? I expect this type of behavior in paredit-mode, but outside of that mode I want to be free to type any characters.

GNU Emacs 25.3.1 on macOS. Clojure mode 5.8.2.


texts: Best pratice advices for abbrev vs. completion vs. snippets

texts:
I am not sure if this is really a proper question but I am interested in having some opinions about the most efficient usage of Emacs' abbreviations features (abbrev/dabbrev) in combination with auto-completion/company and/or yasnippets.

At the moment I am using for my org mode stuff and some lisp tinkering abbrev-mode as a basic typo-correction system, i.e. substituting teh with the without further bothering me. yasnippets I use for specific and bigger expansions, e.g. special file headers for my hobby project etc. For everything in between I use auto-completion, e.g. saving a few key strokes while typing a function name. I am pretty happy with this and try to review my workflow constantly where I should define another abbreviation  of where a snippet would save some time on common constructs. This means dabbrev is not needed at all for me, because either auto-completion jumps in automatically or I have already a larger snippet (or should have one).

Is this a common workflow? How to you use these different features in parallel?


texts: How to force a Python shell to re-import modules when running a buffer?

texts:
I'm using C-c C-c to send a buffer to a Python shell. The buffer has an import at the beginning. I found that if I modify the module I'm importing, it doesn't reflect the changes if I run the buffer again with C-c C-c (it seems the Inferior Python is doing the import only once).

How can I force the Python shell to import again the modules already called in the first run of the buffer?


texts: HTML tag auto open/close/expand/quote problem

texts:
I'm a novice at emacs use in general, and new to spacemacs, so I'm hoping this is just a case of missing a trick or two. I am working in a symlinked app on Mac OSX, not in the terminal.

I have a pretty much stock config of spacemacs, added a few extra layers, in evil-mode. I'm trying to do some work with HTML, using web-mode, and it isn't behaving entirely as described:

If I type <li I get a dropdown menu that completes words, but doesn't complete the open/close tag (is this intended behaviour, or is it supposed to complete your selection if you make one?).

If I type
</ it will autocomplete properly to

, matching indicated behaviour. I have tried setting web-mode-tag-auto-close-style to 2 in dotspacemacs/userconfig () per this answer to allow completion at opening tag closure instead of closure tag opening (i.e.
 -->

) but have had no luck getting it to work. Am I putting it in the wrong place or using the wrong syntax?

If I type d/s/ as in the example it results in <d/> instead of the indicated
|
. Yet if I type d TAB s TAB it produces <d>s</d>| and if I then scroll back to s and hit TAB again, it produces <d><s></s></d> I have not been able to find more detailed information about this function of web-mode, am I using it incorrectly?


texts: How to find out if a file is visible for my shell script?

texts:
I want to implement a script that I can call from my file explorer to be able to open a new frame with the chosen file (emacsclient -nc $1), but only if the file does not already exist then I simply want to focus the right frame (or buffer). So how to I find out if a frame is already visible?

So far I tried to use this function get-buffer-window(How to know my buffer's visible/focused status?) and call it with emacsclient -e, but I do not know what argument I should give it (I am an emacs newbie here btw :D).


texts: helm-swoop: how to make it behave more like isearch?

texts:
Following up on a recent question of mine (here), I would like helm-swoop to behave in a certain way when pressing C-s that parallels the behaviour of isearch:

C-s in a buffer: open helm-swoop with empty search field.
C-s in helm-swoop with empty search field: activate previous search.
C-s in helm-swoop with non-empty search field: go to next match.

The tricky parts are 2. and 3. obviously. Any suggestions?


texts: How to force Emacs or pinentry to forget wrong GPG password?

texts:
I use mu4e, mu4e-send-delay to send emails with a delay, GPG to store my SMTP authentication, and pinentry to access GPG files. When I am prompted for the GPG encryption password in the mini-buffer but am typing in another buffer and don't notice it, Emacs remembers that entry and keeps trying to open the GPG file with that wrong password. I then get the *Error* buffer next to my other buffer:

Error while decrypting with "/usr/local/bin/gpg":

gpg: AES encrypted data
gpg: gcry_kdf_derive failed: Invalid data
gpg: encrypted with 1 passphrase
gpg: decryption failed: No secret key

and a user dialog Emacs-x86_64-10_14, Buffer *temp* modified; kill anyway?, and buttons with Yes and No.

Emacs has the same behavior if I restart it, probably because pinentry remembers the password for the session.

How can I force Emacs or pinentry to prompt for a new password? And could I force that prompt to happen in a user dialog, which is more noticeable than the mini-buffer?


texts: How do I associate a file extension with a specific mode?

texts:
I would like emacs to switch to gnuplot-mode when I open a file ending in .g or .gnuplot.

I tried

;; gnuplot mode-name
(add-to-list 'gnuplot-mode '("\\.g\\'" . gnuplot-mode))

or

;; gnuplot mode-name
(add-to-list 'gnuplot '("\\.g\\'" . gnuplot))

Neither works.  How do I make Emacs behave this way?


texts: Emacs sometimes starts automatically recentering cursor position

texts:
At some unidentifiable point of time (can be in a few days, can be in a few hours) something clicks in Emacs and it starts automatically recentering my cursor position. Like I move my cursor somewhere and in a few seconds the buffer is shifted so that cursor is now vertically in the middle of the window. Once this happens, it persists in all buffers until I restart Emacs.

I can't figure what triggers this, but I noticed that the probability of of this happening increases if I use GUI commands like customize-group, customize-variable etc.

I thought that maybe my smooth scrolling setup was to blame. I used to have this in my init.el:

(setq-default redisplay-dont-pause t
              scroll-margin 1
              scroll-step 1
              auto-window-vscroll nil
              scroll-conservatively 10000
              scroll-preserve-screen-position 1)

Now I replaced that with smooth-scrolling package and the mentioned behavior still occurs.

Can anyone help with this? I run Emacs as a daemon, and being forced to restart it because of such silly issue enrages me.


texts: remap evil-mode normal-state folding key to folding-mode folding-toggle-show-hide

texts:
Is there a way to remap the "zc" or "zf" key combo for code folding from evil-mode normal-state to folding-toggle-show-hide?

I tried
(define-key evil-normal-state-map "zc" 'folding-toggle-show-hide) without success.

F1 k zc returns:

z c runs the command evil-close-fold, which is an interactive compiled
Lisp function in 'evil-commands.el'.

It is bound to z c.

(evil-close-fold)

Close fold at point.
See also 'evil-open-fold'.


texts: Spacemacs, python, refactoring - Change name of variable

texts:
I know that there are ways in emacs to refactor python scripts and e.g. change the name of a variable. What is the best way to do this in spacemacs? The standard refactoring only seems to offer a few things around the imports.

rope is installed on my system.


texts: How to preserve list indentation after RET in markdown-mode?

texts:
When I'm editing a markdown-mode document with a list like this:

* foo
* bar
  * baz

and my cursor is at the very end of the baz line, and I press RET (which is bound to markdown-enter-key) then the baz line gets dedented so the file looks like this:

* foo
* bar
* baz

But what I would like is for the indentation to behave like most programming modes, i.e. keep baz where it was, and on the newline align my cursor with the baz bullet point so I can start typing another bullet point at that level, e.g.

* foo
* bar
  * baz
  *

How can I configure my emacs to do this?


texts: Why does (require 'use-package) fail from my init file, but succeed interactively?

texts:
With the following init file, emacs chokes on the first line:

bash-4.3$ pwd
/Users/sean/.emacs.d

bash-4.3$ cat init.el
(require 'use-package)
(use-package package)

bash-4.3$ emacs --version | head -n 1
GNU Emacs 24.4.1

However, when I run emacs 'normally' (with this init file) and perform the require manually, it succeeds.  Why would this happen?  What can I do to fix it that won't have me changing load-paths every time I update use-package?

It is interesting to note that, by specifying the load manually, no errors are reported:

bash-4.3$ emacs --batch -L init.el

However, starting emacs interactively shows the issue.


texts: ipython in emacs: Figure windows “not responding” on Windows 7

texts:
I am trying to get a good setup to do scientific python on windows 7. To be complete, I am using Anaconda for Python package management, and emacs 25.2 (the native windows build from GNU, not the cygwin build). My goal is to use elpy, with ipython as the Python shell. The problem is figure windows.

I have found some similar issues reported before, but the solutions don't work for me. In particular, my init.el has (elpy-enable) and (elpy-use-ipython).

So elpy and ipython work fine, until I do figure(1). I get a figure window, control is back at the ipython prompt, but the figure window says "not responding." And if I plot something it doesn't appear. Various attempts to use ion() and show() haven't worked.


texts:
I'm trying to define a minor mode that rebinds M-q to a modified version of fill-paragraph. What I've written so far:
(defun myfun ()
  (message "myfun called"))
(define-minor-mode mymode
  "Test for minor mode keymap."
  :lighter " MM"
  :keymap '(([M-q] . myfun)))

doesn't work, as M-q is still bound to fill-paragraph when mymode is active. Can anyone spot the issue with my code and tell me how to rebind that key properly?


texts: Loading addition org files along with default scratch buffer

texts:
I do a lot of my programming in Haskell and Python. I've started maintaining a personal cheat-sheet for each of these languages for common constructs and tasks I often come across.

Hence whenever I start an emacs process, in addition to the scratch buffer how do I load my files HaskellCheatSheet.org and PythonCheatSheet.org everytime?


texts: Marking files in dired with subdirectories

texts:
I'm trying to mark a set of files (including subdirectories' files) in dired matching a regex, so I do:

C-U C-x d -alR RET e:/ RET

Followed by %m and enter my regex.  No matches.

If, however, I enter the same regex on a "normal" dired (i.e. no -R switch) then the regex matches.

Am I doing something wrong?  I've tried with emacs -Q and get the same result.

edit:

It seems the actual regex is significant; entering \.mp3$ works as expected, but if I try to anchor the regex using ^music marks  everything under the e:/music folder.


texts:
What is the difference between the two functions func1 and func2?

(defun func1 (arg)
  (if (listp arg)
      (mapcar (lambda (x) (func1 x)) arg)
    arg))

(func1 (list 1 2 3))

(defun func2 (arg)
  (if (listp arg)
      (mapcar func2 arg)
    arg))

(func2 (list 1 2 3))

func1 works fine, but func2 throws void-variable func2. Why?


texts: "Error in process sentinel: Selecting deleted buffer" when exiting Emacs?

texts:
I am getting the following message when I do C-x C-c to exit Emacs:

  error in process sentinel: Selecting deleted buffer

So instead of exiting Emacs like normal, I am forced to close it through Task Manager.

An Internet search and some testing shows that it might be because of package prelude or flycheck but I have not installed it.

Q: How to find which package is causing this error and remove it? How can I debug this error?


texts: Paste very specific Unicode in scratch buffer freezes emacs -Q

texts:
I experienced a freeze which can be reproduced very easily on GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.18, cairo version 1.16.0) of 2020-08-25 .

emacs -Q
Copy the Unicode U+27B0 into the scratch buffer: ➰
Emacs frozen for a whole minute and displays ➰.

Remarkably, the response time for other symbols in this Unicode table is quite different, e.g.

➑ takes 30 seconds
➐ is instant.

Is this issue known?
Updates
what-cursor-position
C-u C-x = on the pasted symbol gives (screenshot because Emacs frozen):

Profiling & Benchmarking
Unfortunately, this scenario escaped the profiling...

...and the benchmarking which outputs immediately the result when the symbol is not yet present.


texts: Can org-babel replace code with code output on html export?

texts: I'm using org-mode to generate web pages of my notes.  Can I embed code to generate additional HTML, etc?  org-babel will generate results but it seems to show the results in addition to the code. I would like the code to create html that would replace the code itself.


texts: Is there a way to suggest label names in org-mode latex export?

texts:
In the org-mode example below, I would like to be able to specify the label name to be used by the latex export back-end. Is there such a way?

I have two reasons:

To be able to mix org-style references [[fig:label]] and latex-style references \ref{fig:label} in the same document. This is not necessary (in fact, probably bad practice) if I have everything in the org document. However, sometimes I \input{} an external latex block with a \ref{} somewhere, so I need to control the named reference.
Whenever I export my document, I will get a different latex label (here: orgee8497f). This will have my git back-end think that the document has changed, when in fact it hasn't.

Org source:

This is some text. Here I can refer to Figure [[fig:label]]. However,
if I try to refer to \ref{fig:label}, I get an undefined reference.

#+CAPTION: This is a caption to the figure.
#+NAME: fig:label
\begin{figure}
  figure stuff goes here
\end{figure}

Latex export:

This is some text. Here I can refer to Figure \ref{orgee8497f}. However,
if I try to refer to \ref{fig:label}, I get an undefined reference.

\begin{figure}
  figure stuff goes here
\caption{\label{orgee8497f}
This is a caption to the figure.}
\end{figure}


texts: Suggestions for a well-thought structure, for instant results inside browser from buffers

texts:
Situation
First, I hope you will not mind my poor English. When you're working with websites/webapplications, there is a good chance that you will work with HTML/CSS files. When editing such files in buffers, I save it every time and reload the browser to view my changes (I have a multimonitor setup),
which can be quite cumbersome.
It would be awesome when the changes in the buffer you're editing are sent to your web browser as you type. Instantly see the results of editing your HTML without even bothering to save.
For that, you have Impatient mode. And there is a demo of it. I appreciate the work that's done, but it's not a perfect solution.
For example, I'm editing webpages within a sort of intranet environment.
That's makes it complicated. I will illustrate it with some examples.
Example 1
The HTML-page foo.html is nested inside another HTML page called bar.html.
The bar.html contains CSS and layout-rules, which will be also applied on the nested html-pages inside bar.html.
When I I'm editing the page foo.html, the HTTP server from impatient-mode will serve live foo.html inside browser. But I see only a bleak HTML-page without any markup/styling and the structure is not quite right. The styling and definitons of structure are defined in the file bar.html.
Example 2
On our intranet, we have a template engine, like Mustache solution. For example, we have some PHP-code:
  $foo = "bar";

Then in your HTML-page the template engine is parsing the values from the backend to the frontend.
 <b>{{foo}}</b>

With that, you will usually see in your browser:
bar
But with the impatient-mode, you see in your interactive HTML-page:
{{foo}}
Instead of bar.
This is because impatient-modeand http-server will be hosting their own page, and doesn't have any notion about the backend/template engine or anything. It's mainly useful for hosting stand-alone pages.
I would love to have real interactive editing that works like a charm. So I guess I need to develop a package for it.
Possible structure for new package
We run a Emacs HTTP server which will run locally on the port 8080 of the localhost.

So in the HTML page, you need to include a little javascript snippet.
Pseudocode:
<script>
    Hey Javscript engine inside browser, do polling to output of http://localhost:8080/
</script>

<html>
    <div>
        Your regular HTML page.
    </div>
</html>

Ok, imagine a situation. You're editing some text on line 24 inside a buffer. Then we need a hook that indicates that the user leaves a row. If so, pass the edited row from Emacs buffer to the Emacs HTTP server.

But that's brings us to a new problem. What if the user creates a new line inside buffer, or creates a new line in the middle of of a line? Then Javscript will replace the wrong line.
It could be also a problem when the HTML page is nested into another HTML-page, as illustrated in example 1
Then you're editing a 30 lines HTML page in the Emacs buffer. But in the browser, the whole source code counts more than 100 lines.
Another solution is to replace all the content of HTML-page with the new values of the buffer. But this is not desirable, because in large HTML-files, there is enormous load  for Emacs/ Emacs HTTP server to pass the whole buffer every second, and for the Browser javascript engine to replace all the lines in the current tab.
The interactive environment would not be so responsive, and very lagged. So this is not a good basis to develop a package.
I'm thinking about another ways to have a good workflow.
But I'm still struggling with connecting the dots, but that's what we programmers are supposed to do, right?
Any another suggestion for connecting the dots would be greatly appreciated.


texts: How can I clear the contents of the clipboard before calling clipboard-kill-region?

texts:
I use clipboard-kill-region to copy contents from Emacs to other programs. But sometimes, it copies the same content twice into the clipboard.
It looks like,

/home/user/.emacs/home/user/.emacs

when I copy the filename

/home/user/.emacs

Is there a way I can empty the clipboard contents before calling clipboard-kill-region?

My complete function is shown here; it is a utility function to copy the absolute path of currently opened file in Emacs buffer:

(defun sk-copy-file-name ()
  "Put the current file name on the clipboard"
  (interactive)
  (let ((filename (if (equal major-mode 'dired-mode)
                      default-directory
                    (buffer-file-name))))
    (when filename
      (with-temp-buffer
        (insert filename)
        (clipboard-kill-region (point-min) (point-max)))
      (message filename))))


texts: Emacs-Lisp mode indentation problem when doc string contains left parenthesis in first column

texts:
Usually when I write Lisp code (in an Emacs-Lisp mode buffer), I can press TAB (bound to indent-for-tab-command) to indent code properly. However, if I write a defun with a docstring (longer than one line) that also contains a left parenthesis (in the first column), TAB stops working for the given defun. For example:

(defun test ()
  "Hello
(ok) xxx."

nil)

If I put cursor on n in nil and press TAB I would expect nil to be indented 2 places, but it does not work ( unless I remove the left parenthesis ( from the first column on the second line of the docstring).

I am using Emacs 25.1 on Ubuntu 16.04.


texts: Configure ryo-modal to execute function from evil-ex-commands alist

texts:
I would like some help in configuring ryo-modal, via use-package, to run a command from the evil-ex-commands alist, using ("ll" (cdr (assoc "wq" evil-ex-commands))); however, I'm getting the Error (use-package): ryo-modal/:config: Wrong type argument: listp, cdr error. Here is the whole ryo-modal + use-package code I'm using:
(use-package ryo-modal
    :demand t
    :general
        (:keymaps 'override
            (general-chord "kk") 'start-ryo)
    :config
        (ryo-modal-keys
            ;; First argument to ryo-modal-keys may be a list of keywords.
            ;; These keywords will be applied to all keybindings.
            (:norepeat t)

            ;; Adapted From The Comments:
            ;; Answer: https://emacs.stackexchange.com/a/21364
            ;; User: https://emacs.stackexchange.com/users/8578/pyrocrasty
            ;; ("pp" save-buffers-kill-emacs)
            ;; ("pp" (cdr (assoc "q" evil-ex-commands)))
            ;; ("oo" save-buffer)
            ;; ("oo" (cdr (assoc "w" evil-ex-commands)))

            ("ll" (cdr (assoc "wq" evil-ex-commands)))

            ;; ("qq" kill-emacs)
            ;; ("qq" (cdr (assoc "q!" evil-ex-commands)))
            ("kk" start-ryo)
        )
    :straight
        (:host github :repo "kungsgeten/ryo-modal" :branch "master"))


texts:
I've downloaded a copy of GUI emacs from here and have been using it since then, but it crashes pretty often when I have 20+ frames opened. (I don't know if it's also the case for when there are just few frames.) I heard that if you use the version you have built from the source code, it rarely crashes. How can I do that for a GUI emacs? Can I build some source code? I tried the terminal version of emacs before, but I learned that there was no way to move the cursor with the simple left clicks in it (It bypasses the left clicks. I could option-click, though). I'd like to move the cursor with clicks kind of frequently, so it should be the GUI version.
Mac OS X Mountain Lion, Emacs 24.5.9.0 (also crashes frequently in 24.4)


texts: Editing multiple source blocks in one buffer

texts:
I've got multiple source blocks which are all tangled to the same file. When I invoke C-c ' inside one block, only this specific block is shown in a new buffer.

Is there a possibility to show all parts of this file inside this buffer (instead of just this specific snippet)?

Example:

#+begin_src emacs-lisp :tangle foo.el
(defvar *ok* "")
#+end_src

This is where the variable is stored...

#+begin_src emacs-lisp :tangle foo.el
(defun add-one (n) (+ 1 n))
#+end_src

If I hit C-c ' in the first block I get:

(defvar *ok* "")

but I want:

(defvar *ok* "")
(defun add-one (n) (+ 1 n))


texts:
I have some trouble with my emacs indentation. Since I have enabled electric-pair-mode my indentation is screwed when I use hanging braces. Example (| is my cursor):

int main(int argc, char *argv[])
{
        if(true)|
        return 0;
}

If I now press { I get this:

int main(int argc, char *argv[])
{
  if (true) {
  }
        return 0;
}

Why is this if-block not correctly indented with my c-basic-offset of 8 like the return statement? My relevant config:

(electric-pair-mode 1)
(setq c-default-style "linux")
(setq-default indent-tabs-mode nil)


texts:
In dired, when you use i to see the contents of subdirectories, it looks sort of like this:

/dir:
file1
subdir1
subdir2

/dir/subdir1:
foo
bar

/dir/subdir2:
baz

I want to make it look more like this

/dir:
file1
subdir1
  foo
  bar
subdir2
  baz
  bam

Is there a way to do that?


texts:
When I'm looking for documentation or information, I press C-h and then f or k or anything else. Then a help window will pop up.

I was wondering if I could configure the help window, that he will pop up on the bottom, instead on right and with much smaller window?
Is there any property/variable to manage this behaviour? If this is not specificed for the help-mode, then I might develop a package for that.


texts: Cannot access text properties because of hl-line

texts:
I want to change somes faces in my system, but each time I want to access describe-text-properties I get an answer with hl-line, for every text displayed in the buffer.

Therefore, I cannot investigate and change the settings I want.
For example, I have an issue with variable-pitch-mode and the emphasis in orgmode. I would like to be able to understand what is going on.


texts: Show current org-mode outline position in modeline

texts:
I'm using org-mode with really huge files (what I love in org-mode is having everything in a single file).

I would like to know where I am in the file by having a look at the modeline.

If I have the following :

* Foo
** Bar
*** Dump
[cursor being here]
** Egg

I'd like the modeline to show me something like Foo > Bar > Dump

Any ideas on how to achieve that?


texts: How could I see the output of my Python code in the echo area?

texts:
When I press C-c C-c(python-shell-send-buffer), I get output shown below. Afterwards when I do the same operation (C-c C-c) I always see Sent: #!/usr/bin/env python3... in the echo area.

I just want to see the output rather than seeing the send code.

=> How can I instead see only the output of the code in the echo area (if possible)? or show it on the minibuffer compact as possible and close it when C-g is pressed.

The output in the *Python* buffer:
#!/usr/bin/env python3
...
... print("hello world")
import codecs, os;__pyfile = codecs.open('''/var/folders/mx/m3c2fd193h169gg6nd5x3p480000gn/T/pyK57xMh''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/mx/m3c2fd193h169gg6nd5x3p480000gn/T/pyK57xMh''');exec(compile(__code, '''/Users/alper/code/doo.py''', 'exec'));
hello world
#!/usr/bin/env python3
...
... print("hello world")
import codecs, os;__pyfile = codecs.open('''/var/folders/mx/m3c2fd193h169gg6nd5x3p480000gn/T/pyK57xMh''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/mx/m3c2fd193h169gg6nd5x3p480000gn/T/pyK57xMh''');exec(compile(__code, '''/Users/alper/code/doo.py''', 'exec'));
hello world

My setup in my init file:
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))

(setq python-shell-interpreter "python3"
      python-shell-prompt-detect-failure-warning nil
      flycheck-python-pycompile-executable "python3"
      python-shell-completion-native-enable nil
      python-shell-completion-native-disabled-interpreters '("python3")
      elpy-shell-echo-output nil ; https://github.com/jorgenschaefer/elpy/issues/1550#issuecomment-574512892
  )


texts: Is it possible to displaying Inline Images in Emacs markdown-mode

texts:
I am using GNU Emacs 26.3 inside a remotely connected linux machine.
I was wondering is it possible to display inline images in Emacs markdown-mode? Seems like it is possible (link) in org-mode?
Using M-x markdown-toggle-inline-images gives Cannot show images message in the minibuffer.

basic setup:
(add-to-list 'load-path "~/.emacs.d/markdown-mode")

(autoload 'markdown-mode "markdown-mode.el"
  "Major mode for editing Markdown files" t)

(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

md file:
# test

![](images/hellow_word.png)


texts: How to remove ^M from org-babel code block executing on Linux from Windows OS?

texts:
My problem is that every line executing on the remote Linux machine seems to be including a trailing ^M (as is shown as ? in the file name apa? below).

Content of my .org document:

* Test
#+BEGIN_SRC sh :dir /plink:pi@raspberry:/home/pi/test
touch apa
touch bepa && echo
ls -al
#+END_SRC

#+RESULTS:
: total 8
: drwxr-xr-x  2 pi pi 4096 Nov 23 21:35 .
: drwxr-xr-x 10 pi pi 4096 Nov 23 20:07 ..
: -rw-r--r--  1 pi pi    0 Nov 23 21:35 apa?
: -rw-r--r--  1 pi pi    0 Nov 23 21:35 bepa

If I ssh to my Linux machine and type the file name using tab completion I see

pi@raspberry:~/test $ ls apa^M

Running plink directly from a cmd.exe does not add ^M to the filename:

c:\>plink.exe -l pi raspberry "cd test && touch cepa"

I have saved the org document with Unix line endings, but I get the same result.

My current workaround is to add the && echo to eat the ^M, but I'd really like to find a better one...

I'm running Emacs 25.1 and org-mode v8.3.6 on Windows 10. My Linux machine is a raspberryPi running raspian jessie.


texts:
I wanted to add a latin capital O with circumflex [ô] to a file in emacs, but for some reason all my attempts lead to the character being replaced by a question mark ?. I tried :

M-x insert-char LATIN CAPITAL O WITH CIRCUMFLEX
M-x insert-char u00D4
M-x insert-char U+00D4
C-x 8 RET LATIN CAPITAL O WITH CIRUMFLEX
C-x 8 RET u00D4
C-x 8 RET d4
C-x 8 RET U+00D4

I am not sure what the problem is. When I use UNICODE hex instead of its full name the error wrong type argument: characterp nil comes up


texts: How to specify the buffer mode on the command line?

texts:
I want to open a file in makefile-gmake mode.  Is there a way to do this from the command line?

I'm looking for something like:

$ emacs -m makefile-gmake filename

I do not want to change any config files or embed a mode comment in the file itself.  I want a solution that works for any filename.


texts: Avoid company backend in a specific mode

texts:
In my dot-emacs I have the following backend for Company:

 (add-to-list 'company-backends 'company-dabbrev t)

In Eshell, I use another company backends. So it's configured as the following:

 (add-hook 'eshell-mode-hook
        (lambda ()
          (set (make-local-variable 'company-backends)
               '((company-shell company-eshell-history)))))

But in eshell-mode Company is also using company-dabbrev backend for the completion candidates, next to the backends company-shell and company-eshell-history.

So I'm wondering how I could 'tell' company do not use company-dabbrev backend when the buffer is in eshell-mode. I couldn't find any answer/solution on this.


texts: How to use org-refile to move a headline to a file as a toplevel headline?

texts:
I wish to have an "inbox.org" file where I collect notes into (trying to implement GTD :P), and then later move things around to the proper places. I understand that org-refile is the way to do this (move things around), but it seems that it is only possible to refile stuff under headlines, not directly into files. What I want is to take a note from my inbox.org and add it as a toplevel heading in the proper org file.

Is this by any chance possible? I read the info on org-refile-targets and it seems like it is only able to refile into an existing headline, although the info on org-refile-use-outline-path says:

  org-refile-use-outline-path is a variable defined in `org.el'. Its
  value is "file" Original value was nil

  Documentation: Non-nil means provide refile targets as paths. So a
  level 3 headline will be available as level1/level2/level3.

  When the value is `file', also include the file name (without
  directory) into the path.  In this case, you can also stop the
  completion after the file name, to get entries inserted as top level
  in the file.

However, autocompletion on the org-refile prompt does not even provide the file names as options. Is there a way to do this with org-refile-targets or any other means?

I'm running gnu emacs 24.5.1 on windows 8.1 64bit.

Thanks in advance ;)


texts:
After setting (setq org-log-done t) which adds timestamp to done tasks.

** DONE a testing task :emacs:
CLOSED: [2019-08-29 Thu 09:37]

The problem is that the finished task is not displayed in agenda even though switch timestamp from inactivate to active.

If could not show the done jobs on agenda
find tasks markded today

How could filter the done tasks on a specific day?


texts: Is it possible to use mozilla's rr with gdb multi-window?

texts:
I have started using mozilla's rr (timetravelling debugger, github here) on the command line for debugging c++ code.

In emacs I can start it with gud-gdb and writing rr replay (as mentioned here or here).

I cannot start it with gdb followed by rr replay, which is how I usually start gdb in order to work in gdb many-window-mode. (which I have enabled as a setting).

When I try and start it that way I get these error messages to start off with:

Loaded symbols for /lib64/ld-linux-x86-64.so.2
0x00007f53bd89a6b0 in _start () from /lib64/ld-linux-x86-64.so.2
(rr) Undefined command: "1-inferior-tty-set".  Try "help".
(rr) Undefined command: "2-gdb-set".  Try "help".
(rr) Undefined command: "3-gdb-set".  Try "help".
(rr) Undefined command: "4-enable-pretty-printing".  Try "help".
(rr) Undefined command: "5-file-list-exec-source-files".  Try "help".
(rr) Undefined command: "6-file-list-exec-source-file".  Try "help".
(rr) Undefined command: "7-gdb-show".  Try "help".
(rr) Undefined command: "8-stack-info-frame".  Try "help".
(rr) Undefined command: "9-thread-info".  Try "help".
(rr) Undefined command: "10-break-list".  Try "help".
(rr) Undefined command: "11-thread-info".  Try "help".
(rr) Undefined command: "12-break-list".  Try "help".

followed by this error message when I try and run anything from within the  gdb session:

(rr) continue
Undefined command: "-interpreter-exec".  Try "help".
(rr) run
Undefined command: "-interpreter-exec".  Try "help".
(rr) break
Undefined command: "-interpreter-exec".  Try "help".
(rr)

Does anyone know if it is possible to run rr with emacs many-window-mode?


texts: Respect default action in keymap with Meta keys?

texts:
I have a keymap which uses [t] to bind a default command which should be executed if any key not bound in the map is pressed. This is described in the documentation of define-key and it works for the most part. BUT if I bind a Meta combination in that map, any other Meta key combination will skip this default command from there on.

Example Code to illustrate the problem:

(let ((map (make-sparse-keymap)))
  (define-key map (kbd "M-a") 'some-command)
  (define-key map [t] (lambda ()
                        (interactive)
                        (message "this will be skipped by Meta combinations")))
  (set-transient-map map))

I want to be able to bind a command to a Meta combination, but let other Meta combinations still run the default.

How to do that?


texts: What is the difference between #'fun and 'fun?

texts:
In this configuration file, I've discovered the #' operator, which I did not know, used as:

(add-hook 'LaTeX-mode-hook #'flyspell-mode)

I'm wondering what is the difference with writing just

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

The only documentation I could find about this #' operator hints that it may have some effect when the code is byte-compiled, but I don't understand how.  Is there any difference in this case?  If yes, how can I observe it?


texts: Another way to install emacs on OS X using homebrew

texts:
It seems homebrew has removed all the options (incl. --with-cocoa) for brew install emacs. Now it recommends to use brew cask install emacs to get a built binary from https://emacsformacosx.com/. However, it is not clear to me which options are used to build the binary. The ones I care about are:

--with-modules --with-cocoa --with-gnutls --with-librsvg

Is there still a way to use homebrew to build the latest emacs but with the options above? If not possible, then how do we build emacs from source on OS X (10.12+) with those options


texts: Displaying adjacent boxed text (Zero-length/invisible delimiters for text properties?)

texts:
I'm interested in displaying adjacent boxed text using the :box t face property in the following manner for adjacent text:

Is there an accepted convention for delimiting/isolating text properties between otherwise uninterrupted text?

For review (from Face Attributes):

  :box

  Whether or not a box should be drawn around characters, its
  color, the width of the box lines, and 3D appearance.

Since face and text properties are attached to characters this particular face property is sort of an odd member among text/face properties.  Almost all other properties I can think of would not be expected to make a visual distinction that a text property was "interrupted" between adjacent visible characters.  Whereas with :box you may wish to have a box boundary between respective "boxes".  I can also imagine wanting to "reset" a stipple pattern (thereby potentially interrupting the tiling pattern).  If you can think of any other circumstances please comment.

The only approach that came to mind other than using a null character (which doesn't work) was to include an arbitrary string and mark it invisible:

(insert
 (concat
  (propertize "foo"
              'font-lock-ignore t
              'face '(:box t))
  (propertize "X"
              'invisible t)
  (propertize "bar"
              'font-lock-ignore t
              'face '(:box t))))

Incidentally I suspect that I found a rendering bug in emacs while considering this.  The following code renders as follows, but transitions to the desired rendering when the cursor moves to adjacent to the invisible character.


texts: emacs-ycmd flycheck integration doesn't support C++11

texts:
I have successfully configured Company-ycmd and ycmd as my C/C++ auto completion engine. It works great but the Flycheck-ycmd seems not support the C++11 syntax.

And it give the following errors:

  Such as: "nullptr is not compatible with c++98"


texts: Dealing with a table with too many row in org-mode

texts: When a table gets too long, how can you deal with it? Is there any way of collapsing parts of it? Or maybe dividing it in multiple tables and still perform operations (like adding a column) on all of them as one?


texts: Do not require tags when doing org-capture

texts:
￼
I have this org-capture template:

 ("a" "Appointment or call" entry (file+headline "~/todo.org" "Tasks")
      "* %? %^G \n %^t \n %i")

It asks for a tag. Sometimes I insert tags, sometimes I don't. In the past I could ignore entering a tag by just pressing ENTER. But from a point in time, Emacs shows me a list of tags I have used in the past and now there is no way to NOT specify a tag, because I can't escape that window. Any ideas how to use no tags?

Thanks!


texts:
I would like to be able to toggle abbrev-mode on and off with ease. Of course I could use

M-x abbrev-mode

But I would like to set this to some keyboard shortcut. To this end I've added the following to my .emacs file

(global-set-key (kbd "<f7>") (lambda () (interactive) (abbrev-mode nil)))

But this doesn't have the desired effect. How do I enable this functionality?


texts: Do I really have no fixed-width fonts installed?

texts:
In trying to debug a font issue in Emacs 26.3 on Windows 10, I ran the following, in the *scratch* buffer:
(defun font-existsp (font)
    (if (null (x-list-fonts font))
        nil t))
font-existsp
(font-existsp "-Misc-Fixed-Medium-R-Normal--18-120-100-100-C-90-ISO8859-1")
nil
(font-existsp "-Misc-*-Medium-R-Normal-*")
t
(font-existsp "*-Fixed-*")
nil

And I interpret these results to mean that I don't have any fixed-width fonts installed on my system, which seems awfully strange for a stock Windows 10 system.
Am I misinterpreting these results?


texts: How can I configure projectile to use my `grep-find-command`?

texts:
I have a customized grep-find-command.

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(grep-find-command
   (quote
("find . -type f -exec grep  -nHi  \"{}\" \";\"" . 31))))

How can I configure projectile to use this find & grep command? Because the default one won't work on MS Windows.


texts: Is it possible to transparently kill & yank (copy & paste) org mode text with footnotes?

texts:
When copying text with numbered footnote markers from one org-mode file to another, I have been manually copying and pasting the corresponding footnotes (sometimes renumbering them in the process).  This is difficult and error-prone.  Is there a way to have Org automatically copy and renumber the associated footnotes along with the main body text?

It seems like org-mode used to support inline footnotes (like LaTeX) which would be easier to copy and paste than numbered footnotes -- see the discussion archived at https://lists.gnu.org/archive/html/emacs-orgmode/2009-01/msg00004.html . But I don't think that feature exists in the current version.

If nothing like this exists, I might be motivated to add it myself, but I wanted to check first whether there is an easier way.


texts:
I basically stumbled onto this older question how to merge cells in an org-table. This would be very useful to create a header, something like:

|Merged header|
|----+--------|
|  / |  <     |
|  1 |  2     |
|  3 |  5     |
| 23 | 14     |

Is this possible ?

Thanks


texts: Customizing ace-window to use letters instead of numbers

texts:
ace-window numbers windows for selection by the user (ace-select-window, ace-swap-window, etc.).

How can this identification scheme be replaced with alphabetic / alpha-numeric identifiers?

The rationale is: letters are generally slightly easier to type, so I'd like to use letters. (at least before numbers; what kind of user has more than 26 windows open?!? :-)


texts:
In emacs.el I am using the following construct to set up an org-remember template:

(setq org-remember-templates
    '(("Todo" ?t "* TODO %^{Brief Description} %^g\n%?\nAdded: %U" "~/GTD/newgtd.org" "Tasks")
))

That works OK, but now I'd like to introduce parameters into this template definition. Specifically, I'd like to use a variable (or a constant) in place of "~/GTD/newgtd.org"

Let's say I have this definition earlier in the emacs.el:

(setq todo-file (concat org-directory "todo.org"))

How can I use thid variable todo-file in the setq org-remember-templates definition?

I have tried 'todo-file, "todo-file and simply todo-file in place of "~/GTD/newgtd.org" with no luck. What is the secret to reference a variable value here?


texts: How to get Exec-path-from-shell working in Spacemacs

texts:
I'm using the latest version of emacs, with and without a custom MacOS build (homebrew-emacs-plus). So, I'm trying to use spacemacs on MacOS, and I can't get it to pick up the $PATH on my host system. So when I try to run a command like M-x magit-status, I get the error message.

apply: Searching for program: No such file or directory, git

Spacemacs is using Steve Purcell's exec-path-from-shell. This SO question isn't quite solving it. And I've tried the below configuration (not using exec-path-from-shell), but no dice. I can get it working on my custom emacs configuration. But I’m trying to transition to spacemacs. And this is a blocker. Anyone know howto solve this?

(let ((path (shell-command-to-string ". ~/.bash_profile; echo -n $PATH")))
  (setenv "PATH" path)
  (setq exec-path
        (append
         (split-string-and-unquote path ":")
         exec-path)))


texts: imenu list automatically toggled in new frame

texts:
I tried to run imenu-list-show in hook which is called after frame creation but it doesnt work as expected.
It toggled the imenu-list in new frame but my keyboard arrows become unresponsive.

Code is:

(add-hook 'after-make-frame-functions
          (lambda (new-f)
            (select-frame new-f)
            (imenu-list-show)))


texts:
I'm trying to create *Help* buffers in Emacs, documenting functions defined in other languages.

I can create a simple help buffer easily:

(defun wh/help-hello-world ()
  (interactive)
  (with-help-window (help-buffer)
    (princ "foo_bar is a function.\n\nIt does stuff.")))

However, I want to add a clickable link in my *Help* buffer, which Emacs seems to call a button. I can see describe-function-1 calls help-xref-button which creates a button.

However, if I call insert-text-button the same way help-xref-button creates buttons, then 'help-args seems to expect an elisp function and path.

(defun wh/help-hello-world-button ()
  (interactive)
  (let ((buf (help-buffer)))
    (with-help-window buf
      (princ "foo_bar is a function.\n\nIt does stuff."))
    (with-current-buffer buf
      (let ((inhibit-read-only t))
        (insert-text-button
         "example.txt"
         'type 'help-function-def
         'help-args '(button-type-subtype-p "/usr/share/emacs/24.5/lisp/button.el.gz"))))))

How can I create an Emacs button pointing to an arbitrary line in an arbitrary file?


texts: Org agenda clockreport - how to group by categories instead of by files?

texts: If I open org agenda and press R, I get a clockreport, which is grouped by files. I want to group it by categories instead. How do I do that?


texts: Magit-todos warning: File is too long, consider excluding it from scans

texts:
Whenever I do something in Magit buffer I get this warning:

Warning (magit-todos): File has lines too long for Emacs to search.  Consider excluding it from scans: path/to/file

In particular it complains about socket.io.js.map

I tried excluding the file from projectile - no effect. I don't understand which scans the warning is talking about.


texts:
In latex-mode when I use TeX-insert-macro to type a \input{...}
macro, Auctex conveniently offers filename completion, which is great.
However, it seems to search a lot of places to compile the completion
list, because emacs hangs for almost a minute on my poor little
laptop.

Is there a way for TeX-insert-macro to offer dumb filename completion?
By "dumb", I mean the one you get when calling find-file. Most of
the time the file I want to input is just one directory away, so that
would be more than fine.

If that's not possible, is there another way to speed it up?
I noticed when I insert the \include macro the list of filenames is
much shorter, so maybe there's a way to use that list for the \input
macro as well.


texts: Should I use "require" or "load" when writing my own configuration?

texts:
I am following this tutorial, and the author is doing something like this:

~/.emacs.d/init.el

;; add your modules path
(add-to-list 'load-path "~/.emacs.d/custom/")

;; load your modules
(require 'setup-foo)
(require 'setup-bar)
......

~/.emacs.d/custome/setup-foo.el

(provide 'setup-foo)

;; various configuration settings for foo

~/.emacs.d/custome/setup-bar.el

(provide 'setup-bar)

;; various configuration settings for bar

I am wondering what's the advantage of doing this instead of simply loading everything.

From my understanding, the point of using provide/require is to enable "lazy loading", so that a feature is only loaded when needed, but init.el always load the setup-*.el scripts, which renders this practice pointless to me.

I wouldn't say this question is a duplicate of What does (require 'package) mean for emacs and how does it differ from load-file?, though they're indeed related. My question ask on how to use the two different mechanisms, whereas the other one is about what they are.


texts: Can I reload a library and have defvar re-assign values?

texts:
I am developing a library and would like to reload it after editing without exiting Emacs (assume that it is on load-path):

(load-library "myname")

When I do this, Emacs doesn't pick up changes to defvar-bound variables.

I don't want to call eval-defun (C-M-x) manually on each top level form.  Does M-x eval-buffer respect defvar/defcustom?


texts: Set different highlight-line color for emacs --no-window

texts:
How can I set a different color if I am using emacs on terminal (emacs --no-window)?

I use a grey highlight line when using emacs with GUI because my background theme is white. Here is the code I use in my ~/.emacs.

(global-hl-line-mode +1)
(set-face-attribute 'hl-line nil :inherit nil :background "#e6ffff")

However, when I am using emacs on terminal it has a default black background and this highlight colour looks awful.


texts: How to debug seemingly random crashes of AucTeX?

texts:
My Emacs crashes seemingly randomly. Is there a way to view the Messages buffer after it crashed? Or is there another standard way of approaching this problem? I'd like to see an error message so that I can start pinpointing the source of the crash.

I run Arch Linux with Emacs 25.1.1 and AucTeX 11.89-3