texts: How to make all variables and functions of a mode visible without activating the mode

texts:
Let's say I want to customize a keybind for a mode that hasn't been loaded yet like so:

(define-key eshell-mode-map (kbd "C-M-i") 'eshell-previous-input)

But the problem is if I haven't yet loaded eshell I get this error:
Debugger entered--Lisp error: (void-variable eshell-mode-map)

How would I make the keymap visible without opting for the mode-hook eshell-mode-hook?
Are there multiple ways of achieving this?
If so, what is the standard way of doing so (loading files to make variables/functions/keymaps visible)?

Also, what would the implications be if I decided to load the file manually as opposed to using a mode-hook?


texts: "no match" error after `M-x package-install` on a package

texts:
I want to install https://github.com/syohex/emacs-helm-gtags, and here is the installation instruction:

  helm-gtags is available on MELPA and MELPA stable

  You can install helm-gtags with the following command.

M-x package-install [RET] helm-gtags [RET]

But after M-x package-install [RET] helm-gtags [RET], I got "no match".

How shall I solve this problem? Thanks.

update:

1) Running M-x package-refresh-contents [RET] will stay at "Contacting host: elpa.gnu.org:80" forever, so doesn't seem to solve the problem. Why doesn't finish running?

2) Even without waiting for "Contacting host: elpa.gnu.org:80"  to go away, running package-install on helm-gtags still results in "no match".

3) Do I need to add the repository of helm-gtags somewhere, and what is its repository?


texts: It should be nice to write yasnippets, which ask for filepath interactively using helm, predefining starting directory should be fine too.


texts: Spacemacs org-mode python session plotting problem

texts:
I have been using org-mode with R in Spacemacs for a while now with no issue.

I'm moving my workflow from R to Python.

Jupyter notebooks (EIN) works great, but I prefer org-mode:

Normal (non-plot) blocks work well enough, but Emacs hangs when I try to plot using sessions (I can get it to plot if I don't use sessions).

I get a message that says, executing Python code block... that remains until I escape with C-g.

Here is an example of a function that won't print:

#+BEGIN_SRC python :session *Python*
import glob
from pandas import DataFrame, Series
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.plotting import register_matplotlib_converters
register_matplotlib_converters()
import seaborn as sns
plt.rcParams["figure.figsize"] = (15, 10)
sns.set()
#+END_SRC

#+BEGIN_SRC python :session *Python* :results output drawer
units.pivot_table('A', 'B', 'C', aggfunc=len).fillna(0).plot()
fig=plt.figure(figsize=(6,4))
plt.savefig('test.png')
'test.png'
#+END_SRC

I really want to use org-mode instead of notebooks.  Any idea what I need to correct to make it work?


texts:
You can use org-agenda-prefix-format to have the effort shown for each TODO headline:

(setq org-agenda-custom-commands
      '(("c" "My TODOs"
         ((tags-todo "mytag"
                     ((org-agenda-prefix-format " %6e ")))))))

Which shows something like:

       TODO Some patent task
[0:30] ..TODO Some sub-task
[0:30] ..TODO Some other sub-task

Unlike a clocktable the effort of the sub-tasks is not summed up for the parent task. I would like it to look like this:

[1:00] TODO Some patent task
[0:30] ..TODO Some sub-task
[0:30] ..TODO Some other sub-task

Looking at the documentation for org-agenda-prefix-format shows nothing similar to %e that also does summing, but there is a generic %(expression), with no explanation.

What %(expression) would give me output like the above?


texts: How to assign new keybinding to Ctrl-i but keep Tab key unchanged?

texts:
I want to give a new key binding to Ctrl-i, but when I do that TAB key also maps to the new key binding that I have assigned to Ctrl-i.

=> Is there any way to give a new keybinding to Ctrl-i and keep TAB's key as unchanged?


texts: Separation between paragraphs when exporting to PDF from org-mode

texts:
I use org-mode basically for handling TODO lists and taking notes.
Some time ago, I wrote some documentation using markdown-mode and exported to PDF using pandoc.

Now I am trying to export to PDF from org-mode. I basically write the org-mode file and use org-latex-export-to-pdf function.

I have this org-mode file:

When I export it I get something like this:

How can I get more separation space between paragraphs?


texts: Trying to enable keybindings for 'outshine': "set before outline-mode is loaded"

