texts: Monospace font for calendar buffer and tables (in org-mode), proportional font in main buffer for text paragraphs

texts:
I like having a proportional font in main buffer for writing plain text paragraphs (e.g. Georgia), but calendar buffer (M-x calendar) in org-mode looks funny (not properly aligned) if the font isn't monospaced (Cousine looks nice in calendar buffer, but not for paragraphs of text). Is there a way to configure Emacs (settings loaded from init.el) to display different fonts in main buffer and calendar buffer?

Also, tables look funny if the font isn't monospaced (not properly aligned, like in calendar buffer). Is it also possible to apply a font for tables that's different than the font of the main block of text?


texts: How to globally disable `shell-dirtrack-mode` after `(require 'shell)`

texts:
(require 'shell) enables shell-dirtrack-mode globally in every buffer.  Is there a way to disable that behavior?

The only workaround that I have found is to call (shell-dirtrack-mode -1) for each major mode that loads (e.g., via a major-mode hook); and, for fundamental-mode, I created a new function that calls the same thing immediately after calling kill-all-local-variables.


texts: Org-mode: Recenter buffer to top when clicking on an org-agenda link

texts:
When right- or middle-clicking on a headline generated in the agenda, org will open a buffer with the file containing that headline. That headline will be centered in the buffer.

How can I make it so that clicking on an agenda link aligns the headline to the top of the buffer rather than the center?

I found that I could do this manually by customizing recenter-positions and then hitting C l (recenter-top-bottom), but I really would like this to happen automatically.


texts: Magit popups no longer behaving as popups (in my setup)

texts:
I like to have my emacs set up as one full-screen frame with two side-by-side windows at all time. To do this, I've used this code to force emacs not to split windows arbitrarily:

(defun never-split-a-window nil)
(setq split-window-preferred-function 'never-split-a-window)

This works great, and importantly, I can still use popwin to display temporary popup windows as splits. Other packages still successfully split as well, for example Helm. And a few weeks ago, so did Magit's popups. It was nice to have the main Magit buffer occupy one whole window, but then have popups split the window (temporarily).

Now, since some changes to Magit to consolidate window handling, I get my Magit popups in the opposite window rather than as a split. Is there any easy way to get back the splitting behavior, without allowing Emacs to go nuts and split things willy-nilly (as it did before changing split-window-preferred-function)?


texts:
I am using spacemacs and try to use full text indentation. When I execute "visual-line-mode" and "adaptive-wrap-prefix-mode" by hand via M-x the text will indent, when I edit it. Of course I tried to automate this behaviour with the following configuration:

(with-eval-after-load 'org
   (setq org-startup-indented t) ; Enable `org-indent-mode' by default
   (add-hook 'org-mode-hook #'visual-line-mode)
   (add-hook 'org-mode-hook #'adaptive-wrap-prefix-mode))

But this won't work.. and I have no idea why. I also have tried several other solutions (like this one: Correct indentation for wrapped lines), but nothing worked for me.

Here a screenshot of my emacs setup after launch:

And here is my emacs after I manually entered the above commands:

Can someone help me with my problem or is there another solution for that problem?


texts: How to mark all files in the current dired directory?

texts:
I want to mark all the files in the current dired buffer. Is there a command for this? Not including . and ...

My use case is hardlinking all the files in a directory and I always reach for M which is change mode. I can remove all marks with either (?) U unmark-all-marks or M-DEL unmark-all-files, and it would seem normal to have the opposite.


texts:
I use spacemacs and sometimes I need to fix window configuration 4 windows. Could somebody help with it?

I want to create 4 windows (split vertically and then both split horizontally)Then call some command like toggle-window-configuration-frozen and after that, I'd like to keep that configuration until- toggle back- C-x 0

At the moment, I experienced that, for example,

go test buffer kills after keyboard-quit (C-g)
window configuration resets on keyboard-escape-quit (C-u)


texts: How do I make an org statistics cookie count partially completed subtasks?

texts:
Say I have the following org file:

* do all my chores [0%]
1. [-] vacuuming [50%]
   1. [X] vacuum kitchen
   2. [ ] vacuum pool
** TODO shopping [33%]
*** DONE buy hot sauce
CLOSED: [2019-01-18 Fri 17:57]
*** TODO buy hot peppers
*** TODO buy hot dogs

The top-level headline ("do all my chores") has two children; neither is done. One is a plain list ("vacuuming") with a statistics cookie at 50%. The second is a headline ("shopping") at 33%.

I would expect the top-level statistics cookie to be at 42% (an average of 50 and 33). However, it's actually at 0% -- I assume because none of its direct subtasks has been completed. Can I make it be at 42%?


texts: org-present mode makes asterisk characters invisible

texts:
My org-mode TODO list looks like this in Emacs:

*Angular
**Two way binding
***{{modelName}}
**Controller
***Do crud operations
***Different scopes across the application

I wanted to present it using org-present, which I enabled by doing M-x org-present. This removed all hierarchy-related asterisks and turned the visible text into a plain list:

Angular
Two way binding
{{modelName}}
Controller
Do crud operations
Different scopes across the application

I am interested in preserving the hierarchy levels for display. How can I do that in org-present-mode (or any other presentation mode for Emacs)?

Additionally, I noticed that org-present-mode doesn't get toggled when I do M-x org-present twice.


texts: Spacemacs laggy without external keyboard

texts:
I recently installed Spacemacs on my laptop and I notice strange bahaviour;
if I'm using it with external keyboard everything is fine but soon as I use laptop without external keyboard Spacemacs became really laggy, there is visible delay between me pressing key and letter appearing on screen.
I really can't understand what could be reason for such behaviour, all other applications behave same.
I'm using Vim for years (there is no visible difference between using it with or without external keyboard on same laptop) and really like Spacemacs but this is actually show stopper for me since I use laptop without external keyboard a lot.

UPDATE:

Based on some other posts about slow Emacs/Spacemacs I removed linenum option and after that everything is just fine! What I still don't understand why there is difference in Spacemacs behavior depending on being on power supply or not??? (If I'm on power supply and turn on linenum option application work fine, if I unplugged laptop Spacemacs suddendly become very slow)


texts: How to display and format leading spaces (spaces at the beginning of a line) with whitespace-mode?

texts:
I want to see all spaces at the beginning of a line as dots. Also tabs and line breaks. So I've set my init.el file as the following:

(setq-default indent-tabs-mode nil)

(setq whitespace-style '(space-mark newline-mark tab-mark))

(whitespace-mode t)

(add-hook 'before-save-hook 'whitespace-cleanup)

(add-hook 'prog-mode-hook
  (lambda ()
    (whitespace-mode t)))

(add-hook 'text-mode-hook
  (lambda ()
    (whitespace-mode t)))

(setq whitespace-display-mappings
  '((newline-mark 10 [172 10])
   (space-mark 32 [183] [46])))

And that's the result:

You can see the desired effect for the line breaks and the dots here, but the dots are everywhere (Eg. between the words class and Lottery). I want only the leading spaces, actually to mark my indentation. How can I do that?

Also, how can I format the colors? I want to select a darker dot and line break. I know it's using a display table so faces won't work, right?


texts:
(tool-bar-mode 0) takes up 11% of my initialization time (about a third of  a second). It's not that big of a deal; it's just strange. I've tried it on multiple computers. I've also tried disabling everything but that line in my .emacs. It always takes a while.

Is this normal? Is there a better way to do it?


texts: Almost working smoothly attempt to get terminal Emacs to copy to clipboard

texts:
I'm running this emacs

GNU Emacs 25.2.2 (x86_64-pc-linux-gnu) of 2017-09-22, modified by Debian

directly in a Gnome terminal by calling emacs, which is actually a link to /etc/alternatives/emacs.  This is on an Ubuntu 18.04 Linux.

Emacs copy function, C-c in cua mode, doesn't copy into the clipboard.  I followed this advice and installed this package

M-x package-install RET xclip RET

and it still didn't work.  Now I have added a simple function to my .emacs file :

(defun copy-region-to-clipboard ()
  "Copies region to X-clipboard invoking `xclip' in shell"
  (interactive)
  (shell-command-on-region
   (region-beginning)
   (region-end)
   "xclip -i -selection clipboard"))

(global-set-key (kbd "<f1>") 'copy-region-to-clipboard)

which does work.  But I have to press F1 and Emacs won't return control of the cursor until cancelling with C-g.  After cancelling with C-g, the text disappears from the clipboard.

So the order of operation is

Select-region
    -> F1
        ->  Move focus to other window and paste
            -> Move focus back to Emacs and C-g before continuing

I wonder if there is a tweak to this program that will allow xclip to fork asynchronously with necessary input data and return control to Emacs?  And then somehow chain this new function async-copy-region-to-clipboard onto the end of the C-c functionality?

Edit: Adding & to end of command: xclip -i -selection clipboard &, does not change behavior - Emacs still waits.

Edit With the help of the excellent selected answer I tried using xsel instead of xclip and found that xsel doesn't block like xclip does.  This is long known behavior of xclip. Also discussed here.

  xclip could also be used for this purpose. Unlike xsel, it works better when printing a raw bitstream that does not fit the current locale. Nevertheless, it is neater to use xsel because xclip does not close STDOUT after it has read from the tmux buffer. As such, tmux does not know that the copy task has completed, and continues to wait for xclip to terminate, thereby rendering tmux unresponsive. A workaround is to redirect {{ic|STDOUT} to /dev/null:

However, I found that neither of these worked for the Emacs solution, and Emacs still hung:

xclip -i -selection clipboard > /dev/null
xclip -i -selection clipboard > /dev/null &

My final working code is:

;; .emacs
...
(defun copy-region-to-clipboard ()
  "Copies region to X-clipboard invoking `xsel' in shell"
  (interactive)
  (if (and(use-region-p) (not (display-graphic-p)))
      (shell-command-on-region
       (region-beginning)
       (region-end)
       "xsel -i -b"
       )))

(global-set-key (kbd "<f1>") 'copy-region-to-clipboard)

(defun workaround-copy-region-as-kill ()
  "Run `some-command' and `some-other-command' in sequence."
  (interactive)
  (when (and(use-region-p) (not (display-graphic-p)))
    (copy-region-to-clipboard)
    (copy-region-as-kill 0 0 t)))

(defun workaround-kill-region  ()
  "Run `some-command' and `some-other-command' in sequence."
  (interactive)
  (when (and(use-region-p) (not (display-graphic-p)))
    (copy-region-to-clipboard)
    (kill-region 0 0 t)))

;; Note: 'workaround-copy-region-as-kill' is REPLACING 'copy-region-as-kill'
;; in cua--cua-keys-keymap
;; so we call 'copy-region-as-kill' from the end of it.
(define-key cua--cua-keys-keymap (kbd "C-c <timeout>") 'workaround-copy-region-as-kill)
(define-key cua--cua-keys-keymap (kbd "C-k <timeout>") 'workaround-kill-region)

;;(global-set-key (kbd "C-c") 'workaround-copy-region-as-kill) FAIL!

The technique of mapping C-c <timeout> was provided by this answer to my follow-on question.


texts:
(I am using MAC OS High Sierra v.10.13.6) with Emacs v26.1

When attempting to push changes to a remote-repo (Github) using the package magit

I received the following error in the buffer.

Error (ssh-agency): ‘/usr/bin/ssh-add’ failed with status 1:


texts: Is there a convenient way to swap two words that aren't adjacent?

texts:
I've recently been editing some source code where I often want to swap elements in an array that spans multiple lines.
Doing this manually is quite tedious, moving the cursor between both locations and copy-pasting twice.
It's possible to write a utility that does this - which would be much faster than copy-pasting between two locations (either with a single mouse drag, or marking two locations with the cursor).
However for all I know this may already exist.
Does Emacs provide a convenient way to do this, or is there a package this supports this feature?


texts: Enable cua-mode in term or ansi-term mode

texts: While working with term or ansi-term in term-line mode, I am not able to use cua-mode bindings. Is this possible?


texts: Why is there a case sensitivity problem with org mode source block tags?

texts:
So I am entering source code into org documents by using source code blocks such as:

#+BEGIN_SRC C++
  #include <iostream>

  using namespace std;

  int main() {
      cout << "Hello World" << endl;
      return 0;
  }

#+END_SRC

Notice that the language tag is 'C++'.  When I use uppercase 'C', there is no syntax highlighting but C-c C-c will allow me to evaluate the code block properly.  However, if I try to edit the block by doing C-c ' then I get the error "No such language mode: C++-mode".

If I switch the language tag to 'c++', then I get syntax highlighting and I am able to use C-c ' to edit the source block but then if I try C-c C-c to evaluate the source block I get the error "No org-babel-execute function for c++!"

I have looked in the ob-c.el and org-src.el source code and I think I have found where I could fix it.  Although I don't want to depart from the official source I wanted to see if I was on the right track.  Unfortunately, I can't figure out how to load those changes once I have made them, or maybe it is that the change didn't do what I thought =)  All I did was modify the code in the emacs/lisp directory and delete the .elc version of the file in the hopes that it would get re-compiled the next time emacs started.

Is this a true bug or am I missing something?  This is version 24.3.1

Thanks!


texts:
I installed Emacs via homebrew using this Emacs bundle, https://github.com/railwaycat/homebrew-emacsmacport
This bundle has some nice OS X features but it doesn't have the OS X keyboard shortcuts enabled by default (e.g., command + c for copy and command + v for paste). How can I enable this? I would have thought a Google search would find the answer but all I found was this https://www.emacswiki.org/emacs/MacKeyMode but I am not sure if that's still relevant.
Any pointers would be welcomed and sorry if I missed something obvious.


texts: eshell backtrace when trying to use character command

texts:
I have written a custom interactive command that takes a character as an argument. When I happen to use the key binding for that command while in a eshell buffer where a long-running command is currently running, I get this backtrace:

Debugger entered--Lisp error: (wrong-type-argument characterp (switch-frame #<frame perf_log.1 0x2b7af490>))
  char-to-string((switch-frame #<frame perf_log.1 0x2b7af490>))
  eshell-self-insert-command()
  call-interactively(eshell-self-insert-command nil nil)
  command-execute(eshell-self-insert-command)

So I looked at the code for that function:

(defun eshell-self-insert-command ()
  (interactive)
  (process-send-string
   (eshell-interactive-process)
   (char-to-string (if (symbolp last-command-event)
               (get last-command-event 'ascii-character)
               last-command-event))))

The only reference to which I can find is inside the ominous sounding function eshell-intercept-commands.

I suspect that in that circumstance eshell mistakenly thinks that the last command event was intended for it. Is there a way to filter those instances?

The full implementation of my command is below (it assigns unique characters to emacs windows, displays the character in the modeline, then lets me switch to that window by pressing a hotkey and letter assigned to the window):

(defconst md-glyphs
   '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
   ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
   ?^ ?\# ?\ ?> ?\; ?\" ?* ?\' ?% ?\\ ?\` ?$ ?[ ?_ ?\, ?{ ?:
   ?! ?- ?\( ?\| ?~ ?\. ?? ?= ?\) ?< ?} ?& ?/ ?@ ?+ ?]))

(defun md-get-window-glyph (w)
  (let* ((fp (frame-parameters (window-frame w)))
         (frame-top (cdr (assoc 'top fp)))
         (frame-left (cdr (assoc 'left fp)))
         (window-top (window-top-line w))
         (window-left (window-left-column w))
         (hash (md5 (format "%S %S %S %S" frame-top frame-left window-top window-left)))
         (glyph (nth (% (string-to-number (substring hash 0 2) 16) (length md-glyphs)) md-glyphs)))
    (char-to-string glyph)))

(setq-default mode-line-format
              (append
               (list '(:eval (propertize (format "[%s] " (md-get-window-glyph (get-buffer-window))) 'face 'font-lock-constant-face)))
               mode-line-format))

(defun md-select-window-with-glyph (chosen-glyph)
  (interactive "cWindow glyph: ")
  (dolist (f (frame-list))
    (dolist (w (window-list f 0))
      (ignore-errors
        (when (equal (downcase (md-get-window-glyph w)) (downcase (char-to-string chosen-glyph)))
          (select-frame-set-input-focus f)
          (select-window w))))))

(global-set-key (kbd "M-d") #'md-select-window-with-glyph)


texts: Do not expand abbreviation if preceded by "."

texts:
Let's say abbrev expands "com" into "commission".

The problem is that this expands "google.com" into "google.commission".

Is there a way to disable this expansion if "com" is preceded by a "."?


texts:
I'd like to take a window (or part of it) as a bitmap and save it as an image. This is basically a screenshot functionality.

I'd like to do it with emacs lisp so that screenshot taking can be scripted.

I'm using Aquamacs, but I'm not bound to be using exactly this version of Emacs.


texts: Is there a package for tracking local history of files like in IntelliJ or Eclipse?

texts:
Local History is a feature in IntelliJ and Eclipse, which for every file keeps a history of its changes:

IntelliJ Local History
Eclipse Local History

It is not a replacement for revision control systems like Git, but I found it useful when experimenting with code.

Is there a way in Emacs to allow browsing through changes in one file and being able to select one version and revert to it?


texts: Why aquamacs does not read ~/.emacs.d/init.el?

texts:
I have some customisation in my ~/.emacs.d/init.el. My command line emacs can pick up the init.el as expected. However Aquamacs does not seem to read the file at all. Here is the buffer of the *message*

Loading prestart plugin files ...
... done.
Wrote /Users/antkong/Library/Preferences/Aquamacs Emacs/Packages/.nosearch
Shell: /bin/zsh
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/Recent Files.el (source)...done
Cleaning up the recentf list...done (0 removed)
22 environment variables imported from login shell (/bin/zsh).
Loading /opt/homebrew-cask/Caskroom/aquamacs/3.2/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex.el (source)...done
Loading plugins ...
Loading /opt/homebrew-cask/Caskroom/aquamacs/3.2/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el (source)...done
... done.
Loading `custom-file' failed.
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/Preferences.el (source)...done
Mark set
one-buffer-one-frame-mode disabled.
Mark set [26 times]
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/frame-positions.el (source)...done
file-error: (Opening directory no such file or directory /Users/antkong/Library/Logs/CrashReporter)
Mark set [5 times]
Aquamacs is based on GNU Emacs, a part of the GNU/Linux system. It is Free Software: you can improve and redistribute it under the GNU General Public License, version 3 or later. (C) 2014 Free Software Foundation, and D. Reitter. No Warranty.

Why Aqacmacs does not read the init.el file?


texts:
Has the org-mode text syntax been adopted anywhere besides emacs?

The only place I can think of is that Github allows you to write readmes in org mode and can display it like it can markdown. Are there other pieces of software that support the org-mode syntax? I was thinking maybe there are other editors that support it?


texts:
I try to find the documentation for the function face-attributes-as-vector or any other function which gives my access to the face definition.

Emacs contains just the following information:

face-attributes-as-vector is a built-in function in ‘C source code’.

(face-attributes-as-vector PLIST)

Return a vector of face attributes corresponding to PLIST.

[back]

How to know which vector element contains which face attribute?


texts: Format Haskell type signatures to be multi-line

texts:
I want to have the following functionality on a save hook.

Given a buffer that has type signatures like this…

add :: Integer -> Integer -> Integer
add x y = x + y

…I want to have them reformatted to the following:

add
  :: Integer
  -> Integer
  -> Integer
add x y = x + y

As far as I can tell stylish-haskell does not have this functionality. What are my options?


texts:
All I'm trying to do is to create a slideshow presentation from Org mode.
As everyone does, I googled to get a few links.
I followed this link to write Non-Beamer presentations, as I thought presenting over a web browser would be a cool thing to do (maximum portability).
I chose to go with

org-html5presentation
Is an Exporter of Org-mode documents to HTML5 slide show presentations. (see gist.github.com/509761 for code and usage information)

Even though the instructions are simple as follows:

First of all, check your Org-mode version. Note: This library has
been tested on Org-mode 8.2.5h. M-x org-version

Get org-html5presentation.el. For example,
git clone https://github.com/kinjo/org-html5presentation.el.git \
~/org-html5presentation.el

Add following to ~/.emacs.d/init.el and reboot emacs.
(add-to-list 'load-path "~/org-html5presentation.el")
(require 'ox-html5presentation)

I did not know how to do Step-2 above
I copy pasted the org-html5presentation.el lisp code into file with name org-html5presentation.el and saved it in some folder and added the path as requested in Step-3.
Nothing has worked so far. I get the error "Cannot open load file :org-html5presentation"
What am I missing here?


texts: How does comint-mode override beginning of line behavior? I want same functionality to eshell

texts:
My Emacs version is 24.5.1.

Comint-mode protects the prompt by somehow defining the beginning of line to start directly after the prompt regex. This works for normal motion commands like move-beginning-of-line and even evil-mode motions. For example I can kill the current input by calling evil-change-whole-line and leave the prompt on the same line intact.

Eshell-mode isn't derived from comint mode, and the C-a shortcut is overriden to eshell-bol, which takes the prompt into consideration. So by using normal Emacs shortcuts most things work, but trying to use the standard commands for movement like move-beginning-of-line yields unexpected results. So by using evil-change-whole-line I kill the whole line, when I only wanted to kill the input.

How does comint-mode protect the prompt and is it possible to implement the same behavior in eshell-mode?

Things I have tried but didn't bear fruit:

comint-line-beginning-position and comint-bolare defined in comint.el, but they aren't called when calling evil-change-whole-line or move-beginning-of-line.
I noticed some references to the inhibit-field-text-motion variable in comint.el. But it is nil in at least shell-mode, which is comint-derived.


texts: Labelling LaTeX sub-equations in org-mode

texts:
How to achieve subequation numbering a,b,etc like https://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics#Subordinate_equation_numbering in org-mode. I tried using the LaTeX snippet as it is and surrounding it with

#+BEGIN_SRC latex

#+END_SRC

No success.

Edit:
org-version 9.2
org-latex-default-packages-alist
Value:
(("AUTO" "inputenc" t
  ("pdflatex"))
 ("T1" "fontenc" t
  ("pdflatex"))
 (#1="" "graphicx" t)
 (#1# "grffile" t)
 (#1# "longtable" nil)
 (#1# "wrapfig" nil)
 (#1# "rotating" nil)
 ("normalem" "ulem" t)
 (#1# "amsmath" t)
 (#1# "textcomp" t)
 (#1# "amssymb" t)
 (#1# "capt-of" nil)
 (#1# "hyperref" nil))
org-version: 9.2 OS: Linux/NixOs
By default the variable org-latex-default-packages-alist
has amsmath. I used just the code provided by @Ian. This is the result for HTML export. https://imgur.com/a/L6HHV7R that I get. PDF export gives the correct result with error mentioned by @NickD.
I found some more resources on amsmath http://ctan.imsc.res.in/info/short-math-guide/. Is it possible to get the correct export in HTML.


texts: Unable to load color "#FFFFFF" (mouse-face)

texts:
Using Emacs 27.1 (mac port, BigSur), I get a strange behavior when I set the mouse face color using an hexadecimal description. Running emacs -Q -l show-bug.el, with show-bug.el being:
(font-lock-mode 0)
(insert  (propertize " CLICK "
             'face '(:foreground "black"
                     :background "light grey")
             'mouse-face '(:foreground "white"
                           :background "orange")))
(insert  (propertize " CLICK "
             'face '(:foreground "#37474F"
                     :background "#ECEFF1")
             'mouse-face '(:foreground "#FFFFFF"
                           :background "#FFAB91")))
(insert "\n")

The two texts are properly rendered but when the mouse hovers the second button, it is not highlighted with the specified color (it becomes white instead). In the meantime, in the *Messages* buffer, I get:
Unable to load color "#FFAB91"
Unable to load color "#FFFFFF"

However, if I switch to the *Messages* before hovering, the text becomes properly highlighted without error reporting. I would like to debug this but I'm not sure where to start.
Update 1 If I call describe-char on the second text, hovering works properly.
Update 2 If the mouse pointer is over the position where the button will appear (after starting emacs), it also works.
Update 3 It has been fixed


texts: How to use underscores as word boundary for moving cursor?

texts:
Python mode annoyingly sets underscore (_) to be part of a word, making editing very tedious.

How can one reset this to Emacs's original behaviour?


texts: How to export from Org mode to HTML excluding all but  content?

texts:
Is there a way to export to HTML from Org mode without the extra content at the top of the document?

For example, is it possible to export only what would be inside the <body> tags and ignore the rest?


texts: Run current line or selection in shell then insert result in Emacs buffer (Acme workflow)

texts:
Given lines like these:

pwd

echo "Hello \
World"

in a buffer, I would like to do the following:

Put the cursor to the first line, then press C-`
Select lines 3-4 then press C-`

to send the line or selection to a shell bash and insert the output in the following line. Ideally, the terminal should be persistent, thus setting variables then reusing them is possible.

I found in Evil mode, I could type !!sh to do 1. and !sh when a region is selected (however this replaces the command with the returned output), but couldn't figure out how to map C-` to !!sh. :.w !sh seems to be closer to what I wanted.

There seems to be an Emacs package run-stuff that offers similar functionality, but I'd rather use ways provided by Vanilla Emacs plus common Emacs packages such as evil-mode, use-package etc.

Ultimately, I'd like to embed an acme-like workflow into Emacs, where I can put a few short commands on an anchored top line, then run them while providing a selected text as input to the said command, and if possible, some other selected text (maybe using multiselect) as options to the command.


texts:
I'm trying to get org-capture and mu4e working together nicely. Org-capture is already correctly set up; I can capture links to source code files with the following template:

(setq org-capture-templates
          '(("t" "Todo" entry (file+headline "" "General To-Dos")
             "** TODO %?\n %i\n %A\n")))

I'd like to capture links to emails in mu4e. I have org-mu4e required, and org-capture-link works as expected in the mu4e message view. Great so far.

Now, I try to use the same template to use org capture an email. This always fails with the error, Capture abort: (args-out-of-range 99) (The number varies; I assume this is a code point, but cannot get it to render as anything other than a fairly opaque number).

Using the debugger, I've traced this error to the following code block in org-capture-fill-template:

  ;; Simple %-escapes
  (goto-char (point-min))
  (while (re-search-forward "%\\([tTuUaliAcxkKInfF]\\)" nil t)
(unless (org-capture-escaped-%)
  (when (and initial (equal (match-string 0) "%i"))
    (save-match-data
      (let* ((lead (buffer-substring
            (point-at-bol) (match-beginning 0))))
    (setq v-i (mapconcat 'identity
                 (org-split-string initial "\n")
                 (concat "\n" lead))))))
  (replace-match (or (eval (intern (concat "v-" (match-string 1)))) "")
         t t)))

As best as I can tell, everything up to replace-match is working perfectly. The error occurs when replace-match tries to replace a template character (using any of the link characters %a, %A, %l) with the captured link to the mu4e message. Instead of correctly doing the replace, args-out-of-range is thrown. Normally, I'd assume there was no correctly set match for replace-match to act on -- but match-string returns a correct match result, as does inspecting the match in the debugger.

I'm using Emacs 24.5.1, Org 8.3.4, and mu4e 0.9.16. I've tried this on two different Macs and a Fedora 22 machine; the behavior is absolutely consistent.


texts: How to display the list of functions in iMenu and collapse/uncollapse functions in angular js file

texts:
I use js2-mode with emacs-prelude, imenu displays the list of functions and I can collapse and uncollapse the functions defined in a regular js file like this

function testFunction1(){
    console.debug("test function");
}

function testFunction2(arg1, arg2){
    console.debug("test function2");
}

It however doesn't work on a angular js file

'use strict';
app.controller('TestController', ['$scope', 'TestService',
    function($scope, TestService){

        function testFunction1(obj) {
            console.debug("Test Function");
        }

        var testVariable = {
            'field1': 'val1',
            'field2': 'val2'
        };

        $scope.scopeFunction1 = function(){
            console.debug("Scope Function ");
       };

       $scope.scopeVar ={
        'field1': 'val1',
        'field2': 'val2'
    };
}]);

It doesn't recognize - testFunction1 or scopeFunction1 as a function, they are not displayed on the iMenu and I couldn't collapse/uncollapse them.
How can we configure emacs for working with angular js files.


texts:
I have an org-mode file that's running around 6,000 lines with a hundred or so top-level headlines. It's started to take around a minute to load or save, and occasionally it sends emacs into the weeds and I have to force-quit it.

Do any of you think this is too big a file to handle practically in org-mode?  Do you have experience with bigger files? Do you experience the same kinds of delays?  Or should I be looking elsewhere for the causes of the slowness, like all the other emacs packages I have installed? Maybe I'm just asking too much of emacs in general.

This is with homebrew emacs 24.4 on Mac OS X Mavericks.


texts: How to make the mouse only change point only when clicked in the same window?

texts:
I want to change the mouse behaviour in Emacs:
When I click between windows (i.e. from one window into another)), I only want to select the new window and not change point. This is the behaviour globally enabled through:
(progn
  (global-set-key [mouse-1] 'mouse-select-window)
  (global-unset-key [down-mouse-1])
  (global-unset-key [drag-mouse-1]))

When I stay with my mouse click in the same window I want Emacs' out-of the box behaviour with moving point and selecting on drag, i.e.
(progn
  (global-set-key [mouse-1] 'mouse-set-point)
  (global-set-key [down-mouse-1]    'mouse-drag-region)
  (global-set-key [drag-mouse-1]    'mouse-set-region))

Is there a standard way to do this? I have tried to provide my own customised function for [mouse-1] but somehow this is not enough.


texts: Are there any tutorials/documentation for lsp-java?

texts:
I have managed to install lsp-java according to their git Readme (https://github.com/emacs-lsp/lsp-java) and created my workspace.

Is there a better way (eg. in form of a documentation or tutorial) to get to known with lsp-java or do I have to try out every single possible command and see what is going to happen?


texts: Find clocking errors in org-mode entries: list/edit all clock entries with duration until next day(s)

texts:
I discovered the excellent org-analyzer tool and used it to analyze my clock entries in Emacs org-mode.
Unfortunately the results are not usable yet, because there are a lot (dozens) of faulty clock entries. Most of them are "over night", so I worked on something in the afternoon, forgot to clock out and then the clock-out was generated the next morning.
My question: how can I get a list of all clock intervals with 2 different dates, e. g.
CLOCK: [2020-07-24 Fri 15:38]--[2020-07-25 Sat 08:38] => 17:00

How can I create a search agenda to list all of them, so that I can fix them manually?  Criteria would be 2 different days like in the example above. (Or is there some other way in Emacs to search all .org files in a directory for such entries and easily edit the faulty lines?)

or is there already a tool for cleaning up such clock entries in org-mode?


texts: Reformat timestamp in org-capture-template

texts:
I cloned such a template

(add-to-list 'org-capture-templates
             '("d" "Diary"
               entry (file "~/ORG/src/diary.org")
               "* %u \n** Log\n\n*** Tasks\n\n** Creating Writing" ;;heading必须要紧跟在\n\n后面.
               :empty-lines 1
               )
             )

It display the timestamp as

[2019-07-09 Tue]
** Log

** Creative Writing

How could re-format the timestamp as

Tue Jul-09


texts: HTML export with Org mode : all CSS specifications in one external file

texts:
I am using org mode to write my personnal website. I use the workflow described in the documentation (cf. https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html) and I therefore have a converter.el file consisting, as in the link given above, of the definition of org-publish-project-alist with the notes and static components. I evaluate the whole buffer and run org-publish-project "org" everytime I want to export my files to HTML.

However, I use my own CSS files to style my webpage. For the moment, my files all have a variant of #+HTML_HEAD: <link rel="stylesheet" href="./css/style.css"/> in their first lines. This is totally functionnal and gives the expected graphical result as it allows me to use my own options. #+STYLE: ... is great too.

However, what I'm looking for is the following : I would like to have simple .org files with only the markup part and a unique "switch file" specifying for each of the .org file what style should be assigned, or more generally what are its options. This way, I would have a total separation between my writings (the .org files) and the configuration (this "switch file" plus the CSS files). I guess this file would have some kind of switch-loop structure (hence its name here) and should be used in convert.el, but I have no idea how to code it.

Anyone have any idea how to program it ? I've tried myself but I'm not really good at elisp. I've also searched the web for similar questions, but all the examples I've found always specify the style in the preamble of .org files... Any advice is welcome !


texts: How to generate inline plot result for ob-clojure?

texts:
Question: How to generate inline plot image result in Org-mode babel clojure src block?

I tried some ways:

First way: use :results file :file "clojure-babel-figure-result.png"

#+BEGIN_SRC clojure :session :results file :file "clojure-babel-figure-result.png" :dir "data/images"
(use '(incanter core stats datasets charts io pdf))

(def my-plot (histogram (sample-normal 1000)))

(save my-plot "clojure-babel-figure-result.png")
;; (view my-plot)
#+END_SRC

#+RESULTS:
[[file:/home/stardiviner/Org/Wiki/Computer Technology/Programming/Emacs/modes/Org-mode/data/images/clojure-babel-figure-result.png]]

The problem is that the generated plot image should be in upper link path. But
it is save to CIDER working directory
/home/stardiviner/clojure-babel-figure-result.png.
or Emacs buffer working directory default-directory in /home/stardiviner/Org/Wiki/Emacs/Org-mode.

Second way: use Clojure code to specify the image path.

#+BEGIN_SRC clojure :session :results file :file "clojure-babel-figure-result.png" :var fname="clojure-babel-figure-result.png"
(use '(incanter core stats datasets charts io pdf))
(import 'java.io.FileOutputStream)

(def output-file (FileOutputStream. fname))

(def my-plot (histogram (sample-normal 1000)))

(save my-plot output-file)

(.close output-file)
;; (view my-plot)
#+END_SRC

#+RESULTS:

I found ob-clojure.el does not use fname header argument variable when I
inspect variable output-file.

Is there a way to let ob-clojure.el change working directory?

I have some ideas:

let ob-clojure.el use babel header argument :dir as working directory.

My environment info:

My Emacs version: 26.0.50
My Org-mode version: 9.0.5

EDIT:

The issue is the generated file save to current working directory
default-directory , not in Org-mode babel block specified ~:dir~ path.

For example:

#+BEGIN_SRC clojure :session :results file :dir "data/images" :var fname="clojure-babel-figure-result.png"
(use '(incanter core stats charts io))
(def my-plot (function-plot sin -10 10))
(save my-plot "clojure-babel-figure-result.png")
my-plot
#+END_SRC

#+RESULTS:
[[file:/home/stardiviner/Org/Wiki/Computer Technology/Programming/Emacs/modes/Org-mode/data/images/#object[org.jfree.chart.JFreeChart 0x49b53c9e "org.jfree.chart.JFreeChart@49b53c9e"]]]

BTW, How to make Org-mode babel generate inline image result with relative path instead of absolute path? Relative path is useful for blog publish etc.


texts: org mode - prevent future repetitive entries from showing up in agenda view

texts: It seems to be obvious but I don't seem to have been able to find an answer yet... I have some repetitive tasks which have a property in the style of SCHEDULED: <2015-05-22 Fri 23:00 .+4d>. However this has the effect of making that task also showing up on the agenda view of May 26, May 30... etc. etc., which clutters up the agenda view significantly. I notice that scheduled entries with habit style don't behave like this, however I don't want to make all repetitive tasks into habit. There must be a way to prevent future occurrences of repetitive tasks(Both DEADLINE and SCHEDULED) from showing up on calendar prematurely?


texts: `wrong type argument: number-or-marker-p, nil` after upgrading auctex

texts:
After upgrading to auctex-13.0.1 I am getting the error wrong type argument: number-or-marker-p, nil whenever I try to compile a latex document in emacs.
Activating toggle-debug-on-error and issuing C-c c latex in a minimal latex document gives the following output:
Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  TeX-active-master-with-quotes(t t nil t)
  apply(TeX-active-master-with-quotes (t t nil t))
  TeX-command-expand("%`%l%(mode)%' %T")
  TeX-command("LaTeX" TeX-master-file nil)
  TeX-command-master(nil)
  funcall-interactively(TeX-command-master nil)
  call-interactively(TeX-command-master nil nil)
  command-execute(TeX-command-master)

Any ideas what's wrong here?
I'm quite sure it's not the file I'm using. Any minimal document throws the error. For example:
\documentclass{article}

\begin{document}
Hello.
\end{document}


texts: Every time I search for something with swiper, it switches input method to the default one. Is there a way to preserve selected input method for swiper-isearch?


texts: org-agenda-write doesn't respect org-agenda-dim-blocked-tasks

texts:
Running a fresh Emacs session with emacs -Q, I evaluated the following:

(setq org-agenda-files '("~/index.org"))
(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks 'invisible)

where ~/index.org simply contains:

* Project heading
  :PROPERTIES:
  :ORDERED:  t
  :END:
** TODO First subheading
** TODO Second subheading

When I call (org-agenda nil "t") to display the available TODOs, it correctly displays only "First subheading." However, if I then export that buffer with org-agenda-write, then the resulting file contains both "First subheading" and "Second subheading."

What is going on here, and can it be fixed?


texts: How to generate the result file for dot source block and include it with another path in org-mode?

texts:
I'm starting to write blogs with org-mode and org-static-blog,
but now I'm stuck with a problem respecting exporting graphviz dot file to image file.

So I have a code block like this with (setq org-static-blog-publish-directory "/path/to/blog-site-root/") :

#+BEGIN_SRC dot :file /path/to/blog-site-root/images/2018-12-10-vtable.png :exports results
digraph vtable_example {
    // ...
}
#+END_SRC

I want to generate the png while including the image with a relative path ./images/2018-12-10-vtable.png,
M-x org-static-blog-publish generates it but gives me html including the absolute local path, which will be 404 at my blog site.

If I set the header arguments of :exports to none, then even the image file will not be generated.

So how can I let org export/babel generate the file and then include it with another path?


texts:
So I've been trying to learn and use both Emacs and Org-mode for a while and it has been going pretty well but I am certainly a beginner in these topics including Emacs Lisp.

I found this really good-looking org package called org-drill and I've been struggling to get it running. I initially tried what it said in the installation manual, as in changing the org default variables and ticking the box where it says dril... that didn't work. I tried googling for a bit and I figured that maybe I don't have contrib packages installed. I tried doing what was given as the answer here: org-plus-contrib and org with `require` or `use-package`
again, to no avail. I tried manually searching for the package org-plus-contrib and I couldn't find it. In my init.el I have this:

;; ELPA
(setq package-user-dir (concat dotfiles-dir "elpa"))
(require 'package)
(dolist (source '(("melpa" . "http://melpa.org/packages/")
              ("marmalade" . "http://marmalade-repo.org/packages/")
              ("org" . "http://orgmode.org/elpa/")
              ("elpa" . "http://tromey.com/elpa/")))
  (add-to-list 'package-archives source t))
(package-initialize)

So as I said, installing org-plus-contrib doesn't work. Neither does manually searching for it. Is it already installed? Am I missing something? Requiring org-drill in any manner doesn't work either. Do I have to manually include the contrib folder? I tried searching where it is but that didn't work either. I'm just not sure where to look next.
Any suggestions would be brilliant.

Thanks a lot.


texts:
Windows 10, Emacs 25.1 , Magit

I have many git repositories.

Does the notion of the currently selected repository exist in Magit?


texts: org-roam-capture; Problem with saving the file

texts:
i try to use org-roam-capture with Firefox and Chrome on Linux Kubuntu 18.04 with Emacs 26.3.
here is my config:
(require 'org-roam)
(define-key org-roam-mode-map (kbd "C-c r b") #'org-roam-switch-to-buffer)
(define-key org-roam-mode-map (kbd "C-c r d") #'org-roam-dailies-date)
(define-key org-roam-mode-map (kbd "C-c r f") #'org-roam-find-file)
(define-key org-roam-mode-map (kbd "C-c r g") #'org-roam-graph-show)
(define-key org-mode-map (kbd "C-c r i") #'org-roam-insert)
(define-key org-roam-mode-map (kbd "C-c r r") #'org-roam)
(define-key org-roam-mode-map (kbd "C-c r t") #'org-roam-buffer-toggle-display)

(global-set-key (kbd "C-c C") 'org-roam-capture)

(setq org-roam-directory "/home/held/org-roam/")
(setq org-agenda-files (directory-files-recursively org-roam-directory "\.org$"))
(setq org-roam-encrypt-files nil)
(setq org-roam-link-title-format "R:%s")
(setq org-roam-tag-sources '(prop all-directories))
(setq org-roam-tag-sort t)

(with-eval-after-load 'org-roam
  (with-eval-after-load 'company
    (with-eval-after-load 'org
      (require 'company-org-roam)
      (push 'company-org-roam company-backends)
      (require 'org-roam-protocol)
      )))

(org-roam-mode +1)

Here is the bookmarklet from Firefox (simple copied from documentation):
javascript:location.href = 'org-protocol://roam-ref?template=r&ref=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title)

The following is going wrong.

Starting the bookmarklet starts Emacs.
a buffer opens with name: "~/org-protocol:/roam-ref?template=r&ref=https%3A%2F%2Fwww.salz-helmreich.de%2Fkontakt&title=Online%20Kontaktformular"
usually the org-capture keys should be available : C-c C-c  or C-c C-k

but nothing...

If i save the buffer with C-x C-s the following message pops up:
Directory ‘/home/held/org-protocol:/’ does not exist; create? (y or n)

Very strange.
It should save inside org-roam directory, right?
What is going wrong?


texts:
I use emacs on different boxes and I want to share some files between them.
The canonical examples would be gnus-startup-file and remember-data-file.

I can set the files to remote locations (like, e.g., /sds@myserver:~/.newsrc) and tramp would take care of that.
However, myserver is not always available and I don't want my gnus to freeze when myserver goes down.

The behavior I want is local files which are synced to a remote location every now and then.

For now I do it from gnus-before-startup-hook/gnus-after-exiting-gnus-hook and midnight-hook, but I was wondering what would others suggest.

PS. Note that these files aren't on the same exalted level as, say, .emacs (which is kept under hg), so I do not want to preserve their history.


texts: Is it possible to have ruled lines in emacs? I would like to have the same look of a notebook while writing my org files.


texts: function to reshape a 1-column buffer list into N-columns with align-regexp

texts:
I wanted to display a list of strings in the emacs completing-read style, which displays a list of completion strings in a nicely aligned multi-column display. But I could not find an easy answer or example on the web.

For example, tracing the source of describe-function I ended up in C code. (I used ESC-x describe-function "table-" TAB TAB to show a multi-column display.

I came across this SO posting on align-regexp, which was useful, but it only spoke about keyboard macros. I needed an elisp function for use in code.

In the end I wrote my own function to do the job, after hours spent learning about align-regexp and doing experiments with various args. It always feels like I took too much time to learn something so simple, when I look at the final code. Anyhow, I post my answer here in case someone else can use it one day.

The problem I want to solve is to take a 1-column list of strings in a buffer, like this:

one
two
one
three
four
three
five
xix
boxy

and turn it into 2 or more aligned columns like this

one   two
one   three
four  three
five  xix
boxy

or this

one    two   one
three  four  three
five   xix   boxy

It would be nice to space out the columns to fill the buffer width better, but that's a separate problem.


texts:
I am trying to see image as a text but when I compile this program in Emacs it freezes.
Is the problem in Emacs when showing images as text? My Python code is right below.
import requests as req
import re
img = req.get('https://imgs.xkcd.com/comics/python.png')
print(img._content)

I also run this program in Emacs shell (M-x shell), it's working incredibly slower than gnome-terminal (but not freezes). Why does it happen? Is there a way to increase the speed like normal terminal.
Emacs version 26.3
OS:Ubuntu 24.04/Linux


texts: Capture deadline timestamp based on date in agenda view?

texts:
I want to capture things with a deadline timestamp relative to the date that is open in my agenda view.  How can I do that?

The %T template inserts today's date.  I want a template that queries my agenda view for the date and uses that instead.


texts: How can I do a regex search recursively from a directory?

texts:
Basically I want a command that can do the following:

find /path/dir -type f -print0 | xargs -0 grep -l "foo"

Is there an emacs command to do this? If not, then is there a convenient keybinding that I can make? I tried to do the following:

(global-set-key (kbd "C-f") 'find)
(defun find (dir string)
  (interactive)
  (shell)
  (insert "find")
  (insert dir)
  (insert "-type f -print0 | xargs -0 grep -l")
  (insert string)
)

But it doesn't seem to work. It gives me "wrong type argument: commandp, find".


texts: Match data clobbered by buffer modification hooks in tex files

texts:
I run into the error Match data clobbered by buffer modification hooks when editing tex files. The way to reproduce is as follows.

In terminal,

cd
mkdir tèst/
cd tèst/
touch test.tex
echo "\input ./universalMacros.tex\n\proof\n% some comment\n\nbye" > test.tex
emacs -Q test.tex

In emacs, use M-: to execute the following

(progn (re-search-forward "proof") (replace-match "prf"))

Then the error appears.

In fact, if the file contains a comment, and is saved, then this error appears, but if the file is modified but not saved, or if the file has no comments, then no error appears when doing replace-match.

Moreover, I tried (setq CHANGE-HOOK nil) where CHANGE-HOOK runs through before-change-functions, after-change-functions and first-change-hook, and the error is still there.

However, if I run

(let ((inhibit-modification-hooks t)) (progn (re-search-forward "proof") (replace-match "prf")))

then there is no error. So I suppose there are some modification hooks that I miss that are related to font-locks. But I am not sure how to resolve the problem.

Note: this error only appears if the path to the file contains strange characters, which makes it even more bizarre.

EDIT:
The error message I received is

Debugger entered--Lisp error: (error "Match data clobbered by buffer modification hooks")
  replace-match("prf")
  (progn (re-search-forward "proof") (replace-match "prf"))
  eval((progn (re-search-forward "proof") (replace-match "prf")) nil)
  eval-expression((progn (re-search-forward "proof") (replace-match "prf")) nil nil 127)
  funcall-interactively(eval-expression (progn (re-search-forward "proof") (replace-match "prf")) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

As seen from the error message, this is from replace-match so I don't think this is related to re-search-forward. (I tried to call it like (re-search-forward "proof" nil t) and the error still happens.

If I left out some detail, then please tell me, and I will provide it. Thanks.

Any help or comment is sincerely appreciated; thanks in advance.


texts: Programatically go to next compilation error

texts:
When I am refactoring code, I often need to make the same change in my files.  My current workflow is often something like this:

M-x grep for foo.bar.baz
Go to first hit
M-x replace-string RET foo.bar RET foo
Go to next hit
Repeat previous two lines until no more hits

Keyboard macros and M-p can help with this, but I tried to write a function to do all the replacements in a simple command: M-x my-replace-grep-hits RET foo.bar RET foo.

I am having trouble figuring out how to actually get to the file with the error.  It seems that

      (compilation-next-file 1)
      (compile-goto-error)

should do what I want, but I get an error that the buffer is read-only, so clearly compile-goto-error is not changing the buffer when I call it programatically.

What do I need to do?


texts: Split helm window in different directions

texts:
I'd like helm-buffers-list to split my window horizontally, but I'd like for all other Helm functions to split it vertically.

Is this possible?


texts: convert regular compilation-mode output to inline view

texts:
It would be nice to show the info, warnings and errors from a regular compilation-mode buffer inline in the source code.

I checked to see if flycheck supports this but it appears no. Writing a custom backend would amount to re-writing the compilation mode regexp checkers, per language, which is sub-optimal, see https://www.flycheck.org/en/27/_downloads/flycheck.html#Syntax-checker-definitions

Has anybody written, or considered writing, a flycheck backend or independent minor mode that overlays compilation-mode information onto the source ? This might amount to a "Parsing structured output" backend for flycheck that would work for all languages that have a regular compilation-mode.


texts: Sexp-diff like mode for elisp source diffing

texts:
diff-mode shows differences by lines. I'm looking for a mode that could show a diff knowing that the diffed files are elisp sources, so they are full of sexps and therefore more specialized diff highlight could be used.

Is there a mode to show a diff between two sexps or better between two files that are elisp sources?

Example of what I have in mind, instead of the usual:

- (unless foo bar baz)
+ (when (foo bar) baz)

structural diff:

(+when+-unless- +(+foo bar+)+ baz)


texts: set `all-the-icons-dired` to use consistent directory icon?

texts:
I installed all-the-icons-dired package from melpa, however, it does not use consistent icons for directories. Some directories have their own special icon. Example, these are two directories:

The .dartServer icon above is a standard directory icon, however, Desktop uses a special icon.

I prefer the standard directory icon for all directories. How can I do that?


texts: Include vendor's tags for ruby-mode and ggtags

texts:
I'm trying to install and configure the ggtags package. Primarily, I use it for a ruby on rails projects (enh-ruby-mode).

I can generate ctags including all vendor's files for my project with the following command:

ctags -R --languages=ruby --exclude=.git --exclude=log . $(bundle list --paths)

How can I configure ggtags package to achieve the same thing?

I use OS X, with installed exuberant-ctags and pygments plugins.

I think, I need to add some settings to ~/.globalrc or to the project root's gtags.conf, but I don't know the settings.


texts: Insert and strip helpful comments from vc commit message buffer

texts:
When I run hg commit (or git commit, same difference...) from the command line without supplying a commit message it pops up an emacs buffer with the following contents:

.
.
HG: Enter commit message.  Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
HG: --
HG: user: Myself <me@example.com>
HG: branch 'default'
HG: changed filename

But when I use Emacs' C-x v v the message buffer is empty.

How can I have the vc message buffer pre-populated with useful information, but have it stripped out of the final message before commit?

It doesn't have to be the message that mercurial (or git) supplies. In fact, in the case above I would prefer if a diffstat were included.


texts: How to search for any unicode octal character in a buffer?

texts:
I'm looking for a way to locate all unicode octal characters in a buffer such as \344 and replace them with ä or \353 with ë, etc.

At the least if I could just locate octal characters using incremental search or a REGEXP search, I could manually replace them.


texts: How to stop "completing-read" / "ivy-completing-read" from sorting?

texts:
Recently, when using Ivy and calling completing-read,
my output is being sorted (instead of showing up in the order passed in).

How can I prevent sorting the input to completing-read when using Ivy?


texts: Emacs daemon preventing correct operation of saveplace

texts:
Writes to saveplace are not persisting after the emacs daemon stops.

Saveplace is configured in my init file as:

;; saveplace remembers your location in a file when saving files
(use-package saveplace
  :config
  (setq save-place-file (expand-file-name "saveplace" savefile-dir))
  ;; activate it for all buffers
  (save-place-mode t))

I'm using systemd for the emacs daemon:

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=simple
ExecStart=/usr/bin/emacs --fg-daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

When I run kill-emacs or save-buffers-kill-emacs and then query the contents of saveplace, its contents accurately reflect the last cursor position in each buffer. However, if I then run $ systemctl --user restart emacs, the file reverts to the contents it had before the last emacs session. If I open saveplace in vim and write the file contents before restarting, they persist past the daemon restart. So, I thought it might be an issue with the buffers not flushing, but if I run $ sync saveplace and then restart the daemon, the correct contents do not persist.

What's going wrong here and how do I fix it?


texts:
I want to skip blank region under cursor, so I created this regex:

\s+\w translated to emacs regex [:space:]+[:graph:] but it doesnt match what I want. It matches some random space somewhere!

Whats even worse, regex [:space:]\{1,\}[:graph:] which is exactly same fails completelly without giving me anything.

What I want concretelly:

[cursor]_____some code...

I want to get position of the code to be able to jump there with cursor ...

EDIT:
CODE

(trying to enhance code of someone else, just to be clear ...)

(setq custom/separators-regexp
      (concat "\\([\-'\"(){};:,.\\/?!@#%&*+=\]\\)\\|\\(\\[\\)\\|"
              "\\(\\]\\)\\|\\(\\s-\\)\\|\\(\\s_\\)\\|\\(\\`\\)\\|"
              "\\(\\'\\)\\|\\(\\^\\)\\|\\(\n\\)"))

(defun custom/position-normalize-forward (saved-pos my-pos)
  "Normalize position after forward move"
  (if (>= (- my-pos saved-pos) 2)
      (progn
                                        ;going to my-pos
        (goto-char my-pos)
        (if (not (eq my-pos (point-max)))
            (progn
                                        ;also backward-to-separator to fix position
              (custom/backward-symbol))))
    (progn
                                        ;going to my-pos in the usual way
      (goto-char my-pos))))

(defun custom/forward-symbol ()
  "Move to the next separator like in the every NORMAL editor"
  (interactive "^")
  (let ((saved-pos (point))
        (my-pos (re-search-forward custom/separators-regexp))
        (my-pos2 (re-search-forward "[:space:]+[:graph:]")))
    (if (> my-pos2 my-pos)
        (progn
          (message "POS %s %s" my-pos2 my-pos)
          (goto-char my-pos2)
          (return)))
    (if (eq my-pos 1)
        (progn
          (goto-char (+ my-pos 1))
          (setf my-pos (re-search-forward custom/separators-regexp))
          (custom/position-normalize-forward saved-pos my-pos))
      (custom/position-normalize-forward saved-pos my-pos))))


texts: How do I efficiently copy or move elements from one vector to another?

texts:
I'm working on optimizing some Emacs Lisp code that I've written. Part of this code needs to move elements from one vector to another. Currently, I have this code:

(defun copy-elements (source source-begin source-end
                      destination destination-begin)
  "Copy elements from SOURCE to DESTINATION.

We start at SOURCE[SOURCE-BEGIN], and the last element copied is
SOURCE[SOURCE-END - 1].

These elements are copied beginning at DESTINATION[DESTINATION-BEGIN].
This means DESTINATION must have enough space.

This method returns DESTINATION, and does not modify SOURCE.

If SOURCE and DESTINATION are the same, overlapping could cause issues."
  (dotimes (i (- source-end source-begin))
    (setf (seq-elt destination (+ i destination-begin))
          (seq-elt source (+ source-begin i))))
  destination)

This works fine:

ELISP> (let ((v1 [1 2 3]) (v2 [4 5 6])) (copy-elements v1 0 1 v2 2) (list v1 v2))
([1 2 3]
 [4 5 1])

But it's not as efficient as it could be. Even though we know we're working on consecutive elements, we move each one separately.

Is there a way to move or copy these elements? I don't need to share structure, so copying them would be perfectly fine if that's more efficient.

In fns.c, the function copy-sequence uses the C function memcpy to move things around vectors, but I don't see a way to do that myself.

What can I do to speed up moving consecutive elements from one vector to another?


texts: Load custom highlighting after colorscheme change

texts:
I am a Vim user and i recently decided to try Emacs Spacemacs, i have a problem setting up custom highlighting, i set some lines like the following in my .spacemacs (i guess it's the same problem in your .emacs):
(set-face-background 'font-lock-comment-face nil)

The idea is to always disable the background highlighting of "commented areas" but it has a problem, it works fine when starting Emacs but changing the theme resets it (the new theme overwrites it).
There is the same problem in Vim which is easily fixed by loading the custom colors after a theme has been loaded :
autocmd ColorScheme * call LoadMyCustomHighlighting()
How do you translate that in elisp?

Note:
I found what seems to be a similar question here but it don't understand it (elisp noob), i would want some actual working code with a basic explanation.


texts:
I am very new to emacs so it would be a big help if answers came with a lot of detail.

I've tried to get my M-x shell to run python 3 but can't. I've tried:

(setq python-shell-interpreter
      "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6")

and also adding this location to ~/.emacs but neither have worked. I have python 3.6 installed and running in terminal but can't get it running in the M-x shell.  I'm using a mac.


texts: How do I find the variable or lisp code controlling a face at a particular column?

texts: For the longest time I have been ignoring a face change at column 80 in my Java code.  The text switches to a pinkish color as shown below.  Now it is sufficiently bothersome that I would like to chase down the cause and fix it to essentially match fill mode column (I use 100, the Google Android convention).  My first question is: is this particular face change controlled by a variable or by elisp code?  Simple searching (within Emacs and external) and experimenting does not reveal the culprit.  My second question, and the more difficult (I believe), is: given a piece of text in Emacs using different faces, how do I find the origin of the font-lock expression controlling that text?


texts: Capture text after an OR group in Emacs Lisp

texts:
Say I want to match the a character "h a" or "f a". So capture all the a that are preceded by an h or an f.

I tried the following :

1) \(h\|f\) \\(a\\)

but it doesn't work. the problem appears to be with the the OR group, if I do

2) h \\(a\\) the a in the string h a is captured.

Does anyone know how to fix my first expression?


texts: why does this function keep updating the same result?

texts:
I am trying to do the following exercice:

  Given a DNA string, compute how many times each nucleotide occurs in the string.

  DNA is represented by an alphabet of the following symbols: 'A', 'C', 'G', and 'T'.

Here is a simple unit test to better understand what's expected:

(ert-deftest count-all-nucleotides-test ()
  (should (equal (sort-pairs (nucleotide-count "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC") #'<)
             '((?A . 20) (?C . 12) (?G . 17) (?T . 21)))))

Here is the function I've written:

(defun nucleotide-count (s)
  "Return the count of nucleotides in S."
  (let ((result '((?A . 0) (?C . 0) (?G . 0) (?T . 0))))
    (seq-reduce
     (lambda (result c)
       (let ((count (cdr (assoc c result))))
         (if (equal c nil)
             (error (format "Invalid nucleotide %c" c))
           (setf (cdr (assoc c result)) (1+ count)))
         result))
     s
     result)))

This seems to work... but only once. It seems the function re-uses the previous alist and updates it but I don't understand why:

ELISP> (nucleotide-count "ACGT")
((65 . 1)
 (67 . 1)
 (71 . 1)
 (84 . 1))

ELISP> (nucleotide-count "ACGT")
((65 . 2)
 (67 . 2)
 (71 . 2)
 (84 . 2))

ELISP> (nucleotide-count "ACGT")
((65 . 3)
 (67 . 3)
 (71 . 3)
 (84 . 3))

Why is that?


texts: cannot connect through TRAMP to university server

texts:
I have 2 university server I can connect to and I set up the config files in the ~/.ssh directory to connect to them just by using an alias.

Until 1 or 2 days ago both of them were working fine but now I cannot connect to one of them through TRAMP (I still can connect fine using the terminal).

The following is the tramp log, it seems the initial connection get established but then something happen that doesn't allow it to go further.

Linux access.chaos-cluster.uni.lux 3.2.0-4-amd64 unknown
18:05:38 up 199 days, 23:06,  3 users,  load average: 0.06, 0.05, 0.05
[01;32m0 [36;1m18:05:38[0m [0;37username[0m@[4;36maccess[0m([1mchaos-cluster[0m)[0;31m[0m[0;32m (master #)[0m [34;1m~[0m $
18:06:37.592257 tramp-process-sentinel (5) # Sentinel called: `#<process *tramp/ssh chaos-cluster*>' `killed
'
18:06:37.607714 tramp-process-actions (1) # File error: Timeout reached, see buffer `*tramp/ssh chaos-cluster*' for details
18:07:07.641803 tramp-maybe-open-connection (3) # Opening connection for chaos-cluster using ssh...failed
18:07:07.642873 tramp-get-remote-stat (5) # Finding a suitable `stat' command
18:07:07.643063 tramp-file-name-handler (1) # Suppress received in operation (file-attributes /ssh:chaos-cluster:/userpath)
18:07:07.643464 tramp-get-test-command (5) # Finding a suitable `test' command
18:07:07.643625 tramp-file-name-handler (1) # Suppress received in operation (file-readable-p /ssh:chaos-cluster:/userpath)

I have searched for solution on internet but I didn't find solutions for similar situations.
Does anybody knows what it could be?

Thanks in advance!

P.S. I am using spacemacs on emacs 24.5.1 and debian testing.


texts: AUCTeX does not recognize texlive installation

texts:
I am running Emacs 25 on Kubuntu 17.10.

I have a texlive installation in:

  /home/user/texlive/2017/bin/x86_64-linux

echo $PATH produces:

  /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/user/texlive/2017/bin/x86_64-linux

But out of this, /home/user/texlive/2017/bin/x86_64slinux was added by hand in my ~/.zshrc.

So, I added the following line to my ~/.emacs:

(setenv "PATH" (concat (getenv "PATH") ":/home/user/texlive/2017/bin/x86_64-linux")

Now, (getenv "PATH") shows the full path as mentioned above.

And yet when I try to compile a .tex file using C-c C-a, it produces an error:

  AUCTeX cannot find a working TeX distribution.

What is happening? How do I get AUCTeX to compile?


texts:
I'm using using AUCTeX to write a IEEEtrans LaTeX document with a seperate BibTeX file.

As I recall I used to simply hit C-c C-c (currently bound to TeX-command-master) repeatedly until it said "view" in the minibuffer, and then AUCTeX would have taken care of running pdflatex and bibtex as needed.

I've now moved to a new machine - Still same OS (Linux Mint 17.1) and same ~/.emacs (I keep it on github, but rely on el-get for e.g. AUCTeX)

To my surprise AUCTeX doesn't pick up changes in bibtex file, but simply runs LaTeX and then View. Any suggestions as to why it doesn't realize the need to run BibTeX?

Some details:
(Please ask if you need more)

OS: Linux Mint 17.1 x64_64
Emacs: GNU Emacs 24.3.1, from apt-get
AUCTeX: from el-get, tag: release_11_88, commit: 5178ba6

Files, after Clean All:

.
├── bib
│   └── paper.bib
└── paper.tex

Files if I call LaTeX, BibTex, LaTeX, LaTeX:

.
├── bib
│   └── paper.bib
├── paper.aux
├── paper.bbl
├── paper.blg
├── paper.log
├── paper.pdf
└── paper.tex

Contents of paper.tex:

\documentclass[conference]{IEEEtran}
\begin{document}
\cite{ref}
\bibliographystyle{IEEEtran}
\bibliography{IEEEabrv,bib/paper}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

Contents of bib/paper.bib:

@electronic{ref,
  author        = "Someone",
  title         = "Sometitle",
  url           = "http://test.com",
  year          = "2000"
}


texts: Use multiple `:mode` arguments with use-package

texts:
I'm trying out use-package - the docs say the argument to the :mode keyword "can be a cons cell, a list, or just a string."  However, I'm not sure how to make a cons cell or list work.  Here's an example:

(use-package markdown-mode
  :mode (list "\\.markdown\\'" "\\.md\\'"))

With that in my init-file, I get this error:

Wrong type argument: listp, list

Is that saying a list doesn't pass the listp test?


texts: How to use concat to get the path in .dir-locals.el with flycheck-clang-include-path

texts:
I am using the following content to include headers to my project using .dir-locals.el

((c++-mode .
   ((flycheck-clang-language-standard . "c++14")
    (flycheck-clang-include-path
     "/Users/user/Documents/project_name/source"
     "/Users/user/Documents/project_name/source/library/include")
    )))

But, I do not want to explicit tell the path when it is located on my computer.

I was trying to use (concat (file-name-directory (or load-file-name buffer-file-name)) "library/include") for .../source/library/include and just (file-name-directory (or load-file-name buffer-file-name) for .../source. Since .dir-locals.el is located in /Users/user/Documents/project_name/source

However when I replace the part with its respective instructions I got

Error while checking syntax automatically: (error "Value (\"/Users/user/Documents/project_name/source" (eval concat (file-name-directory (or load-file-name buffer-file-name)) \"library/include\") of flycheck-clang-include-path for option \"-I\" is not a list of strings")

I tried to use it with eval but did not work, How can I accomplish my goal?

EDIT: I test using eval as db48x suggested as the following:

((c++-mode .
    ((flycheck-clang-language-standard . "c++14")
    (eval .
        (setq flycheck-clang-include-path
            '("/Users/user/Documents/project_name/source"
         "/Users/user/Documents/project_name/source/library/include"))
        )
    )
))

That worked fine, but when adding replacing the second path with (concat (file-name-directory (or load-file-name buffer-file-name)) "library/include") got that it is not a list of string.


texts: Collapse src blocks in org-mode by default

texts:
When I open an org file, I want all the src blocks to start collapsed and stay that way until I explicitly org-cycle them.

I can't find any variable to control this behavior. Perhaps I'm overlooking something? Or maybe someone has an elisp solution?


texts: How to automatically change TODO priority in Org-mode based on number of days to a deadline?

texts:
Is there a way to automatically specify a TODO items' priority based on the number of days to a given deadline?
For example, if the deadline for the TODO is <2021-01-22 Fri>, I would like the priority set automatically to [#C], then on Fri 8th Jan 2021 the priority would be automatically set to [#B], and finally on Fri 15th Jan 2021 the priority is set to [#A].


texts: Correct web-mode syntax-highlighting in org-mode src blocks

texts:
When adding source blocks in a org-mode document (usually with the shortcut <s TAB), it usually works fine, but specifically with web-mode, if I edit any snippet with the special editor (C-c-'), it also works fine, but once I close emacs and reopen it again, the syntax highlight of "embedded" web-mode source snippets doesn't work correctly.

It seems that just after editing the source code with the special editor, the syntax highlight is correctly copied to the org file, but once I re-edit directly the snippet or I restart emacs it only highlights the javascript parts.

In my case, this piece of code:

#+BEGIN_SRC web
  <!doctype html>

#+END_SRC

only has highlighted const, element and getElementById. Everything else is just white (even root has also lost his highlighting).

Of course, I have org-src-fontify-natively set.

Is there any solution to this?

PD: If it is worth to note, I'm using the purcell's emacs configuration. The only personal configuration added by me that has something to do with org-mode or web-mode is:

(require 'web-mode)

(defun my-web-mode-hook ()
  "Web mode personalization."
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-code-indent-offset 2)
  (setq web-mode-indent-style 2)
  (setq web-mode-comment-style 2)
  (setq web-mode-style-padding 1)
  (setq web-mode-script-padding 1)
  (setq web-mode-block-padding 0)

  (setq web-mode-enable-css-colorization t)
  (setq web-mode-enable-current-element-highlight t)
  (setq web-mode-enable-current-column-highlight t)

  (setq web-mode-enable-auto-pairing t)
  (setq web-mode-enable-auto-closing t)
  (setq web-mode-enable-auto-expanding t)
  (setq web-mode-enable-auto-quoting t)

  (setq web-mode-enable-engine-detection t)

  (if (equal web-mode-content-type "javascript")
      (web-mode-set-content-type "jsx")
    (message "now set to: %s" web-mode-content-type)))

(add-hook 'web-mode-hook 'my-web-mode-hook)
(setq org-src-fontify-natively t)

But I don't think my configuration has something to do with the problem because the special editor works perfectly as I said.

PD2: web-mode's auto-indentation or other features doesn't work either unless I open the special editor, but that's fine to me. I only need the highlighting works as expected.


texts:
Emacs 26.1, Windows 10

If I want to show all lines content text in one line I use command occur

M-x occur text_to_find

Nice. It's work fine.

But how I can use occurif text to find is on 2 lines?

E.g.:

aaa bb cccc
test this text_to_find hello how I your?
result is very good
ddd eee ffff

So I need to show all lines content the next text (in 2 lines)

text_to_find

result


texts: Emacs doesn't seem to recognize .emacs.d on the latest Windows Insider Preview

texts:
I was able to use Emacs normally on Windows until the latest update to Build 17711.rs_prerelease.180703-1539. Now, whenever I start Emacs, it just shows the default welcome page, even though .emacs.d is still present in my home folder with all the spacemacs configurations in it. It seems that it's just ignoring .emacs.d altogether. I wonder if this has something to do with some changes introduced in this update.

If I change .spacemacs to .emacs, Emacs does seem to pick it up and apply some settings (e.g. the variable-pitch font specification). However, it apparently still can't use .emacs.d properly and still shows the default welcome page.

Maybe it has something to do with the folder name which contains two dots. Is there a way to configure Emacs to look for a folder with a different name to .emacs.d?

Emacs: 25.3.1 (x86_64-w64-mingw32) from Emacs-w64 project
System: Windows 10 Pro Insider Preview Build 17711.rs_prerelease.180703-1539


texts: script to Ediff two files in running gui Emacs?

texts:
I'm putting together a presentation that involves some live demos in the terminal. In one of the demos, I run a shell script that takes an input file, runs it through an Awk script, and generates a transformed output file. After doing so, I'd like to display the diff between the input and output files.

Ediff is perfect for this, since it colors the diff and I can navigate easily with n and p. However, I've only been using a gui Emacs. If I start ediff in terminal emacs, the coloring seems to be absent, and other things are just wonky, since I've been gui-centric in my configuration.

I'd like to have the shell script focus a running gui Emacs and run ediff on the two files. I'm on macOS, and I have a shell script that uses applescript to focus Emacs, but I don't know of a way it could tell Emacs to evaluate an expression.

My current workaround is to add a keybinding in my init.el that will launch the desired ediff session, and have my script simply launch/focus Emacs. Then it's up to me to hit the keybinding.

The demo shell script looks like:

#!/usr/bin/env bash

input=/path/to/input
output=/path/to/output

awk_script=/path/to/awk_script

awk -f "$awk_script" "$input" > "$output"

e

The e script launches/focuses emacs. It can be seen here, but the gist of it is:

osascript -e "tell application \"$emacs_app\" to activate"

And in my init.el, I've added:

(defun ivan-demo-ediff ()
  (interactive)
  (ediff-files "/path/to/input"
               "/path/to/output"))

(global-set-key [f2] #'ivan-demo-ediff)

Is there a better way to do this?


texts:
I am installing Emacs 24.5.0, and I want to install it with X. I am on Fedora. the configuration script cannot find any x-toolkit. How do I find out which one is good for me, and in which folder do I find it?

Somewhere I have read that the x-toolkit for fedora should be gtk. How can I check if and where this library is installed?


texts: Launch term in command-line-default-directory

texts:
Currently, I have following key binding defined in my init.el:

(global-set-key (kbd "C-c C-SPC")
                (lambda()
                    (interactive)
                    (term (getenv "SHELL"))))

As it is easy to see, it executes the term command with my default shell.

The terminal is open with pwd equal to default-directory, which by default corresponds to the directory of the file I'm currently editing.

What I would like to do is be able to open it in command-line-default-directory. That's, in the directory from which I launched Emacs. However, I don't want to change default-directory variable, because it's behavior is ok for me for any other purpose.


texts: Modify the first element of the kill-ring

texts:
I have stored in my clipboard a path to an image, which I want to paste inside emacs.
I would like to modify the path to change/postpone/prepone some stuff before yanking.
Following my previous question here, I tried
  (defun replace-in-string (what with in)
   (replace-regexp-in-string (regexp-quote what) with in nil 'literal))
  (defun paste-image-link ()
     (interactive)
     (let ((tmp  (car kill-ring))))
     (setq tmp (replace-in-string  "E:\\Dropbox\\JULIEN\\01.Emacs"
                             "../.."
                             tmp))
     (setq tmp (concat "[[file:" tmp "]]"))
     (setq kill-ring  (cons tmp (cdr kill-ring)))
     (yank)
     )
   (global-set-key (kbd "M-i")  'paste-image-link)

My goal is to change the absolute path to a relative path and add [[file: before.
For example, this :
E:\Dropbox\JULIEN\01.Emacs\02.Emacs screenshots\2021-04-04_02-23-12_vivaldi.png

should become :
[[file:../..\02.Emacs screenshots\2021-04-04_02-23-12_vivaldi.png]]

I am obviously making trivial mistakes about let and setqstatements because I get instead :
[[file:[[file:[[file:[[file:[[file:[[file:[[file:(car kill-ring)]]]]]]]]]]]]]]

and the number of [[file:before is growing each time i try
what should I do ?
Addendum : besides i would like to add a line before to finally get
#+ATTR_ORG: :width 300px
[[file:../..\02.Emacs screenshots\2021-04-04_02-23-12_vivaldi.png]]


texts: Orgmode html export: how to include equation cross references?

texts:
According to my reading of the documentation, something like this should work in my org file:
#+NAME: eq:one
\[
x^2+y^2=z^2
\]

You can see, by considering equation [[eq:one]] that a sum of squares...

But it doesn't.  I'm getting an error saying: Unable to resolve link: "eq:one".  In fact, I'm trying to use several links in this file, but none of them are working, so clearly I'm missing something here.
I believe MathJax allows the usual LaTeX \label and \eqref constructs, but so far I haven't had much luck with them either.
I'm moving from PDF to HTML-based material (all the better for accessibility), and the org file was created by applying pandoc to my original LaTeX file.  This has worked before, and I'm quite happy to spend time touching up the org file to ensure a smooth conversion to HTML. But I've never had to wrestle with internal cross-references before.
Thank you!


texts: I have my idle timer which saves the current buffer automatically just once when idle for three seconds. It's handy but when I stop typing while in helm, it opens up a prompt that asks me where to save the helm buffer, since it's not an already existing text file. And I don't want to save helm buffers in the first place. I want this behavior to stop, i.e. I'd like this idle timer to work only in org-mode. How can I do this?


texts: Scan error: "Unbalanced parentheses" in fresh emacs installations, without config files

texts:
When I start emacs and run M-x up-list in the initial buffer (the about Emacs buffer, in fundamental mode) I get Scan error: "Unbalanced parentheses". If I move the mark to the end of the buffer, the error gives the character range 1057, 1057 Again, this is not really a buffer of parenthesized expressions, and there certainly aren't any dangling parens at the end.
I'm on an OSX machine, running emacs 27.2 I've tried starting emacs with -nw -Q --debug-init. I've tried the same experiment in another buffer. If I instead go to the initial scratch buffer, both M-x up-list or M-x down-list give the same error. I presume it's not just these two commands, these are the handful I used as tests.
I don't think it should matter, but (I believe) I've also moved and renamed my .emacs file and my .emacs.d directory, so neither of these should be relevant.
I've tried uninstalling and reinstalling emacs via Homebrew, and tried enabling both the standard emacs formula and the emacs-mac port.
Why is the reader saying my parens are unbalanced, and how do I resolve this? What could be causing this? I can M-x down-list into a set of parens, but editing around when the reader thinks my parens are unbalanced would be very annoying.
I still don't know the actual /cause/ or /explanation/ of the problem. But the workaround solution was to uninstall, to re-reinstall, and reboot my system. It would still be nice to know how I might have resolved this without needing to reinstall or reboot my system.


texts: Shift+Up isn't recognized by Emacs in a terminal

texts:
Very often I use Shift+Up/Down to select a region in Emacs. It works fine in GUI mode, but when emacs is invoked with -nw option I can select lines only with Shift+Down. The Shift+Up doesn't work, I get this error message in the minibuffer:

<select> is undefined

How can I solve this issue?


texts: Is there a good way to see accumulated time over several org files using org-mode time tracking?

texts: I use org-mode for time tracking and can calculate the overall time with C-c C-x d. Is there a good way to show total time spent over several org-mode files (I tend to have separate projects in separate files)?


texts:
I am using Emacs Org Mode to manage a todo list. Is it possible to use Emacs to manage my calendar?

I will need it to integrate with my Nextcloud calendar. And it would be great if it can integrate with my todo list in Org Mode.

If this is already answered in a way a newbie like me can understand, please just point me to it. I looked up a few sources/ answers but could not make anything of them.


texts: emacs 26 orgmode on win10 can not find jupyter

texts:
I am using emacs26(GNU Emacs 26.3 (build 1, x86_64-w64-mingw32)) on win10. I can run jupyter command from shell. but when I run below code:

#+BEGIN_SRC ipython :session test :results output
print("tester")
#+END_SRC

error happen:

Searching for program: No such file or directory, jupyter

what's wrong with my config?


texts:
As an evil I choose to use tabs.
I'm having trouble getting them to work like they do in other editors.

I want displayed tabs aligned to 2 columns (with no exceptions).

I have tab-width set to 2, but when tabs begin on an odd column they become 3 columns wide. Standard editors align to the next tab stop so in this case they become only 1 column wide (which is what I want).

Examples (where 'T+' is a tab with 2 chars, and 'x' is an ordinary character):

xxT+xx // same alignment on emacs and standard editors.
xT++xx // emacs.
xTxx   // standard editors. (This is what I'm after)

How do I achieve this (preferably globally, but primarily for C/C++/bash/text).

Note: This question is entirely about the display of existing tabs.


texts: Can cursor's background color will be always be the cell's text color?

texts:
iTerm has an option called Smart box cursor color in its setting.

Smart cursor color
When selected, a block cursor will be displayed in reverse video. If
this would result in confusion, then a different color is chosen that
will be most visible given the surrounding cells' background colors.
Cursor's background color will be always be the cell's text color,
while cursor's text color will always be the cell's background color
(usually black).

=> Is it possible to have this dynamic color sheme (cursor's background color will be always be the cell's text color) for cursor within emacs?


texts: How to avoid annoying `auto-fill` behaviour in `c-mode` comment?

texts:
Recently I write quite a lot comments for c/c++ files. I use auto-fill-mode for comment auto format. But I found a quite annoying problem: whenever I input SPC at the end of a comment line, the cursor just sticks to the end of the last word in the line, as the screenshot shows below:

Strangely, this only happens in block style /**/ comment. If I use line comment //, auto-fill won't prevent cursor from moving:

Since I made the screenshot with emacs -q, I am sure this is the default behaviour of auto-fill-mode with emacs 26.2. Can anyone tell me how to prevent such annoying default behaviour?


texts:
I would like to build a shell command using elisp and then printing the result so it is stored in a #+RESULTS block and from there execute that result block as a shell command still inside the org-mode document.

How do I achieve that?


texts: Fixing keybindings of Emacs inside Putty on Windows

texts:
I have regularly tried, over the years, to run emacs through putty to get rid of the need to install a local X server. I remember the putty+emacs combination being abysmal in the past; and right now it seems slightly better but still outright unusable.

For example, even after applying all configurations from https://www.emacswiki.org/emacs/PuTTY (setting to SCO emulation, etc.), many keys still do not get sent to emacs work (e.g., Shift-Arrow, Ctrl-Arrow, Ctrl-PageUp/Down etc.). That page is from 2014, though.

Has someone had good results in a current(ish) PuTTY (0.65, which is from 2015, but the changelog displays only minor bugfixes and security changes since then) with GNU emacs (24.5.1 in my case, but the problems seem to occur long before they actually reach emacs...). Or is it still hopeless?

EDIT: I am aware of Emacs being available as a native windows executable; I have used that; also Tramp, or running an X server on the Windows machine. This question is geared toward the specific situation of being forced to start it in this specific terminal program (which seems to be quite standard in the Windows world) on a remote machine (Unix, of course), for whatever reasons out of my control.

EDIT^2: I don't see how I can get much more specific. I named a few commonplace key combinations that do not work; I would suspect/hope that anybody who regularly uses Emacs over Putty would be able to give a quick "situational update" like "it kind of works, but better learn to only use Ctrl/Alt+[a-z] keys instead of any 'modern' key" or "if you set option XYZ in Putty and option ABC in Emacs, 99% of all combinations work". I'll interpret "no answer" as "let go of all hope".


texts: Can I split emacs the window 4 ways (vertically and horizontally) in a 4 grid layout with different files in each?

texts: I just started using emacs and since I have been using Sublime Text for a while, I am used to the four-grid-layout with 4 windows stacked horizontally and vertically. I have been able to split the screen horizontally only. How do I split it 4 ways?


texts:
While yas-snippet itself loads, the snippets do not. I tried loading them manually and using the following in my init, but neither loads any snippets. What could be the issue?

(require 'yasnippet)
(setq yas-snippet-dirs
      '("~/.emacs.d/snippets"                 ;; personal snippets
        ))
(yas-global-mode 1)

UPDATE:

Removing

(setq yas-snippet-dirs
      '("~/.emacs.d/snippets"                 ;; personal snippets
        ))

fixed the problem.


texts: How do I let ert know where my tests are defined?

texts:
What I'm doing:

If I define a test like:

(ert-deftest tmp-test ()
  "failing test"
  :expected-result :failed
  (should (eql (+ 1 0) 2)))

and then I run

M-x ert-run-tests-automatically ;; with selector t

My cursor jumps to the *ert* test buffer and I can view the failing test

f tmp-test
    failing test
    (ert-test-failed
     ((should
       (eql
        (+ 1 0)
        2))
      :form
      (eql 1 2)
      :value nil))

However when I move my cursor over the "tmp-test" link and press enter instead of switching windows/buffers and jumping the cursor to the test definition like I assume should happen I see the message
"Don't know where 'tmp-test' is defined" printed in the minibuffer.

Question:

How do I tell ert where to find my test definitions?


texts:
This matches nothing:
    Query replace regexp (default \.org.+  → ): \.org.+$  →

The same without '$' matches incompletely:

I'd like to be able to match \.org and all that follows.


texts: Magit - How to expand all and collapse all sections in magit-status

texts:
Pressing TAB on a single unstaged file shows or hides details pertaining to that file.

How do I show & hide (toggle) details of all unstaged files at once?

I did come across outline-hide-sublevels via M-x. But I would like to know a key combination to do this in a toggle fashion.

I also typed ? to check the keybinding shortcuts for the magit-status area but could not find an answer.


texts: Auto adjust window width based on number of windows?

texts:
If i run C-x 3, when emacs  starts  up it will split window and creates two windows of  equal size like this

Now i run  C-x 3 again it  will split current window  into two parts resulting  in this

But whenver i  create a vertical split, i want to auto adjust width of each window to equal size like this.

How can  i achieve this?


texts: How to avoid make  in org-agenda view limited to current buffer to open a new view on buffer?

texts:
I started using org-agenda-view limited to current buffer to get a kinda of a outline of the current file (using < Buffer, subtree/region restriction)

Works great in that it splits the window in 2 and I have outline in one, full text buffer in other.

What is annyoing though is that when I press enter to jump to TODO item in the agenda view it don't just jump back to the original buffer/view but opens a new one so now I have two views onto the same buffer.

Is there a setting to have it just keep using same buffer ?


texts:
Today I realized something odd that bothers me. Here is a little example of a function I wrote. I am using armadillo, but that is is unimportant. Here, the indentation looks just fine.
float GetE0()
{
    // Calculate E0 according to Kurfess et. al, 2000
    arma::fvec
        E2 {vertex2X - vertex1X, vertex2Y - vertex1Y, vertex2Z - vertex1Z}, E3 {vertex3X - vertex2X, vertex3Y - vertex2Y, vertex3Z - vertex2Z};

    float cosPhi2 = norm_dot(E2,E3);

    return Kurfess_Eq5(cosPhi2);
}

Now, I find the long initialization of E2 and E3 annoying, so I make a line break between the two for better readibility. I also indent my whole buffer.
float GetE0()
{
    // Calculate E0 according to Kurfess et. al, 2000
    arma::fvec
        E2 {vertex2X - vertex1X, vertex2Y - vertex1Y, vertex2Z - vertex1Z},
        E3 {vertex3X - vertex2X, vertex3Y - vertex2Y, vertex3Z - vertex2Z};

        float cosPhi2 = norm_dot(E2,E3);

        return Kurfess_Eq5(cosPhi2);
}

Now, Emacs indents the float [...] and return statement to the same column as E2, E3. This was not the case in the first example. In my layman's mind the last two statements belong to the same colum as the arma::fvec statement, like it was in the first example.
Is there a way to fix this?
I couldn't find anything specific in the internet yet. Usually, I am using c-style 'stroustrup'. I tried other styles with no succes.
Edit: Sorry, I completely forgot. I am using emacs 25.2.2, I use helm, and a company complete with clang but no package that I can think of modifies the indentations.
Edit2: I also observed the same behavior with the -Q option (emacs -Q), therefore I guess I can rule out that my packages are the causation.
Edit3: Installing emacs 27.1 fixed the issue but this lead me to a follow up question concerning highlighting and indentation.
Example 3: Now, indentation seems to be correct but the highlighting is off (it was before, but the indentation issue was priority).
float GetE0()
{
    // Calculate E0 according to Kurfess et. al, 2000
    arma::fvec
        E2 {vertex2X - vertex1X, vertex2Y - vertex1Y, vertex2Z - vertex1Z},
        E3 {vertex3X - vertex2X, vertex3Y - vertex2Y, vertex3Z - vertex2Z};

    float cosPhi2 = norm_dot(E2,E3);
    return Kurfess_Eq5(cosPhi2);
}

In the above example, Emacs highlights E2 as a variable but E3 is standard text color. When I now change the indentation to Example4:
float GetE0()
{
    // Calculate E0 according to Kurfess et. al, 2000
    arma::fvec

         E2 {vertex2X - vertex1X,
         vertex2Y - vertex1Y,
         vertex2Z - vertex1Z},

         E3 {vertex3X - vertex2X,
             vertex3Y - vertex2Y,
             vertex3Z - vertex2Z};

    float cosPhi2 = norm_dot(E2,E3);
    return Kurfess_Eq5(cosPhi2);
}

You can see, that the indentation of E2 differs from E3.  I believe the different indentation is a result of emacs not recognizing E3 as a variable. Did anyone also observe this?
Here a screenshot for illustration


texts: Change highlight color when window isn't in focus?

texts: I'm using hl-mode as a minor mode for deft. How do I make the highlighted line change color (e.g. to gray) when the deft window isn't the current window, and then back to the default highlight color when the deft window becomes the current window again?


texts: wanderlust: sort threads by newest message in thread

texts: I know I can use C-u S date in the summary view to sort threads in reverse date order, but when I do this Wanderlust uses the date of the first message in the thread instead of the most recent. Sorting by number works the same way. This is unhelpful, because it means an old thread that receives a new reply will not be sorted to the top. Is there a way to get Wanderlust to use the latest date in the thread, highest number in the thread, etc. when sorting?


texts:
"Emacs pretest 26.1.92 is out!" reported a recent email. Are downloads of this available for the Windows platform? Where can I find them?

Files here were last updated on 17 January 2019, so presumably this is not the right place?


texts: Custom keyword list for auto completion M-/?

texts:
I make use of M-/ for auto-completion. Is it possible to supply a custom list of frequently used keywords (e.g. for a niche programming language) to be loaded at Emacs startup?
I could save the keywords into a separate file, and opening this file (together with the file I want to edit) will enable auto-completion of these keywords, but it's inconvenient if I have to do this every time I start Emacs.


texts:
The key combination is used in Emacs to mark from the point to the end of the line (navigation with shift selection), but a box is overriding that making it unusable.

I have been working in another station with Fedora 24, and the problem doesn't show, so it seems to be derived from Fedora 25 (the version of Emacs is the same in both stations).

Here is a sample of the box (right after the box appears it has the @ symbol):

Another sample, once the box is showing, if I type anything:

Alternatively, once the box is showing, if I do ctrl+x then I get:

In order to solve the problem, it is needed to know what the box is, and I think I prove that right, because unsuccessfully spent many hours "googling" for something I don't know how to name or describe, the GUI doesn't show a gloss, apologies for my ignorance.


texts: Change font color on a =org-reveal= slide

texts:
I'm preparing a set of lectures using =org-reveal=. I found really useful to change the background to add exercise to the slides, e.g.,

** EXERCISE
:PROPERTIES:
:reveal_background: ./images/Thinker-30.png
:reveal_background_trans: slide
:END:
Using the analogy with the river, prove the Gauß' theorem in:
- Cartesian coordinates,
- Cylindrical coordinates, and
- Spherical coordinates.

but the result is not very visible....

Question:

Is it possible to change the font color for this slide?


texts: org-mode source block: conditional header

texts:
How can I modify the header of a source block dynamically, based on the backend used to export my org-mode document? Specifically, I want the header to include :results output html when the file is exported to HTML, and :results output latex when the file is exported to LaTeX.
I believe that I should use the org-export-current-backend variable to achieve this, but I have been unable to write a header that does what I need.
For example, I think I could include an if call in the header. Unfortunately, this example triggers the HTML build correctly but not the LaTeX one (I can successfully export to LaTeX by inverting the if conditional):
#+begin_src emacs-lisp :exports both :results output (if (eq org-export-current-backend 'html) html latex)

(if (eq org-export-current-backend 'html)
  (princ "

Green tea

Black tea

")
  (princ "\\begin{itemize}\n\\item Green tea\n\\item Black tea\n\\end{itemize}"))

#+end_src