texts: With incremental compilation and changed files `compilation-goto-error` moves to wrong line

texts:
I work on a typescript project that I compile with webpack serve, using projectile-run-project. My *compilation buffer shows the webpack output, which includes typescript errors. After some webpack hacking, I managed to get the errors into a compilation mode compatible format. When I select an error (which runs compilation-goto-error on this error), emacs opens the respective file in another buffer and jumps to the correct line. This works well so far.
When I change files, webpack serve immediately recompiles the project, and echos new error messages into *compilation*.
When I now edit a file, emacs seems to memorise error locations at the start of the compilation. Meaning:

I start compilation
I edit file index.ts to add a new line after line 4
webpack reports an error at index.ts:6
compile-goto-error goes to index.ts:7

I assume that this happens because compilation mode knows that line 6 in index.ts at the start of the compilation is now at line 7. However, I don't need that memoization, as the compilation reports current (correct) lines. How can I make compilation-goto-error use current lines, not cached onces?


texts: How to obtain file path from LISP file loaded by command line?

texts:
Given you started Emacs passing a LISP file through command line:

emacs --load .custom.d/init.el

how it could be possible to dynamically obtain custom.el directory location?

Since the default init.el is not used, buffer-file-name is not a possible solution:

(file-name-directory (or load-file-name (buffer-file-name)))

I have also tried to eval default-directory as follows:

cd /tmp/username
mkdir custom.d
touch custom.d/init.el
emacs -nw --load custom.d/init.el --eval "(print default-directory)"

however the directory from where emacs was invoked (i.e. /tmp/username in) is shown, not the init.el folder.


texts:
Let's say we have

* Task
:LOGBOOK:
CLOCK: [2018-05-08 Tue 00:00]--[2018-05-08 Tue 1:00] =>  1:00
:END:
** Subtask
:LOGBOOK:
CLOCK: [2018-05-08 Tue 01:00]--[2018-05-08 Tue 2:00] =>  1:00
:END:

Is there a way to create a function which takes all of the sub-clocks of Task and merges them at the parent level? I.E.:

* Task
:LOGBOOK:
CLOCK: [2018-05-08 Tue 00:00]--[2018-05-08 Tue 1:00] =>  1:00
CLOCK: [2018-05-08 Tue 01:00]--[2018-05-08 Tue 2:00] =>  1:00
:END:
** Subtask
:LOGBOOK:
:END:


texts:
When I try to do this:

(global-set-key (kbd "C-x 8 l") (lambda () (insert "λ")))

It just doesn't work:

Wrong type argument: commandp (lambda nil (insert "λ"))

Does anyone know a decent way to do this?


texts: Block syntax highlighting breaks in org-mode in this case, how to fix?

texts:
I have this in my init.el to enable block code syntax highlighting in org-mode:

(setq org-src-fontify-natively t)

I have also this for org-babel:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (ditaa . t)))

when I insert source code < s followed by TAB to draw something using ditaa (same problem with emacs-lisp code, it seems to be a general SRC code block problem), the syntax highlighting breaks when I write this line:

#+BEGIN_SRC ditaa :file "./foo.png" :cmdline -r

No syntax highlighting but code can be evaluated

However, when I leave only #+BEGIN_SRC sitting alone in the first line I get the highlighting right, but code will not be evaluated in this case when I hit C-c C-c. Even one space after SRC is enough to break that syntax highlighting. What is going on? Can anyone help me fix it?

Syntax highlighting is right but code cannot be evaluated

Note

GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian)
GNU Emacs 25.1.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-09-29; nothing changed.
Org mode version 9.0.4 (release_9.0.4-248-gdef8a8)
Org mode version 9.0.5 (release_9.0.5-288-g4caad0) problem presists
theme used is moe-dark

Update

When I run emacs --vanilla from the terminal, the problem disappears. So what is going on? What to do next to find the cause from here?


texts:
Is there a way to merge single files in magit like you would do from this question or something equivalent. Namely:

$ git checkout source_branch -- <paths>...


texts: Display done org-habit habits in a different face

texts:
I'm experimenting with org-habit and currently have org-habit-show-all-today set to t so I can see a habit even when I've done it for that day.  I'm doing that because I want to get the little reward of seeing the line of stars right away :-)

However, I also want to not have habits I've already done distracting me from habits that aren't done.

How can I display those in a different face, so I can make the text of the habit "greyed out"?

Investigating further, what-cursor-position with a prefix argument reveals (I've removed the properties other than the faces):

There are text properties here:
  done-face            org-agenda-done
  face                 org-scheduled-today
  mouse-face           highlight
  undone-face          org-scheduled-today

The face associated with done-face, org-agenda-done, is already "greyed out" (grey italic text), which is the face I want.  However, I think what determines the face is just the text property face, which is associated with face org-scheduled-today (medium weight blue text) -- that makes the text appear in blue, not grey or italic.

Something I don't understand the intent of -- though resolving this may not be needed to answer the question -- Why would these habit TODO items have face org-scheduled-today when they are not scheduled for today?  I think the following code (from org-agenda.el's org-agenda-get-scheduled) is responsible for that, but I don't understand why that behaviour is wanted:

    (let* (
  ...
       (face (cond ((and (not habitp) pastschedp)
            'org-scheduled-previously)
               (todayp 'org-scheduled-today)
               (t 'org-scheduled)))
         )
      (org-add-props item props
    'undone-face face
    'face (if donep 'org-agenda-done face)
...

So I think face is set to org-scheduled-today ("Face for items scheduled for a certain day") because it's a habit that appears on today's date, even though it's not scheduled for today's date.

Here's the item in question (which appears as I've described above at the time of writing, i.e. when today's date is 2018-11-26):

** shave yaks
SCHEDULED: <2018-11-27 Tue 08:00 .+1d>
:PROPERTIES:
:STYLE: habit
:LAST_REPEAT: [2018-11-26 Mon 11:23]
:END:
- State "DONE"       from ""           [2018-11-26 Mon 11:23]


texts: How copy file from Windows to smartphone (Symbian) in dired mode?

texts:
Windows 10, Emacs 25.1, Dired+.

When I connect (via microUSB) my smartphone (Nokia) to my computer, the Windows 10 success detect new device.

And as result I can success copy/move file from Windows machine to smartphone.

Is it possible to do same in Emacs in dired mode?


texts: Is it possible to open .iso file in emacs dired?

texts:
When I open .iso file in dired, I have to mount it a temp folder

mount -t iso9660 foo.iso temp

then navigate to that folder, read the files.

Is it possible to open .iso file in dired directly? (possibly dired create a temp folder?)


texts:
Is it possible to hide TODO timestamps in Org mode?  More specifically, I want to keep the timestamps associated with TODO states (CLOSED, SCHEDULED, DEADLINE) from being shown in the Org buffer, even if they exist in the file.

Why?  I'm working on the same file in both Emacs and Orgzly (Org app for Android).  I don't use timestamps in Emacs, but Orgzly puts them in by default and has no option not to do so, although it does allow you to hide them in its UI.


texts: tree-mode, view selected file preview in right side window

texts:
I am using tree-mode to see the folder contents in a tree like design.
It is working awesome. I would like to customize the enter key  behaviour.

1)  key press on a file node must show the file's contents in preview mode. Pressing enter shows the preview but the cursor is as well taken to the new window which is not desired.

2)  key press on directory nodes must expand/toggle the folder to show its contents in a sub-tree and not open the next window in dir-mode


texts: Mutually recursive bytecode function throws an error when I try to eval

texts:
The following workflow contains the steps needed to reproduce the error:
;; Byte-compile the function.
(byte-compile '(defun flatten (x)
                 (cl-labels ((rec (x acc)
                                  (cond ((null x) acc)
                                        ((atom x) (cons x acc))
                                        (t (rec (car x) (rec (cdr x) acc))))))
                   (rec x nil))))

;; `pp-eval-last-sexp` output.
(byte-code "\300\301\302\"\207"
           [defalias flatten
             #[(x)
               "\302\303\211    \302\")\207"
               [--cl-rec-- x nil
                           #[(x acc)
                             "\306  \n\211\204\0\306\202'\0\f:\204\0\fB\306\202'\0\f@
\fA\"\307*\204\0)\207"
                             [retval x acc acc x --cl-rec-- nil :recurse]
                             4]]
               4]]
           3)

;; Taking out the actual bytecode so as to eval the expression.
(#[(x)
  "\302\303\211 \302\")\207"
  [--cl-rec-- x nil
              #[(x acc)
                "\306   \n\211\204\0\306\202'\0\f:\204\0\fB\306\202'\0\f@
\fA\"\307*\204\0)\207"
                [retval x acc acc x --cl-rec-- nil :recurse]
                4]]
  4] '(1 2 3))

