texts:
How do I set a fallback font for LaTex export to pdf?

I have the following setting in my init.el.

(setq org-latex-classes
      '(("article"
         "
\\documentclass[12pt,a4paper]{article}

\\usepackage{xeCJK}
%\\usepackage[heading]{CJK}
\\usepackage{zhnumber} % package for Chinese formatting of date time (use /zhtoday)
%\\usepackage[yyyymmdd]{datetime} % set date time to numeric

% Set default indentation

\\setlength\\parindent{12pt}

% Set Paper Size, Page Layout (another variable is 'bindingoffset')
\\usepackage[margin = 1.5in, paper = a4paper, inner = 2.5cm,
outer = 2.5cm, top = 3cm, bottom = 2.5cm]{geometry}

% Keep paragraph indentation while having a line break in between paragraphs.
\\edef\\restoreparindent{\\parindent=\\the\\parindent\\relax}
\\usepackage{parskip}
\\restoreparindent

% Indent first paragraph.
\\usepackage{indentfirst}

\\usepackage{titlesec}
\\usepackage{titling}
\\usepackage{fontspec} % packages for title and section-heading font setting.

% Set Font.
\\setsansfont{Arial Unicode MS}
\\setmainfont{Calibri} % Set serifed font to Calibri. Originally set to 'Times New Roman', but it cannot display certain characters such as ①②③.
\\setCJKmainfont{MingLiU}
\\setCJKsansfont{Kaiti TC} % Set Chinese font. NOTE: Remember to append CJK before of the font class. CJK HAS to be there for the font to show.

\\titleformat*{\\section}{\\fontsize{16}{18}\\bfseries\\sffamily}
\\titleformat*{\\subsection}{\\fontsize{14}{16}\\bfseries\\sffamily}
\\titleformat*{\\subsubsection}{\\fontsize{12}{14}\\bfseries\\sffamily} % Set formats for each heading level. 'sffamily' will point to the sans-serif font. In this case, 「楷體」.
\\renewcommand{\\maketitlehooka}{\\sffamily} % Set title font.

% Set quotation font.
\\usepackage{etoolbox}
\\newCJKfontfamily\\quotefont{Kaiti TC}
\\AtBeginEnvironment{quote}{\\quotefont\\normalsize}

% Tweak default settings.
\\renewcommand{\\baselinestretch}{1.2} % Set line width.
\\renewcommand{\\contentsname}{目次} % Translate content page title to Chinese. (Could possibly be done automatically with '\\usepackage[heading]{CJK}'. TODO experiment. )

% For text-boxes

\\usepackage{mdframed}
\\BeforeBeginEnvironment{minted}{\\begin{mdframed}}
\\AfterEndEnvironment{minted}{\\end{mdframed}}

% [FIXME] ox-latex 的設計不良導致 hypersetup 必須在這裡插入
\\usepackage{hyperref}
\\hypersetup{
  colorlinks=true, %把紅框框移掉改用字體顏色不同來顯示連結
  linkcolor=[rgb]{0,0.37,0.53},
  citecolor=[rgb]{0,0.47,0.68},
  filecolor=[rgb]{0,0.37,0.53},
  urlcolor=[rgb]{0,0.37,0.53},
  pagebackref=true,
  linktoc=all,}
"
         ("\\section{%s}" . "\\section*{%s}")
         ("\\subsection{%s}" . "\\subsection*{%s}")
         ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
         ("\\paragraph{%s}" . "\\paragraph*{%s}")
         ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
        ))

Sample Org Document:

#+OPTIONS: toc:nil

#+BEGIN_QUOTE
㊀㊁㊂ ①②③
#+END_QUOTE

㊀㊁㊂ ①②③

PDF generated:

As apparent from the above example, Kaiti TC contains the characters ㊀ etc. but MingLiU does not.

How can we define a fallback font for CJKmainfont so that ㊀㊁㊂ without the quote can be displayed properly?


texts: Is there a color selector in Emacs, that reads the HTML color under cursor?

texts:
As an alternative to the awesome vCoolor plugin.