texts:
I'm just getting started with outshine, and I'm trying to enable outshine's keybindings, but I am stumped by the directive in the readme to

  ...set the outshine prefix (M-#) in your init file before (!) outline-mode is loaded to enable the outshine keybindings

I don't know how to know when outline-mode is loaded. It's a built-in mode, so I don't mention it in my dotemacs:

(require 'outshine)
(setq outline-minor-mode-prefix "\M-#")
(setq outshine-use-speed-commands t)
(add-hook 'outline-minor-mode-hook 'outshine-hook-function)
(add-hook 'emacs-lisp-mode-hook 'outline-minor-mode)
(add-hook 'LaTeX-mode-hook 'outline-minor-mode)
(add-hook 'text-mode-hook 'outline-minor-mode)

I'm also not sure if fixing this issue will create the situation I'm hoping for. The outshine readme says that outshine uses functionality from outline-magic.el, where subtrees can be moved with M-up and M-down (as in org-mode). That's what I'm hoping for.


texts: How to make org-export give more messages when it fails

texts:
When I tried to org-export to html file, this message showed up in Messages or minibuffer:

htmlize-color-to-rgb: Wrong type argument: stringp, 3

nothing more.

Actually another message showed up before this one:

org-html-table-cell: Args out of range: [left right right], 3

I remember an abnormal place about my table in this file, so I can just search string for the position.

But this org file contains more than 1000 lines and I don't have clue where and what(even though it mentioned rgb) is going wrong so it is really hard to check page by page manually.

org-export-to-html function works successfully for my another org file, failed for this one, but I think it should give more than just one sentence without even mentioning which line causes an error.

So is there any variable to turn on for more verbose messages if org-export fails?


texts: spacemacs auto-complete layer: showing the difference between a snippet and a dictionary word

texts:
Say, I have been using Spacemacs for a while now, and was looking at Spacevim a bit. One nice feature of Spacevim is that it's autocompletion feature includes both the words for completion as well as snippets. So if I am in latex mode, the completion dropdown will display both potential completion text as well as snippet text.

I have include a picture of this below.

I was wondering if there is a feature like this in Spacemacs or emacs? I know that Spacemacs seems to use company.el for completion, but was not sure if I could switch to a different completion package and if that would solve the problem? Would something from helm be able to provide this?


texts:
display-buffer-reuse-frames tells Emacs to re-use frames for displaying buffers.   However, as of 24.3 this variable is obsolete (emphasis mine):

  display-buffer-reuse-frames is a variable defined in window.el.
  Its value is t
  Original value was nil

  This variable is obsolete since 24.3;
    use a reusable-frames alist entry in display-buffer-alist.

  Documentation:
  Non-nil means display-buffer should reuse frames.
  If the buffer in question is already displayed in a frame, raise
  that frame.

I understand that I am supposed to replace that variable with display-buffer-alist.  I'm familiar with the latter, and use it at many different places in my configuration, but nonetheless this docstring is a mystery to me.

What entry exactly do I need to add to display-buffer-alist to replicate this variable?  IOW, what entry do I need to add to display-buffer-alist to make Emacs reuse frames for all buffers, while still using the default display actions?

And please, dear Emacs developers, write less hand-wavy docstrings for obsolete options…


texts: Go to body after url-retrieve-synchronously

texts:
I use url-retrieve-synchronously to download a JSON file from a remote server.  This function returns a buffer which contains the entire content of the response, including HTTP headers.  However, I'm just interested in the body.

Now, short of parsing a HTTP response manually, how can I jump to the beginning of the body?  I have found the variable url-http-end-of-headers, which works, but it's not documented at all, and using it feels “dirty”.  Is there a proper API for this purpose?


texts: 1 single custom command to compile and run executable

texts:
In my emacs init file, I have this:

(add-hook 'c++-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (concat "g++ " buffer-file-name))))

Then, say I have a c++ file called: test.cpp. I just need to do M-x compile, Emacs would do : g++ test.cpp automatically.

Now, to run the executable, I would need to do: M-x shell, then ./a.out to run the program.

Is there a way to create a command that tells Emacs to do M-x compile then run the executable?

Additionally, how would one change so that M-x compile will give appropriate executable name? For example, if I have test.cpp, then I want it to do: g++ test.cpp -o test instead.

Please help and thank you


texts: C-x 3 open a new buffer to the left of the current buffer

texts:
When strike C-x 3, a new window and buffer will open to the right of the current buffer.

How could set it open to the left of the current?


texts: Bind self-insert-command in sparse keymap

texts:
I have a sparse keymap with suppress-keymap set as a parent:
(setq km (make-sparse-keymap))
(setq skm (make-keymap))
(suppress-keymap skm t)
(set-keymap-parent km skm)
(add-to-list 'emulation-mode-map-alists (list (cons t km)))

Desired behavior is to have a limited set of keys bound to self-insert-command (insert a key character in current position), and others to be suppressed.
I can achieve this with an anonymous function (first line below) but binding self-insert-command directly throws is undefined message when key is pressed (second line below).
(define-key km (kbd "a") (lambda () (interactive) (insert "a"))) ;; works
(define-key km (kbd "b") #'self-insert-command) ;; throws "b is undefined"

Why binding of self-insert-command is suppressed in this example?


texts: Avoiding warnings of undefined functions while compiling

texts:
I have a lot of code in my init file like this:
(when library-is-available
  ;; Code that use that uses functions from library
)

However, I get warnings that the functions that I am using are not known to be defined.
What is an easy way to avoid these warnings?
Can I perhaps ignore these code parts and not include them in the compiled file?


texts:
I have a function that executes save-excursion from within an Org Agenda buffer, but it doesn't return the point to the agenda buffer once the body of the excursion finishes executing. Here is the function I call:

(defun link-headline-from-agenda ()
  "From an agenda window, link the corresponding headline to the selected file."
  (interactive)
  (save-excursion
    (org-agenda-goto)
    (link-headline)))

Is there a way to make save-excursion work as expected or get similar behavior inside an org agenda buffer?


texts: I want to generate an Excel spreadsheet programmatically from an Org document. Any tips on how to markup colored text? I understand that Org does not natively support color markup, wondering if there's something else I can use just so I can translate it later to Excel formatting.


texts: How to write a custom find-file function

texts:
I want to write a set of functions that call specific files, not by a specific name, but the newest file (with a certain suffix) in the directory. So far I've got

(defun org_lisp_dir ()
  (interactive)
  (switch-to-buffer (find-file-noselect "~/org/babeltest/c.org"))

but that doesn't get me the latest .org file. To do this I believe I need to use something like (eshell/ls something), but I'm not sure how to use (eshell/ls) or integrate a complex eshell command into my code. The actual command would be something like ls -Art *.org | tail -n 1 which works just fine in eshell, BTW.


texts: Adding a command to latex-match-warning-keywords for tex-mode

texts:
I want the commands \largerpage and \addlines to be displayed in red (font-latex-match-warning-keywords) but cannot figure out how to do this. I found several posts, but non of this seems to work.

This is what I tried:

;; \font-latex-warning-face
(setq font-latex-match-warning-keywords
    '(
        ("addlines" "")
    )
)

 (font-lock-add-keywords nil '(("\\(addlines\\) \\(largerpage\\)"
                                 0
                                 'font-latex-warning-face)))

(font-lock-add-keywords 'latex-mode '(("addlines"
                                            0
                                            'font-latex-warning-face)))

I am using GNU Emacs 24.5.1.


texts: Fontification by AUCTeX is great, but font locking for ConTeXt code, any idea?

texts:
I wasn't sure where to post this question, but I count on the Emax community when it comes to font-locking and fontification.

We all know that AUCTeX is the way to go when writing a document in LaTeX, part of it due to the fontification this mode provides for the default LaTeX macros. But consider this MWE written with ConTeXt:

\setuplayout
  [header=2\lineheight,
   headerdistance=\lineheight]

\setupbackgrounds[header][text][frame=off, bottomframe=on]

\setupheader[style=bold]
\defineframed[headerframed]
             [frame=off,
              align=middle,
              width=fit]
\setupheadertexts[\headerframed{C \\ D}]
\setupheadertexts[\headerframed{A \\ B}][\headerframed{E \\ F}]
\starttext
\input knuth
\stoptext

In ConTeXt the \starttext and \stoptext are the equivalents of \begin{document} and \end{document} commands. Yet, Emacs doesn't show any fontification for many of the commands in ConTeXt. I am using moe-theme.

How to enable that? is there any known package to do that for you? Do I need to setup that manually command by command? If yes, how?


texts:
Suppose I have the following Python script:
def foo(x) -> int:
    y = 2
    return y+x

class Bar:
    def __init__(s):
        self.s = s

    def buz(x, y):
        return x*y

My current Imenu setup is:
(defun my-merge-imenu ()
  (interactive)
  (let ((mode-imenu (imenu-default-create-index-function))
        (custom-imenu (imenu--generic-function imenu-generic-expression)))
    (append ;; mode-imenu
        custom-imenu)))
(defun my-python-imenu-hooks ()
  (interactive)
  (setq imenu-generic-expression
    '(("Functions" "^[[:blank:]]*def \\(.*\\)(.*).*:$" 1)
      ("Classes" "^class \\(.*\\).*:$" 1)))
  (setq imenu-create-index-function 'my-merge-imenu)
  )
(add-hook 'python-mode-hook 'my-python-imenu-hooks)
(add-hook 'lsp-mode-hook 'my-python-imenu-hooks)

This gives the following output from M-x helm-semantic-or-imenu:
Classes / Bar
Functions / foo
Functions / __init__
Functions / buz

What can I do in my setup to get the following output instead:
Functions / foo
Classes / Bar
Functions / Bar::__init__
Functions / Bar::buz


texts: Where would be the most appropriate directory to put my own Emacs-lisp files in Spacemacs?

texts: I want to create an Emacs-lisp file to store my org-mode configuration. This file will be loaded by dotspacemacs/user-config. My question is where would it be the standard directory (if any) where I whould store this file? I was considering .emacs.d/private/local, but I noticed it does not exists in load-path, so I guessed it is not intended for this kind of use. Any suggestions?


texts: Is there a way to determine the face at frame x / y (mouse position)?

texts:
When trying to theme certain modes, it's not possible to place the point on the themed item (e.g. to do C-u C-x =) and identify the face used.

My thought is to use the mouse to identify the face used, but all I can get is the frame x, y position (using (mouse-position))

From there I don't know how to get the face definition at those coords.

Any help is appreciated.


texts: Speed issue with omnisharp go-to-definition

texts:
Getting a rather sizable speed issue with using go-to-definition from omnisharp. Ran the profiler, and received nearly 50% of the cpu time dedicated between:

isearch-printing-char

and

omnisharp-go-to-definition

The former was 9% larger than the latter. Anyone else experience this issue?

Modes I'm currently running on the buffers that are starting the function call:

C#, company, flychec, yas, projectile, ws


texts: How to echo each magit command after each action?

texts:
Although I can use $ to see the command histories, I'd like to see it immediately each time I performed an action.

E.g. Display git push -v origin master\:refs/heads/master after P p.


texts: Setting default-directory does not change find-file directory

texts:
I try to set a default path for opening a file via C-x C-f by adding the following to my .emacs:

(setq default-directory "~/some_dir/")

However, after I launch Emacs in some directory, the find-file directory is always reset to the current working directory when I do C-x C-f.

Is there something else I need to configure to enforce this?


texts:
I've been trying to switch to Ivy from Helm for the past little while. One feature I miss (and because of this I keep helm installed) is the ability to run helm-ag, and then to hit C-c C-e so I can edit the lines in the file that helm-ag matched.

Is there any equivalent functionality with Ivy/Swiper/Projectile/etc.?


texts: Recommended Emacs for ORG-Mode (vanilla, emacs plus, doom, spacemacs)? Getting Things Done (GTD) Method?

texts:
This is just a general question in relation to emacs and it's specific use for ORG mode.
I have always been miserable at planning and organization in daily life (keeping TODO list, general time management), and after having found emacs and org-mode a month ago, I am excited seeing its potential.
Clearly emacs is extremely configurable and everyones situation differs, but does anyone have any advice on a methodology (such as GTD) to follow that has proven successful for you, and flavour of emacs installation is recommended? (I do not have vim experience so I assume spacemacs or doom is not the place to start).


texts:
I'm trying out emacs. With no .emacs file and starting emacs 26.1 with emacs -Q on Debian 10, it takes two seconds for the welcome screen to show up. Before the welcome screen, there is a message "Loading .../00debian.el (source)...done". The "done" part shows up right away; I didn't have to wait for the word "done".

When this disappears, the welcome message shows up. I can press a key to get rid of it but this lag is disorienting.

How do I remove this lag?

Just to make sure the 00debian.el isn't the source of the delay, I deleted the file entirely. Now the message doesn't show up but the lag is still there.


texts:
I'm having an issue when using (org-global-cycle) from a subheading followed by (org-cycle).

For example in the following org file:

* Level 1 Heading 1
** Level 2 Heading 1
** Level 2 Heading 2
*** Level 3 Heading 1
    Test

If the cursor is at *** Level 3 Heading 1{cursor here} and I hit S-<TAB> everything will fold up to * Level 1 Heading 1{cursor here}... properly.  But the if I use <TAB> to view the level 2 headings I instead get:

* Level 1 Heading 1...
*** Level 3 Heading 1{cursor here}
    Test

Any clue what's going on?  I'm running emacs.exe -q with Emacs 24.5.1 and org-mode 8.2.10 when I use -q and 8.3.6 when running with my config.


texts: Reversing the order of letters/characters of a selected region

texts:
How can one reverse the letters/characters in a selected region?

xyz --> zyx

ab cde --> edc ba


texts: Case-insensitive filename completion in `shell-command'

texts:
I know I can get case-insensitive filename completion in the minibuffer using read-file-name-completion-ignore-case, but this doesn't seem to apply to all filename completion in the minibuffer.  Specifically, it doesn't seem to apply when I'm using shell-command. Example:

$ emacs -Q
M-: (setq read-file-name-completion-ignore-case t)
M-! touch /tmp/HelloThere
C-x C-f /tmp/hello<TAB>  <-- this completes to HelloThere, as expected
M-! shell-command<RET>ls /tmp/Hello<TAB>  <-- this completes to HelloThere, as expected
C-g
M-! shell-command<RET>ls /tmp/hello<TAB>   <-- no completion

Is there any way to get whatever is completing /tmp/HelloThere while reading from the minibuffer for a shell-command to respect read-file-name-completion-ignore-case?


texts: Additional Keybinding for RefTeX to add new bibliography entry

texts:
Nowadays I often insert @Online entries into my bibliography files.

Unfortunately, the RefTeX doesn't have the Online-Entry bound to any key by default.

I tried to add something like

;; I often use the "@Online" entry in my bibliographies.
;; Unfurtunately, no key binding was defined by default.  I think C-c
;; C-e C-o would be a good choice and is still unused.
(define-key reftex-mode-map (kbd "C-c C-e C-O") 'bibtex-Online)

Running eval-last-sexp (bound to C-xC-e) gave no error, but said bibtex-Online as expected.

What is my mistake?

EDIT

After having Emacs restarted, the keybinding worked, but unfortunately (again!) not in a buffer with a bibliography file!  I was working on my LaTeX file and when I tried to insert a new environment by pressing C-cC-e, but instead of asking which environment I was about to insert, Emacs waited for the next keypress an ah voilà, after completing the session with C-o Emacs most happily inserted an template for an Online document (@Online{...}) into my LaTeX buffer.  Yet, still, the keybinding didn't work in the bibliography buffer :-(


texts: Emacs + Youtube: workflow for taking timestamped annotations, search within subtitles, etc

texts: Is there any way to be able to take timestamped annotations while watching YouTube videos (and controlling play/pause the video)? On top of that, extra functions like searching within subtitles in YouTube video, to find specific locations, would be a plus. I wonder if somebody has built anything like this.


texts: How do I change the highlighted background color inside the parenthesis?

texts:
I am using pretty much the default theme color however, I do want to change the highlighted background color inside the parenthesis.
Is there any specific Face Attributes setting for this specific case?


texts:
I am using org mode with code blocks to produce my slides via beamer. What I'd like to do is make this into a blog post. This needs more explanatory text. What I'd like to be able to do is export some things when exporting to e.g. html but other things when exporting to beamer. Something like this?

#+EXPORT :beamer
  * Stan uses "burn-in" to initialise.
  * PyMC3 uses ADVI.
#+END
#+EXPORT :html
Variational inference (VI) is a scalable technique for approximate
Bayesian inference. Automatic differentiation variational inference
(ADVI) is a way of automating VI so that all that is needed is the
model and the data.
#+END


texts: *Org Src file.org[ R ]*: C-c ' is undefined

texts:
I'm trying to edit a code snippet in org-mode. When I type C-c ' in org mode buffer, it opens up the editor window in R-mode, but it doesn't know about C-c ' and cannot be killed by C-x k since when I execute that command I get a message in the message buffer:

  Wrong type argument: overlayp, nil

Is there a way to force kill a buffer? Right now I'm restarting Emacs. Is there a faster way? Why is this doing in the first place?

The elisp debugger gives:

Debugger entered--Lisp error: (wrong-type-argument overlayp nil)
  delete-overlay(nil)
  #[nil "\301!\207" [org-edit-src-overlay delete-overlay] 2]()
  kill-buffer("*Org Src notes.org<lec>[ R ]*")
  call-interactively(kill-buffer nil nil)
  command-execute(kill-buffer)

If I try to use org-edit-src-exit I get:

  org-edit-src-exit: This is not a sub-editing buffer, something is wrong


texts: Is it possible to disable the support for the mouse in GUI?

texts:
I can't believe there is no way in Emacs to easily and reliably ignore the mouse but my google fu seems not good enough to find how to do it.

By easily and reliably I mean to disable the device, not unbind the mouse events (which is not reliable as any modes can rebind them).


texts: Emacs Sunrise Commander only with name-size-time display

texts:
Normally two-panes file managers display only three fields per file: the file name, the file size (possibly in human format) and the file modification time. See for example Midnight Commander:

.

As for Emacs Sunrise Commander, we have a lot of info (user, owner, permissions), which  make it inconvenient on a laptop screen and perhaps distracting:

How is is possible to get the standard 3-field layout with Sunrise Commander?


texts: Avoid scheduling tasks in vacation in orgmode

texts:
I recently started using orgmode and I wonder if there is any way to avoid scheduling (or deadlineing) tasks during my week of vacation.
I already found a way to highlight regional holidays (followed by (calendar-mark-holidays).

Now I would like to also highlight my planned vacation or trigger a warning when I schedule a task in the week.

My specific questions would be:

Is it at all possible to achieve something like this?
If possible, how would I have to store (or schedule) my vacation within the org-document(s)?
If possible, how could I ask the orgmode calendar to parse these dates and mark them / trigger a warning?

Let's assume I planned my vacation for one the time period

* Holidays
** Autumn Holiday
   <2019-10-07 Mon> - <2019-10-27 Sun>


texts: How to prevent unwanted characters such as`[OB` and `^[OA` and hanging at bottom or top point on scrolling?

texts:
I am using emacs under iTerm2 on Mac. I am using mouse to scroll up and down. Please not that I haven't face with the issue when I remotely connected into a linux machine, which has exactly same emacs setup.
When I scroll to bottom OBB character is generated and emacs is hangs. When I scroll to top section OAA character is generated and hangs again.
Than emacs crashes/suspends itself and generated following output:
^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OB^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA^[OA
[1]  + 5999 suspended  TERM=xterm-256color emacs -nw -nw --no-site-file --debug-init

=> Another case, when I keep scroll to bottom of the buffer and when the cursor ends up on the bottom, emacs halts. I try to enter character or scroll back nothing happens. In another terminal when I try to close emacs, it gets closed and the characters I already entered would show up on the terminal.
My setup:
(setq fast-but-imprecise-scrolling 't)
(setq jit-lock-defer-time 0)
(setq max-lisp-eval-depth 10000)

(setq echo-keystrokes 0.1
      inhibit-startup-screen t
      initial-major-mode 'emacs-lisp-mode
      uniquify-buffer-name-style 'forward
      mouse-yank-at-point t)

$ ssh -tx4C user@IP zsh -i
$ echo $TERM
xterm-256color
$ emacs -nw file.txt


texts: Clickable links to py.test stack frame lines in compilation-mode

texts:
In compilation-mode, how can I make the default py.test output have clickable links to source code (when using py.test's default formatting of tracebacks)?

Does somebody already have appropriate compilation-error-regexp-alist-alist entries?


texts: Org mode 9.2.6 - Org agenda - match tags/prop/todo query hangs

texts:
After typing a keyword the command just hangs, regardless of the query.

The trace is as follows:

Debugger entered--Lisp error: (quit)
  org-add-prop-inherited("qpct")
  #[257 "\300!\262\301!\207" [copy-sequence org-add-prop-inherited] 3 "\n\n(fn X)"]("qpct")
  mapcar(#[257 "\300!\262\301!\207" [copy-sequence org-add-prop-inherited] 3 "\n\n(fn X)"] ("qpct"))
  org-scan-tags(agenda (lambda (todo tags-list level) (progn (setq org-cached-props nil) (or (and (member "bug" tags-list))))) nil)
  org-tags-view(nil)
  funcall-interactively(org-tags-view nil)
  call-interactively(org-tags-view)
  org-agenda()
  org-agenda-append-agenda()
  funcall-interactively(org-agenda-append-agenda)
  call-interactively(org-agenda-append-agenda nil nil)
  command-execute(org-agenda-append-agenda)

Is anyone facing the same issue?


texts: Adding XUL file syntax highlighting support?

texts:
I am new on Emacs and I am working on modifying firefox interface. XUL is implemented as an XML dialect.

I just need basic syntax highlighting for XUL. I found that VIM and gedit are working out of box. If I change the file extension to .xml, it works perfectly.

Any thoughts?


texts: How to distinguish between TODO and WAIT in org-summary-todo?

texts:
Org-Mode proposes to use the following org-summary-todo function in the org-after-todo-statistics-hook:

(defun org-summary-todo (n-done n-not-done)
  "Switch entry to DONE when all subentries are done, to TODO otherwise."
  (let (org-log-done org-log-states)   ; turn off logging
    (org-todo (if (= n-not-done 0) "DONE" "TODO"))))

Now I have added a WAIT state to the TODO states:

#+SEQ_TODO: TODO WAIT | DONE

But org-summary-todo will mark headlines as TODO although all sub tasks are in WAIT state, which is obviously wrong, because there is nothing to do.

* TODO Tasks [0/2]
** WAIT Bob
** WAIT Alice

How to extend the org-summary-todo function in that way, that headlines are marked with WAIT instead of TODO, when all sub tasks are marked with WAIT?

Is it also possible to extend the brackets tag in that way that it distinguishes between all TODO states and not only done and not done?

If there are mixed states I would prefer the following summary:

* WAIT All others [0/2/2]
** WAIT Bob
** WAIT Alice
* TODO Mixed [1/1/2]
** TODO My job
** WAIT Others job


texts: MELPA no longer works: error in process sentinel: End of file during parsing

texts:
MELPA no longer updates after no changes of mine. With a minimal .emacs of

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

the command M-x package-list-packages (pa-l-) fails with

  error in process sentinel: End of file during parsing

The proxy is set from environment variables: url-proxy-services is

(("https" . "127.0.0.1:8080") ("http" . "127.0.0.1:8080"))

How is this fixed?


texts: How to get scrolling without jumps (by one line) in info mode?

texts:
I'm new to Emacs and trying to learn it using the built-in manuals (tutorial, manual and lisp intro).
I used (setq scroll-step 1) to avoid jumps in the normal mode, yet when viewing info - the scroll is still jumpy.
How do I fix that?


texts:
I start with this:

(setq test (propertize "foobar" 'face 'font-lock-keyword-face))
;;=> #("foobar" 0 6 (face font-lock-keyword-face))
(add-face-text-property 0 3 'font-lock-type-face nil test)
test
;;=>
;; #("foobar"
;;   0 3 (face (font-lock-type-face font-lock-keyword-face))
;;   3 6 (face font-lock-keyword-face))

Now I'd like to remove font-lock-type-face in the whole string,
while preserving font-lock-keyword-face and all other possible
faces.

What's an easy way to do this?


texts: How to show available options with evil-leader? (like spacemacs)

texts:
Spacemacs has a nice ability to show available keys when pressing the leader key.

How can bound leader keys be displayed with evil-leader ?
Or is this only available via a different package?


texts: Creating sparse tree based on two headings underneath an inactive timestamp

texts:
I need help writing a filter for my meeting notes to show the outcomes and actions of todays meetings at the end of the day.
I keep notes of my meetings with an org-capture that produces a structure like this:
* Project name
 * Design meeting                                            :meeting:notes:
  Entered on [2020-06-27 Sat 17:50]
  * Present
    - 0 :: me
    - A :: Alice
    - B :: Bob
  * Notes
    - A: things are going well
    - B: I am delayed because of X
      - A: can we help?
      - B: yes, can you organise Y by D
  * Actions
   * NEW Check progress by Alice on Y
     DEADLINE: <2020-06-28 Sun>
  * Outcomes
    - Bob is delayed
    - Alice can help
    - Need to check if we can rescue the schedule

The sparse tree I would like to generate would look like this
* Project name
 * Design meeting                                            :meeting:notes:
  Entered on [2020-06-27 Sat 17:50]
  * Present...
  * Notes...
  * Actions
   * NEW Check progress by Alice on Y
     DEADLINE: <2020-06-28 Sun>
  * Outcomes
    - Bob is delayed
    - Alice can help
    - Need to check if we can rescue the schedule

For all meeting notes of <today>.
How can I write a sparse filter that takes the Entered on timestamp into account? (Do I need to put the timestamp in a property so it propagates to the subheadings?)


texts: Use AucTeX with "latexmk -pvc": jump to errors

texts: Currently, I edit LaTeX files by running latexmk -pvc in the background to generate PDF automatically upon change to be previewed in Evince. However, when there is a syntax error, AucTeX is not able to show it. How can I complete this integration by jumping to errors given by the latexmk process?


texts: Finding and executing org-babel snippets programatically

texts:
I currently I have a couple of org-babel shell snippets to package up a build and push it to a server for later usage. This also handily keeps a reference to the last execution of the snippet so I can remember what was last uploaded and when.

I was thinking I could further automate my process by hooking into compilation-finish-functions to look-up a babel snippet and execute it on successful compilation. What's the best way to organise the babel snippets and call the snippets programmatically? I was wondering if I can use :tags: or if I can just call up the snippet by #+:NAME by searching all my org-agenda-files. I was planning in storing the target babel function in the project's .dir-locals.el.

It would also be nice to mark a snippet as trusted whilst it was unchanged so I didn't need to confirm every execution.


texts: How to toggle Org-mode source code block ":eval no" status

texts:
I often limit or unlimit the evaluation of specific code blocks in org-mode babel using :eval header argument.

Here's an example:

#+BEGIN_SRC emacs-lisp :results value scalar :eval no
(+ 1 1)
#+END_SRC

#+RESULTS:
: 2

I toggle the code blocks between :eval no and :eval n (or delete :eval no completely) by hand.

#+PROPERTY: eval no is convenient, but is not suited for each code block.

Are there any better ways to toggle the :eval status handy, like below?

C-c C-t     (org-todo)
Rotate the TODO state of the current item among
(unmarked) -> TODO -> DONE


texts: Jump to an org agenda clock from an org agenda clock report

texts:
Here's an example Org clock table in Emacs:

#+BEGIN: clocktable :maxlevel 1 :scope file :tcolumns 1 :formula %
#+CAPTION: Clock summary at [2014-03-30 Sun 22:47]
| Headline     |   Time |     % |
|--------------+--------+-------|
| *Total time* | *4:31* | 100.0 |
|--------------+--------+-------|
| Item A       |   1:07 |  24.7 |
| Item B       |   1:06 |  24.4 |
| Item C       |   2:18 |  50.9 |
#+TBLFM: $3='(org-clock-time% @2$2 $2..$2);%.1f
#+END:

Is it possible to move my cursor over Item B and run a command that would take me to Item B's clock? If so, is it possible to do the reverse and jump from the clock to the clock's row in the Org clock table?


texts: Why exec-path doesn't contain /usr/local/bin while /etc/paths already contains it?

texts:
Emacs 24.5.1 on OS X 10.11.1.

This is the content of /etc/paths:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

This is the value of exec-path:

("/usr/bin"
 "/bin"
 "/usr/sbin"
 "/sbin" "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9"
 "/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_9"
 "/Applications/Emacs.app/Contents/MacOS/libexec"
 "/Applications/Emacs.app/Contents/MacOS/bin")

Why doesn't it contain /usr/local/bin?


texts: Referring to the org-babel src block name from within the script

texts:
This is tangentially related to my previous question on dealing with asynchronous babel scripts. Currently I have to manually specify the name of the src block the babel function is in:

#+name: elisp-block-name
#+begin_src emacs-lisp :var src="elisp-block-name"
(format "My src-block is %s" src)
#+end_src

#+RESULTS: elisp-block-name
: My src-block is elisp-block-name

Obviously this is prone to error so it would be nice to generate it programmaticaly. Is there any environment/variables always passed to tangled block that indicates this or do I need to just call some elisp for my :var block?


texts: Add multiple predicates to isearch-filter-predicate

texts:
I wrote a set of predicates to filter matches in my ìsearch-* and query-replace* routines. I also wrote a macro to bind the isearch-filter-predicate variable to multiple predicates:

(defmacro with-ifp-predicates (PREDICATES &rest body)
  (declare (indent 1))
  `(let ((isearch-filter-predicate isearch-filter-predicate))
     (mapcar (lambda (x)
               (add-function :before-while isearch-filter-predicate x))
             ,PREDICATES)
     ,@body))

I use it in my code in this way:

(with-ifp-predicates '(skip-maths skip-comments)
  (query-replace "foo" "bar" nil (point-min) (point-max)))

I tested it and it seems to work but if I enter recursive-edit (C-r) and look at the value (C-h v) of the isearch-filter-predicate variable, I get this:

Is it normal? Is it caused by the :before-while? I chose it because I need a match to be skipped if just one of the predicats is satisfied.


texts:
I am using AucTeX in combination with visual-line-mode but sometimes I find it somewhat confusing that a broken line does not follow the "current indentation" which makes it harder to see environments. In other words a "too long line" is indented by a few characters but the parts which had to be broken start a the left of the buffer.

Is there a way to get automated line breaks where the "broken parts of the lines" have the same indentation?


texts: Defining custom latex class for org-mode export

texts:
I an trying to define a custom latex class, I will use it to export my org files to PDF. I found information about this on internet and I tried to implement the proposed solution, I wrote this in my .emacs:

(with-eval-after-load 'org-latex
(add-to-list 'org-export-latex-classes
   '("org-article"
      "\\documentclass{org-article}
      [NO-DEFAULT-PACKAGES]
      [PACKAGES]
      [EXTRA]"
      ("\\section{%s}" . "\\section*{%s}")
      ("\\subsection{%s}" . "\\subsection*{%s}")
      ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
      ("\\paragraph{%s}" . "\\paragraph*{%s}")
      ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))

So the custom class name is org-article, but when try to export a simple org file using this custom class :

#+LaTeX-CLASS: org-article

Emacs says Unknown LaTex class : 'org-article'.

It seems to me that I did everything right according to the org manual and other users in several forums. So I ask you to help me find what is wrong.


texts:
Since few days I am getting this error but I don't remember changing anything in my configuration. I have dash installed on my system. I was thinking then it needs dash Emacs package, but after installing it nothing has changed.
When I do evaluate the init.el buffer manually, my config runs without a problem.
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "dash")
  require(dash)
  byte-code("\301\302!\210\301\303!\210\10\204\17\0\304 \210\305\306\307\310\311\303%\210\312\313\314\315\311\306\316\317&\7\210\312\320\321\322\316\323\311\306&\7\210\312\324\325\326\316..." [package--initialized require dash package package-initialize custom-declare-group auto-package-update nil "Automatically update Emacs packages." :group custom-declare-variable auto-package-update-interval 7 "Interval in DAYS for automatic package update." :type integer auto-package-update-before-hook 'nil "List of functions to be called before running an a..." hook auto-package-update-after-hook 'nil "List of functions to be called after running an au..." auto-package-update-last-update-day-filename ".last-package-update-day" "Name of the file in which the last update day is g..." string auto-package-update-buffer-name "*package update results*" "Name of the buffer that shows updated packages and..." auto-package-update-delete-old-versions "If not nil, delete old versions directories." boolean auto-package-update-prompt-before-update "Prompt user (y/n) before running auto-package-upda..." auto-package-update-hide-results "If not nil, the result of auto package update in b..."] 8)
  require(auto-package-update nil t)
  (not (require 'auto-package-update nil t))
  (if (not (require 'auto-package-update nil t)) (display-warning 'use-package (format "Cannot load %s" 'auto-package-update) :error) (condition-case err (progn (setq auto-package-update-delete-old-versions t) (setq auto-package-update-hide-results t) t) ((debug error) (funcall use-package--warning1 :config err))))
  (condition-case err (if (not (require 'auto-package-update nil t)) (display-warning 'use-package (format "Cannot load %s" 'auto-package-update) :error) (condition-case err (progn (setq auto-package-update-delete-old-versions t) (setq auto-package-update-hide-results t) t) ((debug error) (funcall use-package--warning1 :config err)))) ((debug error) (funcall use-package--warning1 :catch err)))
  eval-buffer(#<buffer  *load*> nil "/home/siery/.emacs.d/init.el" nil t)  ; Reading at buffer position 1050
  load-with-code-conversion("/home/siery/.emacs.d/init.el" "/home/siery/.emacs.d/init.el" t t)
  load("/home/siery/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1594639ba149>) #f(compiled-function () #<bytecode 0x1594639ba0e1>) t)
  command-line()
  normal-top-level()

Here are the last changes I think I made.


texts: How can I detect compilation-mode is waiting for input

texts:
This often trips me up when building Linux kernels. I'll kick of a compile and after a while I realise it's not completed. What's usually happened is because the default config has changed it's waiting for user input in the compilation window. For example I find the compilation window stalled on the following:

-*- mode: compilation; default-directory: "~/lsrc/kvm/kernel-v8.build/" -*-
Compilation started at Tue Nov 25 10:34:20

cd /home/alex/lsrc/kvm/kernel-v8.build && ARCH=arm64 make -j9
  GEN     ./Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
*
* Restart config...
*
*
* File systems
*
Second extended fs support (EXT2_FS) [Y/n/m/?] y
  Ext2 extended attributes (EXT2_FS_XATTR) [N/y/?] n
  Ext2 execute in place support (EXT2_FS_XIP) [N/y/?] n
Ext3 journalling file system support (EXT3_FS) [Y/n/m/?] y
  Default to 'data=ordered' in ext3 (EXT3_DEFAULTS_TO_ORDERED) [N/y/?] n
  Ext3 extended attributes (EXT3_FS_XATTR) [N/y/?] n
The Extended 4 (ext4) filesystem (EXT4_FS) [Y/n/m/?] y
  Ext4 POSIX Access Control Lists (EXT4_FS_POSIX_ACL) [N/y/?] n
  Ext4 Security Labels (EXT4_FS_SECURITY) [N/y/?] n
  EXT4 debugging support (EXT4_DEBUG) [N/y/?] n
JBD (ext3) debugging support (JBD_DEBUG) [N/y/?] n
JBD2 (ext4) debugging support (JBD2_DEBUG) [N/y/?] n
Reiserfs support (REISERFS_FS) [N/m/y/?] n
JFS filesystem support (JFS_FS) [N/m/y/?] n
XFS filesystem support (XFS_FS) [N/m/y/?] n
GFS2 file system support (GFS2_FS) [N/m/y/?] n
Btrfs filesystem support (BTRFS_FS) [N/m/y/?] n
NILFS2 file system support (NILFS2_FS) [N/m/y/?] n
Dnotify support (DNOTIFY) [Y/n/?] y
Inotify support for userspace (INOTIFY_USER) [Y/n/?] y
Filesystem wide access notification (FANOTIFY) [Y/n/?] y
  fanotify permissions checking (FANOTIFY_ACCESS_PERMISSIONS) [Y/n/?] y
Quota support (QUOTA) [N/y/?] n
Kernel automounter version 4 support (also supports v3) (AUTOFS4_FS) [N/m/y/?] n
FUSE (Filesystem in Userspace) support (FUSE_FS) [Y/n/m/?] y
  Character device in Userspace support (CUSE) [Y/n/m/?] y
Overlay filesystem support (OVERLAY_FS) [N/m/y/?] (NEW)

It would be useful if I could detect this programatically so I could flag a notification in my mode-line. Any idea how I could detect this?


texts:
I was learning magit and found this screenshot at Command to visit Github pull request of current branch with Magit:

I was wondering why we have Rebase and Push (and not just Push) at the top. What would be the difference in pushing vs rebasing in this instance?
Thanks!


texts: `expand-env: ((yas-indent-line 'fixed))` ignored

texts:
I have the following in a snippet's header

expand-env: ((yas-indent-line 'fixed))

...but when I attempt to insert the snippet, I still get a lot of unwanted indentation.

What else can I do to prevent such indentation?

I'm using version 20161022.646 of yasnippet, and version 25.1.1 of Emacs.


texts:
I created a custom keyboard layout (using ukelele) where I use F1-F4 as dead keys to input pinyin (accents for tones). Is there a way to get it to work in emacs?

I tried the (require 'iso-transl) but that doesn't help (not sure if it is supposed to).


texts: Switch from Dired to Wdired rename file and directory errors when using "-F" or "--classify" ls switch regex help

texts:
If you set -F or --classify in the dired-actual-switches then it places a / at the end of directory names and * at the end of executables. When you finish renaming the files, these characters are taken literally so every directory it will try to move it inside of itself if it was renamed.

Of note, I have recently switched to emacs 27 head, so I can't remember if this happened in Emacs 26.1 or not when switching.

I tried to use this hacky solution to remove --classify from dired-actual-switches but it doesn't seem to work. Is there a better to do this? Maybe wrapping an advice around wdired instead of using the hooks might be better but not sure how to do that.

(defvar-local jj/dired-classify-enabled nil)

(add-hook 'wdired-mode-hook
      (lambda ()
        (if (string-match "--classify " dired-actual-switches)
        (setq jj/dired-classify-enabled t))
        (setq dired-actual-switches
          (if (string-match "--classify " dired-actual-switches)
              (replace-match "" t t dired-actual-switches)))))

(add-hook 'dired-mode-hook
      (lambda ()
        (cond ((eq jj/dired-classify-enabled t)
           (setq jj/dired-classify-enabled nil)
           (setq dired-actual-switches
             (if (string-match "-a " dired-actual-switches)
                 (replace-match "-a --classify" t t dired-actual-switches)))))))

Edit: I noticed the above works to remove the --classify when entering wdired-mode but I have to call revert-buffer to get it to update properly. I tried putting revert-buffer in the wdired-mode-hook but then I got errors.

Edit2:I've figured out how to do this with defadvice. I'd greatly appreciate someones help with using emacs regex functions and syntax. If someone can modify my answer below for a version using regex instead of just removing --classify and readding it that would be great and I will accept your answer.

Edit2: Root on my mac seems to not recognize --classify but only -F, so if using root for dired best to change the script to use -F instead of --classify. This could be due to an old version of gnutils ls on the system that is possibly fixed in newer versions.


texts:
I want correct indentation with my C++ code.

The following piece of code indents properly. It nicely indents the access label and the member declaration independently.

class Test : public Base {
 public:
  int a;
};

However if I add a final keyword, the public won't indent half-ways anymore.

class Test final : public Base {
public:
  int a;
};

If I go check with C-c C-s, in the first case the line with public returns ((inclass 1011) (access-label 1011)). But for the second case it returns ((label 1011)). Looks like c++-mode is not able to detect that the second case is also a class definition, not a function definition.

I wonder if I have to do something to c++-mode for it to support C++11 syntax.


texts: Can I define a function/macro in emacs named .?

texts:
I would like to define this function:

(defun . (object method &rest args)
 (apply (plist-get object method) args))

But, not surprisingly I get: if: Dot in wrong context

Not surprising because it looks like a cons cell and isn't. I can use some other character like @ or function name like dot, but it seems like it should be possible to use . too. Is there any way to do something like that?

The application is for a closure that defines a plist of functions, and I want something like a dot notation to access them.

This does work, but the double dot is a little unconventional from what I am used to:

(setq c (let ((counter 0))
      (list :inc (lambda (&optional dx)
               "Increment counter by DX (default=1)."
               (incf counter (or dx 1))))))

(defun .. (object method &rest args)
  (apply (plist-get object method) args))

(.. c :inc)


texts: How to make C-j and return behave like they did pre Emacs 24

texts: C-j used to newline-and-indent, now it doesn't indent anymore, but RET does. Now since I upgraded to Emacs 24 they are swapped. Is there any way to revert this?


texts: Can't download file using helm-find-files?

texts:
Windows 10, Emacs 25.1
I want to download file from http://whatever.com/file.pdf

So I use command helm-find-files (C-x C-f)

Whe I try C-x C-f http://whatever.com/file.pdf , press return , as result Emacs open my browser (Chrome) and Chrome download pdf file.
But I want to download file by Emacs.


texts:
How can I manage with Emacs dired-mode colors?

For example, if I want to make column with file's last modified time and date to be red-colored.


texts:
For some reason certain executables are not being found when I add them to the load patch but others are, while n the same directory. For example I got clang-format under usr/local/bin and I have

(setq exec-path (append exec-path '("/usr/local/bin")))
(require 'clang-format)

This in my init.el. It works just fine.

Now I installed hindent for Haskell (https://github.com/commercialhaskell/hindent) and put the executable hindent also under usr/local/bin.

In the same fashion I put

(setq exec-path (append exec-path '("/usr/local/bin")))
(require 'hindent)

in my init.el.

However when I load Emacs (GUI and shell) I will get "cannot open load file: No such file or directory, hindent".

Has this to do with emacs? I don't see why it would produce an error for the one file but not the other.


texts: What is the reason for this erratic behavior in `time-subtract`?

texts:
I am attempting to calculate some time differences in org time strings using time-subtract.

(time-subtract (org-parse-time-string "2018-04-16 Mon 14:00")
               (org-parse-time-string "2018-04-14 Sat 13:00"))

=> (0 0 1 2)

This seems to make sense. The two times are different by two days and one hour.

(time-subtract (org-parse-time-string "2018-04-16 Mon 14:00")
               (org-parse-time-string "2018-04-11 Wed 18:00"))

=> (-1 65535 999996 5)

This one doesn't come out as neatly. I would expect (0 0 1 5).

Here is the documentation for time-subtract.

time-subtract is a built-in function in ‘C source code’.

(time-subtract A B)

Return the difference between two time values A and B, as a time value.
Use ‘float-time’ to convert the difference into elapsed seconds.
A nil value for either argument stands for the current time.
See ‘current-time-string’ for the various forms of a time value.

If I try float-time on the two examples above, I get 1.000002e-06 and -3.999994078185409e-06, which implies to me that I'm doing something wrong.

The documentation on current-time-string does not appear to be helpful. In particular it does not define the four fields producted by time-subtract.

What is going on here? How can I get a consistent time difference between two org-mode timestamps?


texts: Flycheck: change color / thickness of underline

texts:
Using Flycheck, I get a green thin jagged underline line for style-guide violations, and a red thin jagged underline for syntax errors (see below).

Is it possible to change the thickness or the color of the line? Namely, I'd like the red to be more noticeable upon my grey background. I would prefer if it was light red / pink instead.


texts: I've modified "initial-scratch-message" -- what else must I do to see it effected?

texts:
Using the menu Options-Customize Emacs-Browse Customization Themes, I've modified initial-scratch-message. I saved my customizations; and exited Emacs.

When I re-start Emacs, the initial-scratch-message displays as before; but, if I open my init.el file, I see the changes that I'd saved.  I've tried all manner of options over the past couple of hours to no avail.

Original question:  Is there something that is preventing my customization from taking effect?

Modified question:  More specifically, how can I tell ErgoEmacs to stop overriding my preference?

p.s.
Since originally posting my question, I'm beginning to think that my recent addition of the ErgoEmacs package may be influencing the behavior.  When I start Emacs, I see the "scratch-message" which is originally set in the /etc/emacs*/* libraries.  Since I've included the code in my init.el to always recreate a scratch whenever one is killed, I kill the first Scratch buffer and, upon inspecting the scratch buffer, I have a separate message in my scratch buffer alerting me to using "Control-O" to open a new file (rather than Emacs classical way of C-x C-f).  And each successive generation of scratch has that 2nd message.


texts: Bulk-reverse the order of headers in Emacs org-mode?

texts:
I asked this question on stack overflow, but haven't gotten to solve the problem yet, then I thought I should rather post it here.

Is there a way to bulk-reverse the order of headings in Emacs org-mode?
I'd like to change this kind of list (but much bigger, not just two or three items, thus "bulk"):

* personal computer
 * Windows
 * Mac
 * Linux
* StackExchange
 * stackoverflow
* countries
* people

to this:

* people
* countries
* StackExchange
 * stackoverflow
* personal computer
 * Windows
 * Mac
 * Linux

I just want to reverse the list so that the last heading with its subtrees would be the first heading of a new list, second-last would be the second heading of the new list, and so on.


texts:
I learn the mark-end-of-sentence is handy to select to end of the sentence as handy as C-M-Space which select a word.
from Select to the sentence of line in a shortcut

The function is not bound by default, so I tried kinds of keys permutations.

one option is C-M-s (s for sentence) and C-M corresponding to C-M-Space to select a word, then faild.

(global-set-key (kbd "C-M-s") #'mark-end-of-sentence)

global-set-key (kbd “C-M-s”) 'mark-end-of-sentence

It remind me that M-e move-forward to end of a sentence, then set 'C-M-ewhich cover the original(sp-end-of-sexp &optional ARG)`, still failed.

(global-set-key (kbd "C-M-s") #'mark-end-of-sentence)
Final solution, I set a key sequence randomly.

Take it seriously, what's the rules to bind keys? Two items I could get:

Not conflict with the current important and frequent keys
as semantic as possible to assistance memory.

I am determined passing my emacs.config to the grandsons, how could I play a intelligent role from now?


texts: How do I use global-unset-key for non ASCII characters?

texts:
I am using QWERTZ with Czech layout and to write certain characters like { and } I have to press down option, however in my emacs (using the emacsformacosx version) the option key is bound to the Meta key.
In my ~/.emacs.d/init.el file I added the following lines:
;;; To unset the M-
(global-unset-key (kbd "M-+"))
(global-unset-key (kbd "M-ě"))
(global-unset-key (kbd "M-š"))
(global-unset-key (kbd "M-č"))
(global-unset-key (kbd "M-ř"))
(global-unset-key (kbd "M-ž"))
(global-unset-key (kbd "M-ý"))
(global-unset-key (kbd "M-á"))
(global-unset-key (kbd "M-í"))
(global-unset-key (kbd "M-é"))

however this does not work and I still keep getting the M-<key> is undefined in my buffer.
I tried escaping the characters, but it did not work either, what is the correct approach to unset these key combinations?
Thank you very much


texts: How can I open the current buffer in an alternative editor?

texts: Sometimes it may happen that we would like to open the current buffer in another text editor (notepad, gedit, texmaker, ....). What are the best ways to do it?


texts: Why is emacs saying my theme is undefined?

texts:
I'm pretty new to emacs customization and lisp, so I don't really know how to debug this problem.

I'm trying to install a custom theme. Here's a link to the .el file.

The theme's load-path is set correctly, and it shows up in the M-x customize-themes menu, but when I try to enable it I get this in the echo area:

Undefined Custom theme emerald

Any idea why this is happening? Thanks.


texts:
Step 1

make-toggle-func returns a anonymous function ...

(defun make-toggle-func (book-name repl-name code-file)
  `(function (lambda (x)
           (interactive)

           (setq book-name ,book-name
             repl-name ,repl-name
             code-file ,code-file)

           (toggle-between-book-and-code))))

Step:2

  (fset 'el-toggle (make-toggle-func  "eintr.pdf"
                "*ielm*"
                "ch01-02.el"))

Step: 3

(funcall (symbol-function 'el-toggle))

Error:
I'm getting the following error. Please help?

*** Eval error ***  Invalid function: (function (lambda (x) (interactive) (setq book-name "eintr.pdf" repl-name "*ielm*" code-file "ch01-02.el")))


texts: How to include "titlepage" before the Latex Org Mode document?

texts:
I have a title page that I would like to put before the Org Mode document. Example is below. Right now, I am producing the title page separately and printing it as 2 separate files. It would be nice to have some possibility to include such page within an Org file, before the actual Org Mode output and before the contents.

How?

Example:

\documentclass[12pt,a4paper]{report}
\begin{document}
\begin{titlepage}
\begin{center}
{\Large Companies Act 2012 \par}
\vspace{2cm}
{\Large MEMORANDUM AND ARTICLES OF ASSOCIATION \par}
\vspace{2cm}
OF \par
\vspace{2cm}
{\Large COMPANY LIMITED \par}
\vspace{2cm}
{\large May 18th 2017}
\end{center}
\vfill
Drawn by subscriber:\\
\\
Mr. Rosario Maddox\\
COMPANY LLTD
\end{titlepage}
\end{document}


texts: Force keymap to ignore (kbd ) and [tab] even though TAB is defined

texts:
I found that when I press the tab key, the command I have bound to C-i gets run (somewhat unsurprisingly). I would like to keep this command bound to C-i but run a different one when pressing the tab key. I have found that I can do this within a keymap by defining (kbd <tab>)

Thanks to this Emacs.SE post, I found which keymap is responsible for it and that there is a global binding for tab. The keymap doesn't have (kbd <tab>) bound, but it's translated instead of falling through to the global binding.

How do I get it to fall through?


texts: How to get hungry-delete working in paredit-mode?

texts:
Using hungry-delete is really nice, see this Blog post. But with paredit activated, hungry-delete functions are not triggered.

paredit defines <delete> as paredit-forward-delete and DEL as paredit-backward-delete, while
hungry-delete uses key <delete> for hungry-delete-forward and DEL for hungry-delete-backward

How to get hungry-delete working in paredit-mode with keeping the features of both modes?
(This means the modes should share the DEL and <delete> key)


texts: How do I add a new hideshow block to Python mode?

texts:
I'm using a Python decorator that takes so many arguments it happens to frequently span multiple lines, and so I'd like to configure hs-minor-mode to recognize the decorator lines as a hideable block.

Right now my code looks sorta like this:

@multiline.decorator(arg1, arg2,
    arg3, arg4,
    arg5, arg6)
def fn():
    pass

I want it to look like this after saying hs-hide-all:

@multiline.decorator(arg1, arg2,...
def fn():...

I found the variable hs-block-start-regexp and tweaked its value in the buffer from

\\s-*\\(?:def\\|class\\)\\>

to

\\s-*\\(?:\\(?:def\\|class\\)\\>\\|@\\)

but I'm not seeing any change in behavior.  What am I missing?


texts: Elpy Auto Complete is not working at all

texts:
I am trying to configure my emacs for python programming. Elpy auto-complete suggestion is not working at all in all instances. Any suggestions?

Here is my elpy-config...

Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.31.0
Virtualenv........: None
Interactive Python: python 3.7.4 (/Users/mdmorshed/.pyenv/shims/python)
RPC virtualenv....: rpc-venv (/Users/mdmorshed/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.7.4 (/Users/mdmorshed/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.15.1
 Rope.............: 0.14.0
 Autopep8.........: 1.4.4
 Yapf.............: 0.28.0
 Black............: 19.3b0
Syntax checker....: flake8 (/usr/local/bin/flake8)

You have not activated a virtual env. While Elpy supports this, it is
often a good idea to work inside a virtual env. You can use M-x
pyvenv-activate or M-x pyvenv-workon to activate a virtual env.

The directory ~/.local/bin/ is not in your PATH. As there is no active
virtualenv, installing Python packages locally will place executables
in that directory, so Emacs won't find them. If you are missing some
commands, do add this directory to your PATH -- and then do
`elpy-rpc-restart'.


texts: Change the asterisk (heading identifier) to some other symbol in Org mode

texts:
I know that outline mode works like this in Emacs org mode

* Heading 1
** Heading 2

Is it possible to configure Emacs to take a different identifier than the *to identify headings?
I have a few files where I want to use a particular character (or character combination) where I have certain character combinations like C %% MODULE which mark the beginning of every module within the program.

So If I have a mechanism to use the C %% MODULE instead of * I do not have to add additional headings to enable the folding mechanism within my program.

Which file would I have to modify to have this functionality changed?

Just to provide more clarity, my code looks as shown below

I have developed this in org mode.  When I paste this into my system, I will have to manually delete the preceeding * and paste it.
But I was looking for a cleaner solution and if possible I could customize org-mode further to meet my requirements.


texts:
When I did some clean up of my Emacs init file, I discovered that I had used both

(add-hook 'LaTeX-mode-hook ...)

and

(add-hook 'latex-mode-hook ...)

What is the difference between LaTeX-mode-hook and latex-mode-hook?


texts: Does "Edit with Emacs" saves a local file of current edit buffer?

texts:
I'm using Edit with Emacs to edit Stack Overflow and Stack Exchange sites.
Currently I'm doing it with this message ;-)

When I click on the button under the text area of Chrome browser, I get a new file opened on Emacs.
Current file is named emacs.stackexchange.com/questions/ask.
When I press save the file: C-x C-s, the text gets updated in the browser.

Is the file saved somewhere in the filesystem, so I can recover it locally, just in case I kill the current buffer?


texts: How to control line-continuation using SMIE?

texts:
I'm trying to implement qmake-mode using SMIE(https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html), but I have no idea how to control indent width in line-continuation. Block indentation works(yes, I stole block indentation from sh-script.sh(sh-mode))

For example, I expect this

SOURCES += a.cpp \
    b.cpp

rather than

SOURCES += a.cpp \
        b.cpp

Here is brief code:

(defconst qmake-smie-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    '((var)
      (value)
      (exp (var "+=" value)
           (var "=" value)
           (var "-=" value))
      (inst (exp "||" exp)
            (exp "&&" exp))
      (insts (inst ";" insts)))
    '((assoc "+=" "=" "-="))
    '((assoc "||" "&&"))
    '((assoc ";"))
    )))

(defun qmake-smie-backward-token ()
  (let ((bol (line-beginning-position))
        pos tok)
    (forward-comment (- (point)))
    (cond
     ((< (point) bol)
      (cond
       ((qmake-smie--looking-back-at-continuation-p)
        (forward-char -1)
        (funcall smie-backward-token-function))
       ((qmake-smie--newline-semi-p) ";")
       (t (funcall smie-backward-token-function))))
     (t tok))))

(defun qmake-smie-rules (kind token)
  (pcase (cons kind token)
    (`(:elem . basic) qmake-indentation)
    ((and `(:before . ,_)
          (guard (when qmake-indent-after-continuation
                   (save-excursion
                     (ignore-errors
                       (skip-chars-backward " \t")
                       (qmake-smie--looking-back-at-continuation-p))))))
     ;; After a line-continuation, make sure the rest is indented.
     (let* ((qmake-indent-after-continuation nil)
            (indent (smie-indent-calculate))
            (initial (qmake-smie--continuation-start-indent)))
       (when (and (numberp indent) (numberp initial)
                  (<= indent initial))
         `(column . ,(+ initial qmake-indentation)))))
    (`(:before . ,(or `"(" `"{" `"["))
     (if (smie-rule-hanging-p) (smie-rule-parent)))))

Here is full code:
https://gist.github.com/inlinechan/2ff5194d06cfcfb34016


texts: Org-mode export: force page break after TOC

texts:
I'm using org-mode to export to PDF. I'm going over the same document multiple times and exporting different branches during my evaluation.

I always want the first section in the PDF to start on a clean page, regardless of which subtree I export. So, there should always be a cleanpage after the TOC.

I can manually add newpage everywhere in my org-mode doc, but I have a tree with thousands of branches. I'd rather add this in the latex preamble or .emacs config, once.

Is it possible?


texts: How can I skip a test if another test failed?

texts:
Say I have two tests:

(defun func-one () nil)
(defun func-two () (and (func-one) t))

(ert-deftest test-one ()
  "Test basic functionality"
  (should (func-one)))

(ert-deftest test-two ()
  "Test advanced functionality"
  (should (func-two)))

How can I run test-two only if test-one succeeds?

Or, perhaps,

(defun func-one () nil)
(defun func-two () (and (func-one) t))

(ert-deftest test-all ()
  "Test basic functionality"
  (should (func-one))
  (should (func-two)))

Testing func-two only if func-one passes, for example.

Or even

(defun func-one () nil)
(defun func-two () (and (func-one) t))
(defun func-thr () (or  (func-one) t))

(ert-deftest test-one ()
  "Test basic functionality"
  (should (func-one)))

(ert-deftest test-two ()
  "Test advanced functionality"
  (should (func-two)))

(ert-deftest test-thr ()
  "Test advanced functionality"
  (should (func-thr)))

Testing

func-two only if func-one passes
func-thr only if func-one passes

but func-two failing should not impede func-thr from running.


texts: Display file icons in ranger inside spacemacs

texts:
I am looking to get visual representation of different file extensions as discussed in this question.

  https://github.com/ranger/ranger/issues/298

In the question however there are some python files involved and the discussion is about the icon addon as a vim plugin.

I have the ranger as a spacemacs layer, so I would need to get it to work in spacemacs. Could someone please provide an easy guide (if it is possible at all) what to do to get some beautiful file icons for the files displayed in ranger in spacemacs instead of only text. Your help is very appreciated.


texts: What does the M in MR stand for in the first column header of *IBuffer*?

texts: When I run M-x ibuffer, a table of my buffers is displayed. The first column header is MR, and I assume the R stands for read only, however, I don't know what the M stands for. What does it stand for?


texts: How to navigate stack frames in Emacs debugger?

texts:
I'm trying to debug the infamous Unrecognized entry in undo list undo-tree-canary, and after having Emacs debugger triggered on error, I want to move back and forth between stack frames and to examine state of variables. Sort of what frame 3 command in gdb would do.

Unfortunately I haven't found this question asked before, and searching through Emacs documentation haven't been fruitful for me.


texts:
Let us say I have a text like so below:

AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)
AC(nn)

Now I want to replace the nn with numbers like so

AC(0)
AC(1)
AC(2)
AC(3)
AC(4)
AC(5)
AC(6)
AC(7)
AC(8)
AC(9)
AC(10)

I used M-x replace-regexp nn RET \# RET to accomplish this.

Questions:

I want to start the replacement number to start from 1 rather than from 0. Or rather start from a specified number say 25. How should I modify the above command?
How to replace nn with digits like 001, 002 .... 998, 999etc - I mean with leading zeros


texts: Fixed indentation for sectioning commands

texts:
I'm looking for a particular LaTeX indentation feature regarding sections, subsections etc. Specifically, I would like to start the text within a section (assuming \section is the highest sectioning level) at column 4, in a subsection in column 6 etc., like so:

\documentclass{article}

\begin{document}
  some text not in a section: col 2

  \section{Second Section}
    Section text: col 4
    \subsection{First Subsection}
      Subsection text in col 6
      \begin{..}
        standard extra indentation for environments
      \end{..}

  \section{Last Section}
    Again some text in col 4

\end{document}

The other indentation rules should be unchanged (extra indentation for environments etc.)

Since \section is not an environment, I could not find anything in the AUCTeX customization. Is there a simple way to do this?


texts: How to prevent window split in a single frame

texts:
I'm in emacs 24.something on a Windows platform.
I have an agenda generated by org that I would like to keep on continuous display.
I use multiple frames, and multiple windows per frame, for my other work.
What I would like is a single frame with a dedicated window displaying my agenda buffer that is NOT split

(set-window-dedicated (selected-window) t)

seems to help, but doesn't quite do the trick.

Any ideas?


texts: How to indicate the currently clocked-in task?

texts:
I'm using org-mode's clocking functions to track the hours I spend on projects. Since my main org file is rather large and I scroll through it a lot, it would be great to have a visual cue of the task that's currently clocked in.

Ideally some marker (e.g. a red arrow) in the fringe would be nice, especially if it 'moves' to the parent header if the subheaders are collapsed. Alternatively a highlighted line would be an options (somewhat similar to hl-line-mode, but fixed to the current task (or its parent)). Unfortunately my (e)lisp skills are almost non existent, so I don't have much of a clue where to start. Going through the Emacs manual it looks like overlay-arrow-string and overlay-arrow-position are the variables I could use, and org-clock-in-hook and org-clock-out-hook from org-clock.el look like places where I could (un)set these variables.

I know you can easily jump to the current task with C-c C-x C-j, but a visual cue would be much appreciated.


texts: Does anyone know of a Bash linter for the Google shell style guide? I have been using shellcheck as my linter with flycheck but it doesn't conform to this standard.


texts:
I am on this version of GNU Emacs on a Windows 10 computer:
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29
For the past many weeks, Emacs report this error accessing GNU Elpa when I run "list-packages":
Importing package-keyring.gpg...done
error in process filter: Error retrieving: https://elpa.gnu.org/packages/archive-contents (error http 400) [2 times]
Package refresh done
In a browser, I can access the URI just fine. This happens on two Windows 10 boxes I have.
A Google shows complaints about such errors as recently as a year ago, though I've not found any with "http 400 (Bad Request)". In addition, I don't have errors for  melpa stable, the other repository in my package-archives list:
 '(package-archives
   (quote
    (("gnu" . "https://elpa.gnu.org/packages/")
     ("melpa-stable" . "https://stable.melpa.org/packages/"))))

Does one of you have suggestions on what else I might try?
Thanks,
Mario


texts: How to mark a directory as "not a project" in projectile?

texts:
I have a big version-controlled directory hosting a lot of half-independent bodies of work. I want to consider them all as projects for projectile.

So I added an empty .projectile file in each of them, with the idea that projectile would pick that up instead of the .git above.

So the situation is like this

~/main-directory/
 -> .git
 -> project1/
     -> .projectile
     -> file1
     -> file2
 -> project2/
     -> .projectile
     -> file1
     -> file2

But if I open ~/main-directory/project2/file1 and call projectile-add-known-project, it considers the whole main-directory as one project.  In particular, completion matches files with the same name in all subdirectories...

I have tried (setq projectile-project-root-files-bottom-up (delete ".projectile" projectile-project-root-files-bottom-up)), but it did not help.

Is there a simple way of telling projectile that the main-directory is not to be considered a project?


texts: Set up Emacs on Windows to start a single instance and open files in the existing instance

texts:
I am particularly interested in the full Windows experience including:

Automatically starting a server if one is not already started
How to call emacs so that it utilizes the server (e.g. from command line or third party tools)
Context menu support (e.g. right-click on a file and allow it to be sent to emacs for viewing and editing)

Is such support available out of the box anywhere?


texts: Make shell-command / async-shell-command respect carriage return?

texts:
Say I have a simple perl program:

for my $i (0..10) {
    print "$i\r"
}

print "\n"

Now if I run the program through shell-command,
instead of getting a single line with 10, I will see the following thing
in the output buffer.

  0^M1^M2^M3^M4^M5^M6^M7^M8^M9^M10^M

My question is how can I make the output look like the way similar to shell output (i.e. \r moves to the begin of a line, further output overwrites previous one, and \n switches to a newline).


texts: Does `use-package` reduce startup time? If so, how?

texts:
My understanding of Emacs's package management is that Emacs automatically loads all installed packages.

use-package itself is a package, which only becomes usable after (package-initialize), at which point all packages have already been loaded.

I was just wondering how exactly use-package reduce startup time for Emacs? Can anybody explain this at a high level?


texts: How to call pdflatex under TeX-PDF-mode?

texts: I am already in TeX-PDF-mode. When C-c C-c and type in pdflatex, it doesn't run. How can I run pdflatex in TeX-PDF-mode? Note: I don't change my emacs configuration file. Thanks.


texts: How to fix indentation of C++ methods with ref-qualifiers?

texts:
Emacs in its default configuration seems to have trouble indenting C++ methods with reference qualifiers (& and &&). For example:

struct foo {
    void a_method() && {
                        std::cout << "rvalue ref\n";
    }

    void a_method() const& {
                            std::cout << "lvalue const ref\n";
    }

    void this_gets_properly_indented() const {
        std::cout << "without a ref-qualifier\n";
    }

    auto this_too() && -> void {
        std::cout << "rvalue ref; '->' notation\n";
    }
};

One workaround I have found is to use the -> syntax for return types, but this breaks too if the return type is a reference. Can this behaviour be somehow configured?


texts: (load-theme) at the bottom of .emacs, or manually renders a different screen

texts:
Adding this line at the very end of the .emacs file, that loads a default theme coming with the Emacs package,
(load-theme 'tsdh-dark)

the (main) screen looks like

Note the black-on-dark text, the barely visible mini-buffer, and other syntax highlighted languages (C++, Perl...) have all a lot of dark-on-dark text.
Now, if, instead, I do the command manually, right after .emacs was executed (ie first command),

M-x load-theme → tsdh-dark

the highlighting is normal,

in all languages.
Why is it that running as the last lisp instruction in .emacs the rendering is wrong, while loading the theme manually just after works?
And how can I fix that?
(I realized that the command might do more than just the (load-theme) lisp instruction... this question is also to fix the problem in a clean way)


texts: How do I bind C-x p to the project.el project-prefix-map?

texts:
Following the advice of Mastering Emacs I'm trying to use the project.el package. My problem is that C-x p isn't bound to the prefix keymap and I can't figure out how to bind it correctly.
I'm pretty sure I'm trying to get this part of the package to load: https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/project.el#L618
I've tried this:
(use-package project
  :bind-keymap ("C-x p" . project-prefix-map))

but I get a Wrong type argument: sequencep
I've tried bind-key but I don't know what to put in for the COMMAND argument so I tried this:
(bind-key "C-x p" project-prefix-map)

which is also wrong.
I'm running Emacs on MacOS. The Emacs version is GNU Emacs 27.1 (build 1, x86_64-apple-darwin19.6.0, NS appkit-1894.60 Version 10.15.7 (Build 19H15)) installed using macports.


texts: How to bind a keybinding to add `\textit` or `textbf` for the word, where the cursor is pointing?

texts:
I am working on a LaTex file.
Is it possible to bind a keybinding to add \textit or textbf for the word, where the cursor is pointing?
For example, cursor is on top of word hello:

hello converted into \textit{hello} # with M-o i
hello converted into \textbf{hello}  # with M-o b


texts: How can I resume swiper-isearch with the next line selected?

texts:
What I'm trying to do is have swiper-isearch resume the last search with the next element selected. The definition of next is the next element from where my cursor currently is.

You can read my original post below for how I was trying to use ivy-resume and ivy-next-line to achieve this, but it didn't work — it always resumed with the originally selected item still pre-selected.

Original Post:

How can I resume ivy with the next line selected?

I want to issue a keyboard command that resumes the last ivy listing, but instead of resuming at the line it left off at, I want to resume with the next line selected. I thought this would be simple enough if I did the following:

(defun my-ivy-resume-with-next-line ()
  "Resume the last completion and move current line down one."
  (interactive)
  (ivy-resume)
  (ivy-next-line))
(global-set-key (kbd "s-g") 'my-ivy-resume-with-next-line)

When I hit my keyboard command, ivy resumes right where it left off — it does not go to the next line. I'm not sure if there's some simple elisp functionality that I should know to fix this, or if ivy-resume is doing something weird. My guess would be that maybe ivy-next-line is being called in my main buffer and not the newly created minibuffer from ivy-resume. (If that's the case, then this is a question of how to call that command in the context of the minibuffer.)

Notes:

I have also tried various variations of the following for the message body per suggestions in the comments:

(minibuffer-with-setup-hook (:append #'ivy-next-line) (ivy-resume))

Nothing seemed to work for me in my testing. However, after hearing they were working for others, I changed which function I was using to create the initial ivy listing and it worked. So the minibuffer hook is working for me when ivy has been called using counsel-find-file but not when using swiper-isearch. My primary use case for this is to resume swiper and go to the next found item, so I still need help.

Software versions

swiper 20200220.1026
ivy 20200220.1043
Emacs 26.3
MacOS 10.15.3


texts: Is it possible in mobileorg to link to other org files? I have tried the example in the documentation trying to link first.org, second.org etc. in mobileorg, but when i link to another org file there is nothing to press on.


texts: Incremental search for visible org headings that begin with STRING

texts:
I have a document with hundreds of org headings, sorted alphabetically. I would like to find a way of jumping to the first visible heading whose initial letter(s) match the string typed so far. (Intuitively, the functionality I am trying to replicate resembles that of some file managers such as OSX Finder, where one can quickly jump to any file or directory just by typing the first few letters of it, with the difference being that the candidates here are instead visible org headings.)
For example, suppose that the first few lines of my document look like this:
* AlphaGo
AlphaGo is a computer program that plays the game Go. It should not be confused with AlphaZero.
** Gamma
* AlphaZero
* Beta
* Gamma

Then (assuming point is at the beginning of the document) typing a would move point to the first line, typing alphaz would move point to the fourth line, and typing g would move point to the final line if the first heading is folded, and to the third line otherwise.


texts: diff-mode: refine all hunks when opening a diff file?

texts:
diff-mode provides diff-refine-hunk function to refine the highlighting of the current hunk. However, by default, only diff-hunk-next or explicit diff-refine-hunk calls will do this job -- hunks will not be refined by default. I wrote the following snippet to refine all hunks when I enter diff-mode:

(defun my-diff-hunks-highlight-all ()
  "Highlight all hunks in diff-mode."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (let ((last-point))
      (while (not (equal (point) last-point))
        (setq last-point (point))
        (diff-refine-hunk)
        (diff-hunk-next)))))
(add-hook 'diff-mode-hook 'my-diff-hunks-highlight-all)

However, it turns out that only the last hunk will be refined. Is there any reason that this approach fails? What should be the proper way to do it?

Related Emacs bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18128


texts: How to diff a single, unstaged file in magit-status?

texts:
How can I display a diff for the actually selected file in magit-status?  What can I do  in

do display a diff of build/conf/local.conf?

With the now deprecated git-status, I could run git-diff-file (=) to see quickly what has been changed (without visiting the buffer first or digging through the the complete list of unstaged changes).


texts: How to block highlighting of certain nicks in ERC?

texts:
Some people in IRC channels I frequent have elected to use extremely common words for their nicks, including "a" and "me". I use erc-hl-nicks, and was able to block those particular nicks from getting colored, but I would like to block them from being bolded as well. It seems it's ERC's default behavior to bold nicks when they are mentioned. See the attached screenshots, where "a" and "D" are highlighted in bold.

How can I indicate to ERC that those nicks should not be bolded or highlighted? I've played around with the erc-fools list, but I can't get that to do anything, and every time I turn it on, it breaks nick coloring for most people.


texts: Commenting in and Org-mode block (SRC) indents entire block. How to comment without indenting org src block?

texts:
In my org-mode source blocks, any commenting with a function indents the entire source block. Is this normal behavior? Is there a setting to allow commenting of region, or line without indenting the entire source block.
This occurs with electric-indent and electric-indent-local modes off. Also it happens with any of the following functions:
smart-comment-line
smart-comment
smart-comment-region
comment-line
comment-region
comment-or-uncomment-region
comment-dwim
org-commnet-dwim
This can't be the default behaviour, :) , there must be something missing!
Has anyone else experienced this?


texts: How do I prevent one subprocess from starving others?

texts:
To be clear, I'm not talking about anything that should require emacs to be multithreaded (though that would probably also solve this). To reproduce:

emacs -Q # I'm running 24.4.1
Make a second frame
Switch back to first frame
M-x shell
M-x rename-uniquely (we're going to make a second shell later)
Start running: while true; do echo "hello world"; done
In the second frame, M-x shell

The second shell will almost never display (rarely it works after repeated attempts). Apparently emacs will never take a break from reading the output of the first shell to listen to the output coming in from any other process. It would be much better behavior for it to round robin when there are multiple processes with pending output. Is there any way to get better behavior?

The only trick I know would be to make the shell buffer its own process, but unfortunately that won't work for me. Even if I do that, I have to run a subprocess to listen to a socket for my speech recognition software to work so that I can actually control the shell in the first place, that's how I discovered this; running an infinite loop like the above prevents any data from being taken off the socket.


texts: How to ignore currently clocked entries?

texts:
I would like to iterate all entries from all org-agenda files but those marked as done and those currently clocked.

So far, I had success with the first part. However seems like org-agenda-skip-if can't detect if an entry is currently clocked.

Right now, what I'm doing to check if the entry is currently clocked is doing a hackish string comparison with the value of org-clock-current-task

Here is the code I have:

 ;; This goes inside a let statement which sets the org-agenda-skip-function
 ;; variable with my function to ignore DONE tasks.
(let* ((entries (org-agenda-get-day-entries file today :scheduled :deadline)))
          (dolist (entry entries)
            (if (and (string-match-p today-regexp (get-text-property 0 'extra entry))
                   (string-empty-p (get-text-property 0 'time entry))
                   (not (string-suffix-p org-clock-current-task (get-text-property 0 'txt entry))))
                (alert "Pending Task for today with unknown time of day"
                       :title (format "%s" (get-text-property 0 'txt entry))
                       :mode 'org-mode))))


texts: How can I make sure that Emacs opens files with extension `*.rec` as normal text files?

texts:
How can I make sure that Emacs opens files with extension *.rec as normal text files?
When I try to open a file with the extnsion *.rec, I get the error message Running someFile.rec...done without the file being opened.

I assume that rec-mode is not installed because its status is Available from gnu (see below).

What can I do in order for Emacs to open *.rec files as plain, normal text files?


texts:
In org-mode, M-x org-agenda a will display a built-in agenda view labeled "Agenda for current week or day". How can I exclude a tag from this view?

Parenthetical clarification

I know how to filter a tag out of this view after it is displayed, but I would like to add something to my configuration to exclude the tag by default.

I know how to exclude a tag from a custom agenda view, but I would like to exclude a tag from the built-in agenda view labeled "Agenda for current week or day".


texts: Configure package manager to use an NTLM Proxy

texts: I've seen a few examples of how to setup Emacs to use Basic Auth proxies - is there a way to configure it to use an NTLM proxy?


texts:
I know this isn't the best type of question for stack... but I can't think of another place where it might get enough exposure.

So I really like company-mode, but sometimes it's annoying to have to manually switch to the next backend (company-try-hard is handy here). I've started playing around with grouped backends, and I can see some awesome potential. Unfortunately, I'm not happy with anything I've tried so far. I think this might be better set with hooks for different modes. Does anyone have some interesting company-backends lists that I could get some inspiration from?

I mainly use python (elpy), javascript (js3-mode), web (web-mode) and shell scripts if that helps.


texts: any change in my init config delays emacs start by 90-150 seconds

texts:
weird issues. when i restart emacs it usually starts up pretty fast. BUT any small change i make to my config file makes emacs have a delay of 90-150 seconds each time. im using a org based config and this is what my init.el looks like

    ;;; init.el --- Where all the magic begins
;;
;; This file loads Org-mode and then loads the rest of our Emacs initialization from Emacs lisp
;; embedded in literate Org-mode files.
;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files

(require 'package)

;since we are using use-package-don't autoload anythings
(setq package-enable-at-startup nil)

(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
;; org maybe suspect of hanging melpa, if you have hangs disable this first
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
;; Initialize installed package
(package-initialize)

;; Bootstrap `use-package'
;(unless (package-installed-p 'use-package)
;  (package-refresh-contents)
;  (package-install 'use-package))

(require 'use-package)

;;; org babel magic happens here
(require 'org)
(org-babel-load-file
(expand-file-name "settings.org"
                   user-emacs-directory))

;; init.el ends here

(put 'dired-find-alternate-file 'disabled nil)

again after a successful emacs start i can kill it and quickly restart emacs but any change to my setting.org file (the actual config being tangles) creates this huge delay

i have tried binary partitioning of the settings.org file with no success which makes me think its not a conf issue

Edit: i will add that when i launch emacs from the CLI it seems to be stuck at the point where it says

│Warning: due to a long standing Gtk+ bug
│http://bugzilla.gnome.org/show_bug.cgi?id=85715
│Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lo
│Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.

that part halts for a good 2-3 minutes and then it dives into tangeling and i get all the messages like

Wrote /home/zeltak/.emacs.d/settings.el

any clue?


texts: UnicodeEncodeError in inferior python under windows

texts:
I have recently started using emacs under Windows as my python IDE. I had some struggle getting python convinced that it was allowed to output UTF-8 to my terminal emulator (mintty does support unicode, after all) – setting PYTHONIOENCODING=UTF-8 did the trick – but my inferior python buffer still tries to force the “charmap” encoding onto python, even though emacs can deal with unicode.

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "p:/My Documents/test.py", line 33, in <module>
  File "c:\[...]\Anaconda3\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03b5' in position 0: character maps to <undefined>

How do I tell emacs to tell python to just get on with it and use UTF-8?


texts: I am using window-numbering.el to switch between windows in a frame. However if I have multiple frames each frame starts numbering its windows beginning with 1. Is there a way I can have global window numbers over all frames, so that window numbering jumps between frames as well?


texts:
I'm running OS X Yosemite and Emacs 24.3 from Homebrew.

The locale setting for my user is:

LANG="en_AU.UTF-8"
LC_COLLATE="en_AU.UTF-8"
LC_CTYPE="en_AU.UTF-8"
LC_MESSAGES="en_AU.UTF-8"
LC_MONETARY="en_AU.UTF-8"
LC_NUMERIC="en_AU.UTF-8"
LC_TIME="en_AU.UTF-8"
LC_ALL=

Yet, when I launch Emacs.app via the launcher (or the OS X UI generally), and run locale in ansi-term, I get:

LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

How can I ensure that I get my user's locale when launching Emacs.app via the OS X UI?

(Note: Launching Emacs.app from a shell does pickup the correct locale, but that is not the solution I'm looking for).


texts:
With Gnus, I got into the habit of replying to messages with the
shortcut F, whether they come from private exchanges, forums or
mailing lists.
The problem is for the latter: when I reply to a message
sent by a person to a mailing list, F put:

this person into the "To" field,
the list into the "Cc" field,

so that this person receives my reply twice.
OK, I could use the S L shortcut instead of F since the
reply is then sent only to the list: so far, so good; or, rather, almost good.
The problem is indeed that S L is not very ergonomic and that
I have got too much used to F.
So I considered rebinding S L to F but the problem is that S L does not
work:

nor for private exchanges (or mixed private/mailing list): no "To" field filled in,
nor for the forums: Gnus tries to send a mail to the person and
not an article on the forum.

The question I am asking is therefore whether there would be a way for F to behave as:

F when I reply to a private e-mail or an article on a forum,
S L when I reply to a message from a mailing list.


texts:
How do I turn off fringes in text-mode? The closest I've gotten is this:

(add-hook 'text-mode-hook
          (lambda ()
            (set-fringe-mode '(0 . 0))))

But that turns off fringes permanently for all buffers after I've visited a text buffer once.


texts:
Are there emacs commands which will let me resize/move the frames/windows?

By frame/window I mean the GUI object that X/Windows/whateverAppleCallsIt to contain the interface to emacs. Sorry, emacs language conflicts with OS-GUI language.


texts: How to set temporary halt after C-x C-c?

texts:
If I run C-x C-c in emacs, it will close immediately. If I set confirm-kill-emacs to y-or-n-p it  will ask for confirmation before closing.

Instead of y-or-n-p, I want to set some temporary timer for 3 seconds before closing emacs. So, if I press C-x C-c it should show something like

  Emacs will be shutdown in 3 seconds. Press C-g to stop

If I don't do anything, it should shutdown emacs, but if I press C-g, it should prevent shutting down.  How can I achieve this?


texts: How to make fill-paragraph respect smileys at end of sentences?

texts:
I'm a big fan of fill-paragraph, and also sentence-end-double-space being set to t so that I can easily navigate and edit via backward-sentence, forward-sentence, kill-sentence, transpose-sentences and so on.

However there is one minor flaw with this combination - if I hit M-q (i.e. fill-paragraph) on a paragraph like this:

This sentence ends with a wink ;-)  And it's followed by two spaces
then another sentence.

then it will trim one of the two spaces after the smiley, because it does not recognise the smiley as being the end of the sentence.  Is there a clean way to fix it to preserve these two spaces, whilst not breaking the existing behaviour defined by the sentence-end function?  I can think of three possibilities:

Take the regexp generated by (sentence-end), tweak it to recognise smileys, and store it in the sentence-end variable - but then it's a static regexp which doesn't honour changes to variables like sentence-end-without-space.
Copy the whole of the sentence-end function and then hack it to cope with smileys, but then I have to maintain my own version in parallel with the upstream one.
Hack sentence-end as in 2. and then try to get the change merged upstream, but I don't know how realistic that is.

Are there any better options?


texts: imenu in ess-mode: recognize assignment with "="

texts:
Is there a way to configure the imenu integration in ESS-mode so that it recognizes assignment by the equal sign "=", not only by arrow "<-"?

I'm switching between R and python so I've switched to "=" to decrease the cognitive load, but this way I loose the imenu functionality...

Thank you very much!


texts:
I have a list of triplets (3-tuple) like this:

Hank   01.09.1999  Syracuse
Betty  10.30.1987  Sacramento
...

the "key" should be the first column, the person's name. What is a good elisp data structure way to represent this data? I know alist and hash are key-value oriented, here I have three objects. I want to read a text file with the raw (tab delimited) data and write it to a file in the elisp data structure. As a beginner, I'm thinking

((Hank (01.09.1999 . Syracuse)) (Betty (10.30.1987 . Sacramento)) ... )

where I cons the birth date and the birth city, then cons to dotted pair to the name, but is there a better way? I guess there is no "dotted triplet" i.e., (a . b . c)? In general, I could use some examples of live elisp code where code and data are blended together, too.