texts:
How can I set up golangci-lint as the linter with my config? I've tried using flycheck-golangci-lint but it doesn't seem to be working. I'm testing my config by opening a .go file with an ineffectual assignment that trips golangci-lint when run from the CLI tool. My Go and LSP configs are:
;; lsp-mode configs
(use-package lsp-mode
  :delight lsp-lens-mode ""
  :ensure t
  :init
  ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l")
  (setq lsp-keymap-prefix "C-c l")
  :custom
  (lsp-auto-guess-root +1)
  :config
  (lsp-enable-imenu)
  (setq lsp-prefer-flymake nil)
  (setq lsp-headerline-breadcrumb-enable t)
  :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode)
         (python-mode . lsp-deferred)
     (scala-mode . lsp-deferred)
     (sh-mode . lsp-deferred)
         (go-mode . lsp-deferred)
         ;; if you want which-key integration
         (lsp-mode . lsp-enable-which-key-integration)
     (lsp-mode . lsp-lens-mode)
     (lsp-after-open . 'lsp-enable-imenu)
     )
  :commands (lsp lsp-deferred))

;; go-mode
(use-package go-mode
  :delight ""
  :hook
  (before-save . lsp-format-buffer)
  (before-save . lsp-organize-imports)
  )

;; flycheck-golang-ci-lint
(use-package flycheck-golangci-lint
  :ensure t
  :hook
  (go-mode . flycheck-golangci-lint-setup)
  )

Apologies for the wall of code - I want to make sure I don't miss anything that might be causing flycheck-golang-ci-lint to fail.


texts: How can I ask emacs to show me (visually) invisible characters like CR LF?

texts:
The title says it all:  I want emacs to show (all, or only some, like CR LF) invisible characters in my buffer? (If it matters: I am using the latest emacs (25) on the latest debian testing)

(I am not used to the tags used on this site, so please help to make more useful tags)


texts: emacsclient "unknown command" when opening file

texts:
Whenever I try to open a file with emacsclient (and emacs is running, and the server is running, and the socket is there), I get this error message:

Marcins-MBP:docker-influxdb-grafana marcin$ emacsclient -s /Users/marcin/.emacs.d/server-sockets/server --alternate-editor="" influxdb.conf
Waiting for Emacs...
-emacs-pid 3747
-error Unknown&_command:&_/Users/marcin/dev/thirdparty/docker&-influxdb&-grafana/influxdb.conf

What's up with that? How can I fix it?

I'm running aquamacs:

Aquamacs 3.3  GNU Emacs 25.1.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C109))
 of 2016-09-19 on 24a02dbf6b34ae061ef4df89f15bfbc5d3ed497e


texts:
I have a book list contained which will be read or had done. Like this

* English books [0/2]
  - [ ] bible
  - [ ]

When I use C-c C-c to check, is it possible to add date behind or add low level automatically.

* English books [1/2]
  - [X] bible   :03/22/2016
  - [ ]

Or

* English books [1/2]
  - [X] bible
     - DONE:03/22/2016
  - [ ]

Or

* English books [1/2]
  - [X] bible
   :PROPERTIES:
   :DONE:03/22/2016
   :END:
  - [ ]


texts: Displaying some characters with all-icon instead of my current font

texts:
Usually people want to print some characters and end up having strange squares clearly telling them this character is unknown by their default font and they have no fallback font for it.
My problem is quite the opposite, my current font (Fira Code) actually knows all the characters and seems to not agree with all-icons on some of them.
In my custom.el file I have a function to display some bullets as special characters and I explicitly wrote:

I put screenshots because it looks like StackExchange can't handle these unicode characters:
'(? ? ? ?)

When I put my cursor on one of these characters and M-x describe-char I get the following answer:

Note that the code for this character is #xe3d0 (and the other three are #xe3d(1/2/4)" so I could write my list like this:
'(#xe3d0 #xe3d1 #xe3d2 #xe3d4)

Anyway, when I restart my emacs to have my prettified bullets:

And even better, if I go back to my customisation file (at least it's coherent):

I tried adding:
(set-fontset-font "fontset-default"
                  '(#xe3d0 . #xe3d4) (font-spec :name "FontAwesome"))

But it didn't change anything.

[EDIT] If I write this list (according to https://en.wikipedia.org/wiki/Enclosed_Alphanumerics):
'(#x2460 #x2461 #x2462 #x2463)

I have the wanted result:


texts: org-mode timestamp repeater interval manipulation

texts:
What are (if any) the lisp functions to read and write the repeater interval part of the org-mode timestamps? (The ones at the end of the timestamp string, which are optional, e.g. +1w or +6d in <2016-03-03 Thu .+6d -3d> or [2016-01-27 Wed ++1w -2d])

If there are none such functions, how does one approach creating them?

Any way to convert them to seconds for use in arithmetic manipulations?


texts: Cperl-mode syntax highlighting breaks when inserting a newline into a here doc

texts:
in cperl-mode, here docs are colored with a font-lock-string-face. However if you used any function that inserts a newline on a blank line (e.g. M-: (insert "\n")) it will cause all code after the newline to be highlighted with font-lock-comment-face. The only way to fix it is try and "mess with" here doc tags so that cperl re-parses and corrects the font-lock. I have a feeling this may have something to do with this issue since it is also dealing with multi-line syntax highlighting. Is there an expert out there who can help me find a way to fix this?

#!/usr/bin/env perl

my $here_doc = <<'_HERE_';
this is here doc line
<--- call (insert "\n") when cursor is here
_HERE_


texts: How to install multiple dictionaries in Emacs?

texts:
I am using Emacs 26.1 on MacOS 10.14.2. I am trying to use hunspell with 3 dictionaries that are installed in ~/Library/Spelling but when I start Emacs I got the following error: Wrong type argument: stringp, nil

;; Portuguese dictionary
 (with-eval-after-load "ispell"
   (setq ispell-program-name "hunspell")
   (setq ispell-dictionary "en_GB,en_US,pt_PT")
;;   ispell-set-spellchecker-params has to be called
;;   before ispell-hunspell-add-multi-dic will work
   (ispell-set-spellchecker-params)
   (ispell-hunspell-add-multi-dic "en_GB,en_US,pt_PT"))


texts: How do I automatically enter evil-insert-state after running the org-add-note command?

texts:
I have tried this out of guesswork but it doesn't work:

(add-hook 'org-add-note-mode-hook 'evil-insert-state)

Which follows the syntax of something that does work:

(add-hook 'org-capture-mode-hook 'evil-insert-state)

Bonus: How do I find out more information about the hooks available so I can call them correctly?


texts: Weird spacing with whitespace newline mark "↴"

texts:
I have my whitespace newline mark set to the "↴" character,

(setq whitespace-display-mappings '(
                                    (newline-mark 10 [8628 10])
                                    ))

Now, the spacing is fine when I use DejaVu monospace font, but with all the other fonts I've tried, I get this kind of behavior:

I know it's just because I'm using a weird whitespace character but I like it and I'd like to keep it. Is it just because of the font limitation, or are there other ways around this?

Thanks! :)


texts: R (ESS) freezes emacs when asking for project directory

texts:
Using Windows. Fresh install of emacs 2.6.
The installation of R CLI and R studio worked ok. No issues.
 I open R files on emacs and ESS mode is properly set on modeline but when I try to execute/eval a line or paragraph (C-x C-r or C-RET) Emacs asks for "R starting Project directory".
I accept the offered path and emacs freezes. The only thing I can do is killig it from task manager because close window does not work. Emacs is unresponsive.

Tried to open R terminal wwith M-x R freezes emacs too.
Tested on two different machines using plain simple emacs and Vincent Goulet Modified Emacs for windows
https://vigou3.gitlab.io/emacs-modified-windows/
same results on both


texts: Lisp nesting exceeds max-lisp-eval-depth in python-mode 6.2.3, Emacs 25.2

texts:
I have this simple Python test program:

#! /usr/bin/env python3
import numpy as np

x = np.array([0, 1, 2, 3])
y = np.array([0, 1, 4, 9])

def gen_segments(x, y):
    for i in range(0, len(x)-1):
        yield (x[i], x[i+1]), (y[i], y[i+1])

lines = [list(zip(s, t)) for s, t in gen_segments(x, y)]

when I position the cursor at the end of the line starting with yield and press ENTER, Emacs gives me the following error:

  "Lisp nesting exceeds ‘max-lisp-eval-depth’"

I am using Emacs version 25.2 on Ubuntu 17.04.

Here is a minimal setup to reproduce the problem:

$ emacs -Q -l init.el t.py

where t.py is the above python program, and init.el is:

(setq debug-on-error t)
(setq package-load-list '((python-mode t)))
(package-initialize)
(setq package-enable-at-startup nil)

The Python mode that package-initialize above loads was
installed with the Emacs package manager as python-mode-20170307.457 in my elpa directory. If I comment out the line (package-initialize) above, it works fine (then Emacs uses the Python mode in /opt/emacs-25.2/share/emacs/25.2/lisp/progmodes/python.el.gz instead).


texts: How do i get rid of "default" (last used) string in some emacs functions?

texts:
I have the following problem : when i use 'C-x r t' (string-rectangle), i am prompted to enter some string, to replace the selected rectangle. Lets say i type ";;" (to comment out the rectangle). This works just fine, but the next time i call the same function, and i want to replace with nothing (empty string), i can not do that, because there is "default" string ";;" that i previously used, and if i just hit enter the command will use that ";;" string instead of empty one. How do i set it to empty string ?

Similar problem i had with some search/replace functions. Basicaly, when it remembers the last string i used, and sets it to default, how do i "enter" empty string instead ?

EDIT :

Kill-rectangle, mentioned by YoungFrog solves the specific problem, but i had another thing in mind : basicaly, in what ever function emacs remembers the last value you entered, and uses it as "default" when you just hit enter, you should be able to clear that "default" to whatever was real default before you first used the function. Here is another example :

In dired mode, if you 'M-x rgrep' it asks you for 3 inputs :

1) What to search for : whatever you enter here, will be used as default next time you use rgrep. As someone pointed out, it makes no sense to search for empty string, so clearing this "default" value is indeed never needed i guess.

2) Next it will ask in what files to search for. It's real default is "all" files. If i enter *.txt, and search, next time when i use rgrep, *.txt will be used as "default". Now i wish to clear this "default" *.txt, and return to its original default, "all", just as i wanted to clear ";;" "default" in string-rectangle function to it's real default, empty string.

Of course, this specific problem for all files could probably be solved with typing * ? But this general problem potentialy remains with other commands that remember last used value.

3) It will next ask for Base directory, no problem here.

So, the way i see it, whenever emacs tries to help me by remembering my last used value in some command (which i find very helpful most of the time) there should be a way to clear that used value as if i never used that command before.

P.S. I am still new to emacs, and perhaps the functionality i require is not needed, as there is always some workaround ?


texts: What does "You can run the command X with Y" mean?

texts:
I'm running M-x man ... and I'm getting this in my *Messages* buffer:

You can run the command `man' with m

What does it mean? It obviously doesn't run when I just press m and it doesn't run man when I do M-x m either.

I have looked in my config and there's nothing mentioning man there.


texts: How can I make Dired buffer names include the full path?

texts:
I often have many dired buffers open, including some for folders that have identical names. Occasionally, this causes me to switch to the wrong one, so I am looking for a way to fix this.

Currently, if I have multiple identically-named folders open in dired, then my buffer list looks something like this:

foo
foo<2>
bar
foo<3>
bar<2>

I would like to include the full path (or some portion of it) in the buffer name so I can see which folder I am actually switching to. I would prefer to do it like this:

foo</full/path/to/foo>
foo</another/path>

and so on. I could also settle for e.g.:

/full/path/to/foo
/another/path/foo

but I would prefer the former, because it will usually be easier to find the buffer I want by folder name first, and full path second. How can this be done?


texts: Why is my use-package not installing packages properly? (Using org-mode init file and babel)

texts:
I'm new to emacs and I'm trying to setup my init file using a .org file with org-babel-load-file. I've read that it's a good idea to use package use-package to configure packages and to make sure they are installing when moving my init file to another PC (:ensure t).

But the problem is that my setup does not install everything properly. For example, when installing flycheck, I'm using this configuration (this lines of code are available in the flycheck READ.me, also):

#+begin_src emacs-lisp

(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))

(use-package flycheck-irony
  :ensure t)

(use-package flycheck-rtags
  :ensure t)

#+end_src emacs-lisp

But, when I open emacs on another computer, I have to manually install flycheck and even use M-x global-fly-check-mode because the init does not work either.
I really don't know what to do. I was trying to install cmake-ide but the same thing happened.
I'm contantly pushing my init file to https://github.com/mrisso/dotfiles

I'd be glad if you guys help me with that. Thanks!


texts: How to detect if `read-event` or `y-or-n-p` is running?

texts:
In haskell-doc-mode we have a timer that shows useful tips in minibuffer when cursor is idle for a moment. In other part of Haskell Mode there is code asking questions using y-or-n-p or read-event. The problem is haskell-doc-mode does not know about this and overwrites echo area. Users are confused and think Emacs is hanging.

Is there a general mechanism to detect if read-event or y-or-n-p is running?

Link to the reported issue:

https://github.com/haskell/haskell-mode/issues/820


texts:
Q: how do I unlist an org-mode plain list?

I have a plain list that looks like:

* header

  - List item 1.
  - List item 2.
  - List item 3.

I want to remove the plain list formatting and convert it to plain
text:

* header

List item 1.  List item 2.  List item 3.

I want to do this programmatically.  Are there org facilitates
to strip off the bullets and refill the text, or do I
need to roll my own?


texts: Why can't I directly invoke the result of apply-partially?

texts:
I'm confused about return value of apply-partially. Documentation states that it returns a function, and source of the function shows that it actually retruns a lambda. But I can't invoke the return value directly, only via funcall. Creating lambda directly at the call place allows me to invoke it directly.

Here are three examples of what am I talking about:

((apply-partially 'string-prefix-p ".") ".emacs")
;; => (invalid-function (apply-partially 'string-prefix-p "."))
((lambda (x) (string-prefix-p "." x)) ".emacs")
;; => t
(funcall (apply-partially 'string-prefix-p ".") ".emacs")
;; => t

Why is it working in such way?


texts:
This is a follow-up on the comments on this answer. The following bits of code seem to be equivalent:

(and a b)

(when a b)

Of course and lets you put more conditions: (and a b c d) means (when (and a b c) d)

I tend to use when only to express branching. Are there actual differences? Is it better to use one or the other?

I don't have Emacs' C source at hand; and is a C function; when is a macro that expands to if, which itself is a C function.


texts: When to use normal incremental search in place of the regex version?

texts: Assuming familiarity with regex, is there ever any reason to use the normal incremental search (C-s) over regex (C-M-s)?


texts: Org mode 20161102 Latex export: Images without {center} environment

texts:
Present 20161102 org mode now exports images by default wrapped in \begin{center}..\end{center} environments.

This destroys layouts and confuses export scripts made with earlier versions or different settings in mind.

(\centering is added in the case of figures. This is in principle a bit less obtrusive, as here we are telling org to prepare the environment.)

How can I turn off this "feature"?


texts: Example of drawing rectangle in picture-mode

texts: I have been going through the manual of picture-mode and have been wondering if it's possible to draw a rectangle and connect it with another rectangle or something like that?


texts: How to search and replace, with search starting with the current selection

texts:
I would like the "search" from search and replace, to be the selected region.

Is there a command doing that already ?


texts: how to define an evil-operator to move forward/backward a text-object?

texts:
I am trying to define a function that moves to the begin/end of current text-object.

First - I define an operator:

(evil-define-operator evil-forward-text-object (beg end type)
  "move to end of text object"
  (if (eq type 'block)
      (evil-apply-on-block #'evil-forward-text-object beg end nil)
    (goto-char end)))

In this case I need to press M-w i ) to move forward a bracket.
There will be an i or a, it is troublesome to type a or i,
and there is no difference between i and a.

Next - I try to set the keymap:

(define-key evil-motion-state-map (kbd "M-w")
  evil-inner-text-objects-map)

This works in some cases, such as M-w p or M-w o
(forward a kebab-style Lisp symbol).
But in most cases it does not work - for example, M-w ) and M-w ".

How can I define a command such as I described?


texts: how to get buffer for file specified on command line?

texts: Let's assume I invoke EMACS (24.3.1) always with just one file name to visit.  How do I get the buffer for that file while in my .EMACS startup?  I tried it and the function (current-buffer) will return my scratch buffer.


texts:
I found the command SPC m x c to insert a small code snippet like ~~. I would like to insert a longer snippet like

 #+BEGIN_SRC
 #+END_SRC

Is there a command to do this? I found a way to add it for markdown, which is SPC m x c


texts: Is there a way (a package?) to "redirect" pop-up menus to the minibuffer, ido, or completion buffer; either generic or flyspell-specific

texts:
Sometimes I must use Emacs (in X mode) over a network connection (for example, working on a cloud VM). I am pretty comfortable with the interface responsiveness inside a frame, although X is notoriously sensitive to network delays. But when it comes to any type of creating a new X window, be it a menu, a tooltip or a new frame, I'm looking at a few seconds wait. Tolerably painful if I want a new frame--this is not something I do often--but entirely unusable for a menu.

Unfortunately, flyspell, that I often use, is hard-coded to invoke x-popup-menu¹. Fixing a typo manually is certainly faster than popping up the menu, but there is not a function in it to add the word to dictionary, and this is where the menu gets me.

But nothing in principle prevents one from fbinding their own override version of x-popup-menu to intercept calls to it. So my question is, essentially, two-part:

Is there a more or less generic way (a package, presumably) that converts pop-up menus into (ideally) ido prompts, or other in-frame interface, e. g., the usual completion buffer? This would be a win for me!
If such a thing does not exist, is there a flyspell-specific modification: a package that hooks into flyspell, or a fork that does not use menus, or just anything but the popups?

I am aware of certain alternatives. For example, I use tramp mode over SSH when feasible and edit remote files in a local, responsive Emacs. But it often happens that all I have on me is a Windows laptop, so a remote X client is the only practical option.

¹ Tangentially, and curiously, for the (late) XEmacs flyspell has a separate code path that invokes the more general, window-system-agnostic popup-menu function, which exists, and is supposedly compatible, in GNU Emacs. Even though the XEmacs project has been thoroughly dead for a decade, being one of its major developers, I can't stop wondering what was the reason for this...


texts:
System Config: macOS Sierra, Emacs v26.1 installed from emacsformacosx.com

issue: On a fresh install, the C-x key is mapped to M-x by default.

Is this the default behaviour?

If so, how can I change the keymapping to emulate the default mappings in Ubuntu?


texts:
I'm currently working on a JavaScript project using Backbone.js and I wonder how can I navigate between files, based on method and object definitions.

For example, I keep references to some of my views in the global object App.Views, and I would like to be able to navigate to each individual definition (App.Views.Home, App.Views.SomePage, etc.) if I encounter one. Also, there are a lot of closures used for avoiding namespace leaking, and I want to know how can I automatically follow these definitions.

I've seen tern but there are not many examples on how to configure it so I have not been able to do much.

What are some good tools for this?


texts: Insert Org or Markdown code blocks with Babel in org-mode?

texts:
In org-mode, if I do something like this:

#+begin_src org
## What does this PR do?
- Updates the Dockerfile to make the `dev` service connect to a shared network at startup
- Registers the `create_docker_network` and `remove_docker_network` `gogo` commands
- Advertises new `gogo` networking commands
- Bumps `gobase` version in the service's Jenkinsfile
- Provides a script to create the network at build time
- Adds a Jenkins step to run the script to create the network

## How to test
*Remember you have to download the latest `gogo` version!*

### To watch it fail
1. Run `gogo start`
* It will fail because most likely the network doesn't exist
#+end_src

The result gets rendered like this:

What can I do to make it render correctly as code?


texts: How do I change the default indentation of 'if' for Common Lisp and Scheme?

texts:
When I am using (setq lisp-indent-function 'common-lisp-indent-function), the ifs are indented like this:
(if x
    y
    z)

For Scheme, (setq lisp-indent-function 'scheme-indent-function) also produces the same indentation as above.
I would prefer ifs to be indented like this instead:
(if x
  y
  z)

Is there a way to customize common-lisp-indent-function and scheme-indent-function such that ifs will be indented by two spaces instead of being aligned with the predicate?


texts: Accidentally disabling evil mode in spacemacs

texts:
While use spacemacs in evil mode, I sometimes accidentally disable evil mode and I do not understand how I am doing it. And once disabled, I do not know how to reenable the mode without restarting emacs.

Any idea what I am doing?
How do I reenable evil mode?


texts: Whitespace mode settings on per major mode basis

texts:
When I open the Linux Kernel code, my default indentation conflicts with the desired formatting of the Kernel. I use Emacs Prelude, so I added the settings from this link to my c-mode-common-hook. I constrain the indentation only to the Kernel code base by checking the path of the opened file, as they did on the link.

However, one problem remained. Since the Kernel codebase uses tabs and my global whitespace-style is set to '(face tabs empty trailing lines-tail), a bunch of whitespaces in the Kernel code are highlighted. How can I disable tab highlighting within my c-mode-common-hook?

Note that I still want to keep highlighting in other buffers that are not the part of the Kernel codebase.

Update:
It looks like setting buffer-local variable does not solve the problem. If I do:

(setq-local whitespace-style (remq 'tabs whitespace-style)

in c-mode-common-hook, it does correctly set the buffer-local variable. I can check it by doing M-: whitespace-style in a Kernel code buffer (it shows the new value I set). However, the buffer still highlights the tabs. It is only when I do M-x whitespace-mode once to disable it, and once more to enable it again that the highlight actually disappears. Unluckily, if I add two (whitespace-mode) in c-mode-common-hook after setting the buffer-local variable, it does not have the same effect as when I call it with M-x once the buffer is fully initialized.


texts: Indenting LaTeX code for \if \else \fi statements

texts:
This is related to this Emacs.SE question.

I use the code from the answer:

(setq LaTeX-begin-regexp "\\(?:begin\\|if@\\)\\b")
(setq LaTeX-end-regexp "\\(?:end\\|else\\|fi\\)\\b")
(defun LaTeX-indent-level-count ()
  "Count indentation change caused by all \\left, \\right, \\begin, and
\\end commands in the current line."
  (save-excursion
    (save-restriction
      (let ((count 0))
        (narrow-to-region (point)
                          (save-excursion
                            (re-search-forward
                             (concat "[^" TeX-esc "]"
                                     "\\(" LaTeX-indent-comment-start-regexp
                                     "\\)\\|\n\\|\\'"))
                            (backward-char)
                            (point)))
        (while (search-forward TeX-esc nil t)
          (cond
            ((looking-at "left\\b")
             (setq count (+ count LaTeX-left-right-indent-level)))
            ((looking-at "right\\b")
             (setq count (- count LaTeX-left-right-indent-level)))
            ((looking-at LaTeX-begin-regexp)
             (setq count (+ count LaTeX-indent-level)))
            ((looking-at "else\\b"))
            ((looking-at LaTeX-end-regexp)
             (setq count (- count LaTeX-indent-level)))
            ((looking-at (regexp-quote TeX-esc))
             (forward-char 1))))
        count))))

But instead of getting this indentation:

\ifx\condition
  \dosomething
\else
  \dosomethingelse
\fi

I do get

\ifx\condition
  \dosomething
  \else
  \dosomethingelse
\fi

Hoe to get the \else in line with \if and \fi?


texts: Creating an association list with element evaluation

texts:
So as far as I understand it you create association lists that look like

'((rose . red)
 (violet . violet)
 (chrysanthemum . who-knows))

My question is, what do you do if you want rose, violet, etc., to be evaluated before they're put into the alist?

For example, for normal lists you can do

(list 1 2 3 4)

instead of

'(1 2 3 4)

How do you replicate this functionality? I'm new to elisp and Emacs, so please forgive any errors or misnomers.


texts: "Tramp: Opening adb shell connection...failed" + extra characters ^[7 and ^[8 present

texts:
It happens when I try to connect from emacs-26.3/tramp-2.3.5.26.3 onto my sgs5's lineageos14.1 adb shell.
*tramp/adb d73896d9* buffer contents is the following:
   nv COLUMNS=1 ls -d -l /; echo tramp_exit_status $?^M
   /system/bin/sh: nv: not found
   tramp_exit_status 127
   klte:/ $ ^[[K^Mklte:/ $                                                             ^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H

from *debug tramp/adb d73896d9*, I can see following command is used by tramp: adb -s d73896d9 shell.
Following is the output from manual run:
   prompt$ adb -s d73896d9 shell
   ^[7

Session DOES NOT end here, it's functional - the only strange thing here is that funny prompt.
pressing enter adds ^[8klte:/ $  to the output so that the full output from very beginning looks like following:
prompt$ adb -s d73896d9 shell
^[7
^[8klte:/ $

subsequent presses of ENTER just adds klte:/ $  prompts so that full output looks like following:
prompt$ adb -s d73896d9 shell
^[7
^[8klte:/ $

klte:/ $

klte:/ $

Is the ^[7 and and ^[8 main player here? That's why we do have nv COLUMNS=1 ls -d -l / instead of env COLUMNS=1 ls -d -l / above (e is swallowed by ^[7 somehow?).
when I run adb shell from non-emacs terminal or from M-x term, I get correct prompt immediatelly, ie no extra ^[7 and ^[8 characters are present + no extra empty line is produced later down between subsequent prompts.
please help.


texts:
I'm using org-mode in Spacemacs and have this code block:

#+BEGIN_SRC js :var payload=access-token-payload
let parsedPayload = JSON.parse(access-token-payload);
return parsedPayload.access_token;
#+END_SRC

Expected behavior:
The code executes when I press C-c C-c

Actual behavior:
I get an error saying No org-babel-execute function for js!. This should be supported since org-babel is present. I code a lot of Node and Javascript applications so Node is in my path.


texts: paragraph reflow and advance to next para?

texts: Excuse tyro question (google hasn't helped), but the default behaviour of paragraph reflow (M-q) not advancing to the next para doesn't suit me, particularly when reflowing a large section of text, and i end up doing the combination para-reflow, advance para (M-q, M-]).   This is a surprising awkward combination to key in repeatedly.  Is there any simple way ("simple" is important for me!) to redefine M-q to behave like M-q M-]?


texts:
I'm using the C-x C-f option to use SSH to edit a file.

The file I'm editing requires my SSH user to use sudo.

When I start editing the file it says read-only. How can I remotely edit files requiring sudo?


texts: How to use a macro append macro argument to a list?

texts:
I want use a macro to generate a package list.

(defvar xx-packages '())

(genpack evil)
(genpack all-the-icons-ivy-rich
   :recipe (:host github :repo "seagle0128/all-the-icons-ivy-rich"))

this macro genpack will append argument to xx-packages,then xx-packages value is

xx-packages '((evil)
              (all-the-icons-ivy-rich
                   :recipe (:host github :repo "seagle0128/all-the-icons-ivy-rich"))

How can i write this macro genpack, thanks


texts: How to reproduce `git push -u` behavior, that is, auto-set local branch as the new remote or push branch?

texts:
No matter how I fiddle with magit options, I cannot reproduce the following behavior:

I checkout origin/master.
I create a new feature-branch on top of it; its name is unique.
I make changes, add commits to that branch.
I push the branch, and it ends up as origin/feature-branch.

This behavior is trivially achieved by git push -u.

From within magit, the "Push" popup suggests to set upstream, but it suggests master, or other existing upstream branches.

I want my local name branch be settable as upstream, or the push remote branch, without copy-pasting.

An elisp snippet to set the upstream branch would be equally helpful.


texts: How to force the variable 'bidi-paragraph-direction' taking the value 'left-to-right' in a math environment in LaTeX-mode

texts:
One of the great features of Emacs is its ability to handle bidirectional support for the right-to-left languages (like Hebrew, Arabic and Persian). Note that even in these languages mathematical formulae are written from left-to-right. So when typing a mathematical formula (usually between $ $) in a right-to-left line, it would be desirable to temporary force the direction left-to-right. For example in the following line I have written $V^*$ but Emacs shows it in reverse.

I know the setting (setq bidi-paragraph-direction 'left-to-right) can be used to change to the correct direction. Also the variable texmathp can be used to determine if the cursor is in a math environment (see how to detect if inside a LaTeX math environment? and https://emacs.stackexchange.com/a/548/2609).

But I don't know to put these altogether. So my question is

How to force the direction from right-to-left in a math environment?


texts:
Once I connect to a remote computer using tramp. It connects but tramp keeps trying to open the connection.  This is the output that is printed again and again.

 Tramp: Waiting for prompts from remote shell...done
 Tramp: Found remote shell prompt on ‘gnu’
 Tramp: Opening connection for gnu using ssh...done
 Tramp: Opening connection for gnu using ssh...
 Tramp: Sending command ‘exec ssh -q   -o ControlMaster=auto -o
 ControlPath='tramp.%C' -o ControlPersist=no -e none gnu’

I don't know what's is wrong exactly. Any ideas?

Edit
The problem was not really resolved. I looked into recenf as suggested by @MichaelAlbinus. I default recenf but nothing more. My rencenf config is below

(require 'recentf)
(setq recentf-auto-cleanup 'never) ;; disable before we start recentf!
(recentf-mode 1)

For now I'm getting away with C-g  until it stop trying to connect.

Then I defined this function when I lose patience.

(defun tramp-refresh ()
  (interactive)
  (recentf-cleanup)
  (tramp-cleanup-all-buffers)
  (tramp-cleanup-all-connections))


texts: Mediawiki mode stopped working after upgrading to the latest 20150403

texts:
In Emacs 24.3.1, I upgraded Mediawiki package to the latest version, 20150403...,  using the package manager.  After restarting, I found that I can't access remote Mediawiki sites any more, after inputting user name and password as usual, I got a

Wrong type argument: listp, 0

error in the mini buffer.  Anybody else?  Any idea how to fix it?

Edit:

This is what I get in a backtrace buffer:

Debugger entered--Lisp error: (wrong-type-argument listp 0)
  mediawiki-page-get-revision((page ((pageid . "1") (ns . "0") (title . "Main Page") (contentmodel . "wikitext") (pagelanguage . "en") (touched . "2014-03-12T04:57:54Z") (lastrevid . "505") (counter . "2691") (length . "141") (starttimestamp . "2015-05-29T07:52:26Z") (edittoken . "b3b54027c1c571738764f73dee1e4abd+\\")) (revisions nil (rev ((revid . "505") (parentid . "454") (user . "XXX") (timestamp . "2014-03-12T04:57:54Z") (comment . "") (contentformat . "text/x-wiki") (contentmodel . "wikitext") (xml:space . "preserve")) "Main page."))) 0 timestamp)
  mediawiki-save-metadata("1" (page ((pageid . "1") (ns . "0") (title . "Main Page") (contentmodel . "wikitext") (pagelanguage . "en") (touched . "2014-03-12T04:57:54Z") (lastrevid . "505") (counter . "2691") (length . "141") (starttimestamp . "2015-05-29T07:52:26Z") (edittoken . "b3b54027c1c571738764f73dee1e4abd+\\")) (revisions nil (rev ((revid . "505") (parentid . "454") (user . "XXX") (timestamp . "2014-03-12T04:57:54Z") (comment . "") (contentformat . "text/x-wiki") (contentmodel . "wikitext") (xml:space . "preserve")) "Main page."))))
  mediawiki-get("1" "Main Page")
  mediawiki-edit("1" "Main_Page")
  mediawiki-site()
  call-interactively(mediawiki-site record nil)
  command-execute(mediawiki-site record)
  execute-extended-command(nil "mediawiki-site")
  call-interactively(execute-extended-command nil nil)


texts: How can I save the current Unix working directory in a variable?

texts:
I know I can run M-x pwd which will give me Directory ~/ or something like that. Can I get it without the "Directory" bit?

Thank you very much.


texts: Org-mode adding statistic cookie to date-tree lines in capture

texts:
In this video(timestamped to relevant section), I see this guy's org file in a date-tree with the [/] statistic cookie next to each YYYY-MM-DD headline.

https://youtu.be/-2RXhPV_zgc?t=12m51s

I'd like to be able to do date-tree captures in a file that has those statistic cookies.  Even though I can't figure out how to get this automated in a capture template, I figured I could just add them manually when I'm not capturing and working on that file directly.  But the problem is that when I then do another capture, it doesn't recognize the YYYY-MM-DD line after I edit it to include the [/].


texts: how can I re-use the window created by `display-buffer-in-side-window`?

texts:
I'm creating a window at the bottom of the frame with display-buffer-in-side-window and it displays a given buffer, I would like to have another buffer created but re-use that exact same window.

How do I do that? I'm keeping track of the value yield by (get-buffer-window (current-buffer)).

(defvar tortuga-first-open-window nil
  "Track the window of the first shell opened.")

(defun tortuga-shell ()
  "Open the first terminal at the bottom of the frame."
  (interactive)
  (if tortuga-first-open-window
      (set-window-buffer tortuga-first-open-window (tortuga-shell--create-new))
    (select-window
     (display-buffer-in-side-window
      (save-window-excursion
        (tortuga-shell--create-new))
      `((side . bottom)
        (window-height . ,tortuga-first-open-window-height)))))
  (setq tortuga-first-open-window (get-buffer-window (current-buffer))))