As shown, I byte-compile a function and try to eval it with the argument '(1 2 3). It throws the following error and I don't know why:
Debugger entered--Lisp error: (wrong-type-argument listp 1)
  #f(compiled-function (x acc) #<bytecode 0x4c32e213416e008>)((1 2 3) nil)
  #f(compiled-function (x) #<bytecode -0x1a3b6ef3b20a60c7>)((1 2 3))
  eval((#f(compiled-function (x) #<bytecode -0x1a3b6ef3b20a60c7>) '(1 2 3)) nil)
...
...
...

I've pinpointed that perhaps (cl-labels ((rec (x acc) has something to do with this.


texts:
Is there a pre-defined emacs function or emacs add-on package that will fill a rectangle with numbers?  For example:

012       9
010  or  10
008      11

The closest I've found is rectangle-number-lines, which seems to have limitations.
If I'm not mistaken, it doesn't allow decreasing numbers and forces step-value=1
(e.g. can't have 1, 3, 5).


texts: Configure jabber without writing password in plain text

texts:
I find jabber to be a fantastic tool, but it worries me a little that my password is written in plain text in my init file.
Is there a way to configure my jabber login credentials without writing them in plain text?

Just to be clear, I don't want to be asked for a password either. So the solution would need to hook into some external keyring/database or just do some encrypting to obscure the password.

Ideally, the solution would be OS independent, but my priority is getting it to work on Linux (with gnome) which is where I use jabber the most.


texts: How create keybindings for Evil command line?

texts:
For example, I have created a keybinding for Emacs mini-buffer, that will receive the [f9]-key as a confirmation (usually the RET-key).

 (define-key minibuffer-local-map (kbd "<f9>") 'exit-minibuffer)

I use Evil mode, so would like to make a keybinding to RET in the Evil command buffer (after when you're pressing :). So that he will interpret the [f9]-key as an Enter/confirmation key.

When looking up in the documentation of Evil, I notice there are 6 state maps defined, but none of them applies on the command line, while in Vim you could map the keybindings on the command line.

Any solution on this?


texts: How to check if a variable is a file local variable

texts:
Some background, I have some code that sets a default compile command depending on the mode.  However, in some files, I've used the add-file-local-variable-prop-line to create a more specific command, and this overwrites that.  I need to check if compile-command has been defined for the file, so I don't assign a default value when the file already has a compile-command.

I've tried using file-local-variables-alist, but it's value is nil, even when there are local variables.


texts: Org-mode set a global configuration variable for `#+OPTIONS: ^:{}`

texts:
I add #+OPTIONS: ^:{} to all of my org-mode documents so _ is not interpreted and displayed directly as a LaTeX subscript unless I use write thing_{subscript}.
How do I set this globally in my emacs config? I can't find the variable in the documentation and this answer https://emacs.stackexchange.com/a/59135/16023 does not seem to work for me.
Would love a link to the spot in the documentation that explains this as well.


texts: Move point to previous/next parent heading

texts:
This answer describes how to move point to the next or previous heading.

I would like to move point to the next or previous heading, which is one level higher up the tree (at the parent level).

For example:

* One
** OneA
** OneB []
** OneC
* Two

If point is the [], I would like to move point to * One or * Two immediately.


texts: Calling function from hook not working as expected

texts:
I am trying to add a hook which calls shr-render-buffer after loading a file in html-mode. This is what I came up with:

(add-hook 'html-mode-hook (lambda () (call-interactively #'shr-render-buffer)))

This works, except not quite as expected.

Calling M-x shr-render-buffer in an html-mode buffer splits the current frame vertically, and puts the rendered output in the bottom window with the html still visible in the top window. On the other hand, if I do find-file and open an html file, my hook code splits the frame vertically, but buries the html buffer, so that I have the rendered buffer on the bottom, and whichever buffer I was visiting when I did find-file at the top.

What is happening here? Seemingly, something with the timing is getting messed up from the way I am calling shr-render-buffer, but I don't really know what/how.


texts: describe-key for sequence mappings such as those in evil-mode

texts:
So, in evil mode, something like d i b (delete inside brackets) is a common occurence. However, describe-key will immediately describe just the d part. Using (describe-key "d i b") produces: d i b is undefined.

How would I view a description of such a keybinding? And how are they called anyway, modal, sequential?


texts: How to automatically accept: Please answer y or n. Process `LaTeX' for document `program' running, kill it? (y or n)

texts:
When I save a LaTeX file, I want to compile it as well on the background. In order to achieve it I have done following module:
(defun my-run-latex ()
  (interactive)
  (save-all)
  (setq TeX-command-force "LaTeX")
  (setq TeX-clean-confirm t)
  (TeX-command-master))

(add-hook 'LaTeX-mode-hook (lambda ()
                 (local-set-key (kbd "C-x C-s") 'my-run-latex)))

But when I do that I keep having following message:
Please answer y or n.  Process `LaTeX' for document `program' running, kill it? (y or n)

What may be the reason for this message? Is it possible to ignore it or automatically confirm it via y?


texts: Clipboard manager will not work in terminal Emacs

texts:
Emacs 25.1.50, GTK+ version 3.18.9 on GNU/Linux, version 4.4.
Gnome-terminal as xterm terminal emulator.

When using clipboard (as in, I copy some text from my operating system/browser), and paste it in Emacs GUI version, it works fine. The GUI Emacs works in pair with the clipboard manager, which is supported by many X desktop environments.

However, when I'm using Emacs with emacs -nw, the clipboard seems to be inaccesible from the terminal version of Emacs. When reading the Emacs documentation about clipboard, I tried to let the console Emacs communicate with the clipboard with the following settings:

(setq
 x-select-enable-clipboard t
 x-select-enable-primary t
 x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)
 x-stretch-cursor t)

Without any luck. Other packages like simpleclip will not work in terminal Emacs too. So I'm out of ideas. I'm not sure if this is related with the terminal itself of the console-based Emacs.


texts: set up custom port for default ssh connection in tramp

texts:
I am wondering what is the best way to set up a default port that is not the standard 22 port. I regularly log in with tramp to remote systems and would like to avoid having to put in #1234 every time I connect.

My tramp config (org-mode) looks as follows

* Tramp
For TRAMP to work with ssh-key, install the programm ssh-askpass
 (https://github.com/markcarver/mac-ssh-askpass)
 C-x C-f /ssh:you@remotehost|sudo:remotehost:/path/to/file

#+BEGIN_SRC emacs-lisp
(defun url-clear-cookies ()
  "Clear all cookies."
  (interactive)
  (setq url-cookie-storage nil)
  (setq url-cookie-secure-storage nil))

(use-package password-cache
  :ensure nil
  :custom
  ;; Never expire passwords
  (password-cache-expiry nil))

(use-package tramp
  :ensure nil
  :custom
  (tramp-default-method "ssh"))

(defun add-ssh-agent-to-tramp ()
  (cl-pushnew '("-A")
              (cadr (assoc 'tramp-login-args
                           (assoc "ssh" tramp-methods)))
              :test #'equal))

(use-package tramp-sh
  :ensure nil
  :custom
  ;; Use out-of-band method for big files
  (tramp-copy-size-limit (* 0.5 1024 1024))
  :config
  ;; Use the PATH from the remote
  (add-to-list 'tramp-remote-path 'tramp-own-remote-path))

(use-package tramp-gvfs
  :ensure nil
  :after tramp-ftp
  :config
  ;; Prefer gvfs for FTP
  (add-to-list 'tramp-gvfs-methods "ftp"))

(defun local-file-name-as-sudo (file-name)
  "Transforms /foo/bar.ext into /sudo::/foo/bar.ext"
  (concat "/sudo::" file-name))

(defun tramp-file-name-as-sudo (file-name)
  "Transforms /scp:user@host:/foo/bar.ext into /ssh:user@host|sudo:host:/foo/bar.ext"
  (let* ((parts (tramp-dissect-file-name file-name))
         (host (tramp-file-name-host parts)))

    ;; replace "host:" by "host|sudo:host:"
    (setq file-name (replace-regexp-in-string (regexp-quote (concat host ":"))
                                              (concat host "|sudo:" host ":")
                                              file-name t t))

    ;; replace scp by ssh otherwise sudo doens't work
    (setq file-name (replace-regexp-in-string "^/scp" "/ssh" file-name))))

(defun buffer-file-name-as-sudo (&optional buffer)
  "Return BUFFER filename as sudo"
  (require 'tramp)
  (let* ((buffer (or buffer (current-buffer)))
         (file-name (expand-file-name (or (buffer-file-name buffer) dired-directory))))
    (if (tramp-tramp-file-p file-name)
        (tramp-file-name-as-sudo file-name)
      (local-file-name-as-sudo file-name))))

(defun find-alternative-file-with-sudo ()
  (interactive)
  (find-alternate-file (buffer-file-name-as-sudo)))
#+END_SRC


texts: Eval SQL in Org Babel using sql-connection-alist for credentials

texts:
I would like to evaluate SQL source blocks in Org Babel using the connections I have set up in sql-connection-alist from sql-mode. This way I can save database credentials in a private (Elisp) file and share the files with the queries.

Is there any way to configure this in Org Mode?


texts:
There seems to be a bug in clojure-mode (mentioned here) because it does things in a mode hook (for paredit-mode) but doesn't undo them when the mode is turned off.

I understand that add-hook can register a function to run when a mode is turned on, but is there a way to run a hook when a mode is turned off?

Here's a github link see the clojure-mode code that adds the hook.


texts: Hide ifdef(or gray out) through compile_command.json

texts:
I've just finished to set up LSP with ccls and company packages.
It works but I have one more possible wish that such LSP packages could do.
Now I'm using hide-ifdef package to gray out the inactve code area but it reads preprocessors from my certain .dir-locals.el.
As you know, such preprocessors are already in compile_commands.json.
I wonder some of LSP package could do the same thing - ie graying out the inactive area. Or whether I have to write a new package to do so.
Please share your experience.


texts:
I have an org-mode file in standard agenda format:

* Dentist
<2015-10-01>
* Put up shelves
<2015-10-05>

I'm just starting to use org-agenda but I still use just that single file a lot just as an regular org-mode fully-expanded tree, and it's handy to have it kept sorted in date order.

Currently I sort it by hand.  How can I get emacs to sort it by date?


texts: hs-minor-mode with python.el - hide if statements, for/while loops, etc

texts:
Currently, I use the hs-minor-mode to collapse my python code and make it easier to work with - however, by default this only folds def my_function(): blocks. Is it possible to get it to work with if, for, while etc. blocks as well?

If not, does anyone know a better option for code folding? I do use C-s and M-x occur to move around my code already, I just sometimes like to fold my code so I don't have so much to look at.


texts: How to bind (C-x C-x ) to save buffer and exit emacs?

texts:
I have to press C-c C-shift-c on the keyboard to exit emacs. It's a bit time consuming, and Fn + F10 + up_arrow_key is a bit far in order to exit from the menu bar.

When I run the code:  (global-set-key (kbd "C-x C-x") 'save-buffer-kill-terminal)

I get the following error: command-execute: Symbol's function definition is void: save-buffer-kill-terminal

Can you please explain why the function is void, and what I am doing wrong?


texts: How to treat keybinding as input to search?

texts:
In some cases [0/4]

Keybinding is too much!
Keybinding naming is not intuitive. like projectile-rails-console has keybinding [prefix + r].
Some keybindings naming will conflict under the intuitive principle. For example: projectile-rails-find-test, projectile-rails-find-template, [t].
Borrow the idea from helm: search, filter, narrow to one candidate.

So I want to create an emacs extension to do better job.
For example, I have following keybindings bind to those commands.

    [C-c C-r r] -- projectile-rails-console
    [C-c C-r t] -- projectile-find-test
    [C-c C-r T] -- projectile-find-current-test
    []          -- projectile-goto-template-at-point

Below is a list of things I'd like to achieve:

UI Features

Borrow the idea from helm: search, filter, narrow to one candidate.
Borrow from “guide-key”, show the keybindings popup.

Core

When you input a prefix, like [C-c], then the extension start popup the following keybindings like “guide-key”, then user can continue press key just like normal use “guide-key”, but user also can type key like [tem], this will filter out keybindings which bind to command projectile-rails-goto-template etc.
I know I can archive this by directly use [M-x] to select command, but it is not intelligent, Emacs separated keybinding and command. I want to provide a smart way to do both in one place.
The big problem is how to let Emacs treat the following key input as search input, instead of continuing key press.

I created an github reposition at here: emacs-intelligent-key-guide.

Does anybody knows that is possible? And how? I need some hints.
Thanks in advanced.
And if you're interested in this project, welcome to contribute.

My real question is:
How to treat following keybinding behind prefix map as normal input for searching commands?


texts: Variable names for the nw drop down menu faces?

texts:
I'm trying to set up a color theme I like when using an xterm.  I'm looking through the variable names (e.g. "Font Lock Doc Face") for the theme 'deep-blue' using Custom Theme option.  Unfortunately, I don't see any settings that seem to correspond to the faces used when accessing the menubar at the top of the frame.

Can someone help clue me in?


texts:
I'm using helm-imenu to list Classes and Functions.
How can I add enable it to list variables also?


texts:
Most everyone who uses paredit has used paredit-kill (i.e., C-k), which allows one to delete a line forwards whilst keeping delimiters balanced properly. But how does one do this in the reverse direction? When one does C-0 C-k, which is something that's typically used to kill the line backwards, paredit-kill actually calls the built-in kill-line to handle it. Unfortunately, this loses the delimiter-balancing that is otherwise had with paredit-kill. Since discovering that C-0 C-k does not work quite right, I've tried implementing a paredit-backward-kill-line function that will kill backwards and balance delimiters a la paredit-kill. However, I've not had much luck with this and have only come up with an implementation which uses paredit-backward-delete under certain conditions. This solution has only worked marginally well for me thus far. I've also tried reworking some of paredit's functions that relate to killing lines, but it seems that they are all hard-coded to work with forwards deletion. This is making certain functions here significantly difficult to rework.

All in all, this seems like a lot of work to get something working that seems like it should be relatively simple, given that paredit already works as well as it does. So, I guess my question is: is there a way to do a backwards paredit-kill which retains all the delimiter-balancing functionality that is had from a normal, forwards paredit-kill?


texts:
If I have font-lock on and I do M-x find-library RET simple RET, I have colours:

If I then M-x font-lock-mode to disable the mode, the colours disappear in the currently-visible portion of the buffer:

But the colours are still present everywhere else if I scroll the buffer:

This does not happen with emacs -Q. Any ideas on how to debug it?
GNU Emacs 27.1 (build 1, x86_64-apple-darwin20.3.0, NS appkit-2022.30 Version 11.2.1 (Build 20D75)) of 2021-03-13

Update: It happens with a fresh Doom emacs, so I am reporting it as an issue.


texts:
I recently changed my Linux distribution (from an old Opensuse 13.1 to Linux Mint 19, which comes with "GNU Emacs 25.2.2 of 2017-09-22, modified by Debian"), and now my very basic theme is not working correctly anymore. My theme file is only this:

(deftheme Labo
  "Created 2017-02-16.")

(custom-theme-set-variables  'Labo
 '(default-frame-alist (quote ((tool-bar-lines . 0) (height . 57)
                               (menu-bar-lines . 1) (width . 82)
                               (vertical-scroll-bars . right)))))

(custom-theme-set-faces  'Labo
 '(default ((t (:height 113 :foundry "1ASC"
                :family "Droid Sans Mono Slashed")))))

(provide-theme 'Labo)

My theme is correctly loaded from .emacs: M-x customize-themes shows it checked. M-x describe-variable default-frame-alist gives the correct value (as defined in the theme). But M-x describe-face default gives:

Family: DejaVu Sans Mono
Foundry: PfEd
Height: 98

However, changing the default face by hand in Customize works, so I guess the "Droid Sans Mono Slashed" font is not the culprit.

I'm far from being an Emacs expert. Maybe a loading order issue? The requested font is a TrueType one, placed in ~/.fonts.

There is no error in Messages. How to debug this? Thanks for your help.


texts: `fit-window-to-buffer` and `reposition-window` non-interactively

texts:
I'm using lean-mode and want to keep the *Lean Goals* buffer sized to fit its contents.  Here's what it should look like:

To get that working, I wrote the following and hooked it in to the relevant function.

(defun lean-resize-goal-buffer ()
  (let ((goal-buffer (get-buffer lean-show-goal-buffer-name)))
    (when goal-buffer
      (let ((orig (current-buffer)))
    (pop-to-buffer
     goal-buffer)
    (fit-window-to-buffer nil nil (+ (count-lines (point-min)
                              (point-max))
                     1))
    (pop-to-buffer orig))
    ;; Added this, but it doesn't work as intended
    (reposition-window))))

(advice-add 'lean-show-goal--handler :after #'lean-resize-goal-buffer)

The display is a bit jumpy, and I realised I need to run reposition-window to get the windows to resize correctly.  But this does not work non-interactively, as in the above function.  When I press C-M-l it works fine.  Even wrapping reposition-window with call-interactively doesn't work.

Any suggestions?


texts: helm-ag (or equivalent) open selection in existing window?

texts:
If you run helm-ag (I typically do this with helm-projectile-ag, but I think it should be similar) and select a match, the file / buffer opens in the last used window.
My question is this: If a you already have the file / buffer open in an existing window, can you force the match to open in that window? This keeps the position of files in your frame more stable.
There's a similar question here: Open file in a specific window, but I figured this would be a common (and perhaps solved) use-case. If not, maybe I could override the action initiated on RET to scan my existing windows and, if a window has the right buffer already open, open it there? I'm not sure if there's a better way to do it.
Thanks for any help!


texts: delete trailing new lines / whitespace, but not an image at eob

texts:
I have a buffer that will have either plain text or an image (text properties) near the end of the buffer.  I would like to delete any new lines or whitespace at the end of the buffer.  How can I do this?

The following works if there is an image:  (delete-region (previous-property-change (point-max)) (point-max)).  However, if there is no image, it deletes plain text -- which is not what I want.

The following works if there is no image, but deletes the image if there is one (which is also not what I want):

  (save-excursion
  (goto-char (point-max))
  (let ((trailing-whitespace+newlines (abs (skip-chars-backward "\s\r\n\t"))))
    (when (> trailing-whitespace+newlines 0)
      (delete-char trailing-whitespace+newlines))))


texts: At what point are file-local and dir-local variables applied to a newly-loaded buffer?

texts:
I'm currently attempting to call the function company-org-roam--init-hook from org-mode-hook in order to enable the company-org-roam backend in org-roam buffers. In some of the files in which this hook is called, I've used a .dir-locals.el file to set org-roam-directory to a non-default value. However, when company-org-roam--init-hook is called while loading the file, it appears that org-roam-directory isn't set to its dir-local value, causing the hook not to enable the Company backend.

Is it expected that dir-local variables are applied only after major-mode hooks are run? If so, is there a way to work around this (besides a run-at-time)?


texts: Managing path for reproductible scientific paper using session, org-babel and org-mode

texts:
I'm starting using org-mode and org-babel to support my day by day scientific work and produce reproductibles papers.

Lot of people use rMarkdown/jupyter to do that, but i'm interested by investing some time to do more or less the same things using org-babel and org-mode.

Running chunk of code using org-babel is as simple as running chunk of code with RMarkdown/KnitR, and it seems org-babel is much powerfull on this side, so no problem with that actually

For me, problem arrives when i try to manage path, and start using :session property, especially with shell (sh/bash).

I define the workspace :dir for source code like this :

:PROPERTIES:
:export_file_name: reproductiblepaper
:header-args: :dir ~/home/xxx/reproductible_paper tangle:yes session: reproductible
:END:

It's common to use git or any cvs to download and run code producing result, so naively i wrote in my org code :

#+begin_src sh
git clone git@gitlab.com:xxx/yyy/mygitproject.git
#+end_src

Folder appear in ~/home/xxx/reproductible_paper/mygitproject/ as expected.

After that, i don't want to rewrite my :dir path for each #+BEGIN_SRC ... #+END_SRC block, so i use the :session capacity, and i wrote

#+begin_src sh
cd mygitproject
#+end_src

BUT, using this strategy cannot work.

When you write and export org file multiple time in a writing/publishing workflow (write -> execute/publish -> write), each command rerun using the same shell session !, bypassing the :header-args: dir: defined in property.

The result was weird, and multiple run create an infinity of nested folder due to git clone and cd command.

Following your advice what is the best way to manage path in this use case ? Killing session each run ? Use environment variable without :session to define directory path ?

UPDATE 1

a) Using absolute path, env substitution, and session :

:PROPERTIES:
:export_file_name: reproductiblepaper
:header-args: :dir ~/home/xxx/reproductible_paper tangle:yes session: reproductible
:END:

#+NAME: absfolder
#+BEGIN_SRC sh
ABS="/home/xxx/reproductible_paper"
#+END_SRC

#+begin_src sh
git clone git@gitlab.com:xxx/yyy/mygitproject.git
#+end_src

#+begin_src sh :noweb yes
<<absfolder>>
cd $ABS/mygitproject
pwd
#+end_src

If you use this solution, and killing each time the session, it works, but you cannot use interactive evaluation without creating an unstable state in your shell session. Why not.

But to do this in a clean way i need :

a way/command to kill/reset session at each re-export.
a starting script which clean previous state files/folders manipulation

Any advice do that in org ?

b) I suppose there is probably another way to do the same thing without using a session, using :var or :dir and using link dependency between each code block ?


texts: How can I get buffer-local environment variables via .dir-locals?

texts:
I'm using emacs for many different projects. For some of them, I need, for example, different entries in $PATH, or different $MAKEFLAGS, whatever, you name it...

I thought this would be possible somehow like this in .dir-locals:

((c++-mode
  (c-basic-offset . 4)
  (tab-width . 4)
  (eval progn
          (make-local-variable 'process-environment)
          (setenv "gna" "gnagna3")))
 (c-mode
  (c-basic-offset . 4)
  (tab-width . 4)))

Bit with this approach, "gna" is set in all buffers.

What am I missing?


texts:
So I've been using my custom config for a while now and no problems whatsoever, recently however there's a lag while loading emacs. It hangs at loading /home/<user>/.emacs.d/git_config.el (source) for about 5mins before going through.

I'm not entirely sure what the problem is. I tried loading it in --debug-mode but to no avail. I can get over the hang by clicking C-g. I tried commenting out git_config.el but then it hangs in helm.el.

In git_config.el it seems that it hangs at (require 'git-commit).

Any idea on how to go about debugging this?


texts:
I am thinking about mimicking Outlook interface on this.

Let say I am planning my week, and I see that on Tuesday next week I don't see any todo there. So, I move the cursor to the date and hit some keyboard shortcut. Then I will be able to add a todo task to the date. The task will be saved in a preconfigured file (i.e. todo.org). How do I do this?

In calendar view I can see that I can add a diary entry to date. But I need more customization.


texts: How can I create a new frame that does not inherit the splits from an existing frame?

texts: From time to time I like to pop open a new frame (GUI window) with cmd + n which gives me a new frame. However if I create a new frame and I have an existing frame with 2 splits the new frame also is open with the same 2 splits with the same buffers. I'd like this new frame to open with a single split by default, is this possible?


texts: Difference between init and config in use-package

texts:
I have a configuration like this:

(use-package html-mode
  :mode "\\.html\\'"
  :config
  (progn
    (add-hook 'html-mode-hook 'turn-off-auto-fill)))

Now when I go and visit an HTML file, I observe that auto-fill is not turned off. But if I use :init instead of :config, auto-fill gets turned off. So my question is when are the commands under :config executed ?


texts: org-reveal - change table font-size globally

texts:
I can use below code to change font size to 60%, how can I make it take effect for all tables?
#+REVEAL_HTML: <div style="font-size: 60%;">
| Name                     | Blueprint        |
| LOCAL_PRODUCT_MODULE     | product_specific |
| LOCAL_PROPRIETARY_MODULE | vendor_specific  |
| LOCAL_ODM_MODULE         | device_specific  |
#+REVEAL_HTML: </div>


texts: flyspell and ispell give too many spelling suggestions

texts:
I'm using flyspell mode with aspell under the hood. Emacs 27.1 installed using Homebrew on macOS Mojave. This behavior happens both with my normal configuration as well as emacs -Q.
I looked through M-x customize as carefully as I could in the flyspell and ispell sections, but did not find anything useful.
When I right-click on a misspelled word, I get way more suggestions than I want:

I want maybe a dozen suggestions.
M-x ispell-buffer similarly gives too many suggestions.
This seems like an Emacs thing because running aspell on the same file in the terminal manually gives a much more reasonable number of suggestions (here, 8):


texts: How to control in which window a buffer is displayed?

texts:
Q: how can I control which window org-deadline uses to display the calendar?

org-deadline temporarily pops up the calendar buffer in a window when setting a deadline, and then closes it again after completing.  When there is only one window, it pops a new window at the bottom of the existing frame.  When there are multiple windows, it selects one -- I presume with something like get-lru-window -- of the available windows.

The latter is problematic if it takes over one of the other windows that has the information I need in order to set the deadline (date, time, etc.)  This is commonly a problem in a window setup such as:

+--------------------+--------------------+
|                    |                    |
|                    |  (B: mu4e header)  |
|                    |                    |
|                    +--------------------+
|  (A: agenda file)  |                    |
|                    |                    |
|                    |                    |
|                    |  (C: mu4e view)    |
|                    |                    |
|                    |                    |
|                    |                    |
+--------------------+--------------------+

When adding a deadline to the agenda file in (A), org-deadline will take over (B) or (C), which contain emails that have the date/time information I need.  I'd much prefer that, if I'm calling org-deadline from (A), it would pop a temporary window (D) to contain the calendar buffer as below:

+--------------------+--------------------+
|                    |                    |
|                    |  (B: mu4e header)  |
|                    |                    |
|                    +--------------------+
|  (A: agenda file)  |                    |
|                    |                    |
|                    |                    |
+--------------------+  (C: mu4e view)    |
|                    |                    |
|   (D: calendar)    |                    |
|                    |                    |
+--------------------+--------------------+

So: how would one force org-deadline (and analogous functions) to pop a new, temporary window at the bottom of the active window rather than take over one of the other ones?

PS: I'm aware of dedicated windows, but they don't strike me as the best approach since it's not so much that I want to dedicate buffers to windows as I want to avoid having a function take over one of the "short" ones.


texts: What's causing slow behavior interacting with gpg files?

texts:
I have a gpg file I occasionally need to access from ubuntu 18.04 gnome desktop or xfce desktops in linux, or via a terminal in an ssh session.  On the gnome desktop, everything works reasonably easily, a new desktop window pops up for password entry, however on xfce there is typically at 10+ second wait for the window to appear, and when in a terminal, I never get prompted for password entry and the gpg request just times out.

Is there any way to access gpg more quickly?  Perhaps entirely from within gpg and the shell (I suspect the problem somehow is with the gui aspect of the desktop).

I am using GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-09-22, modified by Debian.

EDIT: delay is 25 sec


texts: how to filter Stack Exchange questions with sx.el?

texts:
I'm looking for a command like sx-tab-all-questions. But instead of
displaying a list with all communities, I want it to display my list of filters. How can I create a filter, include tags of different communities and highlight new questions ?


texts:
Is it possible to specify that a defcustom can only take the value of a mode?

More specifically, I've got a variable that's a map from major modes to lists of strings, and I wants users to be able to configure this map. So conceptually I want something like this:

(defcustom my-type-map
 :type '(alist :key-type 'mode :value-type '(repeat string)))

Is this possible, or do I just need to use documentation?


texts:
I have some recurring tasks for habits that I want to disappear after setting them done, but I also want a special agenda view, showing when items were completed, to see how well I have been keeping up with them. Say that my recurring tasks looks like this:

* TODO scheduled task
SCHEDULED: <2020-04-06 Mon ++1d>
:PROPERTIES:
:LAST_REPEAT: [2020-04-05 Sun 11:12]
:END:
- State "DONE"       from "TODO"       [2020-04-05 Sun 11:12]
* TODO task <2020-04-06 Mon ++1d>
  :PROPERTIES:
  :LAST_REPEAT: [2020-04-05 Sun 11:12]
  :END:
  - State "DONE"       from "TODO"       [2020-04-05 Sun 11:12]

After reading through different questions on this site I tried:

(setq org-agenda-custom-commands
    '(("1" agenda ""
       ((org-agenda-include-inactive-timestamps t)))
      ("2" agenda ""
       ((org-agenda-include-inactive-timestamps t)
        (org-agenda-start-with-log-mode t)
        (org-agenda-start-with-log-mode-items '(state closed clock))))))

Both solutions shows the same result, and has two problems:

The tasks shows up twice, I would like to match only against the STATE "DONE" from "TODO" line.

The tasks are shown as TODO in both cases but I want them shown as DONE.


texts: url-http unable to connect to api - gnutls error

texts:
I am using restclient-mode and trying to POST JSON to an API I'm writing. Making curl requests works fine but I'm getting these errors from restclient.el:

My restclient-mode request looks like this:

POST https://www.example.com/
Content-Type: application/json

{
  "email": "bitops@example.com",
  "password": "secretP@55word"
}

I see this output in the Messages buffer:

Contacting host: **API URL**:443
Opening TLS connection to `**API URL**'...
Opening TLS connection with `gnutls-cli --insecure -p 443 **API URL**'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 **API URL** --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect **API URL**:443 -no_ssl2 -ign_eof'...failed
Opening TLS connection to `**API URL**'...failed
url-http: Could not create connection to **API URL**:443

My gnutls-cli info:

$ /usr/local/bin/gnutls-cli --version
gnutls-cli 3.3.9


texts: How do I toggle soft-wrapped lines in org-mode?

texts:
I want to be able to toggle soft-wrapped lines in org-mode. My .emacs file has this code:

;;;;;;;;;;;;;;
;; Org Mode ;;
;;;;;;;;;;;;;;

(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)

;; Start-up with soft-wrap enabled
(setq org-startup-truncated nil)  ; This works
;; Toggle soft-wrap with super-q
(define-key org-mode-map "s-q" 'toggle-truncate-lines)  ; This doesn't

I would like to map it to something like super-q or F7. Is there something wrong with my syntax? Neither works.


texts: Keymap on region only updating from mouse click

texts:
I have defined some keymaps on org-mode src-blocks. If I click in the block with a mouse, I see the keymap is changed, e.g. the menu items change, and the new keybindings are active. However, if I use C-n or C-p to get into the block, the keymap is not changed. However, as soon as I edit the block, the keymap becomes active. The keymaps are added during font-lock via:

(add-text-properties
             beg end `(local-map ,some-key-map))))

inside a function that is added to org-font-lock-hook.

Is there something different about mouse motion and cursor motion that would cause this difference?


texts: How can I see which version of a package I'm using?

texts: I'm curious to see which version of a package I'm using to see if it is out of date. I don't see a package- function that looks applicable.


texts: Sum effort estimates from today's scheduled tasks in org-mode

texts:
I want the agenda view to calculate the total amount of effort I have in tasks scheduled for today. For example, take these two tasks:

* TODO Task 1
SCHEDULED: <2019-04-17 Wed>
:PROPERTIES:
:CREATED:  [2019-04-17 Wed]
:Effort:   2h
:END:
* TODO Task 2
SCHEDULED: <2019-04-17 Wed>
:PROPERTIES:
:CREATED:  [2019-04-17 Wed]
:Effort:   30m
:END:

Then I want the agenda view to show those two tasks scheduled and the total effort of 2h30m.

I tried this answer:

(setq org-columns-default-format "%60ITEM(Task) %6Effort(Estim){:} %8ASSIGNED_EFFORT(Assigned){:}  %6CLOCKSUM(Clock)")

and my agenda view and org-mode buffer look the same.

How can Org-mode do this?


texts: How show corresponding key binding of command during M-x completion?

texts:
Linux Mint 20
Emacs 27.2
ido-mode
When I press M-x then show (ido-mode) the list of functions.

Nice. But sometime it is not enough. I need to know what is keybinding for this functions. Is it possible to show keybining when  press M-x ?


texts: How can I tell if a buffer is a comint buffer, eshell buffer or neither?

texts:
I have Emacs Lisp program that I want to work inside either a comint process buffer or an eshell buffer. The code I currently am using is:

https://github.com/rocky/emacs-dbgr/blob/master/realgud/common/track-mode.el#L141-L147

but this is a bit ugly and might be prone to breakage if either the comint or eshell changes.

Any suggestions?


texts:
For some org-mode files, I would like to run specific commands when that file is opened for editing. These commands should be written in the heading of the file somewhere near the #+CONFIG bits.

E.g in my 'WeeklyReport.org' I would like it to automatically run my function NavigateToOrCreateThisWeek()

Is this possible?

As an alternative, I currently have functions that load a file and then do something. But I'd like to instruct the functions to be ran when ever I open that file.


texts: Remap Company's select next and select previous keys, with evil-mode?

texts:
When company-mode pops up suggestions, I want to use C-n and C-p to select the next or the previous options, instead of M-n and M-p.

Having found the general answer on this site, I was happy to try it out, but it turns out that doesn't work for me.  I suspect this is because I have Evil mode enabled.

When I'm in evil-insert-mode, pressing C-h k C-n tells me:

C-n runs the command evil-next-line (found in evil-insert-state-map),
which is an interactive compiled Lisp function in ‘evil-commands.el’.

It is bound to C-n.

(evil-next-line &optional COUNT)

Move the cursor COUNT lines down.

Is there any way I can shadow this correctly in company-active-map?

For completeness, my configuration is:

(with-eval-after-load 'company
  (define-key company-active-map (kbd "M-n") nil)
  (define-key company-active-map (kbd "M-p") nil)
  (define-key company-active-map (kbd "C-n") #'company-select-next)
  (define-key company-active-map (kbd "C-p") #'company-select-previous))


texts:
I copied and paste text in an org file and formatted it as a list:

- Funded pensions :: As explained more fully in Chapter 3, funded pensions are paid on behalf of its members.

How can I have the list formatted as:

- Funded pensions :: As explained more fully in Chapter 3, funded pensions are
      paid on behalf of its members.

Another simple example where fill-region-paragraphsdoes not work is:

* first header

- The primary objective of pensions is /economic security in old age/, achieved
through consumption smoothing, insurance, poverty relief, and redistribution.
- The primary objective of pension design is to /optimize old-age security/, includ-
ing the cost of providing it.


texts:
I have recently installed helm but haven't gotten very far with using it so far. I noticed that I can run the command helm-pdfgrep-help and it shows me a list of keybindings. But I don't have a helm-pdfgrep (or pdfgrep-help for that matter).

What's the deal? The idea of using helm to search text in my pdf library sounds extremely useful. But a quick search on the web does not lead me to think helm-pdfgrep even exists.


texts:
Normally, for historic reasons, emacs treats the TAB keycode and the C-i key as the same, cf. the emacs lisp documentation on function keys or abo-abo's answer on the question "What is the difference between TAB and ?".

  NOTE: In this post, keycodes are TAB, <tab>, and C-i; tab and Ctrl + i on the other hand are the physical keys on the keyboard.

  However, at the moment, emacs treats the TAB and C-i as the same thing, i.e. (equal (kbd "TAB") (kbd "C-i")) -> t.

However, since we are no longer living in the stoneage of computing I find this extremely annoying. There's a few suggestions out there what can be done to work around this, e.g.

"How do I bind a command to C-i without changing TAB?"

Trey's Solution did not work for my, the variable local-function-key-maps is not changed. Modifying it to use delete rather than delq does result in a modified variable but it does not bring resolve ... tab and Ctrl+i are still the same.
Translating to the hyper map seems like a 1980s workaround ... I might want to use Hyper+i as well.

Using the input-decode-map to map Ctrl+i to some post-ASCII control code is almost what I'm looking for. Except that it does not work properly with the kbd macro meaning that one must modify all bits of source code that will bind Ctrl + i. Arguably this is the best solution given that all source code is modified properly.
Using (kbd "<tab>") for tab and (kbd "C-i") (which translates to (kbd "TAB") i.e. the \t literal) for Ctrl+i does work but you'd have to modify all source files which use the wrong kind of tab [Read: the keycode TAB] which is annoying.
This has been suggested e.g. in a github issue and on emacs.sx as well.

None of these solutions seem real solutions, I'd rather consider them workarounds or hacks (of the existing bug).

  Is there a way out there to force emacs to map tab to (kbd "<tab>") and (kbd "TAB") while Ctrl+i is mapped to (kbd "C-i") short of modyfing the emacs source code?

  This approach should be completely invisible to the user, meaning that the tab like keycodes <tab> and TAB should map to one binding whilst the Ctrl+i like keycode C-i should map to another binding.

On a less serious note: Any emacs developers here who can comment whether this will be changed / fixed in the emacs source code at some point?


texts: Use Eshell with Tramp, from a Windows computer to a Linux server

texts:
I use a Windows computer to control servers through Tramp (with plink).
Here's my setup:

(setq explicit-shell-file-name "/bin/bash")
(setq default-directory "/plink:user@server:~")

Now when I run M-x shell it runs perfectly. All commands (w, ls...) work on the server.

M-x eshell does get me a prompt on the distant server. However, here's what I get with w:

/plink:user@server:/home/user $ w
w: command not found

The ls command on the current directory works. However, I cannot change directory :

/plink:user@server:/home/user $ cd Videos
No such directory found via CDPATH environment variable

Except if I use this small hack found on Reddit :

/plink:user@server:/home/user $ cd $PWD/Videos/
/plink:user@server:/home/user:/home/user/Videos $

So, what elements of configuration am I missing to have a working eshell on my distant server?


texts:
I would like to hide the mode-line completely in a speedbar buffer. Calling (setq mode-line-format nil) in the buffer works temporarily, but I would like to make this setting permanent. Adding a hook using (add-hook 'speedbar-mode-hook (lambda () (setq mode-line-format nil))) has no effect. What is the correct way to achieve this?

I am using emacs 25.2.1 on macOS.


texts: How to disable global Linum mode for certain mode?

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

(global-linum-mode 1)
(add-hook 'term-mode-hook (lambda () (linum-mode)))

However, when I enter ansi-term-mode linum mode is still on.

I have also tried

(add-hook 'ansi-term-mode-hook (lambda () (linum-mode)))

and

(add-hook 'term-mode-hook (lambda () (linum-mode nil)))

Does anyone have any idea how to turn off linum mode for ansi-term-mode only?


texts: How do I set a specific font for Windows and Ubuntu?

texts:
I want to use the same configuration for both Ubuntu and Windows, so I want to share my ~/.emacs between boxes. I'd like, however, to use the Consolas font in Windows, and Ubuntu Mono font in Ubuntu.

How can I autodetect which OS emacs is running in, and define the font code conditionally on the environment?


texts: Selecting the cursor type when using an overlay 'cursor property

texts:
The documentation for the 'cursor overlay property does not discuss methods for altering the type of cursor that is used when point is on a particular overlay:  https://www.gnu.org/software/emacs/manual/html_node/elisp/Special-Properties.html  The default overlay cursor type is hollow.

Is there a way for a user to select the type of cursor that is displayed when point is on a particular overlay?  E.g., box; bar; (bar . [WIDTH]); hbar; (hbar . [WIDTH])

The following example creates an overlay using an xpm image at the end of the current line, which requires an Emacs version that supports xpm images.  The test was performed with a default Emacs installation -- i.e., a white buffer background and a black cursor color -- the hollow cursor outline can be easily seen in this example.

(let ((xpm--pilcrow
       (propertize " " 'cursor t 'display
         `(image :type xpm :mask nil :ascent center :data
         "/* XPM */
         static char * pilcrow_plain_xpm[] = {
         \"11 20 2 1\",
         \". c white\",
         \"+ c cyan\",
         \"...........\",
         \"...........\",
         \"...........\",
         \"...........\",
         \"...++++++..\",
         \"..++++.+...\",
         \"..++++.+...\",
         \"..++++.+...\",
         \"...+++.+...\",
         \".....+.+...\",
         \".....+.+...\",
         \".....+.+...\",
         \".....+.+...\",
         \".....+.+...\",
         \"...........\",
         \"...........\",
         \"...........\",
         \"...........\",
         \"...........\",
         \"...........\"};"))))
  (overlay-put (make-overlay (point-at-eol) (point-at-eol)) 'after-string xpm--pilcrow))


texts: Specifying local package loading order in spacemacs

texts:
I'm trying to create a layer where one package in the layer depends on the functionality of another package in the same layer.
As spacemacs loads the packages alphabetically (I assume) this only works if the dependend package has a name that is loaded after the name of the package with the required functionality - otherwise it doesn't compile.
Minimal example:

emacs/private/testlayer
    - packages.el
    - local
        - a-package
            a-package.el
        - b-package
            b-package.el

Where packages.el:

;; the order of the arguments in the package-list doesn't matter
;; for the loading process
(defconst testlayer-packages
  '((a-package :location local)
    (b-package :location local))
)

;; the order of the init functions in the file doesn't matter
;; for the loading process
(defun testlayer/init-a-package ()
  (use-package a-package)
)

(defun testlayer/init-b-package ()
  (use-package b-package)
)

and a-package.el:

(require 'b-package)

(defun a-pack-fun ()
  (b-pack-fun)
  )

(provide 'a-package)

and b-package.el:

(defun b-pack-fun ()
   (message "b-pack-fun")
)

(provide 'b-package)

Adding testpackage to dotspacemacs-configuration-layers in .spacemacs and trying to load it results in the following error message:

Warning (initialization): An error occurred while loading
`/home/user/.emacs.d/init.el':

File error: Cannot open load file, no such file or directory, b-package

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

If the dependencies are the other way around (b-package calls functionality from a-package) everything works just fine due to the alphabetical loading order.

Now, how can I specify the loading order so that b-package is loaded before a-package?


texts: How can I restart emacs and preserve my open buffers and interactive history?

texts:
As a follow-up to What's the fastest way to reload my .emacs file when I make changes so all my affected buffers will pick up those changes?

It was suggested that the restart question should be asked separately.

Is there an easy way to reopen all the previous buffers and keep the M-p interactive history for commands?


texts: Preventing parent tasks from switching TODO keywords

texts:
I have several parent-level tasks that I manage as projects so I've created TODO keywords to support project management as follows.

(setq org-todo-keywords
  '((sequence "TODO" "NEXT(n)" "DOING(!)" "|" "DONE(d)")
   (sequence "WAITING(w@/!)" "HOLD(h@/!)" "DELEGATED" "|" "DONE")
   (sequence "NEW" "PLANNING(p@/!)" "EXECUTION(x!)" "|" "COMPLETE(c)")
   ))

Each project will have a set of sub-tasks that I use the TODO NEXT DOING DONE states, such as the following.

* PLANNING This is a project
** TODO this is a project task
** NEXT this is another task

The behaviour I am seeing is that when I change the state of one of the sub-tasks, the parent 'project' task changes to TODO from it's current state. What I would like to do is customize this to at least stop this behaviour i.e. a sub-task should not change the state of the project level task. Ideally, though, I would like to see if it's possible to have the project level task state change to COMPLETE when all the child tasks are set to DONE. Any help here would be greatly appreciated!


texts:
I am trying to update my Magit install.

The Magit manual has install instructions on
https://magit.vc/manual/magit/Installing-from-an-Elpa-Archive.html#Installing-from-an-Elpa-Archive

M-x package-install does not list "magit":

M-x magit-version says "2.11.0".

M-x list-packages lists "magit  2.12.1":

According to this post Install package: magit (via package.el) only shows *Completions*
package-install is not a valid option if Magit is already installed.

How to update a Magit install?

I am running Spacemacs v.0.200.9


texts: tramp mode on Ubuntu hangs while attempting ssh to 0.0.0.1

texts:
With emacs 25.2.2 on Ubuntu 18.04, if I try opening a file over ssh using a path such as /ssh:somehost.example.com:/tmp/testfile, it launches a sub-process that does:
/usr/bin/ssh -o ControlPath=%C 0.0.0.1

This IP address does not accept ssh connections, so the ssh subprocess hangs, and the file opening in emacs also hangs until the ssh eventually times out.  Using lsof, it can be seen that the TCP connection to 0.0.0.1:ssh is stuck in SYN_SENT state, consistent with it not receiving any response.
I found that it is possible to work around this by adding an iptables rule to reject the outgoing ssh connection to this address:
sudo iptables -A OUTPUT -d 0.0.0.1 -p tcp --dport 22 -j REJECT

so that this attempted ssh connection quickly receives a "connection refused", instead of the packet effectively being dropped and it just hanging.  After this, emacs then connects to the actual target machine correctly, and the remote file can be edited.
Why is this connection to 0.0.0.1 being attempted, and how can this be prevented (in a way that does not require sudo access)?


texts:
I'm writing some very simple code to get data from a web api, i then parse the response and output the result in a buffer.

By default this text is very flat, how can i add keyword highlighting that follows the current theme's colourscheme?

For example, the text in the buffer:

Title

Keyword1: data1
Keyword2: data2

How can i define, and most importantly apply faces(i think) to the keywords?


texts: Exact steps to export to an org table to csv

texts:
Sorry if this is trivial. What are the exact step to export the following table:

1) to a buffer
2) to the file specified in properties

For now if I position the cursor inside the M-x org-table-export I get a prompt for a file, not a buffer.

* FRUIT

:PROPERTIES:
:TABLE_EXPORT_FILE: ~/Desktop/tbl
:TABLE_EXPORT_FORMAT: orgtbl-to-csv
:END:

| Name      | Color |
|------------+-------|
| Blueberry  | Blue  |
| Blackberry | Black |


texts: Ruby's array.sample() equivalent for lisp

texts:
I want to write a method that returns a random (predefined) face

In ruby I would do,

def random_face
 [ :my-face-01, :my-face-02, :my-face-03 ].sample(1).first
end

How can I do it in elisp?


texts: Sort list by decreasing length of the strings

texts:
I have this list:

(setq MYLIST '("J. Phys."
               "New. J. Phys."
               "J. Phys. Soc. Jap."
               "Phys. Plasmas"))

How can I get a new list ordered by the decreasing length of the strings? :

("J. Phys. Soc. Jap."
 "New. J. Phys."
 "Phys. Plasmas"
 "J. Phys.")

ADDENDUM. It happens that when I try the DoMiNeLa10 answer on a 232 element list I get a 130 list. 102 of them goes lost (they are not duplicates). If you need my list as a file please tell me how can I share it.

You can find my list here: MYLIST.


texts: Need emacs lisp function to execute command in *shell* buffer

texts:
How to write a function (it would go into .emacs) that sends some command to shell buffer (and initializes shell if needed)?

Something like:

(defun ()
  (interactive)
  (shell)
  (sh-send-text "ssh my.server.com"))

(I currently do this via tramp and sshx but it is slower than if I manually open shell and just type in the ssh command. So I want to speed this up with a helper function).


texts: Emacs -q error "Failed to initialize color list unarchiver"

texts:
When I run emacs -q I got the following error (on Mac OS) although emacs window still pops up.  Any idea?
% /Applications/Emacs.app/Contents/MacOS/Emacs -q
2021-05-10 22:44:57.297 Emacs-x86_64-10_14[43625:9228583] Failed to initialize color list unarchiver: Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]: non-keyed archive cannot be decoded by NSKeyedUnarchiver}


texts: How close and exit from buffer *Re-builder*?

texts:
emacs 26.1

M-x regexp-builder

Input some regexp.

Nice.

But now I want to close and exit from buffer Re-Builder. How I can do this?


texts: Show free blocks of time in org-mode's agenda

texts:
I would like to make it easy to find where are the free blocks of time in my org-mode agenda.

For instance, if I have two appointments one 9:30am-10:30am and another 11:15am-12:30pm, I would like to see at a glance that the 10:30am-11:15am block is free.

In other words, I want to be able to distinguish free time as easily as it is done in a graphical agenda such as Google calendar.

Is there a way to make the empty blocks of time easy to see?  Perhaps to colorize the empty blocks that are longer than a given number of minutes?


texts:
Is there a package/function for shuffling the paragraphs in the buffer?
(I mean to sort the paragraphs with a random order, not changing the paragraphs, just randomizing their order).

Motivation: For learning vocabulary of a foreign language, research shows that it is better to change the order of the words you study. There is such a thing as “serial” learning such that a fixed order becomes itself a trigger in remembering the word. See http://rharriso.sites.truman.edu/vocabulary-and-word-formation/vocabulary-home/tips-on-learning-vocabulary/. Imagine you have a buffer in which every paragraph contains a word and its meaning. It would be great to change the order of paragraphs.

Edit: Based on the idea given by Politza, here is a solution:

(defun random-sort-paragraphs (reverse beg end)
  (interactive "P\nr")
  (save-excursion
    (save-restriction
      (if (region-active-p) (narrow-to-region beg end))
      (goto-char (point-min))
      (sort-subr reverse
                 (function
                  (lambda ()
                    (while (and (not (eobp)) (looking-at paragraph-separate))
                      (forward-line 1))))
                 'forward-paragraph nil nil
                 (lambda (s1 s2) (eq (random 2) 0))))))


texts:
I want to record some typing on a screen video using emacs and I'm wondering if there is something available in emacs to mimic human typing.
I imagine I feed it a line(region) of text and it is displayed in the buffer, character by character which a human can follow. A bit faster and without backspace correction than my live typing, but still a lot slower than just playing back an recorded macro?


texts: emacsclient's "--script" option alternatives

texts:
To run an elisp file hello.el with emacs in cli, do simply

$ emacs --script hello.el

However, a naive try for emacsclient fails, as --script is not an option of emacsclient.

$ emacsclient --script
emacsclient: unrecognized option '--script'
Try 'emacsclient --help' for more information

Question: What is a good practice to evaluate an elisp file by a running emacsclient?


texts: flycheck, elpy and re-displaying corrected python code

texts:
I've had Flycheck installed for some time, using flake8.  This has worked for some time. When I had errors in a *.py program, they were indicated with markers by flycheck, and after correcting them, the eror markers would automatically disappear.
But now I am trying out to see if (on top of the above), elpy may be helpful to me in python coding, so I installed it. Here comes my problem: with elpy, whenever I have corrected a coding mistake in a python program, the error markings do not automatically vanish anymore; only AFTER saving the file, do the error markings disappear.
Does anyone know off-hand which setting I need to look at here?  Thank you.


texts: "Auto-Confirmation: Automatically Saying Yes" but how?

texts:
i have
(defun insert-buffername ()
 (interactive)
 (compile (concat "lua " (buffer-file-name))))

 (global-set-key (kbd "C-c C-e") #'insert-buffername)

but when i use this key binding it always asks me "Save file: (y, n, !, ...)" question
which i would prefer not to see every time. I can not adopt the code in
https://www.emacswiki.org/emacs/YesOrNoP to my case.
Need help


texts:
Open the code below with emacs -q, do set-variable sh-basic-offset 2, then indent-region. All lines are indented with 2, while the echo line is indented with 4. Is this a bug in Emacs, or how do I configure it to indent consistently with 2? (When setting to 8, echo is still indented with 4.)

Using latest release GNU Emacs 25.3.1 on macOS installed with Homebrew.

#!/bin/bash

hello() {
  while true; do
    if [ true ]; then
    ····echo true
    fi
  done
}


texts: dired-quick-sort - sort by name not working

texts:
Linux Mint 20.1
Emacs 26.3
In folder temp I have some files.
Here is what it looks like (sort by name) in file manager Nemo

Sort by name:
how.build.txt is first. Nice.
Now same folder in dired mode

As you can see I select:
Sort by : version (natural)
I add new file whatsnew2.txt
and here result

But file how.build.txt is not first file in folder.
It's AFTER file WHATSNEW.txt and BEFORE whatsnew2.txt
Why?
P.S.
'(dired-listing-switches "-alFh")

And in my init.el
(require 'dired-quick-sort)
(dired-quick-sort-setup)
;; to save sort after reset Emacs
(savehist-mode 1)

P.P.S
If I comment in init.el
;;(dired-quick-sort-setup)

and now sort correct:

Why and how fix this?


texts: How to export multiple graphs/plots per code block in org-mode?

texts:
If my R code, which plots several graphs, is contained within one babel code block in org-mode, is it possible to export all of the graphs and display them in the #+RESULT section after evaluating the code?

Using Spacemacs 200.9@25.1.1, Org-mode v.9.0.5, ESS and R 3.3.3


texts: Human-readable time interval function for Elfeed

texts:
Is there some built-in or third-party function I can use for the following?

The function

(elfeed-entry-date entry)

returns the timestamp for an RSS feed entry, e.g. 1518282912.0.

I would like to use this as

(message "%s" (elfeed-entry-date entry))

but instead of 1518282912.0 the result should be

2 hours ago or n days ago or x years ago ...

What I tried: Did some googling, found a somewhat related SO question that deals with Clojure.

There's also a ruby method called distance_of_time_in_words but of course this question is about Elisp.


texts:
Probably influenced by Clojure, I more often use property lists as data-structures.  Emacs most of the time indents them like this,

`(:token ,token
         :token-quality ,quality)  ,

while this is what I would prefer

`(:token ,token
  :token-quality ,quality) .

So, I wonder, if someone has already tackled this ?


texts: Emails from multiple accounts go to the same trash folder

texts:
I use Emacs and mu4e for email. I set up multiple accounts as in the manual. I also included this snippet from here to send deleted messages to a folder instead of deleting them permanently:
(add-to-list 'mu4e-marks
     '(trash
       :char ("d" . "▼")
       :prompt "dtrash"
       :dyn-target (lambda (target msg) (mu4e-get-trash-folder msg))
       :action (lambda (docid msg target)
                 (mu4e~proc-move docid
                    (mu4e~mark-check-target target) "-N"))))

The problem is that all deleted messages are marked to go to the Trash of the main account instead of the Trash of their own account. Running help on key d shows:

d runs the command mu4e-headers-mark-or-move-to-trash (found in
mu4e-headers-mode-map), which is an interactive compiled Lisp function in
‘/usr/local/Cellar/mu/1.4.1/share/emacs/site-lisp/mu/mu4e/mu4e-headers.el’.

It is bound to d, .

(mu4e-headers-mark-or-move-to-trash)

which in turn shows:

mu4e-headers-mark-or-move-to-trash is an interactive compiled Lisp function in
‘/usr/local/Cellar/mu/1.4.1/share/emacs/site-lisp/mu/mu4e/mu4e-headers.el’.

It is bound to d, .

(mu4e-headers-mark-or-move-to-trash)

Mark message for "move" to the trash folder if the message
maildir matches any regexp in ‘mu4e-move-to-trash-patterns’.
Otherwise mark with the "trash" flag.
Also see ‘mu4e-view-mark-or-move-to-trash’.

The variable mu4e-move-to-trash-patterns is set to nil, and mu4e-view-mark-or-move-to-trash shows:

mu4e-view-mark-or-move-to-trash is an interactive compiled Lisp function in
‘/usr/local/Cellar/mu/1.4.1/share/emacs/site-lisp/mu/mu4e/mu4e-view.el’.

(mu4e-view-mark-or-move-to-trash &optional N)

See ‘mu4e-headers-mark-or-move-to-trash’.

How can I send each message to the trash of its own mailbox?


texts: Python, How to find the right indent level when the openning of desired indent level is not visible in a screen?

texts:
say you have

    for user_id, group in df.sort_values(
          ['user_id', 'timestamp'], ascending=[True, False]
     ).groupby('user_id'):
         group = group.reset_index()
         positive = None
         for index, row in group.iterrows():
             # print(index)
             if row.rating_type not in [20, 90]:
                 positive = row

                 num_prior = self.num_prior
                 low = max(0, index - num_prior)
                 priors = group.drop_duplicates(subset=['user_id', 'review_meta_id'])[low:index]

                 result_positive_dict = {
                     'user_id': user_id,
                     'review_meta_id': positive.review_meta_id,
                     'prior_ids': ','.join(priors.review_meta_id),
                     'target': 1
                 }
                 results.append(result_positive_dict)
                 # 20, 90 = negative
                 positives = group[(group.index>=index) & (~group.rating_type.isin([20, 90]))][:10]

                 num_negative = 4

                 for i in range(num_negative):
                     index_sample = random.sample(range(index+1), 1)[0]
                     sample = group.iloc[index_sample]

                     low = max(0, index_sample - num_prior)

                     try_count = 5
                     for _ in range(try_count):
                         if sample.rating_type not in [20, 90] or sample.review_meta_id in positives.review_meta_id:
                             index_sample = random.sample(range(index+1), 1)[0]

....

after few more lines, your screen doesn't show the first line for user_id, group in df.sort_values( which has the right indent level you want..

How do you place your cursor at the right indentation level in such cases?


texts:
I use emacs/gdb for debugging. Generally, I

emacs
M-x then type gdb
type exe name.

Every debug, I've gone through these 3 steps.

I want to know: is it possible to run gdb from the command line, e.g.

emacs -xxx "gdb my_exe" ....


texts: term without line numbers and highlight for current line

texts:
I have the following settings in ~/.emacs:

(setq linum-relative-current-symbol "")
(linum-mode)
(linum-relative-global-mode)
(global-hl-line-mode t)

In order to supress both these features in terminal, I added the following to ~/.emacs:

(add-hook 'term-mode-hook (lambda () (linum-mode -1)))
(add-hook 'term-mode-hook (lambda () (hl-line-mode -1)))

Now when I M-x term RET /bin/zsh RET, it produces an unusable terminal. See the image below:

As you can see, it still uses line numbers and highlights the current line.

What am I doing wrong? How do I set things right?


texts: yasnippet : How to expand snippet inside snippet?

texts:
In yasnippet's manual expansion of snippet inside a snippet is mentioned but I wasn't able to achieve this.
Can someone tell me what I'm doing wrong ?

I have two snippets :

# -*- mode: snippet -*-
# name: newhist
# key: newhist
# expand-env: ((yas-triggers-in-field 't))
# --
${1:-- }----------------------------------------------------------------------------
${2:_head}$2
$1Objet        : ${4:Objet}$0

and

# -*- mode: snippet -*-
# name: _head
# key: _head
# --
${1:-- }Auteur       : `(and (boundp 'user-ngram) user-ngram)`
$1Date         : `(capitalize (format-time-string "%d/%m/%Y"))`
$1Version      : `(and (boundp 'global-release) global-release)`.00.${2:0001}$0

And I expect something like that after expansion :

-- ----------------------------------------------------------------------------
-- Auteur       : me
-- Date         : 29/09/2016
-- Version      : 513.00.0001
-- Objet        : Objet

But all I get is :

-- ----------------------------------------------------------------------------
_head_head
-- Objet        : Objet


texts: How to quit key sequence using evil / spacemacs?

texts:
I'm using spacemacs in evil mode and I'd like to remap my escape key to the right arrow key (It's easily accessible for me due to a global remapping which is useful in another application). I had most success so far with either of these commands:

(global-set-key (kbd "<right>") (kbd "<escape>"))
(global-set-key (kbd "<right>") 'evil-escape)

However, there is one thing I didn't manage to get right yet. When I press, for example 'd', it expects another key (like another 'd' to delete the whole line), but pressing  won't abort that key sequence. How can I achieve this?


texts: Emacs python-mode language formatting does not reapply on buffer on newly typed text

texts:
When I open a .py file for the first time
the formatting is perfect, colors match special words as expected in Python
But when I type new text in the buffer, it inherits the color of the same character my cursor was when I started typing
regardless of Python formatting.
Expected behavior would be that after each key press that result in new characters being added to the buffer
the Python formatting would reapply immediately.
My workaround is to run M-x python-mode which does a one-time fix for the buffer formatting until I add new characters once again.
How could this be fixed?


texts: Why isn't org-agenda skipping DONE tasks?

texts:
I'm trying to set up a planning process for the day (like in http://newartisans.com/2007/08/using-org-mode-as-a-day-planner/), but my org-agenda keeps showing DONE tasks, even though I set org-agenda-skip-deadline-if-done and org-agenda-skip-scheduled-if-done in the init.el:

My current init.el file is available at https://github.com/aylons/emacsd/blob/master/init.el


texts: Why requiring fails with dynamic symbols?

texts:
I just encountered this behavior of Emacs.

This works:

(require 'test)

But this doesn't

(require (make-symbol "test"))

Why is that and can I workaround it somehow?


texts: how to use org to open w3m url in a new window

texts:
I often use C-c l key strike to store link in w3m
and use C-c C-l to save link in org

but when I click this link, the current org window jump to w3m window

I need the current org window not change
and open the link to w3m window in a new window


texts: How can I use a var to provide multiple arguments to a function?

texts:
Here is a simple example in which I would like to replace

(start-process "ls" "*temp*" "ls" "-l" "-a" "-t" "-r") ; this works

with

(setq some-var ????) ; <-- Need to figure this part out
(start-process "ls" "*temp*" "ls" some-var)

But I cannot figure out how to represent that some-var.

Below did not work:

;; Attempt 1
(setq some-var "-l -a -t -r")

;; Attempt 2
(setq some-var '("-l" "-a" "-t" "-r"))

I basically need a solution to be able to provide variable number of args (&rest args) to a function using a variable.


texts: I'm looking for a python debug debug mode in Emacs that allows me to start flask apps in debug mode and interact with them. Is there something that does this and and a step through on how to use it? I'm not very experienced with debuggers


texts: How to bypass lines matching some regexp, when searching forward

texts:
I've written the following function to go from an error line to the next one:

(defconst mylog-mode-error-regexp
  "\\(\\[ERROR\\]\\|rule did fail\\)"
  "Regexp to recognize errors in my log file.")

(defun mylog-mode-next-error ()
  "Go to next error."
  (interactive)
  (let ((case-fold-search nil))
    (search-forward-regexp mylog-mode-error-regexp)
    (narrow-to-region 1 (line-end-position))
    (setq current-count (mylog-mode-count-errors))
    (widen)
    (message "Error %d/%d" current-count (mylog-mode-count-errors))))

I'd like to skip some lines, the ones matching:

[ERROR][2018-05-29 07:39:25,149][Authenticated] - [Page [/login.html] is not allowed]

… as those errors aren't real errors -- which I have to debug.

How could I do that?


texts: How to change key bindings for Calendar mode?

texts:
How to change key-bindings for Calendar Mode only? I'm trying to do something like this:

; original bindings require pressing alt and shift simultaneously
; alt+shift change keyboard layout, so I cannot use those bindings
(define-key calendar-mode-map (kbd "M-]") 'calendar-forward-month)
(define-key calendar-mode-map (kbd "M-[") 'calendar-backward-month)

but calendar-mode-map is void. How can I get name of keymap of Calendar mode (or any arbitrary mode).


texts: View command does not open pdf while in AUCTeX mode

texts:
Sometimes, after havin applied latex to my .tex file, instead of executing

okular --unique my.pdf

emacs tried to execute

okular --unique my.pdf#src:332#("/folderToMyTex/my.tex" 0 61 (org-attr nil))

and the pdf is not opened. What is the reason for this and how to prevent it?


texts: Can I change the background color of the inactive minibuffer?

texts:
I tried it with the following settings:

(add-hook 'minibuffer-setup-hook
      (lambda ()
        (make-local-variable 'face-remapping-alist)
        (add-to-list 'face-remapping-alist '(default (:background "green")))))

(set-face-background 'minibuffer-prompt "blue")

but they only affected the active minibuffer:


texts: Spelling check in Emacs 25.2 on Mac OS Sierra

texts:
I am new to Emacs and I have a hard time to have spelling check when I use Emacs+AUCTex.

Here is a list of what I have done so far:

I read on a post saying that I should not install Flyspell. So I did not.
I followed some instructions on Homebrew. I think I have installed ispell successfully.
When I tried to install aspell, it says Error: No available formula with the name "aspell-en".

Now when I use M-x ispell, it says Searching for program: No such file or directory, ispell.

I saw different solutions online and tried some, but none of them worked. And since I am new to Emacs, I also do not want to mess up my .emacs file too much. So I come here for some help.


texts: Changing state of folded item with CLOSED tag in org-mode absorbs the next item

texts:
When trying to change the state of an item with (setq org-log-done 'time) enabled, they appear in the same line.
I have following org file:
* DONE A
  CLOSED: [2020-10-29 Thu 23:35]
* TODO B

When my first item is folded (org-cycle) and I change the state then it looks like this:
* A...* TODO B

Does anyone know how to fix this?


texts: Cannot jump to file or location link in grep-mode or compile-mode

texts:
I have recently installed emacs on a new system (Manjaro arch-linux), using my usual configuration (available here, if relevant).

However, the jump function never works on this new system: whenever I click a link to a location in a file in grep-mode, compile-mode, or any other mode using these links, I get an error which says Symbol's function definition is void: orig-fun.

For information I am mostly relying on helm, projectile, and desktop-mode in my workflow, if relevant.

I am using emacs 26.1, though I do not believe it is version-related, as I could replicate this problem on earlier versions of emacs (emacs 25 and 24).

I do not know how to further diagnose the issue or how to interpret this error, hence I would appreciate some suggestions.

EDIT1: This is the backtrace of the error, obtained through the emacs debugger (ran a grep-find with search term "emacs" on my home directory and selected the first link):

Debugger entered--Lisp error: (void-function orig-fun)
  orig-fun(#<marker at 145 in *grep*> "./.zshrc.pre-oh-my-zsh" nil nil)
  compilation-find-file-projectile-find-compilation-buffer(#f(compiled-function (marker filename directory &rest formats) "Find a buffer for file FILENAME.\nIf FILENAME is not found at all, ask the user where to find it.\nPop up the buffer containing MARKER and scroll to MARKER if we ask\nthe user where to find the file.\nSearch the directories in `compilation-search-path'.\nA nil in `compilation-search-path' means to try the\n\"current\" directory, which is passed in DIRECTORY.\nIf DIRECTORY is relative, it is combined with `default-directory'.\nIf DIRECTORY is nil, that means use `default-directory'.\nFORMATS, if given, is a list of formats to reformat FILENAME when\nlooking for it: for each element FMT in FORMATS, this function\nattempts to find a file whose name is produced by (format FMT FILENAME)." #<bytecode 0x168f211>) #<marker at 145 in *grep*> "./.zshrc.pre-oh-my-zsh" nil)
  apply(compilation-find-file-projectile-find-compilation-buffer #f(compiled-function (marker filename directory &rest formats) "Find a buffer for file FILENAME.\nIf FILENAME is not found at all, ask the user where to find it.\nPop up the buffer containing MARKER and scroll to MARKER if we ask\nthe user where to find the file.\nSearch the directories in `compilation-search-path'.\nA nil in `compilation-search-path' means to try the\n\"current\" directory, which is passed in DIRECTORY.\nIf DIRECTORY is relative, it is combined with `default-directory'.\nIf DIRECTORY is nil, that means use `default-directory'.\nFORMATS, if given, is a list of formats to reformat FILENAME when\nlooking for it: for each element FMT in FORMATS, this function\nattempts to find a file whose name is produced by (format FMT FILENAME)." #<bytecode 0x168f211>) (#<marker at 145 in *grep*> "./.zshrc.pre-oh-my-zsh" nil))
  compilation-find-file(#<marker at 145 in *grep*> "./.zshrc.pre-oh-my-zsh" nil)
  apply(compilation-find-file #<marker at 145 in *grep*> "./.zshrc.pre-oh-my-zsh" nil nil)
  compilation-next-error-function(0 nil)
  next-error-internal()
  compile-goto-error(return)
  funcall-interactively(compile-goto-error return)
  call-interactively(compile-goto-error nil nil)
  command-execute(compile-goto-error)


texts:
After switching to gui version of emacs and also installing prelude with helm everywhere, I have lost the ability to paste stuff in to the search prompt.

So before, I could mark a word, copy to clipboard and C-s (I-search) and then
Command-V would paste whatever was in the clipboard in to the I-search prompt.
This doesn't happen anymore.
Any ideas?


texts: Bookmark+ how to easily bookmark a window configuration?

texts:
In the manual for Bookmark+ it says:

  A function bookmark simply invokes some function — any function. You
  can, for instance, define a window or frame configuration and record
  the configuration as a bookmark. Then jump to the bookmark to switch
  contexts. (You can also bookmark a desktop and jump to that.)

Which is fine, but I'm not sure how to go about defining my window config.

Ideally I would like it so I can easily just bookmark a window layout. I would press a command, it would ask me for a name, and then bookmark my window configuration.


texts: The org-mode table alignment issue in right-to-left languages

texts:
I really enjoy writing bidirectional text in org-mode using Emacs as it supports the rt-to-left direction out of the box. However, when it comes to org tables alignment things become very unorganized.

I have this setup in my init.el file for correct RTL display in org file taken from this post:

(defun set-bidi-env ()
  "interactive"
  (setq bidi-paragraph-direction 'nil))
(add-hook 'org-mode-hook 'set-bidi-env)

MWE with a table in English vs Arabic to show the difference

* Tables in English (no alignment problems)

| No | Name           |             Tel |  Rate | Result |
|----+----------------+-----------------+-------+--------|
|  1 | John Doe       | +1-541-754-3010 | 34.99 | Fail   |
|  2 | Johnson Kirton | +1-541-754-3010 | 55.89 | Pass   |
|  3 | Debbie Cannon  | +1-541-754-3456 | 66.45 | Pass   |

* Tables in Arabic (problems with alignment)

| رقم | الاسم         |          الهاتف | المعدل | النتيجة |
|-----+---------------+-----------------+--------+---------|
| ١   | جون دو        | +1-541-754-3010 | ٣٤.٩٩  | فشل     |
| ٢   | جونسون كيرتون | +1-541-754-3010 | ٥٥.٨٩  | نجاح    |
| ٣   | ديبي كانون    | +1-541-754-3456 | ٦٦.٤٥  | نجاح    |

* And this text in English after the tables

* وهذا نص باللغة العربية بعد ادراج الجداول

Screenshot to show the display

See the alignment in the Arabic table below how it is different from that of the table in English as ugly to neat. Is there any fix to get it right?

Update

Using an Arabic monospaced font (Kawkab Mono) as kindly suggested by @Do didn't solve the problem.

Not a Duplicate

A similar issue has been reported for Japanese here, but the solutions presented there didn't help solve my problem. Changing the font to "Inconsolata-12" for example didn't change anything in the table alignment, this could be only applicable to the Japanese characters but not to Arabic ones. Neither font type nor size did improve the appearance of the alignment. The second solution in the same post, to my understanding (article in Chinese) is to try out specific pair sizes for English and the SECOND language but as I said, changing font size didn't work for me.

Another Monospaced Font

Trying out Droid Sans Mono did improve the appearance but it didn't solve it completely and in a larger table the bad alignment would be much worse. I ran out of ways to seek a TYPICAL monospaced Arabic font that will fix it. I wonder if such a font does exist!!


texts: Recursively insert a new line character in every line at a certain column

texts:
I was just going to ask how to accomplish this, but through a few DuckDuckGo searches, I was able to answer a lot of my question. I have a buffer of part numbers and part number descriptions each in a single line like this...

123456789 Description1
234567890 Descripton2

and I want to separate the different part numbers and descriptions by a new line, and also keep the part numbers with their corresponding descriptions together (separate each new part number with a blank line). I created this function which does the job this time anyway.

(defun auto-new-line()
  (interactive)
  (move-to-column 0)
  (insert ?\n)        ;; This, along with the previous line moves to column 0 in the first line and inserts a beginning new line to separate the part numbers with their descriptions from the other part number/description combinations.
  (move-to-column 18) ;; In this case the part numbers are 18 characters wide.
  (insert ?\n)
  (next-line)
  (auto-new-line())

The output of this goes something like.

123456789
(there's a tab here not sure how to input that)Description1

234567890
(Tab)Description2

And it keeps going to the end of the file.

Being an Elisp newb, there are a couple of custom things that I would like to add, but I am unsure how.

I would like to add an interactive variable so that the (move-to-column 18) can be customized for different lengths of part numbers.
Also, this is just stopping abruptly when Emacs runs out of file (because it is calling itself recursively) is there another way to have the recursive nature, but end it by itself? Will letting Emacs just run out of file cause any sort of problems?
If anyone else has any suggestions I am open to hearing them.


texts: Org: Agenda command with org-agenda-filter-by-tag not working

texts:
I have the following agenda command for things that I want to do at home:

     ("h" "thing TODO at Home"
     (

      (tags-todo "+dailies+SCHEDULED<=\"<today>+1\"")
      (agenda "" ((org-agenda-ndays 1)
                  (org-agenda-filter-by-tag  '("-work" ))
                  (org-agenda-sorting-strategy
                   (quote ((agenda time-up priority-down tag-up) )))
                  (org-deadline-warning-days 0)
                  ))
      (tags "reading")
      (tags "writing")
      (tags-todo "REFILE")

      )

     )

I am using org-agenda-filter-by-tag to remove all the entries that are tagged work. (I have some file
wide tags on the files). However, the agenda works, but is showing me also the entries tagged work.
I also tried putting the org-agenda-filter-by-tag on the top of the definition of the block agenda
but it is also not working.

Org-mode: 8.3.2
Emacs 24.5.1
OS: Mac OSX Yosemite 10.10.4

Thanks


texts: Use code variable in org-mode continuous text

texts:
I want to run a short python simulation in org-mode and use the results later
on in my continuous text. Something like:

#+begin_src python
a = 5 + 5
#+end_src

The result of the calculation is <<value in a>>

Which should export to the following latex code

The result of the calculation is 10.


texts:
In this HTML source:

<title>mark test</title>

mark test

    def add(a,b):
        return a+b

 is used to highlight some of the content of the
 block. The marked code is highlighted by being rendered in a different style.

How can something similar be achieved with org export to HTML in SRC and EXAMPLE blocks?

The following naive attempt does not work:

* Code

#+BEGIN_SRC python
  def fib(n):
      if n < 2:
          return 1
      return fib(n-1) + fib(n-2)
#+END_SRC

#+BEGIN_EXAMPLE
  def fib(n):
      if n < 2:
          return 1
      return fib(n-1) + fib(n-2)
#+END_EXAMPLE

[Bonus question: is there an HTML-independent way of highlighting parts of SRC and EXAMPLE blocks?]

Edit: as discussed in Picaud Vincent's answer the ref mechanism doesn't do the job, because of the requirements:

the highlight must be visible without the reader's intervention,
it must be possible to highlight portions of lines, not just entire lines.


texts: How does one colorize keywords in Info pages like in man?

texts:
Since I learned how to colorize man pages using LESS_TERMCAP I find them much more easy to read.

I would like to achieve the same with Info pages in emacs. For example, colorize function names, variables, example ELISP code, etc.

I tried customize-face RET info- TAB but I did not find any suitable option.


texts: How prevent `display-buffer` from opening a specific buffer in a new window if and only if it is shown in another frame

texts:
I want the *compilation* buffer to not pop up in my main frame when I have it in another frame already open. However if the buffer is not shown anywhere, I do want it to pop up in a new window of the main frame.

I have set special-display-regexps:

(setq special-display-regexps (list "\\*compilation\\*.*"))

And this somewhat works: The compilation buffer does not open in a new window when it's displayed in another frame, so far so good, but, if it is not displayed anywhere it is opened in a brand new frame - and I do not want this.

Any idea how I can tweak this?


texts: How to get vanilla find-file in Spacemacs

texts:
Even when i M-x find-file I get the Helm stuff.
I usally also want that, it's just with some Tramp stuff I think there are Problems.

How to get the plain old find-files from vanilla emacs in spacemacs?


texts: How to terminate ambiguous multi-key input in input-method?

texts:
(I’ve titled this question as I have because I imagine the answer would apply to any input method that has multikey character inputs, such as rfc1345, not just ipa-x-sampa). If it turns out this is not the case, I’ll retitle the question before accepting an answer.

I’m using the ipa-x-sampa input method for the first time—in the past I’ve usually used the rfc1345 input method or (insert-char), but right now I’m doing some phonetics-heavy work for which X-SAMPA is much-better suited. (For those who haven’t tried it: the ipa-x-sampa input method takes standard ASCII X-SAMPA input and inserts IPA characters.)

X-SAMPA uses postfix diacritics (e.g., “ë” is typed e_" or e_") for characters that can also go alone (e.g., e which is... e). But it also has characters that have alternates expressed by non-diacritic postfixes. So for instance, “r” is r, but “ɹ” (the alveolar approximant, or “North American ‘r’”) is typed
r\ or r\.

Emacs shows the difference here in that when you type an e, it comes out right away and you’re back to typing the next character, but when you type r, the r is underlined (as in other input methods, that means “waiting for disambiguating input”) and the minibuffer shows the potential disambiguating keys. (This particular behavior of the minibuffer seems peculiar to ipa-x-sampa, as input methods that have dozens of potential legal following characters, like rfc1345, do not show potential completions. Or this may be a matter of some arbitrary limit or whether the list of legal following characters can fit in the minibuffer, I’m not sure.)

My question is this: if I type one of those and have the underline and minibuffer prompt, how do I say, “that's all, I just want an ‘r’”? rSPC gives me r with the space, which I can delete. And C-g also terminates the r, but of course beeps and potentially cancels an operation in progress. So, is there a standard way in these input methods to say “I’m done with this character now”?

There aren’t many places where it matters—for the most part, X-SAMPA was designed such that it should be unambiguously convertible into IPA. But this isn’t 100% true.¹ For instance, the string tS can be rendered either as t͡ʃ(two characters, with a tie added separately) or as ʧ (one). In this case, I might have to type tSPCDELS or tC-gS.

It seems to me C-g should be right, as I know that (keyboard-quit) only cancels a single function—meaning if you’re in the midst of a function calling another interactive function, only the top-of-stack interactive is explicitly cancelled—but character continuation apparently doesn’t count; if I start an isearch with C-s and type tC-g, the isearch is cancelled, so I only know of the SPCDEL working in this case.²

¹ X-SAMPA is more or less unambiguous in its most-common use cases of phonemic transcriptions and marked-language use. It only becomes ambiguous in close phonetic transcription and interlingual use.

This is why, for instance, in modern natural-sounding text-to-speech systems that accept X-SAMPA or IPA for pronunciation hints, even in places where you can write the X-SAMPA two different ways in IPA, both variants of the IPA will produce identical output speech, while in older, artificial-sounding, ones, the two would produce different speech—the older ones didn’t have to know what language they were speaking so could use “foreign” sounds, but the newer TTS systems always speak in a given language so “know” to substitute native sounds when necessary.

² This answered question notes that isearch does not actually “use the minibuffer” proper, and only uses the input method already set when invoked. This is true but, I think, irrelevant to my question.


texts: Linking Multiple Implementation Files in C on Emacs

texts: I need help with linking multiple c source code files on emacs. Could anyone show me the way on how to work this out? Thanks!


texts: How add company-dabbrev to the Company completion popup?

texts:
Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
of 2015-07-25 on KAEL

Compiled from EmacsW64.

, using the latest version of  from MELPA

Windows 7 x64 bit.

Situation:

For example, I'm typing in the buffer foobarsentence.

And then start a new line below that, and typing fooba, I expected to get foobarsentence suggested from the Company popup completion window. But there is no foobarsentence.

I found it out from another answer that I could use company-dabbrev`` for that, bound, M-/. But I couldn't figure out how I could 'feed' the suggestions from company-dabbrev into the popup-window. I made a screencast gif to made my question clear.

As you can see, M-/ calls company-dabbrev. But I would like to see that suggested in the company completion popup. It surprised me this is not by default.

Any suggestion in order to 'feed' the suggestions from company-dabbrev to company popup window?


texts: How are a daemon and a server different in Emacs?

texts:
After running (server-start) in Emacs, I evaluated
(daemonp)

and
(server-running-p)

The first one returns nil, whereas the second one returns t. So, how are a daemon and a server different in Emacs? The official website http://www.nongnu.org/emacsdoc-fr/manuel/emacs-server.html does not seem be distinguish the two.