texts: where to put .el files on Windows10 for loading at startup

texts:
I'm using emacs as a bog-standard program in Windows, and also from the command line in cygwin.

They both use the same installation of emacs.

I just grabbed yaml-mode.el off the net but I can't get it to load at start-up. Where should I put it?

Initially I thought I'd put it in the emacs installation directory emacs/site-lisp/ but then I noticed there's also an emacs/25.3/site-list/.

Neither of those works for emacs from the cygwin command line. It complains at startup due to the lisp  in my .emacs.

I also put it in ~/.emacs.d but that didn't work either.

Ideally I would like to have it one place so that it works in Windows and cygwin, and is in a directory on my Microsoft One Drive (because that's the only place on my workstation which gets backed up).

I can make pointers to wherever I need to, which work for the .emacs file.


texts: How do I make helm swoop not default the search to the word at point?

texts: When I trigger helm-swoop, it autofills the search with the word at point. For my most common use case, this isn't what I want. How do I disable it, so there's nothing in the search.


texts: Automatically display new channel buffer after joining new channel or new channel buffer is created by ERC

texts:
Is there a way to automatically display new channel buffer after it's created by ERC?
To join new channel the erc-cmd-JOIN function is invoked. The buffer for new channel is created in the background pretty much immediately. If the buffer is new, it's never displayed in any window. I always want this buffer to be displayed in current window. It takes few more keystrokes to switch to that buffer manually, so I look for a way to automate it.


texts: Parsing formatted time string (inverse of format-time-string)

texts:
The format-time-string function takes a time argument like '(21761 64499 350937 0) and a format string like "%y-%m-%d %a %H:%M" and returns something like "15-03-12 Thu 16:49".

What is the inverse function, which takes "15-03-12 Thu 16:49" and "%y-%m-%d %a %H:%M", and returns '(21761 64499 350937 0)?

I am trying to parse times out of a website so as to convert them into org-mode timestamps, but I'm having trouble finding the right function in the emacs documentation.

Edit I'm promoting this from my comment to erikstoke's answer. parse-time-string and org-parse-time-string are insufficient because while they parse many standard time strings, they do not allow for specified formats. Both functions are rather incomprehensive. In particular, they lack ISO8601 support.


texts: Home and End keys stop working correctly

texts: I am running a session of emacs in an xterm+256color terminal, i.e., with the command emacs -nw. At the start of my session, the Home and End keys work just fine. However, after a while, the Home key eventually starts producing the key code ^[[H instead of ^[OF. Why does this happen? What can I do to fix this problem?


texts:
Is there a keybinding (or way to define one) to call a source block by its name in the current org-mode buffer?
Currently, I move mouse pointer inside the code block and then press C-c C-c. But this jumping
is becoming distracting as the document gets larger and larger.


texts: Good resources for turning Emacs into a LaTeX IDE?

texts:
I am learning Emacs thanks to awesome resources like this or this. However, I can't find a good tutorial for setting up AucTeX in order to turn Emacs into a LaTeX IDE. I am trying to set it up with the official user guide, but I find it hard to follow.
Any good resource?


texts: function calls from command line, using emacsclient

texts: I used to read my emails from command line with emacs -f gnus. To read my emails using emacsclient, I'm doing emacsclient -c --eval '(gnus)'. Just want to know, is there a simpler alternative to that? Something that will be closer to emacs -f gnus? In fact, what is the proper way to call an emacs functions from command line using emacsclient?


texts:
I recently started using spacemacs/emacs, and encountered the following problem:

When I enable popwin-mode I would expect popup windows to get handled by popwin. However, when I run occur (M-x occur), it seems to not be - the buffer with the occur results always gets opened in another buffer either to the left or right of the current one. And can not be closed with C-g, as advertised.

Having set popwin-window-position to bottom, I would also expect occur to open a new buffer below the current one. But, as I said, it does not.

Could anyone help me fix whatever is the problem here?


texts:
today I have to ask the community for some help. I used my org-agenda for a few years now. But since a few month my missed deadlines wont be shown in weekly agenda. Maybe I miss-configured something during continues cleanup but I dont find a bad configuration.

I already tried a clean only org-mode installed config but it also does not work, no warnings of missed deadlines :-(

Documentation for deadlines writes "In addition, the agenda for today will carry a warning about the approaching or missed deadline, starting org-deadline-warning-days before the due date, and continuing until the entry is marked DONE." So actually no magic.

My Emacs-Version: GNU Emacs 26.3

My Org-Version: 9.3.1

My org-mode config:

(use-package
  org

  :mode
  ("\\.org\\'" . org-mode)

  :commands
  (org-agenda
   org-capture-todo
   org-capture-todo-context
   org-capture-journal
   org-capture-calendar)

  :config
  (setq
   org-gtd-directory "~/.gtd/"
   ;; org-gtd-todos-file (expand-file-name "todos.org" org-gtd-directory)
   ;; org-gtd-journal-file (expand-file-name "journal.org" org-gtd-directory)
   org-gtd-todos-file (expand-file-name "gtd.org" org-gtd-directory)
   org-gtd-journal-file (expand-file-name "gtd.org" org-gtd-directory))

  (setq
   org-startup-indented t
   org-M-RET-may-split-line t
   org-default-notes-file org-gtd-todos-file
   org-outline-path-complete-in-steps nil
   org-refile-use-outline-path t
   org-blank-before-new-entry '((heading . nil) (plain-list-item . nil))
   org-agenda-files (list org-gtd-todos-file)
   org-todo-keywords '((sequence "TODO(t)" "STARTED(s)" "BLOCKED(b)" "|" "DONE(d)" "DELEGATED(g)" "CANCELED(c)"))
   org-tag-alist '(;; For exclusiv groups
                   ;; (:startgroup . nil)
                   ;; ("@work" . ?w) ("@home" . ?h)
                   ;; ("@tennisclub" . ?t)
                   ;; (:endgroup . nil)
                   ("GENERAL" . ?g) ("EMACS" . ?e))
   org-refile-targets '((org-agenda-files :maxlevel . 5)))

  (setq
   org-capture-templates
   '(("t" "Todo (without context)" entry (file+headline org-gtd-todos-file "Inbox")
      "* TODO %? %i %^g\n:PROPERTIES:\n:ADDED: %U\n:CONTEXT:\n:DEADLINE: %^t\n:END:")
     ("T" "Todo (with context)" entry (file+headline org-gtd-todos-file "Inbox")
      "* TODO %? %i %^g\n:PROPERTIES:\n:ADDED: %U\n:CONTEXT: %a\n:DEADLINE: %^t\n:END:")
     ("j" "Journal" entry (file+headline org-gtd-journal-file "Journal")
      "* %? %i %^g\n:PROPERTIES:\n:ADDED: %U\n:CONTEXT: %a\n:END:")
     ("c" "Calendar" entry (file+headline org-gtd-todos-file "Calendar")
      "* TODO %? %i %^g\n:PROPERTIES:\n:ADDED: %U\n:CONTEXT: %a\n:SCHEDULED: %^T\n:DEADLINE: %^t\n:END:")))

  (defun org-capture-todo ()
    (interactive)
    (org-capture nil "t"))

  (defun org-capture-todo-context ()
    (interactive)
    (org-capture nil "T"))

  (defun org-capture-journal ()
    (interactive)
    (org-capture nil "j"))

  (defun org-capture-calendar ()
    (interactive)
    (org-capture nil "c"))

  :bind*
  (("C-M-- <RET>" . org-capture)
   ("C-M-- t" . org-capture-todo)
   ("C-M-- T" . org-capture-todo-context)
   ("C-M-- j" . org-capture-journal)
   ("C-M-- c" . org-capture-calendar)
   ("C-M-- a" . org-agenda)))

My example org-file:

* TODO TEST A                                                       :GENERAL:
:PROPERTIES:
:ADDED: [2020-01-05 Sun 16:47]
:DEADLINE: <2020-01-08 Wed>
:END:
* TODO TEST B                                                       :GENERAL:
:PROPERTIES:
:ADDED: [2020-01-05 Sun 16:47]
:DEADLINE: <2020-01-16 Thu>
:END:

My agenda output:

Week-agenda (W03):
Monday     13 January 2020 W03
Tuesday    14 January 2020
Wednesday  15 January 2020
Thursday   16 January 2020
  gtd:        TODO TEST B                                                               :GENERAL:
Friday     17 January 2020
Saturday   18 January 2020
Sunday     19 January 2020

Expectation: TEST A schould be shown as missed deadlined task.

Any ideas what I missed, hopefully someone can help me, thx.


texts: Why am I getting Wrong type argument: stringp, nil?

texts:
What's wrong here ? It gives me the error Wrong type argument: stringp, nil.
(let* ((filename (file-name-nondirectory buffer-file-name))
       (executable (file-name-sans-extension filename)))
  (setq compile-command
        (concat "g++ -static -DONLINE_JUDGE -DONLINE_JUDGESAS -Wl,--stack=268435456 -O2 -std=c++17 "
                filename
                " -o "
                executable)))


texts: Highlighting upcoming dates in org mode agenda

texts:
I have entries in my org file similar to:

* Birthdays
:PROPERTIES:
:CATEGORY: birthday
:END:
%%(org-anniversary 1981 1 2) Harry (%d)

What I would like is for these to appear in the agenda (say) 2 weeks before they're due, similar to how a deadline works.

Is that possible?


texts: ssh to a remove host and use emacs in the ssh session, cursor always move to the beginning of the screen when save file

texts: I have a VPS server and I always ssh to it and us emacs in the ssh session. I found that when I save a buffer the cursor always move to the beginning of the screen. How to disable this behavior? I don't want cursor movement when save a file.


texts:
Is there a way to profile or time code that simulates interactive editing?

The gist of what I want to do is that I have some code that runs during font-lock, and sometimes it makes editing sluggish. What I would like is a way to run a test that simulates the editing (and corresponding font-lock operations) and does some timing so I can test which implementations are fastest.

Supposing I have a measure-time macro (eg from https://stackoverflow.com/questions/23622296/emacs-timing-execution-of-function-calls-in-emacs-lisp), this test code would look like this, where example/info.org is the file I want to test on.

(cl-loop for i to 3 collect
     (with-temp-buffer
       (insert-file-contents "example/info.org")
       (org-mode)
       ;; Goto place in file where I know editing becomes slow
       (re-search-forward "ref:")
       (end-of-line)
       (measure-time
        (dotimes (i 5)
          ;; this code should act like if typed a character, triggering a
          ;; font-lock update
          (insert " ")))))

and it would return a list of execution times for the edit operation (in this case inserting characters).

Then, I could try different implementations of the code to see which one makes for the fastest editing.

Are there any standard tools for doing this?


texts: How to create a command that runs all of those functions on the current buffer?

texts:
I'm a total noob so be patient with me. I wrote a piece of elisp code that reads a .csv file (FILE.CSV) on which every line has the format Key, Value
It composes a mail using the keys and values in this CSV file. When reading from the file everything works. However I'd like to run this code on a buffer. So I tried using buffer-file-name to get the name of the default buffer and run the functions on this buffer. This doesn't work.

So the question is how to create a command M-x schedule-as-email that takes a buffer (having the same contents as the file) and creates a mail along the lines of the code below.

contents of file: FILE.CSV

Key,Value
John,BlahBlah
Alexander,BlahDiBlah
Andrew,Blaaah
Victor,Blablabla
Pablo,lalalalalah
Group,B

code I hacked together (sorry I'm new to programming):

(require 'f)
(require 's)

(setq myHash (make-hash-table :test 'equal))

;;(setq filename "~/FILE.CSV") - works

(setq filename (buffer-file-name)) ;;does not work

(setq mylist (s-lines (s-chomp (f-read filename))))

(defun elements-of-list-to-hash (list)
  "Put each element of a LIST of keys and values in myHash."
  (while list
    (setq subList (s-split "," (car list)))
    (while subList
      (print (car subList))
      (print (nth 1 subList))
            (puthash (car subList) (nth 1 subList) myHash)
            (setq subList (cdr subList)))
    (setq list (cdr list))))

(elements-of-list-to-hash mylist)

(setq john (gethash "John" myHash))

(setq alexander (gethash "Alexander" myHash))

(setq andrew (gethash "Andrew" myHash))

(setq victor (gethash "Victor" myHash))

(setq pablo (gethash "Pablo" myHash))

(setq group (gethash "Group" myHash))

(setq next-friday (s-chomp(shell-command-to-string "/bin/date --date='next Fri' +'%e %B %Y'")))

(setq subject (format "What they should have learned before friday %s\n" next-friday))

(if (string-suffix-p group "A") (setq mailbody (format "Hi\n\n I want to tell you what our students have to learn before friday %s:\n\n John: %s\n Alexander: %s\n Andrew: %s\n" next-friday john alexander andrew)) (setq mailbody (format "Hi\n\n I want to tell you what our students have to learn before friday %s:\n\n Victor: %s\n Pablo: %s\n" next-friday victor pablo)))

 (defun my-schedule-as-email ()
  "Get mail form variables"
  (interactive)
  (compose-mail
   "receiver@localhost.net"
   subject
   nil
   t)
  (insert mailbody))

(provide 'schedule-as-email)


texts: Only doing whitespace-cleanup on the lines touched

texts:
For most projects I work on I use a before-save-hook to run whitespace-cleanup.  This is fine when everybody on the team cleanups up their spaces but sometimes I am involved in already running projects were most files are littered with trailing white.  Currently I simply turn off my save-hook and add my share of spaces but ideally I want my diffs to be squeaky clean..

Are there any packages out there which only cleanup whitespace on the lines I touched?


texts:
Using org-mode, I can open a single url with Cco on it.

But if I have a list of them like:

- http://www.cnn.com
- http://www.example.com

How can I tell it to open all of them in different tabs?

I use Firefox. Marking all and applying Cco would just run the last one.


texts: What is the keybinding for toggling between editing the shell contents as a buffer and running commands in it?

texts:
What is the keybinding for toggling between editing the shell contents as buffer on one hand and running commands in it on the other? I have configured multi-term to run bash and the shell is switching to buffer editing mode via some keystrokes I am not sure off.

So far the Esc key appears to enter normal Emacs editing mode and Ctrl-z exits it, ie when in the shell? Are they the standard keys?

I am using Spacemacs in evil-mode.


texts: in org-mode, how to change the formatting of timestamps in export to LaTeX?

texts:
In org-mode, how can I change the formatting of timestamps exported to LaTeX PDF?

In the generated .tex file, I see that my timestamps are rendered in LaTeX as \textit. How can I modify this? I probably want to change it to non-italic monospace font.


texts: How to defer a remap until the affected keymap has been created?

texts:
I wanted to change the behavior of isearch in the minibuffer, making Return both accept a search result (isearch-exit) and submit it (minibuffer-complete-and-exit). This is the behavior I've grown to like with Ctrl-R in the shell.

(defun ivan/isearch-exit ()
  "Run isearch-exit, and if in the minibuffer, submit the search result as input."
  (interactive)
  (isearch-exit)
  (if (minibuffer-window-active-p (selected-window))
      (minibuffer-complete-and-exit)))

The first time isearch-mode is entered, it binds Return to isearch-exit in overriding-terminal-local-map (which takes precedence over all other keymaps). So I'm remapping isearch-exit to my custome ivan/isearch-exit in that keymap.

The problem is, I can't simply do the remapping in my init file, because overriding-terminal-local-map is nil at that point. To get around this, I've done the remapping in a hook:

(defun ivan/remap-isearch-exit ()
  (define-key
    overriding-terminal-local-map [remap isearch-exit] #'ivan/isearch-exit))

(add-hook 'isearch-mode-hook #'ivan/remap-isearch-exit)

This works, but it means I'm doing the remapping every time isearch starts, which is unnecessary. Not that it hurts anything (except maybe performance?), but I'd like to avoid doing so. Now I've added a variable to make sure the remap only occurs the first time isearch is entered.

(setq ivan/remapped-isearch-exit nil)

(defun ivan/remap-isearch-exit ()
  (unless ivan/remapped-isearch-exit
    (setq ivan/remapped-isearch-exit t)
    (define-key
      overriding-terminal-local-map [remap isearch-exit] #'ivan/isearch-exit)))

But it makes me wonder if there's a better way. Is there something I could hook into that's run when overriding-terminal-local-map is first created? Or is there another approach altogether that I'm not aware of?

Update: Thanks to lawlist's answer, I now have the following:

(eval-after-load "isearch"
  '(define-key isearch-mode-map [remap isearch-exit] #'ivan/isearch-exit))


texts: Macro with defcustom leads to "Symbol's value as variable is void" error when byte-compiled

texts:
In two of my packages I have a macro where the body depends on a variable defined in a defcustom form.

When installing the packages from Melpa, the byte-compilation ends with:

  Error: Symbol's value as variable is void: my-defcustom-variable

Then, manually byte-compiling the file by opening it in a buffer works.

I tried with an autoload cookie but still have the same behavior.

I'm missing something important here.


texts: Org-mode COMMENT blocks local variable eval?

texts:
The code below is an org-mode file that will not load by-backend. But if I put the org code block setup anywhere else besides under * COMMENT it does run and (fbound 'by-backend) gives t. What is it about COMMENT that blocks local variable from doing setup upon loading the org file? I'm in org-mode 9.0.2 from elpa and Emacs 25.1.1.

* COMMENT
  #+name: setup
  #+begin_src emacs-lisp :results silent :exports none
  ;; (setq org-babel-latex-htlatex "htlatex")
  (defmacro by-backend (&rest body)
    `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body))
  #+end_src

  # Local variables:
  # eval: (org-sbe "setup")
  # End:


texts: Is there a way to move region with arrow keys or similar?

texts:
Say I have a function
int calc(int that, int this);

I want to mark int that and then move it right across words by hitting modifier arrow key (or similar) twice to get
int calc(int this, int that);

This is left and right, but I'm also interested in moving lines or selected blocks up and down.


texts: Org task repeatable cycle state turn DEADLINE and SCHEDULED timestamp inactive/active

texts:
I have a list of repeatable tasks. Sometimes I deactivate them by changing state to CANCELED. But when I do it the new SCHEDULE is created in the future. To prevent that from happening I change timestamp to inactive by hand, and when I want to bring this repeatable task back to TODO I have to remember to activate timestamp.
I could remove timestamp from task before canceling it, and set it again if necessary, but I want to keep it as inactive in case I would like to return to it in the future, so I know repeatable setting from the past.
How could I make task timestamp (DEADLINE and/or SCHEDULED) inactive while switching to CANCELED state, and active while changing it to TODO automatically?
EDIT:
I managed to put together something like this, but it doesn't work.
(defun jarfar/org-state-canceled-timestamp-toggle ()
  "Toggle active/inactive SCHEDULED or DEADLINE timestamp when switching between CANCELED and TODO state."
  (save-excursion
    (let ((state (org-get-todo-state)))
      (cond
        ((equal state "CANCELED")
          (when (and
                  (org-get-deadline-time (point))
                  (search-forward-regexp "DEADLINE: .*" nil t)
                  (null (deactivate-mark))
                  (equal (char-to-string (char-after)) ">"))
            (org-toggle-timestamp-type))
          (when (and
                  (org-get-scheduled-time (point))
                  (search-forward-regexp "SCHEDULED: .*" nil t)
                  (null (deactivate-mark))
                  (equal (char-to-string (char-after)) ">"))
            (org-toggle-timestamp-type)))
        ((equal state "TODO")
          (when (and
                  (org-get-deadline-time (point))
                  (search-forward-regexp "DEADLINE: .*" nil t)
                  (null (deactivate-mark))
                  (equal (char-to-string (char-after)) "]"))
            (org-toggle-timestamp-type))
          (when (and
                  (org-get-scheduled-time (point))
                  (search-forward-regexp "SCHEDULED: .*" nil t)
                  (null (deactivate-mark))
                  (equal (char-to-string (char-after)) "]"))
            (org-toggle-timestamp-type)))))
    (when (equal (buffer-name (current-buffer)) "*Org Agenda*")
      (with-current-buffer "*Org Agenda*" (org-agenda-redo)))))

(add-hook 'org-after-todo-state-change-hook 'jarfar/org-state-canceled-timestamp-toggle)


texts: php-mode indents anonymous function incorrectly

texts:
I have the latest Emacs and php-mode setup and this code does not get indented correctly

$app->group('/route', function () use ($app) {
    echo 'hello';
});

Instead it looks like this

$app->group('/route', function () use ($app) {
        echo 'hello';
    });

Note both the last line and that it indents the echo with 8 spaces instead of 4.

I've tried M-x php-enable-psr2-coding-style but it still doesn't work.


texts: Make forward-sexp recognize blocks defined by keywords, not just parentheses

texts:
In a language (julia) that has blocks defined by keywords such as for..end, begin..end, as well as parentheses, what is a good way to skip over such a block? Also, end is not only a block keyword, but also a valid identifier used in other places.

One way is to look for block-starting/closing regex, and to skip over all strings, comments, and ends, etc., but this is somewhat inefficient, and a little ugly.

Is there a way to make emacs's own syntax parsing recognize such block keywords, so that forward/backward-sexp would automatically work, and so that one could quickly tell the beginning of the current block from the output of, e.g., syntax-ppss?

[Note: I don't mind parsing the file myself, but in that case I would still like to know how my parser should be plugged into the rest of emacs.]


texts: Recurrent pop-up when queued email sends without internet connection

texts:
I use mu4e and mu4e-send-delay. When I send a message immediately and don't have an internet connection, I see this message in the mini-buffer:

smtp.domain.tld/25 nodename nor servname provided, or not known

The message remains open in the Emacs frame with some changes such as the FCC header with the destination filepath and is saved to Drafts.

When I delay sending mail with mu4e-send-delay, at the time of sending, the mini-buffer shows Sending via mail.... If I have no internet connection at the time of sending, a pop-up appears in Emacs:

Emacs-x86_64-10_14

Buffer *temp* modified; kill anyway?

[Yes] [No]

If I click Yes, the mini-buffer changes to Buffer *temp* modified; kill anyway? y. If I click No, the mini-buffer changes to Buffer *temp* modified; kill anyway? n and I get a file similar to *message*-20190627-105554 saved in the home directory with the content of the message:

User-agent: mu4e 1.2.0; emacs 26.2
From: ...
To: ...
Subject: ...
Fcc: /path/to/maildir/Sent Items/cur/1561629089.e6e765d7b4ad6364.hostname:2,S
Date: Thu, 27 Jun 2019 11:01:54 +0100
Message-ID: <some-id.fsf@domain.tld>
--text follows this line--
...

Annoyingly, I get a new saved message with the same content every time I click No in the Emacs pop-up.

How can I avoid these annoying pop-ups every time the queue timer runs without an internet connection?


texts: How to add CSS support for the html-export in org mode for the properties drawer?

texts:
My org version is 9.1.14.

Background info:

I am trying to export my notes in org-mode to html. I would like to have my notes tagged with Category and Tags. I want to apply some CSS beautification to the exported properties. All I get now is a simple export of properties wrapped in
 tag.

The problem:

I have the following org content:

:PROPERTIES:
:Date:     2018-09-15 Sat
:Author:   somebody
:Category: ideas
:END:

It gets exported as below html code:

:Date:     2018-09-15 Sat
:Author:   somebody
:Category: ideas

I want to apply pretty CSS to the properties exported and I expect the export to be something like

:Date:     2018-09-15 Sat

:Author:   somebody

:Category: ideas

How can I achieve that? or is there any other better way to achieve a neat CSS formatted properties listing?


texts: How do I finish a line in artist-mode without a mouse?

texts: I'm using a lot of artist-mode at the moment but I find cancelling the current op very fiddly. Apparently when drawing a polyline you can use mouse-3 but this isn't very helpful when you just have keys. What's the correct way to finish the current drawing operation?


texts: Nested Buffers - Opening external sourcecode files inside org-mode codeblocks

texts:
How to open external sourcecode files inside org-mode codeblocks, in a way that files can be viewed and saved while saving the org-mode document.

Kinda of a 'Nested Buffers' feature?


texts:
In org mode, this inline latex dollar sign fails to render:

$\$$

but this has no problem rendering:

\[ \$ \]


texts: Emacs powerline inconsistent colors behind arrows

texts:
I just setup powerline for the first time and there's this whitish transparent background overtop all of the arrows. Is there anyway to fix this?

Also, while we're at it, just a general question:

What does the 2.24 in the mode line mean?


texts: How may I completely disable all Emacs' default bindings to the Fn keys (F2 - F12)?

texts: I'm willing to allow help to remain on F1, but I don't want any of Emacs default bindings on any of the other Fn keys.  If you must know why, it's because all keyboards made in the last 20 years are garbage, and I'm done putting up with "accidentally" ending up in 2C mode.


texts: How to start emacs with a custom user-emacs-directory

texts:
I'm working on a custom and small Emacs configuration that I want to share with some friends as a git repository for them to use as a baseline for their own future configurations.

For this I need some way to test my configuration and the simplest solution I can come up with is something like:

$ emacs --eval "(setq user-emacs-directory \"~/Code/my_custom_emacs.d/\")"

But I can't seem to make it work.

Any help much appreciated.


texts: emacs -nw standard input is not a tty on ConEmu and Mintty

texts:
On my Windows XP machine I use Emacs-25.2.1. During web app development I use ConEmu version 191012 and I need to use Emacs at the command line. When I enter emacs -nw on ConEmu, it says

emacs: standard input is not a tty

This error occurs on MSYS2's default terminal Mintty which is invoked by cmd.exe /A /Q /K C:\msys32\mingw32_shell.bat, too but it doesn't occur on Windows' default CMD.exe and PowerShell so I guess it may have something to do with the Environment Variables. Several months ago, the ConEmu had a problem where the arrow keys and backspace were not working, (roughly described here) and I remember fixing it by changing or deleting an environment variable. This standard input is not a tty problem seemed to pop up roughly around the same after I fixed that problem but I'm not 100% sure of this.

What should I do to fix this problem?


texts: In Magit: fatal: Could not read from remote repository

texts:
For some repositories at work I get the following message when I try to push my commits:

GitError! Could not read from remote repository.  [Type `$' for details]

The details read:

128 C:/Program Files/Git/mingw64/libexec/git-core/git.exe … "push" "-v" "origin" "master:refs/heads/master"
Pushing to ssh://git@XXX.git

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any idea what the problem could be?
Running the above git command from a git-bash (minus those tripple-dots) also works. In fact, that's my workaround. Compose the commit with magit and just type git push in a git-bash.
Pushing to github.com repository on the same machine works from magit.


texts:
I have my email setup with mu4e and I have org-mu4e so that when I capture a task, a link to the message is added at the end of it. However, I am wondering if there's a way to generate a link to a message so that I can paste it in an old task in my org file. Right now, my way of solving this is to capture a fake task and then copy the link into my old task and delete the fake task.

Is there a better way to do this?


texts: Can I turn off or switch the syntax checker for js2-mode?

texts:
I have a default setup of js2-mode.  This provides nice syntax highlighting and checking but I am now working on a project with a different set of styles (specifically this new project does not use semicolons).

This causes every single line of code to be underlined in js2-mode with the warning: missing ; after statement

Is there a way that I can disable the syntax checking in js2-mode?

Or, even better, is there a way to use a diferent syntax checker?

I have Flycheck mode installed and running for my .js files but I just do not have any syntax checkers enabled (i.e. all checkers are set to nil and not found).  It would be great to know how to enable one of these and disable the built in js2 one.

I know the views on semicolon insertion vary but this project follows the "standard style" for which there is a syntax checker in Flycheck and I am just interested in if I can switch the checker.


texts: Setting `python-shell-interpreter-args` causes slow python mode enabling

texts:
I have a ipython config which imports lots of packages.

I also have some configs in my python setup like

  (setq python-shell-interpreter "ipython3"
        python-shell-interpreter-args "-i --profile=ipy --simple-prompt --pprint")

Loading a lot of packages will cause slow ipython shell startup. But this also happens when python-mode is being enabled.

Moreover, even after opened a python file, when I use C-c C-p to start an interactive shell, the slow progress happens again. Here is the illustration

After removing the --profile=ipy part, both the mode enabling and interactive shell starting will have a significant speed up.

I can understand the slowness of starting an interactive shell process when with --profile=ipy, but not the python mode enabling.

My question is what is the appropriate way to avoid this ? As I don't see any shell process when python mode is being enabled. The mode enabling is still very slow.
Thanks!


texts: How convert txt file to UTF-8 from Windows-1251?

texts:
Windows 10, Emacs 25.

When I want to convert file from Windows-1251 to UTF-8 I use Notepad++.

Before convert:

convert:

after convert:

My question is: Is it possible this convert in Emacs?


texts:
(defun pretty-add-keywords (mode keywords)
      (font-lock-add-keywords
       mode (mapcar (lambda (kw) `(,(car kw)
                                   (0 (prog1 nil
                                        (compose-region (match-beginning 0)
                                                        (match-end 0)
                                                        ,(cdr kw))))))
                    keywords)))

This function currently lets me match a regexp and replace it with a single char. I've been trying to modify it so that instead of just replacing it with a fixed char it replaces it with a group from the regex.

Would anybody be able to help me out.

Thanks


texts: Is there a quicker way to create links to attachments?

texts:
I often want to create a link to the attachment I've just added. Especially when the attachment is an image and I want to show the image inline.
What I usually do is I open the attachment folder in dired mode, copy the filename, then create a link manually by writing [[attachment:the-file-name]].
I was just wondering if there's a quicker way to do this?


texts: Calling emacsclient from ansi-term makes emacsclient hang, how do I get around this?

texts: Sometimes I use ansi-term in emacsclient instead of directly using my shell. When I do this, it is not an infrequent occurrence that I forget where I am and call emacsclient someFile, which freezes the terminal window and doesn't let me start a new emacsclient process. Is there a way to make invocations of emacsclient in ansi-term instead open the file? Or some other way to unfreeze this? The only solution I have found is to kill the server process.


texts:
I want to replace all occurrences of a word in the whole buffer. What i do is:

M-x replace-string RET word-to-be-replaced RET new-word

The problem with this is that it also changes the word-to-be-replaced even if its only part of another word (for example wanting to change mod to off_mod results also changing set_mode to set_off_mode). How can i change it only in cases it exists exactly as a whole word  and not also as parts of other words?


texts:
I'd like to include a custom latex wrapper around src blocks result. For example, given:

#+BEGIN_SRC sh :results latex
which awk
#+END_SRC

I'd like to generate

#+RESULTS:
#+BEGIN_LaTeX
\begin{myverbatim}
/usr/bin/awk
\end{myverbatim}
#+END_LaTeX

Instead of the standard

#+RESULTS:
#+BEGIN_LaTeX
/usr/bin/awk
#+END_LaTeX

Is there a straightforward way to get this?


texts: Font-lock for strings messes up non-code buffers

texts:
In Magit buffers, or helm-swoop, an unclosed double quote enables the string highlighting for the rest of the buffer (until another quote is found). This is how it looks like:

Because of that, I also lose the green/red highlighting of added/removed lines in Magit. When I disable the font-lock-mode, everything becomes fine (blue text is not blue anymore, +/- lines are colored).

I could add hooks to disable font-lock-mode in those buffers but it is too much trouble to do that for every buffer. Can I somehow find out what causes the screwup in the first place?


texts: How to select non-contiguous regions in Emacs?

texts:
Suppose that I have already selected some text in the current buffer.
Is it possible to select another stretch of text, while keeping the previous selection (and so on)?

Added: One motivation for this functionality is as follows:
Assume that I have some text that looks like this:

paragraph 1 ...

paragraph 2 ...

paragraph 3 ...

paragraph 4 ...

paragraph 5 ...

I would like to remove some paragraphs (e.g. 2, 4 and 6) and insert them before paragraph 1.


texts:
Can someone help me with this snippet? I found it here

# -*- mode: snippet -*-
# name: jsdoc comment
# key: doc
# --
/**
* $0
`(save-excursion
(let* ((pos-fun (re-search-forward "\\<function\\s-*(\\([^)]*\\))"))
        (argstr (and pos-fun (match-string 1)))
        (args (and pos-fun (split-string argstr ",\\s-*"))))
    (loop with params = nil
        for arg in args
        for nump = (string-match "s$" arg)
        for param = (if nump (format " * @param {[]} %s - " arg)
                        (format " * @param {} %s - " arg))
        do
        (if (< 0 (length arg))
            (push param params))
        finally return
        (mapconcat 'identity (reverse (cons " * @return " params)) "\n"))))`
*/

it creates this:

/**
*
[yas] elisp error: Search failed: "\\<function\\s-*(\\([^)]*\\))"
*/

I'm suspecting there's something wrong with the regex

What this snippet suppose to do? It creates js-doc comments as function headers in js2-mode. So code like function foo(a, bs, c) should turn into:

/**
* @param {} a -
* @param {[]} bs -
* @param {} c -
* @return
*/
function foo(port, methods, host) {


texts: Can you turn on flyspell for comments but NOT strings?

texts:
I currently use the following to enable flyspell in prog-mode:

(add-hook 'prog-mode-hook 'flyspell-prog-mode)

This checks spelling automatically in comments and strings. However, I would like to disable spell checking in strings.

How can I enable flyspell for comments but not strings?


texts: After executing org-narrow-to-subtree, how do I move between subtrees of the same level?

texts:
When I have executed (org-narrow-to-subtree), how can move between subtrees of the same level.

Is this possible?

I have tried

next/previous heading                             C-c C-n/p
next/previous heading, same level                 C-c C-f/b

But they don't recognize the same levels as the narrowed subtree.

Example:

* Tree 1
** Sub 1
** Sub 2
* Tree 2

If i am at * Tree 1 and do C-x C-n s is there a way to jump between * Tree 1 and * Tree 2 without first doing C-x C-n w?


texts: In terminal, C-) and ) both execute evil-forward-sentence. I want C-) to run paredit-forward-slurp-sexp

texts:
If I type C-f paredit-forward-slurp-sexp, Emacs tells me the command is mapped to C-). Yet through C-h k I realized that both C-) and ) run evil-forward-sentence. If I do C-f evil-forward-sentence, Emacs tells me it is bound only to ).

If I evaluate (key-binding (kbd "C-)")) the result is paredit-forward-slurp-sexp. If I go through what describe-bindings prints, C-) is shown as associated with paredit-forward-slurp-sexp, There are other paredit associations in the listing, like M-<right arrow>, which works fine.

Why is this and how do I make the C-) behave the way I want.


texts:
I want to install the company mode, but searching in the M-x list-packages i find no company mode found, but a bunch of company backends for different languages. How should i install company?
PS: This is my init.el file beginning:

(require 'package)

(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/") t)
;; elpy
(add-to-list 'package-archives
         '("elpy" . "http://jorgenschaefer.github.io/packages/") t)
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))

(package-initialize)


texts: Temporarily show a message in the modeline?

texts: How can I print a message for a period of time to the mode line and restore the default format afterwards?


texts:
When I export an org document to html, the broken links are visible as html link 'nil'.

What I want is just normal text, not link (just description from link). How can I accomplish this?


texts: In EXWM `split-window-right` followed by immediate `windmove-right` swaps order of buffers

texts:
I have a function
(defun bad-fn ()
  (interactive)
  (split-window-right)
  (windmove-right)
  )

If I go to a frame with just one window visiting EXWM buffer A (and buffer B
is next), and call

split-window-right
windmove-right

Manually with M-x, I have A to the left of B, and B is the selected
window.
If I use the above function, I have B to the left of A, and A is the
selected window.
Changing the above to
(defun bad-fn ()
  (interactive)
  (split-window-right)
    (sit-for 0.5)
  (windmove-right)
  )

fixes things.
Emacs version info: "GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+
Version 3.24.22, cairo version 1.17.3) of 2020-08-28"
As a note, I don't think this happened in Emacs 26.3.


texts: package.el asks whether I want to save modified files before package installation. How to disable this?

texts:
When I run M-x package-install to install a package, I get asked whether I want to save files, that have been modified since the last save (Save file /a/b/c.txt? (y, n, !, ., q, C-r, d or C-h) in the minibuffer). I get this prompt for each modified file, and, if installing multiple packages from the *Packages* buffer, I get asked multiple times! This is incredibly frustrating, especially as the files that I am asked about have nothing to do with compilation, and could, in fact, be any files at all, including ordinary text files.

I did a bit of sleuthing, and found that, at the end of the day, package.el runs package-unpack to install a package, which runs package--compile, which runs byte-recompile-directory. I have therefore set the following in my init.el (even though I don't think I should have to do that(!)):

(setq compilation-ask-about-save nil)

No improvement.

Frankly, I thought this must be a side-effect of some customization of mine, since in no way would I consider this to be desirable behavior...until I ran emacs -Q to reproduce this without my config, and, to my surprise, ran into the very same thing. While this seems baffling, it also offers me some hope that perhaps someone has figured out a way to disable this super-annoying prompt?


texts: Copy and paste to system clipboard in tmux

texts:
I have the following code in my init.el

(xclip-mode +1)
(setq
  x-select-enable-clipboard t
  x-select-enable-primary t
  x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)
  x-stretch-cursor t)

In a regular terminal, copy and paste works seamlessly. However in tmux the kill-ring is not synchronized with my regular clipboard, and yank does not yank from the clipboard. How can I fix this?


texts: How to turn off python-mypy in spacemacs flycheck-mode?

texts:
I'm using the latest Spacemacs with the Python layer. I'd like to turn off python-mypy in flycheck-mode, but the following in my ~/.spacemacs doesn't work:
(defun dotspacemacs/user-config ()
  (add-to-list 'flycheck-disabled-checkers 'python-mypy)
)

How do I turn it off?


texts:
I have the following in my init.el, and it does a great job of automatically disabling evil in certain emacs modes:

(dolist (mode '(git-rebase-mode
        flycheck-error-list-mode
        inf-ruby-mode
        term-mode))
  (add-to-list 'evil-emacs-state-modes mode))

However, this will not work for help-mode, which is frustrating, as help-mode has some great keybindings I'd like to take advantage of. I've also tried this: (add-to-list 'evil-emacs-state-modes 'help-mode), but it didn't work either.

How can I turn off evil in help-mode?


texts: Terminal Buffer: error in process filter: Invalid face: unspecified

texts:
On Fedora 25 with GNU Emacs 25.1.90 (which I am running via an AppImage, you can download it from here and test out your theories as to what's wrong if you would like, remember AppImages will only work on Linux though) with a config file found here I get an error whenever I start ansi-term or term via M-x ansi-term<RET> or M-x term<RET>, respectively, namely:

error in process filter: Invalid face: unspecified

I does not seem to matter too much which shell I use as I have tried my default shell, Z Shell (Zsh) and the more popular Bash shell and I get the exact same error message. Despite this the Bourne shell (/bin/sh) works fine. The Emacs debugger gives the following backtrace:

Debugger entered--Lisp error: (error "Invalid face" unspecified)
  internal-get-lisp-face-attribute(unspecified :foreground nil)
  face-attribute(unspecified :foreground nil default)
  face-foreground(unspecified nil default)
  term-handle-colors-array(1)
  term-handle-ansi-escape(#<process terminal> 109)
  term-emulate-terminal(#<process terminal> "[1m[7m%[27m[1m[0m

")

If you're wondering why I don't just use GNU Emacs 25.1 installed via the DNF package manager well using it lead to some issues with Octave syntax-highlighting per this chat room discussion.

It seems to be colouring-related as when I comment out the PS1=... line in my ~/.bashrc file this error goes away and Bash starts without a problem.


texts: How to programmatically insert a string at the end of some file?

texts: How to silently (in background) create a new line at the end of a specific file, say /path/to/file.txt (which is not necessarily a visiting file and is not necessarily already open in emacs) and insert some string (say xyz) in that new line and then to save the file after?


texts: How to make mu4e and Emacs the default email program?

texts: On macOS, when I click an email link <a href="mailto:...">, it opens Mail.app that ships with macOS. How can I change it to mu4e in Emacs?


texts: How to move point to the vertical center of the window when I use `C-u C-SPC`?

texts:
I am using following answer to jump to the previous jumped point and I also use C-u C-SPC as well.

(defun alt-exchange-point-and-mark (&optional arg)
    (interactive"P")
    (exchange-point-and-mark (not arg)))

(global-set-key (kbd "C-x C-x") 'alt-exchange-point-and-mark)

[Q] When the jump operation is performend, can the jumped line be on the center of the window?


texts:
[[link]]@@comment:[[link]]@@
# [[link]]

* link

I get the message "No Link Found" when clicking on the [[link]] within the inline @@comment:[[link]]@@.
The link works fine with emacs -Q, but breaks after evaluating some init.el code. Problem is, I cannot pinpoint to the exact code that broke the link.
Evaluating the code from Castlemacs below, for example, could bring about the error.
;; ====
;; INIT

;; Package system and sources.
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                 (not (gnutls-available-p))))
    (proto (if no-ssl "http" "https")))
    ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
    ;; (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
    (add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
    (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
(add-to-list 'package-archives '("gnu" . (concat proto "://elpa.gnu.org/packages/")))))

(package-initialize)

;; We will use 'use-package' to install and configure packages.
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(eval-when-compile (require 'use-package))

;; No need to out 'ensure' everywhere, since we don't use anything else to install packages.
(setq use-package-always-ensure t)

;; Pass system shell environment to Emacs. This is important primarily for shell inside Emacs, but also things like Org mode export to Tex PDF don't work, since it relies on running external command pdflatex, which is loaded from PATH.
(use-package exec-path-from-shell
  :ensure t)
(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

;; Store custom-file separately, don't freak out when it's not found
(setq custom-file "~/.emacs.d/custom.el")
(load custom-file 'noerror)

;; Set path for private config. private.el is not part of Castlemacs and you can use it for your personal
;; additions. Do not change init.el yourself, it will make updates harder.
(add-hook
 'after-init-hook
 (lambda ()
   (let ((private-file (concat user-emacs-directory "private.el")))
     (when (file-exists-p private-file)
       (load-file private-file)))))


texts: lexical-binding: How to create a let-bound function that recursively calls itself

texts:
The custom function below my-jump-to works after being evaluated in a scratch buffer, but does not work when I stick it into a library with lexical-binding non-nil in the header.  When byte-compiling, I get a warning:  reference to free variable ‘the-fn’.  When I restart Emacs after byte-compiling, and try to use the function, I get a *Backtrace*:  Debugger entered--Lisp error: (void-variable the-fn).  I tried using the trick of putting a #' in front of the (lambda ..., but that did not appear to have any effect.  I tried using a backtick in front of the (lambda ..., and placing a comma before the-fn, but that didn't work either.  Is it possible to make this work inside a library with lexical-binding non-nil in the header, and if so, then how can that be achieved?
  (defun my-jump-to ()
"Jump to an imenu item using ido."
  (let* ((completion-ignore-case t)
         (collection (imenu--make-index-alist))
         (first-amended-collection nil)
         (the-fn
           (lambda (index-alist depth)
             (dolist (entry index-alist)
               (setq imenu-list--line-entries (append imenu-list--line-entries (list entry)))
               (push entry first-amended-collection)
               (when (imenu--subalist-p entry)
                 (funcall the-fn (cdr entry) (1+ depth))))))
         second-amended-collection)
    (funcall the-fn collection 0)
    (mapc (lambda (elt)
            (push (cons (car elt) (list elt)) second-amended-collection))
           first-amended-collection)
    (let ((choice (ido-completing-read "SELECT:  " second-amended-collection nil 'confirm)))
      (imenu (car (cdr (assoc choice second-amended-collection)))))))


texts: How to init emacs with an option (such as `--debug-init`)

texts:
This might be a very silly question, and that's maybe why there's no answer on the internet.

I'm using Windows 10. And I tried to click on properties, and then change the ending of the file's name for --debug-init or --no-window-system and, of course, the .exe disappears.

I could get sites where there're lists of the Options available and their functions but not specifically how to use the Options.


texts: How do I get curly quotation marks to show in Emacs on OS X?

texts:
EDIT: My problem has been fixed or, more precisely, worked around, thanks to help in the comments below. Never figured out what exactly the issue was as it wasn't a problem with my Emacs configuration but with my Emacs installation (which I had originally done via Homebrew).

I am using Emacs 25.0.5 on OS X 10.10.5. For some reason, Emacs displays ‘ ’ and “ ” only as ' ' and " ", respectively. The behavior persists in typopunct-mode (from the Typopunct package), although things like en- and em-dashes display correctly as distinct Unicode characters. The behavior also persists if I use a variable width typeface I am certain has glyphs for curly quotes.


texts: Don't enable tool-bar mode when run in terminal?

texts:
I have .emacs in my ~ which turns off tool-bar-mode
The problem is that when I run Emacs from terminal, rather than standalone Mac app, it fails on that line Symbol's function definition is void: tool-bar-mode , and stops executing the rest of .emacs. Any suggestion how to get around that?


texts: How to search and replace a number starting with 0?

texts:
I know how to do a normal search and replace ,but say for instance that I want to replace all numbers in a buffer that starts with a 0 and the second number is a generic number, how do I match that pattern?

Say that I want to remove all numbers that begins with a zero followed by some other number.


texts: How can I know what command is running when I move the point or select something?

texts:
One example: I select something, then the minibuffer give me some response. For example, in markdown-preview-mode I select a paragraph then the minibuffer shows me the paragraph with <p> in each end.

Another example: I move the point onto some defn in clojure-mode or funtion in js-mode or def in python-mode, then the minibuffer shows me the doc or usage of the function.

So what command cause this behavior? Is this a hook? If so, which hook, and hook to what? How could I know that?


texts: How can a mode be prevented from changing syntax coloring?

texts:
The theme I'm using on emacs (zenburn) makes JDEE custom syntax coloring very hard to read. I'd like JDEE to obey the color theme I've already chosen.

Is there a simple way to prevent a mode from changing the syntax coloring?


texts:
I search for a solution to reference (preferably automatically) radio targets, which are used in plural form in text blocks.

For example, given the radio target <<<message>>>, uses of message in the text are automatically linked to the radio target. However, the plural form messages will not be linked. I tried to use internal links [[message]]s with no success (the link can resolved, but why is this so?).

The only workaround I can think of is explicitly addin a link target <<messages>>. However, I still have to insert the link manually.
What makes thins worse is, that the link works in org-mode, but after html export the link references to a random footnote.
Exports to odt are better, however the text is replaced by a number. So i would have to insert [[messages][messages]]. That looks ugly.

Any suggestions?

I would dream of haveing the ability to note plural version in radio target, e.g. <<<message|messages>>> with only message being inserted visually.


texts:
Expanding <<foo>> using noweb works with #+NAME: foo above one src block.

Why is this one not expanded?

 ** My org section
    :PROPERTIES:
    :header-args: NAME: foo
    :END:
     #+BEGIN_SRC sh
    pwd
     #+END_SRC


texts: How do I insert read-only, HTTP-style headers with editable values?

texts:
I'm creating a 'form' of sorts in a buffer that has a few required arguments:

Title:
Labels:

content content content

When the form is presented, I'd like to be able to edit any and all text after each Header: without being able to move point into Header: -- kindof like a minibuffer prompt.

After looking at the definition of read-from-minibuffer for the right properties, here's what I've got so far:

(defun my--insert-header (header &optional default-value)
  ;; inhibit point from moving inside the field
  (setq-local inhibit-point-motion-hooks nil)
  ;; insert Header: Default-Value pairs
  (let ((props1 '(front-sticky t rear-non-sticky t field t read-only t intangible t face magit-header-line))
        (props2 '(front-sticky nil rear-non-sticky nil field nil read-only nil intangible nil)))
    (insert (apply #'propertize (format "%s: " header) props1))
    (insert (apply #'propertize (or value "") props2))
    (insert (apply #'propertize "\n" props1))))

When I run this code in a scratch buffer

(progn
  (insert "\n\n\n")
  (my--insert-header "Title" "some title"))

I get an error.  I think it's because (insert (apply #'propertize (or value "") props2)) is trying to insert at read-only text, but I'm not sure how to go about fixing that without compromising the desired behavior.


texts: Applying a timeout on call-process/shell-command?

texts:
In some cases, when delegating work to an external process, it's useful to set a timeout on the command to prevent Emacs from hanging indefinitely.
Unfortunately, the following does not work.

(with-timeout (1 nil)
  (call-process "/usr/bin/bash" nil t nil "-c" "sleep 10"))

The same goes for shell-command.

Is there a way to set a timeout on these synchronous processes?
That is, I want the process to be killed automatically if it doesn't
finish within a certain number of seconds. Is that possible?


texts: Sitemap or index for each subfolder in project

texts:
I have all of my notes organized under one project, "Notes", which consists of multiple subfolders with each subject:

|-Notes
  |-Subject 1
    | - topic.org
  |-Subject 2
    | - topic.org

Is it possible to generate a sitemap for each folder that only lists the pages in that folder, plus the sitemap for nested/parent folders? An example would be the Org Manual, which does exactly what I would like, except there is no need for next/previous links.

It is possible to change the function that builds the sitemap with :sitemap-function in the publishing configuration. Is modifying this property the correct approach?


texts: Projectile renaming buffer name causing issues with ESS (ctrl enter) functionality

texts:
I have recently installed projectile package into my Emacs. It's great package, however, now my C-RET binding to ESS (R) is not working any more.

Part of my current init.el related to ESS looks like this:

   (setq ess-local-process-name "R")
   (setq comint-scroll-to-bottom-on-input t)
   (setq comint-scroll-to-bottom-on-output t)
   (setq comint-move-point-for-output t)

   (defun my-ess-start-R ()
     (interactive)
     (if (not (member "*R*" (mapcar (function buffer-name) (buffer-list))))
         (progn
           (delete-other-windows)
           (setq w1 (selected-window))
           (setq w1name (buffer-name))
           (setq w2 (split-window w1 nil t))
           (R)
           (set-window-buffer w2 "*R*")
           (set-window-buffer w1 w1name))))

   (defun my-ess-eval ()
     (interactive)
     (my-ess-start-R)
     (if (and transient-mark-mode mark-active)
         (call-interactively 'ess-eval-region)
       (call-interactively 'ess-eval-line-and-step)))

   (add-hook 'ess-mode-hook
             (lambda()
               (local-set-key [(control return)] 'my-ess-eval)))

   (add-hook 'inferior-ess-mode-hook
             (lambda()
               (local-set-key [s-up] 'comint-previous-input)
               (local-set-key [s-down] 'comint-next-input)))

   (add-hook 'Rnw-mode-hook
             (lambda()
               (local-set-key [(control return)] 'my-ess-eval)))

I am not familiar with Emacs Lisp, so I am bit struggling to make it work. For me it seems it has lot to do with the my-ess-start-R function in the member part. The projectile always concatenate a string with the name of the project after *R* buffer name.

So far I tried to play around with regexp expression to match the buffer name, but no luck.

How it used to be:
If the R buffer is not open, open one, after hitting C-RET
If the R buffer is already open, evaluate the R Code after hitting C-RET

Current situation:
After hitting C-RET the first time Emacs keep opening new R buffers in the format of "R:(project name)(N)" where (project name) is project name coming from projectile and (N) is the count of the buffer. After hitting C-RET the second time new buffer with (N+1) opens.
In the *Messages* buffer I can see an error:
my-ess-start-R: Wrong type argument: bufferp, nil

Expected results:
1. Open R buffer after hitting C-RET if the buffer is not yet open
2. Evaluate R code in R buffer, again after hitting C-RET if the buffer is already open

Any help of how to modify the function would be really helpful.


texts:
How can I use "return receipt" (Message disposition notifications) in mu4e. For composing as well as receiving messages?
For composing I tried to add a "RRT" field in the header, but receiving this mail with thunderbird didn't result in a "return receipt" pop up.
Vice versa I don't know how to make mu4e ask me for Message disposition notification if I receive such an email with mu4e.


texts: Change default behavior of numeric key row?

texts:
I'm looking for a way to redefine the row of numeric keys so that by default it will act as if I'm holding <shift> giving me the punctuation and symbol characters, and holding <shift> will give me the numbers. Basically reversing the behavior.

My issue is, I don't want the keypad keys to change.

For example:

pressing '4' up top would give $
pressing '4' on the keypad would give 4

I see how I could do the reverse: redefine the keypad keys, but the default behavior of the keypad numeric keys is to translate to the number, so redefining the number keys will affect both, right?

Does anyone know a way I could do this? Or maybe this has already been done somewhere?


texts:
I have a project I build using cmake. To build this project, I need to define several options like -DPRODUCT=amd64 -DXML_DIR=/opt/xml_database Normally, I either pass these as -D or configure them in IDEs like qtcreator and vscode. How would I define them in package cmake-ide? I feel like I need to add these to .dir-local.el but could not find an example.

Edit: I am trying to edit the variable given in the answer below and it has a type of string. I checked List Variables documentation but can't seem to make it work. In my dir_local.el

((nil . ((cmake-ide-cmake-args .
            ("-DSOME_CMAKE1=foo_bar1" "-DSOME_CMAKE2=foo_bar2")
        ))
))

but this gives me errors related to type of the variable.cmake-ide-cmake-args has type of list of strings. So, how can I edit that variable? I also tried

((nil . ((cmake-ide-cmake-args .
            (list "-DSOME_CMAKE1=foo_bar1" "-DSOME_CMAKE2=foo_bar2")
        ))
))

((nil . ((cmake-ide-cmake-args .
            `("-DSOME_CMAKE1=foo_bar1" "-DSOME_CMAKE2=foo_bar2")
        ))
))


texts:
I'm looking for an emacs package that can continuously run my unit tests. As I make changes, I'd like to be alerted as soon as a test fails. Preferably, a package that is language agnostic would be great (this is a C++ project). In my case, running the tests is all command-line driven.

Does such a package exist?


texts: Filter out entries for the same package in other repositories (melpa, marmelade, etc.)

texts:
My package-archive variable is set to:

(("melpa-stable" . "http://stable.melpa.org/packages/")
 ("melpa" . "http://melpa.org/packages/")
 ("marmalade" . "http://marmalade-repo.org/packages/")
 ("gnu" . "http://elpa.gnu.org/packages/"))

which means that most packages appear twice or more in my package-list-packages output. Can this be avoided? Can this be avoided in a smart way?

Here's an example output :

  abl-mode           0.9.0         available  marmalade  Python TDD minor mode
  abl-mode           20170604.1309 available  melpa      Python TDD minor mode
  ac-R               0.2           available  marmalade  Autocompletion routines for R
  ac-cider           0.2.0         available  marmalade  Clojure auto-complete sources using CIDER
  ac-cider           0.2.3         available  melpa-s... Clojure auto-complete sources using CIDER
  ac-cider           20161006.19   available  melpa      Clojure auto-complete sources using CIDER
  ac-geiser          0.1           available  melpa-s... Auto-complete backend for geiser
  ac-geiser          0.1           available  marmalade  Auto-complete backend for geiser
  ac-geiser          20130928.2347 available  melpa      Auto-complete backend for geiser

I'd like to see this instead:

  abl-mode           0.9.0         available  marmalade  Python TDD minor mode
  ac-R               0.2           available  marmalade  Autocompletion routines for R
  ac-cider           0.2.3         available  melpa-s... Clojure auto-complete sources using CIDER
  ac-geiser          0.1           available  marmalade  Auto-complete backend for geiser

In this case I favoured marmalade and melpa-stable over melpa. Between marmalade and melpa-stable, I picked whichever had the higher version number.

A workaround would be to add an entry in package-pinned-packages for every package available, but that sounds very unsatisfying.


texts: Setting the time for messages in the minibuffer

texts: Messages that appear in the minibuffer disappear too quickly for me to read them. I would like them to last a few more seconds before disappearing. (I know I can press C-h e to see them again.) I forgot which setting to tweak for this.


texts: Make a monolithic personal config compatible with Prelude and Spacemacs

texts:
I'm refactoring my config from a monolithic init file (a .org that is tangled) to something more modular.

In the same time, I am trying out Prelude and Spacemacs, and I feeling it very likely to use both of them in different context.

As a result I am trying to find a way to dispatch and structure my original init file in a way that can be easily plugged into both Prelude and Spacemacs.

The Spacemacs way uses pushes to create (private) configuration layers. But I'm not sure I could find a way to use them in Prelude. (and I'm not fond of dispatching, dep, function, keybindings into different files)
The Prelude way puts different modules into dedicated files, which you place in folder personal.

How can I do this? Has someone already tried?


texts: How can I set timers in Emacs to trigger at certain times of day? Midnight mode adds hooks for a single "midnight" time, but I would like to create separate hooks for multiple clock times.


texts: AucTeX - insert environment menu command

texts:
I have a big LaTeX project divided in many files; the \documentclass statement and the preamble are in the main file, that in turn includes many (~20) other files, one for every chapter.  One of the statements in the main file is \usepackage{paralist}, in order to use the environment compactdesc.

Visiting the main file, in the AucTeX LaTeX -> Insert Environment menu, compactdesc is listed; and M-Enter inside the environment inserts an \item and asks for the label of that item.

Visiting one of the included file, the lack of a \usepackage causes no inclusion of the compactdesc environment in the LaTeX -> Insert Environment menu list; and I don't like that.

Giving the command M-x LaTeX-environment followed by compactdesc, inserts in the file a \begin{compactdesc}-\end{compactdesc} couple, but M-Enter does not ask for the item label - and I would like to be able to enter the labels for every \item added.

I have tried with the local variables at the end of the file, inserting the lines

% Local Variables:
% mode: latex
% TeX-master: master.tex
% ispell-local-dictionary: "italian"
% End:

(where master is the main TeX file); but still LaTeX -> Insert Environment does not know about compactdesc.

How can I do, to have both 1) the environment compactdesc available and 2) AucTeX knowing about items of that environment having a label?

Thank you in advance for any help.


texts: Query-replace stops after first item in while

texts:
Following this StackOverflow question, I coded this function to clean up text pasted from other sources, such as Google Docs:

(defun sanitize-md ()
  "Replace characters."
  (interactive "*")
  (save-excursion
    (let ((replacement-list '(
                              ("\\" . "/")
                              ("ﬁ" . "fi")
                              ("“" . "\"")
                              ("”" . "\"")
                              )))
      (while (let* ((pair (pop replacement-list))
                    (to-find (car pair))
                    (to-replace (cdr pair)))
               (message "%s %s" to-find to-replace)
               (query-replace to-find to-replace nil (point-min) (point-max))
               )
        replacement-list)
      )))

My problem is the curly double quote “, which I have in a document. When I run this function, I get this in the *Messages* buffer:

\ /
Mark set
Replaced 0 occurrences

If I remove the line on query-replace, then the *Messages* buffer shows all four pairs. And if I put the double-quote pair as the first element of the list, then it gets replaced.
Why does query-replace stop at the first element of the dolist, and how can I code the replacement of all pairs?


texts: Under org mode, Save section of file to another file

texts:
In an org file, I got things like:

  A
  aaa
  B
  bbb

I'd like to save a section of it regularly to a file. The section is being updated daily.

Is there a command that could be inserted in this section to allow to perform this operation repeatedly?

For example, executing:

    * B
    (save-section to `~/b_section.org`)
    - bbb

would perform this task. That is, not just appending, but saving the new updated version of the section.

I tried to archive but, it was an incremental saving, and the section was deleted (this is a minor issue, since I could undo it). It also did not allow for selectively saving different sections to different files.


texts: Any way to display clock time in the modeline for both the current clock and all accumulated clocks simultaneously?

texts:
The variable org-clock-mode-line-total controls whether to show the clocked time of only the current clock or of all accumulated clocks of the current task. However, I'd actually like to show both.

The package org-pomodoro displays a pomodoro counter in the modeline in addition to the normal org-clock display. However, I don't want the countdown of org-pomodoro and want to simply display the time elapsed on the current clock so far, starting from 0:00.

How can I do it?


texts:
I want to use two frames. One on virtual desktop #1 and the other one on #2. I (have to) work on Windows so I would like to see a frame number in the frame title, since Windows lacks a permanently visible virtual desktop indicator.
I thought I just add a frame counter variable to frame-title-format and I'm good to go, but it seems there is none. My current frame-title-format:

(setq frame-title-format '("%b" "   " buffer-file-name))

I'm lacking coding skills, and I couldn't find any solution using Google/SE search.


texts: How to disable scroll lock when moving point

texts:
A strange behaviour happens when I move up or down the point (using the keyboard): Emacs automatically scrolls up or down whenever I pass a certain line threshold. See here:

When moving down, at line 20 the scroll locks (until I reach the end of the buffer). When moving up, the threshold is at line 10.

I would like to disable this scroll locking. That is, I would wish the point could move to the top or bottom of the screen withoug auto-locking the scroll. Any ideas? (Using GNU Emacs 24.4.4 in Linux and Mac.)


texts: Org-mode hook following creation of a new >>

texts:
I want to call org-update-radio-target-regexp as soon as org-mode recognises that a new <<<radio target>>> has been created (which seems to happen as soon as the third ">" is typed, at least this is when it gets fontified).
What hook can I use to get this done?


texts: Is this possible to prettify \(A_i\) to A_i (Ai) in org-mode?

texts: I would like to prettify \(A_i\) to Ai. Is this possible? I looked up the source of org-match-substring-regexp and tried to modify it, but no luck. any help?


texts: Auto highlighting text when paste a new content

texts:
This is my first post here.

I have Emacs installed at work and at home. The functionality is slightly different when I use highlighting and I cannot figure out which options to change.

At work, I applied a couple of highlight-regexp for a number of patterns on temporary buffer (C-x b). I am pretty sure that when I posted a new content of another text, Emacs highlighted a new content. Also, when I typed a new word and that word matched one of the regexps, Emacs automatically highlighted the word.

At home, this functionality is missing and I don't know how to turn it on. It's really useful!

Edit.

I have only added a few functions in .emacs to have: a larger window, no welcome screen, and access to MELPA. Apart from that, I installed a custom color theme (the link here). But this extra package is installed in both versions of Emacs i have at home and at work.

The content of .emacs:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
 '(custom-enabled-themes (quote (atom-dark)))
 '(custom-safe-themes (quote ("ed066c6e5b9d72b2b2acce51bc944b396b82e5338c79135888c584d6979f5cd2" "c64bcaa2a93cf797e7a2f860d0545f8de1833feda24c680bd56ee76d88c06948" default))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

 ;; Custom wind size
 (if (display-graphic-p)
   (progn
     (setq initial-frame-alist
       '(
         (tool-bar-lines . 0)
         (width . 136) ; chars
         (height . 46) ; lines
         ;;
         ))

   (setq default-frame-alist
     '(
       (tool-bar-lines . 0)
       (width . 136)
       (height . 46)
       ;;
       )))
   (progn
     (setq initial-frame-alist
       '(
         (tool-bar-lines . 0)))
     (setq default-frame-alist
       '(
         (tool-bar-lines . 0)))))

 ;; No welcome text
 (setq inhibit-startup-screen t)

 ;; load emacs 24's package system. Add MELPA repository.
 (when (>= emacs-major-version 24)
   (require 'package)
   (add-to-list
     'package-archives
     ;; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
     '("melpa" . "http://melpa.milkbox.net/packages/")
     t))

Edit 2.

Possible variables related to hi-lock-*:

hi-lock-archaic-interface-deduce    hi-lock-archaic-interface-message-used
hi-lock-exclude-modes               hi-lock-face-defaults
hi-lock-face-history                hi-lock-file-patterns
hi-lock-file-patterns-policy        hi-lock-file-patterns-prefix
hi-lock-file-patterns-range         hi-lock-highlight-range
hi-lock-interactive-patterns        hi-lock-map
hi-lock-menu                        hi-lock-mode
hi-lock-mode-major-mode             hi-lock-regexp-history
hi-lock-string-serialize-hash       hi-lock-string-serialize-serial

Possible variables related to global-hi-lock-*

global-hi-lock-mode
global-hi-lock-mode-buffers


texts:
If I open an encrypted .gpg file, Emacs will prompt me for the password in the Minibuf using pinentry.  However, if I try and decrypt an entry in org-crypt, it is popping up a CURSES entry in the shell that launched the Emacs GUI.

I'm seeing this with both Emacs 25 and 26.3.  For some extra background, I'm trying to get this to work on a Windows machine with emacs running in WSL (after having too many issues with native Windows Emacs).  On one older image (with GPG 1.4), org-crypt would prompt me in the minibuffer for the password and all was well.  Then I switched to a newer VM (GPG 2.2) and Emacs hangs while a CURSES prompt appears in MobaXTerm asking for the password.

How can I configure org-crypt to trigger the same password prompt as I get for .gpg files via epa-pinentry-mode?


texts: Is there a way to colorize markdown coding partial

texts:
I want to colorize code snippet in markdown-mode.

# foo.rb
def foo
  do_something
end

And javascript code.

// bar.js
function bar(){
  do_something();
}

In markdown-mode the codes are colored by single color. Is there a way to colorize the codes by using proper programming language color mode?

I mean by reading first line of the codes like # foo.rb or // bar.js.


texts:
I like a clean interface. One without the clutter of scroll bars, or menu bars. So, to remove them, I have the following in my init.el

(progn
  (menu-bar-mode -1)
  (scroll-bar-mode -1)
  (tooltip-mode -1)
  (tool-bar-mode -1)
  (set-face-attribute 'default nil :height 150))

However, these 5 lines are slow. I profiled my startup using esup. And this is what I found

Total User Startup Time: 0.498sec     Total Number of GC Pauses: 0     Total GC Time: 0.000sec

init.el:10  0.231sec   46%
(progn
(menu-bar-mode -1)
(scroll-bar-mode -1)
(tooltip-mode -1)
(tool-bar-mode -1)
(set-face-attribute 'default nil :height 150))

Half of my startup time comes from these 5 lines. Is there any way I can accomplish these same tasks faster? Specifically the menu, scroll, tooltip, and toolbar. Those seem like they should be very quick operations.

Ps. Yes, I know if you use emacsclient, the startup time doesn't matter. But, that's not what this question is about.

Edit:
I checked the time for each line individually. Here are the results:

(menu-bar-mode -1)    ;; 0.032sec
(scroll-bar-mode -1)  ;; 0.105sec
(tooltip-mode -1)     ;; 0.000sec
(tool-bar-mode -1)    ;; 0.000sec
(set-face-attribute 'default nil :height 150) ;; 0.120sec

So, I guess I need to rephrase my question. How can I disable the scroll-bar faster?


texts: Why is the `buffer-undo-list` excluded from `(buffer-local-variables)`?

texts:
I am modifying desktop.el to support restoring the buffer-undo-list, and am push-ing that list at the tail end of the function desktop-buffer-info because the buffer-undo-list is not included in the output of the function buffer-local-variables.

Q:  Is there a built-in method to include the buffer-undo-list in the output of the function buffer-local-variables?  If not, is there a reason why it's not included?

To make the buffer-undo-list get stored into the desktop file, I add:

(push (cons 'buffer-undo-list buffer-undo-list) ll)

It works, but I'd like to understand why a seemingly buffer-local variable is excluded from the function buffer-local-variables.


texts:
How do I create interactive lambda functions?

(use-package general
  :ensure t
  :config
  (general-evil-setup t)
  ;;(setq general-default-keymaps 'evil-normal-state-map)

  (general-define-key
   :states '(normal motion emacs)
   :prefix "SPC"
   "l"  '(:ignore t :which-key "Workspace")
   "lc" '(perspeen-create-ws :which-key "Create workspace")
   "l1" '((lambda () (interactive) (perspeen-goto-ws 1)) :which-key "Workspace 1")
   "l2" '((lambda () (interactive) (perspeen-goto-ws 2)) :which-key "Workspace 2")

   )
)

This works but isn't there a less vebose way?

I also tired funcall and call-interactively

"l1" '((funcall perspeen-goto-ws '1) :which-key "Workspace 1")

But that doesn't seem to work

Another idea was to expand a macro but that also doesn't seem to work

(defmacro goto-ws (idx)
  (lambda () (interactive) (perspeen-goto-ws idx)))

"l2" '((expand-macro '(goto-ws 2)) :which-key "Workspace 2")


texts: I want to enlarge the text in tooltips displayed via https://www.emacswiki.org/emacs/PosTip . What can I do?


texts: Jump to documentation buffer with company-mode

texts: I have recently switched from auto-complete-mode to company-mode and I having fun. Recently I had to write some Emacs Lisp code. I start typing my function, completion candidates are shown, I press F1 and the documentation opens up in another buffer. I would like to jump to the documentation buffer, but, as I type C-x o it gets closed. Any hint?


texts: How to print a separator line at an specific location in the results of a `#+BEGIN_SRC` block whose language is C++?

texts:
The context
In #+BEGIN_SRC blocks whose language is Python, I can show a separator line in the table that shows the results by using None (see example below)
#+begin_src python :results output table
print([['Number', 'Number * 10'], None, [1, 10], [2, 20]])
#+end_src

#+RESULTS:
| Number | Number * 10 |
|--------+-------------|
|      1 |          10 |
|      2 |          20 |

The question
I wonder how I can get that same behavior in #+BEGIN_SRC blocks whose language is C++ (see below)
#+begin_src cpp :results output table
#include <iostream>

int main() {
  std::cout << "Number" << '\t' << "Number * 10" <<  std::endl
            << 1 << '\t' << 10 << std::endl
            << 2 << '\t' << 20 << std::endl;
  return 0;
}
#+end_src

#+RESULTS:
| Number | Number * 10 |
|      1 |          10 |
|      2 |          20 |


texts: How to make image-dired work on remote files?

texts:
I've tried sshand scp for tramp's method (both work for tramp), yet image-dired thumbnail creation fails
Thumb could not be created for /scp:raspi:/media/pi/91D4-7E58//IMG_1.JPG: exited abnormally with code 1

Do I need to setup filesharing e.g. nfs or is there something else I could try before?
Both, tramp and image-dired work fine on local files


texts:
On the 2016 MacBook Pro, monospaced fonts are not lining up. It happens to just some buffers and can only be fixed by changing the default font size then changing it back. My font setting is:

'(default ((t (:family "Ubuntu Mono" :foundry "nil" :slant normal :weight normal :height 181 :width normal)))))

I have the exact same Emacs configuration on two other Macs and never experience this problem.


texts: How do I flycheck files go into a different directory?

texts:
Followings answer for: How do I control how Emacs makes backup files controls generated emacs backup files by redirecting them into antoher folder.

  It is annoying that all backup files go in the
  same directory as the file you're editing, but that is easy to change.
  You can make all backup files go into a directory by putting something
  like the following in your .emacs.

  (setq backup-directory-alist `(("." . "~/.saves")))

[Q] I was wondering can I apply similiar approach into generated flyccheck_ files during run time?

I am using flycheck for python, which keep creates flycheck_<filename> files in the same directory the files is located. This creates some issues during compilation if flycheck_ file remains.

(add-hook 'python-mode-hook
          (lambda ()
            (setq flycheck-python-pylint-executable "~/venv/bin/pylint")
            (setq flycheck-pylintrc "~/.pylintrc")))


texts: Is it possible to enable flyspell in scratch buffers?

texts:
I often use scratch buffers, when I want to take a closer look at some code. However I can't enable flyspell in scratch buffers. Is there a way to also use it when not editing a file ?

EDIT:

I can't enable flyspell-mode while the buffer isn't saved to a file. When I use it in a scratch buffer I only get this message in the echo area Flyspell mode disabled in current buffer. No matter how often I try to activate it.

EDIT:

Thanks to lawlist I found the problem. It seems, that I ignored flyspell-lazy-mode consequently while I was looking for the problem.

  This package also forces flyspell-mode off completely for certain
  buffers.

"Certain buffers" seems to include scratch buffers, but not buffers that are attached to a file. lawlist was right so I reward his correct answer and also his patience.


texts:
I'm a newbie elisp user. I would like to process a few hundred xml files and call an elisp function for each line which does an query-replace to fix a problem in these files.

My question is: how do I write the modified lines back to the file?

Subquestion: currently the lines are not changed to upper case - can you give me a hint why this does not work?

(defun fix-xml-file (filePath)
  "Fix xml file"
    (with-temp-file **filePath**  <<-- Edit: the file path was missing here!
      (insert-file-contents filePath)
      ... do work here ... ) )

(defun fix-xml-folder (folderPath)
  "Fix all xml files in folder"
  (interactive "folder: ")
  (require 'find-lisp)
  (mapcar 'fix-xml-file (find-lisp-find-files folderPath "\\.xml$") ) )


texts: Activate personal configuration to the config with load-file and require

texts:
I created personal my-config in .doom.d and have 'my-org-agenda` etc within it.

#+BEGIN_SRC shell :results output
tree ~/.doom.d  | head
#+END_SRC

#+RESULTS:
#+begin_example
/home/me/.doom.d
├── config.el
├── init.el
├── my-config
│   ├── my-org-agenda.el
│   ├── my-org-babel.el
│   ├── my-org.el
│   └── my-org-note.el
├── packages.el
├── snippets

#+end_example

I do the following configuration:

Add (add-to-list 'load-path "~/.doom.d/my-config/") as the first line of config.el

and require the appropriate personal configs

;;--------------------------------------------------------------------------
;;Org
;;Note taking
;;GTD agenda
;;literature programming
;;--------------------------------------------------------------------------

(require 'my-org-note)
(require 'my-org-babel)
(require 'my-org-agenda)

Restart emacs but got the errors:

    /home/me/Documents/primary.doom.d/my-config/my-org-note.el failed to provide feature ‘my-org-note’

What the problem with my usage of load and require?


texts:
Say you have an org file with several code blocks like the one below:

#+BEGIN_SRC jupyter-python :session py :results silent :async yes
stuff
more stuff
even more stuff
#+END_SRC

Question: Is there any function that would clear the contents of all code blocks, while leaving the code block declaration in place?


texts: how to use CSS to change styling of elements in org-mime emails?

texts:
The org-mime page describes how to use org-mime-html-hook to style HTML email by inserting inline CSS. I used this method to successfully change the styling of my body paragraphs by targeting <p> tags:

(add-hook 'org-mime-html-hook
      (lambda ()
        (org-mime-change-element-style
         "p" "font-family: Georgia,serif;")))

But when I tried the same method to target ordered lists, unordered lists, and DONE headings, it had no effect:

(add-hook 'org-mime-html-hook
      (lambda ()
        (org-mime-change-element-style
         "ul.org-ul li"
         "font-family: Georgia,serif;")))

(add-hook 'org-mime-html-hook
      (lambda ()
        (org-mime-change-element-style
         "ol.org-ol li"
         "font-family: Georgia,serif;")))

(add-hook 'org-mime-html-hook
      (lambda ()
        (org-mime-change-element-style
         ".done"
         "color:#00bb00")))

The CSS styles were not reflected in the org-mime HTMLized buffer at all.

Eventually I was able to address the ordered and unordered lists by targeting the <li> tag directly...

(add-hook 'org-mime-html-hook
      (lambda ()
        (org-mime-change-element-style
         "li"
         "font-family: Georgia,serif;")))

...but doing so also stripped the formatting from my <p> tags!

What's going on here! And how can I style these other elements using org-mime?


texts: init.el config overwritten in certain modes?

texts:
I find when I am using emacs in certain modes that configurations made in my init.el files do not apply anymore. E.g. I have my keybinds set up so that tab is used for indentation, § for snippet completion and ~ for auto-complete completion. In c-mode and python-mode this works fine. However when I attempt to use this in vhdl-mode these commands don't all work. § still works for snippet completion but tab is now used to indentation and autocompletion and rather than bringing up a nice menu of the auto-complete options it merely cycles through the options as I press tab. How can I correct this behaviour? I assume it is set in a seperate init file for that particular mode, in the same way as my snippet and autocompletion don't work in latex-mode for example.

It's particularly problematic because I want to use tab to indent a block of code and it starts auto-completing if I type tab in the middle of a line of text.


texts:
I am using spacemacs. I want to achieve similar thing to the one in question browse through bookmarks in dired.
I would like to be able to quickly choose an alternative destination from within the helm-mini-buffer:

a bookmarked directory
a directory from the current buffer list

The default option just shows all reachable destinations in the directory of the opened file.

I want to have the following behavior:

Open the copy file Helm mini-buffer with spacemacs/copy-file (just Helm copy file function). Then have some shortcut which toggles the showing of bookmark paths on and off (in addition to the default showing of files and directories in the proximity of current buffer) so I can copy the file to this destination.

This goal may be a little ambitious.

Simpler alternative in which I am also really interested is to yank the path of a certain bookmark. Then I just could use the regular copy command and insert the desired path as the copy destination. There is a list-bookmarks function in which one can see the file/directory paths, but I don't know how to grab them.

Of course I can go to the bookmarked directory, copy the path, go to the original file and then use the copy command but I find this cumbersome.


texts:
I would like to use org to type my math lessons, documentation says it has an embedded system completion which can be activated by :

(add-hook 'org-mode-hook 'turn-on-org-cdlatex)

This command is not present on my system (emacs 24).
There is still an org-cdlatex-mod but when I trigger it with M-x it says

Cannot open load file: no such file or directory, cdlatex

After what if I retrigger the mod it says that the mode is now disabled. However it doesn't do anything after I type C-c { to insert an environnment template...

There is a package, but the documentation says that I shouldn't use it since it's embedded in emacs.


texts: Exporting "Artist-mode" drawing to PDF through Org-mode

texts: Do you know how to export an Artist-mode drawing using the Org-mode export feature?


texts:
Such as in the built-in variable mode-line-modified which displays an asterisk in the mode line if the buffer is modified.

Specifically, I want to turn hl-line-mode off when the buffer is modified and on when it's not.

I've read the documentation about "Change Hooks", but I want hl-line-mode to toggle when I undo a change like the mode line asterisk.


texts: Open emacs in basic mode as default editor

texts:
I want to set emacs as the default editor for crontab

me@me:~$ cat .selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/emacs -nw"

but find this solution too heavy for some easy task, so I re-configure it as

me@me:~$ cat .selected_editor
# Generated by /usr/bin/select-editor
SELECTED_EDITOR="/usr/bin/emacs -Q"

emacs was opened but in a GUI mode

How could I open it in terminal in a basic mode


texts: How to find and replace regex within a rectangle selection block

texts:
I have the following text:

| Row # | Facility                 | Recycled Off-site |
|-------+--------------------------+-------------------+
|     1 | 1234, 12th st, jamestown |           216,574 |
|     2 | 1234, 12th st, jamestown |               760 |
|     3 | 1234, 12th st, jamestown |                 0 |
|     4 | 1234, 12th st, jamestown |               464 |
|     5 | 1234, 12th st, jamestown |                 0 |
|     6 | 1234, 12th st, jamestown |             2,280 |

and I want to remove all of the commas in the last column. I am able to select the last column (using a rectangular selection, or C-v in evil-mode), but how do I perform a regex replace only within the selected area? I don't want to replace the commas in the second column.

Any suggestions that use evil-mode would be extra helpful!


texts: Dedicated compile hook on compilation finish

texts:
I use the compilation-finish-functions hook to perform some actions once compilation finishes.  However, unexpectedly to me the hook is also triggered when rgrep completes.

I can't seem to find a more appropriate hook for what I'm after, namely a hook that is triggered only when compile's compilation completes.

Is there such a hook or must I take this into consideration in my hooked functions?

This is how I hook my function (Emacs 25.1.1):

(defun display-piped-output (buffer msg)
  (unless (string-match "^finished" msg)
    (switch-to-buffer "test.log")))

(define-minor-mode moscow-compilation-mode
  "Expect compilation output piped to file"
  :global t
  (if moscow-compilation-mode
      (add-hook 'compilation-finish-functions 'display-piped-output)
    (remove-hook 'compilation-finish-functions 'display-piped-output)))


texts: Is there a place to look for statistics on most useful packages?

texts:
Emacs is a powerful editor (or operating system disguised in a text editor), and some packages are extremely powerful - they improve efficiency diagrammatically.

It might be useful to spend limited time on learning and getting efficient with the most useful packages. Is there a such place to look for statistics or votes on most useful packages?


texts:
I have added the following option in my ~/.emacs file so that it uses the Fortran 2008 standard when checking syntax using Flycheck (as suggested in http://www.flycheck.org/en/latest/_downloads/flycheck.html#Fortran):

(flycheck-gfortran-language-standard 2008)

When I load emacs, I get the following error messages:

Warning (initialization): An error occurred while loading `/home/wadud/.emacs':
Symbol's function definition is void: flycheck-gfortran-language-standard

How do I fix this?


texts:
Since the mode-line space is precious, I'd like to display some information in a fixed size area (60 char for example).

To do so, I'd like the text to scroll, like when music players display music title (that's actually what I want to do).

How can I do this ?


texts: How can I split Emacs to two buffers, one for html and the other for w3m so that when I save the html it refreshes the w3m buffer. Also, when I press E in the w3m buffer it takes me to the corresponding position in the html buffer. Exactly like the sync between tex and pdf buffers in pdf-view.


texts:
Is there a way to open a file from Neotree in a new split window?

I want to achive same functionality as Vim NERDTree shortcuts "i" and "s"

Or is that the wrong approach?


texts:
Regular HTML mode doesn't close tags. Or, if it does, I haven't found out how.

Transitioning out of Sublime Text, I am searching for an HTML markup mode that will close tags intelligently.

The HTML mode that came with my Emacs (on Ubuntu) can open tags automatically, but does not have a shortcut to close them (like Sublime does when you start typing greater than followed by a forward slash).


texts:
I have an org entry with a sexp and a tag:
* test  :test_tag:
%%(org-anniversary 2000 08 23) test anniversary

When I open my agenda "test anniversary" shows up as it should (I'm writing this on August 23rd).
But when I filter by it's tag (/ -test_tag) nothing happens!
How do I filter out sexp entries?
edit:
emacs-version: GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu) of 2019-09-16
org-version: Org mode version 9.3.2 (9.3.2-1-g1d426e-elpa @ /home/maynard/.emacs.d/elpa/org-9.3.2/)


texts: How to set the colors for pdf-tools annotations individually?

texts:
I would like to be able to set the annotation colors to be different (e.g. strike-out "black" while keeping highlight "yellow"). I asked about this as an issue at the github page for pdftools and was told that the ui was not available, but it could be done by using advice. The code below works for me to make the strike-out black. I am wondering is there a better, more flexible, or otherwise superior way to be doing this? Thanks.

(use-package pdf-tools
  :ensure t
  :config
  (defun pdftools-strikeout-black (oldfun loe)
    (apply oldfun loe '("black")))
  (advice-add 'pdf-annot-add-strikeout-markup-annotation :around
#'pdftools-strikeout-black)
  )


texts: Why are there escape sequences in my *Warnings* buffer and how to get rid of them?

texts:
I got this warning while trying to activate the python layer in spacemacs. However, the escape sequences are not unique to this situation; they are usually present whenever there are warnings in the *Warnings* buffer. Why are they there and how do I get rid of them?

OS: macOS 10.13

Emacs Version: 25.3.1

Spacemacs Version: 0.200.9

Shell: zsh (using oh-my-zsh)

.spacemacs: https://pastebin.com/vKVUxFad

*Warnings* Buffer:

Error (use-package): python :init: Invalid version syntax: ‘^[]4;0;rgb:1d/1f/21^[\^[]4;1;rgb:cc/66/66^[^\[]4;2;rgb:b5/bd/68^[\^[]4;3;rgb:f0/c6/74^[\^[]4;4;rgb:81/a2/be^[\^[]4;5;rgb:b2/94/bb^[\^[]4;6;rgb:8a/be/b7^[\^[]4;7;rgb:c5/c8/c6^[\^[]4;8;rgb:96/98/96^[\^[]4;9;rgb:cc/66/66^[\^[]4;10;rgb:b5/bd/68^[\^[]4;11;rgb:f0/c6/74^[\^[]4;12;rgb:81/a2/be^[\^[]4;13;rgb:b2/94/bb^[\^[]4;14;rgb:8a/be/b7^[\^[]4;15;rgb:ff/ff/ff^[\^[]4;16;rgb:de/93/5f^[\^[]4;17;rgb:a3/68/5a^[\^[]4;18;rgb:28/2a/2e^[\^[]4;19;rgb:37/3b/41^[\^[]4;20;rgb:b4/b7/b4^[\^[]4;21;rgb:e0/e0/e0^[\^[]10;rgb:c5/c8/c6^[\^[]11;rgb:1d/1f/21^[\^[]12;rgb:c5/c8/c6^[\6.2.1’ (must start with a number)


texts: Build org-mode documents to specific folder

texts:
I have org-mode files in a git repo and don't want to pollute it with with build files. I probably can't tell git to ignore the built files.

Can I tell Emacs to build the files (see linked question for a list) to a specific folder? I'd prefer the built files to be stored in a common location for all org-mode files, not matter where they are on my system because I don't intend to keep them, but if I can specify that they are put into a certain folder relative to the location of the org-mode document, that's fine, too.

I tried building the file via pandoc because you can run bash scripts from Emacs and in a bash script I could (if I could pass the location of the current file as a parameter) just call pandoc and tell it to store the resulting PDF (pandoc doesn't even create the other files) in the folder I want them to be stored in. However, I wasn't able to make the documents look like the ones org-mode builds.


texts: Rust autocomplete - hide paths where stuff is found

texts:
When the autocomplete from company-racer kicks in, it shows the path where it is found for some reason. For example, if I start typing:

use std::i

it comes up with io /usr/src/rust/src/libstd/io/mod.rs : Module

How can I hide this path so it just suggests io?


texts: How to call a function in a list and substitute its return value in the same position?

texts:
I'm trying to use the following property value in org-publish-project-alist

:html-divs ((preamble "header" "preamble")
            (content "main" (org-export-output-file-name))
            (postamble "footer" "postamble"))

to make the value of the id attribute of the main element the name of the org file. For example,
<main id="index">. However, the actual HTML output is the literal function call: <main id="(org-export-output-file-name)">.

The documentation for org-export-output-file-name says,

  Return file name as a string.


texts:
I have a list that looks like

1.530 2.895
4.362 50.14
3.14  2.7

And I want it to look like

1.530
2.895
4.362
50.14
3.14
2.7

I suspect there is a clever way to use a rectangle to do this but I cannot figure it out.


texts: How to detect if the point is within a comment area?


texts: Unexpected: magit stash performs git reset --hard, why?

texts:
I used magit to store current workspace content to git using z z, which I expected to store my work in a stash. However, process log showed that magit simply did git reset --hard HEAD and created an empty stash. I expected some git stash.

Ok, then I thought I might want to "Save workspace", so I did z w and what magit issued was git checkout -- ., plus empty stash.

Err, ok, maybe I want a "Snapshot"? That did "something", creating an empty stash...

I could not find the issued command in buffer the magit-process buffer of the current repository...

I am confused what is happening here...

PS: I had much luck, that I did not lose my work.

EDIT:

To be more precise: I want to know why I almost lost all changes (all done to already tracked files).

What I learned already is, that magit creates the stashes somehow and then performs reasonable cleanup.

EDIT:

Fault was making process-environment file-local and fiddling with environment, from a .dir-local.el. Lessons learned: Read the docs and don't do that!


texts: Version control: registered or unregistered?

texts:
I'm a bit confused when writing code using the VC interface. After executing the following commands in the shell (committing a dummy file ~/test/file in a fresh git repo ~/test):

cd
mkdir test
cd test
git init
touch file
git add file
git commit -am "test"

I end up in a situation in which Emacs (vc-state "~/test/file") evaluate to unregistered but (vc-registered "~/test/file") reports the converse as it evaluates to t. What's wrong?


texts: Is there a way to auto-format (in terms of things like indentation etc) the entire buffer or a region in an html file?