(defun tortuga-shell--create-new ()
  "Create a new eshell."
  (interactive)
  (let* ((count (+ 1 (length tortuga-shell-buffer-list)))
         (new-eshell-buffer (get-buffer-create (format "%s<%d>" eshell-buffer-name count))))
    (tortuga-shell-setup new-eshell-buffer)
    (add-to-list 'tortuga-shell-buffer-list new-eshell-buffer)
    new-eshell-buffer))

(defun tortuga-shell-setup (buffer)
  "Setup new buffer BUFFER as eshell buffer."
  (with-current-buffer buffer
    (eshell-mode)
    (add-hook 'kill-buffer-hook #'tortuga-after-kill-buffer nil :local)
    (local-set-key (kbd tortuga-hydra-start-key) 'tortuga-hydra/body)))


texts: org-export latex pdf output does not render svg

texts:
I tried out this section of code from this repo
#+LATEX_HEADER_EXTRA: \usepackage{svg}

...

#+PROPERTY: header-args :eval never-export :file-ext svg

...

#+NAME: sequence12422
#+BEGIN_SRC plantuml :file-ext png
  ' this is a comment
  Alice -> Bob: Authentication Request
  Bob --> Alice: Authentication Response
  John --> Alice: another Authentication Request
  Alice --> John: another Authentication Response
#+END_SRC

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

#+NAME: svg-seq
   #+BEGIN_SRC plantuml
     ' this is a comment
     Alice -> Bob: Authentication Request
     Bob --> Alice: Authentication Response
     John --> Alice: another Authentication Request
     Alice --> John: another Authentication Response
   #+END_SRC

   #+RESULTS: svg-seq
   [[file:svg-seq.svg]]

the png image gets rendered but the svg does not. My org-version is 9.1.9 on macOS mojave. What is the proper way to render svg images on pdf with org export? Am I missing a package or something?
EDIT: In the exported tex file, the exists no command that includes the svg image. However, I can see the \includegraphics{...} for my png image.


texts: Edebug orgmode source code blocks with input variables

texts:
What is the standard method to debug emacs-lisp orgmode source code blocks with input variables as header arguments?

I found the hacky solution to insert the following snipped in front of a source code block.

(when t ;; t: do debug, nil: do not debug
  (org-edit-src-code)
  (let ((parse-sexp-ignore-comments t))
    (goto-char (point-min))
    (forward-sexp 2)
    (edebug-defun)))

Debugging of the source code block can be turned on or off by the boolean on the first line. The org-edit-src-code makes sure that point is in the special source edit buffer when one executes the source code block. The snippet puts point in front of the actual code and enters edebug-defun.

There follows a full working example:

* edebug emacs-lisp source code block with input variables

  Example input data:
  #+TBLNAME: input-table
  | This   | table       | contains |
  | some   | strings     | for      |
  | trying | source code | blocks   |

  Further example input data (strings to be highlighted):
  #+TBLNAME: emph
  | table | strings | blocks |

  The code-block to be debugged:
  #+NAME: emphDebug
  #+BEGIN_SRC emacs-lisp :var input=input-table emph=emph
(when t ;; t: do debug, nil: do not debug
  (org-edit-src-code)
  (let ((parse-sexp-ignore-comments t))
    (goto-char (point-min))
    (forward-sexp 2)
    (edebug-defun)))
;; The actual program starts here.
(let ((re (regexp-opt (car emph))))
  (mapcar (lambda (row)
        (mapcar (lambda (col)
              (if (string-match re col)
              (concat "*" (match-string 0 col) "*")
            col))
            row))
      input))
  #+END_SRC

  #+RESULTS: emphDebug
  | This   | *table*     | contains |
  | some   | *strings*   | for      |
  | trying | source code | *blocks* |

Place point on the #+BEGIN_SRC line and press C-c C-c to start debugging.

If one often needs to debug source code blocks one can define the following function somewhere in his configuration file:

(defun org-src-debug ()
  "Put a call to this function at the beginning of the org source block to debug it."
  (save-excursion
    (let ((pt (let ((case-fold-search t)) (org-babel-where-is-src-block-head))))
      (unless pt (error "Not at source block"))
      (goto-char pt)
      (org-edit-src-code)
      (let ((parse-sexp-ignore-comments t))
        (goto-char (point-min))
        (forward-sexp 2)
        (edebug-defun)))))

This function can then be used at the beginning of source code blocks. Example:

#+BEGIN_SRC emacs-lisp :var test='(1 2 3)
   (org-src-debug)
   (message "arg: %s" test)
#+END_SRC

But, I guess there is some org-standard way for debugging which I am not yet aware of.


texts: How to set org-mode header properties globally?

texts:
I am trying to set the following org-mode tangle property (mkdirp), which

creates parent directories for tangled files if the directory does not
exist. A ‘yes’ value enables directory creation whereas ‘no’ inhibits
it.

Apparently, it makes sense to set it for all relevant code blocks. My question is:
Is there a way to set a header property/argument like this globally for the entire .org file?


texts: How to avoid typing "space" after "^" for moving up in directory in dired?

texts:
^ is the key binding for moving to the parent directory in dired ("Up directory").

However, in Gnu Emacs on Windows 7 Professional 64-bit with my German keyboard layout, it is not sufficient to type "^" but I have to type space afterwards to make the key-binding work.

How can I redefine the key-binding to avoid having to press space and move upwards only with "^"?

C-h k ^<space> returns

  ^ runs the command dired-up-directory, which is an interactive
  compiled Lisp function in `dired+.el'.

  It is bound to ^,   .

  (dired-up-directory &optional OTHER-WINDOW)

  Run Dired on parent directory of current directory. Find the parent
  directory either in this buffer or another buffer. Creates a buffer if
  necessary.


texts: Many `elpa/flycheck-pychecker` processes running on the background

texts:
I have hundreds of python /home/alper/.emacs.d/elpa/flycheck-pycheckers-20200828 processes running on the background and they remain on the background. What may be the reason for this and how can I fix it?
❯ grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} "emacs" =(ps aux)
alper      9111  6.0  0.6 298448 102580 ?       Ssl  18:16   0:03 emacs --daemon
alper      9214  4.0  0.3 252884 56380 ?        Dsl  18:16   0:02 emacs --daemon
alper      9291  0.1  0.0 251212 15612 ?        Ssl  18:16   0:00 python /home/alper/.emacs.d/elpa/flycheck-pycheckers-20200828.
alper      9292  0.1  0.0 251268 15668 ?        Ssl  18:16   0:00 python /home/alper/.emacs.d/elpa/flycheck-pycheckers-20200828.
alper      9293  0.1  0.0 251268 15660 ?        Ssl  18:16   0:00 python /home/alper/.emacs.d/elpa/flycheck-pycheckers-20200828.
alper      9294  0.1  0.0 251212 15600 ?        Ssl  18:16   0:00 python /home/alper/.emacs.d/elpa/flycheck-pycheckers-20200828.
alper      9295  0.1  0.0 251264 15796 ?        Ssl  18:16   0:00 python
# ...  There were at least 200 hundred more

Also alper     17082  0.3  0.2 220592 34572 ?        Ds   18:25   0:00 /home/alper/venv/bin/python3 /home/alper/venv/bin/mypy <process_name> process is opened for all the buffers in the emacs and remain as open.

my setup:
(use-package flycheck-pycheckers
  :after flycheck
  :ensure t
  :init
  (with-eval-after-load 'flycheck
    (add-hook 'flycheck-mode-hook #'flycheck-pycheckers-setup)
    )
  (setq flycheck-pycheckers-checkers
    '(
      mypy3
      ;; pyflakes ;; alper
      )
    )
  )


texts: Magit pull with merge/rebase from upstream/pushRemote

texts:
I have upstream set to the develop branch (say origin/master) and pushRemote to a feature branch.

I currently use pulling with preserving rebase.

I would like to setup magit in such a way that:

this would be used by default for feature branch (pushRemote)
but pulling from develop branch should be done with merge (upstream).

Is it possible to reconfigure magit for that behavior?
Probably this could be configured in git itself?

EDIT:

I came up with a safe-guard to prevent me from accidentally rewriting history by applying the following advice:

(defun my-magit-pull-from-upstream (org-fun &rest args)
  (if (yes-or-no-p "Do you really want to pull (rebase) from upstream? ")
      (apply org-fun args)
    (when (yes-or-no-p "Do you want to merge from upstream? ")
      (setq args '("--no-rebase"))
      (apply org-fun args))))

(advice-add 'magit-pull-from-upstream :around #'my-magit-pull-from-upstream)


texts: How to make GUI Emacs use all available space when running maximized on linux?

texts:
GUI Emacs running maximized on my Linux (centos7+kde) is not using all the available space leaving some space around the borders, specially at the top and the bottom.

Sample of GUI emacs running "maximized" where you can still see the desktop wallpaper (and you should not):

All other apps (kde, gnome, etc) don't have this problem, when you click on maximize button, you cannot see the desktop wallpaper (expected behaviour).

In both cases (emacs and any other app) I use the maximize button provided by the OS. Using M-x toggle-frame-maximized as suggested has the same (wrong) effect. Using M-x toggle-frame-fullscreen works better in that emacs uses all the screen, but hides the window frame and the OS panel at the bottom, which is not what I want, I just want it to run maximized.

Appreciate if anyone knows how to make GUI Emacs use all the space available when running maximized.


texts: Locally modify the syntax-table via text-properties

texts:
I’m trying to make a particular exclamation point behave like a word constituent (from the point of view of the syntax table), using the syntax-table text property, but I can’t get it to work.

In an empty buffer I write an exclamation mark and then evaluate the command (add-text-properties 1 2 '(syntax-table (2))). I think this is what I’m supposed to do.
But describe-char on the exclamation mark shows

            character: ! (displayed as !) (codepoint 33, #o41, #x21)
[…]
               syntax: .    which means: punctuation
[…]
There are text properties here:
  syntax-table         (2)

Note that the text property has been applied, but it is still considered a punctuation character. What am I missing? Do I need to call a function to update it somehow? Other text properties (for instance display) are applied automatically.


texts: Ergonomic way to edit source code inside ReST or Markdown code blocks?

texts:
I often find myself writing ReST files with embedded source code examples (e.g. in .. code:: blocks or GFM-style triple-backticks; usually the embedded source code is Python). And this is always an exercise in frustration, because ReST mode has opinions about things like how text should be indented and where my cursor should go when I hit enter, and these are totally wrong for source code. So I find myself not only having to indent my code by hand (like an animal), but actively fighting against emacs to do it.

I'm hoping someone out there has found something, anything, that makes writing these kinds of documents less painful. Exiling source code snippets to external files sometimes helps, but it's not well-supported by all ReST processors and for short snippets often isn't worth the hassle. Possibly the gold standard would be an equivalent to org-mode's excellent org-edit-special (which pops out a source code block into its own buffer to edit in the proper major mode, while synchronizing changes back to the original buffer), but I'm not picky...

(If there's a markdown mode that handles this better I'd also be interested in that -- I don't always get a choice between rst and md, but in cases when I do then this could be a compelling differentiator.)

What do you do?


texts: emacs opens shells in a random window, how to change this?

texts:
Try splitting the frame repeating some times the command C-x 3.
Then try open the shell with M-x shell.

It will open in a random window and not the one which you have typed the command from. Why?


texts: Gnus fails to decrypt an email encrypted using GPG

texts:
When I try to open an encrypted message, Gnus asks me for my passphrase, which it seems to accept. But then it doesn't decrypt the message, and it doesn't report errors either.

I can otherwise decrypt the message by directly feeding its text to GPG. How do I debug this problem?

More info: If I run M-xepa-decrypt-region on the text of the message, while in Gnus, it decrypts it.

The key associated with the sender has multiple email addresses associated with it, and the address in question is the second in the list. Is it possible that this is a problem?


texts: Dired "quick-view" key to preview the file at point

texts:
I would like to create a function that does a "quick view" of a file the is under point in dired.

The way that I would like for this to work is that I hold down a function key, which then makes the file visible in a buffer, but when I let off of the key, the buffer closes and the dired buffer returns.  I do not want to have to close the temporary buffer with C-x k.

Is there a way to make this functionality in Emacs?  It seems possible if I can bind functions to keypress / depress.


texts: How to save and restore the association of a window to buffer across Emacs sessions?

texts:
I have a window layout with three windows and I would like Emacs to remember the buffers even if the buffers don't exist after restart.

Context: I am using Spacemacs for Clojure development. In window #1 I have my sourcecode. In window #2 I have *cider/repl ..., which is my REPL which is only available after starting it. In window #3 I have *cider-test-report* which is my unit test report. Since the buffers in #2 and #3 are temporary, Emacs fills them with *scratch* after restart.

How to get Emacs to open my usual buffers in windows as soon as the buffers are available?


texts: How to fix  and arrow keys in ansi-term on macOS

texts:
I'm running emacs on macOS, and I've run into problems with ansi-term. Using bash itself works fine, but as soon as I run a simple application with a command line interface, my <delete> and arrow keys break.

Instead of the usual delete behaviour, emacs prints ^h, and instead of moving in the direction indicated by the arrow keys, emacs prints ^[OA, ^[OB, ^[OC, and ^[OD. How can I fix this?


texts:
I'm trying to setup my emacs editor as scala IDE.
I'm following the instruction from the page https://scalameta.org/metals/docs/editors/emacs.html to do the set up.
when I'm importing sbt project into emacs I'm getting error Server metals:4410 status:starting exited with status exit. Do you want to restart it? (y or n)

OS details -
$ lsb_release -a
LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:    20.2
Codename:   Nibia


texts: Magit forge: is it possible to have "upstream/master" as default when dwim diffing on a pull request?

texts:
When my cursor is at a pull request in status buffer, and I press "d d", then I get the diff of master...refs/pullreqs/XXX. This works as intended, if my master branch is up-to-date. However, sometimes my master branch doesn't have upstream changes merged, so this diff generates a bad output.

Is it possible to have "d d" make the diff of upstream/master...refs/pullreqs/XXX?

I know that I can press "d r" (diff-range), then "M-n" (copy the dwim-default to mini-buffer), and then prepend "upstream/". But still, having "upstream/master" as the default would be more convenient when reviewing PRs.

Note, in my .git/config, I have forge/remote set as:

[forge]
        remote = upstream


texts: How can I configure imenu to ignore comments?

texts:
To configure imenu in my major mode, I need to set imenu-generic-expression to have regexps for functions.

However, this is incorrectly detects things inside comments and strings that look like functions.

How do I prevent this? imenu isn't confused by the following elisp, but I can't see what emacs-lisp-mode is doing differently.

;; imenu detects this.
(defun foo () (foo))

;; imenu correctly ignores this, even though it's at
;; the beginning of the line.
"
(defun bar () (bar))
"

;; imenu correctly ignores this.
;; (defun baz () (baz))

;; imenu correctly detects this, even though it's not
;; at the beginning of the line.
 (defun boz () (boz))


texts: Sorting todos by custom todo label when invoking `org-todo-list` with `C-c a t`

texts:
I have defined some custom todos keywords with
(setq org-todo-keywords
      '((sequence "TODO" "TODAY" "IN-PROGRESS" "WAITING" "URGENT" "FUTURE" "MAYBE" "LATER" "DONE")))

And when I invoke C-c a t I see the following:

I would like the todos to appear in the following order:
"URGENT" "TODAY" "IN-PROGRESS" "TODO" "WAITING" "FUTURE" "MAYBE" "LATER" "DONE"
and then, within each distinct label, having the todos sorted by priority.
I have tried many approaches, especially the one described here, but nothing works for me.
How can I achieve the desired behavior?


texts: Folder navigation on remote windows machine can't see folders with spaces

texts:
I've been trying to navigate folder structures on a remote Windows machine with Cygwin installed, but I can't seem to navigate to folders which contain a space in them. Emacs claims that "File no longer exists; type 'g' to update Dired buffer", although I suspect that it's simply not passing the folder name correctly (interpreting the remaining folder name as arguments).

I can, however navigate to them directly by specifying the path within quotes. How can I resolve this issue?


texts: how to add time information to an evaluated org-mode code block?

texts:
I'd like to be able to add additional information of when a block was run to the result:
ie.
#+BEGIN_SRC js
var a = 4
var b = 3

return a + b
#+END_SRC

#+RESULTS:
: 7 @ Thurs 8th Dec 2:00pm EST

is there a way to do that?


texts:
Make names of major modes shorter in the mode-line describes a way to shorten the modeline with cypejor. However, it seems like projectile-mode is not shortened by cyphejor. Is there anything that needs to be added to the config? Example:

(setq
 cyphejor-rules
 '(:upcase
   ("projectile" "P")
   ("menu"        "▤" :postfix)
   ("mode"        "")
   ("package"     "↓")
   ("python"      "π")
   ("shell"       "sh" :postfix)
))
(cyphejor-mode 1)


texts: How to execute a function on the name before creating a branch in magit?

texts:
I want to execute the following function on the provided name before creating a new branch in magit:

(defun pb/magit-new-branch-name (branch-name)
  "create a name usable as a branch name from branch-name"

  ;;remove special characters inside
  (replace-regexp-in-string
   "[ \t\n:]+"
   "-"
   ;;remove leading spaces
   (replace-regexp-in-string
    "\\`[ \t\n]*"
    ""
    ;;remove trailing spaces
    (replace-regexp-in-string
     "[ \t\n]*\\'"
     ""
     branch-name
     )
    )
   )
  )

The goal is to be able to copy-paste something like

"   TICKET-3423

Issue description
"

at the "Branch name:" prompt and have it automatically rewritten to "TICKET-3423-Issue-description".


texts: How to insert a specific number of newlines in org-mode

texts: Inside org-mode, RETURN is bound to (org-return &optional INDENT). This command apparently ignores C-u numeric prefixes and so if you want to enter 10 newlines, you can't just type C-u 1 0 RET and have it work. You can do C-u 1 0 M-x newline and get expected behavior, but I would like to know if there's a simpler set of default keystrokes?


texts:
I am trying to create something like uniquely, which renames the buffer to the full path within the projectile project. I have the code working, however, I can't seem to figure out how to get it to run when a new buffer is open. It seems like Emacs does not provide any hooks for when a new buffer is opened.

What is a good way to run the code when a new buffer is opened? How does uniquely do it? I tried reading its source, but I can't seem to find where the code gets triggered to run.

Thanks


texts:
Since js2-mode does not have eldoc-mode support, I was wondering if I could get some similar functionality to js2-mode with the help of tern-mode.

tern-mode has a command tern-get-type which will return the type of the thing under cursor in the minibuffer. How can I get this command to run automatically when cursor is idle (preferably after a small delay)?


texts: How to keybind helm-projectile-other-file

texts:
I like using helm-projectile-find-other-file to switch between header and cpp files, for example.  I tried to keybind it to C-c h with the following in my .emacs:

(global-set-key (kbd "C-c h") 'helm-projectile-find-other-file)

When I use the function directly, I get the desired results, and even a message to the effect that: You can run the command 'helm-projectile-find-other-file' with C-c h, but if I actually use the keybinding, I get the error:
    helm-compile-sources: Wrong type argument: sequencep, -1

I guess I have to specify some argument(s?) within the keybinding?  Can someone help me out.  Explanation in addition to a solution is appreciated.


texts: Literate Programming with non org-mode Collaborators

texts:
I've been starting to take a literate programming approach using org-mode for school assignments.  However a lot of assignments require working in a group with other students who typically don't have emacs/org-mode experience.

The only solution I can think of so far is to create an 'id' for each section in my source code and use the search link method here to link my org file to each section.  For example:

code.py

# Section1

code.org

* [[file:code.py::Section1][Section 1]]

The biggest issue I see with this is others won't benefit from the information in my org file.

I'm hoping for advice on either:

How best to implement a system using links as described above
A different approach others have used to solve the same issue


texts: Putting a framebox around enumerated items

texts: I would like to put my enumerated items in a framebox with rounded corners. I can do it with LaTex. But I would like to do it in emacs org document. How can I do it ?


texts: Org-mode: pipe source block output as stdin to next source block

texts:
I try to pipe the output of one source block to the next source block as standard input.
Here an example of what I have so far:

Create stdin data:
#+header: :exports code
#+header: :results output
#+begin_src sh
echo "That goes to the next"
#+end_src

#+name: piped
#+RESULTS:
: That goes to the next

Use "piped" as stdin:
#+header: :exports results
#+header: :stdin piped
#+header: :results output
#+begin_src sh
VALUE=$(cat)
echo "I got:"
echo "$VALUE"
#+end_src

My problems with this are:

I have to manually create the result of the first block by hitting C-c C-c
the result must be included in org-buffer (large output not needed otherwise)
the result must be named manually

Is there a workaround or better way to do this?


texts: Make text clickable: add urls with a loop

texts:
In my LaTeX code I have functions that generate hyperlinks in the PDF file. I have, e.g.:

\newcommand{\arXivid}[1]{\href{https://arxiv.org/abs/#1}{\tt arXiv:#1}}

So, in my LaTeX code I have strings like \arXivid{1207.7235} that points to https://arxiv.org/abs/1207.7235.

I'd like to have these strings clickable in the emacs' so I tried this function:

(defun my-follow-link ()
  (interactive)
  (require 'button)
  (save-excursion
    (goto-char (point-min))
    (while (search-forward-regexp "\\\\arXivid{\\([^}]+\\)}" nil t)
      (save-excursion
    (let* ((b (copy-marker (match-beginning 0)))
           (e (copy-marker (match-end 0)))
           (ID (match-string-no-properties 1))
           (URL (concat "https://arxiv.org/abs/" ID))
           )

      (make-button b e 'action (lambda(x) (browse-url URL)))

      ;; (let ((map (make-sparse-keymap)))
      ;;   (define-key map [mouse-2] '(lambda(x) (browse-url URL)))
      ;;   (put-text-property b e 'keymap map))
      )))
    )
  )

I get this error message:

Symbol’s value as variable is void: URL

I understand that let-binding the URL variable was not a good idea. But I have no idea to fix my code.
The button seems to respond only to the RETURN key, not to mouse click.
I tried also to use text-property (the commented code) as explained here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Clickable-Text.html but the code didn't work (I didn't understand it completely).

Where did I go wrong?


texts: Setting (or *simple* mode) for editing tab-separated columns

texts:
I'm looking for either some built-in setting or a simple mode for viewing and editing tab-separated columns (TSV files).

All I need is for the TSV text to be displayed in a way that respects the vertical alignment of the columns, and the horizontal alignment of the rows.  If line-wrapping could be toggled that would be sweet, but secondary.

Searching for column viewing in emacs is made difficult by the fact that the word "column" already has a different meaning in Emacs.

(I specified "simple" to discourage answers like org-mode's column view.  At the moment my needs are extremely simple, and I don't want to contend with installing, loading, and learning about a monster mode like org.)


texts: multi-term terminal messages configurations not working as expected

texts:
I'm trying to follow this article and configure my multi-term to work with remote files seamlessly. Edit: That article seems to be down currently. Try the cached version here.

But it's not working as expected.
I'm running OS X 10.9.5 and GNU Emacs 24.4.1.

As explained in the above article, I have placed the following code in my .emacs.d/init.el:

(when (require 'term nil t)
  (defun term-handle-ansi-terminal-messages (message)
    (while (string-match "\eAnSiT.+\n" message)
      ;; Extract the command code and the argument.
      (let* ((start (match-beginning 0))
             (command-code (aref message (+ start 6)))
             (argument
              (save-match-data
                (substring message
                           (+ start 8)
                           (string-match "\r?\n" message
                                         (+ start 8))))))
        ;; Delete this command from MESSAGE.
        (setq message (replace-match "" t t message))

        (cond ((= command-code ?c)
               (setq term-ansi-at-dir argument))
              ((= command-code ?h)
               (setq term-ansi-at-host argument))
              ((= command-code ?u)
               (setq term-ansi-at-user argument))
              ((= command-code ?e)
               (save-excursion
                 (find-file-other-window argument)))
              ((= command-code ?x)
               (save-excursion
                 (find-file argument))))))

    (when (and term-ansi-at-host term-ansi-at-dir term-ansi-at-user)
      (setq buffer-file-name
            (format "%s@%s:%s" term-ansi-at-user term-ansi-at-host term-ansi-at-dir))
      (set-buffer-modified-p nil)
      (setq default-directory (if (string= term-ansi-at-host (system-name))
                                  (concatenate 'string term-ansi-at-dir "/")
                                (format "/%s@%s:%s/" term-ansi-at-user term-ansi-at-host term-ansi-at-dir))))
    message))

And I have placed the following code in my .bashrc:

# are we an interactive shell?
if [ "$PS1" ]; then
  case $TERM in
    eterm-color*)
      if [ -n "$SSH_CONNECTION" ]
      then
        echo "if"
        _HOST=$(echo -n $SSH_CONNECTION | cut -d\  -f3)
      else
        _HOST=$HOSTNAME
      fi

      echo -ne "${PWD/#$HOME/~}\n"
      PROMPT_COMMAND='echo -ne "\033AnSiTh ${_HOST}\n\033AnSiTu ${USER}\n\033AnSiTc ${PWD/#$HOME/~}\n"'
      ;;
    xterm*)
      PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\007"'
      ;;
    screen)
      PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; echo -ne "\033\\"'
      ;;
    *)
      [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
      ;;
  esac
fi

if [ "${TERM}x" = "eterm-colorx" ]
then
  alias e='echo -ne "\033AnSiTe"'
  alias x='echo -ne "\033AnSiTx"'
  echo "eterm-colorx"
else
  alias e='emacsclient -n -t -a nano'
fi

After adding these, I see 2 issues.

When I open a multi-term buffer, I see the current working directory being printed before each prompt. I also see a box (some unprintable character) and / preceding the path.

I don't know where this string is coming from.
Also when I try to open with command x samp.txt it opens a file with some terminal messages attached at the end of filename. The file name it tries to open is samp.txt^[AnSiTh xyz.

xyz (renamed here) is the hostname of the system. It looks like the terminal message for setting the hostname somehow got appended to the filename. I couldn't figure out who/which code is appending this.


texts: How can I add functions to provide http links?

texts:
A recent feature request raised a new area of integration/customization for me.  I've developed a package to browse GitHub content and we'd like to be able to store a link to the current 'thing' using org-store-link (C-c C-l).  Problem is – it doesn't seem like I can change the behavior of the https? protocol without completely replacing it.

At any given time, there are multiple things you might want to get the link for – and they'd all be https? links.  How can I define multiple functions for a link type such that they can provide multiple options?  Reading org-link-parameters and org-store-link-functions, this doesn't appear to be possible.

Pursuant to the comments below…

This is for proposed Magithub functionality.  Magithub is a Magit-based GitHub client that can view issues, pull requests, and comments (among other things).  You can choose to visit the current 'thing' in the browser using w, though sometimes the current 'thing' is ambiguous.  For example, if point is at a comment, it is also technically at an issue or PR.  Point could even be at a link within a comment on an issue – and now there are three distinct link candidates for storing.  Ideally, org-store-link should at this point prompt for which link should be stored (which does appear to be possible per the results-alist variable in the definition).  The list of functions though comes from the return of org-store-link-functions which collects over org-link-parameters, so it seems it's not as simple as adding a function to a list.

When org-store-link completes, I'm guessing org-stored-links would just have a list ("some human-readable title I define" "https://github.com/some/project/issues/123") added as an element.


texts: How can I record where a function is defined if it's done indirectly?

texts:
I've got a few functions in api-wrap.el that I'll refer to as 'macro code', here simplified to clarify the question:

function (generate-form prefix kind &rest args) returns an unevaluated form that would define a new specific function
macro (generate-macros prefix &rest args) loops over PUT, GET, etc. and defines macros that use generate-form as a definition

So, calling order: generate-macros creates macros (here called factories) that dip into generate-form to create the definition.  These factory-macros are what actually defines each target function in application code.

Finally, the question: when I define one of these target functions in application code, I get a docstring that looks like the following

some-awesomely-generated-function is a Lisp function.

I don't get any link to where the function was defined in application code like I would if I was describing a normally-defined function.  The same applies for the macros generated by generate-macros, though I'm less concerned for those.

I don't get any link to where the function was defined like I would if I was describing a normally-defined function.  How can I declare where these functions are actually created, i.e., at macro-use?

If my explanation is unclear, refer to the real generate-form and generate-macros code; each function is well-documented.


texts: Org-Babel Unable to Tangle to Write-Protected Folders?

texts:
I'm trying to move my OS configuration over to org mode, and in the process I'd like to be able to tangle to write-protected directories like /etc

Unfortunately, tangle doesn't seem to work whenever the target file needs elevated permissions. So for instance, using org-babel-tangle works on this code block

#+BEGIN_SRC sh :tangle psmouse.conf
options psmouse synaptics_intertouch=1
#+END_SRC

but trying to tangle this one will ask me for my password (which I can give just fine) and then promptly fail

#+BEGIN_SRC sh :tangle /sudo::/etc/modprobe.d/psmouse.conf
options psmouse synaptics_intertouch=1
#+END_SRC

The error message I get in the minibuffer says

Copying directly failed. See buffer '*tramp/sudo root@pop-os*' for details

But the weird part is, although the buffer mentioned above is created on error, it's actually empty.

My Messages buffer is a little bit more informative as to what's going on

Setting up indent for shell type bash
Indentation variables are now local.
Indentation setup for shell type bash
Copying /tmp/tramp.l6Xnsw.conf to /sudo:root@pop-os:/etc/modeprobe.d/psmouse.conf...failed
tramp-error: Copying directly failed, see buffer ‘*tramp/sudo root@pop-os*’ for details.


texts: Upgrading to org-mode 9.1.6 error: org-duration-to-minutes: Invalid duration format: "val"

texts:
I upgraded my org-mode from version 9.0.10 to 9.1.6. Restarted emacs,
then launch my usual org-agenda. I get an error message:

org-duration-to-minutes: Invalid duration format: "val"

The error comes from the new file: duration.el

Backtrace:

* org-duration-to-minutes("16:00")
  org-refresh-property(((effort . identity) (effort-minutes . org-duration-to-minutes)) "16:00" nil)
  org-refresh-properties("Effort" ((effort . identity) (effort-minutes . org-duration-to-minutes)))
  org-refresh-effort-properties()
  #[0 "\307\306!\203\f

How do I fix this?


texts: How to check if a given string is a substring of an element of a list

texts:
According to documentation, member checks if a a given element is an element of a list. For example if the list, say my_list consists of apple and orange, (member "apple" my_list) returns true.

Is there an easy way to check if a given string is a part of a string of a list. For example ap is a part of a string  of the above list.
Hence it would be desirable to have a function like my-function  such that (my-function "ap" my_list) returns true.


texts: How do I organize my notes in org-mode in terms of hierachy?

texts: In OneNote there're notebooks, each notebook contains tabs and each tab contains pages. What are those or alternatives to them in org-mode?


texts: Confirm command by pressing same key that invoked it

texts:
I have <f5> bound to projectile-run-project. When pressing <f5>, the minibuffer displays the command to run and you need to press RET to confirm it.

How can I add the behavior that when <f5> is pressed again, it acts as a RET to confirm and execute the command?

UPDATE:
my working projectile config after the answer from @Tobias

(use-package projectile
  :init (setq
         projectile-project-search-path '("c:/repo") ;; todo make variable and declare it in paths
         projectile-enable-caching t
         projectile-completion-system 'helm
         projectile-indexing-method 'native)
         (add-hook 'ibuffer-hook
             (lambda ()
                 (ibuffer-projectile-set-filter-groups)
                 (unless (eq ibuffer-sorting-mode 'alphabetic)
                     (ibuffer-do-sort-by-alphabetic))))
  ;; projectile-globally-ignored-file-suffixes
  ;; (append '("S" "elf" "o") projectile-globally-ignored-file-suffixes))

  :bind-keymap
  ("C-c p" . projectile-command-map)

  :bind
  ("<f5>" . projectile-run-project)

  :config (projectile-mode +1))

(defun my-read-shell-command-key-wrapper (oldfun &rest args)
  "Wrapper for `projectile-run-project' that temporarily adds <f5> to the keymap."
  (let ((minibuffer-local-shell-command-map (copy-sequence minibuffer-local-shell-command-map)))
    (define-key minibuffer-local-shell-command-map (kbd "<f5>") (kbd "RET"))
    (apply oldfun args)))

(advice-add 'projectile-run-project :around #'my-read-shell-command-key-wrapper)


texts:
Is there a way to use highlight-regexp in a case-insensitive way?  I'm parenthesizing an expression in my regexp and refer to it using \1 later and I want to match this regardless of case.  I'm trying to find occurrences of repeated words (with maybe some other words in between), even if they are differently capitalized, e. g. in

One two three.  Four five six four seven eight nine.

I would like to highlight the phrase Four five six four due to the repeated word four.  My approach is this regexp:

\b\(\w+\)\b\W+\(\b\w+\b\W+\)\{0,10\}\1\b

I will work fine for repeated words with exactly equal capitalization but it does not work if the capitalization doesn't match.

I also tried setting case-fold-search to various values but it does not seem to be used for highlight-regexp.

Is there any way to highlight my repeated word case?


texts: "require ('org-journal')" creates "Symbol's value as variable is void: require"

texts:
I added require ('org-journal) to my .emacs.
Now I get the error message: 'Symbol's value as variable is void: require', when emacs is started. Without require ('org-journal) there is no error message.
But Org Journal seems to work (even with the error message during the start): the key-binding C-c C-j for org-journal-new-entry works, but i get the message.

Source file ‘/home/nilss/.emacs.d/elpa/org-journal-1.12.0
/org-journal.el’ newer than byte-compiled file

Output with emacs --debug-init:

[init-file-user system-type delayed-warnings-list user-init-file
inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs"
windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$"
        "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message
"`_emacs'   init file is deprecated, please use `.emacs'" "~/_emacs" t
load expand-  file-name "init" file-name-as-directory "/.emacs.d"
file-name-extension   "elc" file-name-sans-extension ".el"
file-exists-p file-newer-than-file-p message "Warning: %s is newer than
 %s" sit-for 1 "default"] 7]()

I don't understand what this message wants to tell me.


texts: Import SQL credentials from separate file

texts: As the title implies, I would like to populate login parameters (i.e., server address, user name, and password) in sql-connection-alist from a separate file. I am aware of this post, but I am wondering if there are other alternatives, or if there is a "canonical" solution for this case.


texts: How to customize font-backend for /usr/local/bin/emacs in OS X?

texts:
The docs state:

  In Mac OS X 10.5 and later, Emacs uses a Core Text based font backend by default. If you prefer the older font style, enter the following at the command-line before starting Emacs:

defaults write org.gnu.Emacs FontBackend ns

I've seen this works when the Emacs executable lives under /Applications (like a typical Mac application) and runs under the native OS X window system, but not if it is installed /usr/local/bin and runs under some X11 port.

As a result, X11-capable instances of /usr/local/bin/emacs fail to recognize any of the 30-odd variables whose names start with ns-.

Is there some other way of customizing Emacs' font backend that would work for X11-capable instances of /usr/local/bin/emacs?

Strangely enough, elsewhere in the docs one finds this description of font-backend (my emphasis):

  font-backend

  A list of symbols, specifying the font backends to use for drawing fonts in the frame, in order of priority. On X, there are currently two available font backends: x (the X core font driver) and xft (the Xft font driver). On MS-Windows, there are currently two available font backends: gdi and uniscribe (see Windows Fonts). On other systems, there is only one available font backend, so it does not make sense to modify this frame parameter.

The emphasized sentence seems to contradict the excerpt cited at the beginning of this post.  Be that as it may, I have not been able to find the setting for anything called font-backend in any instance of Emacs I've checked.  Therefore, it is not too surprising that putting the following line at the beginning of my ~/.emacs file fails to have any substantive effect:

(setq font-backend 'ns)  ;; useless


texts: Org Mobile staging area with a WebDAV: Unable to set 'org-mobile-directory' with TRAMP

texts:
I have a working Owncloud server, and I would like to use Org Mobile to sync my Org files with my phone.

Following "Setting up the staging area" in the info doc for Org Mobile, I have customized the variable org-mobile-directory to the directory where I want my files to be stored on the server. I have now the following in my ~/.emacs:

 '(org-mobile-directory
   "/davs:MyUserName@MyIPaddress:/owncloud/remote.php/webdav/MyRemotePath/")

This syntax for the remote directory is what I understood from the TRAMP info docs.

When I run org-mobile-push, then after an expected message showing me the good certificate for my cloud and asking me if I am sure to connect, I always get "Variable 'org-mobile-directory' must point to an existing directory".

Is the syntax I am using correct? Am I missing something?

Notes:

The path /owncloud/remote.php/webdav/ is what I read in the settings of my Owncloud to specify the WebDAV address to applications.
I have verified that MyRemotePath exists on my server.
I have set org-mobile-files and I have verified that org-directory is set to an existing directory (if it matters, although the latter should only concern the pulling from the staging area).
I eventually would like to use Mobileorg. I have managed to sync from the Mobileorg application to my Owncloud, but apparently I would need a file index.org in my server directory in order to sync from the server to the phone. And this file seems to be generated by org-mobile-push, which is what led me to this problem.


texts: How to change which window a click in *Occur* buffer affects?

texts:
My use case: I am looking at one place in the code in one window (call it window A), have a second window with the SAME code open (window B) in the same frame, together with an Occur buffer, that I opened from window B.

Whenever I click in the Occur buffer, it switches to window A, even though Occur was called from window B.

Can I change this behavior? Similar problems might occur with other selection bufers, such as compilation or xref and grep results.


texts: How to disable DocView mode (completely)?

texts:
I found here that the following disables DocView mode for a specific file type, like PDF:

(add-to-list 'auto-mode-alist '("\\.pdf\\'" . fundamental-mode))

But how can DocView mode be disabled completely, for any file type? (on GNU Emacs 26.1)


texts: emacs dired ignores LC_COLLATE=C when using sudo?

texts:
My emacs dired changes sort order from ASCII to case-insensitive whenever I view a directory listing under sudo::. Checking getenv on LC_COLLATE shows that emacs still thinks the value is 'C'; and ls -la under sudo on the command line still returns files sorted in ASCII order; so I have a hard time blaming sudo itself.

emacs 24.5.1

Ubuntu 4.8.4-2ubuntu1~14.04.3

Edit per jue 2017.06.16:

dired without sudo:

dired with sudo:

@jue: I believe you are correct that the sudo dired no longer considers LC_COLLATE; but I have no idea what else might be causing this.

Please note that outside emacs on the command line sudo and ls do not change sort order.

long listing without sudo:

$ l /usr/local/rancid3/
total 208
drwxrwx---  9 rancid3 netadm  4096 Jun 16 09:25 .
drwxr-xr-x 16 root    root    4096 Apr  4 12:55 ..
-rw-------  1 rancid3 netadm  1510 Jun 14 13:17 .bash_history
-rw-r-----  1 rancid3 netadm  4634 Apr  5 06:32 .cloginrc
-rw-r-----  1 root    root   19737 Nov 18  2016 .cloginrc.JK
-rw-r--r--  1 root    root    3772 Sep  4  2016 .cloginrc.sample
drwx------  2 rancid3 netadm  4096 Nov 18  2016 .emacs.d
-rw-r--r--  1 rancid3 netadm    77 Nov 18  2016 .selected_editor
drwx------  3 rancid3 netadm  4096 Nov 19  2016 .ssh
-rw-r--r--  1 root    root   62285 Sep  4  2016 CHANGES
-rw-r--r--  1 root    root    2797 Sep  4  2016 COPYING
-rw-r--r--  1 root    root   28334 Sep  4  2016 FAQ
-rw-r--r--  1 root    root   16218 Sep  4  2016 README
-rw-r--r--  1 root    root    4096 Sep  4  2016 README.lg
-rw-r--r--  1 root    root    5519 Jun 14 09:15 README_WHOI.org
-rw-r--r--  1 root    root    5704 Sep  4  2016 UPGRADING
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 bin
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 etc
drwxr-xr-x  3 root    root    4096 Nov 18  2016 lib
drwxr-xr-x  4 root    root    4096 Nov 18  2016 share
drwxr-xr-x  6 rancid3 netadm  4096 Nov 18  2016 var

With sudo:

$ sudo ls -la /usr/local/rancid3/
[sudo] password for ericx:
total 208
drwxrwx---  9 rancid3 netadm  4096 Jun 16 09:25 .
drwxr-xr-x 16 root    root    4096 Apr  4 12:55 ..
-rw-------  1 rancid3 netadm  1510 Jun 14 13:17 .bash_history
-rw-r-----  1 rancid3 netadm  4634 Apr  5 06:32 .cloginrc
-rw-r-----  1 root    root   19737 Nov 18  2016 .cloginrc.JK
-rw-r--r--  1 root    root    3772 Sep  4  2016 .cloginrc.sample
drwx------  2 rancid3 netadm  4096 Nov 18  2016 .emacs.d
-rw-r--r--  1 rancid3 netadm    77 Nov 18  2016 .selected_editor
drwx------  3 rancid3 netadm  4096 Nov 19  2016 .ssh
-rw-r--r--  1 root    root   62285 Sep  4  2016 CHANGES
-rw-r--r--  1 root    root    2797 Sep  4  2016 COPYING
-rw-r--r--  1 root    root   28334 Sep  4  2016 FAQ
-rw-r--r--  1 root    root   16218 Sep  4  2016 README
-rw-r--r--  1 root    root    4096 Sep  4  2016 README.lg
-rw-r--r--  1 root    root    5519 Jun 14 09:15 README_WHOI.org
-rw-r--r--  1 root    root    5704 Sep  4  2016 UPGRADING
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 bin
drwxr-xr-x  2 root    root    4096 Mar 29 10:47 etc
drwxr-xr-x  3 root    root    4096 Nov 18  2016 lib
drwxr-xr-x  4 root    root    4096 Nov 18  2016 share
drwxr-xr-x  6 rancid3 netadm  4096 Nov 18  2016 var


texts:
I'm trying to add line numbers to emacs, following this guide: Linum: Separating line numbers from text.

I have to edit "linum.el" to add some code, however I can't find that file.
I'm using ubuntu, I have tried using:

find */* linum.el

but I'm getting:

find: `linum.el': No such file or directory


texts:
I have the following elixir code that looks like this:

defmodule Drawing do
  use Surface.Component

  def render(assigns) do
    ~H"""
    <svg viewBox={{ "0 0 #{@width} #{@height}" }}>
      {{ SomeElixirCall.here() }}
    </svg>
    """
  end
end

It's elixir outside, with HTML in between ~H""" and """, and elixir inside the html, between {{ and }}.

I have made some mmm config that managed to highlight the html parts and the outer elixir part, but not the elixir inside the html.

Is that possible with mmm, two levels deep mmm'ing? Or maybe I am just doing it wrong? Thanks!

(mmm-add-classes
 '((sf-elixir
    :submode mhtml-mode
    :front "^[ ]*~H\"\"\"$" ;; regex to find the opening tag
    :back "^[ ]*\"\"\"$"))) ;; regex to find the closing tag

(mmm-add-mode-ext-class 'elixir-mode nil 'sf-elixir)

(mmm-add-classes
 '((elixir-sf
    :submode elixir-mode
    :front "{{" ;; regex to find the opening tag
    :back "}}"))) ;; regex to find the closing tag

(mmm-add-mode-ext-class 'mhtml-mode nil 'elixir-sf)


texts: The time of the last change of the current buffer

texts:
Can Emacs determine the time of the last change (or the last edit) done to the current buffer?

The buffer may has been saved or not.


texts:
I'm using M-x compile to check for compilation errors and it's great. However, I'm wondering if I can get the actual error message to begin on its own line. For some reason the file path shows up as the absolute file path, which is unnecessary IMO (is it possible to change that?).

This makes it so that the error message starts very late in the line and wraps around. I think wrap-around is inevitable with long error messages, but it'd make things much easier to read for me if it would just start on its own line.

To be clear, I'm wondering if I could change this to something like:

cargo build
   Compiling diecast v0.0.1 (file:///home/blaenk/code/rust/diecast/diecast)
/home/blaenk/code/rust/diecast/diecast/src/job/manager.rs:309:53: 309:64
error: type mismatch resolving `<collections::vec_deque::VecDeque<eventual::future::Future<bind::Bind, Box<std::error::Error + Send + Sync>>> as core::iter::IntoIterator>::Item == bind::Bind`:
 expected struct `eventual::future::Future`,
    found struct `bind::Bind` [E0271]


texts: Why is this function working properly in GUI-Emacs, but not in terminal Emacs?

texts:
Setup: Xubuntu 16.04, GNU Emacs 25.1.50.2

I have the following function defined.

(defun sudo-edit (&optional arg)
  "Edit currently visited file as root.

With a prefix ARG prompt for a file to visit.
Will also prompt for a file to visit if current
buffer is not visiting a file."
  (interactive "P")
  (if (or arg (not buffer-file-name))
      (find-file (concat "/sudo:root@localhost:"
                         (ido-read-file-name "Find file(as root): ")))
    (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))

When I want to edit /etc/default/grub, and in the GUI Emacs frame I call sudo-edit, after typing my password, it works fine. But when I do the same with the emacsclient in terminal, it exits directly to the terminal after calling the same sudo-edit. And it's not responding anymore, and I cannot create another frame.

I fail to understand why Emacs is not handling this properly in terminal, and the GUI frame does it well. I couldn't find anything in the function which is related to the GUI.

Anybody that can find where this functions went wrong with the terminal Emacs?


texts: Key binding of a function interferes with global key binding

texts: The key binding \  of the function w3m-show-source interferes with the function with the same key binding hydra-master-body (which I set up in the init file). I have used the function global-set-key to change the key binding of w3m-show-source to ctrl-,. Now the function w3m-show-source has two key bindings \ and ctrl-,. How can I remove \ from the function w3m-show-source so that it will execute hydra-master-body?


texts: Tramp: Waiting for prompts from remote shell... Sending command `exec ssh -e none bin'

texts:
Tramp hangs for several minutes every time I launch Emacs, giving me these errors:

Tramp: Opening connection for bin using scp...
Tramp: Sending command `exec ssh  -e none bin'
Tramp: Waiting for prompts from remote shell...
Timeout reached, see buffer `*tramp/scp bin*' for details
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for bin using scp...failed

My tramp debug:
https://gist.github.com/2dc7672fb5aa22f06b53

I believe it's related to this:
https://github.com/emacs-helm/helm/issues/1000

and this:
https://github.com/syl20bnr/spacemacs/issues/3422#issuecomment-148919047

I followed the directions from the Spacemacs FAQ, which suggests this solution:

(setq tramp-ssh-controlmaster-options
   "-o ControlMaster=auto -o ControlPath='tramp.%%C' -o ControlPersist=no")

This didn't have any effect.

I also tried this:

(setq tramp-ssh-controlmaster-options nil)

...but I got the same result.

The FAQ suggests that if the above doesn't work, you can try to put these settings directly in ~/.ssh/config:

Host *
ControlMaster auto
ControlPath ~/.ssh/master -%r@%h:%p
ControlPersist = no `

So I did this, which caused the error message to change to this:

Tramp failed to connect.
Garbage at the end of the line. -%r@%h:%p
If this happens repeatedly, try M-x tramp-cleanup-this-connection

I did also try tramp-cleanup-this-connection also, but it too had no effect.

How can I get Emacs to stop hanging on startup?


texts: Passing function to align-region raises an error when using 'justify' rule

texts:
I have *test* buffer with following contents:

 1234   23347   35466
    155555      267       31
 1444444 2444 32777

Now I'm trying to understand how passing a callback to align-region works, so I wrote this script:

(let* ((group -1)
       (regexp
        "\\(\\s-*[0-9]+\\)")
       (spacing 5)
       (repeat t)
       (rule
        (list (list nil (cons 'regexp regexp)
                    (cons 'group (abs group))
                    (if (< group 0)
                        (cons 'justify t)
                      (cons 'bogus nil))
                    (if (>= spacing 0)
                        (cons 'spacing spacing)
                      (cons 'column (abs spacing)))
                    (cons 'repeat repeat)))))
  (with-current-buffer "*test*"
    (align-region (point-min) (point-max) 'entire rule nil
                  (lambda (&rest r) t))))

I copied that rule from definition of align-regexp.
When I evaluate my code I get en error:

Debugger entered--Lisp error: (wrong-type-argument markerp (#<marker at 53 in *test*> . #<marker (moves after insertion) at 60 in *test*>))
  marker-position((#<marker at 53 in *test*> . #<marker (moves after insertion) at 60 in *test*>))
  align-areas(((#<marker (moves after insertion) at 51 in *test*> #<marker at 53 in *test*> . #<marker (moves after insertion) at 60 in *test*>) (#<marker (moves after insertion) at 22 in *test*> #<marker at 27 in *test*> . #<marker (moves after insertion) at 33 in *test*>) (#<marker (moves after insertion) at 1 in *test*> #<marker at 2 in *test*> . #<marker (moves after insertion) at 6 in *test*>)) (5 . t) (nil (regexp . "\\(\\s-*[0-9]+\\)") (group . 1) (justify . t) (spacing . 5) (repeat . t)) (lambda (&rest r) t))
  align-region(1 72 entire ((nil (regexp . "\\(\\s-*[0-9]+\\)") (group . 1) (justify . t) (spacing . 5) (repeat . t))) nil (lambda (&rest r) t))
  (save-current-buffer (set-buffer "*test*") (align-region (point-min) (point-max) (quote entire) rule nil (function (lambda (&rest r) t))))
  (let* ((group -1) (regexp "\\(\\s-*[0-9]+\\)") (spacing 5) (repeat t) (rule (list (list nil (cons (quote regexp) regexp) (cons (quote group) (abs group)) (if (< group 0) (cons (quote justify) t) (cons (quote bogus) nil)) (if (>= spacing 0) (cons (quote spacing) spacing) (cons (quote column) (abs spacing))) (cons (quote repeat) repeat))))) (save-current-buffer (set-buffer "*test*") (align-region (point-min) (point-max) (quote entire) rule nil (function (lambda (&rest r) t)))))
  eval((let* ((group -1) (regexp "\\(\\s-*[0-9]+\\)") (spacing 5) (repeat t) (rule (list (list nil (cons (quote regexp) regexp) (cons (quote group) (abs group)) (if (< group 0) (cons (quote justify) t) (cons (quote bogus) nil)) (if (>= spacing 0) (cons (quote spacing) spacing) (cons (quote column) (abs spacing))) (cons (quote repeat) repeat))))) (save-current-buffer (set-buffer "*test*") (align-region (point-min) (point-max) (quote entire) rule nil (function (lambda (&rest r) t))))) nil)
  elisp--eval-last-sexp(t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  funcall-interactively(eval-print-last-sexp nil)
  call-interactively(eval-print-last-sexp nil nil)
  command-execute(eval-print-last-sexp)

The script evaluates cleanly if I change group to 1 in line 1 (so I don't use 'justify rule).
Am I missing something obvious? I tested this on emacs-25.3 and 26-0.90 and the results are the same.


texts: In org-mode, how do I continue a list in a new line?

texts:
For example:

* Tests
** Test1
   - When I put a new-line right here ->
the list will not be continued (unlike in word or similar applications).

For clarification, what I expect is:

* Tests
** Test1
   - When I put a command right here ->
   - the list will be continued (like in word or similar applications).

I am using the most recent version of spacemacs where it was possible with evil-bindings, but I deactivated them.


texts: Subdirs in Dired: display relative paths

texts:
I've hacked something together for myself to hide/toggle columns of my choice in Dired and display what's left with a less obtrusive face. As a side effect this makes the width of Dired buffer small enough to use it as a speedbar replacement.

I use subdirectories, inserted with i a lot. I now want Dired to show only relative paths; and only for subdirectories. I.e.:

Since I'm manipulating Dired's output anyways, I certainly could use the same regex based approach to achieve that. But before I go into another circle of introducing bugs and typos, I thought I'd rather check whether this already exists. Does it? I couldn't find anything in the Docs or via Google.


texts: Is there an electric-indent for single-line statements in braced languages?

texts:
My code style for braced languages like C/C++/Java is to use no braces when the statement is a single line. One of my biggest pet peeves is that every IDE I've ever used will not smartly un-indent after this single statement if there is no brace.

I tend to use three spaces for my personal style with some other styles using more. I hate having to tap on the backspace key so many times when I do this.

Has anyone seen anything like this for emacs?

I already use a custom indentation function which I hope can be expanded to include this feature:

(defvar my-indentation-width 3
  "The number of spaces I prefer for line indentation.")

(defun my-enter ()
   "Inserts a newline and indents to align with previous line"
   (interactive)
   (newline)
   (unless (looking-back "\\`\n*")
      (indent-relative-maybe)))

(defun my-indentation-setup ()
  "Binds RETURN to the function 'my-enter'"
  (local-set-key "\r" 'my-enter)

(add-hook 'text-mode-hook 'my-indentation-setup)
(add-hook 'c++-mode-hook 'my-indentation-setup)
(add-hook 'c-mode-hook 'my-indentation-setup)
(add-hook 'java-mode-hook 'my-indentation-setup)


texts: How can I insert org-capture-templates into a document I'm editing

texts:
I have a capture template for TODO items defined as follows

("t" "todo" entry (file "~/org/refile.org")
             "* TODO %?\n%U\n%a\n" :clock-in t :clock-resume t)

While editing a document, I would like to insert the template where my cursor is. An example foll
ows:

My buffer looks like this:

* TODO make a sandwich
    <cursor here>

I call my new command, org-insert-template.

I am prompted with the available capture templates and choose [t] TODO

My buffer now looks like this:

* TODO make a sandwich
  * TODO <cursor here>
    :LOGBOOK:
    CLOCK: [2019-05-06 Mon 23:09]--[2019-05-06 Mon 23:09] =>  0:00
    :END:
    [2019-05-06 Mon 23:09]

Could you please provide guidance on implementation of org-insert-template?


texts: How do I parse a simple grammar and obtain a syntax tree in Emacs lisp?

texts:
How can I construct a parse tree from a string and a simple grammar? Semantic seems very tricky, and SMIE does not seem to produce a parse tree.

Here's an example, assuming a language that looks like this:

BLAH [ FOO "aaa"; "bbb" | BAR [ "ccc" | "ddd" ] ]

How can I simply transform that string into the following sexp, or something close?

(seq (ident "BLAH")
     (choice (cons (seq (ident "FOO") (str "aaa"))
                   (seq (str "bbb")))
             (seq  (ident "BAR")
                   (choice (seq (str "ccc")) (seq (str "ddd"))))))

(essentially there are sequences seq (no delimiters), grouping choices choice ([]), strings "", identifiers ident (capitals), and delimited sequences cons (;-delimited))


texts: Seeing "Unpushed commits" after doing a push on the current commit

texts: I understand that Magit will report a commit as "Unpushed" immediately after pushing it because it has not been pushed to the Upstream branch (master in this case).  That makes me wonder what the rationale is for labeling the commit as "Unpushed" in the face of the common workflow convention of pushing a commit to a remote branch, creating a Pull Request on that remote branch, applying review comments, and then merging to the upstream branch.  I would think that what Magit currently labels "Unpushed" would be better labeled "Unmerged" and that "Unpushed" would mean that the current branch has not been pushed at all and the label gets changed to "Unmerged" after doing a successful push to any remote branch.  In this model, one could see (different) commits under an "Unpushed" section and under an "Unmerged" section.  I might have a misunderstanding for the Magit model and if so, I'd like to get a more accurate model.  I ask the question as a pre-cursor to filing an issue to make sure it really is a product issue and not just a grokking issue.


texts: How can I escape single quotes inside a code format block in org mode?

texts:
I have an org-mode document with inline code formatting (text wrapped in ~). If the code starts with ', when I export to HTML the formatting doesn't get applied, and the ~s are printed literally. The syntax highlighting inside emacs also reflects that the formatting isn't being applied.

For example, this text:

Strict mode is enabled per scope with the ~'use strict';~ declaration at the very top of the scope.

Will be exported as-is, instead of removing the ~ around 'use strict;~ and rendering it as pre-formatted text.

Does anyone know how to get the proper formatting even when code formatting starts with a single quote?


texts: When I (byte-compile-file "my-package.el"), can I treat warnings as errors?

texts:
As part of CI testing, I'm byte-compiling package files to make sure there are no errors.  I'd like to take this a step further and ensure there are no warnings, either (like 'function not known to be defined', etc.).

Is there a variable I can let-bind to make this happen?  apropos was not very enlightening.