texts: org mode logbook note entry without logbook drawer?

texts:
Is there a way to make a logbook-like note without it always being stuck in a :LOGBOOK drawer? For example:

- [2015-09-02 Wed 18:03] \\
    * 12.3 Export settings             :om:htmlexport:
      - Up: Exporting
      - [[http://orgmode.org/manual/Export-settings.html][Export settings]]

I like being able to just stick a timestamped observation anywhere with C-c C-z. Is there any way to turn off the automatic :LOGBOOK drawer?


texts: org-table: add hline based on change in column values


texts:
Windows 10, Emacs 25.1

When I open file that not encoding in UTF-8 I get the next incorrect result:

I try by command set-buffe-file-coding-system but it not help.

And here result:

As you can see this command not help.

To fix this I need to encoding content to UTF-8.

Note: If I open this file by Notepad++ than it show correct:

Here test case when I apply function "find-file-with-coding-system" with KOI8-R of @Tobias, but it not help.

Also I try by emacs-Q, but result same.

Here base64-encode-region part of my file:

MQowMDowMDo0MCwzODMgLS0+IDAwOjAwOjQzLDkyOArR5eLl8Cwg5+Dv4OQsIP7jLCDk7urr4OTi
4Ony5S4KCjIKMDA6MDA6NTAsMzkzIC0tPiAwMDowMDo1Miw1MjcKyuDq4u4g6PHq4Pgg5OAg6uDm
5fg/CgozCjAwOjAwOjUyLDY4NyAtLT4gMDA6MDA6NTYsMTU1Csrg6uLu8u4g6uDn4PUuCgo0CjAw
OjAwOjU2LDMxNSAtLT4gMDA6MDE6MDAsMjg1Cs3g5P/i4Pgg8eUg5OAg7vbl6+XlLgoKNQowMDow
MTowMCw0NDUgLS0+IDAwOjAxOjAzLDE2MgrS7uLgIO3lIOUg5O7x8uDy+vft7i4KCjYKMDA6MDE6
MDMsMzIyIC0tPiAwMDowMTowNSw2MjMKwOruIPLoIOTw5ezl+OUuLi4KLSDK4PDrLg==

How I can do this?


texts:
#+BEGIN_SRC zsh :session z1
echo $HOME $0
#+END_SRC

#+RESULTS:
: /Users/evar /bin/bash

I am thinking of trying the workaround outlined here, but shouldn't this work out of the box?
Update: I couldn't get that workaround to work. I tried:
(require 'ob-shell)
(defadvice org-babel-sh-evaluate (around set-shell activate)
  "Add header argument :shcmd that determines the shell to be called."
  (let* ((org-babel-sh-command (or (cdr (assoc :shcmd params)) org-babel-sh-command shell-file-name))
         (shell-file-name org-babel-sh-command)
         )
    ad-do-it
    ))

#+BEGIN_SRC zsh :session z1 :shcmd zsh
echo $HOME $0
#+END_SRC

But it still uses bash.


texts: Disable VC for SVN in exclusive-locking mode

texts: I have Subversion exclusive-locking enabled to increase SVN performance. If I commit a file the svn command line client opens Emacs so I can enter a commit message. But Emacs VC tries to determine the SVN status of the commit message file svn-commit.tmp with the command svn --non-interactive status -v svn-commit.tmp. That blocks because the commit command has the exclusive lock and I have to wait for the status timeout (10 seconds) until I can type my commit message. How can I disable version control for *.tmp files in Emacs to prevent that wait time? I didn't find an option to exclude files from VC.


texts: How to export doi links without description?

texts:
I want export a doi link from an org file to LaTeX and then to pdf. If the doi link has no description the export does not work. Why? I want as a result in pdf, not the description but the doi address.

    #+TITLE: Exporting doi link
    #+AUTHOR: SB
    #+Date: \today
    #+OPTIONS: H:3 toc:nil num:nil d:nil
    #+LATEX_CLASS: memarticle
    #+LATEX_CMD: xelatex

    * First

    This exports to \LaTeX: [[doi:10.1111/j.1468-0149.2007.00450_2.x][doi-description]] and this [[http:www.ine.pt]].

    But not a doi link with no description: [[doi:10.1111/j.1468-0149.2007.00450_2.x][]].


texts: M-x command completions to all occurrences of a substring

texts:
If I do M-x insert TAB  Emacs shows a list of possible completions like below

Possible completions are:
insert-abbrevs              insert-anniversary-diary-entry
insert-block-diary-entry    insert-buffer
insert-char                 insert-cyclic-diary-entry
insert-diary-entry          insert-file
insert-file-literally       insert-kbd-macro
insert-monthly-diary-entry  insert-pair
insert-parentheses          insert-register
insert-weekly-diary-entry   insert-yearly-diary-entry

What if one likes to have a list of all completions in which the string insert exists, for example auto-insert which is not given in the above list.


texts: How to use "o" to open from dired/ibuffer into another frame

texts:
I have two windows open and split vertically (single frame):

A) contains my work
B) contains either dired or ibuffer.

I would like to be able to navigate to a file/buffer in pane B and hit "o" have it open in pane A.  Is this possible?  Right now emacs is creating a new pane in the lower portion of pane A to open the file.

edit: according to user lawlist the above described behavior will happen when the frame is large.  This appears to be the case for me because now that I am at home (not on an external monitor, smaller frame) emacs is behaving as I desire.  The question now becomes: can I prevent emacs from opening a new window when the current frame is large?


texts: Narrow helm-projectile-grep to specific file type

texts:
I usually find myself when using helm-projectile-grep to narrow my search down to a specific file type.

For example: I do a search for "container" but only want to show the results in the .style files. I haven't been able to find if you can do this with helm-projectile-grep but it does seem like it should be possible.


texts: Override auctex adding brace after accent macro

texts:
I have

'(TeX-insert-braces nil)

in my customizations, which according to the document should mean that braces {} are not automatically inserted after macros via TeX-insert-macro.  However, when
I insert the accent macro \tilde the braces are added, contrary to my wish.

I can trace this down to latex.el containing

   (TeX-add-symbols
    ...
    '("tilde" t)
    ...
   )

in the function LaTeX-common-initialisation.  As a result I have tried to override the setting by adding

(TeX-add-symbols '("tilde" nil))

to my 'LaTeX-mode-hook, but this doesn't work.

How do I do this and
is there a systematic way to implement this for all accent symbols?

Note the list of such symbols is available in the Math > Accents menu, when math mode is enable (which I do by default).


texts: Dependent state in org-babel :var arguments

texts:
I enjoy using org-babel for testing/exploring API HTTP endpoints.
#+BEGIN_SRC http :var access-token=select-access-token-from-sql :pretty
GET http://localhost:3000/api/items/71
Authorization: Bearer ${access-token}
#+END_SRC

71 is a hardcoded item id for the given(and only) user that I currently use for testing.
I would like to rewrite this snippet in a way to make it randomly picking a user(e.g. admin or a client), and based on user's ID or role request a specific item id(instead of hardcoded 71)
That's what I've tried and it didn't work:
#+name: sampleUserId
#+BEGIN_SRC emacs-lisp :results value
(defun sample (items)
  (let* ((size (length items))
         (index (random size)))
    (nth index items)))

(sample (list 11 22 33))
#+END_SRC

#+name: getResourceId
#+begin_src emacs-lisp :var userId=-1
(cond ((eq userId 11)
       111)
      ((eq userId 22)
       222)
      ((eq userId 33)
       333)
      (t "invalidUserId"))
#+end_src

#+BEGIN_SRC sh :var userId=sampleUserId :var resourceId=getResourceId(userId)
echo "Testing using User ID ${userId}, requested resource ID is ${resourceId}"
#+END_SRC

It fails with(probably as expected):

Reference userId not found in this buffer

Is there any approach to fix this issue?
Perhaps instead of passing low-level userId this should be more high level construct consisting of user id and all of its item IDs? My other idea was to try using org-babel sessions for it, not sure if that's possible though.
The whole goal of this task is the ease of use, and cycling through roles/requests withoug leaving the SRC block.


texts: Is there a way to ask Emerge to "pick both"?

texts:
As far as I can see I only have the options to pick either A, or B, but not both. I occasionally want to pick both A and B. I know I can just go to the C buffer and edit the file by hand, but it happens often enough that I'd love a key for it. (A different conflict resolution tool I've used in the past, though I cannot remember which, allowed two options: A then B, and B then A.)

An example follows. Let's say I have the following conflict:

fi
fo
fa
fum
<<<<<<< HEAD
foo
=======
bar
>>>>>>> bar
I
like
Bubble
Gum

I would then like an option "A then B" that would yield the following result:

fi
fo
fa
fum
foo
bar
I
like
Bubble
Gum

As extra bonus, I'd love a "B then A" option that would yield the following result:

fi
fo
fa
fum
bar
foo
I
like
Bubble
Gum

PS: I usually invoke emerge from Magit. I'm not sure if this is relevant... Further, I'm on a Mac and I use Emacs 25 pre-test from http://emacsformacosx.com/


texts: Latex compilation message in the echo area dissapears too soon

texts:
The outcome (success/error) of a Latex compilation (TeX-command-run-all) is printed in the echo area. Once you press a key, however, the echo area is cleared and the message is gone. I usually look at the pdf viewer when I compile, and continue typing if the pdf looks ok. This means I often miss Latex error messages. I find this annoying. I keep writing only to discover much later that my document contains an error.

Of course I can keep open a window showing the last couple lines in the *Messages* buffer, but then I have to look at all kind messages that are completely irrelevant to me. So I am asking if somebody can suggest a more convenient solution.

An easy solution would be to stop clearing the echo area after the next keystroke. Somehow make an error message stick in the echo area?


texts: Unquoting a variable name (to implement variable pointers)

texts:
I know that if I have a variable with a function name, I can call it using funcall, like this

(setq func-ref 'my-func)
(funcall func-ref)

I am wondering if there's a similar functionality for variables (defined with defvar), so that I can set var-ref like this

(setq var-ref 'my-var)

and use it to get the value of my-var and/or update it.

EDIT: I want to use this functionality in a function which takes as argument a reference to a variable that will be changed in the function.


texts: How to dired-find-file for ONLY directories in Dired?

texts:
I want to add keybinding to Dired mode for entering directory, and ONLY directory. By default enter key is bound to function dired-find-file. The problem with it is that its or opening new dired buffer if it is directory under cursor, or open file for editing if its file.

So I added two shortcuts for going to parent directory and stepping in directory under cursor this way:

(define-key dired-mode-map (kbd "<left>") 'dired-jump)
(define-key dired-mode-map (kbd "<right>") 'dired-find-file)

As you may guess the problem is in last - dired-find-file will work on non-directories too, and I want it not to do anything. So my question - is there a specific function for stepping in directory under cursor or, if not - is there a way to check if there is directory under cursor in dired mode to construct my own function? Thx.


texts: wanderlust: using "To" in wl-template-alist only for new messages, not replies

texts:
In wanderlust, I have several folders with which I use wl-template-alist to set up default values for some of the headers when I am writing messages. In one of these folders (not all of them), I want to use the "To" value from wl-template-alist only for new messages. If I am replying, I want To to be automatically set to the sender's address.

For example ...

(setq wl-template-alist
  '(("certainfolder"
    ("To" . "default-recipient-address@domain.com")
    ;;; other stuff
    )))

In this case, I want To to be set to default-recipient-address@domain.com when I'm in "certainfolder" and writing a new message, but I want this to be ignored and the sender's address (or their Reply-To) to be used in To when I'm generating a reply to any messages in that folder.

How can I do this via wl-template-alist for this one, single folder?

Thank you very much.


texts: How to use a Mac's Command key as a Control key?

texts:
I'm new to Emacs, and am using a Mac.  I want the Mac command key to act as a control key for Emacs.

How do I do that?  I tried (setq mac-command-modifier 'control).

Besides, how do I find key variable and local key names in Emacs?  For example: how can I find that mac-command-modifier is the command key name?


texts:
When I use helm fuzzy matching, call helm-M-x type elm I would like emacs-lisp-mode to pop up as a candidate. Instead I get

helm-M-x
helm-gid
helm-dash
helm-locate
...

I don't find this default fuzzy matching very helpful. How do you achieve more intuitive fuzzy matching?

Looking up how to change this, I found the package helm-fuzzier and it looked promising but after installing it didn't work (it seems a bit outdated).


texts:
Windows 10 (64 bit), Emacs 26.1

I open trace.log file from remote Linux machine by Tramp mode.

Nice.

I set custom variables:

'(password-cache-expiry nil)
'(auto-revert-remote-files t)

I set variable auto-revert-remote-files t because I need to see content of remote file interactively (on fly).

But when file trace.log is change (by external web application) I get the next message in minibuffer:

Tramp: Waiting for prompts from remote shell...done
Copying /pscp:mylogin@remote_ip_machiney_ip:/root/logs/trace.log to c:/Users/Alex/AppData/Local/Temp/tramp.2iBhRe.log...done
Tramp: Inserting ‘/ppscp:mylogin@remote_ip_machiney_ip:/home/myproject/logs/trace.log’...done

    Tramp: Checking ‘vc-registered’ for /pscp:mylogin@remote_ip_machiney_ip:/root/back/myapp/logs/trace.log...done
    Tramp: Inserting ‘/pscp:mylogin@remote_ip_machiney_ip::/root/back/myapp/logs/trace.log’...done

File trace.log on remote machine is periodically changes by web application.

How disable this message on minibuffer?


texts: EMMS and LibreFM: How do I tell LibreFM to love or ban tracks?

texts: When I play something through LibreFM's web client, I can ask it to love or ban certain tracks. How do I do this in EMMS configured to play music from LibreFM?


texts: How to ask magit to use external diff and merge tools?

texts:
I have set the git variables [merge] and [diff] to the appropriate values like
this:

[merge]
    keepBackup = false;
    tool = p4merge
[mergetool]
    prompt = false
[mergetool "p4merge"]
    cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false
[diff]
    tool = p4merge
[difftool]
    prompt = false
[difftool "p4merge"]
    cmd = p4merge "$LOCAL" "$REMOTE"
    keepTemporaries = false
    trustExitCode = false
    keepBackup = false

and this works from the command line. I am not sure how to open external
diff and merge tools from within magit.

I found this tool https://github.com/Perlmint/magit-exttool , but it
doesn't work.


texts:
Specifically in the content of exporting org->latex->pdf when using pdftools to view the resulting pdf, how can I stop emacs from asking me if I want to revert the pdf buffer and instead just auto-revert without asking?

I tried:

(add-hook 'pdf-view-mode-hook (lambda () (auto-revert-mode 1)))

and also:

(add-hook 'pdf-tools-enabled-hook (lambda () (auto-revert-mode 1)))

But neither of these had an effect.


texts: Why am I getting an error while downloading Melpa packages in Emacs on Win7 OS

texts:
I am using Emacs on a Win7 machine. I have added the Melpa repo. in init.el.
When I do M-x list-packages, I do get a buffer listing the packages from Melpa.

But, when i try to download them, I get an error:

open-network-stream: make client process failed: connection timed out,   :name, melpa.milkbox.net, :buffer, #<killed buffer>, :host, melpa.milkbox.net, :service, 80, :nowait, nil...

Please note that I am using Emacs behind a corporate proxy. Emacs is able to download the list of packages but not able to install any.

Please find below snippet from my init.el:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "http://melpa.milkbox.net/packages/"))
(add-to-list 'package-archives
         '("org" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives
     '("gnu" . "https://elpa.gnu.org/packages/"))

(package-initialize)

;; line numbers in emacs everywhere
(global-linum-mode t)

(set-face-attribute 'default nil :font "Consolas-12")

;; set proxy
(defun proxy-activate ()
 (interactive)

 (let ((proxy "unrealproxy:8080") (credentials      "unrealusername:unrealpwd"))
 (setq url-proxy-services
  `(("no_proxy" . "^\\(localhost\\|10.*\\)")
   ("http" . ,proxy)
   ("https" . ,proxy)))

 (setq url-http-proxy-basic-auth-storage
  (list (list proxy
            (cons "Input your LDAP UID !"
                  (base64-encode-string credentials)))))))

 (provide 'proxy-activate)


texts: How to use a classical development setup (file explorer + code + terminal) in Emacs

texts:
I like using the following setup for development:

+--------+---------------------------------+
|    .   |                                 |
|        |         Python or JS            |
| Dired+ |             buffer              |
|        |       (with centaur-tabs)       |
|        |                                 |
|        +---------------------------------+
|    .   |    Shell, Eshell, or iPython    |
+------------------------------------------+

I'm looking for ways to make this setup more "static" and intuitive. By "static", I mean that, for instance, I'd like the Shell and the Dired buffer not to be replaced nor resized by any action.

Here are examples of problematic use cases that I'm trying to solve:

when I open a file from the Dired+ buffer, with o, I want it opened on the top right window. By default, one time out of two, it gets opened in the "Shell" window, sometimes resizing it at the same time. I don't want that. I found a hack at the post Controlling window locations fo files visited by Dired, but it only works as long as the file in question is above the frame separation on the left (e.g. it works for the first point on the picture above, not for the second)
When I do C-h m, I'd like the *Help* buffer to always open in the largest window;
When using Magit, I'd like the Magit buffer to alway appear in the largest window.

Can anyone suggest a way to solve these problems, or, in a broader sense, an efficient way to use this configuration on Emacs?


texts: How to check if a major mode derives from another?

texts:
Is it possible to check if a mode is derived from another mode?

eg:

(member major-mode '(c-mode c++-mode glsl-mode))

Could be replace with something like this:

(does-mode-derive-from major-mode cc-mode)


texts: Create private spacemacs layer for yafolding

texts:
I had tried to create my first (private) layer for spacemacs, for the yafolding package. So I had created the ~/.emacs.d/private/yafolding/packages.el file with the following contents:

(setq yafolding-packages
    '(
      yafolding
      ))

(setq yafolding-excluded-packages '())

(defun yafolding/init-my-package ()
   "Initialize my package"
   (use-package yafolding))

And also enabled this layer in ~/.spacemacs:

dotspacemacs-configuration-layers
'(
  ;; ...
  yafolding
  )

Now when I start emacs *Messages* lists my private layer as loaded:

Loading c:/Users/ZsBotykai/AppData/Roaming/.emacs.d/private/yafolding/packages.el (source)...done

But as far as I see, yafolding did not get installed (ls ~/.emacs.d/elpa/*yaf*).

What did I miss?

Disclaimer: as you might noticed it: I'm on Windows, with the official GNU Emacs windows binaries, although I'm having cygwin installed just in case (but without cygwin emacs). Also I had enabled other official layers but they were installed properly.


texts: read-event read entire arrow key instead of escape

texts:
In graphical emacs on OS X, (read-event) in the scratch buffer produces left, however in iterm2 (which I configured to send esc-* for arrow keys), I get something like

(read-event)
27
OD

when I press the left arrow. Configuring iterm2 to use esc for arrow keys works well with the other programs I use and I am reluctant to change it. Is there another function I can use instead of read-event that will pick up the entire arrow key?


texts: How to change color of the found character string on `projectile-find-file`?

texts:
I am using projectile-find-file to open files.
The color of the found part of the string ex: (bash) in the mini-buffer is unreadable on my terminal. Is it possible to change its color?
Example screenshot:


texts: org-babel problem printing separator rows to org-mode table

texts:
I found here in the org manual how to output from an org-babel source-code block to an org-mode table, namely through something like
#+header :results output table

I have had some trouble getting org-mode to interpret separator rows in output correctly, however, Here is an example
  #+name: stack_overflow_mve
  #+header: :exports results
  #+header: :results output table
  #+begin_src C++ :noweb yes :results output :flags -std=c++14 :includes '(<algorithm> <functional> <iostream> <cmath> <string.h> <stdio.h> <stdlib.h> <iomanip>)"
    double means   [] {0.23, 0.77,     2.05,    3.8,   6.35};
    double stddevs [] {0,    0.763675, 2.28184, 3.965, 6.65608};
    size_t total_count = sizeof(means) / sizeof(means[0]);
    std::cout << "count " << "mean " << "std_dev" << std::endl;
    std::cout << "-----|" << "----|" << "------|" << std::endl;
    for (size_t count = 0; count < total_count; ++count) {
        std::cout << count + 1      << " ";
        std::cout << means[count]   << " ";
        std::cout << stddevs[count] << " " << std::endl;
    }
  #+end_src

The code block above produces the following almost-table. As you can see, the separators on the second line are not correct. That incorrectness hinders my ability to feed the table to some later code blocks without manual intervention.
  #+RESULTS: stack_overflow_mve
  | count | mean |  std_dev |
  | ----- | ---- |   ------ |
  |     1 | 0.23 |        0 |
  |     2 | 0.77 | 0.763675 |
  |     3 | 2.05 |  2.28184 |
  |     4 |  3.8 |    3.965 |
  |     5 | 6.35 |  6.65608 |

If I put the cursor inside the table on the second line, replace the first space with a - and press TAB, org-mode corrects it to the following:
  | count | mean |  std_dev |
  |-------+------+----------|
  |     1 | 0.23 |        0 |
  |     2 | 0.77 | 0.763675 |
  |     3 | 2.05 |  2.28184 |
  |     4 |  3.8 |    3.965 |
  |     5 | 6.35 |  6.65608 |

Of course, I want to do that with my code so that my document is fully automated. Here are a bunch of attempts, each of which produces some hilariously differently wrong results:
//std::cout << "|-----+-----+-----|" << std::endl;
//std::cout << "|-----|-----|-----|" << std::endl;
//std::cout << "-----\t" << "---- \t" << "------" << std::endl;
//std::cout << "----- " << "---- " << "------ " << std::endl;
//std::cout << "------" << "-----" << "-------" << std::endl;

I was unable to find specific info in the org-manual about how to format separator lines correctly from org-babel code.


texts: Help with `replace-regexp-in-string`, to replace only first instance in every line

texts:
I have the following string:

// const asdf = 'asdf'
// // comment
// const asdf2 = asdf

And I want to run a regexp replace to make it look as follows:

const asdf = 'asdf'
// comment
const asdf2 = asdf

Basically, I'm trying to make a regexp that will comment out the first instance of // on every line. Here is my current implementation:

(setq comment "// const asdf = 'asdf'\n// // comment\n// const asdf2 = asdf")
(setq comment (replace-regexp-in-string "\\(//\\)" "" comment)))

But note that it is removing all matches to //, which gives the following output:

const asdf = 'asdf'
comment
const asdf2 = asdf

But I want to leave the second instance of // on the // // comment line. Any suggestions?

If your are curious, I am trying to solve this issue: https://github.com/fxbois/web-mode/issues/980 at this place in the code of web-mode: https://github.com/fxbois/web-mode/blob/master/web-mode.el#L9973


texts: backward-kill-word ignores whitespaces, is there another friendlier version?

texts:
Emac's backward-kill-word tends to delete more than I want.
E.g when I press delete multiple times on this:

(key-chord "qf" 'helm-org-in-buffer-headings)   ;heading search. |

I get:

1. (key-chord "qf" 'helm-org-in-buffer-headings)   ;heading|
2. (key-chord "qf" 'helm-org-in-buffer-headings)   ;|
3. (key-chord "qf" 'helm-org-in-buffer-|   <<< too much deletion.

I expected this in the 3rd step:

3. (key-chord "qf" 'helm-org-in-buffer-headings)|

I want to know:
- Is there a philosophy behind deleting more than what's wanted?
- Can I make emac's backward-delete-word more friendly? I.e, remove white spaces but don't kill off 'too' much?

EDIT
I don't really know 'what' I want. Maybe make it more like other delet functions like in google-keep or other text editing applications.

edit2
In the mean time, lawlist fixed up his custom function which works rather well: enter link description here


texts: 'wrong-type-argument stringp nil' Error With org-babel-load-file Function

texts:
I'm following the tutorial here to implement my init.el file in org mode. I therefore cleaned out my init.el file and added this only:

(require 'org)
(org-babel-load-file
 (expand-file-name "emacs-init.org"
                   user-emacs-directory))

When I do I get the following error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil)
  load-file(nil)
  org-babel-load-file("/home/tom/.emacs.d/emacs-init.org")
  mapc(org-babel-load-file ("/home/tom/.emacs.d/emacs-init.org"))
  eval-buffer(#<buffer  *load*> nil "/home/tom/.emacs.d/init.el" nil t)  ; Reading at buffer position 1065
  load-with-code-conversion("/home/tom/.emacs.d/init.el" "/home/tom/.emacs.d/init.el" t t)
  load("/home/tom/.emacs.d/init" t t)
  ...
  command-line()
  normal-top-level()

It seems that the expand-file-name function is working, but for some reason nil is being passed to the load-file function. Is that a proper reading of this stack trace? And if so, then why is that happening?


texts: Slime fuzzy completion not working correctly in TTY mode

texts:
I have Slime configured with fuzzy completion and it works perfectly when I'm using it in X11 mode (M-TAB, list of completions pops up in a separate buffer, C-n/p allows to choose the right completion, TAB makes use of chosen completion). However, when I run Emacs in TTY mode (-nw option), that last step fails, i.e. I get a list of completions, can navigate across them, but pressing TAB on my choice does not select it. I am, however, able to select it by pressing Enter, but this also results in a newline being inserted, which is annoying. Any idea why there is such a discrepancy between those two modes?

EDIT:

I'm using Emacs version 26.0.50.2 (but this also happened in previous versions - 24 and 25). My Slime version is 20161109.640 (installed from MELPA). Below is the part of the config relevant to Slime:

;;;;;;;;;;;;;;;;;
;; Common Lisp ;;
;;;;;;;;;;;;;;;;;

(setq auto-mode-alist
      (append auto-mode-alist
          '(("\\.cl\\'" . lisp-mode)
        ("\\.lsp\\'" . lisp-mode))))
(slime-setup '(slime-fancy
           slime-media
           slime-asdf
           slime-tramp))
(setq slime-enable-evaluate-in-emacs t)
(add-to-list 'slime-contribs 'slime-autodoc)
(add-to-list 'slime-contribs 'slime-trace-dialog)
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)


texts:
I would like to be able to use conda activate to switch between environments in ansi-term. I am running bash in ansi-term from Emacs 27.1 on MacOS Catalina. Currently, executing conda activate <ENV_NAME> from a terminal works as expected. However, from ansi-term, it gives the following output:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

See 'conda init --help' for more information and options.

IMPORTANT: You may need to close and restart your shell after running 'conda init'.

conda init <SHELL_NAME> doesn't help for any supported value of <SHELL_NAME>: it just tells me that none of the relevant dotfiles need to be updated.
I tried executing source ~/anaconda3/etc/profile.d/conda.sh in an ansi-term. This allowed conda activate <ENV_NAME> to execute without errors. However, while this does update environment variables like CONDA_PREFIX and CONDA_DEFAULT_ENV, it does not update others like CONDA_PYTHON_EXE or the system path, so executing eg which python gives /usr/bin/python instead of ~/anaconda3/envs/<ENV_NAME>/bin/python.
I do have exec-path-from shell installed. I also know that I can change the overall python environment used by emacs using something like pyenv-mode, but I specifically want to be able to switch environments in a terminal emulator (for example for running mpi programs).


texts:
I am trying to avoid duplicating code and also trying to avoid introducing unnecessary global symbols. So I tried to use let, dolist and lambda when defining the same keys in two different keymaps:

(let ((key (kbd "S-<down>"))
      (def (lambda ()
             (interactive)
             (unless (evil-visual-state-p)
               (evil-visual-state))
             (evil-next-line))))
  (dolist (map '(evil-normal-state-map evil-insert-state-map))
    (define-key map key def)))

Here I want S-down to have the same definition in both evil-normal-state-map and in evil-insert-state-map.

This gives me error:

Wrong type argument: keymapp, evil-normal-state-map


texts: Org Agenda missing past TODO items in Org 9.1

texts:
Org-mode's agenda view is behaving differently for me based on whether I use the Org-mode 8.2.10 that came with my Emacs or 9.1.1 as installed from Elpa. Specifically, on 8.2.10, the default "week" agenda view includes TODO items that are past due, but in 9.1.1, it does not. I am using the exact same configuration in either case. My init.el is here in case that helps. I would be grateful for any hints as to what might be causing this difference in behavior.

For example, today (2017-09-24), the following overdue todo item would be included in 8.x, but not in 9.x:

* TODO review code

DEADLINE: <2017-09-05>

I am using Emacs 25.2.2 from Debian.


texts: How to capture show-paren-mode region into the kill ring?

texts: I'm enjoying show-paren-mode using the "expression" style, which highlights a parenthesized region in a contrasting color.  I'd like to define an Emacs Lisp function that could capture the region into the kill ring, as in M-w (kill-ring-save), but the region seems to be represented as an "overlay," and there is no function to capture it.


texts: Disable minor modes like flycheck-mode and flymake-mode by default

texts:
I disable the following the modes in init.el

;;flycheck-mode
;;flymake-mode
(flycheck-mode nil)
(flymake-mode nil)
(prettify-symbols-mode nil)

However, they did not work as expected.

My emacs.d excluding 'init.el` cloned from purcell/emacs.d: An Emacs configuration bundle with batteries included

the flycheck-mode flymake-mode and prettify-symbols-mode are enabled by defautl.

The above three are of type function, why not working by passing nil to them?


texts: "C:/c/user/...my-folder/ isn't an existing directory" error

texts:
I use Emacs 24.5.1 with Spacemacs and added Msys2 to the exec-path to use git.exe

When I run 'Magit-status' I get the following error:

C:/c/user/...my-folder/ isn't an existing directory.

I can see there is something weird going on with the path. There is an extra '/c/'
There is a very similar error to users that use Git from Cygwin, and there is a work around to fix that by removing the extra '/cygdrive/' added to the file path. Unfortunately I haven't found anything to fix my problem.

Any ideas anyone?

Thanks


texts:
In ~/.emacs I've globally enabled whitespace-mode:

(require 'whitespace)
(setq whitespace-style '(face empty tabs lines-tail trailing))
(global-whitespace-mode t)

Example buffer content:

-*- fill-column: 100; whitespace-line-column: nil -*-
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut
labore et dolore magna aliquyam erat, sed diam voluptua.

According to documentation for whitespace-line-column: If nil, the `fill-column' variable value is used. However, that doesn't happen. In the buffer with the above sample content, highlight starts at column 80 (default value):

What I already tried, to no avail:

Enabled whitespace-mode for that buffer explicitly.
Buffer local: whitespace-line-column: 100
In ~/.emacs: whitespace-line-column: nil, whitespace-line-column: 100

Version: GNU Emacs 24.4.1 (i686-pc-mingw32) of 2014-10-24 on LEG570

How can I specify line length for whitespace-mode for an individual buffer?


texts: interactive-haskell-mode: Format specifier doesn't match argument type

texts:
Pressing C-c C-l (for a simple "Hello, world!" script) in interactive-haskell-mode gives me the error message
Format specifier doesn't match argument type

whereas I would have expected the file being executed in a new buffer (resulting in the output `Hello, world!").
The script consists fo the single line
main = putStrLn "Hello, world!"

I cannot make much sense of the error message. Does anyone has an idea which additional diagnostics I could run in order to pin down the problem?
There is a loosely related (open) issue on GitHub https://github.com/haskell/haskell-mode/issues/1429 resulting in the same error message for Haskell snippets in org-mode.
I'm using Emacs 25.2.2 from the official package on 64-bit Ubuntu 18.0.4 and also the haskell-mode package from the official repositories.


texts: How to bind mouse click to kill an inactive window, but not the buffer

texts:
I'm trying to create a binding to kill windows (but not buffers) when they're being pressed by a middle mouse click in their header lines. (Just to note, all windows in my setup have header lines.)

So far I've had some limited success killing the active window which is being under focus via this binding:

(global-set-key
    (kbd "<header-line> <mouse-2>")
    'kill-buffer-and-window)

The two issues I'm having with my current binding:

When trying to kill an inactive window, it kills the active window instead of the window that is actually being pressed. (by "active" I mean under focus with the caret pointer in it)
It kills both the window and the buffer, how can I kill just the window but not the buffer? The only interactive function that I've found was kill-buffer-and-window.


texts: How to hide items after refiling to a collapsed target in org-mode?

texts:
When an item is refiled to a target which is collapsed and contains other items, the refiled items are visible beneath the collapsed target. I would like these refiled items to instead be hidden along with the other items within the collapsed target.

So instead of:
 * Target...
 ** Refiled item 1
 ** Refiled item 2

one would just see:
* Target...

Is this possible?


texts:
I am trying to make term buffer to use slightly smaller font than of the rest of Emacs.

I was able to quickly find that for that I need to customize term face. I changed the font size, and indeed when the term buffer starts, initially it shows the prompt with the font size I set. But then, once I start typing it falls back to default font-size. Is it possible to get what I want at all?

Let me clarify: I don't want to change font-size with keyboard (which I still can do). I want it to be smaller by default.

upd: wondering if I can set text-scale-mode on term-mode-hook, since I can make it work through customizing the face


texts: Line break/word wrap setup for writing a book/journal

texts: I've just started learning Org-Mode and have comes across the issue of unending lines while journalling. All the different minor modes for line breaking and word wrapping have me confused. I want lines to end where the screen does, and not be dependent upon me hitting return. I also want to be able to move up and down a single line, defined by the size of the window and not where a line's newline character is, because I'm constantly resizing my window. I'm using Aquamacs right now, though also use iTerm.


texts: Keep ERC buffers in the background on reconnect

texts:
I'm using ERC (with ZNC) as my IRC client.  I'm joined to quite a few channels and when I run znc-all all my buffers are restored and the logs are replayed.  This is all great.

What I find very annoying, however, is that while replaying the logs each channel buffer is popped to the front and I really can't do any other work at that time.

It's even more annoying when I'm reconnecting automatically after being temporarily disconnected.  All of a sudden my work is interrupted by these channel buffers that pop to the front while the channel logs are replayed.

How can I tell ERC/ZNC to keep the buffers in the background when replaying chat logs?  I don't want Emacs to ever switch buffers unless I explicitly ask it to switch buffers.


texts: How to kill all buffers except the buffer current one and *other*?

texts:
I use this:
(defun kill-other-buffers ()
    "kill all other buffers."
     (interactive)
     (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))

I need to add one more buffer


texts:
I referenced C-h f apply for the source code of "apply", it prompts

References
C code is not yet loaded.

but does not hint the destination file.

Execute grep-find within Emacs repo thus return no results.

find . -type f -exec grep --color -nH --null -e 'int apply' \{\} +
Grep finished with no matches found at Thu Jan 16 18:47:40

How could locate the definition of apply in C code?


texts: Meta+Shift-Return in iTerm2 on Mac not working

texts:
Have you met the case that Emacs in iterm2 on Mac does not recognize  M-S-RET (Meta(Option)+Shift+ Return key)?  I guess it's related to the modifier key conversions in terminals.

M-S-RET is used in org-mode

I tried describe-key in Emacs and got M-[1 3; 4
I think M stands for meta, 13 is the ASCII code of return, 4 is the CSI u code for Shift+Alt  see http://www.leonerd.org.uk/hacks/fixterms/


texts: Emacs org-mode custom agenda view for each project

texts:
I have a project.org file that as a * Project subtree where each project I'm currently working on is tracked. I'd like to create a custom agenda view that separates out each project by project so I can see what items I have open for each project. I've been able to do something similar for work that has been delegated by using tags, but in this case I don't want to have to tag every item in order to separate it out. How might I go about breaking my agenda view up based on the subtrees in my project file? Example below
* Project
** Project 1
*** TODO Task 1
** Project 2
*** TODO Task 2
* Hiring
** Position 1
*** DONE Job Requirements
** Position 2
*** TODO Job Requirements

Should result in something like the following:

Project 1 unfinished tasks:
agenda:     TODO [#A] Task 1

=======================================================================================================================
Project 2 unfinished tasks:
agenda:      TODO [#A] Task 1

=======================================================================================================================
Position 2 unfinished tasks:
inbox:      TODO Job Requirements


texts: Is there a way to write and kill a buffer in a single command in Spacemacs / Evil?

texts:
I am new to (Spac)Emacs with Evil, and I did quite some searching to find an answer to this question, so I hope this is a 'legitimate' question here.

Is there a default single command to write a buffer and kill only the buffer instead of quitting Emacs. I found answers for how to just quit a buffer here and here but I do not know how to do the same thing including saving the buffer in one command. For example, I can delete the buffer with :bd, but :wbd does not work.

If there is no default way, then what is a nice alternative to get this job done (in a single command of course).


texts: Making mouse pointer invisible (x-pointer-invisible)

texts:
I am trying to hide the mouse pointer via:
(setq x-pointer-shape x-pointer-invisible)
(setq x-sensitive-text-pointer-shape x-pointer-invisible)
(setq void-text-area-pointer 'text)
(set-mouse-color (cdr (assoc 'mouse-color (frame-parameters))))

The last command is supposed to make the previous changes effective (it works with other pointer shapes), but in the case of x-pointer-invisible I get the error can't set cursor shape: BadValue.
Any ideas on how to fix this, or another way to make the mouse pointer invisible? I am looking for temporary invisibility that can be toggled on the fly.


texts: calc and evaluation of rational fractions

texts: I am new to using calc. Is it possible that the evaluation of ((x-1)/(x+1))+((x+1)/(x-1))=> returns ((x-1)/(x+1))+((x+1)/(x-1))=>(2 x^2 + 2) / (x^2 - 1)


texts:
I've made a minor change to the existing code in bibtex.el; to be more precise, I've modified the function bibtex-generate-url-list so that it can generate URLs for several more fields (in addition to the DOI and URL fields that the existing code can handle).

I have written the code that I need, that's not a problem. The problem is that I don't know how to make emacs see the changes.

What I tried:

Back up the original files bibtex.el.gz and the byte-compiled version bibtex.elc.
Save my changes in the old location and byte-compile the file. So the versions of bibtex.el.gz and bibtex.elc in the directory /usr/local/share/emacs/24.4/lisp/textmodes now contain my changes.
Restart emacs.

But my changes don't seem to work when I load a bibtex file.

So how can I make emacs use my changes?

For completeness, here is the code I added (everything after the doi entry). I've tested the regular expressions and they do what I want, so that's not the issue, as I explained above.

(defcustom bibtex-generate-url-list
 '((("url" . ".*:.*"))
(("doi" . "10\\.[0-9]+/.+")
 "http://dx.doi.org/%s"
 ("doi" ".*" 0))
(("mrkey" . "\\(mr\\)?[0-9]\\{1,8\\}")
 "http://www.ams.org/mathscinet-getitem?mr=%s"
 ("mrkey" "\\(mr\\)?\\([0-9]\\{1,8\\}\\)" 2))
(("arxiv" . "\\([0-9]\\{4\\}\\.[0-9]\\{4,5\\}\\|[-a-z]+/[0-9]\\{7\\}\\|[-a-z]+\\.[a-z]\\{2\\}/[0-9]\\{7\\}\\)\\(v[0-9]+\\)?")
 "http://arxiv.org/abs/%s"
 ("arxiv" ".*" 0))
(("zblnumber" . "\\([0-9]\\{4\\}\\.[0-9]\\{5\\}\\|[0-9]\\{8\\}\\)")
 "http://zbmath.org/?q=an:%s"
 ("zblnumber" ".*" 0)))


texts: How to detect if emacs starts with a file?

texts:
I would like to be able to implement the following logic.

(if (developer-opened-file-with-emacs)
    (do nothing, get on with working as fast as possible)
    (load fancy splash screen that may take a while))

What would be a good way to detect this case so that I may use this to choose what kind of startup behavior to use?

Another way to say this is: Will emacs show *scratch* buffer once it's started.

Examples of opening emacs with a file include:

emacs somefile.txt

Or using elisp:

emacs --eval '(progn (find-file "test.txt"))'

Note that checking argv isn't a good option since elisp may be used in a command line argument to open files.


texts: in org mode table. I have a cell with many words, and and to append more words to the end. But how to quick move to the end of current cell?


texts: Use `org-plus-contrib` to satisfy dependency of `org2blog`

texts:
Is there a way to tell package.el that the org-plus-contrib package I already have satisfies any dependency on org, so that installing packages that depend on org (such as the afore mentioned org2blog) doesn't automatically install org as well?

This is not an actual problem: after installing org2blog through the Package menu I now have org installed in addition to org-plus-contrib (which includes all of org). This extra org doesn't load (when I run M-x org-version I can see that I get the one from org-plus-contrib) or bother me in any way. But since I'm not using it, I'd rather not have it.

I bet the "right way" to fix this is for the org-plus-contrib package to be reduced to an org-contrib package that depends on org and only contains the extra libraries, not the org base. But is there anything locally I can do to fix this (very minor) annoyance?


texts: When repeat invoking counsel-ag, counsel-rg, counsel-projectile-rg etc, how can I quickly bring back the previous search term without retyping the query?


texts: Is there a case aware way to select words?

texts:
Is there a way to select words respecting the case... camelCase, snakeCase...

e.g.: i have a word "trullyAwesomeFunction" and cursor is on "w", is there an Emacs function I could use that would select "Awesome" and then if used again select "trully" and then "Function". and deselect them similarly?

Let's say this function bound to <C-up> I'm gonna have to press <C-up> 3 times to select the entire word. And if it's snake case like: "trully_awesome_function" it would work the similar way.


texts: clang-format malfunctioning(?) Or am I not fully understanding how clang-format works?

texts:
I installed the clang-format package from melpa.

I then added the following lines to my init file:

(require 'clang-format)

I then created a test directory, cpp-proj with one file, main.cpp.

main.cpp

#include <iostream>

using namespace std;

int main()
{
    cout << "ok\n";
    return 0;
}

I then created a .clang-format file in the directory using the command:

clang-format -style=webkit -dump-config > .clang-format

.clang-format

---
Language:        Cpp
# BasedOnStyle:  WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands:   false
AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
  AfterClass:      false
  AfterControlStatement: false
  AfterEnum:       false
  AfterFunction:   true
  AfterNamespace:  false
  AfterObjCDeclaration: false
  AfterStruct:     false
  AfterUnion:      false
  BeforeCatch:     false
  BeforeElse:      false
  IndentBraces:    false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: WebKit
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
ColumnLimit:     0
CommentPragmas:  '^ IWYU pragma:'
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat:   false
ExperimentalAutoDetectBinPacking: false
ForEachMacros:   [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
    Priority:        2
  - Regex:           '^(<|"(gtest|isl|json)/)'
    Priority:        3
  - Regex:           '.*'
    Priority:        1
IndentCaseLabels: false
IndentWidth:     4
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd:   ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
ReflowComments:  true
SortIncludes:    true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles:  false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard:        Cpp03
TabWidth:        8
UseTab:          Never
...

I then went back into my main.cpp file, with the whole buffer selected and issued the command Meta-x clang-format-region.

The result:

main.cpp

#include <iostream>

using namespace std;

int main() {
  cout << "ok\n" << endl;
  return 0;
}

This is not correct.

It should be:

main.cpp

#include <iostream>

using namespace std;

int main()
{
    cout << "ok\n"
         << endl;
    return 0;
}

No matter what style I choose it doesn't work within emacs.

Am I doing something wrong configuring clang-format?

It spits out the correct format when I issue the command

clang-format -style="<style>" main.cpp in a terminal, but never in Emacs!

What gives?


texts: Org capture template not working (when trying to set local notes file)

texts:
My goal is to get org-capture to store captured notes in a local "notes.org" file located in the same directory as the current working buffer.

I set the template like so:

(setq org-capture-templates
       '(("x"
     "local notes" entry (file+headline (concat ,(file-name-directory buffer-file-name) "notes.org") "Copied regions")
     "* %^{Title} %U \n %i")
    )
       )

Alas, when invoking the template i get Invalid file location: nil.

How should this be done?


texts: With org-babel, how to name the results of a function call and reuse them

texts:
In org-mode, I am trying to define a function, a variable, and then assigning to another variable the result of the function call on the first variable. However, then it seems that I cannot use this new variable in subsequent functions calls.

Inlining the function calls does work, but affecting the value to a variable first would allow for faster debug in case something goes wrong in the first function call, and to avoid duplicating potentially expensive computations.

MWE: (use (require 'ob-emacs-lisp) if needed)

#+name: square
#+begin_src emacs-lisp :var x=3
  (message (format "%s" (* x x)))
#+end_src

#+RESULTS: square
: 9

#+name: value
: 45

#+name: squaredvalue
#+call: square(x=value)

#+RESULTS: squaredvalue
: 2025

Now I try to reuse this value:

#+begin_src emacs-lisp :var res=squaredvalue
  (message res)
#+end_src

#+RESULTS:
: nil

Inlined calls do work:

#+begin_src emacs-lisp :var res=square(value)
  (message res)
#+end_src

#+RESULTS:
: 2025

Expanding the second code block shows:

(let ((res (quote "nil")))
  (message res))

What am I missing?

(This has been tested on emacs 24.3.1, 24.4 and 24.5, using org 8.2.10)


texts: Any date entry in the text will be captured in agenda view

texts:
I guess this is best explained by screenshots.
I have one entry like this:

then I run M-x org-agenda RET a RET and I get something like this:

Problem is, I do not want this timestamp to show up in my agenda as it's the content under the heading Problems and solutions, instead of a Deadline or Scheduled time.

I've googled for a few hours but amazingly couldn't get any helpful information.

thanks in advance.

Edit

I found this and tried the solution (set org-agenda-search-headline-for-time provided anyway but had no luck. Also tried searching for something like -for-time as suggested but it didn't give me any more than org-agenda-search-headline-for-time.


texts: Restoring windows and layout after an Ediff session

texts:
Looking for a solution on how to restore my window layout after an Ediff session, I found  a blog post, where the author suggests:
(winner-mode)
(add-hook 'ediff-after-quit-hook-internal 'winner-undo)

This seems to almost work well for me. I say almost because I invoke M-x ediff-buffers from Helm, and quiting the Ediff session brings me back to the original layout with the dead Helm menu from where I chose M-x ediff-buffers.
Let me explain:

At any point I have several windows open with a window layout L1.
I want to ediff some buffers, so I press M-x: This re-uses one of the windows in L1 to open up a Helm autocompletion menu. So far so good.
I choose ediff-buffers, and then the two buffers to compare, one after the other
This takes me to an ediff session where I can check differences etc.
Once I am done. I quit my ediff-session.
I would like to go back to my layout L1 in step #1. However, Emacs (winner-mode) takes me back to step #2, where one of the Emacs windows in L1 was used to show the options in Helm. This is pointless since I am done with my ediff session.

How can I restore windows to my original layout L1?
Setup:
This is all in Emacs 25.0.50.1 on OS X. More specifically, GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.0.0, NS appkit-1343.16 Version 10.10.1 (Build 14B25))


texts: Why does AucTeX say I need to run LaTeX again, when in fact I don't need to do so?

texts:
I've used the solution suggested in this answer to automize the compilation of my LaTeX document using Arara upon entering C-c C-a. The resulting output is perfect, but the following erroneous message appears in the Emacs status bar: You should run LaTeX again. When I run arara on the same LaTeX document from the command line (not within Emacs), I get no such message.

Why is this message displayed? How can I get rid of it?


texts: How could I get alchemist to always open its test report in a window at the bottom?

texts: alchemist.el has functions for running tests. These functions use display_buffer to show test results. Is there a way to ensure that all Alchemist test results open in a window that is the bottom-most window? In other words, if I have two windows, split vertically, one is the test file, when I run the test, it should create a 3rd window beneath the two that are split.


texts:
My emacs installation has over time grown so that the startup has started taking multiple seconds. The only feasible way to run emacs then is in daemon mode and then connecting with emacsclient. In my init.el I have the following snippet:

(lambda ()
 (when (display-graphic-p)
 (set-scroll-bar-mode 'right)
 (menu-bar-mode -1)
 (tool-bar-mode -1)))

This runs once on startup and and removes the toolbars atop graphical emacs, along with putting the scroll bar on the right hand side of the window. But in terminal emacs set-scroll-bar-mode is undefined, hence the surrounding if-statement.

The problem then is that this code runs on emacs startup, not when a client connects to the emacs daemon. Where do I hook up this function so that it's run for every new emacsclient that connects.


texts: Convert org-mode structure to dot source

texts:
Fast generation of graphs from a tree-like structure can be very useful when making notes in org-mode that require sharing and or beautification for other humans.

I couldn't find any way to do this other than to manually create a dynamic dot/graphviz block.

A translation from a structured tree to a simple directed graph should be fairly straightforward.

I'm looking for a simple way to traverse an org-mode tree (a selected region) and to translate the tree structure (and optionally some information from the contents of the structure) to a dot graph.

I can't possibly be the first to have come up with this. Has this been solved?

input

* la1
** la2
*** la3
*** la4
** la5

and perhaps a variable org-to-dot-preamble

digraph {
   rankdir=TB;
   splines=true;
   node [shape=box];

the output would look like an org-mode dynamic block

#+BEGIN_SRC dot :file out.png :cmdline -Kdot -Tpng
(contents of org-to-dot-preamble)

la1 -> la2
la1 -> la5
la2 -> la3
la2 -> la4
}
#+END_SRC

A more advanced version would first declare all the nodes and allow for some formatting.

input

* la1
  firstline
  secondline
** la2
   firstline
   secondline
*** la3
*** la4
    firstline
** la5

Some formatting variables

org-to-dot-shape
org-to-dot-font

output

#+BEGIN_SRC dot :file out.png :cmdline -Kdot -Tpng
(contents of org-to-dot-preamble)

la1 [shape=Mrecord, label="{firstline|secondline}", fontname = "helvetica"]
la2 [shape=Mrecord, label="{firstline|secondline}", fontname = "helvetica"]
la3 [shape=Mrecord, label="{firstline|secondline}", fontname = "helvetica"]
la4 [shape=Mrecord, label="{firstline|secondline}", fontname = "helvetica"]
la5 [shape=Mrecord, label="{firstline|secondline}", fontname = "helvetica"]

la1 -> la2
la1 -> la5
la2 -> la3
la2 -> la4
}
#+END_SRC


texts: spacemacs keeps matching my new file name to an existing file. How to save a brand new file?

texts:
This is my example:

I have two files in a directory:

Order.coffee
OrderCart.coffee

I wan to save the content of Order.coffee to a new file Cart.coffee

I use C-x C-w to save. When I typed in Cart.coffee, spacemacs matches to another file within the same folder, OrderCart.coffee.

I am unable to save it to Cart.coffee.

How can I prevent this mapping?


texts: how to select one row of a column of a table in org-mode (i.e. a cell of a table)

texts: in org-mode, is there a command to select the entire text in one column in one row? I know i can move to the beginning/set-mark/goto the end of the column. But i am wondering if there is one command already for that.


texts: TeX-folding creates visual newlines (AucTeX)

texts:
I rarely find myself asking questions since about everything has already been answered somewhere; not this one though.

I use Emacs 25.3.2 with AucTeX 12.1.1 on Ubuntu 16.04 and for a while now, whenever I enable TeX-Folding (invoking TeX-fold-buffer), the display string for folded elements (citations, refs and, footnotes) are followed by visual newlines (see screenshot link).

This also affects my custom display strings, which do not contain newline chars;

the problem is therefore not due to the string containing new line chars, but to some quirk in how folding is applied.

I have no clues how to investigate this any further… any ideas?

Many thanks and all the best!

screenshot here: http://www.phylax-computerkunst.de/download/auctex_folding_error.png


texts: Conditional key binding: Evil vs Slime conflict for "M-."

texts:
Slime (and elisp-slime-nav) uses M-. to navigate to the symbol at point, and M-, to pop back to previous marks. I like this.

Evil uses . to repeat the previous editing command, C-. to replace a just repeated command with a previously executed command, and M-. to do the same in the reverse direction (useful if you overshoot with C-.). I like this as well.

I'd like to use M-. for slime-style navigation except when the previous command was C-. (evil-repeat-pop), in which case I'd like M-. to run evil-repeat-pop-next. I'm not sure how to go about implementing this.

I'm considering removing the evil M-. binding and defining a hydra that's entered upon running evil-repeat-pop (C-.) and which binds M-. to evil-repeat-pop-next in a transient keymap.

I also considered binding M-. to a wrapper function like,

(if (eql last-command 'evil-repeat-pop)
    (evil-repeat-pop-next)
  (elisp-slime-nav-find-elisp-thing-at-point))

but I want the "else" clause to do whatever M-. would have done if evil wasn't enabled. This might be elisp-slime-nav-find-elisp-thing-at-point, xref-find-definitions, ggtags-find-tag-dwim, etc. depending on what modes and code-tagging approaches I'm using.


texts: Why has my .custom file changed between `(quote` syntax and the `'` syntax and how to convert between the two?

texts:
I use the same .custom file on different machines syncronised via a git repo.
I just noticed that suddenly the .custom file from one machine uses the (quote syntax while in the past the  ' syntax was used (or vice versa). Two questions:

Why is this happening? Is there a change in, say, Emacs 27? (On one machine I have upgarded to 27.)

How can I convert manually between the two syntaxes, so that I can diff teh files sensibly?


texts: How can I use two hooks with overlapping usecases?

texts:
I'm in the process of writing an Emacs package that helps you controlling popup windows and have hit a minor roadblock while developing a new feature for it.  Currently I'm using window-configuration-change-hook to track certain buffers and their windows that have either been buried or closed, however this hook cannot catch if the buffer in question has been killed since this isn't a window configuration change.

edit: There is a kill-buffer-hook that could help me solve this minor annoyance, however it's run differently than window-configuration-change-hook. window-configuration-change-hook is run after the window configuration changes, kill-buffer-hook is run before the buffer is killed with the buffer selected.  This means that if I add my function to both hooks, I cannot detect if the buffer has been killed because it hasn't been killed yet when the hook is run. That means I'd need to either use a different function in kill-buffer-hook that operates on the selected buffer than in window-configuration-change-hook where the selected buffer has different semantics or would need to know what hook has run it.


texts: Inline images appear shifted down relative to text

texts:
To speed up visually scanning my org file I would like to add icons to my headings. I am using 16x16 images which seem to fit well with the size of the font, but the images always appear slightly offset, lower than they should be.

Is this expected behavior? Is there a way to fix it so it is vertically aligned with the text? Thanks.


texts:
I read a lot of mailing lists in mu4e. Sometimes a thread that I'm not interested in gets a lot of activity, and I'd like to unsubscribe from that thread in particular without unsubscribing from the whole mailing list.

How can I ask mu4e to take future replies to a thread and send them straight to my archive?


texts: Remove extra prompts in inferior-python-mode with ipython

texts:
emacs24.5 -Q
M-: (setq python-shell-interpreter "ipython") RET
M-x run-python RET

Python 3.5.1 (default, Dec  7 2015, 12:58:09)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
In [1]:
In [2]:
In [3]:
In [4]:

This may seem pretty insignificant, but I honestly believe that small cosmetic quirks like these can have a large impression on those who do not already love Emacs. And besides, I'm OCD. :)


texts: Cover the active region with a character

texts:
Called with an active region, it will replace all spaces in that region with the character corresponding to the subsequent key press. E.g., if cover-active-region is bound to C-c /, then C-c / h will replace all spaces (not newlines or anything) in the active region with the letter h.

I suppose this is a simple extension of a command that replace all characters in active region (not just whitespace).

In any case, I'm sure there is a function or idiom for this in Emacs, but I can't seem to find it.


texts: How to actually scroll with popup-tip :scroll-bar t?

texts:
Following this blog post, I am interested in using popup.el for my own purposes. In the post, he mentions to add a scroll bar with the :scroll-bar argument. If I include the :scroll-bar t option in popup-tip a scroll bar is displayed, but I couldn't find any way to actually use it. Is this functionality just not implemented? If it is, could you provide an example?

(defun hlwm/object-tree ()
  "Show the current hlwm object tree in a buffer."
  (let* ((shell-command-switch "-c")
     (object-tree-string
      (shell-command-to-string "herbstclient object_tree")))
    (popup-tip object-tree-string
           :point (point)
           :around t
           :height 30
           :scroll-bar t
           :margin t)))


texts:
I use org-mode for a lot of things, but two of them are now in conflict. The two use cases are (1) drafting assignments and exporting to LaTeX and (2) tracking my reference library using RefTeX. My default system PDF reader is Acrobat, which is great for reading and annotating PDFs. However, it's not so great when you're exporting from org to LaTeX, because it locks the file, meaning you have to close it to redo the export. Recently I added the following lines to my configuration on Windows to use SumatraPDF instead, because it allows for live updates of the file without closing:

(custom-set-variables
 '(org-file-apps
   (quote
    ((auto-mode . emacs)
     ("\\.mm\\'" . default)
     ("\\.x?html?\\'" . default)
     ("\\.pdf\\'" . "C:/SumatraPDF/SumatraPDF.exe %s")))))

The issue is that when I open PDF links from my reference library, they now (of course) open in SumatraPDF, when I would rather be using Acrobat, the system default. Is there a way to either (a) select a different PDF viewer only for org-mode exports or (b) specify to use the default PDF viewer when opening links from my reference notes file?


texts: Debuggable emacs and vanilla emacs binaries

texts:
I'm running Ubuntu 20.04.
I would like to build an emacs binary for general usage (no debug symbols) and
another emacs binary (when something goes wrong).  The build is pretty straight-forward, but I don't know how to have both debug and non-debug binaries exist at the same time.
Is it enough to ./autogen.sh && ./configure -ggdb3 -O0 && make - and then copy the resulting src/emacs debuggable binary to a temporary directory.
Followed by ./autogen.sh && ./configure && make && make install
which will create (in my case) a /usr/local/bin/emacs-28.0.50
Finally, can I simply copy the binary I configured with debug flags to /usr/local/bin/emacs-28.0.50-debug and call that file when needed?
Or - do I have to included other emacs-related files when I debug emacs?


texts: Emacs (spacemacs) not keeping extensions

texts:
I installed emacs 25.1.1 on fedora and cloned the spacemacs environment. Then, I launch emacs and install some packages (e.g. magit). When I close and reopen emacs all my extensions must be reinstalled to use them. I can see the files I need exist under .emacs.d/.cache.

Any idea why it is not installing them permanently?


texts: How to autoload a package without requiring in the init file?

texts:
When you install clojure-mode via package-install, you can then open any .clj file and automatically enter the mode.

And this works for every subsequent Emacs launch ; Yet, no (require 'clojure-mode) (or a custom definition, nothing) has been inserted in the init file.

I carefully reviewed the clojure-mode.el file, and found no clue as to how this works. Yes, the main interactive functions and the major modes definitions are autoloaded, and the common clojure file extensions are added to auto-mode-alist:

;;;###autoload
(progn
  (add-to-list 'auto-mode-alist
               '("\\.\\(clj\\|dtm\\|edn\\)\\'" . clojure-mode))
  (add-to-list 'auto-mode-alist '("\\.cljc\\'" . clojurec-mode))
  (add-to-list 'auto-mode-alist '("\\.cljx\\'" . clojurex-mode))
  (add-to-list 'auto-mode-alist '("\\.cljs\\'" . clojurescript-mode)))

But this is not enough for the mode I'm working on. I found no way of loading it without explicitly requiring it in the init file..?

What is this magic?


texts: Show included text inline, like with org-display-inline-images

texts:
Goal

In org-mode, you can include parts of other files during export with the keyword #+INCLUDE. I would like to be able to view the included files in-line in the current buffer (and maybe even edit the included text?).

Questions

Are there any existing tools for this? (I haven't found any yet.)
If not, is this possible?
If so, would someone knowledgeable and competent in the ways of elisp give me some pointers on how to start implementing such a feature?

Example

Suppose I have the following org file:

./foo.org:

#+TITLE: Foo

Blah, blah blah.

#+NAME: whitehead-on-notation
#+BEGIN_QUOTE
...by the aid of symbolism we can make transitions in reasoning almost
mechanically by the eye, which otherwise would call in to play the higher
faculties of the brain.
#+END_QUOTE

And I include it in another file:

./bar.org

#+TITLE: Bar

Blah blah blah, blee blah

#+INCLUDE: "./foo::whitehead-on-notation"

Blee blah, blee blah, blo blee.

I would like to be able to execute a function, and have the buffer viewing ./bar.org display

#+TITLE: Bar

Blah blah blah, blee blah

#+INCLUDE: "./foo::whitehead-on-notation"
#+BEGIN_QUOTE
...by the aid of symbolism we can make transitions in reasoning almost
mechanically by the eye, which otherwise would call in to play the higher
faculties of the brain.
#+END_QUOTE

Blee blah, blee blah, blo blee.

But, critically, I want the excerpt to be virtually embedded, so that if anything changes to the text in foo.org, the embedded text will also be updated. If this would require that the displayed text in bar.org be read-only, that is acceptable.


texts:
This question is pretty self explanatory. I'd like to move evil-mode-line-tag to the beginning of mode-line-format. However, when I try my instinctive solution:

(setq-default mode-line-format (cons
                                 'evil-mode-line-tag
                                 (delete 'evil-mode-line-tag
                                          mode-line-format)))

My changes seem to be reverted instantly. Why is this, and how can I achieve the effect I'm looking for?


texts: How do I remove passwords and usernames from my emacs .init file?

texts:
Example:

I have IRC username and password in my emacs .init file
I share my .init file across devices using a public github repo
I encrypt this heading in my .init to avoid showing
org-encrypt-entry does NOT always encrypt upon saving file
thus I always have to check before git push
also sometimes I share snippets of my .init with people in IRC to help troubleshoot. Today I posted my IRC pw's and had to immediately reset.

Instead of hardcoding un/pw's in my .init file, can I use some elisp to reference a .gpg dir/file elsewhere?


texts:
I would like to open url in eww in readable-mode and find str.
Below is my code that doesn't work:

(defun my-eww-searh-readable (str)
  "Once-off call to `my-eww-searh-readable' after EWW is done rendering."
  (unwind-protect
      (eww-readable)
    (search-forward-regexp str)
    (remove-hook 'eww-after-render-hook (lambda () (my-eww-searh-readable str)))))

(defun my-eww-url (url str)
  "Open URL in `eww' with `eww-readable' enabled and search str."
  (interactive)
  (add-hook 'eww-after-render-hook (lambda () (my-eww-searh-readable str)))
  (eww url))

(setq strtmp "eww")
(setq ulr "https://emacs.stackexchange.com/questions/50807/search-in-readable-eww-buffer")
(my-eww-url url strtmp)

I found the following mistake:

Symbol’s value as variable is void: str

What do I do wrong?


texts: Binding compile command to a key for c++ code

texts: Is it possible to bind the compile and run commands for a c++ code to a single key (for example F5). What i do at the moment is to run M-x compile and then as compile command g++ project.cpp and then i run ./a.out in a shell. Does anyone has a solution for doing these with less typing for c++?


texts:
I want to be able to copy paste using C-c and C-v when I edit a file and in multi-term. After more than a few hours I gave up. I would be thankful if anyone could tell me what the recommended way for doing something like this is.  Here are some of the things I tried:

Putting

(local-set-key (kbd "C-c") 'kill-ring-save)
(local-set-key (kbd "C-x") 'kill-region)
(local-set-key (kbd "C-v") 'yank)

in my find-file-hook. This works for C-x and C-v but doesn't work for C-c. (I think this is because of the C-c C-... keybindings, but I don't know if there is some way to just overwrite those).

Defining a function that uses

(if (or (eq major-mode 'term-mode) (eq major-mode 'eshell-mode))

to detect whether we are in a terminal or a file and then deactivates cua-mode or activates it. I added this function to some hooks but it got buggy, because this function was either called not enough or too often. Also

(add-to-list 'term-bind-key-alist '("some binding" . some command))

works for C-v and C-x but not for C-c.

Note: I know that C-c is normally terminal interrupt, but I put a stty intr ^J in my .bashrc.

Using eshell instead of multi-term: The Problem with the eshell is, that it's autocompletion is not as good as the autocompletion of bash. Bash can e.g. autocomplete git chec  to git checkout.

Note: I know that normal Emacs users use M-w and and C-y to copy-paste, but this would mess up my muscle memory when working with programs that use C-c C-v top copy-paste.

UPDATE: The following works:

(global-set-key (kbd "C-v") 'yank)
(global-set-key (kbd "C-x") 'kill-region)
(define-key input-decode-map (kbd "C-c") (kbd "M-w"))
(add-to-list 'term-bind-key-alist '("C-v" . term-paste))

Why is emacs so unnecessarily complicated?


texts: How to disable syntactic indentation interactively in php-mode?

texts:
I discovered that in php-mode, syntactic indentation makes rigid indentation very slow when the marked region is big. When I disable syntactic indentation, rigid indentation is not slow anymore.

So I made functions that disable syntactic indentation before indenting rigidly.

(defun my/indent-region-left-tab ()
  (interactive)
  (c-toggle-syntactic-indentation -1)
  (indent-rigidly (region-beginning) (region-end) -4)
  (c-toggle-syntactic-indentation 1)
  (setq deactivate-mark nil)
  )

(defun my/indent-region-right-tab ()
  (interactive)
  (c-toggle-syntactic-indentation -1)
  (indent-rigidly (region-beginning) (region-end) 4)
  (c-toggle-syntactic-indentation 1)
  (setq deactivate-mark nil)
  )

The problem is they don't seem to disable syntactic indentation, because they work just as slow. But if I use the next function before calling my/indent-region-left-tab or my/indent-region-right-tab, then the indentation is done fast:

(defun my/disable-syntactic-indentation ()
  (interactive)
  (c-toggle-syntactic-indentation -1)
  )

How to do it so it can be all put inside the functions so they are not slow anymore?


texts: Is it possible to compress data (an Elisp string for example) using Emacs (without calling 3rd-party commands)? I noticed Emacs uses zlib, but I only found zlib-decompress-region.


texts: Tell ESS to use a different R program when on a Tramp remote session

texts: I'm trying to configure ESS to use a different R program path when I'm on a remote session. Now, every time I ssh into the hpc cluster I use, I set the variable inferior-ess-R-program to /weird/path/to/R to make ESS open up a remote R session, but I'd like to figure out how to this automatically. I use R on my local machine via ESS as well, so changing the variable permanently it not an option. Thanks!


texts: Emacs org mode export paragraph in block to HTML, The content does not wrap

texts: it became to one long straight bar, instead of showing as a block of the paragraph. I use #+begin_example. if I use quote it looks ok but I want to have the block looks.


texts:
When I try to open a zip file in emacs I just see the binary file instead of a listing of the files.

I get the following backgrace:

Debugger entered--Lisp error: (args-out-of-range 36585 36589)
  archive-zip-summarize()
  archive-summarize(nil)
  archive-mode()
  set-auto-mode-0(archive-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer cmyk.zip> "~/Downloads/cmyk.zip" nil nil "~/Downloads/cmyk.zip" (9179932 64513))
  find-file-noselect("/home/thayne/Downloads/cmyk.zip" nil nil nil)
  find-file("/home/thayne/Downloads/cmyk.zip")

The numbers in args-out-of-range change depending on the zip file.

I have googled around and can't find anything that works. This happens for EVERY zip file.

EDIT

I am using emacs 24.3.1, I can get a listing when I use emacs -q, so I guess it is something in my configuration.

I am using Prelude with a number of plugins installed, I'm not sure how to narrow down on what plugin and/or configuration is causing the problem though.


texts: How to create grouped company-backends list and an extra one for specific major mode?

texts:
Lately, I'm working on how to configure the best grouped company-backends for different major modes, although having been using company-mode for over one year (already got a configuration long time ago), but recently realized it was not working as I expected, and started looking for the official documentation on how to configure it, but found nothing useful.

For example
in emacs-lisp-mode, words in buffers, yasnippet, elisp(company-capf), etc., sorted in this order in the droplist

in c/c++-mode, words in buffers, yasnippet, the name(variable, function, struct etc.), etc,.

in org-mode, words in buffers,  yasnippet, etc,

in latex-mode, words in buffers, yasnippet, latex-environment, etc.

If I insert and "/", it should use company-files as the primary backend.

In above examples, there will be a default company-backends for all the major modes when company-mode is enabled, there will be an extra configuration for a specific minor mode to work with the default.

For example:

(setq company-backends
  '(
    (
     company-files
     company-dabbrev
     company-keywords
     company-capf
     company-yasnippet
     )
    (company-abbrev company-dabbrev)
    ))
(add-hook 'emacs-lisp-mode-hook
      (lambda ()
        (set (make-local-variable 'company-backends)
             (append company-backends
                     '((
                        company-elisp
                        ))))))

But I cannot make the company-elisp work, there always are such problems for other major modes, the two backends won't work well for a specific major mode. there always are one or more backends is not working.

No official documentation or examples.

How to create grouped company-backends list to work with an extra one for specific major mode?


texts: org-mode : highlight lines in src blocks when exported

texts:
Github has a convenient way to show some lines as highlighted in the code, like so.

I'd like to know if there's a way to setup something similar with org-mode code blocks when exporting (in my use case, to HTML), so I can show a longer code block for context yet point the reader quickly towards the lines that were added or modified.

I haven't found anything obvious in the documentation. I don't know where I would start the research to implement this myself.

Can this be done? Has it already been implemented? If not, can I implement this myself? Where would I start?

I have found that org-mode exports to HTML and provides a .code-highlighted class, but that seems to be only for the (ref:xx) tools: hover over a reference, the corresponding code gets highlighted.


texts: How to add a right-aligned menu item to menu-bar?

texts:
I hide the window title bar, so I can't use the close window button in the top right corner.

I want to add a menu item with no drop-down menu on the far right side of menu-bar, which can only be clicked as close window button.

A more detailed explanation of the problem added after Drew’s answer:

Close button should be close to the right edge of the window, There should be a space separator in the middle to isolate the close button from other menu items.


texts: How do I generate a swiper like list from a custom input?

texts:
I need help with creating a tool.
So I have some lines selected by a region, that I need to feed line by line to a shell/python script. The output of shell/python script will be of the form:

0xabcd is in func1 (/path/to/file/a.c:233)

I want to show these lines in a swiper like buffer in this format:

func2(233) /path/to/file/a.c
func1(567) /path/to/another/file/b.c

so that I can use down and up arrows to visit these files. eg. using an up arrow will show file /path/to/file/a.c at line number 233 and
using a down arrow will show file f.c at line 567 etc.
something like this but with my own entries:
imgur.com/gallery/uYtuOyg

What is an efficient way I go about doing this in elisp ?


texts: Exporting help for multiple emacs lisp symbols into a single Texinfo file

texts: I am looking for a way to produce HTML documentation for functions and variables defined in my .el files. One way I have seen suggested is by using texi2html tool. The challenge is to produce the input for texi2html. In particular, how do I export help for multiple Emacs-Lisp symbols into a single Texinfo file?


texts:
Is this possible with stock emacs:

I'm editing a .txt file that has a snippet of bash code
  When I do C-x b RET  I can switch to a preopened M-x shell buffer named guesuser@productionServerShellSession
  I have the snippet of bash code selected in a .txt file. It's a multi line pipe command ending with \ on each line.
  I often find myself copying the region, switching buffer and pasting and pressing enter to run the snippet in shell.

Can this be made easier with fewer key strokes?

What I did:
Researched https://stackoverflow.com/questions/6286579/emacs-shell-mode-how-to-send-region-to-shell


texts: How to prevent Gnus from creating a `~/News` directory?

texts:
I'm using Spacemacs on Debian Linux.  Each time I start Gnus with SPC a g, it creates a folder ~/News in my home directory.  I don't see the point in this, as I only use Gnus to read news via NNTP.

What is this folder good for, and how can I prevent Gnus from creating it?


texts: Insert multiple blank line in table editor

texts:
I'm using the built-in table editor of org-mode.

As described in the documentation, I can use M-S-Down to insert a row above my current row. Using the universal argument, I can create my new line below my current line instead of above: C-u M-S-Down.

However, when trying to create multiple lines at the same time, it does not work: C-- C-5 M-S-Down: this only create one line.

How can I insert a specific number of line below my current line?


texts: Theme background not exported for HTML source code block

texts:
I have some code snippets within an org file:

#+BEGIN_SRC python
print 42
#+END_SRC

When exporting to HTML (org-export-dispatch), the syntax highlighting seems to follow my current theme, but the background of the code block remains pure white (and as I'm using a dark theme, makes the code quite unreadable).

From what I've seen htmlize.el (https://github.com/hniksic/emacs-htmlize) is supposed to help. I can call htmlize-buffer and indeed I get a page that has the right background colour, but it's just a "raw" copy of my buffer and not a proper Org export.

How should I go about to make org-export-dispatch use htmlize only for the source code blocks ?

FWIW I'm using Emacs 24.5.1


texts: How can I change the font face for source code blocks in org-mode?

texts:
I tried to change both org-code and org-verbatim without success. Here is the relevant part of my theme:

'(org-verbatim ((nil (:inherit 'fixed-pitch))))
'(org-code ((nil (:inherit 'fixed-pitch))))

The setting for checkboxes does get applied however '(org-checkbox ((nil (:inherit 'fixed-pitch)))).


texts: Prevent bmkp-last-as-first-bookmark-file from being placed in custom-set-variables

texts:
I have the following code to set a custom.el file and load Bookmark+:

(setq custom-file  (concat elf-emacs-lib-home-directory "emacs-config/" "custom.el"))
(when (file-exists-p custom-file) (load custom-file :noerror))

(setq bookmark-default-file  (substitute-in-file-name "$HOME/.emacs.d/.bookmarks"))

(use-package bookmark+              ;;; Bookmark+: extensions to standard library `bookmark.el'.
  :init
  (defvar bmkp-last-as-first-bookmark-file)
  (defvar bmkp-bmenu-state-file)
  (setq bmkp-last-as-first-bookmark-file bookmark-default-file) ;; load the the last-used bookmark file first
  (setq bmkp-bmenu-state-file            (substitute-in-file-name "$HOME/.emacs.d/.bmk-bmenu-state.el")))

My problem is that I keep getting this in my custom-set-variables:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(bmkp-last-as-first-bookmark-file "/users/name/.emacs.d/.bookmarks")

How do I prevent this variable from being placed in custom-set-variables?


texts: Is there a way to specify seconds when starting the orgmode countdown timer? I've tried using fractions of a minute, such as 1.5, but it disregards anything after the first digit.


texts: The GDB local variable window (in the multi-window view) usually works fine to track local variables. However, I've recently been coding a lot in C++, and almost all variables are some kind of struct/class, which is just displayed as <complex data type>, which isn't very useful. Is there any way of telling Emacs (or GDB?) to display said data type anyways? Maybe even with some upper limit?


texts: Switch to buffer conditional to no file having been specified in the command line?

texts:
On startup, I want to create an empty buffer and switch to it, but only if no file has been specified in the command line.

The closest I have is

(switch-to-buffer "untitled")

at the end of init.el but this still creates an "untitled" buffer even when I specify a file in the command line. I don't want this because it slows things down and leaves an unneeded buffer lying around.


texts: Code completion for structure with preprocessor selection statement

texts:
I'm using Rtags and Irony as backends for company. They work but with some glitches. For example, given this code segment:
#include <stdio.h>
#include <signal.h>

int main()
{
    struct sigaction sa;
    sa.
}

When I typed struct sig, this is no completion candidates displayed
When sa., both Rtags and Irony show completions like sa_flags, sa_mask, and sa_restorer. But there should be sa_handler or so

For #1, it's fine without any completion. But for #2, it's bewildering. The definition for struct sigaction is
struct sigaction
  {
    /* Signal handler.  */
#ifdef __USE_POSIX199309
    union
      {
    /* Used if SA_SIGINFO is not set.  */
    __sighandler_t sa_handler;
    /* Used if SA_SIGINFO is set.  */
    void (*sa_sigaction) (int, siginfo_t *, void *);
      }
    __sigaction_handler;
# define sa_handler __sigaction_handler.sa_handler
# define sa_sigaction   __sigaction_handler.sa_sigaction
#else
    __sighandler_t sa_handler;
#endif

    /* Additional set of signals to be blocked.  */
    __sigset_t sa_mask;

    /* Special flags.  */
    int sa_flags;

    /* Restore handler.  */
    void (*sa_restorer) (void);
  };

It's like that all codes inside selection statements of preprocessor are not parsed.
How can I make them work?


texts: Config, examples and use cases of Library Of Babel

texts:
I want to understand how org-babel's Library Of Babel works. Seems like a powerful yet underused tool.

The documentation says that I can

  add code to the library, by first saving the code in regular ‘src’ code blocks of an Org file, and then load the Org file with org-babel-lob-ingest, which is bound to C-c C-v i.

What is that org-babel-lob-ingest truly doing? It is just appending all source blocks within an Org File to another file?

And what are the use cases of this? Can I see what I have in my Library interactively? Can I use noweb syntax with source blocks within the Library? What do I need to do to start using it?

Any examples and links to tutorials are very welcome.


texts: in a custom lisp function how to run command after gdb loaded

texts:
below are my set up for launching gdb in Emacs.

(defun debug-gdb-advanced ()
  (interactive)
  (delete-other-windows)         ; close all other panes
  (split-window-horizontally)    ; split pane left right
  (other-window 1)               ; switch to right pane
  (split-window-vertically)      ; split pane top down
  (debug-gdb)                    ; open
  (set-window-dedicated-p (selected-window) t) ; anchor the gdb window, never let it switch buffer
  (other-window 2)               ; switch to left pane
  (gdb-display-stack-buffer)     ; open stack buffer
  (other-window 1))              ; switch to gdb pane

but I also want to run the following after gdb has initialized

(defun closeUnnecessaryBuffers ()
  (interactive)
  (setq kill-buffer-query-functions nil)
  (kill-buffer (shell "*breakpoints of *"))
  (kill-buffer (shell "*threads of *"))
  (kill-buffer (shell "input/output of*")))

is there a way to fold the second function into the first one without mannually waiting gdb fully initialized.


texts: Pdf-tools: Toggle between viewing and editing mode

texts: In DocView (without pdf-tools installed) I could hit C-c C-c to toggle between viewing-mode and editing-mode. After installing pdf-tools I expected C-c C-c to act the same. But now it toggles between PDFView and DocView, without any editing mode. What can I do to make it toggle between PDFView and editing mode?


texts:
If I need to remove everything in a parenthesis {...}, I do

Put the cursor on {
Click C-space (set mark)
Click C-M-right (go to the })
Click C-w (remove selection)

How can I automatize these steps? How to do this macro-like action in emacs?


texts: I use ediff-revision or vc-ediff to compare the current state of a file respect its working revision. I normally do not want to check the whole file but just the difference at or closest to the current position. However, ediff will always start from the beginning of the file. Is it there a way to force it to find the closest difference and open buffers A and B centered on that?


texts: Editing html is good but I really would like to have a way of fast previewing the changes that I made. Is there e.g. a script to open Chromium or refresh a site for that?


texts: set-frame-size does not work on emacsclient

texts:
I have set up Emacs daemon on Windows 10. My Emacs version is GNU Emacs 25.3.1

I have some code in my init.el which resizes the frame size automatically when Emacs starts up. The code is

;; Select a desirable font-size, frame position and frame size when Emacs starts up
(defun originalPosition ()
  (interactive)
  (set-frame-font "Courier New-14" t t)
  (set-frame-position (selected-frame) 100 50)
  (when window-system (set-frame-size (selected-frame) 82 28))
  )
(originalPosition)

This code used to work perfectly when I launched Emacs normally (not as daemon). However, emacsclient does not accept these settings.

Searching around for a solution, I realised that I need to use after-make-frame-functions . So I added an extra line to my init.el

(add-hook 'after-make-frame-functions (lambda (frame)(when (display-graphic-p frame)(originalPosition))))

After adding this line, every instance of emacsclient has different frame sizes (but uses the correct font size).

How can I get emacsclient to use the correct frame size for every instance?


texts:
I'd like to obtain the absolute pixel position of the point (i.e. the cursor, not the mouse pointer) in the current buffer in a GUI frame, to pass it onwards to an external program.

I don't mind where the pixel position is anchored, e.g. whether to the frame or to the display, as I can easily convert between these, but I haven't found a way to obtain either position within Emacs.

What did I miss?  What function can I use to get the pixel position of the point?


texts: How to auto-save buffers when Emacs loses focus?

texts:
I recently had a Sublime Text user try out Emacs for a while, and he was interested in getting the same auto-save behavior in Emacs.

Basically, he wanted all buffers to be saved whenever the frame lost focus (really saved, not just backed-up). This includes when switching windows to a completely different application.

I could not find any event that was triggered when switching to a different application. Is there such an event or is there another way to achieve the same behavior?

Note a time based solution was not satisfactory, and neither was the default auto backup behavior. He specifically wanted the buffers to be saved (as in save-buffer) for all files.


texts: Context sensitive skeleton triggered by abbrev stuck in loop

texts:
I want to create a skeleton, triggered by the abbrev keyword 'func' which checks its context and runs one of two possible sub-skeletons.

Here's what I have:

(define-skeleton my-func-skeleton "func skeleton"
  ""
  (if (looking-back "\n")
      ;; A function at left of screen is a top level function.
      '((setq str (skeleton-read "Function name: "))
        "// " str " ." \n
        "func " str "(" @ ") {" \n
        _ @ \n
        -1 "}")
     ;; Otherwise it is an anonymous function.
     '("func () {" \n
       _ \n
       -1 "}")))

(expand-add-abbrevs go-mode-abbrev-table
                    '(("func" my-func-skeleton)))

But this just recursively executes the appropriate sub-skeleton until I quit.

How do I make expressions within skeletons return sub-skeletons that work correctly?


texts:
Before switching to eshell I had zsh setup so that it would:

Write out to the history file after every command
Append to rather than overwrite the history file so when running multiple shells they would all get merged into one big history

Both zsh options are documented here (see APPEND_HISTORY and INC_APPEND_HISTORY).

This is super useful when combined with a large history size because you can open a new shell weeks after issuing a command and find it in your history (without these options a large history is useless since it will only contain the history of the most recently closed shell). It also means you can open new shells and have them immediately know your most recent commands in other shells. Is there any way to setup eshell with this behavior? The first bullet seems easy enough but appending looks trickier...


texts:
I'm trying to get numpy and matplotlib to run from emacs so I downloaded anaconda. I've got it running on my terminal but I don't know how to run it in an m-x shell. I'm using mac os.

I've considered putting a command for it in .emacs.d/init_bash.sh but I don't know what that command would be or how that would work. How should I go about getting anaconda to work in an m-x shell?


texts:
I'm having a little trouble with magit and the default-directory variable.

When calling M-x magit-status, an exception is thrown - Setting current directory: No such file or directory, /path/to/git/repo/^M/. I.e. there is an extra carriage return character inserted on the end of the path as though it were another directory level.

For the avoidance of doubt, this is not about carriage returns in a repository file, but rather the path to the repository. Emacs is running on windows, with git for windows.

Error trace below:

Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "c:/emacs/home/temp/\015/")
  call-process("c:/Program Files/Git/git-cmd.exe" nil (t nil) nil "--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z")
  apply(call-process "c:/Program Files/Git/git-cmd.exe" nil (t nil) nil ("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z"))
  process-file("c:/Program Files/Git/git-cmd.exe" nil (t nil) nil "--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z")
  apply(process-file "c:/Program Files/Git/git-cmd.exe" nil (t nil) nil ("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z"))
  magit-process-file("c:/Program Files/Git/git-cmd.exe" nil (t nil) nil "--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z")
  apply(magit-process-file "c:/Program Files/Git/git-cmd.exe" nil (t nil) nil ("--no-pager" "--literal-pathspecs" "-c" "core.preloadindex=true" "-c" "log.showSignature=false" "-c" "i18n.logOutputEncoding=UTF-8" "config" "--list" "-z"))
  magit-git-insert("config" "--list" "-z")
  apply(magit-git-insert ("config" "--list" "-z"))
  magit-git-items("config" "--list" "-z")
  magit-config-get-from-cached-list("magit.extension")
  magit-get-all("magit.extension")
  magit-load-config-extensions()
  run-hooks(change-major-mode-after-body-hook special-mode-hook magit-mode-hook magit-status-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook special-mode-hook magit-mode-hook magit-status-mode-hook))
  run-mode-hooks(magit-status-mode-hook)
  magit-status-mode()
  magit-setup-buffer-internal(magit-status-mode nil ((magit-buffer-diff-args ("--no-ext-diff")) (magit-buffer-diff-files nil) (magit-buffer-log-args ("-n256" "--decorate")) (magit-buffer-log-files nil)))
  magit-status-setup-buffer("c:/emacs/home/temp/")
  magit-status(nil ((4 . 4) (("c:/emacs/home/temp/\015/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" "rev-parse" "--show-toplevel") . "\015")))
  funcall-interactively(magit-status nil ((4 . 4) (("c:/emacs/home/temp/\015/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" . magit-toplevel) . "c:/emacs/home/temp/\015/") (("c:/emacs/home/temp/" "rev-parse" "--show-toplevel") . "\015")))
  call-interactively(magit-status record nil)
  command-execute(magit-status record)
  helm-M-x(nil #("magit-status" 0 12 (match-part "magit-status")))
  funcall-interactively(helm-M-x nil #("magit-status" 0 12 (match-part "magit-status")))
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)