texts: How to split the output of a `printenv` shell command?

texts:
Basically, I want to split a multiline string at the regular expression that, in Perl, would be specified with \n(?=[^\W\d]\w*=).

Note that the Perl regexp features a "zero-width lookahead match" ((?=...)), meaning that the substrings that match this part of the regexp will not be "consumed"; they will appear in their corresponding entries in the resulting list.

For example, the string whose printed representation is

A=1
B_C_D=
foo
bar
baz
  =whatever=
X_Y_Z=quux

would be split into the following three-element list:

("A=1" "B_C_D=\nfoo\nbar\nbaz\n  =whatever=" "X_Y_Z=quux\n")

Even though Elisp regexps do not support lookahead/lookbehind expressions, this sort of splitting problem (in which part or all of each matching substring is not consumed) is common enough that I hope there are some other standard ways to solve it in Elisp.

Moreover, the ultimate goal here is to split the output of the shell command

/usr/bin/zsh -ilc 'printenv' 2>/dev/null

so that each element of the result would correspond to one "setting" of an environment variable1.  So I also figure that Elisp may possibly have functions that facilitate the handling of this special case2.

1 The desired result is conceptually similar to value of the variable process-environment, but in general it is not be identical to it.  Also, the side-effects associated with setting and updating process-environment do not enter into my problem.

2 Unfortunately, it appears that process-environment is initialized in C-code, so whatever functions do that are not available in Elisp.


texts: How to debug lack of response to a certain set of keystrokes?

texts:
Suppose I do a certain keystroke sequence in emacs, and nothing happens, even though I expect there to be a keybinding that would do something. This could be because:

The keybinding is not actually present.
The keybinding is invoking the command, but for some reason the command isn't having the expected effect.

How can I tell which of these it is? (The specific example is that I'm doing meta-q, which is supposed to be bound to the command fill-paragraph, but nothing seems to happen.)


texts: Does emacs have a process viewer (resource manager) or equivalent?

texts:
Occasionally emacs will hit 100% cpu usage. Obviously when this occurs there is an issue with a runaway process.

Just wondering if there is a way to view all running processes in emacs?

Kind of like unix htop, the interactive system process monitor & viewer... htop


texts:
I am sending text to a REPL as if I had typed it in, like so:

(insert "source activate py3; hy")

How do I do the programmatic equivalent of pressing enter after inserting this string?


texts:
In org-mode, if I set the :file header-arg at some point, like all header args, it is inherited at lower levels. I want to avoid duplicating the header-arg all over. In the case of :session, the special value none is used to not associate the code block with any existing session, it s always a new session. I want the special value for :file, which represents do not write this to a file, but insert it directly as usual.

* set at top header level
  :PROPERTIES:
  :header-args: :R :file "abcd.pdf" :exports both :results output graphics
  :END:

#+BEGIN_SRC R
x = seq( from = -2, to = 2, by = 0.1)
plot (x,x^2,col="red", type="l")
#+END_SRC

** lower level header
# output still goes to abcd.pdf, but I don't want it to, I want it inserted
#+BEGIN_SRC R
2 + 2
#+END_SRC


texts: Coloured active mode line only when many windows

texts:
I am reluctantly using a coloured active mode line to
distinguish it from inactive mode lines, but it occurred to me
that it might be possible to reserve its colouring for times
when there are more than one window in the frame (when there
could be some doubt as to which is the active window).  Any tips
on how to do this would be appreciated.


texts:
I use an asterisk in my function names, so that to execute one
of my own functions, I would begin by typing M-x *.  Now I
would like to save myself a keystroke and achieve the same by
M-X.  How do I do that?

I tried defining a keyboard macro with F3 M-x * F4, but that,
for some reason, didn't work.


texts:
I've been using gdb in emacs for a bit now and I mostly love it, but there are some minor quirks about its behavior that I find bothersome and I wanted to know how to go about tweaking them. I also want to say I know almost nothing about modifying emacs in general.
I've been using gdb-many-windows when I debug. The thing I want to change is the behavior around breakpoints. After a breakpoint is hit, the source window moves to the line I placed the breakpoint on. This is good, I like that. But after that, if I move to a different part of the source file myself and then run any gdb command, the source window will automatically move back to the line containing the breakpoint. So if I want to, say, set a breakpoint at a different line of the source file, the moment I do so the source window snaps back to the first breakpoint. This has me constantly moving up and down the source file.
Is there any way I can change this? I've tried googling and I can't seem to find anything about this.


texts: changing todo state of multiple headings at once

texts:
I've got a list of todo's, and I'd like to change all of the todo's in that list with a single command, instead of moving point to each item and changing the status manually. For example.

* TODO Item 1
** TODO Item 1.1
** TODO Item 1.2
* TODO Item 2

Is there a way to select the whole region and set the todo-state for the whole region? Or any other method?


texts: Org-mode emphasis markers: surround symbol

texts:
Suppose I have this text, where | is point.

This is the te|xt.

Now I want to put the word text in bold, so I use Org keybindings and do C-c C-x C-f and pick *. This is what happens:

This is the te *|* xt.

Would it be possible to have the markers surround the symbol where point is? Like this:

This is the *text*|.

I know org-emphasize works on the active region, but it would be quicker if it was done automatically on the symbol where point is.


texts: How to manually define trusted paths for directory local variables '.dir-locals.el'?

texts:
I would like to define a list of trusted paths.

Where dir-locals.el can be loaded without asking me.
Without having to be concerned with safe-local-variable-valuesWhich isn't very practical if the value contains code which might be edited/modified.

Instead, I would like to have a list of paths, similar to .gitignore, which are "trusted" and won't prompt me to trust expressions.


texts: Expand an org-table with clipped fields?

texts:
I learned that I can edit the whole clipped field in a new window with org-table-edit-field, but it's kind of annoying to open a new window each time I want to edit each field. How can I edit those clipped fields by expanding them temporarily instead?

e.g. expand this:

|<3>|<3>|
|a=>|c=>|

to get this:

|<3>|<3>|
|abra|cadabra|


texts: org-capture template error: Template is not a valid Org entry or tree

texts:
I am running org version: 9.1.9 and have issues setting up a template for org-capture. I have read over the documentation but cannot figure out why my template throws this error when I call it: org-capture: Capture template ‘pt’: Template is not a valid Org entry or tree

current setup for org mode

(custom-set-variables
 '(org-agenda-files (quote ("life.org" "work.org")))
 '(org-capture-templates
   (quote
    (("p" "Private templates")
     ("pt" "TODO entry" entry
      (file+headline "life.org" "Capture")
      "templates/tmpl-todo.org" :empty-lines-before 1))))
 '(org-directory "~/Sync/org/")
 '(org-refile-allow-creating-parent-nodes (quote confirm))
 '(org-refile-targets (quote ((org-agenda-files :level . 1))))
 '(org-refile-use-outline-path (quote file))
 '(safe-local-variable-values
   (quote
    ((eval add-hook
       (quote after-save-hook)
       (lambda nil
         (org-babel-tangle))
       nil t)))))

file in templates/: tmpl-todo.org

* TODO %^{Description}
  %?
  :LOGBOOK:
  - Added: %U
  :END:

thanks.


texts: How can helm be configured to return a nil result when the user cancels?

texts:
This function selects one of the items in projectile's project list, but when I cancel the select using Ctrl-G an item is still returned. Whatever candidate the selection is on is returned even if the dialog is cancelled.
Is there some setting to override this behaviour?
  (defun vh-select-project()
    (interactive)
    (let ( (projectlist
                 (with-temp-buffer
                   (save-excursion
                     ;;(insert "(progn\n")
                     (insert-file-contents-literally (expand-file-name "projectile-bookmarks.eld" user-emacs-directory))
                     (goto-char (point-max))
                     ;;(insert "\n)")
                     (read (buffer-string)))))

           (input (progn
                    (helm :sources
                          (list (helm-build-sync-source "Select project:"
                                  :candidates projectlist)))
                    (helm-marked-candidates)
                    )))
      (when project
        (insert (car project) ""))
      )
    )


texts: tramp-mode popping up while editing c/c++ files

texts:
recently, some strange behaviour popped up when editing c/c++ files in emacs: Whenever I want to write a comment, the first / I enter will open a buffer of type *tramp/spc C* with error message

  ssh: could not resolve hostname c: Name or service not known

My research has brought me as far as finding out that this is related to tramp-mode, something I never used or even knew that it exists. So, my question is: How can I get rid of this behaviour?

Using emacs24, installed from the Ubuntu 16.04 repos, if that matters.

Thanks for any advice.

EDIT 16/12/16

this most have something to do with my .emacs as the buffer is not popping up when starting with emacs -q.

Active modes in my editing buffer are

Abbrev Auto-Complete Auto-Composition Auto-Compression Auto-Encryption Blink-Cursor Electric-Indent File-Name-Shadow Font-Lock Global-Auto-Complete Global-Font-Lock Line-Number Menu-Bar Mouse-Wheel Tool-Bar Tooltip Transient-Mark


texts: trying to make a self-modifying function

texts:
I'm trying to make a function that returns a list of perfect numbers:

  A perfect number is a positive integer that is equal to the sum of its proper positive divisors

For instance, 28 is perfect because its factors are 1, 2, 4, 7, 14 and 1 + 2 + 4 + 7 + 14 = 28.

My initial code was:

(defun factors (n)
  "Return a list of the factors of N, except N itself."
  (let ((factors (list 1))
        (i 2))
    (while (<= i (/ n 2))
      (if (zerop (% n i))
          (setq factors (cons i factors)))
      (setq i (1+ i)))
    factors))