I tried to find alternatives in Emacs. When you do M-x color. You see a list of possible color functions. But nothing of them reads the color under the cursor and lets you input the HTML color (e.g. #BD9800).
Or something in that way.

Is there any function or package that offers same functionality as the vCoolor plugin for Vim?


texts: Prefer side-by-side splits over top-bottom splits even when calling `calendar`

texts:
From what I understand, Emacs splits windows by first trying a horizontal split and then a vertical split. I'm fine with that behavior, except when in fullscreen mode. I've tried several of the solutions posted in the answers to this very similar question and they almost work. So, I can set it so the new window appears to the right of the current one whenever the current window is wide enough, and below otherwise, in most cases by using this bit of code:
(with-eval-after-load "window"
  (defcustom split-window-below nil
    "If non-nil, vertical splits produce new windows below."
    :group 'windows
    :type 'boolean)

  (defcustom split-window-right nil
    "If non-nil, horizontal splits produce new windows to the right."
    :group 'windows
    :type 'boolean)

  (fmakunbound #'split-window-sensibly)

  (defun split-window-sensibly
      (&optional window)
    (setq window (or window (selected-window)))
    (or (and (window-splittable-p window t)
             ;; Split window horizontally.
             (split-window window nil (if split-window-right 'left  'right)))
        (and (window-splittable-p window)
             ;; Split window vertically.
             (split-window window nil (if split-window-below 'above 'below)))
        (and (eq window (frame-root-window (window-frame window)))
             (not (window-minibuffer-p window))
             ;; If WINDOW is the only window on its frame and is not the
             ;; minibuffer window, try to split it horizontally disregarding the
             ;; value of `split-width-threshold'.
             (let ((split-width-threshold 0))
               (when (window-splittable-p window t)
                 (split-window window nil (if split-window-right
                                              'left
                                            'right))))))))

(setq-default split-height-threshold  4
              split-width-threshold   160) ; the reasonable limit for horizontal splits

However, when opening a calendar buffer, the buffer appears on the right of the current window no matter how narrow it is.
I tried looking into the definition of the calendar function, but I can't quite figure out how to make it behave the way I want it to---I'm very new to elisp and Emacs in general. Looking at the answer to this question I found the following seems to work but only when calling calendar from the org-agenda buffer:
(defun my-window-displaying-agenda-p (window)
    (equal (with-current-buffer (window-buffer window) major-mode)
        'org-agenda-mode))

(defun my-position-calendar-buffer (buffer alist)
  (let ((agenda-window (car (cl-remove-if-not #'my-window-displaying-agenda-p (window-list)))))
    (when agenda-window
      (let ((desired-window (split-window agenda-window nil 'below)))
        (set-window-buffer desired-window  buffer)
        desired-window))))

(add-to-list 'display-buffer-alist (cons "\\*Calendar\\*" (cons #'my-position-calendar-buffer nil)))

I can sort of see how to tweak the function my-position-calendar-buffer so that the calendar always shows at the bottom, say. But I'd like to have the position of the calendar buffer depend on the window width, and would like to understand how to get a unified solution to both problems.


texts: Is it possible to show all files in all subfolders in one buffer?

texts:
Emacs 26.1, Windows 10, dired+

Suppose I has folder with 2 subfolders. In every folders has files. Is it possible , to show all files in one buffers.
Smt like this:

P.S.
If I use "i" (dired-maybe-insert-subdir)  in dired mode

it's not good, because I need to press 4 times to open all folders.
But I want with ONE press to show all folders/files and all its subfolders and files.


texts: Different fill-column for comments than code in programming modes

texts: I don't mind if the occasional code line runs long.  For example, the Shopify ruby standard allows lines of 120.  But I want comments to be restricted to the first 78 lines or so.  Is there any way in a programming major mode to have a different fill column for comment lines than for code line?


texts: use nonstandard `.git` directory with magit

texts:
I have been using the setup described on the top comment  here to manage my dotfiles using git. In short, I have this in my .bashrc:

alias config='/usr/bin/env git --git-dir=$HOME/.myconf/ --work-tree=$HOME'

I then can run any git command using config add <file>, etc. Is there anyway to get this working with magit, so I can commit changes to my configuration files without dropping into a shell?


texts: Optional prompts in org-capture template using helm?

texts:
Is there a way to bypass a prompt (set the value to nil) in an org-capture template with helm?

Specifically, template looks like this:

("m" "Meeting notes" entry (file "~/Dropbox/org/meetings.org")
       "* %^{Meeting Time}T %^{Title} %^g \n** %i%?\n " :prepend t)

How can I leave out the title (%^{Title}) or tags (%^g)? I've tried an empty string, but that aborts the capture. Pressing enter without any input selects the first helm completion.


texts: Is nxml-mode vulnerable to the billion laughs attack?

texts: I was asked this by a friend, and I couldn't find any information about whether this vulnerability exists in nxml-mode as current or not. I specifically mean this billion laughs attack.


texts: How to configure the LSP language server

texts:
Iam trying LSP and it works great ; Upon startup a "wizard" offers you to install a server for the language you want to use it with ; I chose jstr, but now I want to try the Eslint server, but I can't find any way to get rid of jstr, even by deleting my whol config, then re-installing everything and installing eslint, jstr is still here..?

My config:
(use-package lsp-mode
  :straight t
  :commands (lsp lsp-deferred)
  :init
  (setq lsp-keymap-prefix "C-c l"))

(use-package lsp-ui
  :straight t
  :defer t
  :custom (lsp-ui-doc-position 'top-right-angle)
  :bind
  :hook (lsp-mode . lsp-ui-mode))

(use-package lsp-ivy
  :straight t
  :defer t)

(use-package lsp-treemacs
  :straight t
  :bind
  ([(f2)] . treemacs))

(use-package js2-mode
  :straight t
  :defer t
  :config
  (setq js2-global-externs '("module" "require" "buster" "sinon" "assert" "refute" "setTimeout" "clearTimeout" "setInterval" "clearInterval" "location" "__dirname" "console" "JSON" "PTL" "$" "exports" "resolve" "reject" "process" "localStorage" "DOMPurify"))
  (add-hook 'js2-mode-hook #'company-mode)
  :custom
  (company-dabbrev-code-ignore-case t)
  :mode "\\.js\\'"
  :hook ((js2-mode . lsp-deferred)
     (js2-mode . display-line-numbers-mode)))


texts: Why is face-attribute interfering with isearch?

texts:
Question: Why does face-attribute interfer with isearch filter predicates?

The following code is part of my answer to the question about searching for bold text.

If I set the variable isearch-face-bold-p-fun to the predicate function isearch-face-p searching the Emacs man page for daemon with isearch-bold-forward works like expected. Isearch stops at bold occurences of the word daemon.

If I set isearch-face-bold-p-fun to isearch-face-bold-p instead and search the Emacs man page for daemon no matches are found.
(There are even stranger effects in other constructed examples.)

The main difference between isearch-face-p and isearch-face-bold-p is the call of face-bold-p which works with face-attribute. That motivates my question.

(defun isearch-face-p (start end)
  "Return non-nil if face at start-position is bold."
  (save-excursion
    (goto-char start)
    (face-at-point t t)))

(defun isearch-face-bold-p (start end)
  "Return non-nil if face at start-position is bold."
  (save-excursion
    (goto-char start)
    (cl-some (lambda (face) (and (facep face) (face-bold-p face))) (face-at-point t t))))

(defvar isearch-face-bold-p-fun #'isearch-face-bold-p
  "Isearch filter for bold text.
The value should be a function suitable for `isearch-filter-predicate'.")

(defun isearch-bold-forward-end-fun ()
  "Uninstall isearch filter `isearch-face-bold-p'."
  (remove-function (local 'isearch-filter-predicate) isearch-face-bold-p-fun)
  (remove-hook 'isearch-mode-end-hook #'isearch-bold-forward-end-fun))

(defun isearch-bold-forward ()
  "Like `isearch-forward' only accepting bold matches."
  (interactive)
  (add-function :after-while (local 'isearch-filter-predicate) isearch-face-bold-p-fun)
  (add-hook 'isearch-mode-end-hook #'isearch-bold-forward-end-fun)
  (call-interactively #'isearch-forward))

Tested with emacs -Q Emacs version GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-04-12.

EDIT:

Drew solved why the search in the man buffer for Emacs failed.
Pityngly that is not the only case that fails.
In the following code I adapt Drew's proposal to add the non-nil INHERIT argument to face-bold-p.

(defun isearch-face-p (start end)
  "Return non-nil if face at start-position is bold."
  (save-excursion
    (goto-char start)
    (face-at-point nil t)))

(defun isearch-face-bold-p (start end)
  "Return non-nil if face at start-position is bold."
  (save-excursion
    (goto-char start)
    (cl-some (lambda (face) (and (facep face) (face-bold-p face nil t))))))

(defcustom isearch-face-bold-p-fun #'isearch-face-bold-p
  "Isearch filter for bold text.
The value should be a function suitable for `isearch-filter-predicate'."
  :group 'isearch
  :type 'function)

(defun isearch-bold-forward-end-fun ()
  "Uninstall isearch filter `isearch-face-bold-p'."
  (remove-function (local 'isearch-filter-predicate) isearch-face-bold-p-fun)
  (remove-hook 'isearch-mode-end-hook #'isearch-bold-forward-end-fun))

(defun isearch-bold-forward ()
  "Like `isearch-forward' only accepting bold matches."
  (interactive)
  (add-function :after-while (local 'isearch-filter-predicate) isearch-face-bold-p-fun)
  (add-hook 'isearch-mode-end-hook #'isearch-bold-forward-end-fun)
  (call-interactively #'isearch-forward))

New Test:
Isearch for bold with M-x isearch-bold-forward starting at the beginning of the following org snippet.

Point jumps from the b of the first occurrence of bold to the o of the second (non-bold) occurrence.

Some of the text here is **bold**.
Some intermediate text.
We do not need to bold everything.
Here is some more **bold** text.

Local Variables:
mode: org
End:


texts:
I don't know how to compile and run a C++ file in GNU Emacs. I searched on the various sites and stackexchange network, but from them what I understood was write something like make compile, and I don't know what does that mean, obviously compiling something. I even have looked at GNU Emacs reference card and Dired reference card on gnu.org, but I could not find a helpful code and explanation of how to compile and run a C++ file.

Can someone help me with compiling and running, how each is done separately, and what steps are? For example, I see g++, gcc, -o, -Wall, foo.cpp, ./.a codes elsewhere but I don't know their function. Can someone explain their function, please? I have seen somebody's answer on stackoverflow which said:

  if something is on your ~/PATH

What is that? How to put something in ~/PATH.

I know I'm asking for too much, but I don't want to use ready-go IDEs or compilers, I want to use GNU Emacs, and I want to learn it hard way. Thanks.

PS: I use Linux Ubuntu 16.somenumber as an OS. Thanks.


texts: Calculations à la Emacs Rocks -- with `multiple-cursors`

texts:
In this "Emacs Rocks" video relating to the library multiple-cursors ( https://github.com/magnars/multiple-cursors.el ), the author demonstrates a way of swiftly performing calculations, getting the result in the main window (not in the mini buffer). However, he does not explain what commands are being used. I haven't been able to replicate them, having consulted the available documentation.

Any ideas on how he does it?


texts: Indentation of conditional comments in web-mode.el

texts:
I want to set the indentation of conditional comments to 2 space, like this:

<!--[if lt IE 9]>
  <script src="https://...)

The default is 4, like this:

<!--[if lt IE 9]>
    <script src="https://...)

NOTE:

I have tried without web-mode, just builtin HtmlMode and SgmlMode, and the behavior is the same: I can't modify conditional comments indentation.


texts: Why does a let-bound huge list survive garbage collection after the let form?

texts:
Note that the following original test is errorneous and has been superseded by the EDITED version below.

(progn
  (message "Before: %S" (memory-use-counts))
  (let ((x (make-list 100000000 0)))
    (message "Use: %S" (memory-use-counts)))
  (message "Garbage Collect: %S" (garbage-collect))
  (message "After: %S" (memory-use-counts)))

The message output after running the progn form is:

Before: (1974893 657 3944364 16613 2025974 923 92307)
Use: (101974903 658 3944364 16613 2026125 923 92310)
Garbage Collect: ((conses 16 100008801 10478) (symbols 48 2200 4) (strings 32 2545 1051) (string-bytes 1 82237) (vectors 16 3935) (vector-slots 8 69235 13732) (floats 8 11 12) (intervals 56 57 163) (buffers 992 7))
After: (101975693 659 3944734 16613 2029800 923 92506)

One clearly recognizes the huge list of 100000000 conses in the cons counter of the memory-use-counts.

Obviously the garbage-collect after the let-form does not free the memory for the conses of the huge list. Why?

emacs-version:
GNU Emacs 27.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-08-16
and
GNU Emacs 26.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-04-12

EDIT:

User legoscia was so kind notify me about an error in my test with his answer.

Nevertheless, we can correct the test (with some self-check at the end) and the result of the new test still acknowledges that the memory for the huge list is not freed:

(progn
  (message "Before: %S" (garbage-collect))
  (let ((x (make-list 100000000 0)))
    (message "Use: %S" (garbage-collect)))
  (message "After: %S" (garbage-collect))
  (message "Let's check again: %S" (garbage-collect)))

The output of this test is:

Before: ((conses 16 8012 7551) (symbols 48 2200 4) (strings 32 2533 939) (string-bytes 1 82159) (vectors 16 3912) (vector-slots 8 68701 11716) (floats 8 10 8) (intervals 56 26 21) (buffers 992 7))
Use: ((conses 16 100008064 733) (symbols 48 2200 4) (strings 32 2558 914) (string-bytes 1 83293) (vectors 16 3913) (vector-slots 8 68847 11570) (floats 8 10 8) (intervals 56 26 21) (buffers 992 7))
After: ((conses 16 100008106 691) (symbols 48 2200 4) (strings 32 2559 913) (string-bytes 1 83491) (vectors 16 3913) (vector-slots 8 68847 11570) (floats 8 10 8) (intervals 56 26 21) (buffers 992 7))
Let’s check again: ((conses 16 100008062 735) (symbols 48 2200 4) (strings 32 2559 913) (string-bytes 1 83495) (vectors 16 3913) (vector-slots 8 68847 11570) (floats 8 10 8) (intervals 56 26 21) (buffers 992 7))

The doc string of garbage-collect says that the (nth 2 (assq 'conses (garbage-collect)))) is the number of conses found live in memory. So, this time the test should be valid.

Relevant part of the doc string of garbage-collect:

  Reclaim storage for Lisp objects no longer needed.
  Garbage collection happens automatically if you cons more than
  gc-cons-threshold bytes of Lisp data since previous garbage collection.
  garbage-collect normally returns a list with info on amount of space in use,
  where each entry has the form (NAME SIZE USED FREE), where:
  - NAME is a symbol describing the kind of objects this entry represents,
  - SIZE is the number of bytes used by each one,
  - USED is the number of those objects that were found live in the heap,
  - FREE is the number of those objects that are not live but that Emacs
    keeps around for future allocations (maybe because it does not know how
    to return them to the OS).


texts: Change scratch buffer to org mode by default

texts:
When I test some codes in scratch buffer, usually first set it as org mode manually.

How could config it as 'org mode' rather than fundamental mode by default.


texts: Troubleshooting: changing default folder in .emacs not working

texts:
I am trying to make emacs start on the folder where all my orgfiles are saved. I achieved this in my windows machine by changing the "Start In" field of the shortcut properties, as suggested in this SO question.

However I haven't been able to make the changes in my .emacs file have any effect on this matter on my ubuntu machine. I am still left in my home folder when emacs is opened. I have tried several options such as the ones here and here. For clarity I'll write them below:

;; Efforts to change default emacs folder
;;(cd (concat (getenv "HOME") "/Dropbox/orgs/"))
;;(cd "~/Dropbox/orgs/")
;;(setq default-directory (concat (getenv "HOME") "/Dropbox/orgs/"))
;;(setq default-directory "~/Dropbox/orgs/")
;;(add-hook 'find-file-hook #'(lambda () (setq default-directory (expand-file-name "~/Dropbox/orgs/"))))

Any tips on how can I go about this? I am using GNU Emacs 24.5.1.


texts: How to replace sections of non-org files from within org-mode?

texts:
I am trying to write some notes on django with the help of org babel.
Is there a way to replace a block in a file(which was not tangled with org) after I eval a certain src block?
Here's what I mean:
If my project is named ProjectA, django automatically creates the following files:
Project A
├── asgi.py
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py

Now, from within org-mode, I am creating a new app called core by executing the following:
#+begin_src shell
python manage.py startapp core
  #+end_src

It creates a new directory called "core" with some boilerplate files.
There is a section inside ProjA/settings.py where all manually created app should be registered explicitly:
  INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'core',
  ]

Right now, I manually appended core to the end of the INSTALLED_APPS.
But since I am creating the app from within org-babel, is there a way to register the app from within org-mode without manually going to settings.py(which is not an org tangled file) and appending core to the end?
Thanks.


texts:
I added a section binding to my config, but one key doesn't work.
:bind (("C-c a" . org-agenda)
       ("<f6>"  . org-capture)
       ("<M-S-return>" . org-insert-subheading))

These two keys (C-c a, f6) work as I expected.
If I check the M-S-return key binding via C-h k, the help will show the org-insert-todo-heading binding.
How do I bind M-S-return to org-insert-subheading?


texts:
I would like to integrate the calendar from my outlook into my orgmode agenda.

I am looking for a solution with the following features

Should be implemented in elisp only, so that I can run this on any system that has emacs
Should use Microsoft Exchange EWS Webservices to retrieve the calendar items.
Should create an org file containing the items for a predefined period (i.e. next two weeks or similar...)
Should be compatible with Office 365

I found some solutions, that come close, but are not quite there.

The ews-orgmode solution (see https://github.com/kautsig/ews-orgmode). This is implemented in python and generates an org file. This is problematic, because this obviously requires a python implementation and a scheduling solution. This makes this hard to use across platforms (e.g. windows vs linux) and requires significant effort to set up.
excorporate (see https://github.com/emacsmirror/excorporate). This is implemented in elisp, but does not provide any orgmode integration. I can create a buffer containing the calendar entries for a specific date, but cannot integrate it into the org agenda, because the buffer is not persisted and I am not aware of any way to call excorporate on agenda creation (with a specific date or date range) and to show those entries in the agenda

Is there any way to achieve an exchange calendar integration into the agenda using excorporate or something similar?


texts: How to make Helm always add ^ to the input pattern

texts:
Is there a way in Helm to first match substrings from the beginning and only after that in the middle of candidates?

For instance, I have the following directory structure:

~/
    .emacs.d/
    .gem/
    .microemulator/

And I want to open a file in the directory .emacs.d. I start to type .em and Helm matches .gem first.

How to make Helm match .emacs.d first, without prepending the beginning of line symbol (^)?


texts: Remove color overlay from active line with `display-line-numbers-mode`

texts:
Since linum-mode is replaced with display-line-numbers-mode I'm having an color overlay on the active line, seen in this screenshot as white on the line 77:

Tried to change the theme and few other modifications but this remains. I'm not doing anything to emphasize line on which my cursor is at, so I'm guessing that shouldn't be the source also.
I tried setting it with both (global-display-line-numbers-mode t) and (display-line-numbers-mode t) but it's the same.
How could this be removed, or what variable could be set to customize that color?
Additional question: Could I instead of that overlay have slightly different font color?


texts: Automatically add an Org tag if some other Org tag is added

texts:
I want a mechanism by which if an Org headline has TAG1, TAGX2 is also added to it. This can happen at capture time (preferable) or some kind of a cron job that runs every x minutes, parses all headlines and adds tags as needed.

Of course, if TAGX2 is already added, that headline should be left alone or we will have :TAG1:TAGX2:TAGX2: kind of situation!


texts:
Is there an equivalent of C's system(char*) or Python's os.system(string) for emacs --script?
I want to use Emacs for shell-scripting purposes. However, I cannot find a function that allows running an executable in a subprocess and connectings its STDOUT/STDERR directly to the terminal.
make-process, call-process, start-process, shell-command, async-shell-command all require a lot of additional code to forward the process output from either an intermediate Emacs buffer or by using filter functions.
I am looking for a solution that replicates the simplicity of int status = system("ls -l");. Ideally, it should be a builtin feature of Emacs to avoid having to set up EMACSLOADPATH.


texts: Evaluating `org-babel-clojure` blocks returns all form evaluations

texts:
I'm trying to set up babel for use with Clojure according to http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html#org85bc1ec and I can evaluate code but when I evaluate a block with multiple forms in it it outputs all of the form like so

#+begin_src clojure :results value
  (def small-map {:a 2 :b 4 :c 8})
  (:b small-map)
#+end_src

#+RESULTS:
: #'user/small-map4

I'm using cider for the back as given in the tutorial and I'm not getting any errors just unwanted input.

I don't think anything in my Emacs config should effect this but I can post if needed.

I've used the debugging tools to go through cb-clojure.el and found that the nrepl-sync-request:eval result dictionary list the output of all of the form in value without any separator so I'm guessing that its something with the nrepl tools. I'm running the most up to date version of cider from melpa.


texts: Split command line into a list of arguments

texts:
How do I take a string giving a shell command line such as:

"program arg1 arg2 \"long argument with spaces\" arg\\\"3"

and turn it into a list of unquoted arguments like:

("program" "arg1" "arg2" "long argument with spaces" "arg\"3")

I.e. almost the reverse of shell-quote-argument. shell-unquote-argument doesn't do the trick.

I realize this sounds like an XY problem. I'd like to offer a minibuffer prompt for the user to give command line arguments to an external program, then run that program via call-process. I could prompt for the command line arguments one at a time until the user gives a blank, but it seems like better UI to let them type all the arguments at once as they would at a real shell prompt. I could also error out on fancy characters and only let them type alphanumerics, dashes and spaces, but that seems limiting. As a third alternative, I could use the call-process variant that gives the command line to a shell instead using it directly as the argv, but I'd like to avoid giving the user the full power of the shell (pipes, redirects, etc.) as that would probably confuse more than help.


texts:
I am trying to set up the emacs server daemon and use emacsclient on MS Windows so that files can be opened quickly without the delay and overhead associated with starting additional instances of emacs for each file opened. I am following the specific instructions provided in emacswiki for MS Windows which involves:

Running emacs as a daemon, runemacs.exe --daemon
Followed by invoking emacsclientw.exe with the appropriate options.

Starting the daemon succeeds (I see emacs.exe in the process list), but invoking emacsclient produces errors. The wiki says to create a shortcut to emacsclientw.exe and change the target to

X:\path\to\emacs\bin\emacsclientw.exe -na "X:\path\to\emacs\bin\emacsclientw.exe" -c -n

Is this correct? It looks like the client is invoked twice. Using the target as shown does not run the program and produces the error "file name or argument required". Using only the first part of the target shown above

X:\path\to\emacs\bin\emacsclientw.exe -na

produces a generic error. Using only the second part

X:\path\to\emacs\bin\emacsclientw.exe -c -n

produces the error "No socket or alternate editor." (The official emacsclient options are described here.)

Any suggestions? Emacs runs fine in standard mode, that is, not in daemon mode. Version 25.1.  I would prefer to run the daemon rather than starting the server in my initialization file.


texts:
I want to extract the title of a bibtex entry by using a convenient org-ref function. Is there a way? How?

Im using org-ref with org-mode in spacemacs.


texts: Theme editing: bash: change color of heredoc

texts:
I am editing a bash theme file for emacs. I can't seem to figure out which keyword defines the color of heredoc in bash.

(e.g.:

cat<<EOF
some code here
EOF

)

How can I set the color coding for these blocks?

Thank you.


texts: Syntax coloring: Unable to color special syntax

texts:
I am writing a mode to color a few common syntax in a symbolic language called FORM. I am a new user of emacs and I took the help of this website to write down the following code. I modified the original code changing the syntax that I want to be colored. But keywords that have special characters (hash # / dot . /underscore _ ), such as "#define", "...", "(dot)sort", "(dot)end", "d_" etc, do not show color.

(setq form-font-lock-keywords
    (let* (
          ;; define several category of keywords
          (x-keywords '("S" "s" "V" "v" "I" "i" "F" "f" "CF" "cf"))
          (x-types '("#define" "..."))
          (x-constants '(".sort" ".end" ".store" ".global" ".clear" ))
          (x-events '("break" "bracket" ))
          (x-functions '("d_" "g_" "g5_" "g6_" "g7_" "gi_"))
          ;; generate regex string for each category of keywords
          (x-keywords-regexp (regexp-opt x-keywords 'words))
          (x-types-regexp (regexp-opt x-types 'words))
          (x-constants-regexp (regexp-opt x-constants 'words))
          (x-events-regexp (regexp-opt x-events 'words))
          (x-functions-regexp (regexp-opt x-functions 'words)))

      `(
        (,x-types-regexp . font-lock-type-face)
        (,x-constants-regexp . font-lock-constant-face)
        (,x-events-regexp . font-lock-builtin-face)
        (,x-functions-regexp . font-lock-function-name-face)
        (,x-keywords-regexp . font-lock-keyword-face)
        ;; note: order above matters, because once colored, that part won't change.
        ;; in general, put longer words first
       )))

(define-generic-mode  form-mode nil  "form mode"
   "Major mode for editing FORM symbolic tool."

    ;; code for syntax highlighting
    (setq font-lock-defaults '((form-font-lock-keywords))))

(provide 'form-mode)

To my understanding, what I did was:

I have defined categories of the keywords --> x-name of the category
Generated regular expression - regex (I am not sure of its function in this context) for each category
assigned regex to a font that has unique color
set nil as parent mode

At first I thought that my parent mode was not accurate to show color for #/./_ symbols, but now I think that's not the main issue. I think the problem comes from 1-3 options. Please provide your valuable suggestion on this problem. Many thanks!


texts:
Have a way to paste the primary selection using this, but now I want the same functionality with multi-term. Using the function I wrote earlier just causes "Buffer is read-only: #<buffer *terminal<1>*>" to print out.

How do I gui-get-primary-selection to work with multi-term?


texts: How to enable multiple minor modes in one shot?

texts:
In order to perform some debugging, I'd like to enable multiple (say n) modes: mode-1, mode-2, ..., mode-n. This can be done thanks to a C-x C-e at the end of each of the following lines:

(mode-1 t)
(mode-2 t)
...
(mode-n t)

but this is a pain if n is large (more than 50).  Is it possible to achieve the same result in one shot?


texts:
Current with C, Javascript, Ruby, etc. when inserting a block with { <RETURN>, Emacs automatically indents the next line, but it does so with spaces. How do I change this behavior to tab characters? The follow is my configuration.

(setq-default tab-width 2)
(setq-default c-basic-offset 2)
(setq-default indent-tabs-mode t)

This sets the indention level to 2 (for C and Ruby, but strangely 4 for Javascript), but it still inserts spaces rather than tabs.


texts: Stop "File not found in root path, do you want to change root?" message

texts:
When using Spacemacs and neotree, I often see this message pop up

File not found in root path, do you want to change root? (y or n)

If I say y, it moves neotree to the directory of whatever buffer I was on at the time that it popped up. However, I rarely want to do this and would rather not see the message. Is there a flag I can disable to achieve this?

This message is printed by the Neotree package [reference]


texts:
My package depends upon org 9. I want to use cask to enforce this dependency.

The way to specify this in my cask file would seem to be (depends-on "org" "9.0.1") as documented
here.

However cask seems to be ignoring the version specified.
The following is some sample output demonstrating this.

> cat Cask && cask install && cask update && cask eval "(progn (require 'org) (message (org-version)))" && cask --version && emacs -q --eval "(progn (require 'org) (message (org-version)))" --batch
(source gnu)
(source melpa)

(package "org-db-link" "0.1.0" "Quickly navigate and search your emacs org trees")
(files "org-db-link.el")

(depends-on "org" "9.0.1")
8.2.10
0.8.1
Loading 00debian-vars...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...

Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Loading /etc/emacs/site-start.d/50ecasound-el.el (source)...
Loading /etc/emacs/site-start.d/50festival.el (source)...
Loading /etc/emacs/site-start.d/50pylint.el (source)...
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...
Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...

    8.2.10

```

I have tried running cask upgrade but this did not help.


texts: How to run process in administrative mode from Emacs?

texts:
I've been using powershell.el in MS Windows Emacs, but I sometimes want
to be administrative mode so that I can do software installation via
chocolatey, etc.

Is there any way to call shell command, or call-process, in admin.
mode from Emacs?


texts:
The following code:

defines a major mode my-mode where C-d binding is redefined;
opens a my-mode buffer inserting an editable-field widget.

(require 'widget)
(require 'wid-edit)

;; Define my-mode mode
(defvar my-mode-map
  (let ((map widget-keymap))
    (define-key map (kbd "C-d") (lambda () (interactive) (message "Ctrl D")))
    map))
(define-derived-mode my-mode nil "My")

;; Open my-mode buffer and insert editable field
(let ((buf (get-buffer-create "*buf*")))
  (with-current-buffer buf
    (my-mode)
    (widget-create 'editable-field
           :format "Field 1: %v ")
    (widget-setup))
  (switch-to-buffer buf))

My problem is that, C-d binding works only outside the editable field.
How can I make it work inside the field too?


texts: Change post-self-insert-hook only in one mode

texts:
I have written a functionality that inserts the word end at end of blocks in a lua major mode. How i do it is to check if a space character has been typed, if yes is the word before the space for example function, if yes print the end. Now adding my funcionality to post-self-insert-hook will change its hooks-list in all modes and buffers. How can i specify it to happen only in lua-mode?

Here is my code in my init.el:

(add-hook 'lua-mode-hook 'mein-lua-mode-hook)
(defun put-end ()
  "print end of blocks"
  (interactive)
  (backward-char)
  (when (member (thing-at-point 'word) '("function"))
    (progn
      (save-excursion (insert "  " "end"))
      (forward-char))))
(defun spacep ()
  (if (and (derived-mode-p 'lua-mode)(member (char-before) '(13 32)))
      (put-end)))
(defun mein-lua-mode-hook ()
  "Tastaturanbindungen fuer das Lua-Mode"
  ;;; some other things come here
  (add-hook 'post-self-insert-hook 'spacep))


texts: Configure Hack as default font in .emacs.d/init.el

texts:
I would like to configure the default Emacs font in my init.el (as opposed to using M-x customize that a lot of other questions here on Emacs Stack Exchange has already explained).

I have tried the following;

(when (eq system-type 'gnu/linux)
    (set-default-font "-unknown-Hack-normal-normal-normal-*-14-*-*-*-m-0-iso10646-1"))

This works, the result is what I want, the font size is correct. If I place point on a char and do C-u C-x = I get the following;

position: 171 of 841 (20%), column: 0
character: R (displayed as R) (codepoint 82, #o122, #x52)
preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x52
script: latin
syntax: w   which means: word
category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
to input: type "C-x 8 RET 52" or "C-x 8 RET LATIN CAPITAL LETTER R"
buffer code: #x52
file code: #x52 (encoded by coding system utf-8-unix)
display: by this font (glyph code)
xft:-unknown-Hack-normal-normal-normal-*-14-*-*-*-m-0-iso10646-1 (#x4E)

But I have a feeling this is a somewhat temporary way of doing this.

Another way I tried was;

(when (eq system-type 'gnu/linux)
  (add-to-list 'default-frame-alist '(font . "Hack-10")))

This works so far as to set the font but the font size is just a bit to small;

position: 15130 of 22797 (66%), column: 4
character: d (displayed as d) (codepoint 100, #o144, #x64)
preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x64
script: latin
syntax: w   which means: word
category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
to input: type "C-x 8 RET 64" or "C-x 8 RET LATIN SMALL LETTER D"
buffer code: #x64
file code: #x64 (encoded by coding system prefer-utf-8-unix)
display: by this font (glyph code)
xft:-unknown-Hack-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1 (#x87)

Now the font size is said to be 13 instead of 14 which is what I want. The numbers used when setting the default font using set-default-font and using default-frame-alist seems to have different meaning, that is the "14" and the "10".

Can I use default-frame-alist to set my default font to Hack with size 14 or is there a better way of doing this in the init file?


texts: How to set a tangled parent directory for each subtree in org mode?

texts:
Base on this, one can set a global tangled file.

However, I'd like to set one directory for each subtree, e.g. for a * Python subtree, in every code block I can set :tangle a.py or :tangle b.py instead of :tangle python/a.py and :tangle python/b.py.

Any help will be appreciated.


texts:
When you select a region normally, you can do a replace-string on only that region.

It would be very useful to select a rectangular region (via C-x SPC), and be able to replace-string on only that rectangle. Currently, it acts as though the region is everything between the beginning and end of the selection, not just the rectangle.

Is there any way to get the functionality described above? I've tried the multiple-cursors package, that doesn't provide this either.

Using Emacs 26.2, if it helps.


texts: When starting dired, go to the existing dired window

texts:
I'm getting better and better at using emacs but one thing is annoying when using dired. When I run dired, it opens a new one, which is obviously the intended behaviour. Would it be possible to write a function so when I run M-x dired, it starts dired, however, if there's already a dired buffer, it'll take me there without starting a new instance.

I don't really know anything about elisp.

Edit: I'm adding some pseudo code to clarify it:

function dired2() {
   if (dired.buffer.exists) {
     existing_dired = get.dired.buffer
     focus.on.existing_dired
   }
   else {
     run.dired
  {
{

Thank you.


texts: How to get emacs to automatically insert block comment prefixes?

texts:
I would like to type source code comments of the form:

{-
 - Hello World
 -
 - This program prints "Hello World".
 -}

where I would like emacs to automatically insert the leading - for each line. Is there any way to teach emacs to do this?


texts: Remapping global keybindings to a prefix command

texts:
The following works:

(define-prefix-command 'my-map)
(global-set-key (kbd "C-@") 'my-map) ;; MacOS
(global-set-key (kbd "C-SPC") 'my-map) ;; Windows 10

The following does not:

(global-set-key [remap set-mark-command] 'my-map)

It fails with the error that my-map is not a command (commandp returns nil).

The emacs manual states that "putting a remapping in a prefix keymap like ctl-x-map typically has no effect, as such keymaps are not themselves active;" however, I am remapping a command in the active global map to a prefix map. So why does this fail?


texts: Variable-width font in info- and help-mode with correct text width?

texts:
If I use info inside emacs and enable variable-pitch-mode, all text is displayed in proportional fonts, but the text width is all wrong, because info-mode laid out the text assuming fixed-width characters and a window width of something like 70 characters. The same thing happens in help buffers as well.

How do I get info-mode to lay out the text neatly when using a variable-width font?


texts: I create around 50 folders in a day. I use dired. I need to add custom comments such as New (N), old (o) and Review (R) to analyse my days work. Is adding the comments in dired possible?


texts: how to define bindings for multiple keymaps with bind-keys?

texts:
I use bind-key and I haven't found anything else that convenient for organizing key bindings. However sometimes I want to bind some commands for more keymaps than one. That's the way I do it now for both maps.

  (bind-keys  :map some-map
               :prefix-map some-prefix-map
               :prefix "PKEY"
               ("KEY1" . command1)
               ("KEY2" . command2))

and I want it to also work this way

  (bind-keys  :map map1 map2
               :prefix-map some-prefix-map
               :prefix "PKEY"
               ("KEY1" . command1)
               ("KEY2" . command2))

EXAMPLE:

  (bind-keys :map org-mode-map emacs-lisp-mode-map
              :prefix-map f14-prefix-map
              :prefix "<f14>"
              ("x" . my-elisp-indent)
              ("y" . paredit-open-round)
              ("z" . paredit-kill))


texts: tabbar scroll picture button grayed out when only one tab is active

texts:
I replaced the image for tabbar scroll. Original:

Replaced them with the following lines in the init file:

  ;; Load a new tabbar arrow image
  (setq tabbar-scroll-left-button-enabled-image-one '((:type png :file "~/tabbar-scroll-left.png" :ascent center)))
  (setq tabbar-scroll-left-button
        (cons (cons " <" tabbar-scroll-left-button-enabled-image-one)
              (cons " =" nil)))
  (setq tabbar-scroll-right-button-enabled-image-one '((:type png :file "~/tabbar-scroll-right.png" :ascent center)))
  (setq tabbar-scroll-right-button
        (cons (cons " >" tabbar-scroll-right-button-enabled-image-one)
              (cons " =" nil)))

I replaced them with a colored picture, but they are only colored when there are multiple tabs.

With only one tab (both scroll pictures are greyed out):

With two tabs (Right scroll icon is showing as colored, which is desired when they are always colored):

The desired scenario is to have the two scroll image always colored. I investigated tabbar.el but did not have a clue where it defines behavior of graying out a colored picture. Can anybody help?


texts: How to input special character, such as Celsius symbol, and common greek letters?

texts:
I want to input:

Celsius degree symbol
Common Greek letter: Alpha, Theta, Omega


texts:
I changed chronos-text-to-speech-notify acording to https://github.com/dxknight/chronos/issues/2.

My Chronos config includes this:

  (setq chronos-text-to-speech-program-parameters  "-s 50 -k 1 -a 50 -v mb/mb-fr1" ).

The command

  (chronos-add-timer "0:0:1" "Coucou, je parle français" nil)

is supposed to speak the message with a French voice, but it doesn't (default English voice only)

Chronos sent  this shell command:

  espeak \"-s 50 -k 1 -a 50 -v mb/mb-fr1\" \"20:44 Coucou, je parle français\"

which returned

  Failed to read voice 'mb/mb-fr1"'

This shell command works fine, however:

espeak -s 50 -k 1 -a 50 -v mb/mb-fr1 "20:44 Coucou, je parle français"

This sounds like a bug, but I haven't succeeded in fixing it.


texts: Changing HOME directory only for Emacs (on Windows 7)

texts:
Due to the COVID19, I am working from home via VPN.  The HOME directory is set to a directory on the company network.  Other applications use this directory as well.

I would like to have Emacs use a local HOME directory without changing the HOME environment variable (used by other applications).  I'm hoping this will speed up Emacs.

The manual and other issues say to change the value of the HOME environment variable in order load the .emacs and other initialization files.  I can't do this because other applications refer to the HOME directory.

I have Windows 7 set up to run "runemacs.exe" when a ".cpp" file is double clicked in File Explorer.

So, how do I change the Emacs home directory, so that File Explorer can pass the HOME directory to Emacs (?via command line?)?


texts: how to disable autocapitalization for specific words?

texts:
I use org-mode, with auto-capitalize-mode turned on.

But sometimes, within org-mode, I want to type out some lisp, highlight it, and execute it.

I might type something like

(setq org-cycle-emulate-tab)

Auto-capitalize automatically capitalizes setq to Setq.

I don't feel like switching modes to emacs-lisp-mode or disabling auto-capitalize-mode. I just want it to recognize that I never want the word setq capitalized.

How can I disable autocapitalization for certain specific words?


texts: Shift key is not working after Meta key (Mac OSX)

texts:
My Shift key is usually working but the combination M-S- is not, and M-S- is sometimes pretty useful in org-mode. It's not just for org-mode, though. I tried describe-key but when I enter S- after M- nothing happens.

  For example, M-> (meta+shift+period) no longer activates end-of-buffer.

I'm using Emacs 24.5 and I'm under OSX El capitan


texts:
How can I narrow a buffer to the python class at point?

narrow-to-region works but requires first selecting the class as a region, and it seems python-mode has moved on since this was written:

http://blogs.fluidinfo.com/terry/2011/01/28/py-narrow-to-class/


texts: Shortcut to put the selected region in an ordinary LaTeX environment (not with begin-end style) using auctex

texts:
In auctex if one has a selected region and then apply the command c-c c-e (LaTeX-environment) then by selecting an environment, the selected region will be folded between that environment.

Is there a similar command to put a selected region between an ordinary command (not begin-end environments, but ordinary latex environment)?

As a specific example assume that one would like to put the selected region between the braces in \underline{}. Is there a command which takes the name of the environment (in this case unerline) then put the selected region between the braces in \underline{}?


texts:
Using an icicles menu with emacs 26.1, I'm now having the menu sorted.

The menu used to be unsorted (items appeared in the order they were given). In the previous version of emacs they were unsorted.

How can I call the menu so it keeps the items unsorted?

See: https://emacs.stackexchange.com/a/38752/2418


texts: How to prevent emacs from popping up with new frames in response to dedicated windows? I would much rather it split the existing window

texts:
I've recently started using dedicated windows because I have certain windows (a python interpreter, sometimes a PDF of a LaTeX document), that I do not want obstructed under any circumstances. This mostly works great, except sometimes, I run a command that wants to open a new window and instead of splitting the window, it opens a whole new frame!

For an MWE of this issue, if you have AucTeX, try creating a buffer with the .tex extension and paste in the following code:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
(progn
  (defun toggle-window-dedicated ()
    "Control whether or not Emacs is allowed to display another
buffer in current window."
    (interactive)
    (message
     (if (let (window (get-buffer-window (current-buffer)))
         (set-window-dedicated-p window (not (window-dedicated-p window))))
         "%s: Can't touch this!"
         "%s is up for grabs.")
     (current-buffer))
   (force-mode-line-update)
  )
  (global-set-key (kbd "C-c d") 'toggle-window-dedicated)
(turn-on-reftex))
\begin{equation}
1+1=2\label{fish}
\end{equation}
\eqref{fish}
\end{document}

First, evaluate the great big Elisp expression that I randomly put in the middle of my TeX file. Next, split your frame into two windows using C-x 2 or C-x 3. Type C-c d to make your current window dedicated, then C-x o to switch to the other, non-dedicated window. Now move the cursor the the word fish in \eqref{fish} and type C-c & to find the label its referring to.

Emacs opens a new frame! I have confirmed that Emacs25 has this behavior with a blank .emacs.

If you tried the same behavior with a frame containing only one window, Emacs sensibly splits the window. I would like Emacs to always split windows in situations like this, and never open new frames unless I explicitly request it.

First, Is there a way to do that? Second, should I file a bug report?


texts: how can i configure sgml-mode to format open and close tags on same line?

texts:
I set up my emacs to use sgml-mode so that I can format xml with M-x reformat-xml, but it puts the closing tags on the line below, rather than on the same line.

instead of this:

<mytag>stuff
</mytag>

I want this:

<mytag>stuff</mytag>

Can I configure sgml-mode to do this for all reformats?

So far I've just got this to activate sgml-mode:

(require 'sgml-mode)

(defun reformat-xml ()
  (interactive)
  (save-excursion
    (sgml-pretty-print (point-min) (point-max))
    (indent-region (point-min) (point-max))))


texts:
I am using the railwaycat brew install version of emacs.

24.5.1

I have the following alias in my .bashrc:

alias edit="emacsclient -a '' -nw"

I also have $EDITOR set to the same command.

If I run edit in a terminal before I open the gui version, it starts a daemon in the background, and opens emacs in the terminal, which is what I want.

However, if I run the GUI version of emacs first, and then type edit in the terminal, it opens a new frame, which is NOT what I want.

How can I get it to always open the terminal version in the terminal?


texts: Is it possible to disable magit calling :git branch --remote --contains  when doing an interactive re-base?

texts:
I'm running on fairly large repository (Gentoo's portage, 2.5G .git) and slightly slow hardware (1Ghz arm64) and interactive re-basing is very slow. It seems the main culprit is "git branch --remote --contains " so I'm wondering why it's done and if it is possible to limit it somehow?

These operations are very expensive over the whole repo, for example:

(385.025976377 #1# "branch" "--remote" "--contains" "2bb9cf91e26e")

takes over 6 minutes to complete.


texts: How can I hide general text in parentheses?

texts:
I have some legal text that is peppered with digressions and interpolations in parentheses, so many that it is hard to keep track of the main text.

Pasting the text into emacs at least allows me to match parentheses easily, but it occurs to me that it would be handy to be able to hide all text in parentheses. I don't want to delete the text, because then I would have to replace it all at the end.

Here's an example of the desired output.

Before:

The doctor (who was a friend of mine) had graduated from John Hopkins (a well-known school) in 2003 (and as a result of his time there was something of an expert on Baltimore) before moving to Ireland (his grandmother was Irish) in 2008.

After:
The doctor had graduated from John Hopkins in 2003 before moving to Ireland in 2008.

Can emacs be made do this without a ton of elisp? I note a number of other questions related to folding, but they seem to be line-oriented (hiding functions in code, or sections in LaTeX etc.) rather than word-oriented.


texts: Can I include a common code block in two different code blocks in Org mode?

texts:
I have an org-mode file containing a table of data and two Python code blocks to extract different summaries from it.

I would like to share some common constants and functions between these two code blocks.  Ideally, I'd do this by factoring out the common code into a separate code block, which would be automatically included and evaluated whenever either of the other two blocks is evaluated.  In made-up syntax, it would look something like the following:

#+NAME: init_block
#+BEGIN_SRC python
  ... common constants and functions here ...
#+END_SRC

#+NAME: summary_1
#+BEGIN_SRC python :prepend init_block
  ... data-processing code depending on init code goes here ...
#+END_SRC

#+NAME: summary_2
#+BEGIN_SRC python :prepend init_block
  ... more processing which also depends on init code ...
#+END_SRC

I suppose I could use the :session option, but I would prefer not to, for two reason.  First, it sets up a stateful system, rather than one which runs from scratch each time I use C-c C-c on a code block.  Second, and relatedly, I now have to remember to manually evaluate the common initialization code each time I open the file: I can't just update the data table, go to one of the summary blocks and hit C-c C-c to update it.

Is there a good way to do this?


texts: Why is emacs so bad at rendering long strings of text and what can be done to make it good?

texts: Whenever a long string is to be rendered in an emacs buffer, which usually happens in the shell, emacs hangs and freezes, or takes too long to render the text compared to the terminal. What can be done to improve the performance of rendering text in emacs buffers?


texts: Make octave-mode recognise the MATLAB command spmd

texts:
The parallel toolbox for MATLAB has a command, spmd  (https://se.mathworks.com/help/parallel-computing/spmd.html), that octave-mode does not recognize. Note: I know how to make octave-mode recognize it as a keyword.

The problem is that MATLAB expects spmd to have a matching end, which confuses octave-mode that sees an "extra" end. In addition, the statements in between should be indented. E.g. like this:

parpool(3)
spmd
  q = magic(labindex + 2);
end

How can I make octave-mode treat spmd as per above?

The lisp snippet below makes octave-mode highlight spmd as if it was a keyword:

(font-lock-add-keywords 'octave-mode
                        '(("\\<spmd\\>". font-lock-keyword-face)))

Update: Clarified intention of workaround snippet above.

Update 2: Using Stefan's workaround partially solves the issue. The end is now matched to spmd, although indentation is to large for some reason. See below for an example of the result, where the statements

      while false
        1;             # The expected amount of indentation
      end

      spmd
          1;           # Twice the expected amount of indentation
      end


texts:
Is there a way to make Ediff highlight whitespace using a different color, the way it does for non-whitespace differences?

For example, here are two regions with only whitespace differences:

And here are two regions with non-whitespace differences:

The non-whitespace differences are highlighted with ediff-fine-diff-* faces, while whitespace differences are not. I'd like some way to tell what the whitespace differences are.


texts:
I've started on Learn C The Hard Way and want to collect my work in org mode. Executing

rm ex1 && CFLAGS="-Wall" make ex1

in the terminal returns

cc -Wall    ex1.c   -o ex1
ex1.c: In function ‘main’:
ex1.c:3:3: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration]
   puts("Hello world.");
   ^~~~

but executing the source block

+BEGIN_SRC sh :results output :dir lcthw/
  rm ex1 && CFLAGS="-Wall" make ex1
+END_SRC

renders

+RESULTS:
: cc -Wall    ex1.c   -o ex1

without the warnings.

Anyway I can include the warnings in the results of the source block? It is very relevant for working with C.

Feel like I have tried most (all?) results flags without success. Also looked into this question, but it specifies as python specific, so not sure if it should work.


texts: How can I use C- C- for backward/forard-word under MacOsX?

texts:
I tried the following to assign Ctrl-left/right for moving one word forward/backward, but none of them works:

(global-set-key (kbd "<C-left>") 'backward-word)
(global-set-key (kbd "<C-right>") 'forward-word)
(global-set-key (kbd "C-<left>") 'backward-word)
(global-set-key (kbd "C-<right>") 'forward-word)

Has anyone an idea?


texts: Why does SSH mode for emacs (ssh-el) hang?

texts:
Adding this for anyone who runs into this problem.

I use SSH mode for emacs (ssh-el) on Windows and it just hangs there without connecting sometimes, usually after a crash.


texts: What is an Emacs- and org-friendly "command character" for GNU Screen?

texts:
The default "command character" for GNU-screen is C-a, which collides with the default key combination for move-beginning-of-line in Emacs, and for the analogous command of many other interfaces.

It is difficult to find an alternative command character for GNU-screen that does not collide with some common Emacs binding.  And for users of org-mode the problem is considerably worse.

I figure that there must be enough users of both GNU-screen and org-mode (and also of Emacs, of course) for there to be a widely accepted solution to this problem.


texts:
Is it possible to prevent kill-ring from storing whitespaces/empty lines? Right now after I do a couple of changes and then go to browse-kill-ring I often see something like this:

-------

-------
   merchant_uuid: "some_uuid"
-------
   it "creates a webhook" do
-------

-------

-------

Is there a way of forcing kill-ring to only append meaningful content?


texts:
I am trying to write a function which will perform a bookmark-jump but then reset the the bookmark line to the top of the screen. So far I have:
  (defun foo ()
    (interactive)
    (bookmark-jump)
    (evil-scroll-line-to-top nil)
    )

  (define-key evil-normal-state-map [f9] 'foo)

But hitting F9 gives this message. What am I doing wrong please?


texts:
My terminal in Doom looks like shown in picture but I can't seem to find a way to solve this.
I have term activated in my init.el


texts: How to export an html file with a foldable & dynamic TOC from an org file?

texts:
When HTML pages are extended I find it quite useful to have a TOC (table of Content) available all along with your scrolling.
A good example of an implementation of such a functionality is the Worg webpages (here is an example), which are generated from org files.
So my question is, how is this done? Is it done through a CSS file? If it is, what would the CSS code be?


texts:
I'm new to emacs, and I'm trying to set it up as my editor for both python and R. Elpy and Ess are both great, and I'm relying on them a lot. However, I'm used to the Ess key-bindings, and would like the same key-bindings for the similar Elpy commands. For instance, elpy has elpy-shell-send-statement-and-step bound to C-c C-y C-e, and ess has ess-eval-region-or-line-and-step bound to C-<RET> (both of these essentially do the same thing).

What is the best way to modify a few of my Elpy key-bindings to match the matching Ess key-bindings in my init.el?

Thanks in advance!


texts: thing-at-point does not bound url properly due to backslash in url

texts:
I am trying to filter URLs and elisp thing-at-point 'url doesn't bounds a url properly because it has backslashes \in it. I believe that backslashes are unsafe in urls, but that's a separate topic. The fact is that I am receiving emails with URLs that have them.
So my question is if there is any way to ensure that thing-at-point allows backslashes, so that urls can be properly bounded? The relevant functions should be available at thingatpt.el Thank you in advance.

Update

This is phils' solution

(defun thing-at-point-bounds-of-url-at-point (&optional lax)
  "Return a cons cell containing the start and end of the URI at point.
     Try to find a URI using `thing-at-point-markedup-url-regexp'.
     If that fails, try with `thing-at-point-beginning-of-url-regexp'.
     If that also fails, and optional argument LAX is non-nil, return
     the bounds of a possible ill-formed URI (one lacking a scheme)."
  ;; Look for the old <URL:foo> markup.  If found, use it.
  (or (thing-at-point--bounds-of-markedup-url)
      ;; Otherwise, find the bounds within which a URI may exist.  The
      ;; method is similar to `ffap-string-at-point'.  Note that URIs
      ;; may contain parentheses but may not contain spaces (RFC3986).
      (let* ((allowed-chars "--:=&?$+@-Z_[:alpha:]~#,%;*()!'\\\\")
         (skip-before "^[0-9a-zA-Z]")
         (skip-after  ":;.,!?")
         (pt (point))
         (beg (save-excursion
            (skip-chars-backward allowed-chars)
            (skip-chars-forward skip-before pt)
            (point)))
         (end (save-excursion
            (skip-chars-forward allowed-chars)
            (skip-chars-backward skip-after pt)
            (point))))
    (or (thing-at-point--bounds-of-well-formed-url beg end pt)
        (if lax (cons beg end))))))

and this is the original and url bounded by thing-at-point-bounds-of-url-at-point (both edited)

original:

https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.disney.com%2F&amp\;data=02%7C01%7CDonald.Duck%40disney.com%7Cfd8a40dd8138470286be08d8020da460%7C07ef1208413c4b5e9cdd64ef305754f0%7C0%7C0%7C637261604914185764&amp\;sdata=UdFaQR32cGXKu7ZrBU%2BGg8TJ%2BOeTZUMBV9N%2BE8Vi22s%3D&amp\;reserved=0

bounded:

https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.disney.com%2F&amp


texts: What should I do to get xi:include to be recognised and my specified dtd file used?

texts:
Pretty simple xml file with:

<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
                      "../../../../tools/docbook-dtd-4.4b2/docbookx.dtd"
[
<!ENTITY % vers   SYSTEM "../../../../doc_developer/version.xml">
%vers;
]>

<book>

  <bookinfo>
    <title>SuperDuper Product Test High-Level Requirements</title>
    <subtitle>Release &superduper_prod_dot_version;</subtitle>
    <pubdate>&superduper_prod_date;</pubdate>
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="../../../../doc_developer/copyright/copyright.xml" />
  </bookinfo>

  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="high_level_requirements_intro.xml" />
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="reqs_refs_docbook.xml" />
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="high_level_requirements_context.xml" />
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="reqs_content_docbook.xml" />
  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="high_level_requirements_guidelines.xml" />

</book>

Emacs (or nxml?) selects

<uri resource="high_level_requirements.xml" uri="../../../../../../../../../../Program Files/Emacs/emacs-24.3/etc/schema/docbook.rnc"/>

as the schema; attempts to use  "XML" -> "Set Schema" -> "File..." to the cited docbookx.dtd fail ("No schema loader available for file extenson 'dtd'") M-x rng-set-vacuous-schema finds the xi:include acceptable. The cited version.xml defines the superduper_prod_dot_version and superduper_prod_date (xlst generates an html file with no problems from this file; fop is unhappy.)


texts: Why do I have to choose evil-org-mode before evil-mode will appear?

texts:
I have been working with org mode for some time, and recently installed evil mode and evil org mode via the melpa package tool.

For some reason though I cannot run M-x evil-mode (nor does it come up as an autocomplete suggestion), until I have first run M-x org-evil-mode. This is even the case if I am in fundamental mode, which seems very strange.

I have the following lines in my ~/.emacs which may have something to do with it, though as I said I have the same problem even if I manually switch to fundamental mode.

;;;;org-mode as default
;; Enable org-mode
(require 'org)
;; Make org-mode work with file ending in .txt
(add-to-list 'auto-mode-alist '("\\.txt$" . org-mode))

I am using GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-15, modified by Debian.


texts: How to make helm-projectile-rg list files in relative to project?

texts:
Whenever I use helm-projectile-rg I see the list of files in relative to the current file:

../../../../../../project_dir/test/test1/filex.cpp   "match"

Is there a way to have it show files in relative to project like this:

test/test1/filex.cpp "match"


texts: wanderlust: getting application/octet-stream images to display?

texts:
In wanderlust, if an attachment has an image/* content type, the image will be properly displayed in the message buffer. For example ...

Content-Type: image/jpeg; name="foobar.jpg"

However, some emails arrive with their attachment's content type set to application/octet-stream, even though the attachment is an image, and wanderlust will not display these images in the message buffer. For example ...

Content-Type: application/octet-stream; name="foobar.jpg"

Is there any way to configure wanderlust so that it uses the name attribute to determine that an octet stream represents an image, so it can be displayed in the message buffer?


texts: Press F5 to save, compile, and run current rust file

texts:
Similar to Visual Studio, when working with Rust programs, I'd like to press F5 to save the current file, compile it, and run it.

What's a good way to do this?


texts: How to rsync/fetch/download the folder open with ssh/tramp

texts:
I work in a folder on the server, peyote2 in this case. I can edit files there etc, we all know that. However I have there a pdb file (RNA 3D structure) that to view I have to download it to my computer.

What would be the easiest way to do it?


texts:
Windows 10, Emacs 25.1

Is it possible to pretty format XML file?

E.g. here not formatted xml:

<?xml version="1.0" encoding="UTF-8"?><items xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><category><category_id>2</category_id><category_title>Music</category_title></category><category><category_id>1</category_id><category_title>Entertainment</category_title></category></items>

So after format I must get the next result:

<?xml version="1.0" encoding="UTF-8"?>
<items xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <category>
      <category_id>2</category_id>
      <category_title>Music</category_title>
   </category>
   <category>
      <category_id>1</category_id>
      <category_title>Entertainment</category_title>
   </category>
</items>

Is it possible?


texts:
I have a org-mode document, with some inline images:

[[path/to/image.png]]

These render properly on GitHub wikis, but fail when I use org-latex-export-to-pdf.  However, I can get the pdf export to work by changing the path slightly:

[[./path/to/image.png]]

Notice the ./ at the beginning.  But writing them in this way breaks the link for GitHub wikis.  As a workaround, I manually changed the image references, but I am hoping there's a better way.

Is there a way to include images which properly renders both in GitHub wikis and org-latex-export-to-pdf output?


texts: Enable Emacs column selection using mouse

texts:
How to use mouse to select column in Emacs? How to enable it?

The emacs wiki RectangleMark says,

  there is mouse support for rectangle highlighting by dragging the
  mouse while holding down the shift key. The idea is that this behaves
  exactly like normal mouse dragging except that the region is treated
  as a rectangle.

However, when I tried it, it doesn't work. No rectangle column is highlighted.

I don't know if I need to use the next Lisp:rect-mark.el file or not, because when I look at it, it says,

;; If you use both transient-mark-mode and picture-mode, you will
;; probably realize how convenient it would be to be able to highlight
;; the region between point and mark as a rectangle.  Have you ever
;; wished you could see where exactly those other two corners fell
;; before you operated on a rectangle?  If so, then this program is
;; for you.

To "see where exactly those other two corners fell"? Isn't that feature already provided out of box (ref http://www.gnu.org/software/emacs/manual/html_node/emacs/Rectangles.html)?
I'm confused. UTSL tells me that it is duplicating what is already provided out of box by Emacs. Do I need the whole rect-mark.el file, or merely the mouse key-binding part only?

UPDATE, for the record, for all my questions, I gather all the answers to here.


texts:
I often open temp files and I don't care about saving the contents when I modify the buffer.  How can I tell Emacs to ignore buffer changes when the filename matches a pattern, so that I don't get prompted to save the buffer when I kill it?

Edit: I am loading files from the command line, so I'd like to auto-detect this situation and configure the buffer accordingly.


texts: Is there any setting in Emacs to choose perlbrew over perl?

texts: I have a Perl project (developed in Ubuntu 14.04) which cannot be built on perl 5.18.2, but it works on Perlbrew 5.22.0. I have tried to use M-x perldb in Emacs but it looks like Emacs calls Perl 5.18.2 by default. Is there a way to choose Perlbrew in Emacs for debugging?


texts: Use standard keybindings for copy, paste, cut, etc. as in other software?

texts:
I want to use the same basic keybindings for copy (C-c), paste (C-v), cut (C-x), etc. that are supported in some other software.

How can I do that?


texts: The function will not pass anything to a SQL process, when called. There is no error

texts:
I liked the interactivity of Clojure/Lisp, where you can see the result in the REPL. I tried to implement the same behaviour for SQL-mode.
The idea is that when I do C-x C-e on the SQL-statemnt, I see the result in the *SQL*-mode, which will function as an alternative REPL.

To get this behaviour, I wrote two functions (I use Evil, so I have a normal, visual and insert state).

(defun sql-region-evaluate (start end)
"This will send the selected region to the SQL process"
(interactive "r")
(if (evil-visual-state-p)
    (sql-send-string (buffer-substring-no-properties start end))))

When I select a region, then I will use this function.

I do not want to use the sql-send-buffer command, because sometimes I type the next statement after the previous statement. When calling sql-send-buffer both SQL-statements will be queried, instead the last one.

So that's why I use the sql-send-region. The key command vap is an Evil keysequence in normal state which will visually selects the block.

(defun sql-evaluate (s)
"It will visually select the text block, and send it to the SQL process"
(interactive)
    ;; If I'm in the normal mode
    (if (evil-normal-state-p)
        (lambda ()
            (execute-kbd-macro (kbd "vap"))
            (sql-send-region start end)
            )))

When I call sql-region-evaluate, it works fine.
When I call sql-evaluate, nothing happens, I don't get any error message or something. So I cannot trace it back where it went wrong.

Any suggestions where it could get wrong?


texts: cider-jack-in: Symbol's function definition is void: clojure-project-dir

texts: When I run cider-jack-in the following error appears. Symbol's function definition is void: clojure-project-dir I am very new to Emacs and this is totally stumping me. Let me know if you need more information and I will provide.


texts:
I have managed to setup Tramp to connect to a remote Solaris machine from a Windows machine using plink, which is very nice.

 (setq tramp-default-user "Beginner"
       tramp-default-host "the_host"
       tramp-default-method "plink")

But now I have a host of new problems, which I would assume to be related to the file encoding from the tramp upload:

For example I have edited the .profile and now I get strange error messages like

$>. .profile
bash: $'\r': command not found

How can I configure tramp to format files in a Solaris-friendly way?

Edit: Having unix-encoding the default solves the issue for me

 (prefer-coding-system 'utf-8-unix)


texts:
Q: Why does elisp not have namespaces, and how could we get them?

Elisp does not have namespaces other than the global one, which has led to the coding convention of prefixing all global functions, variables, and constants with a unique prefix.

Aside from the annoyance factor, it also strikes me as a simmering issue given 1) the ever-expanding number of great libraries and packages, and 2) the continued existence of legacy functions and variables that either don't respect the prefix convention, or are sufficiently idiosyncratic that there isn't really a good prefix option they could use.   It also means that periodic attempts to rationalize older code (as with the transition from cl to cl-lib) is a non-trivial amount of work.  (Although I'm glad for the clean-up, I still shed a tear every time I type something like cl-find).

I went poking around to see if I could find out why elisp still doesn't have namespaces after a few decades of use, but was a little surprised at the modest harvest.  The wiki page on namespaces is quite short.  Nic Ferrier has a slightly longer treatment of the issue, and there's a fairly recent thread on emacs-devel on it as well.  There's an old Stack Overflow thread from 2010 that discusses the possibility of using macros to implement namespaces; another example of the macro approach can be found here. There are at least a couple of implementations (here and here, with a description of the latter here) out there, but they haven't seen much activity for a couple of years, and I've not run across any libraries that use them.

I presume that, if adding namespaces were easy, it would already be done.  So:

What are the technical barriers to adding namespaces to elisp?
Would adding namespaces break a lot of existing code?
Is this functionality something that needs to be organic to elisp (changes to the interpreter itself), or could it really be built on top via macros?


texts:
I am getting the following error while startup

Failed to verify signature dash-2.12.0.tar.sig:
No public key for 066DAFCB81E42C40 created at 2019-09-21T23:24:49+0530 using RSA
Command output:
gpg: WARNING: unsafe permissions on homedir `c:/Users/sreekumar.14CPU0014/AppData/Roaming/.emacs.d/elpa/gnupg'
gpg: Signature made Sat Sep 21 23:24:49 2019 IST using RSA key ID 81E42C40
gpg: Can't check signature: public key not found

I don't know what is the reason and how to correct it?

Updated part of init file

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


texts: There are plenty of ways to count lines, words, and characters in Emacs. For instance, invoking M-= (AKA count-words-region) does that very thing on a given region. However, I am having trouble finding a way to do this for paragraphs. By paragraph, I mean the same pattern that is used for forward-paragraph and backward-paragraph. I see no easy or straightforward way to count the number of paragraphs in a region or buffer without using regexps or similar. I'm sure that I'm not the first person to face this problem, so I must be missing something. If someone could provide an easy, straightforward way to count the paragraphs in a region or buffer, I would be glad.


texts:
I would like to list the available tags in Magit in order to diff a specific revision, is this possible?

Specifically what I am after is to list the revision history at a certain tag and then view the diff for one of the patches in its history.  I have just completed a rebase and noticed some inconsistencies, I know which patch introduced the change and I would like to see its diff from the version prior to the rebase.


texts: How can I find the buffer position of an org-mode cell?

texts:
I'm trying to create a formula that modifies overlays on an org-table. I need to figure out the position in the buffer of the cell so I can create an overlay that spans the length of the cell.

How can I figure out the start-pos and end-pos of the cell?


texts: How to use Emacs Application Framework as Default PDF viewer?

texts:
I recently discovered the Emacs Application Framework, which works quite nice for me. The only thing that's bothering me is, that I need to explicitly call eaf-open on a file, to open it with the framework.
I tried to associate eaf with the file extension via (add-to-list 'auto-mode-alist '("\\.[pP][dD][fF]\\'" . eaf-mode)) but to no avail.
How can I tell Emacs that it should open PDF files with eaf?


texts:
I sync my config between several different machines using git. Setting options via the customize-variable interface, some of my computers use quote, while others use '. As a consequence, my git commits include lots of bouncing back and forth like this:

  '(ess-r-prettify-symbols
-   (quote
-    (("<-" 129032)
+   '(("<-" 129032)
      ("->" 32

I'm not editing these values by hand, so something in Emacs is deciding whether or not to use the word or symbol for quote. It's driving me batty - how do I tell Emacs to always use one or the other?


texts:
I cannot understand the behavior of this simple code:

(defun foo (str bool)
  (interactive
    (list (read-string "Some text: ")
          (y-or-n-p "Yes or no? ")))
  (message "%s is first" str)
  (if bool (message "%s is in if" str)))

When I call it with M-x foo, it prompts for a string input -- which I give as this -- then Yes or no? Good so far. But if I type in n, it prints out this is first. But if I choose y, it seems to jump past the (message "%s is first" str) line and enter the if, which is true (not nil), printing this is in f. Why is the line before if... being skipped if I choose y?


texts: How to use Emacs to open an eshell from Terminal at a specific path

texts:
By default, if I invoke emacs from terminal by typing $ emacs C:\users a directory-like environment opens. Then if I do M-x eshell, an eshell environment opens at this path.

My question is how to directly go to this eshell from the initial terminal. I tried $ emacs C:\users eshell and $ emacs C:\users M-x eshell but they don't work.

Added: As an application of the below solution of abo-abo, on Microsoft OS, if at the path bar of your window directory, you type emacs -f eshell, an eshell will be opened at that directory:


texts: Tasks with indefinite intervals in org-habit

texts:
I'm trying to figure out a way to keep track of habits that do not have a definite interval for repetitions.  I created the following habit without a deadline and time interval because I don't know how often I'd like to repeat it, but I do want to keep track of how often I repeat it.
** DONE do something
   CLOSED: [2021-05-11 Tue 16:01]
   :PROPERTIES:
   :STYLE:    habit
   :LAST_REPEAT: [2021-05-11 Tue]
   :END:

The problem is that, as you can see, it's in the done state, and repetitions aren't logged.  If there is a deadline, each repeat will be logged:
** TODO do something
   DEADLINE: <2021-05-12 Wed .+1d>
   :PROPERTIES:
   :STYLE:    habit
   :LAST_REPEAT: [2021-05-11 Tue 16:07]
   :END:
   - State "DONE"       from "FEEDBACK"   [2021-05-11 Tue 16:07]

Is there a way to log each time it enters into "DONE" without setting an interval?


texts:
I use evil and evil-tabs with Emacs and am quite comfortable with my setup except a few times when I have multiple splits open in a tab, using :q ends up closing all the splits in the window. In Vim it will close only the split I am currently in.

I think this part of evil-tabs.el is responsible:

(evil-define-command evil-tab-sensitive-quit (&optional bang)
  :repeat nil
  (interactive "<!>")
  (if (> (length (elscreen-get-screen-list)) 1)
    (elscreen-kill)
    (evil-quit bang)))
(evil-ex-define-cmd "q[uit]" 'evil-tab-sensitive-quit)

I tried doing the following in my .emacs:

;;; `:quit` ends up quitting more than I intended. So rebind that.
(evil-ex-define-cmd "q[uit]" 'kill-buffer-and-window)

Also:

(eval-after-load 'evil-tabs
  ;; `:quit` ends up quitting more than I intended. So rebind that.
  '(evil-ex-define-cmd "q[uit]" 'kill-buffer-and-window))

But :q again closes the whole tab. Any clues on how to change or debug this?


texts:
How do you abort an emacs M-x compile compilation?
I'm editing a bash file, and I "test execute it" by doing
M-x compile.

What I tried - googled:emacs abort compilation

The file I'm working on is like this

#!/bin/bash
# -*- compile-command: "./spawn.sh" -*-
set -e
# Function definitions
# more ....


texts: Emacs 26.1 RC1 display issues over SSH/X11 with xming/vcxsrv

texts:
I can compile Emacs 26.1 RC1 ok, and use it locally on the host fine.

However, when attempting to ssh -X to host via PuTTY 0.70 and launch the Emacs gui, emacs is not displaying correctly. See screenshot below - no default welcome screen, and missing minibuffer too.   Using Windows xserver program VcXsrv (1.19.6.3).

I suspect this issue is related to some combination of GTK and Xming/VcXsrv, however the behavior does change between Emacs 25.3 and 26.1 RC1, see table below:

| emacs    | x-toolkit | result
+----------+-----------+-------
| 26.1 RC1 | gtk3      | bad
| 26.1 RC1 | gtk2      | bad
| 26.1 RC1 | motif     | ok
| 25.3     | gtk3      | ok
| 25.3     | gtk2      | ok

emacs -Q produces the same result.
freshly compiled on Opensuse Leap 43.2 and CentOS 7 produces same result
XLIB_SKIP_ARGB_VISUALS=1 emacs same result

References: Link1, Link2

./configure options I ultimately desire:

--with-x-toolkit=gtk3 --with-xwidgets  --with-modules --with-mailutils

Where gtk3 is required for xwidgets, so motif or other x-toolkits are not the best solution.

Note: with Xming 6.9.0.31  (not vcxsrv)
I get core dumps with error messages referencing this GTK bug:
https://bugzilla.gnome.org/show_bug.cgi?id=85715

Can anyone else replicate this problem or have any ideas how to resolve?

wget ftp://alpha.gnu.org/gnu/emacs/pretest/emacs-26.1-rc1.tar.xz
tar -xvf emacs-26.1-rc1.tar.xz
cd emacs-26.1
./configure --with-x-toolkit=gtk3 --with-xwidgets --with-modules --with-mailutils --prefix=/home/test/emacs_26.1_gtk3
make && make install
# launch emacs, confirm ok
# login to windows, launch ssh -X putty session to linux host, + vcxsrv/xming
# launch emacs - compare to screenshot

Thanks!


texts: how to create CLOCKSUM column for the week?

texts: In column view i can use some special columns like CLOCKSUM (total time) and CLOCKSUM_T (time for today). How can i create column CLOCKSUM_W which would sum all the time for current week?


texts: Can't find the name of a face in the *Buffer List* menu

texts:
The green arrow points to the face header-line; so I'm good there.

But I have no idea what specific face the red arrow is pointing to.

Does anybody know?


texts: Systematic Spacing between Org Mode Objects

texts:
When I write org mode files it's difficult to keep the right number of blank lines between different org mode objects like source blocks, text blocks, headings, and tables. There exists org-blank-before-new-entry which helps with this a little bit, but it only accepts two kinds of objects a heading or a plain list item.

Too often I see this line highlighting at the end oforg mode headings that have one space or less:

I also see unusual folding images sometimes. Below under #+end-src there is an unusual fold.

When I expand it there's nothing there except for whitespace.

It is cumbersome to be fixing these myself whenever I add forget to add blank lines or add to many.

Is something that exists to format an org file to have the proper spacing between org objects?


texts:
how does one do a query-replace-regexp to add a prefix string but not on EVERY line but rather just lines with text (or start with specific text?)

i know how to add a prefix with query-replace-regexp but that adds the prefix to every line (even empty ones).


texts: Getting consistent colors for terminal and GUI emacs

texts:
I've noticed that color definitions on the terminal and the GUI are not consistent.
For example on the GUI, there is a color DarkOrchid2 defined, however this is not there for the terminal. Instead, the similar color is defined as color-99 and the named colors are not supported.
Is there a way to get the colors consistent?


texts: magit: display the commit log around the commit I'm interested in

texts:
How can I jump to the commit log around the commit I'm interested in?

I use magit-blame a lot while reading the history of a project.  While doing that, I RET to see the commit that changed the line I'm interested in.  Now, from that *magit-revision buffer, I can open a history buffer  using magit-log with the specified revision on top, but how can I see the log around the commit?

Yes I can use magit-log with $rev^10...master to see the history from $rev to master but a) this will take long time if the $rev is old, b) not clean ;p.

Is there better way to list commit log with 10 parents and 10 children?

I assume what I want to do is to get commits like this:

git rev-list 71058854a42cd1~10.. | tail -n 20

and plot them in the buffer?


texts: Spacemacs layers for working with Zotero in org-mode

texts:
Does anyone know if there are any Spacemacs layers written for working with Zotero in org-mode?
I am thinking particularly of layers incorporating the gists: org-pdcite and aj-org-zotxt-configuration.


texts: How to add bufler's projectiles groups to helm-mini-default-sources

texts:
I have this config for bufler.
(use-package bufler
  :straight t
  :bind ("C-x C-b" . bufler)
  :config
  (setq bufler-groups
        (bufler-defgroups
          (group
           ;; Subgroup collecting these "special special" buffers
           ;; separately for convenience.
           (name-match "**Special**"
                       (rx bos "*" (or "Messages" "Warnings" "scratch" "Backtrace") "*")))
          ;; All buffers under "~/.emacs.d" (or wherever it is).
        (group
         ;; Subgroup collecting buffers in a projectile project.
         (auto-projectile))))

With M-x bufler a few groups named Projectile: *project-name1* Projectile: *project-name2* and etc. in my case.
I would like to add all this groups to helm-mini-default-sources, so that it looks like in helm-mini:
`Projectile: *project-name1*`
some candidates
`Projectile: *project-name2*`
some candidates

I suppose helm-bufler-source includes all the necessary Projectiles's groups and candidates. So how can I do it?


texts: Is there a way to display png or tiff, instead of xpm, images on the Emacs toolbar for Microsoft Windows?

texts:
Is there an emacs version that supports displaying png / tiff images on the toolbar instead of only xpm?

On Mac the  Mitsuharu Yamamoto version display TIFF images without any issue. I tried modifying tool-bar.el to add the tiff and png support but did not work. The emacs version on windows is the GNU one with dependencies installed and  I can display PNG images in the buffer, the issue is only in the toolbar.

I was wondering if the image support for the toolbar is coded directly into the emacs code and that is why the GNU version does not recognize the modified tool-bar.el


texts: How can I bookmark Info page to continue reading later?

texts: How can I bookmark Info page to continue reading later ?


texts: cocoAspell + Emacs 24 + Mac OS X Yosemite

texts:
Having trouble configuring emacs 24 on Mac OS X to work with cocosAspell.

Installed MacTex dist. with success;
Installed AUCTex through emacs package manager;
Downloaded and installed the brazilian portuguese dic. for Aspell: aspell6-pt_BR-20090702-0;
tried to config my .emacs files reading a lot of sources but none worked.
Does anyone uses multi languages configurations like this? How do you set up your .emacs file?

My objective is to use both english and brazilian portuguese dicts.

Please! need help with this.


texts:
How can I see a list of internal links in an org-mode document?  I would like a quick way to link within my document without needing to retype/remember all my internal links.

The documentation states,

  To insert a link targeting a headline, in-buffer completion can be used. Just type a star followed by a few optional letters into the buffer and press M-TAB. All headlines in the current buffer will be offered as completions.

The key binding M-TAB, however, toggles the desktop environment's "switch to open application" functionality:

* Header1 <<h1>>
** Subheader1
   This is where I would like to reference *

Reading the documentation for handling links, I have tried placing my cursor on the <<h>> target and manually calling org-store-link.  Emacs processes for a moment.  However, I am unable to use TAB for completion, in the buffer or minibuffer, and the stored target is not in the history accessed by M-p/M-n:

  C-c C-l     (org-insert-link)

  ...

  Inserting stored links

  All links stored during the current session are part of the history for this prompt, so you can access them with UP and DOWN (or
  M-p/n).


texts: a function to clear out particular words/characters via regex

texts:
I have a specific request to all you regex wizards :)
I want to create a simple function that deletes or cleans out several parts of a text file based on predefined keywords (such as single capital letter, some changing phrases that start end with same words etc).

I want to use the function to clean out references based on pre defined words/sentences. for example this is how the original (initial) reference will look:

6.  F. NordioPD, A. ZanobbeiC, I. & J. D. SchwratzPI. 2015. Changing patterns of the temperature-mortality association by time and location in the US, and implications for climate change 81, 80-86. Environment International (3 Citations, IF= 5.559 ; Q1 Environmental Sciences , 8 of 221)

what i want is to clear out:

1) all the added words to a name such as NordioPD note the PD part. the words that we use are 'PD' ,'C' or 'PI' based on the type of contributor and are attached in uppercase to the author last name.

2) in addition there is always a line at the end of the reference that looks like this
(3 Citations, IF= 5.559 ; Q1 Environmental Sciences , 8 of 221)

the line always starts with (X citations) where X can be any number and ends with the ) .

using the above example the reference i want to end up with will look something like this:

6.  F. Nordio, A. Zanobbei, I. & J. D. Schwratz. 2015. Changing patterns of the temperature-mortality association by time and location in the US, and implications for climate change 81, 80-86. Environment International.

Any regex wizard out there know how to deal with this?


texts: Can' t set directory for org-mode capture

texts:
I was trying to use the capture as is explained in org-manual p. 85. This is the relevant part of my .emacs file.

  (setq org-default-notes-file (concat org-directory "~/Notities/org-mode/Capture.org"))
    (define-key global-map "\C-cc" 'org-capture)

But I get this error.

  Symbol's value as variable is void: org-directory

I tried the following solution, but it didn't work. The filepath is directed to an existing file. Why do I still get this error?


texts: How to save a org buffer everytime the todo state changes?

texts: In both agenda mode or a regular org mode buffer, whenever I change the todo state, I want the buffer to be saved automatically.


texts: Modify mode's font-locking without changing source code

texts:
Suppose I want to make additions to a major mode's syntax highlighting, how would I do this without modifying the major mode's source code?

Some ideas:

Redefine variable in .emacs
Define a minor mode with the changes


texts:
helm-swoop no longer works for me. Whenever I try to use it, i get the message

  Symbol's value as variable is void: helm-swoop-pattern

I am using the latest package from MELPA (20170923.2127) which has not been updated since September. So I have no idea what has caused this issue to suddenly crop up.

I am using Emacs 25.3 on macOS. I do not have any helm-swoop specific config in my init.el and am using it "plain-vanilla".


texts: What's the difference of (require 'init-local nil t) and (require 'init-local)?

texts:
I'm not familiar with elisp at present.

I put my local configuration into init-local.el and exclude it in .gitignore.

I use (require 'init-local nil t) in init.el file before, however I think (require 'init-local) could have the same effect when I review my init.el today.

So I have the question : What's the difference of (require 'init-local nil t) and (require 'init-local) ?

;;; update

Thanks @phils and @DoMiNeLa10, after your comment and answer, I understand that it must be (require 'init-local nil t) because the file init-local.el is optional, if I use (require 'init-local) and the file init-local.el is missing I will get the error:

  File is missing: Cannot open load file, No such file or directory, init-local


texts: Does git-messenger support showing a commit using Magit?

texts:
In this issue in git-messenger's issue tracker it was suggested that it should optionally use magit-commit-mode to show commits in a separate buffer. And that issue was closed as resolved.

But it appears that magit-commit-mode does not exists now. Is there a way to use Magit here anyway?


texts:
I \input{b.tex} in a.tex.

I made changes to b.tex, and tried to recompile a.tex by C-c C-c in AUCTeX, but it didn't work since a.tex hadn't been changed.

How can I recompile then?


texts: How can I get Emacs to release a locking folder handle?

texts:
After using Emacs to open a file in a folder on MS Windows using emacsclientw -n, killing the buffer does not release a handle Emacs has to the folder, so the folder can't be deleted.
GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
Windows 10 v1909
Explorer context menu entry: C:\Program Files\Emacs\bin\emacsclientw -a "C:\Progra~1\emacs\bin\runemacs.exe" -n "%1"

How can I get Emacs to release the containing folder handle?


texts: How to inject a PNG into a buffer in image-mode from a process output

texts:
I'm the maintainer of puml-mode, a major mode for editing PlantUML files. It works by submitting the content of the current buffer to an external Java process, PlantUML, which then outputs an image to stdout. This image is then put in a newly created buffer to display.

While it correctly works for both SVG and ASCII art outputs, when I try to produce a PNG something goes wrong and the new buffer shows empty, with no error messages whatsoever. The weird thing is that when I C-c C-c in the image buffer, I actually see the PNG as text, so the image is supposedly properly loaded.

When I manually open PNG files they correctly display as images.

Here's the relevant part of the code:

(defun puml-is-image-output-p ()
  "Return true if the diagram output format is an image, false if it's text based."
  (not (equalp 'utxt
               (puml-output-type)))) ;; << feature detection, either 'png 'svg or 'utxt

(defun puml-preview-sentinel (ps event)
  "For the PlantUML process (as PS) reacts on the termination event (as EVENT)."
  (if (equal event "finished\n")
      (progn
        (switch-to-buffer puml-preview-buffer)
        (when (and (display-images-p)
                   (puml-is-image-output-p))
          (image-mode)))
    (warn "PUML Preview failed: %s" event)))


texts: Can org tables cooperate with my customized dates?

texts:
I have my time stamps customized as follows

(setq-default org-display-custom-times t)
(setq org-time-stamp-custom-formats '("<%a %d-%b %Y>" . "<%a %d-%b %Y %H:%M>"))

My issue is that my org-tables do not align correctly when dates are inserted in them

| <2016-01-12 Tue>   | <2016-01-13 Wed>  |
|-------------------+-------------------|
| aligned           | improperly        |

Is there a way to change this?