(defun is-perfect (n)
  "Return `t` is N is a perfect number, `nil` otherwise."
  (and (/= 1 n)
       (let* ((factors (factors n))
              (factors-sum (seq-reduce '+ factors 0)))
         (= n factors-sum))))

(defun perfect-numbers (n)
  "Return the perfect numbers smaller than or equal to N."
    (seq-filter 'is-perfect (number-sequence 2 n)))

It works, but gets noticeably slow for 10000. Remembering that I recently had trouble with a self modifying function I thought I'd try to exploit this to optimize perfect-numbers. The idea is to keep the list of the perfect numbers we already computed. I tried this:

(defun perfect-numbers (n)
  "Return the perfect numbers smaller than or equal to N."
  (let* ((perfect-numbers '(6)) ; my hope was that this list would get updated each time I call the function
         (highest (car (last perfect-numbers)))
         (new-perfect-numbers (seq-filter 'is-perfect (number-sequence (1+ highest) n))))
    (setq perfect-numbers (append perfect-numbers new-perfect-numbers))
    (seq-filter (apply-partially '>= n) perfect-numbers)))

However in this case, perfect-numbers does not seems to be updated, and I don't understand why:

ELISP> (perfect-numbers 1000)
(6 28 496)
ELISP> (symbol-function 'perfect-numbers)
(lambda
  (n)
  "Return the perfect numbers smaller than or equal to N."
  (let*
      ((perfect-numbers
        '(6)) ; the list did not get updated :(
       (highest
        (car
         (last perfect-numbers)))
       (new-perfect-numbers
        (seq-filter 'is-perfect
                    (number-sequence
                     (1+ highest)
                     n))))
    (setq perfect-numbers
          (append perfect-numbers new-perfect-numbers))
    (seq-filter
     (apply-partially '>= n)
     perfect-numbers)))


texts: Automatically run org-lint through flycheck

texts:
I've got a heap of org-mode files which I publish into HTML for a knowledge base, sometimes the publishing crashes out due to a broken link or something and it's hard to find the problem.

I've been recently using org-lint to find the problems. Is there a way to run this automatically through flycheck?


texts: Quick navigation (with autocompletion) to an org heading

texts:
I have a contacts.org file whose structure looks like this :

* Contacts
** John DOE
** Alicia PING
** Bob DELTA

I'd like to be able to :

quickly set up a link to, for instance, Alicia PING, from a different org file;
quickly navigate to Bob DELTA from anywhere in Emacs.
in both cases, be able to do this with autocompletion (because I might not remember John's surname...)

How could I achieve this?


texts:
I have a package that creates overlays as annotations. Part of the functionality is to delete annotations too.  It turns out neither of these seems to be undoable. I.e. if you add an overlay to text, you cannot type C-/ to undo the addition, and if you accidentally delete an overlay you can not type C-/ to get it back.

Is it possible to add things to the undo list that would make this possible?


texts: make org-blank-before-new-entry distinguish between a TODO list and a text outline?

texts:
Like many of us, I use org-mode for two different things:

As a TODO list manager
As a text outliner

I'd like my blank lines to work differently based on context.

TODO list: no blank lines
text outline: automatically insert 1 blank line when non-heading text precedes a heading

In other words, when I'm doing a TODO list when I have many headings in a row, I don't want stray line breaks between them.

TODO list mode, no line breaks:

* Organize Party [33%]
 ** TODO Call people [1/2]
 *** TODO Peter
 *** DONE Sarah
 ** TODO Buy food
 ** DONE Talk to neighbor

However, when I'm writing text, I want line breaks for the sake of visual whitespace / ease of reading.

outline mode, blank line before heading:

* Heading
This is a document that has a heading, and a body. The body will consist of two paragraphs with sub-headings.

* Body
This is an introduction to the body. The body has two sub-headings, each of which have their own paragraph.

** The First Paragraph
This is the first of two paragraphs.

** The Second Paragraph
This is the second of two paragraphs.

I've already set org-blank-before-new-entry to auto:

 ((heading . auto)
 (plain-list-item . auto))

But I think org-blank-before-new-entry works by detecting other blank lines in the area. I want it to detect whether the preceding line of text is a heading or a non-heading.

How can I modify org-blank-before-new-entry so that when I'm in a TODO list consisting only of headings, org-meta-return doesn't add a line break? but after a block of text, it does?


texts: Find the name of the graphical display emacs is running on

texts:
I run emacs using a server and multiple clients on both, the graphical display and the terminal.
To use the same configuration files for terminal and graphical display, I used this solution.
The issue is, on starting a new emacs client, the fullscreen function gets called on all the already running clients too, and causes a very unwanted behaviour which sometimes throws up errors too.

The display-graphic-p function doc says,

  (display-graphic-p &optional DISPLAY)

  Return non-nil if DISPLAY is a graphic display. Graphical displays are
  those which are capable of displaying several frames and several
  different fonts at once.  This is true for displays that use a window
  system such as X, and false for text-only terminals. DISPLAY can be a
  display name, a frame, or nil (meaning the selected frame's display).

I think my issue can be resolved by specifically calling the fullscreen function on the selected frame's display. So, my question is, how to obtain the name of the current display?


texts: elpy-goto-definition jump to the center of the terminal window

texts:
I was using dumb-jump to go to the location where the identifier at point is defined. When it jumps to the function, jumped function shows up on the middle of the terminal window.

=> Instead when I use elpy-goto-definition it jumps to the function and shows it on the 1st line on the top of the terminal window.

[Q] Is it possible to make elpy-goto-definition to show the jumped function on the center of the terminal like dumb-jump?


texts:
I want to be able to output nicely formated math code. So I decided to learn latex and maxima (and use all that in org-mode).

That's when I came across this tutorial http://maxima.sourceforge.net/contrib/maxiplot/maxiplot_en.pdf.

And there, I foudn this program in section 3.2.1:

\usepackage{amsmath}
\usepackage[amsmath]{maxiplot}
\[   %Math mode begin
\begin{maxima}
f: x/(x^3-3*x+2),     /* Integrating it */
tex('integrate(f,x)), /* will show its integral... */
print("="),
tex(integrate(f,x)),  /* ...and the result */
print("+K")
\end{maxima}
\]   %Math mode end

I tried to execte it, in an org-buffer, by pressing C-c C-x \. But I see no results. The polynomial f: x/(x^3-3*x+2) gets pretty-printed and that's all. But there's not output like anything in the pdf file; a nice integral and so on.

I tried C-c C-x C-l too and the image in blank.

Can anyone tell me, how do I show the output of this latex/maxima program in the org-buffer?


texts:
I tried (global-set-key (kbd "C-s-[") 'xxx) but when I use it I get:

<C-s-268632091> is undefined


texts: How to press RET to insert a newline while remaining in "normal" evil mode?

texts: I want to insert a newline by pressing the return key, but keep the normal status in evil mode. In Vim, I can do this by nmap <CR> o<Esc>. What is its equivalent in evil-mode?


texts:
I have an org table and I will like to convert in into a tree.

So, from:

| 1 | 2 | 3 |
|---+---+---|
| a | b | c |
| l | m | n |

I will like to go to:

* a
  :PROPERTIES:
  :2:        b
  :3:        c
  :END:
* l
  :PROPERTIES:
  :2:        m
  :3:        n
  :END:

I tried this. But it did not work.

Also, I am running spacemacs.


texts: org-mode inline html while exporting using ox-pandoc

texts: I am not able to use inline html through macro in org-mode when exporting through ox-pandoc. For example if I use @@html:@@Small Text@@html:@@ and export the document to HTML5 through ox-pandoc, it just removes the html and gives out normal text. How can I fix this?


texts: \\{ in a doc string: what does it mean/do?

texts:
What does this backslash syntax mean?

(defun elfeed-search-mode ()
  "Major mode for listing elfeed feed entries.
\\{elfeed-search-mode-map}"
  (interactive)


texts: How to open the same file as two separate buffers so that modifying one does not modify the other?

texts:
I am debugging an ocaml program with M-x camldebug while adding comments to the source code and the debugger shows incorrect positions in my tuareg/merlin window. It shows the positions as present in the original source file that do not match the edited file.

As a workaround, I would like to have my file opened in one buffer (the one I'm using with the debugger), and have another buffer with the same file opened that is not synchonized with the first one, i.e., as if it was open in a separate process and without changes in one buffer appearing in the other. Then, I'd just save my files after I'm done debugging.

I tried C-x 4 c, but that still makes changes in one buffer appear in the other. I have an obvious workaround of copying the file to scratch to edit it and then back again, but I am searching for a cleaner way.


texts: Is this something that can / should be done? For example, often I use emacs in my user account and sometimes root account. When using the package manager (i.e marmalade or something) do I have to install the same packages seperately for each account? It seems to me that they get installed in your home directory.


texts: Is it possible to use avy to jump to known positions in a buffer?

texts: I want to use avy to jump to fields in a bibtex entry. I have only found a way to use a regex to specify jump places in avy so far. I don't want to just build a regex to match the fields in an entry, because it would also match fields in another entry, and I want to limit the jump candidates to the entry. Is this doable?


texts: How to prevent slow-down when an inferior processes generates long lines?

texts:
I use Emacs with Geiser to hack on some Scheme code.  As I'm playing around in the REPL I sometimes evaluate expressions that result in a lot of output, often all on one line.

For example, I just played with SRFI-41 (streams) and created a character stream from a big file; then I forced the stream and Geiser barfed the whole contents of the file as a character stream into my buffer.  Almost immediately, Emacs ground to a halt as more and more characters where appended to the output line, and no matter how long I kept pressing C-g or C-c C-c I could not make Emacs (or Geiser) stop.

This broke my whole Emacs session as Emacs now completely ignores my input, thinking that it needs to give priority to printing this massive character stream all on one line into an unresponsive Geiser REPL buffer.

Is there something I can do to protect my Emacs session from my destructive curiosity?  (Why does Emacs get so slow when displaying very long lines anyway?)  Can I set a limit for long lines and tell Emacs that it's okay to simply not attempt to display very long lines?


texts: Read first line of file when opening to rename buffer

texts:
I want to add a hook that reads the first line of the file/buffer when it opens.
I want to do this so that I can rename the buffer that opens notes from simplenote.

But, how do I read the first line?

I guess I was kind of vague in my question. But exactly what I wanted to do was to read the first line when opening notes via simplenote.el since the buffer gets named to a hash of 76 char that does not tell anything about the contents.

This kind of failed since opening a simplenote file it defaults to text mode so no hook possible there. But it could be useful for org-mode notes in simplenote.

Using something like this:

  (defun read-first-line ()
    (save-excursion
    (goto-char (point-min))
    (setq b (point))
    (setq e (- (search-forward "-*-" (line-end-position)) 4))
    (buffer-substring-no-properties b e)))

;(add-hook 'org-mode-hook
      ;(lambda () (rename-buffer (read-first-line))))

(add-hook 'org-mode-hook
     (lambda () ((let (str (read-first-line))
              (if (not (string= "" str))
                  (rename-buffer str))))))

I cannot get the conditional lambda to work.
And what is the difference with let and setq inside a function?

Edit:
Fixed the org-mode-hook:

(add-hook 'org-mode-hook
      (lambda ()
        (let ((str (read-first-line)))
          (if (not (string= "" str))
          (rename-buffer str)))))


texts: Minimize emacs on Windows with Meta-Space, n?

texts:
I'd like to minimize emacs on Windows, when I press the Alt-Space, then n keys, just like with other Windows programs (because Alt-Space opens the program's menu that includes the 'Mi_n_imize' option, and 'n' then tells Windows to minimize that program/window)

I've rebound my left alt to be my Meta key.

So I want to set things up so that Meta-Space n will invoke (suspend-frame)

I tried this:

(global-set-key (kbd "M-SPC n") 'suspend-frame)

But I got the error message Key sequence M-SPC n starts with non-prefix key M-SPC

Is there a clear explanation of what 'prefix' vs. 'non-prefix' keys are?

Is there a way to work around this, and to use Meta-Space in a key sequence?

UPDATE: I've found the GNU Emacs manual entry for prefix keys as well as this Wiki page on adding prefix keys but the following doesn't work:

(define-prefix-command 'keymap-meta-space)
(global-set-key (kbd "M-SPC") 'keymap-meta-space )
(define-key keymap-meta-space (kbd "M-n") 'suspend-frame)

After evaluating all three sexp's I press M-SPC, then I press n, and then emacs waits for me to press something else (by displaying M-SPC n- in the minibuffer).


texts: What does C-u mean in sequence "C-u M-x"

texts:
I learnt that C-u default is to repeat 4 times.

For example:
C-u t is input tttt

However, when I type  C-u M-x, it prompts a function list

What does invoking C-u mean here?


texts:
For some reason, I am not getting spacemacs. But I need the feature that when I do M-x, it displays the column of menu of commands, which I can select from using direction keys (Up and Down) and confirm by pressing Enter.

Can anyone tell me how to write the init.el to achieve this?
Thanks!


texts: Linked, Split screen scrolling for a single buffer?

texts:
I would like to be able to have

a C-x 3 split to have two windows in a frame
both windows view a single buffer
window on left ends at line n
window on right starts at line n +/- configurable offset
vertical scrolling action scrolls BOTH windows

Does something like this already exist?


texts: Org-mode custom intranet links like `intra/desc`

texts:
How can I linkify the following intranet links in org-mode?

intra/link1-description
code/description

By linkify, I mean the links should be fontified and clickable in org-mode.

I don't want to add a custom link handler like intra: because I often copy and paste links from the intranet.


texts: Echo contents of a heading of one .org file in another

texts:
Is there a way to have contents of a heading of an .org file echoed in another .org file, so that the text in the second file would be updated automatically when the first file changes?

For example, suppose that we have .org files dedicated to branches of a company, as follows.

The contents of new-york-branch.org:

* Location       :location:
  New York
* Director       :director:
  John Smith

The contents of washington-branch.org:

* Location       :location:
  Washington
* Director       :director:
  Ann Grey

Then we would somehow be able to compose a file index.org like this:

* Branches
** New York
   Director: John Smith
** Washington
   Director: Ann Grey

In the file index.org above, John Smith and Ann Grey are echos of the contents of new-york-branch.org:director and washington-branch.org:director, respectively. There will probably be some hidden text as well to specify these data sources. In any case, if Ann Grey is replaced by Susan May in washington-branch.org, the change will get reflected in index.org automatically. Please note that I am not looking for #+INCLUDE, since I would like the change to be reflected in org-mode, without the need to export.

Can this be done?


texts:
Supposing I have my cursor resting somewhere in a bunch of text within quotes, is there a key binding that will mark or highlight just the text within the quotes so I can delete it?

This would be ideal for web-mode. Perhaps, if there's not already an emacs way of doing this, then maybe there's a way of doing in web-mode.


texts:
I have the following keymap defined to navigate my Emacs windows:

(defvar my-keys-minor-mode-map (make-keymap) "my-keys-minor-mode keymap.")
(define-key my-keys-minor-mode-map (kbd "C-M-j") 'windmove-left)
(define-key my-keys-minor-mode-map (kbd "C-M-l") 'windmove-right)
(define-key my-keys-minor-mode-map (kbd "C-M-i") 'windmove-up)
(define-key my-keys-minor-mode-map (kbd "C-M-k") 'windmove-down)
(define-key my-keys-minor-mode-map (kbd "C-M-u") 'toggle-maximize-buffer)

(define-minor-mode my-keys-minor-mode
  "A minor mode so that my key settings override annoying major modes."
  t " my-keys" 'my-keys-minor-mode-map)

(my-keys-minor-mode 1)

This works great, except when I am viewing a PDF (DocView). In that case, Whenever I press any of the shortcuts I get errors like:

Wrong type argument: wholenump, -56

What could be going on?

In case it helps I am using GNU Emacs on OS X. I installed with the following command, as suggested in this other answer:

brew install emacs --HEAD --use-git-head --cocoa --with-gnutls --with-rsvg --with-imagemagick

My version specifically is:

GNU Emacs 24.4.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F34))
 of 2014-09-27 on josh.host.net

Could this be a bug? Or perhaps am I not defining this keymap correctly?


texts: Indentation broken with all \input{files.tex}

texts:
Everything is in the title :

a  master.tex file contains several \input{subfileXX.tex} ;
the indentation works in the master file but not in the subfiles. The TAB key acts like in LibreOffice.


texts: org-mode batch export: Missing syntax highlighting

texts:
I'm having issues achieving any syntax highlighting in the results of the following command:

emacs nix.org --batch -f org-html-export-to-html --kill

I know this question has been asked a few times already in various forms, but none of the advertised solutions I've found have worked for me (linked below).

My Environment

spacemacs (via emacs 25.3) on the develop branch, current as of 2018 January 29
htmlize-20171017.141 as a dependency of the org layer
Attempting to highlight source blocks of haskell, lisp, yaml, and nix modes

What I'm Seeing

Naively performing the command above gives many lines of:

Cannot fontify src block (htmlize.el >= 1.34 required)

I tried copy-pasting the htmlize.el found in my .emacs.d/elpa/.. and refering to it manually:

emacs nix.org --batch -l htmlize.el -f org-html-export-to-html --kill

...and this makes the "Cannot find..." errors go away, but the output is still not highlighted properly. Actually, the lisp block does have one of its keywords bolded, but nothing else looks right. Similar hacks to manually include lisp code from say haskell-mode can achieve bold/italics-only highlighting, which is not what I want.

--batch implies -q, which ignores all user config (to speed up start-up, I'm assuming). This seems to have the effect of ignoring all the Emacs packages I have installed (via spacemacs), and so the batch process can't see htmlize or any of my major modes to achieve proper colouring.

Questions

Is there a way for me to tell a batch'd emacs process to respect my config and see all the packages I have? (this might tank each run of it though)
Is there something else simple that I'm missing to achieve this highlighting properly?

My goal is to only commit my .org files for a blog, and have my server generate each .html properly on-the-fly during a deploy. I could just generate the nice .html files on my own machine and commit those, but I really don't want to do that.

Thanks!

Related

https://stackoverflow.com/questions/10642888/syntax-highlighting-within-begin-src-block-in-emacs-orgmode-not-working
https://stackoverflow.com/questions/24082430/org-mode-no-syntax-highlighting-in-exported-html-page
https://stackoverflow.com/questions/31106417/no-syntax-highlighting-with-org-html-export-to-html-when-executing-with-systemd


texts:
When creating projects with elm init, elm creates a project structure where there is a elm.json in the root of the project directory and a src folder, where your .elm files should go

Elm-mode for emacs doesn't seem to support this. When visiting a file in the src directory and typing C-c C-c to compile the file, I get the following error:

-*- mode: elm-compilation; default-directory: "~/Projects/select-elm/src/" -*-
Elm-Compile started at Mon May 13 04:29:55

/home/chris/.nvm/versions/node/v8.9.3/bin/elm make Main.elm --output\=elm.js
-- FILE NOT FOUND --------------------------------------------------------------

You want me to compile this file:

    Main.elm

I cannot find it though! Is there a typo?

Elm-Compile exited abnormally with code 1 at Mon May 13 04:29:56

This is the same error you get when calling elm make Main.elm from the command line in the src folder instead of in the root folder of the project.

If this same file is saved to the root folder of the project, C-c C-c compiles the file without errors. It seems elm-mode expects source files to be directly in the root directory of a project, while the elm language convention is to save the source files in the src folder.

I'm using elm 0.19.0. Is there a graceful way to make elm-mode "project aware", or something similar?

Unfortunately I don't have the option of simply saving my files to the root folder of the project because this is not a project that I own.


texts: I'm using Flycheck with GCC as my checker for C. However, Flycheck gives warnings on OpenMP pragmas, regardless of whether they're correct or not! Is there any setting I can change to turn off these warnings?


texts: Make `hippie-expand` check external file

texts: I have a list of technical terms in a file called jargon.tex which I want to use with hippie-expand in a new project. I do not want to manually load this file every time in a separate buffer when working on a project for hippie-expand to find it. Is there a way to write a function to be added in the hippie-expand-try-functions-list to always check this file without manually loading it in a separate buffer?


texts: How can I prevent large characters from breaking alignment?

texts:
How can I ask Emacs to scale or truncate wide characters (resp. pad narrow characters), so that falling back to a variable-width font does not cause alignment to be broken? I'm thinking of cases like the following:

abcdefg
a ⟿ g
abcdefg

abcdefg
a  g
abcdefg

abcdefg
a ∃∀∃ g
abcdefg

I'd just like Emacs to place all characters on a grid. If a character is wider than one cell, then I'd like it to take two cells. If wider than two, then three. Ideally, it would also be nice to force certain characters to fit in one cell, maybe by scaling the font.

As an alternative, it would be pretty close if all characters were just consider to occupy on space, and spilled beyond their boundaries. I can do this by manually editing the font, of course, but it would be nice if Emacs did it itself (plus if all characters are considered to occupy one space column counts are always accurate.)


texts:
I wrote a bad bit of elisp when trying to do a query-replace-regexp.

The text to replace was like this:

* list item

And I wanted it to be

* List item

My query-replace-regexp match was written as:

^\* \([a-z]\{1\}\)

And the match, where I used the wrong elisp, was:

* \,(upcase-word \1)  ;; should have been * \,(capitalize \1)

I get this error: Wrong type argument: number-or-marker-p, replace-eval-replacement

If I try to run query-replace-regexp again, I get the same error and cannot edit the replacement text. All I can do is exit Emacs and restart it. I assume there must be some way to clear the history, but I can't find it.

Suggested on twitter was (setq regexp-history nil) but no luck.

This is Emacs 25.0.50.


texts: Should "custom" variables defined without defcustom be set via custom-set-variables or setq?

texts:
Should I use custom-set-variables (as opposed to setq) when setting a variable that returns non-nil for custom-variable-p but was not defined by defcustom?

For example, echo-keystrokes is defined in keyboard.c via defvar_lisp, but the following returns non-nil:

(custom-variable-p 'echo-keystrokes)

The documentation for custom-variable-p states:

  A customizable variable is either (i) a variable whose property list contains a non-nil ‘standard-value’ or ‘custom-autoload’ property, or (ii) an alias for another customizable variable.

This leaves me wondering if the conventional advice to prefer custom-set-variables over setq when dealing with custom variables (since they may have special setters and/or initialization code) applies to such variables, or whether it's exclusive to variables defined via defcustom.

If I should only bother with custom-set-variables when dealing with those defined by defcustom, how can I quickly make that determination? I was hoping to use custom-variable-p to programmatically check which variables I should set with custom-set-variables instead of setq, as I'd rather not have to dig through library source code for every variable I set.


texts: Emacs blocked by interactive query in inaccessible frame

texts:
Recently I found my emacs, which I run as a daemon, in a blocked state.
It would not react to any command. Not C-g, not cursor movements, nothing that I could think of. Then I realized, that I had opened another frame via mosh from my laptop, yesterday evening, and in that frame I had opened org-agenda.
After waking up the laptop, I saw that emacs was asking me whether I had really intended to leave a task in clocked-in state for such a long time. It was waiting for a keypress in the minibuffer.
Now, is it possible to move that question to the currently active frame, or to interrupt it within emacs?


texts:
How should we check if point is within a footnote?

(looking-at org-footnote-re) returns t only when point is before a footnote, but not when it is anywhere else within the footnote.


texts: helm-mode-dired folder name completion selection without buffer opening

texts: I use dired with helm a lot. Let's say I want to go to /foo/bar/baz folder. I press C-x d to start minibuffer prompt for directory. I type /f and I get 5 suggestions. When I C-n to the one that I need I don't know which key to press to use that suggestion and keep typing the rest of the path. Pressing Tab gives sole action, which is the same as just pressing Enter. It is time consuming and annoying to have to type the whole path.


texts: outline-mode exclude specific lines in folding

texts:
I'm trying to use outline-minor-mode in a custom major-mode for editing abaqus/calculix inp files.
Here, keyword lines start with "*" and I'd like to fold the content that comes below it, and comment lines start with "**".
The behavior I'd like is to ensure that outline-folding works only on the non-commented lines and all the comment lines are visible at all times and may not be folded.
Here's a gif demonstration of what I'd like and what I currently have setup:


texts: How to change #+begin_comment .... #+end_comment background and text color?

texts:
When I have this code:
#+begin_comment
So this is my comment's body text.
I want it to have these features:

1. text color will be yellow
2. background color will be blue
3. text will be cursive
#+end_comment

How to do that?
What code should I put in my .spacemacs config file?


texts: I would like to define the keybinding C-c s which should start a new shell in the current directory (so C-c s should behave like C-u M-x shell). I know how to define a keybinding based on a function (e.g. (global-set-key (kbd "C-c s") 'shell)), but this problem here is more of the sort "defining a keybinding by another keybinding" (if I try C-h k and then type C-u M-x shell, I get the help for C-u alone (right after typing it)).


texts: How Do I Adjust Indentation Style For Multi-Line Lists?

texts:
The default indentation style in emacs for a multi-line list is as follows:

longFunctionName(arg1, arg2, arg3,
                 arg4)

where the final argument snaps to the starting position of the first argument.

How do I adjust this default indentation style (ie. what do I put in my .emacs) to make the second line snap to some increment of tabbing? I want the final result to look like:

longFunctionName(arg1, arg2, arg3,
    arg4)


texts: How can I tell emacs to open COMMIT_EDITMSG in diff-mode by default? Specifically when issuing git commit -v, but the solution can be for all commit options.


texts:
I'm in Dired, and one of the files in the current directory is a named pipe (FIFO)

prw-r--r--+   1 ivan staff          0 Feb  6 11:13 some_pipe

If I (accidentally) visit it (with dired-visit-file), Emacs appears to freeze. This is not all that surprising, but I'm not sure what it's doing. I can break out of the frozen state by hammering on C-M-c (exit-recursive-edit) and C-g (keyboard-quit), though even that behaves inconsistently (sometimes it works after about 3 taps, sometimes it requires more, and a mix of both commands).

What I'd most like to know is what the expected behavior should be when a user tries to visit a FIFO, and maybe more importantly, how to prevent such accidental visitations.


texts: How to revert buffer after magit-checkout?

texts:
I use smart-mode-line package and I noticed when I change/checkout branches in command line, or in Magit, this is not reflected in the Smart Mode Line. I still see the name of the old branch, while I checked out the other branch.

I need to call M-x revert-buffer to see the actual branch reflected in Smart Mode Line.

These option gives me an error, while in documentation I need to supply REVISION in magit-checkout parameter, which is unknown in Emacs Lisp as variable:

  (add-function :after (magit-checkout) #'revert-buffer)

And this didn't help either:

(setq magit-auto-revert-mode t)

So I'm running out of ideas. Anyone?


texts:
I want to use the vhdl-mode in Emacs. I can use the templates when working with the meta key like:

M-x vhdl-template-process

If i want to use the corresponding key binding like:

C-c C-t P

it won't work.

I am new to Emacs, so it might be kind of a general problem working with some package.


texts: How to make a solid line seperator in linum mode?

texts:
I want to have a solid line seperating the line numbers from the text in linum mode. I have tried following this guide and have this code in my .emacs

http://www.emacswiki.org/emacs/LineNumbers#toc8

;If you want a solid line separator, try something like this:
(setq linum-format "%4d \u2502 ")

with the end result being.

If I am not mistaken that is not a solid line it is a bunch of aligned bars. I want a solid grey line with specified thickness if that is possible.


texts: Why do I have to add each package to load-path? (or Problem with require 'package in my init file)

texts:
Each time I install a package from the Package Menu, if I try to require it in my init file I get an error unless I manually add it to the load-path:

(add-to-list 'load-path "/home/nick/.emacs.d/elpa/use-package-20141220.1645")

(require 'use-package-autoloads)
(require 'use-package)

That's tedious. And usually the package path contains version-numbers. If a package was updated, I have to manually edit the load-path.

Is there any way to automate this?


texts: org-link-open: Wrong number of arguments: (2 . 2), 1

texts:
lately I am often given this error, .e.g. when trying to open pdf files within Emacs. the stack trace reads

Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 1)
  org-docview-open("random.pdf")
  org-link-open((link (:type "docview" :path "random.pdf" :format bracket :raw-link "docview:random.pdf" :application nil :search-option nil :begin 437 :end 639 :contents-begin 555 :contents-end 637 :post-blank 0 :parent (paragraph (:begin 91 :end 4807 :contents-begin 91 :contents-end 4807 :post-blank 0 :post-affiliated 91 :parent nil)))) nil)
  org-open-at-point(nil)
  funcall-interactively(org-open-at-point nil)
  #<subr call-interactively>(org-open-at-point nil nil)
  apply(#<subr call-interactively> org-open-at-point (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> org-open-at-point nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (org-open-at-point nil nil))
  call-interactively(org-open-at-point nil nil)
  command-execute(org-open-at-point)

can someone tell me what the problem is and how to fix it? Im not org 9.3.6 with Emacs 26


texts: Running python script from shell in Emacs results in delayed output

texts:
I'm trying to run a python script from a Windows shell (invoked via M-x shell or M-x powershell) inside Emacs.

However, no output is shown via print statements until I after I hit a raw_input statement AND provide input. In other words, the script shows no almost no output in the window until after I provide input, at which point all the output that should have been printed before get shown.

I say "almost" because LOGGER.info statements still get shown in my Emacs shell window, where LOGGER=logger.getLogger("loggerName")

For example if my script were...

LOGGER.info("Starting script")
print "Hello world."
raw_input("What's your name?").strip()

I would see

Starting script

And then nothing until I typed in something, at which point I would see:

Hello world.
What's your name?


texts: Are there any packages or configuration snippets for better whitespace traversal?

texts:
Whitespace traversal in Emacs is atrocious. By "traversal" I mean:

Moving the point with C-<direction>
Expanding a selection (with either a package or region mark)
Deleting with C- or M- backspace or delete

It trips over punctuation, deletes the next word when deleting whitespace ahead of point, and leaps from paragraph to space to maybe the next paragraph, if there aren't an odd number of spaces, and Mercury is not in retrograde.

I believe (without having inspected the related code) that the core issue is the way Emacs handles the traversal of the point over whitespace (since marking regions, deleting, and traversing are so related).

Has anyone taken a wrench to this and produced an improved configuration or package?

In order to keep this question actionable, I am specifically looking for a configuration that allows the user to delete usually contiguous chunks of whitespace, text, or a mix of those efficiently and accurately, without an unreasonable amount of new commands and shortcuts. You know, like those "other" text editors do.


texts: How to not show habits in global todo list in org-mode?

texts: The agenda view helpfully only shows habits for the current day, but habits that should not yet be done still show up in the global todo list. How can I prevent this from happening?


texts: How to change options passed to git vc-annotate?

texts:
I have a hard time using vc-annotate (my version control system is git), because the output is not very userfriendly, as it displays long filenames in a separate column in the buffer, which take up half of my screen. Apart from that it takes ages until vc-annotate command returns any output.

I suspect this is because of some arguments passed to git blame command. Can I somehow override the default vc-annotate command and pass my custom options to git blame (like not showing file paths, different date format etc.)

I tried magit-blame but didn't like the output style of mixing code and annotations.


texts: How to type the password of a .gpg file only when opening it

texts:
(I understand the security implications of the following, and I'm fine with them.)

I have a single encrypted file in my org directory, diary.org.gpg.
I never did any special configuration for it to work, still

Whenever I visit the file, I'm prompted for the encryption password. Which is great.
Whenever I save the buffer, I'm prompted for the password again twice. Which is my problem.

Note that I haven't configured anything for this to work, so any answers regarding agents or keyrings will have to come with configuration instructions.

I thought of keeping the password written somewhere inside the file (at the header or end-of-file comments). Then, whenever I save, Emacs could read the password in the buffer and use that instead of prompting me. But when I started looking into this, I got completely lost somewhere inside epa.el.

Q: How can I send a password directly from Emacs to the encryption system/process when saving the buffer, instead of being prompted for it?

All the rest (finding the password in the buffer) I can figure out myself. I just got lost when trying to understand how Emacs interfaced with gpg.

Note that I'm on Ubuntu, Arch Linux, and Windows. Which is why my first idea was an emacs-centric solution.
I can live with a solution that doesn't work on Windows, as long as I can still access the file on it in the manual way.


texts: Run Emacs in GUI mode without X over SSH

texts: With Emacs 26.1 installed on a Linux RedHat flavour without X, I want to run Emacs GUI over an SSH connection with X11 forwarding and Xming server on client. Since there is no X on the machine, Emacs starts in text mode. I know that "emacs -nw" forces Emacs in text mode, but how to force GUI?


texts:
I am trying to log all my todos in a archive.org file, by means of the following function:
 (defun mark-done-and-archive ()
    (interactive)
    (org-todo 'done)
    (org-archive-subtree))
  (define-key global-map "\C-c\C-x\C-s" 'mark-done-and-archive)

The part to move the todos to the archive works,  but (org-todo 'done) isn't working and in the archive the todo appears as TODO and not  as DONE. If I try to eval (org-todo 'done) in org-buffer with M-: (org-todo 'done), it works so I don't know what's happening.


texts: can emacs be taught what tables exist in a sql database

texts:
In emacs (in whatever mode you recommend for accessing a Postgres database)

is it possible to type

select * from foo_<tab>

and somehow get autocomplete/help as to what tables are available in the database
( tables that start with foo_ )

I would also like (yasnippet?) help writing long sql. eg.

select name from users where email='abc@def.com' order by name limit 200;

I guess I will have to learn yasnippet for that.


texts:
What is the emacs theme that is used on org-mode site?

http://orgmode.org/img/main.jpg


texts: Go to previous location agnostic of quits

texts:
This binding is not behaving as intended
(defun pop-mark ()                      ; may be overwriting built in definition
  (interactive "*")
  (let ((current-prefix-arg '(4)))
    (call-interactively #'set-mark-command)))

(global-set-key (kbd "C-c ,") 'pop-mark)

I expect it to cycle through my last marked spots, which it does do only if I haven't hit keyboard-quit.
Is there something that allows me to easily jump between spots of my file? I don't need anything from the ring just to jump to and from locations.
It seems I am looking for save-excursion, but am not sure how to implement it.


texts: How can I set the indentation offset for `indent-region`

texts:
I am using spacemacs + lsp layer (ccls) for c/c++ editing

Having my c-basic-offset set to 4:

if I select a region and press = (maybe invoking indent-region?), the region is indented by 2 spaces (messages: Applying [n] edits to [filename]).
If I press = without selecting a region, it indents with 4 spaces.

How can I control the indent level when indenting region?


texts: How to launch (start) emacs with a single window and choose the buffer of that window as default in the init.el file?

texts:
What statements in the init.el file can be added so that there is a single window shown as the default I have is split into 2 windows vertically aligned (equivalent to typing C-x 1)?

Then once there is only a single window showing, how to select the buffer for the window? Eg. open a shell in the buffer (M-x shell).

This question other similar question produces 3 windows vertically aligned.


texts: How to get the argument from previous use of `command-execute`?

texts:
I want to automatically rename the buffer name of compilation mode. The default name is *compilation*. Let's call my new compilation command my-compile. So supposing we run my command like this:

M-x my-compile <RET> make -j8

I want to automatically rename the compilation buffer to *compilation-make*.

I am able to rename the buffer but I am stuck in getting the argument from the command compile.

Here is the code I am currently using:

(defun my-compile ()
  (interactive)
  (require 'compile)
  (command-execute 'compile)
  (pop-to-buffer (get-buffer "*compilation*"))
  (with-current-buffer (get-buffer "*compilation*" )
    (rename-buffer (concatenate 'string "compile-" "GET_ARG_FROM_COMPILE"))))

In this code now I need to replace the string GET_ARG_FROM_COMPILE to a function that reads the argument passed to (command-execute 'compile).


texts: AUCTeX, caching document classes over an Emacs restart

texts:
The first time I create a new LaTeX document* in a new instance of Emacs AUCTeX scans my TeXLive installation to find all the available document classes .

This scanning, due to the complexity and dimensions of a typical TeXLive, takes (much less than the time I spend writing this question but nonetheless) a considerable amount of time but after that the available classes are cached and creating a second new document is instantaneous.

I wonder if it is possible to have AUCTeX cache the classes to disk, possibly with a mechanism to enforce a fresh scan of the TeXLive tree.

[*]
Strictly speaking scanning happens when I create a document environment but I create a document environment every time a create a new LaTeX document.


texts: New Flycheck syntax checker: Errors missing

texts:
I am attempting add an additional Flycheck syntax checker for nxml-mode, however errors/warnings are not showing up even though the linter, igor, is reporting errors/warnings.

Here is the syntax checker definition.

(flycheck-define-checker igor
  "FreeBSD Documentation Project sanity checker.

See URLs http://www.freebsd.org/docproj/ and
http://www.freshports.org/textproc/igor/."
  :command ("igor" "-X" source-original)
  :standard-input t
  :error-parser flycheck-parse-checkstyle
  :modes (nxml-mode))

I made the new definition available for automatic selection.

(add-to-list 'flycheck-checkers 'igor 'append)

When the major mode is nxml-mode, I can run flycheck-verify-setup to verify that igor is listed as a checker.

Syntax checkers for buffer chapter.xml in nxml-mode:

  xml-xmlstarlet
    - predicate:  t
    - executable: Found at /usr/local/bin/xml

  xml-xmllint
    - predicate:  t
    - executable: Found at /usr/local/bin/xmllint

  igor
    - predicate:  t
    - executable: Found at /usr/local/bin/igor

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled checkers.

If I run flycheck-compile and chose igor, I see errors/warnings.

-*- mode: compilation; default-directory: "~/scm/nm/freebsd-docs.svn/doc/head/en_US.ISO8859-1/books/fdp-primer/editor-config/" -*-
Compilation started at Wed Jul 13 15:12:14

igor -X /home/jrm/scm/nm/freebsd-docs.svn/doc/head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml
<file name="/home/jrm/scm/nm/freebsd-docs.svn/doc/head/en_US.ISO8859-1/books/fdp-primer/editor-config/chapter.xml">
  <error line="49" column="1" severity="warning" message="spelling" source="igor" />
  <error line="56" column="1" severity="warning" message="wrap long line" source="igor" />
  <error line="112" column="1" severity="warning" message="bad tag indent" source="igor" />
  <error line="114" column="1" severity="warning" message="bad tag indent" source="igor" />
  <error line="114" column="1" severity="warning" message="wrap long line" source="igor" />
  <error line="115" column="1" severity="warning" message="bad tag indent" source="igor" />
  <error line="115" column="1" severity="warning" message="wrap long line" source="igor" />
  <error line="119" column="1" severity="warning" message="wrap long line" source="igor" />
  <error line="120" column="1" severity="warning" message="blank line with whitespace" source="igor" />
</file>

Compilation finished at Wed Jul 13 15:12:15

I can get basic error checking using :error-patterns instead of :error-parser in the definition, so the problem may be related to parsing the checkstyle XML output.

I am running the sixth pretest for the soon-to-be-released as Emacs 25.1.  What am I missing?


texts:
I usually add a keybinding C-o to call other-window (in addition to default C-x o), by adding

(global-unset-key "\C-o")
(global-set-key "\C-o" 'other-window)

in my .emacs. However, on one machine (Emacs 26.3, MS Windows 10) this event fires twice for every key press. I can see that it actually fires twice by doing (view-lossage).

This also happens if I bypass loading .emacs entirely and execute the global-set-key manually. If I manually re-bind C-o to any other event, for example M-: (global-set-key "\C-o" 'next-line) RET, that event fires twice. This does not happen for any other C- combinations that I've checked so far.

Any ideas what might be going on, and where I should look to fix this? Thanks!!


texts: How to bind "Hide Others" to a key "M-s-h" in railwaycat/emacs-mac-port?

texts: I'm using the railwaycat/emacs-mac-port, and would like to continue use it because of the very nice smooth scrolling. Anyone knows if there is a way to have the "M-s-h" key work as in other Mac applications? In Cocoa emacs I can for example do (global-set-key (kbd "M-S-h") 'ns-do-hide-others). Thanks


texts: Disable pop-up compilation buffer in AucTex

texts: How can I set AucTex to either (a) not pop up that annoying compilation buffer every time I C-c C-c or (b) only pop it up if compilation is not successful? (b) is preferable, but if it's too hard then I'm fine with (a).


texts: When editing remotely, after I change the working tree with magit, why won't my buffers autorevert?

texts: I have magit autorevert set (and also global autorevert), and it seems to work OK editing local files but not using tramp over ssh.  If I do, say, a hard reset in magit, my buffers aren't autoreverted, and I have to run revert-buffer manually.


texts: emacs display anomaly in Jupyter notebook terminal

texts:
When I use emacs in Jupyter hub terminal to edit a file, emacs seems to always insert an extra sequence of characters:

0;276;0c

before the actual content.

Also, after exiting emacs, the terminal display is weird. All characters become underlined. clear doesn't solve the problem. Only tput reset restores display to the normal state.

This is with emacs 26.2 on Ubuntu 18.04. Jupyter hub is TLJH as of Sep 2019.

Does anyone know how to fix the display issue?


texts: is it possible to have a "calc embedded" indicator in doom-modeline?

texts: this is indispensable, since I use "calc embedded" in auctex and need to leave this mode after have activate it.


texts: How to print a PDF, displayed with pdf-tools, from Emacs?

texts:
I'm using PDF-Tools (https://github.com/politza/pdf-tools) to display PDFs inside Emacs. But how to print them? C-c C-p raises the question »Print with:« and I have no idea how to answer it.

I'm looking for a solution to print the pdf, not the buffer, if this makes a difference.

My PC is inside a LAN and there are several printers available. I'm on Linux (openSuse Tumbleweed).


texts:
When I select text with the mouse, I see a region being selected.
However, when I release the mouse, the selection goes away.

Is there a simple way in spacemacs to use the mouse to defin a region, where the mark is set upon the "down" mouse button, and the end is marked with the "up" button ?


texts: Find out backend used in company completion

texts: When using custom company backends, company-complete ends up returning no completions due to a misbehaving backend. In such cases, it would be helpful to know out which company backend was used to generate the list of completions. How do I get this information after a company-complete invocation?


texts: Is it possible to outsource export settings?

texts:
I'm building a website using org-mode (specifically a project exported with ox-twbs). I want a navagation bar at the top of each page in my website. For example, one of my pages looks like this:

#+Title: My Page
#+HTML_HEAD_EXTRA:

Home

Teaching

Messages

This is my page. It was generated with the =ox-twbs= package for =emacs=.

The second line creates a tab menu at the top of the page.

My issue is that I want every page of my website to have the same tab menu. However, I'd rather not edit every org file in my directory every time I want to edit the tab menu.

It would be nice if I could maintain the tab menu in an external file

$ cat ~/tabmenu.html

Home

Teaching

Messages

and import this file into every #+HTML_HEAD_EXTRA with something like this:

#+HTML_HEAD_EXTRA:

Is this possible?


texts: magit blame: how to go to the commit my cursor is currently on

texts:
I want to checkout the file as it was when before the commit was applied so I can dig deeper.

Now I just resort to command line git to do that.


texts: Is there an emacs equivalent of vim's "modeline magic"?

texts:
I can't seem to find this answer anywhere, but I'm sure it's because I don't know the terms to search for.

I'm currently working in a mixed shop, with my developers using a mix of emacs, vim, Notepad++, and whatever you call the alleged text editor that is part of Aginity.

As you can imagine there are also great differences in opinion as to how to indent code (both spaces v.s. tabs, and how many spaces/tabs). Being a support guy I take no position on this, other than PLEASE FOR THE LOVE OF GHOD PICK ONE. I especially hate inconsistency inside a single file (???)

Vim has this feature called "modeline magic" (http://vim.wikia.com/wiki/Modeline_magic) that lets me put:

# vim: expandtab copyindent preserveindent softtabstop=0 shiftwidth=4 tabstop=4 filetype=py

"near" the top or bottom of a file and it tells vim to, well, you can follow that. (note for those who don't follow the link, the first character is a file-type dependent comment. In C++ it might be /* ... */ or //. SQL would be -- etc.

Surely Emacs has some sort of equivalent?

EDITED TO ADD:

Emacs and Vim mean something utterly different by "modeline" and "mode-line". Being a Unix Admin pretending to be a developer, I'm asking about the vim definition.

If I'm just missing the obvious search terms, that would be cool too.
(The tag is...probably wrong. If someone could make it more better, that would be good.) Basil Fixored it. Thanks Basil.


texts: Problem evaluating a `sage-shell-mode` function through `ob-sagemath`

texts:
I'm trying to use sage-math within an org-mode file. So far I've been able to configure the sage-shell-mode package (I'm impressed that sagemath can be installed in Debian using the package manager), my configuration:

(setq sage-shell:sage-executable "/usr/bin/sage")

(sage-shell:define-alias)
;; Turn on eldoc-mode
(add-hook 'sage-shell-mode-hook #'eldoc-mode)
(add-hook 'sage-shell:sage-mode-hook #'eldoc-mode)

(setq sage-shell:use-prompt-toolkit t)
(setq sage-shell:completion-function 'pcomplete)

Then, I installed ob-sagemath from the MELPA repository and followed the instructions from its github page. Notice that I've added a line requiring the package, that it's not in the instructions... but don't work either!

(require 'ob-sagemath)
;; Ob-sagemath supports only evaluating with a session.
(setq org-babel-default-header-args:sage '((:session . t)
                                           (:results . "output")))

;; C-c s for asynchronous evaluating (only for SageMath code blocks).
(with-eval-after-load "org"
  (define-key org-mode-map (kbd "C-c s") 'ob-sagemath-execute-async))

;; Do not confirm before evaluation
(setq org-confirm-babel-evaluate nil)

;; Do not evaluate code blocks when exporting.
(setq org-export-babel-evaluate nil)

;; Show images when opening a file.
(setq org-startup-with-inline-images t)

;; Show images after evaluating code blocks.
(add-hook 'org-babel-after-execute-hook 'org-display-inline-images)

(eval-after-load "sage-shell-mode"
  '(sage-shell:define-keys sage-shell-mode-map
     "C-c C-i"  'helm-sage-complete
     "C-c C-h"  'helm-sage-describe-object-at-point
     "M-r"      'helm-sage-command-history
     "C-c o"    'helm-sage-output-history))

(setq sage-shell:input-history-cache-file "~/.emacs.d/.sage_shell_input_history")

(add-hook 'sage-shell-after-prompt-hook #'sage-shell-view-mode)

Now, I open an org-mode file and try an example:

#+begin_src sage :exports both
2+2
#+end_src

and I get a comment in the *Messages* buffer

  executing Sage code block... ob-sagemath--last-res-info: Invalid
  output:
  --------------------------------------------------------------------------- NameError                                 Traceback (most recent call
  last)  in ()
  ----> 1 _emacs_ob_sagemath.read_file_and_run_cell("/tmp/sage_shell_mode7254uF0/sage_shell_mode_temp.sage", filename=None, latex=False, latex_formatter=None)

  NameError: name ’_emacs_ob_sagemath’ is not defined

Complementary info:

From my .emacs

(org-babel-do-load-languages 'org-babel-load-languages
  '((C . t)
    (emacs-lisp . t)
    (fortran . t)
    (gnuplot . t)
    (ipython . t)
    (latex . t)
    (ledger . t)
    (python . t)
    (mathematica . t)
    (maxima . t)
    (octave . t)
    (org . t)
    (R . t)
    (shell . t)
))

(setq org-confirm-babel-evaluate nil)

Questions:

What is happening?
How do I solve it?


texts: The background color can't fill the buffer completely

texts:
I used a theme in emacs 24, but recently, the background color just filled area where characters are instead of the buffer completely. Even though I killed the orignal ~/.emacs, and used command like customize-* to change the theme to another one, it's not improved.

Later, I added "Emacs.background:#303030" to ~/.Xdefaults and start it with "emacs -Q" to try to solve the problem, but it didn't work.

Version Info:

GNU Emacs 24.3.1
gtk 3.10.8~8+qiana
Distro: Linux Mint 17.1


texts: Does yasnippet support alternative placeholders?

texts:
Consider sample below:

SERVER-1
[connection] 192.168.0.1 success
[connection] 192.168.0.2 failed
[disconnect] 192.168.0.3 pending
[connection] 192.168.0.4 success

but [${1:connection}] ${2:192.168.0.${3:1}} ${4:success} only work for one placeholder (doesn't support alternative placeholders),

Does ya-snippet support syntax like ${1:connection OR disconnect} to give more alternative placeholders? (that's when you cursor is in placeholder, you hit tab then give you next placeholder until the last, yeah this is inefficient when you have list of choices, so consider the alternative implement below instead...)

or maybe integrate elisp powerful function like

${1:$$(popup-prompt '("connection" "disconnect"))} prompt for completion, i guess this function exist...


texts:
I've found that if I open an image in Emacs over 1MB it starts to take a while. I justed opened up a 3MB and it took 16seconds. I'm just using the default image-mode is there a better way?

Is there a way to shrink the preview image before putting it into a buffer? Maybe using imagemagick?

Update
When I type in './configure --prefix=/opt/emacs-26.0.50 --with-xft' it already says I'm using imagemagick, do I have to recompile with --with-imagemagick? It doesn't seem to change this list if I configure with-imagemagick.

  Where should the build process find the source code?    .
  What compiler should emacs be built with?               gcc -std=gnu11 -g3 -O2
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    x11
  What toolkit should Emacs use?                          GTK3
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use a png library?                           yes -lpng12
  Does Emacs use -lrsvg-2?                                yes
  Does Emacs use cairo?                                   no
  Does Emacs use imagemagick (version 6)?                 yes
  Does Emacs support sound?                               yes
  Does Emacs use -lgpm?                                   yes
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               yes
  Does Emacs use a file notification library?             yes -lglibc (inotify)
  Does Emacs use access control lists?                    no
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              yes
  Does Emacs use -lm17n-flt?                              yes
  Does Emacs use -lotf?                                   yes
  Does Emacs use -lxft?                                   yes
  Does Emacs use -lsystemd?                               no
  Does Emacs directly use zlib?                           yes
  Does Emacs have dynamic modules support?                no
  Does Emacs use toolkit scroll bars?                     yes
  Does Emacs support Xwidgets (requires gtk3)?            no
  Does Emacs have threading support in lisp?              yes

Update: How I build emacs

Here is how I'm compiling emacs under Debian Jessie (64bit)

cd ~/src/emacs-master
git pull
./autogen.sh
./autogen.sh git
./configure --prefix=/opt/emacs-26.0.50 --with-xft --with-imagemagick
make bootstrap -j32
sudo make install

Output from configure command https://gist.github.com/map7/ebbec3c6ce491180099bde6e7c1a5fa3


texts: neotree: `all-the-icons-icon-for-dir` raises void-function error

texts:
I am getting an error with neotree and i dont know why the arguments from call-interactively are nil.

Edit: The Problem is within neotree and i have an empty init file just with neotree and the Problem occurs when i switch to the root directory.

Backtrace:

Debugger entered--Lisp error: (void-function nil)
nil()
apply(nil nil)
all-the-icons-icon-for-dir("/" "right")
neo-buffer--insert-fold-symbol(close "/")
neo-buffer--insert-root-entry("/")
neo-buffer--insert-tree("/" 1)
neo-buffer--refresh(nil)
neo-buffer--change-root("/")
neo-global--open-dir("/")
neotree-dir("/")
funcall-interactively(neotree-dir "/")
call-interactively(neotree-dir)
neotree-change-root()
funcall-interactively(neotree-change-root)
call-interactively(neotree-change-root nil nil)
command-execute(neotree-change-root)


texts:
I have downloaded file ido.el, but can't load it.  When I (require 'ido) the following is displayed:

Debugger entered--Lisp error: (file-error "Cannot open load file" "No such file or directory" "seq")
  require(seq)
  eval-buffer(# nil "/home/admin/.emacs.d/ido.el" nil t)  ; Reading at buffer position 13523
  load-with-code-conversion("/home/admin/.emacs.d/ido.el" "/home/admin/.emacs.d/ido.el" nil t)
  require(ido)
  eval((require (quote ido)) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

This is with GNU Emacs 24.4.1


texts: `org-bibtex` is no longer found automatically

texts:
I am getting the following warning message since I have upgraded to GNU Emacs 27 on Mac.
I have been using Emacs for org-mode. It's my understanding that org-bibtex should be a part of GNU Emacs, I don't know why org-bibtex cannot be loaded.
Warning (initialization): An error occurred while loading ‘/Users/euijeong/.emacs’:

File is missing: Cannot open load file, No such file or directory, org-bibtex


texts: Shift+arrow to change window does not work in org-mode

texts: I installed a package that changes emacs windows using Shift+arrow, and it works in various modes I use but not in org-mode.  Is there a reason why org-mode shadows this command?


texts:
For a few years Emacs has had SVG support, however I don't know of a reliable way to detect it, before using it.

How can we detect in EmacsLisp, SVG rendering ability in the current Emacs GUI (X/NS/Mac/Win etc.)

It's not sufficient to assume a GUI build has SVG support, as this is not always the case.


texts: How to make eshell recognize path to files and make it clickable?

texts:
In the compilation environment in emacs (M-x compile), whenever there is a path to file (ex.: ../src/code.cpp:21:3: warning: comparison between...) it highlights the path and make it clickable. When clicked, it opens the file in the corresponding line.

I wanted to enable a similar feature in eshell. So that it would highlight and make clickable everything that looks like a file path. How to do that? Is there any script available for that?

[Edit] - clarifications.


texts:
I need a function to execute before the minibuffer is entered, not after (minibuffer-setup-hook style). Is there any way I can achieve this effect with advice or other emacs systems?

I would like to defer some minibuffer setup until the minibuffer is actually used, to speed up startup time.


texts: In PDFView how do you automate creating errata entries?

texts: When reading PDF documents, I frequently find typos and sometimes more serious errors. I try to keep track of those findings with the intention of sending them to the authors or publishers, but doing it by hand just takes too much time. How to automate the process?


texts: How to transfer special characters like äöü in the command line to emacsclient?

texts:
I try to create an interaction between Emacs and other applications, e. g. Microsoft Office.

For example I have defined a VBA Macro in MS Outlook which starts a search in Emacs:

strEmacsclientPath = "C:\emacs\emacs-24.3\bin\emacsclient.exe"

strShellCommand = strEmacsclientPath & " -c --eval " & Chr(34) & "(org-search-view nil" & Chr(34) & Chr(34) & Chr(34) _
    & strSearchText _
    & Chr(34) & Chr(34) & Chr(34) & ")" & Chr(34)

Call Shell(strShellCommand, vbHide)

This works, but if the text to search (defined in variable strSearchText ) contains special characters like äöü, it fails, as e. g. with the search term "für", in Emacs I get

Search words: f\374r

In consequence, it also does not find real occurrences of the search term "für".

How can I avoid that?

I've redefined the encoding settings, as I also had problems in the past:

(prefer-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)

Here are the complete current encoding settings (obtained with C-h C RET)

  Coding system for saving this buffer:   U -- utf-8-dos (alias:
  mule-utf-8-dos)

  Default coding system (for new files):   U -- utf-8 (alias:
  mule-utf-8)

  Coding system for keyboard input:   1 -- iso-latin-1-unix (alias:
  iso-8859-1-unix latin-1-unix)

  Coding system for terminal output:   * -- cp1252 (alias of
  windows-1252)

  Coding system for inter-client cut and paste:   U -- utf-16le-dos

  Defaults for subprocess I/O:   decoding: U -- utf-8-unix (alias:
  mule-utf-8-unix)

  encoding: U -- utf-8-unix (alias: mule-utf-8-unix)

  Priority order for recognizing coding systems when reading files:
    1. utf-8 (alias: mule-utf-8)
    2. iso-2022-7bit
    3. iso-latin-1 (alias: iso-8859-1 latin-1)
    4. iso-2022-7bit-lock (alias: iso-2022-int-1)
    5. iso-2022-8bit-ss2
    6. emacs-mule
    7. raw-text
    8. iso-2022-jp (alias: junet)
    9. in-is13194-devanagari (alias: devanagari)
    10. chinese-iso-8bit (alias: cn-gb-2312 euc-china euc-cn cn-gb gb2312)
    11. utf-8-auto
    12. utf-8-with-signature
    13. utf-16
    14. utf-16be-with-signature (alias: utf-16-be)
    15. utf-16le-with-signature (alias: utf-16-le)
    16. utf-16be
    17. utf-16le
    18. japanese-shift-jis (alias: shift_jis sjis)
    19. chinese-big5 (alias: big5 cn-big5 cp950)
    20. undecided

  Other coding systems cannot be distinguished automatically   from
  these, and therefore cannot be recognized automatically   with the
  present coding system priorities.

  Particular coding systems specified for certain file names:

  OPERATION   TARGET PATTERN      CODING SYSTEM(s)
  --------- --------------      ----------------
  File I/O   "\.dz\'"      (no-conversion . no-conversion)
        "\.xz\'"      (no-conversion . no-conversion)
        "\.lzma\'"        (no-conversion . no-conversion)
        "\.lz\'"      (no-conversion . no-conversion)
        "\.g?z\'"     (no-conversion . no-conversion)
        "\.\(?:tgz\|svgz\|sifz\)\'"
                    (no-conversion . no-conversion)         "\.tbz2?\'"         (no-conversion . no-conversion)       "\.bz2\'"     (no-conversion . no-conversion)
        "\.Z\'"       (no-conversion . no-conversion)
        "\.elc\'"     utf-8-emacs         "\.utf\(-8\)?\'"    utf-8
        "\.xml\'"     xml-find-file-coding-system
        "\(\`\|/\)loaddefs.el\'"
                    (raw-text . raw-text-unix)      "\.tar\'"     (no-conversion .   no-conversion)       "\.po[tx]?\'\|\.po\."
                    po-find-file-coding-system      "\.\(tex\|ltx\|dtx\|drv\)\'"
                    latexenc-find-file-coding-system        ""          find-buffer-file-type-coding-system   Process
  I/O   "[pP][lL][iI][nN][kK]"  (undecided-dos . undecided-dos)
        "[cC][mM][dD][pP][rR][oO][xX][yY]"
                    (undecided-dos . undecided-dos)   Network I/O   nothing specified


texts: How to use "cache" argument in inline-call of org-babel?

texts:
My 1st question on Stack (＞﹏＜)!

When I write my homework in org-mode, I want to use the literate programming with org-babel.

So I use python as the major language to calculate the results I need in the org file. I use inline call(#+call: or call_<function-name>) with different arguments to realize different functions.

However, I find that #+call: adds an extra newline between in the results block. To avoid that , I use call_<function-name> as an inline call.

But my functions take time to execute, so I want to cache the results of function calls to avoid delays. But with the call, call_<function-name>[:cache yes], the results are not cached.

The following is the original function:

#+NAME: Daoqiex00
#+begin_src python :var R0=10 N=19 :exports none :results value :cache yes
import numpy as np
return np.cosh(1/(N-1)*np.arccosh(R0))
#+end_src

And the inline call is:

We will find \(x_{0}=\) call_Daoqiex00(R0=10,N=19)[:results value raw :cache yes].

How can I make this inline call cache the results?

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


texts: How can I disable the vertical scroll bar on just the minibuffer?

texts:
Look at this tiny scroll bar (circled in red):

I think I could use the elisp function set-window-scroll-bars, but I don't know how to specify the minibuffer.


texts: Adding box around text without changing the text width

texts:
The documentation of Face Attributes suggests that adding a line-width of -n to the box attribute will

  draw a line of width n whose top and bottom parts occupy the space of
  the underlying text, thus avoiding any increase in the character
  height.

So I've added the following line to my personal theme file for isearch candidates (lazy-highlight):

`(lazy-highlight ((,class (:box (:line-width -1 :color ,search) :background ,bg1 :foreground ,fg1))))

This works fine considering the height, however, the text width changes as seen in the gif below:

Is there any way to make left and the right part of the box also occupy the underlying text so that there is no change in the text width?


texts:
My Emacs customizations reside in a few separate .org files, all in the directory ~/emacs-prelude/personal. I'm always searching these files to find and change settings.

How can I define a function search-my-emacs-configutation-files to search the full text of these files?

It seems like the most obvious way would be to do a helm-projectile-grep, but Projectile seems to think the "project" is the entire Emacs-Prelude directory (including all my packages) when in fact I want to search only the subdirectory Personal which has my customizations.

helm-cmd-t seemed promising but it seems like it searches only filenames.

helm-do-grep works, but it asks me for the directory each time. I'd like to be able to call this function using a single keystroke.


texts:
This blog post on migrating from vim to evil-mode in emacs gives code to make a single ESC quit/cancel helm instead of 3.  It worked on Emacs.app (OS X) but doesn't work from Terminal.app (both emacs 24.x); that is, quitting helm requires ESC ESC ESC in Terminal emacs but not in Emacs.app.  How can I get this functionality for emacs in Terminal.app?

From the blog:

;; esc quits
(defun minibuffer-keyboard-quit ()
  "Abort recursive edit.
In Delete Selection mode, if the mark is active, just deactivate it;
then it takes a second \\[keyboard-quit] to abort the minibuffer."
  (interactive)
  (if (and delete-selection-mode transient-mark-mode mark-active)
      (setq deactivate-mark  t)
    (when (get-buffer "*Completions*") (delete-windows-on "*Completions*"))
    (abort-recursive-edit)))
(define-key evil-normal-state-map [escape] 'keyboard-quit)
(define-key evil-visual-state-map [escape] 'keyboard-quit)
(define-key minibuffer-local-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-ns-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-completion-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-must-match-map [escape] 'minibuffer-keyboard-quit)
(define-key minibuffer-local-isearch-map [escape] 'minibuffer-keyboard-quit)
(global-set-key [escape] 'evil-exit-emacs-state)

I tried to figure out the answer here, but after looking at a number of tutorials on using defun I'm stuck.  I have a number of arguments error as well as a free-variable error and I don't know what these things mean (that is, I don't understand the syntax of how the function is called nor do I understand what it is count

I blindly tried something like

(defun my-helm-quit-key ()
  (define-key helm-map (kbd "ESC") helm-keyboard-quit-key))

and then (add-hook 'after-init-hook 'my-helm-quit-key) but that didn't work.

I later found another post about it here, but after installing bind-key I still get the error "reference to free variable helm-map".  Where does helm-map come from?  I believe I have the latest version of helm and helm-gtags and helm-core installed...  The stuff I used from that site is as follows:

;; escape quits
(bind-key "<escape>" 'isearch-cancel isearch-mode-map)
(bind-key "<escape>" 'helm-keyboard-quit helm-map)
(bind-key "<escape>" 'helm-keyboard-quit helm-comp-read-map)


texts: ANSI TERM via `M-x TERM`: How to change line highlighting color?

texts:
How do you change the line-highlighting color in an ANSI-TERM?:

I am using PDB++'s sticky mode for Python debugging. This is how to appears on a regular terminal (lubuntu 17.04):

Notice the word print in the image above is visible. However, when launching terminal emulation in EMACS (empty .init file) via M-x term or M-x ansi-term and Run Program: /bin/bash, the print word is not visible as it is the same color as the highlighter:

I'd like to change the highlight color so the word print is visible. I know this is possible as the Prelude variant of EMACS looks like this:

However, I'm not sure what code in the Prelude configuration is responsible for line highlighting color in terminal emulation. Can anyone assist me? Please help.


texts: Improving org-block-begin-line, splitting in several faces

texts:
The face org-block-begin-line allows to customize the first line of the following block

#+BEGIN_SRC lang :var arg1=1 arg2=2
...
#+END_SRC

However, I would like to customize the faces within the line, by highlighting the lang, and certain properties, like highlighting only arg2=2.

Digging further, we can see that the use of the face is done within (org-fontify-meta-lines-and-blocks-1). But nothing there seems to allow to split the line in several blocks, and even less by doing it conditionally.

Something similar was proposed by rasmus ( https://pank.eu/blog/pretty-babel-src-blocks.html ) to implement further modification on the line, but this is not quite what I am looking for.

Might there be a package already available out there to add some colors // apply some regexp on this line ?

Also, it might be interesting if the same rules could apply on an inline src_lang() and a #+CALL: type of line.


texts: How can I make two running emacs processes to exchange text like in one?

texts:
When I have a running emacs process, before running another, I can make the running one a server, and then running the next as a client.

When I have two emacs processes already running, how can I exchange text between buffers in them as if in one emacs process?

What is some good practice to avoid such hassle?

Thanks.


texts: Show @ symbol in different color in clojure mode

texts: I want to show @ symbols (meaning dereference) in red in clojure-mode. How do I do that?


texts:
My init-which-key.el contains the following code,
(require 'package)
(defun my/which-key-setup ()
  "Startup configuration for which-key."
  (unless (package-installed-p 'which-key)
    (package-install 'which-key))

  (declare-function which-key-mode "which-key")
  (which-key-mode 1))

(my/which-key-setup)

(provide 'init-which-key)

And I include this file in my ~/.emacs.d/init.el. Like this,
(eval-and-compile
  (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)))
(require 'init-which-key)

when I compile init.el using batch mode, it reports
In toplevel form:
init.el:40:1: Error: Symbol's function definition is void: which-key-mode


texts: Display org-mode src R results horizontally

texts:
Is there a way to show the results of a Source Block horizontally, or equivalently to transpose an org-table?

For example, I have the following:

#+begin_src R :results table
c('a','b','c')
#+end_src

#+RESULTS:
| a |
| b |
| c |

I have discovered I can fix this by returning a list:

#+begin_src R :results table
as.list(c('a','b','c'))
#+end_src

#+RESULTS:
| a | b | c |

However, it would be preferable if I could do it without changing the source code.


texts:
How to obtain/implement a beginning-of-defun drop-in replacement that is idempotent?

i.e., if I already am at the beginning of a defun, beginning-of-defun should do nothing, rather than jumping to the beginning of the previous defun.

I acknowledge though that the following case would be ambiguous:

(defun ...)

| ;; <------ cursor is here. What should the function do: jump to next or previous defun?

(defun ...)


texts: header2.el: how to increment the version number with dot?

texts:
My setup

GNU Emacs GUI (version 24.4.51.1 (x86_64-w64-mingw32)
                       compiled from Harroogan Emacs.)
Package header2.el, which I use a lot.
If you need more detail about header2, see the emacs wiki . It's a great package, I really recommend it.

Situation:

header2.el lets you define file headers for different types of file (C, shell, EmacsLisp, and so on). You can automatically insert a header when you open a new file buffer, and it modifies them whenever you're saving.

I made a code, that focused only on inserting the version number and incrementing it every time whenever you're saving the file.

The code below inserts the number 0 of version, when you're creating a new file.

 (defsubst my/header-update-count ()
   "Insert a count of the number of times the file has been saved."
   (insert (concat comment-start " Version     : 0\n")))

 (setq make-header-hook '(my/header-update-count))

Configuring the update of the header whenever you're saving the file.

 (defvar file-header-update-alist ()
   "Used by `update-file-header' to know what to do in a file.
 Is a list of sets of cons cells where the car is a regexp string and the cdr is
 the function to call if the string is found near the start of the file.")

 (defvar header-prefix-string ""
   "Mode-specific comment prefix string for use in headers.")

 (defun register-file-header-action (regexp function-to-call)
   "Record FUNCTION-TO-CALL as the action to take if REGEXP is found
 in the file header when a file is written.  The function will be called
 with the cursor located just after the matched REGEXP.  Calling this twice
 with the same args overwrites the previous FUNCTION-TO-CALL."
   (let ((ml  (assoc regexp file-header-update-alist)))
     (if ml
         (setcdr ml function-to-call);; overwrite old defn
       ;; This entry is new to us.  Add to the master alist
       (setq file-header-update-alist  (cons (cons regexp function-to-call)
                                             file-header-update-alist)))))

 (register-file-header-action "Version   [ \t]*: " 'update-write-count)
 (when (boundp 'libreq-file-header)
   (register-file-header-action libreq-file-header 'update-lib-requires))

;; To have Emacs update file headers automatically whenever you save a
;; file, put this in your init file (~/.emacs):
(autoload 'auto-update-file-header "header2")
(add-hook 'write-file-hooks 'auto-update-file-header)

;; To have Emacs add a file header whenever you create a new file in
;; some mode, put this in your init file (~/.emacs):
(autoload 'auto-make-header "header2")
(add-hook 'emacs-lisp-mode-hook 'auto-make-header)

Action:

Now the version numbering works like your version is 0. When you're saving, it increments it with 1. So if your header have the version 5, when saving, it will change to version 6.
I would like to change the way of version numbering from one number to number dot number. For example, like when you're saving, it will update from 0.1 to 0.2 or from 3.12 to 3.13.

So in order to modify this, I changed the version numbering with adding a dot and number:

(insert (concat comment-start " Version     : 0.0\n"))

When I save the buffer, it updates from 0.0 to 1.0 to 2.0, which is not the intention.

In my setup the following line uses regexp to update the version numbering

(register-file-header-action "Version   [ \t]*: " 'update-write-count)

When I look into the source of the package header2.el, I noticed it uses regexp.

(register-file-header-action "\$VERSION[ \t]*=[ \t]*\"\\([0-9]+\\.\\)+"
                                   'update-write-count)

When I modified the regexp, it didn't gives me the desired behaviour. Notice that adding a file header and updating it are not done by a minor mode. They are done on hooks.  Adding a file header is done, for example, on a major-mode hook, and updating is done, for example, on write-file-hooks. It's a fairly not a difficult modification, but I couldn't even figure it out.

Any suggestion would be appreciated.


texts: Emacs 26.3 on macOS quits unexpectedly when using arrow keys

texts:
I have just installed emacs on my system and am having a problem where it quits when I am opening a new file. Here's how it happens:
After I open emacs I click the "blank page" icon. Next, the file explorer opens. When I try to navigate anywhere in the explorer using the arrow keys emacs instantly closes and Apple gives me an "emacs has quit unexpectedly" message. If I reopen the program and navigate by clicking I am able to open a file with no problem, only the arrow keys cause it to close.
I am running Mac OS 10.15.6 and emacs 26.3. Has anyone else encountered this? I am brand new to this program.


texts:
I am currently using Aquamacs 3.4, Emacs 25.3.50.1, and Org mode 9.2.5 and I typically have my frame split vertically into 2 windows. Each window carries 2+ different buffers whose names are in the tabs above. Here's an example:

When I switch to agenda-view with C-c a, the tab bar and buffers over my right window (where the agenda shows) disappear as shown here:

When I exit the agenda with q, the right tab bar does not return and, instead of the original 2+ buffers in that window, I am left with only 1.

At this point, if I kill the buffer on the right, the other (now hidden) buffer in the right window is revealed. Furthermore, I can M-x tabbar-mode once (getting rid of all tabbars) and then M-x tabbar-mode again to reveal all tabbars correctly again.

Ultimately, my problem seems to be that agenda-view is turning off tabbar-mode specifically in the window it opens. As it stands now, my fix is to turn off all tabbars and then turn them back on again, but it's a little bit of a pain.

Has anyone experienced this behavior and know of a way to disable it? Thanks for any info!


texts: How to export a pdf in landscape rotation

texts:
Following example.org is expected to be exported in landscape though the generated pdf remains in portrait. What should I change?

** A3 PDF Landscape
   #+LATEX_HEADER: \usepackage[a3paper]{geometry}
   #+LATEX_HEADER: \usepackage[lscape]{geometry}
   #+ATTR_LATEX: :placement [H] :landscape
*** Flowchart landscape
    #+BEGIN_SRC mermaid :file myPicture1121.png
 graph LR
     john-->|calls|mary
    #+END_SRC
 #+RESULTS:
 [[file:myPicture1121.png]]


texts: Association list `Symbol's function definition is void` error

texts:
I am trying to achieve a slightly smart package management in my init.el file but can't achieve it because of ELisp ignorance. Here is the case.

;; package loader function
(defun load-packages-context-sensitively (plist)
  (dolist (ppack plist)
    (unless (and ((not window-system) (string= (assoc ppack plist) "GUI")))
      (require '(ppack)))))

(defconst package-assoc-list
  '((package-1 "CLI") ;here
    (package-2 "CLI") ; I
    (package-3 "GUI") ; declare
    (package-4 "GUI") ; my packages
    (package-5 "CLI")))

(load-packages-context-sensitively (package-assoc-list)) ; here we need a happy ending

I simply want to generate an associated list (I'm not even sure if its the right data structure) and map each package name (provide 'package-x)'ed in another file to "GUI" and "CLI" strings. What I want to achieve is to pass the list to my slightly-smart-function and prevent GUI packages being loaded in CLI environments...

It gives me Symbol's function definition is void: package-assoc-list error now. Yes it looks very self-explanatory, it is well documented but I couldn't find a way to overcome it.

Any help, any correction, any suggestion, any cringe is more than welcome.


texts: Changing default font for GUI in bbatsov's prelude

texts:
I'm using bbatsov's prelude and I'm trying to change default font for when I'm running a GUI emacsclient window.

I've added the following to my ~/.emacs.d/personal/preludes:

(set-default-font "Source Code Pro-12")

And I see the font change if I just start emacs.

However, if I restart the emacs --daemon I have in the background and ask a GUI window to be opened using emacsclient -c, I don't see the default font changed to the one I want.

I've also tried to put that lisp code in a file in ~/.emacs.d/personal/preload/preludes.el but it made no difference.

Any ideas?

Cheers


texts: Convert escaped unicode character in string to character

texts:
How can I convert a string containing an escaped unicode character to a character?

(string-to-char "\\u03C0") evaluates to 92 which is the character value of the first \ in the string.  I somehow need to modify the string so I can call (string-to-char "\u03C0") and get 960.  (substring "\\u03C0" 1) evaluates to "u03c0" which isn't quite right either!


texts: how to implement a numeric prefix argument in emacs

texts:
When I press "d", this loop runs 52 times.
How can I adjust this elisp so that, I can specify a number
instead of harcoding 52.

I guess I'm trying to do something like " C-u -1 C-x ^" mentioned at https://www.emacswiki.org/emacs/WindowResize

;; comment
(eval-after-load 'elfeed-search
  '(define-key elfeed-search-mode-map "d" #'my/elfeed-extra-info))

;; fetches extra info
(defun my/elfeed-extra-info ()
  (interactive)
  (dotimes (i 52)
    (elfeed-goto-line i)
    (my/detect-country (elfeed-search-selected :ignore-region))
    (my/detect-isfp      (elfeed-search-selected :ignore-region))
    (my/detect-others (elfeed-search-selected :ignore-region))
    (elfeed-search-update :force)
    )
)


texts:
I expect the package to be require'd as soon as mdi-insert is called but I get:

  Error (use-package): spaceline :config: Symbol’s function definition is void: mdi-insert

~/.emacs.d/init.el

(let ((default-directory (expand-file-name "lisp/" user-emacs-directory)))
  (normal-top-level-add-subdirs-to-load-path))

(require 'package)
(setq-default
 load-prefer-newer t
 package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t)
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package t))
(setq-default
 use-package-always-defer t
 use-package-always-ensure t)

(use-package org
  :pin org
  :ensure org-plus-contrib)

(use-package spaceline
  :ensure nil
  :demand t
  :config
  (message (mdi-insert "star")))

(use-package mdi :ensure nil)

~/.emacs.d/lisp/mdi/mdi.el: https://github.com/angrybacon/mdi/blob/master/mdi.el#L1952-L1957

(mdi is a package I wrote myself and placed under lisp/)

Also, it works with :demand t in the declaration for mdi. But I would like to defer the package if possible.


texts:
With recent versions of Emacs, tramp routinely hangs at the time of making the connection.

The *Messages* buffer gives no information.

Is there a way to get more information as to what's happening?

I have seen this hanging behavior in two forms.

On sudo-based connections, tramp hangs right after I enter the password for sudo, and hit return.

On ssh-based connections, tramp will hang right after the appearance of the message

Waiting from prompts from remote shell...

In either case, it would be helpful to know what tramp is doing all this time.


texts:
What do I put in my init to enable a mode for all files?
Say I want to have auto-fill-mode enabled at all times.
I've seen this
post
and some others, but all are focused on a specific task. I'd like to document
a general solution to a common search that uses best practices.


texts: Sending mail in mu4e on emacs25 (or debugging make-network-process hangs)

texts:
The short

How can I investigate why make-network-process gets stuck forever?

The long

I have been happily using mu4e as my mail agent for a number of years. After upgrading from emacs 24 to emacs 25 (at the same time as upgrading debian 8 jessie to debian 9 stretch, so it is possible that other factors are involved) I have lost the ability to send mail from emacs: after pressing C-c C-c in a message buffer, the minibuffer displays

Trying <whatever> account...

essentially forever, without the mail getting sent.

After setting smptmail-debug-info to t gave no joy (the *trace of SMPT session to <host>* buffer remains empty and no messages appear), I managed to drill down to a call to

(make-network-process :name "smtpmail"
                      :buffer #<buffer *trace of SMTP session to an.smtp.server*>
                      :host "an.smtp.server"
                      :service 25)

which gets stuck. At this point we cross the boundary from elisp to C, and I run out of ideas.

How should I proceed to diagnose and fix the problem?