texts: calculate the sum of the muplication of 2 columns in org table

texts:
I have a org table:

| a | b | c |
|---+---+---|
| 1 | 2 | i |
| 3 | 4 | j |
|---+---+---|
| 4 | 6 |   |

I want to multiply columns a and b and sum them up (except last row: 1*2+3*4) and put into the last cell:

| a | b | c |
|---+---+---|
| 1 | 2 | i |
| 3 | 4 | j |
|---+---+---|
| 4 | 6 | 14|

What is the formula to achieve this? I tried #+TBLFM: @>$>=sum($1 * $2) without luck.

My org version: Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /Applications/Emacs.app/Contents/Resources/lisp/org/)


texts: If I have a list of books' call numbers in Dewey Decimal in a buffer, is this something I could sort with Emacs regex -- or is this an elisp task? For example, 261.1 C87 comes before 261.104 Z99 because the first one can be understood as 261.100 C87. So each column/place must be compared. And then of course the alphabet parts, which means 261.1 C87 comes before 261.1 Ch2. I'm just wondering if there are any Emacs regex experts who would see a good way. Otherwise, I'll just do elisp on it.


texts: Multiple source code blocks with the same name

texts:
The context
Lately, I've been using the =:noweb= feature which has been of great help. Consider this minimal working example
* Using =std::cout=

#+NAME: a
#+begin_src cpp
std::cout << "a";
#+end_src

#+NAME: b
#+begin_src cpp
std::cout << "b";
#+end_src

#+begin_src cpp :noweb yes
#include <iostream>

int main() {
  <<a>>
  return 0;
}
#+end_src

#+RESULTS:
: a

The problem
Now, let's suppose I create a new section within the same file with the following content.
* The =string= data type

#+NAME: a
#+begin_src cpp
std::string c = "AAA"
#+end_src

#+NAME: b
#+begin_src cpp
std::string c = "BBB"
#+end_src

#+begin_src cpp :noweb yes
#include <iostream>

int main() {
  <<b>>
  std::cout << c;
  return 0;
}
#+end_src

As you can see above, I've used the a and b names again as arguments to the #+NAME tag for the source code blocks present in this heading.
When evaluating the last source code block (the one from the The =string= data type section that contains <<b>>), it seems that org searches the source code block with name b and stop when one has been found. This causes a compilation error 'c' was not declared in this scope because it is selecting the one from the Using =std::cout section. However, I would like org to select the one from the same heading.
Of course, I can create different names, but the problem is that the more source code blocks my file has, the harder it will be to select a name. I could use cout-a and string-a but then I won't be able to use those names again, so whenever I want to name a code block, I would need to look at all the names and think in a new one.
The question
So, my question is: When having source code blocks with the same +#NAME tag, is it possible to make org-mode give higher priority to the ones from the same heading?


texts: evil mode j and k moves between paragraphs instead of lines on markdown and text modes

texts: evil mode j and k in markdown and text modes moves down paragraphs (and sometimes to other arbitrary points down/up the paragraph) instead of up and down a single line. How can I change this behaviour?


texts: how often is the official Emacs manual updated?

texts:
Q: How often/quickly is the official Emacs manual updated?

The release announcement of Emacs 24.4 has a blurb at the bottom stating that the FSF's official Emacs manual has been updated to correspond to version 24.2.  It also notes that buying the manual is a good way to support the FSF's work.

Now, aside from donating, buying the paper copy of the manual seems like a decent way to support the FSF, even though it's possible to download a PDF copy for free.

Roughly speaking, how frequently is the manual updated (in terms of dates and/or Emacs versions)?  I'd be happy to throw some money the FSF's way on this, but I'd be less happy if the manual were updated to, say, version 24.4 a month after I bought a copy of this version.

UPDATE: The plot thickens.  The paper copy available from the FSF store corresponds to Emacs version 24.2.  Yet there is also an updated PDF version of the manual that corresponds to Emacs version 24.4.  (Oddly enough, it's about 40 pages shorter than the 24.2 version.)


texts:
Within multiple-cursors-core.el <return> key is bound to multiple-cursors-mode which always ends multiple-cursors-mode, when I'd like to insert a new line.
I can unbind the key with

(define-key mc/keymap (kbd "<return>") nil)

But I wonder: is there more intended by binding <return> to multiple-cursors-mode, then just quiting multiple cursors mode?


texts: Help with function advice: Unknown add-function location ‘asm-calculate-indentation’

texts:
I'm trying to modify how asm-mode does its automatic indentation.
I thought I would use the following:

(defun yasm-calculate-indentation (oldfun)
  "Add the formatting for a few other keywords I like."
  (cond
   ((looking-at-p "section") 0)         ; section
   ((looking-at-p "global") 0)          ; global
   ((looking-at-p "extern") 0)          ; extern
   (:default (oldfun))))

(add-hook 'asm-mode-hook
          (lambda ()
            (advice-add :around #'asm-calculate-indentation
                        #'yasm-calculate-indentation)))

However I'm getting the error: Unknown add-function location ‘asm-calculate-indentation’

Leaving me rather confused.

Am I adding the hook in the wrong location to be able to access that name?

I tried adding the advice from the minibuffer when editing an assembly file but it gave me the same error.

This is my first time trying to use advice so maybe that's where I'm going wrong...
How can I get this to work?


texts: I was searching whether is is possible to edit a document from ShareLaTeX using Emacs in real time. Up to now I haven't find anything to do the job. So my question is if there is a good and reliable way to do that.


texts:
When I close a frame, I'd like for its buffer to be killed.

If the buffer is displayed in other frames, the buffer should not be killed.

Do nothing if more than one buffer is displayed in a frame.

What's a good way to set this up?


texts: How to modify `org-structure-template-alist` after org-mode 9.2?

texts:
I want to append \n to specific easy-template

before 9.2 I could:

(setq org-structure-template-alist
      '(("s" "#+BEGIN_SRC ?\n\n#+END_SRC\n")
       ("e" "#+BEGIN_EXAMPLE\n?\n#+END_EXAMPLE\n")
       ("q" "#+BEGIN_QUOTE\n?\n#+END_QUOTE\n")
       ("v" "#+BEGIN_VERSE\n?\n#+END_VERSE\n")
       ("V" "#+BEGIN_VERBATIM\n?\n#+END_VERBATIM\n")))

the new value looks like this

Value: (("a" . "export ascii")
 ("c" . "center")
 ("C" . "comment")
 ("e" . "example")
 ("E" . "export")
 ("h" . "export html")
 ("l" . "export latex")
 ("q" . "quote")
 ("s" . "src")
 ("v" . "verse"))

more abstract but I can no longer do what I used to do.

any solution?


texts:
Here an org-mode tree

* TEST
 * SUB1
  * SUB11
   * SUB111
   * SUB112
  * SUB12
 * SUB2

If the tree is partially fold you can have:

* TEST
 * SUB1
  * SUB11
  * SUB12
 * SUB2

Is there a command for (un)folding SUB1 without unfolding SUB11 (like org-cycle) with tab on SUB1 ?
an org-fold-unfold-this-subtree function ?

Thanks


texts: How to delete a link in org mode in spacemacs

texts:
I was trying to delete a link and replace it with the description in org mode. And I thought there would be a command to do it. But I could not find one.
There is a solution here. But the question is dated. So, I thought I would ask again.
Is not there a built-in solution to remove the link but retain the description?


texts: Different colors for different characters in tty-menu-bar

texts: All I want to do is have a different color for different characters for the tty-menu-bar when in a terminal mode. Lets say I have for the menu bar "File", I want the character "F" to be a different color from "ile". How can I do that?


texts: Org latex exports $ ... $ math as \( ... \) : can this be avoided?

texts:
As the title says, inline math snippets such as $x+1$ are replaced during org latex export by \(x+1\). But, no one is writing inline math in LaTex files like this. Is there a way to tell Org to leave my dollars alone?

Context: the LaTeX file is collaborative and people are simply not used to \(...\) syntax.


texts: How to make org file type link search work with numbers?

texts:
I am trying to using a link to jump to a number in another org file. Searching for keyword numbers works for internal links but does not when searching in a different file. It works with words but not numbers? Why is this and can it be fixed?

a.org:

abcd or << abcd>>

1234 or even <<1234>>

[[1234]] (works)

b.org:

[[file:./a.org::1234]] (does not work)

[[file:./a.org::abcd]] (works)


texts: Implmentation of org-id-goto but for arbitrary properties?

texts: Does there exist a function similar to org-id-goto, but instead one that can allow you to jump to tasks that have arbitrary property names (other than just "ID")? So for example (org-goto "ID1" "VALUE") would jump to the (perhaps first found) task with property ID1 and value VALUE.


texts: orgmode - html export image and code top alignment

texts:
This pgfplot gallery is excellent. I try to use org mode to generate similar html but the image and code block not align.

#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD: .example {background-color:#eff0f1;}
#+HTML_HEAD: .org-src-container {width:65%; float:right; vertical-align:top; background-color:#ccccff;}
#+HTML_HEAD: img {width:33%; background-color:#f5f5cc;}
#+HTML_HEAD: </style>
#+OPTIONS: html-postamble:nil

#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300
#+HEADER: :packages '("\\usepackage{tikz} \\usepackage{pgfplots} \\pgfplotsset{compat=newest}")
#+BEGIN_SRC latex :file example_0.png :results raw file :exports both
\begin{tikzpicture}
\begin{axis}[
    xmin=-3,   xmax=3,
    ymin=-3,   ymax=3,
    extra x ticks={-1,1},
    extra y ticks={-2,2},
    extra tick style={grid=major},
]
    \draw[red] \pgfextra{
      \pgfpathellipse{\pgfplotspointaxisxy{0}{0}}
        {\pgfplotspointaxisdirectionxy{1}{0}}
        {\pgfplotspointaxisdirectionxy{0}{2}}
      % see also the documentation of
      % 'axis direction cs' which
      % allows a simpler way to draw this ellipse
    };
    \draw[blue] \pgfextra{
      \pgfpathellipse{\pgfplotspointaxisxy{0}{0}}
        {\pgfplotspointaxisdirectionxy{1}{1}}
        {\pgfplotspointaxisdirectionxy{0}{2}}
    };
    \addplot [only marks,mark=*] coordinates { (0,0) };
\end{axis}
\end{tikzpicture}
#+END_SRC

#+RESULTS:
[[file:example.png]]

#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300
#+HEADER: :packages '("\\usepackage{tikz} \\usepackage{pgfplots} \\pgfplotsset{compat=newest}")
#+BEGIN_SRC latex :file example_1.png :results raw file :exports both
\begin{tikzpicture}
    \begin{axis}[
        xlabel=Cost,
        ylabel=Error]
    \addplot[color=red,mark=x] coordinates {
        (2,-2.8559703)
        (3,-3.5301677)
        (4,-4.3050655)
        (5,-5.1413136)
        (6,-6.0322865)
        (7,-6.9675052)
        (8,-7.9377747)
    };
    \end{axis}
\end{tikzpicture}
#+END_SRC

#+RESULTS:
[[file:example_1.png]]

Current output:

The left image should top align the right code block!


texts:
I have such a diary structure

*** 2019-07-28 Monday
**** Tasks
*** 2019-07-29 Tuesday
**** Tasks

Desire to capture todos under the Tasks of latest day

(setq org-capture-templates '(("t" "Todo [inbox]" entry (file+headline "~/ORG/src/sdiary.org"
                                                                       "Tasks") "* TODO %i%?")
                              ("T" "Tickler" entry (file+headline "~/ORG/src/tickler.org" "Tickler")
                               "* %i%? \n %U")))

conversely, it collect todos to the first Tasks not the tasks at the bottom of the file.

How could capture todos to the last tasks rather than the first tasks.


texts: How to prevent emacsclient starting a new frame every time?

texts:
I have Ubuntu 12.04 running with Emacs 24.3.
On computer startup, emacs --daemon is executed, and I have modified the emacs24.desktop to take emacsclient -c -a "" as exec parameter. However, whenever I try to open a file a new frame opens every time.
Is there a way to make the file appear in a preexisting frame as a new buffer?

By “open a file” I mean using either GUI file manager or using terminal by emacsclient -nc [filename] or emacsclient -nc -a "" [file].

EDIT: What seems to be happening is that emacs is opening a new "OS window" (as in Emacs frame) with every file; however, I am able to access all the buffers in the same emacs frame. Still, having multiple emacs frames in irritating even though I don't have to switch through them. Closing the frame manually removes the buffer too.

Is there a way to suppress the behavior of opening the new frame every time?


texts:
So, in Mac OSX,  I'm trying to switch to using Emacs in Terminal.app, but things like C-M-SPC and C-M-% don't work. After a bit of googling I came across this (mostly) unanswered question

https://superuser.com/questions/83166/using-c-m-to-do-a-query-replace-regexp-in-emacs-running-in-mac-terminal

Other discussions such as this one and this one point out that this is basically the terminal emulator's fault, which I can understand.

But is there really no workaround? The last answer in the superuser question https://superuser.com/a/84008/218146, seems promising, but I don't understand it fully. Can you really make Emacs read those events? Perhaps a working (if probably elaborate) hack could be developed on top of it.

Finally, I could use another terminal emulator. The only requirement is that I can keep using the "Option/Alt" key as the Meta key. Any suggestions?

EDIT: I just found out that the "esc" key works, i.e., I can input C-M-SPC perfectly with it. So a more than reasonable hack for me would be to remap Left Option to ESC in Terminal.app. Anyone know how to do that?
EDIT2: I spoke too soon: I tried out Karabiner (https://pqrs.org/osx/karabiner/) and remapped LeftOption to ESC. A single C-M-SPC works alright, but multiple SPC's after that don't. So it's mostly useless... :-(


texts: Unable to set relative line number as a default

texts:
I am trying to setup Emacs to have relative line numbering enabled by default via this plugin.

According to the readme file

  Relative line numbering should already be enabled by default (by installing this package), following linum-on

I have included (linum-on) in my .emacs file but it doesn't work.  M-x linum-relative-mode works, but I have to do it every time.

My full .emacs file at present is below:

(if (display-graphic-p)
    (progn
      (setq initial-frame-alist
            '((tool-bar-lines . 0)
              (width . 106)
              (height . 60)))
      (setq default-frame-alist
            '((tool-bar-lines . 0)
              (width . 106)
              (height . 60))))
  (progn
    (setq initial-frame-alist '((tool-bar-lines . 0)))
    (setq default-frame-alist '((tool-bar-lines . 0)))))
(setq package-list
      '(use-package evil helm js2-mode monokai-theme linum-relative org
        powerline rainbow-delimiters projectile helm-projectile flycheck))
(require 'package)
(setq package-archives '(("melpa"        . "http://melpa.org/packages/")
                         ("MELPA stable" . "https://stable.melpa.org/packages/")
                         ("gnu"          . "http://elpa.gnu.org/packages/")
                         ("marmalade"    . "http://marmalade-repo.org/packages/")))
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(dolist (package package-list)
  (unless (package-installed-p package) (package-install package)))
(setq evil-want-C-u-scroll t)
(require 'evil)
(evil-mode 1)

;; Use `display-line-number-mode` as linum-mode's backend for smooth performance
(setq linum-relative-backend 'display-line-numbers-mode)
(require 'linum-relative)
(linum-on)
(require 'helm-config)
(set-face-attribute 'default nil :height 140)
(load-theme 'monokai t)
(global-set-key (kbd "M-x") 'helm-M-x)
(global-set-key (kbd "C-x C-f") 'helm-find-files)
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(require 'powerline)
(powerline-default-theme)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
(linum-relative-mode)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages
   (quote
    (flycheck rainbow-delimiters powerline linum-relative doom-themes moe-theme cyberpunk-theme monokai-theme helm evil))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )


texts: How to return an org mode table with headings and hline from Ruby

texts:
I have the same question as this question except that I don't see how to do so other than in elisp.  I am using Ruby, but I suppose the question applies to other languages as well.  If I return an array of arrays as the value result of some code, I want to have it formatted as a table headed with the column names.

Here is the solution to what I want in elisp:

#+BEGIN_SRC emacs-lisp :results value table
  '(("First" "Second")
    hline
    (a b) (c d))
#+END_SRC

#+RESULTS:
| First | Second |
|-------+--------|
| a     | b      |
| c     | d      |

But I've tried variants of this in Ruby with no luck.  For example:

#+BEGIN_SRC ruby :results value table
    [ [ 'First', 'Second'],
      :hline,
      [ :a, :b ],
      [ :c, :d ]
    ]
#+END_SRC

#+RESULTS:
| (First Second) | :hline | (:a :b) | (:c :d) |

Which is not what I want.  So, what is the incantation to use here?


texts: Show one todo tree with two different states

texts:
Hi I would like to make this function show a tree with headings in NEXT and WAITING status.
    (defun show-NEXT-in-subtree ()
       "Narrow to a subtree and show only headings with NEXT and WAITING keywords"
       (interactive)
       (org-narrow-to-subtree)
       (org-show-todo-tree '(3 4)) ;; NEXT|WAITING
       (org-ctrl-c-ctrl-c))

I don't understand how to do it in the correct way according to help.

With a prefix argument (or by using C-c / T), search for a specific TODO. You will be prompted for the keyword, and you can also give a list of keywords like KWD1|KWD2|... to list entries that match any one of these keywords. With a numeric prefix argument N, show the tree for the Nth keyword in the option org-todo-keywords.


texts: Reducing LATEX_HEADER clutter at the top of my org files

texts:
I often write notes in org mode and export them to latex. However, because some documents are complex I need to include many latex packages at the top like so:

#+LATEX_HEADER: \usepackage[margin=1.15in]{geometry}
#+LATEX_HEADER: \usepackage{parskip}
#+LATEX_HEADER_EXTRA: \usepackage{graphicx}
#+LATEX_HEADER_EXTRA: \usepackage{mdframed}
#+LATEX_HEADER_EXTRA: \usepackage{needspace}
#+LATEX_HEADER_EXTRA: \usepackage{hyperref}
#+LATEX_HEADER_EXTRA: \usepackage{titling}
#+LATEX_HEADER_EXTRA: \usepackage{enumitem}
#+LATEX_HEADER_EXTRA: \usepackage{etoolbox}
#+LATEX_HEADER_EXTRA: \usepackage{color}
#+LATEX_HEADER_EXTRA: \usepackage{underscore}...

Is it possible to store all the latex header commands (\usepackage, macros definitions etc.) in a separate tex file so that I can just have a single line include at the top of the org file? This will reduce a lot of the clutter and make it easier for me to add packages.


texts: which-function-mode and modified mode line

texts:
I modified my mode-line, but now which-function-mode stopped working: nothing is displayed.  Code:

(setq mode-line-position
      (list '(:eval (propertize "L%l " 'face nil 'help-echo "Line number"))
            '(:eval (propertize "C%C " 'face nil 'help-echo "Column number"))
            (list -3 (propertize "%P" 'face nil 'help-echo "Position in buffer"))
            '(:eval (when (buffer-file-name)
                      (propertize "  %I" 'face 'font-lock-variable-name-face
                                  'help-echo "Buffer size")))))

(setq mode-line-modified
      (list '(:eval (propertize "%*" 'face nil 'help-echo
                                "Buffer read-only and modification indicator"))
            '(:eval (propertize "%+" 'face nil 'help-echo
                                "Buffer read-only and modification indicator"))))

(setq mode-line-buffer-identification
      (list '(:eval (propertize "%12b" 'face 'mode-line-buffer-id
                                'help-echo default-directory))))

(setq-default mode-line-format
              (list "%e"
                    mode-line-position "  "
                    mode-line-modified "  "
                    mode-line-buffer-identification "  "
                    mode-line-modes "  "
                    mode-line-misc-info
                    ))

(which-function-mode)

which-function-mode uses mode-line-misc-info, which I did not modify.
Its value is

((which-function-mode
  (which-func-mode
   (#1="" which-func-format " ")))
 (global-mode-string
  (#1# global-mode-string " ")))

Why isn't it showing anything then? (Nothing is displayed if Emacs is started with this code as ~/.emacs.)


texts:
My global tab-width is set to 4. But in elisp-mode I get 6 spaces per tab in indentation. So the code after auto indenting looks like this:
(defun new-eshell ()
      (interactive)
      (when (one-window-on-screen-p)
            (let* ((lines (window-body-height))
                        (new-window (split-window-vertically (floor (* 0.7 lines)))))
                  (select-window new-window)
                  (buffer-name (eshell "eshell"))
                  )))

How can I set the indentation to 2 spaces?
Update: info for NickD
After I type C-h m I get this:
Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Cl-Old-Struct-Compat Delete-Selection Diff-Auto-Refine Display-Time
Eldoc Electric-Indent File-Name-Shadow Font-Lock Global-Eldoc
Global-Font-Lock Global-Undo-Tree Ivy Line-Number Menu-Bar Mouse-Wheel
Override-Global Pyvenv Shell-Dirtrack Tooltip Transient-Mark Undo-Tree
Yas Yas-Global

(Information about these minor modes follows the major mode info.)

Emacs-Lisp mode defined in ‘elisp-mode.el’:
Major mode for editing Lisp code to run in Emacs.

Doing the same in emacs -Q gives 2 spaces. So, something is wrong with the configs.


texts:
I want to manage simple personal databases, like mp3 collections.

I am not aware of any updated lisp object database project working in Emacs (correct me if I am wrong).

So I would turn to Sqlite, because it seems the only viable serverless database (right?). Have you experience with some library to create or query tables?

I am not particularly interested to Emacs SQL modes, but to libraries sending commands to DBs.


texts: avoid org-preview-latex to open a new window

texts:
I use emacs in frame-only mode and org to typeset latex equations and technical writing.

Since it is hard to see and understand the latex equations in their raw format, I use a package called org-fragtog which just calls the function org-latex-preview to convert the latex code to an image, and insert it in the current buffer.

The problem is, every time a new equation is inserted for the first time, org-latex-preview calls dvipng which opens a new window with the message:

"This is dvipng 1.16 Copyright 2002-2015, 2019 Jan-Ake Larsson [1] ".

Is there a way to suppress this window to open in the first place, or to make it open only when there is an error?

When you are creating lots of equations in a row this gets in the way and stops the flow.

Update

While not knowing a lot of elisp, I could craft the function below. The only problem is it is not being called after org-latex-preview is executed. Anyone know why?

(defun kill-latex-preview-window ()
  (interactive
  (let ((buffer "*Org Preview LaTeX Output*"))
    (if (get-buffer buffer)
        (progn
        (delete-frame (select-frame-by-name buffer))
        (kill-buffer buffer)
        )
    )
  )
  )
)

(add-hook 'post-command-hook 'kill-latex-preview-window )


texts: What's the best way to remove some of the builtin yasnippet and make emacs upgradable?

texts:
I have custom yasnippets and I noticed they are located in the ~/.emacs.d/snippets folder. The builtin snippets are located at ~/.emacs.d/elpa/yasnippet-20161008.804. There are some builtin snippets which I don't want and I want to remove them. Can I simply remove them? Will next time I upgrade yasnippet cause them come back again? What's the best way to handle it?

Please don't suggest not to remove them. I really don't want them because of the conflict key and poor quality of them.

Thanks in advance friends.


texts: org-mode babel python code block to get current org file's location

texts:
I would like to use some python code with babel to output some computation result about the current org file. As I'll be doing this quite often, I'd like ideally to have access to it's file name without hard-writing it's name in my code.

For instance:

#+begin_src python :results output :exports results
with open("myself.org") as f:
    contents = f.read()
print "Current org file line count: %d" % len(contents.split("\n"))
#+end_src

I would want to get rid of the hard-writen "myself.org", which is supposed to point towards the current file name.

Is there any macro possibility in source code block that would insert the current org file's name in the some placeholder in this code block before evaluation ?

Or is there any way to add variables in python code scope to all code blocks which would then allow access to the current file path at run time through variables or any other means ?


texts:
People more knowlegable than I have suggested that intelligent fuzzy matching and sorting for both minibuffer completion and in-buffer completion could be accomplished by implementing a completion-style.

A style that can match according to an arbitrary predicate and can sort according to an arbitrary comparison function would be ideal.

  completion-styles is a variable defined in minibuffer.el. Its value is (basic partial-completion emacs22)

  Documentation:
  List of completion styles to use.
  The available styles are listed in completion-styles-alist.

  Note that completion-category-overrides may override these
  styles for specific categories, such as files, buffers, etc.

  You can customize this variable.

  This variable was introduced, or its default value was changed, in version 23.1 of Emacs.

I'm would personally love to see fuzzy in-buffer completion (à la Visual Studio, Sublime Text, Vim+Neocomplete, Vim+YCM. However, after reading minibuffer.el, I'm completely lost.

How can this be achieved?

There is a lot of interest in this problem:

[Github] Adding fuzzy matching to company
[Github] Implementing a completion style for flx
[Emacs.SE] How can I get fuzzy code completion
[Superuser] Is there emacs plugins to do Sublime-like completion and goto anything?
[SO] Emacs fuzzy autocompletion
[Emacs ML] fuzzy auto-complete via <tab>?
[Reddit] Auto-complete with flex/ido-like matching?
Of course, I'm not sure if anyone wants to use this without a framework, but you absolutely could.


texts: Retrieve all entries with active or inactive timestamp

texts:
I wonder if there is a way to find all entries in active / inactive timestamp state (without DEADLINE or SCHEDULED). It seems I have had such entries unacted upon in the past, and the only way I have to check for them is just browsing my agenda week by week. Thanks!

Emmanu


texts: I have a GPG encrypted Org file (title.org.gpg) that I interact with transparently using epa. I would like to export this to a GPG encrypted PDF. Currently I do this by using the usual LaTeX export (C-c C-e l...), manually encrypting afterwards. How would I go about having Org do this automatically?


texts: Get file name relative to projectile root

texts:
I am trying to write a little function to get the projectile relative path of a buffer. My idea is to delete the substring projectile-project-root from the string buffer-file-name.

For example:

root-file-path: ~/src/dotfiles
buffer-file-name: ~/src/dotfiles/emacs.d/conf.org
relative-file-name: emacs.d/conf.org

my current code is this:

(setq buffer-file-name (string-remove-prefix projectile-project-root
                                             buffer-file-name))

but I can't get it working. Any ideas?


texts:
Do you know about some elisp object inspector? I want object tree view similar to ones in javascript consoles in browsers.

Object:

(list (list "foo" "bar" "baz") "some" "thing")

Inspector:

list
|
+- list
|  |
|  +- "foo"
|  |
|  +- "bar"
|  |
|  +- "baz"
|
+- "some"
|
+- "thing"

It will be awesome with some folding of tree nodes.


texts:
I have several strings in my org file, which look like as follows:

something
something else

When I org-export this file to html, these strings are automatically converted to lists, starting with 1. How to prevent that and export literal strings? Better with some specific #+OPTION or something like that. And how to disable offsets and padding for such strings?


texts: Emacs behind firewall cannot download packages from Melpa

texts:
I am using emacs behind a firewall in Windows. I configured the access to proxy and I worked with no problems for a week. But now I can't upgrade emacs packages using Melpa, because the proxy refuses to download packages ("Bad request"). Any clue to what may happened?

This is the result of emacs with --init-debug:

Debugger entered--Lisp error: (file-error "http://melpa.milkbox.net/packages/archive-contents" "Bad Request")
  signal(file-error ("http://melpa.milkbox.net/packages/archive-contents" "Bad Request"))
  url-insert-file-contents("http://melpa.milkbox.net/packages/archive-contents")
  package--download-one-archive(("melpa" . "http://melpa.milkbox.net/packages/") "archive-contents")
  #[0 "\301\300\302\"\207" [("melpa" . "http://melpa.milkbox.net/packages/") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"]()
  funcall(#[0 "\301\300\302\"\207" [("melpa" . "http://melpa.milkbox.net/packages/") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"])
  package-refresh-contents()
  eval-buffer(#<buffer  *load*> nil "c:/Users/sergio.bacelar/.emacs.d/init.el" nil t)  ; Reading at buffer position 8124
  load-with-code-conversion("c:/Users/sergio.bacelar/.emacs.d/init.el" "c:/Users/sergio.bacelar/.emacs.d/init.el" t t)
  load("c:/Users/sergio.bacelar/.emacs.d/init" t t)
  #[0 "\205\262


texts: What exactly is the difference between `font-family` and `font-foundry`?

texts:
What is the historical context of these two terms?
Why are they distinct? And why are they needed?
What pragmatic utility is there in knowing how these two terms differ?

In terms of Emacs/Emacs Lisp, where are they used/how are they used/why are they used?
(A solid example would be nice).

I am confused because I see no correlation anywhere in any modern-day files/GUI as to why I should know the differences between the meanings of font foundry and font family. But they seem so vital to know when dealing with fonts.


texts: Emacs has opened a py file as a shell script. What went wrong and how to change?


texts: How to pass a DEBUG log-level into elpy?

texts:
To run my C-c C-t individual tests, I tried the following:
 '(elpy-test-pytest-runner-command ("py.test", "-vv"))
 '(elpy-test-runner (quote elpy-test-pytest-runner) (quote "--log-level=DEBUG"))

However the message I get is:
error setting elpy-test-pytest-runner-command

What's the right way to turn
py.test /home/user/my_test.py\:\:test_name

into
py.test /home/user/my_test.py\:\:test_name --log-level="DEBUG"


texts: how to expand the range of org-clock-display

texts:
Recently I upgraded my emacs from 24 to 25 and now when I do a org-clock-display command in one of my org files it only shows me the total for the current year, not previous years.

Is it possible to adjust the range in which org-clock-display will check?


texts: hl-line-mode interferes with custom syntax highlighting

texts:
Recently, using fic-mode as reference, I implemented a way for words like TODO, etc. to be highlighted. Here is the code:

(defun todo/pos-in-doc-or-comment-region-p (pos)
  (memq (get-char-property pos 'face)
        '(font-lock-doc-face font-lock-comment-face)))

(defun todo/search-for-keyword (limit)
  (let ((original-match-data nil))
    (save-match-data
      (while (and (null original-match-data)
                  (re-search-forward "\\<\\(\\(\\(TODO(\\)\\([^)]+?\\)\\():\\)\\)\\|\\(\\(NOTE(\\)\\([^)]+?\\)\\():\\)\\)\\|\\(\\(FIXME(\\)\\([^)]+?\\)\\():\\)\\)\\|\\(\\(IMPORTANT(\\)\\([^)]+?\\)\\():\\)\\)\\)" limit t))
        (if (and (todo/pos-in-doc-or-comment-region-p (match-beginning 0))
                 (todo/pos-in-doc-or-comment-region-p (match-end 0)))
            (setq original-match-data (match-data)))))
    (when original-match-data
      (set-match-data original-match-data)
      (goto-char (match-end 0))
      t)))

(defvar todo/keywords
  '((todo/search-for-keyword  (3 font-lock-warning-face t t)
                              (4 font-lock-constant-face t t)
                              (5 font-lock-warning-face t t)
                              (7 font-lock-string-face t t)
                              (8 font-lock-constant-face t t)
                              (9 font-lock-string-face t t)
                              (11 font-lock-warning-face t t)
                              (12 font-lock-constant-face t t)
                              (13 font-lock-warning-face t t)
                              (15 font-lock-variable-name-face t t)
                              (16 font-lock-constant-face t t)
                              (17 font-lock-variable-name-face t t)
                              )))

(add-hook 'prog-mode-hook
          (lambda () (font-lock-add-keywords nil todo/keywords 'append)))

This was supposed to enable me to write things like TODO(name): something and have it properly highlighted like this:

.

However, if I enable hl-line-mode using (global-hl-line-mode 1), the highlighting only happens if the point (cursor) is on a line different from the one on which the TODO... was typed. If I am on the same line, even doing font-lock-fontify-buffer does not refreshes syntax highlighting.

Also, once the highlighting has been "activated" (by pressing Enter, for example), if I come back to that line and edit something, the highlighting goes away once again.

Can someone help as to how can I stop this clashing with hl-line-mode?

PS. I have set the line highlighting color using

(set-face-background hl-line-face theme/color/woodsmoke) ; hl-line

------------------------------------------------------------

Solution

Using the selected answer, putting

(set-face-attribute 'hl-line nil :inherit nil :background theme/color/woodsmoke)

before

(global-hl-line-mode 1)

fixes it.


texts:
I often use .c file and .txt file on the split emacs frame.

I wrote a code such as the following to init.el.

;; change text-mode indent
(add-hook 'text-mode-hook
      (lambda ()
         (setq indent-line-function 'tab-to-tab-stop)
         (electric-indent-mode -1)
))

This code is convenience for me to arrange text on .txt file.

However, c-mode on emacs also doesn't indent for c-code.

So, I must input tab-key by oneself for .c file.

How can I write a setting to solve this problem.

Please teach me.


texts: Magit pushing through tramp does not work

texts:
Hi guys I'm on a osx machine and I want to push commits from a remote machine through tramp to github. I open the directory in dired on the remote machine which works fine and type M-x magit status which leads me to the status page of the repo and here I wannt to push via P and pbut I get the following error

128 git … push -v origin han\:refs/heads/han
Pushing to git@github.com:username/reponame.git

fatal: Could not read from remote repository.

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

The interesting part of this is, when I log in onto the machine via a terminal session and do a git push there it works flawlessly. So I do have the proper access rights to the repository. The ssh key is added to my local machine and the remote machine. What am I missing here? Why isn't this working in the mentioned setup?


texts: eval elisp code to fill org-babel header arguments

texts:
I use many org files with figures generated by source code blocks.

By example, in an org mode file long/path/document.org I have:

#+BEGIN_SRC dot :file my_fig.png  :exports results
digraph {
  A->B
  B->C
  C->A
}
#+END_SRC

However, to keep a clean directory/files hierarchy I want store the generated figures (or data) in a subdirectory associated to each org mode document, for instance: long/path/document-extra/my_fig.png.

#+BEGIN_SRC dot :file long/path/document-extra/my_fig.png  :exports results
digraph {
  A->B
  B->C
  C->A
}
#+END_SRC

Doing that manually is tedious, how to automate this?


texts: How to show the message age in Wanderlust's summary buffer?

texts:
I tried to customize Wanderlust's summary buffer by changing wl-summary-line-format. I would like to see the age of a message in the summary buffer. But I can not find any abbreviation for the age of a message.

In Gnus it was possible to define a gnus-user-format-function-x, which could be referenced in the gnus-summary-line-format. But I can not find anything similar in Wanderlust.

How to show the age of a message in the summary buffer?


texts: Remapping C-x C-b to Open List of Buffers in Same Window

texts:
I use Emacs across different machines and operating systems. I noticed that when I press C-x C-b to get a list of all buffers, on some machines the list opens in the same window where the cursor is located and allows me to arrow through the list, using ENTER to select and open the buffer I desire.

Yet, on other machines this list opens in the other window (I usually have at least two open) and even after I switch to that window using C-x o, I am not able to arrow through the list, select and open.

How can I achieve the first type of behavior on the latter machines?


texts:
Is it possible to access a user-defined file-local variable during byte-compilation?

As an example, I am trying to get this code to work:

--- testfilelocals.el ---
;; -*- my-file-local: "foo" -*-

(defun testfilelocals ()
  (eval-when-compile
    my-file-local))

which fails with a compiler error

testfilelocals.el:5:5:Error: Symbol's value as variable is void: my-file-local


texts: python "WORKON_HOME" not showing virtual environments in helm

texts:
I've check to see my WORKON_HOME env is set to where I want it at /home/user/anaconda3/envs but in helm the only option i get is .. if I select that option Emacs thinks my virtual environment is anaconda3.

If I use M-x pyvenv-activate I can navigate to my virtual environment and everything is fine. I just can't seem to get pyvenv-workon to point to my environment

For refence I'm using spacemacs with
(setenv "WORKON_HOME" "/home/user/anaconda3/envs")
in my user-init section and verified it is set with M-x getenv WORKON_HOME


texts: auctex pdf-tools split buffers in separate frames

texts: This is an extension of my previous question auctex and pdf-tools in 2 separate frames which was nicely answered by Tobias. I use auctex in one frame and pdftools in another frame. Forward and inverse search work perfectly between the two frames. The question I have is this: how to make forward and inverse search work when I split each frame into 2 buffers? That is,  I have the latex source of a file in one frame split into 2 buffers (with C-x 2); lets call these buffers latex1 and latex2. Similarly I have the corresponding pdf frame split into two buffers - lets call them pdf1 and pdf2. My questions is: how to setup forward and inverse search between latex1 and pdf1, and also between latex2 and pdf2? This helps working on two parts of a large latex document.I need the above setup of two separate frames, one frame for latex (with 2 buffers) and one frame for pdf (with 2 buffers), due to eyesight problems.


texts:
I'm trying to turn off all colored text when using gnu emacs as emacs -nw on linux. This answer gives a snippet of code to use for this purpose:

(cl-loop for face in (face-list) do
     (set-face-attribute face nil :foreground nil :background nil))

However, when I put this in my .emacs file, I get this error:

Symbol's function definition is void: cl-loop

How do I fix this?


texts: Few settings doesn't work in -no-window mode

texts:
I newbee in Emacs, and trying to set up emacs. Well, I've written a init.el file and except few things always work properly. But in -nw mode cursor doesn't work (blink not working), tabs doesn't work (2 tabs always, and I can't do few tabs), cursor-color doesn't work and etc. What Do I do wrong?

init.el:

(require 'package) ;; package.el

;; repositories
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")
                         ("org" . "http://orgmode.org/elpa/")
             ("marmalade" . "http://marmalade-repo.org/packages/")
             ))

(package-initialize)

(load-theme 'dracula t)

;;;;;;;;;;;;;;;;;;;;;;WINDOW SIZE;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-to-list 'default-frame-alist '(height . 40))
(add-to-list 'default-frame-alist '(width . 120))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;SPLASH SCREEN;;;;;;;;;;;;;;;;;;;;;;;;;
(setq inhibit-startup-screen t) ;; turn off
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;;TAB BEHAVIOR;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq-default tab-width 4)
(setq-default indent-tabs-mode nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;;;;;;;;;CURSOR SETTINGS;;;;;;;;;;;;;;;;;;;;;;;;
(save-place-mode 1) ;; save cursor place in file
(set-default 'cursor-type 'box) ;; cursor type underscore
(set-cursor-color "#ffffff")
(blink-cursor-mode 1)
;;(setq visible-cursor nil)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq frame-title-format "emacs") ;;

(menu-bar-mode -1) ;; hide menu-bar

(tool-bar-mode -1) ;; hide tool-bar

(scroll-bar-mode -1) ;; hide-scroll bar

(column-number-mode) ;; column numbers show in bottom

(show-paren-mode)

(global-hl-line-mode)

(winner-mode t)

(windmove-default-keybindings)

(global-set-key (kbd "M-x") 'smex)
(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)

(global-display-line-numbers-mode)

(ac-config-default)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (auto-complete smex dracula-theme))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )


texts:
There is a command I run very often using compile that must be run as sudo. I wanted to achieve something similar to the 5min caching of sudo in a shell: if I keep running the command in intervals shorter than 5min it does not prompts me for the password again.

Is there an easy way to achieve that?


texts: Link and adjacent text get merged: how to preven that?

texts:
Say I start with:

{}{foo}

and insert a link inside the first pair of braces:

{https://emacs.stackexchange.com/questions/ask}{foo}

It will link to

https://emacs.stackexchange.com/questions/ask%7D%7Bfoo

How to prevent this?


texts: Python automatically add import statement

texts:
Is there a way to automatically add imports to python code within emacs?
def f(x: str) -> List[str]:

I want to be able to have my guess over "List" press a key binding and magically add List to my imports.
I had a brief look on github, didn't find much. I found a package called importless-lang that was a partial implementation of this idea, and started adpting this by it seemed like a reasonable amount of work.


texts: More detailed description of how to set-up org-file-apps for orgmode 9.0

texts:
The release notes for the changed method of specifing how to open links in org files say that org-file-apps no longer accepts an S-expression but you need to put in a function (and gives an example with a lambda). But the example does not escape any quotes, nor explain what is the "file" and what is the "link" that are being passed to this function.

I have noticed that libreoffice .ods files are opening up in emacs, and not being opened by libreoffice, but I cannot figure out how to add a case to org-file-apps to do this successfully.

General question: please explain the new methods for org-file-apps orgmode v 9.0 with more detail. Specific question: assuming /usr/bin/libreoffice exists, what should the addition to org-file-apps be to get libreoffice to launch a file with extension .ods rather than open it up in emacs.


texts: How to convert lines to an org-mode checklist?


texts:
Windows 10, Emacs 26.1

I has org mode table. Is it possible to convert it to MS Excel?

Thanks.


texts:
I want to delete lines with number 03,08,13,18,...., 3+5n.

How can I do that? Thank you very much.


texts: Using package.el to install and update but use-package for loading and configuring

texts:
After recently learning about use-package I decided to port my configuration to it but found myself reluctant to give up the convenience of using package.el to install packages and keep them updated. I've found it a little tricky to combine use-package and package.el.

I'm generally interested in learning how people combine use-package with the package.el system, but for a more specific question, keep reading.

Here's what I want:

To have packages installed by the package manager so I can easily browse for packages and keep them updated through list-packages.
To configure and load packages exclusively through use-package, so I can easily see in my init file exactly what I'm loading and how it is configured.
Optionally, I'd like to also be able to install packages through use-package's :ensure keyword.

If I'm understanding correctly I want very little of what package-initialize does, basically only the way it sets up the load-path. Currently I have this in my configuration:

;(package-initialize)
(setq package-enable-at-startup nil)
(let ((default-directory "~/.emacs.d/elpa"))
  (normal-top-level-add-subdirs-to-load-path))
(require 'use-package)

The first, commented, line is so Emacs 25 doesn't helpfully add a (package-initialize) to my init file. The bit with normal-top-level-add-subdirs-to-load-path is an approximation to what package-initialize would make the load-path, an approximation that seems good enough.

This seems to achieve my desires 1 and 2, but not 3. If I try to use :ensure, I get an error message saying that package.el is not initialized. Calling package-initialize would fix that, but I wish to avoid that since a) I don't want all the myriad autoloads to be loaded (I prefer to use use-package to create precisely the autoloads I need), and b) I want to be able to easily avoid loading certain installed packages whenever I want (which is easy to do with use-package).

Does anyone have a recommendation for how to do this?


texts:
I am trying to remap C-c, C-x, C-v (windows editing shortcuts for copy, cut, paste) using these 3 lines of elisp code:

(global-set-key (kbd "C-c") 'kill-ring-save)
(global-set-key (kbd "C-x") 'kill-region)
(global-set-key (kbd "C-v") 'yank)

kill-region and yank works well whereas the C-c binding does not.
Can C-c be rebound? I prefer to set the keybindings myself instead of using cua-mode so that i can have finer control over it.


texts:
In my init.el I have the following lines:

(add-hook 'org-capture-mode-hook
          (lambda ()
             (set (make-local-variable 'org-complete-tags-always-offer-all-agenda-tags)
                  t)))

In my org file, I have more than a hundred tags and have the following line at the very top:

#+TAGS: { Incoming(i) Outgoing(o) }

Now, when I C-c c t to add a new task and to C-c C-q to add tags, I want ONLY i and o to be shown as options. But instead, it shows me multiple tags with random keys assigned to them!

How do I tell org mode to ONLY show EXPLICITLY defined short-cut keys?


texts: Simple project management---org-mode, or another tool?

texts:
I'm a beginning emacs and org-mode user interested in the mode for personal project management. For example, I have a database of photo images:

2014-10-steven-and-his-cats.jpg
2014-10-steven-author-photo.jpg
2014-11-james-with-his-giant-peach.tif

Etc, for hundreds (not thousands) of pictures. I'd like to treat this as a database from which I could draw information for various (fairly simple, some longterm) projects. I'm wondering if people employ org-mode to organize data in this way using, for instance, org links, or if there's a better tool than org-mode. I have limited technical expertise, and am not a programmer.


texts: Different font heights for each Emacs frame

texts:
I use multiple monitors with different DPIs so I would like to have all windows in the Emacs frame on a specific monitor with a bigger font height to have the a closer physical appearance to the other monitor. We can assume I won't open the same buffer on separate frames/monitors.

Is this possible?
I'm running brew 24.5 emacs on OSX.


texts: Magit v2.2.0 failed to load: wrong type argument

texts:
After updating to magit v2.2.0 (and removing the old magit, git-rebase-mode and git-commit-mode I got the following error message after calling M-x magit-status:

Wrong type argument: symbolp, (cyg . win)

and Magit does not fire up. Thought it could come from my init file but removing it did not solve the problem.

M-x magit-version gives Magit 20151019.443, Git 2.6.2, Emacs 24.4.1.

OS: Ubuntu 15.04

Any hints? Thx!


texts: Using Counsel with write-file and insert-file

texts:
What is the simplest way to have Counsel versions of write-file (C-x C-w) and insert-file (C-x i)?

I would like these replacements to work similarly to counsel-find-file (typically bound to C-x C-f).  I don't want to add actions (M-o ...) to counsel-find-file but to have a dedicated functions, as in default Emacs.


texts: symbol's value as variable is void: command, when using ibuffer-sidebar

texts:
I installed ibuffer-sidebar (https://github.com/jojojames/ibuffer-sidebar) and added the following to my ~/.emacs.d/init.el:

(use-package "ibuffer-sidebar.el")
(require 'ibuffer-sidebar)
(setq ibuffer-sidebar-use-custom-font t)
(setq ibuffer-sidebar-face `(:family "Helvetica" :height 120))

After doing this, all helm commands fail. E.g. helm-find-files says In Find FIles source: helm-find-fules-get-candidates (void-variable command). Other helm commands just say symbol's value as variable is void: command. I'm a newbie, very excited about emacs.


texts: how to bind C-p to Evil paste pop only when last command is a paste operation

texts:
I have tried this, not working.

(defun my/evil-paste-pop ()
  (interactive)
    (if (eq last-command evil-paste-pop) (evil-paste-pop 1)
    (previous-line)))
(define-key evil-normal-state-map (kbd "C-p") 'my/evil-paste-pop)


texts: Leuven Theme makes org-mode headline too big

texts:
As you can see, switching to the leuven theme makes my org-mode first level headlines bigger than the rest of the text. I don't like that, where can I change this behaviour? Where is the leuven-code that takes care of this modification? Is this even caused by the leuven theme?

The reason why I don't like this feature is that I'm using my own "first level headline" (see Allgemeines). So as an additional feature: How can I make my own Headings bigger instead of the org-mode headlines? (Maybe the answer to the first question will answer this question too.)

Thanks!

P.S.: I don't want to change the leuven theme, because I like the colors!


texts: Evaluate some arguments to macro immediately

texts:
I am trying to call a macro (defined somewhere else; I can't change it), but I want to evaluate some of the arguments before the macro is expanded.  Is this possible?

For example:

(defmacro foo (&rest args) (mapcar (lambda (a) (message "arg: %s" a)) args) nil)
(foo b (+ 1 1) c)
;; Prints:
;;   arg: b
;;   arg: (+ 1 1)
;;   arg: c
;; But I want:
;;   arg: b
;;   arg: 2
;;   arg: c

The only way I've found so far is:

(eval `(foo b ,(+ 1 1) c))

Is there a better way?


texts: How to understand the font specification in Emacs?

texts:
I can find the font specification of a character in Emacs as something like

mac-ct:-*-Source Code Pro-normal-normal-normal-*-20-*-*-*-m-0-iso10646-1 (#x30)

What do the different parts of it mean?


texts: Syntax highlighting for comments in Magit commit buffers with custom core.commentChar

texts:
I frequently source the body of my GitHub PRs from my commits, and thus is makes sense to consider my commits to be made in Markdown (it is nice to have a markup language for commits anyway). Thus I customized Magit's git-commit-major-mode to be markdown-mode, but then all the # comment lines that Git inserts get formatted like markdown headers---highly undesirable! So I switched away from # as Git's comment delimiter. Somewhat randomly, I picked !, and added to my .gitconfig:
[core]
    commentChar = !

This keeps them from being formatted like headers, but I previously enjoyed the way that Magit had some understanding of these lines and would syntax-highlight them. I was hoping that there was some intelligence in the Git commit mode that would be able to mesh markdown mode with the original abilities of Magit, so that above the comment lines would be highlighted with Markdown, and the comment lines themselves would be highlighted by Magit (which is already aware of core.commentChar, because when I set commit buffers to have no major mode, it properly highlights the comments that use !).
My current configuration is usable, but with Emacs (and Magit especially) I always shoot for the stars. How do I achieve this?


texts: Way to make a file read-only from dired?

texts:
Is there a way to make a file read-only from dired?

This, this, and this are unclear to me.

The manual has lots to say about marking/flagging via dired as well as operating on files, but I can't see anything in operating that discusses changing a file to read-only.

Based on the links above (that I said were unclear to me), I am guessing it has something to do with modes and/or permissions?

For bonus points, is there a way to operate on a directory via dired to make all files within it read-only?

To be clear, I want the files to become read-only and to stay that way until they are changed back to read/write manually.


texts: How query-replace-regexp for all text exact before specific text?

texts:
emacs 26.1, windows 10

I have some text. I need to replace all text before WARN

I use:

query-replace-regexp: .*WARN
query replace regexp: RET

But I need to delete all text BEFORE WARN.
How I can do this?

here is the result:


texts: `message-insert-signature` : Do not add the "--" prefix?

texts: How can I make message-insert-signature not inserting the -- prefix? If not possible, is there a another function that inserts signature without the -- prefix?


texts: How to suppress warning about positional arguments in define-minor-mode

texts:
I am on Emacs 28.0.5 and keep getting warnings about:
Warning: Use keywords rather than deprecated positional arguments to `define-minor-mode'

Unfortunately it is for packages I don't control like lsp-mode. I would like to suppress the warning using something like (I use radian Emacs config, hence the use of use-feature for Emacs-provided packages - imagine a require 'warnings if you are more familiar with that):
(use-feature warnings
   :config
   (add-to-list 'warning-suppress-log-types '(what-to-put-here?)))

but apparently I am not passing the type that warning-suppress-log-types expects for this warning to be picked up because it keeps happening when lsp-mode loads (I won't bore you with all the incantations that I've tried in 'what-to-put-here?'. If you read the source for define-minor-mode you'll see that the way the warning is generated is perhaps non-standard, i.e., it doesn't seem to call display-warning. Do you know a way to make it stop generating this message?
I'd do a pull request to lsp-mode, but I am an outlier by using such a bleeding edge Emacs version and I don't imagine they'll want to accommodate that version in the common case.
Note: I have filed an issue with lsp-mode in the meantime.


texts: use-package deferred loading for extensions not in :mode

texts:
When moving to use-package, I'd to replace

(require 'markdown-mode)
(add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))

with

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

use-package's documentation on :defer says it's unneeded when using :mode:

  Defer loading of a package -- this is implied when using ‘:commands’, ‘:bind’, ‘:bind*’, ‘:mode’, ‘:magic’, ‘:hook’, ‘:magic-fallback’, or ‘:interpreter’.  This can be an integer, to force loading after N seconds of idle time, if the package has not already been loaded.

so only when I open a file ending .md, will markdown-mode be loaded and configured.

However, there're extensions where there're

No additions to auto-mode-alist e.g. .rs files automatically have rust-mode as major
Some additions to auto-mode-alist

(use-package cc-mode
  ;; not adding .c, .cpp, .cc, .h, etc. since it's automatically
  ;; associated to the right cc mode
  :mode (("\\.inl\\'" . c++-mode)
         ("\\.mm\\'" . objc-mode))
)

In these cases will use-package do deferred loading?

When I open a .c file, I see that the major mode is rightly c-mode but I don't know if this was early/lazy loaded.


texts: Why doesn't desktop-save-mode persist neotree?

texts: Desktop-save-mode seems to save all windows except neotree - When I restart emacs, the neotree window is always gone. Why is this window different from the others? Is it possible for neotree's state to persist like everything else?


texts:
The below settings in my .emacs make emacs (24.3) save multiple back-ups.

(setq delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2
      version-control t)

However, I have little use for the newest 6 and oldest 2.

I'd like to distribute the back-ups. For example, keep the last saved version each day, and keep 5 versions for the present day.


texts: How to set indent to 4 spaces in nxml-mode?

texts:
I wanted to indent my XML files with 4 spaces.
I tried to google it, and found this and this one.
But they seem pretty old and/or didn't help me.

This post is great about how to pretty print XML files, but gives no hint how to set indent to a specific value. How can I do that?


texts: org-mode table: how to add the left-most vertical line with column groups notation?

texts:
The documentation suggests that column groups syntax is a general way to add vertical lines in a table.
For instance, the following org-mode's table snippet
|--------+----------|
|        | Column 1 |
|--------+----------|
| /      | <>       |
| Line 1 |          |
|--------+----------|

is rendered in pdf as

and in ASCII as
--------+----------+
        | Column 1 |
--------+----------+
 Line 1 |          |
--------+----------+

(Apparently, this doesn't work for HTML as the boundaries are controlled by CSS).
My question is: how to use column groups to obtain the left-most vertical line?
The idea is to use one syntax to export the table with specific vertical lines in different formats.
I'm aware of the alternative way to achieve it using #+ATTR_LaTeX: :align |c|c|, but it's specific to LaTeX.


texts: Technical considerations for package maintainers to not use the Emacs package manager?

texts:
I am noticing some notable package maintainers are choosing to not use the Emacs package management system (ESS?) or complaining about its limitations (Helm).

Quoting from Helm's README.md:

  WARNING: Due to a bad concept of package.el which is in charge of
  fetching helm files and compiling them, users had errors most of the
  time when upgrading from melpa and list-package. To avoid this Async
  have been added as dependency to helm to force package.el compiling
  its files in a clean environment. People installing from git and using
  the make file will not suffer from this problem and don't need Async
  though it is recommended as it fix installation of all other packages
  you may install with package.el from (m)elpa. See FAQ for more infos.

What exact technical limitations does the current package management system has that they could be alluding to, and why would packages need to use async as a dependency?


texts: Display recursive folder sizes in-line in dired?

texts:
I'd like to display the recursive size (the value that would be reported by du) of folder contents in-line in the dired buffer as an additional column or in place of the directory file size.  Is this already possible with dired/dired+ or a related package?

I've done some digging and found some discussion of this sort of functionality, but nothing that integrates that size information back into the graphical interface of dired.

https://www.emacswiki.org/emacs/DiredGetFileSize
https://superuser.com/questions/462079/how-can-i-display-folder-sizes-in-emacs-dired


texts: How to detect and match indentation size of current buffer

texts:
I'm working on a javascript project that has inconsistent tab sizes 2spaces vs 4spaces on the server and client. I'm using web-mode for javascript editing. I'm looking for a feature like SublimeTexts detect_indentation

I have tried:
https://github.com/emacsmirror/fuzzy-format
https://github.com/jscheid/dtrt-indent

And neither have worked


texts: org-notmuch error: user-error: No method for storing a link from this buffer

texts:
i have added the

(require 'org-notmuch)

to my config and can verify it loads by seeing the notmuch link type in my org mode links.

yet when i try to issue org-store-link in a notmuch buffer i always get the error

user-error: No method for storing a link from this buffer

any clue?


texts: Run-python problem Emacs + Anaconda (virtualenv)

texts:
When I used run-python through 'c-c c-p', I got the messages like below.
I don't know what it is.

Anaconda within GNU emacs in Mac.
It doesn't seem like a problem, just came out.


texts: package is installed but command not available under M-x

texts:
I installed darkroom via the package manager in my GNU Emacs 25.3.1 (x86_64-w64-mingw32). M-x package-list shows the package as installed and in fact are the files in the respective folder, the command, however, M-x darkroom-mode does not work, i.e. response with [no match].

The relevant parts of my  .emacs looks like this:

(package-initialize)

(custom-set-variables
'(package-selected-packages (quote (darkroom auctex))))

Is there something missing? Is it maybe still running? I'm grateful for any suggestions,


texts: how to modify default command for TeX-command-master (ie, C-c C-c)?

texts:
Q: how can I get TeX-command-master (C-c C-c) to default to LaTeX rather than View?

TeX-command-master dispatches to various commands, such as LaTeX, BibTeX, View, etc., almost none of which I use besides LaTeX and BibTeX.  In particular, I almost never use View via TeX-command-master (using TeX-view via C-c C-v instead), and it's annoying that TeX-command-master defaults to View after running LaTeX.

Instead, I'd like TeX-command-master never to default to View, but rather to LaTeX so that I can recompile without breaking my flow.

How would one change the default?  It seems rather extreme to edit out the View option from TeX-command-list, and I'm not sure where else to look.


texts: Include some content in org-mode only when exporting to HTML

texts:
I'm currently exporting a document to latex and HTML and there is some content that I have to create separately for each target. For the latex target, I add the latex code as
#+begin_export latex
// latex code
#+end_end

which is not included in HTML export.
However, for the HTML export, I'd like to add the content as org-mode syntax and have org-mode parse it as usual. Therefore, using #+begin_export html is not an option. Obviously, the parsed content should be included only in HTML export.
I have found this question that use drawers to selective export and the drawer content is parsed by org-mode according to the export target. However, it is necessary to manually specify which drawer should (not) be exported.

The reason I need this is because I want to include two figures side-by-side and I'm using org-ref for labels and references. I can directly include the latex code using the subfigure environment in a #+begin_export latex block and everyhting works in latex export (referencing as well as numbering).
In HTML export it's OK for the figures to be one below the other (although side-by-side would also be nice). If I directly add the HTML code in a #+begin_export html like the solution for the latex export, then the caption will not include the figure numbering, since org/org-ref doesn't touch it.

Current Solution
My current solution is to use a src block to return the org-mode code for the figures, which it the content I only want to be included in HTML export. The reason is that with an src block I can add :exports and pass lisp code that checks the value of org-export-current-backend. In the case of HTML export the lisp code results in :exports results, while in other backends it results in :exports none.
#+begin_src python :exports (if (org-export-derived-backend-p org-export-current-backend 'html) "results" "none") :results raw
  content = """
  ,#+NAME: fig1_label
  ,#+CAPTION: Fig1 caption.
  ,#+ATTR_HTML: :width 500 :height 500
  [[file:figs/fig1.svg]]

  ,#+NAME: fig2_label
  ,#+CAPTION: Fig2 caption.
  ,#+ATTR_HTML: :width 500 :height 500
  [[file:figs/fig2.svg]]
  """
  return content
#+end_src

It works, but it is a bit cumbersome. It would be great if that was a flag I could pass to a #+begin_export html block to specify that it has org-mode markup and the content should be transformed with the regular html export. Even better if I could get actual subfigures working in HTML export (with a single org-mode code for both latex and html export).


texts:
I'm just trying my hands on emacs lisp.  So far I've had some luck, but
I'm stuck trying to load my frames configuration into a list.

Here's what I'm trying to do...
I am saving frames configuration (all currently open frames) like so

(defun save-all-frames ()
  (interactive)
  (let ((config (current-frame-configuration)))
    (with-temp-buffer
      (insert
       (format "%s" config))
      (if (file-exists-p framegeometry-file)
          (when (file-writable-p framegeometry-file)
            (write-file framegeometry-file)))
      ))
  )

where framegeometry-file points to "~/.emacs.d/frameconfig.el"

Now this works fine...but I do not know how to read it back
into a list so that I can traverse through it and create frames
with the configuration. I'm thinking of using set-frame-configuration to
restore the configuration read from the file.

Any help or pointers in the right direction will be really appreciated.


texts: What is the equivalent of save-restriction for org-mode cycling?

texts:
I coded a function that accesses lines in a folded drawer:

(defun org-try-merging-last-clock-out ()
  "Try to merge the latest clock-out, and catch the error if the discrepancy is not zero."
  (save-restriction
    (save-excursion
      (org-clock-goto)
      (search-forward org-last-inserted-timestamp)
      (condition-case nil
      (org-clock-merge t)
    (error)))))

The function org-clock-merge is an interactive function that I defined in this other thread that merges two clock lines. It is long and I can copy it here if needed.

My clock lines are in a LOGBOOK drawer. The headline initially looks like this:

** DONE Some task...

After calling the function programmatically through the org-clock-out-hook, it looks like this:

** DONE Some task
CLOSED: [2019-09-24 Tue 15:56] SCHEDULED: <2019-10-07 Mon>
:PROPERTIES:
:CREATED:  [2019-09-23 Mon]
:END:
:LOGBOOK:...

I confirm that my org-clock-merge function ran and merged the clock stamps. I would like the headline appearance not to change after running the command.

Does a function similar to save-restriction for narrowing exist for org-mode cycling?


texts: scroll-preserve-screen-position causes cursor to move forward one character at screen boundary

texts:
I am using (setq scroll-preserve-screen-position t) as suggested at  https://superuser.com/a/184421/39697, and it works well, except for me, when I scroll at the top of the screen using scroll-up-line, the cursor moves foward one character (same with the bottom of the screen).

This isn't happening with emacs -Q, so I'm unsure what in my configuration is causing it. I'd like to use bug-hunter to find why, but I'm unsure how to encode this as a test expression.


texts:
I am using use-package in my .emacs and it is great. However
occasionally I want to use a 3-rd party code which is not in [M]ELPA.
Of course, I can download it but then I will need to maintain a copy of it on all the machines I use. Now I can just copy .emacs to a new machine, start emacs and it will download and install all packages. I wonder if there is anything similar for non-packaged libraries? Something which will fetch them via HTTP or git, compile and add to load path.

Here is an example of a package I want to use:

https://github.com/emacsmirror/emacswiki.org/blob/master/zoom-frm.el

I suspect that maybe el-get can do this but I am unsure. Maybe somebody can show me an example for this zoom-ftm.el?


texts: emacs 25 shell-mode tab auto-completion issue with ksh

texts:
I have upgraded to Emacs 25.3 from 24. This issue only appears in the ksh. I've found that when I use bash then all is good.
I find that in shell-mode when I hit tab to perform completion of the rest of the filename or directory, then Emacs inserts annoying character(s) at the start of the command line. it inserts one or more of > as I hit the tab key. This didn't happen in 24. I have tried in terminal mode -nw and using a gtk build.

How do I revert to the correct behaviour ?

Here is an example of the shell prompt in Emacs:

stm5412dap: /home/danlsb $

stm5412dap: /home/danlsb $

I now hit the TAB key after ls ./ and completion window pops up and a > gets inserted after the prompt every time I hit TAB. These get sent to the shell when I hit return which the shell will barf an error upon:

stm5412dap: /home/danlsb $ > > > > ls ./

/bin/ksh: ^L^L^L^Llr: not found [No such file or directory]

It's strange that the problem does not occur as soon as I switch to a bash shell. I exported PS1=$ in ksh to test a very simple prompt but the problem persisted.

SOLVED >>>
I found this was causing the issue in my .profile. For some reason emacs25 shell does not like the below lines (yet in worked in earlier versions).

case $- in
    *i*)
        set -o emacs
        set -o ignoreeof
        #bind "^I=complete"

esac


texts:
I'm debugging with pdb in emacs and one of the parameters to the program I'm debugging is a list of regular expressions wrapped in quotes. Basically,

pdb someProgram.py 'regex .* .*'

from the minibuffer, I think.

The problem is that shell expansion happens here for some reason and the .* becomes expanded to a file wildcard pattern and becomes a list of all files in the current directory that start with . including .. and any hidden files.

This doesn't happen if I'm running the program from the standard command line like so:

python someProgram.py 'regex .* .*'

Why is the expansion happening in the minibuffer? And how do I prevent it from happening?


texts: outline levels without different length of the match

texts:
I'm new to Emacs. I'm trying to use the outline-mode with a specific requirement.
I would like to have the number 1 corresponding to the level 1, the number 2 corresponding to level 2 and so on:

1keyword_a(first level)
2sub_keyword_aa(second level)
2sub_keyword_ab(second level)
3sub_sub_keyword_aba(third level)

1keyword_b(first level)
2sub_keyword_ba(second level)
3sub_sub_keyword_baa(third level)

I understand that outline levels works with the length of the match but I'm wondering whether my requirement is possible?


texts: Adding new syntax highlighting for some major modes does not work

texts:
My question is similar to this one and that one: I would like to add highlighting of some characters that are not highlighted in some programming modes, like python-mode and fortran-mode.

So, following Lindydancer's answer to the first question cited above, I try the following in my init file:

(defun python-fortran-common-hook ()
    (font-lock-add-keywords nil
                '(;
                  ("+" (0 font-lock-negation-char-face))
                  ("-" (0 font-lock-negation-char-face))
                  ("*" (0 font-lock-negation-char-face))
                  ("/" (0 font-lock-negation-char-face))
                  ("=" (0 font-lock-negation-char-face))
                  ("<" (0 font-lock-negation-char-face))
                  (">" (0 font-lock-negation-char-face))
                  ("," (0 font-lock-negation-char-face))
                  (";" (0 font-lock-negation-char-face))
                  (":" (0 font-lock-negation-char-face))
                  )))
(add-hook 'python-mode-hook #'python-fortran-common-hook)
(add-hook 'fortran-mode-hook #'python-fortran-common-hook)

The problem is that for some reason this does not work (the characters I want to highlight still have the default highlighting), and my question is why.

Note 1: I tried the same with an add-hook form, and it works. But I would greatly appreciate to have the above form, not to have to write and add-hook for each mode that I want to have this highlighting. I am aware of prog-mode, but there are modes in it for which I don't want this highlighting.

Note 2: Of course, if there is a better way to achieve what I want, I would be glad to hear about it.


texts:
I am lost in Gnus documentation.

How can I report spam to Gmane when read Gmane NNPP in Gnus?

I set:

(with-eval-after-load gnus-art
   (setq gnus-visible-headers (concat gnus-visible-headers "\\|^Archived-At:\\|^List-URL:")))

in order to visit web page and push report button manually.

My attempt is:

(with-eval-after-load gnus
  (require 'spam)
  (spam-initialize)
  (setq gnus-spam-process-newsgroups
        '(("^gmane\\." ((spam spam-use-gmane))))))

but I am unsure if this is correct way and if that worked at all.


texts: How to make emacs work well with tiling window managers?

texts:
Under some conditions Emacs will try to resize a frame if its not fullscreen or maximized.

(specifically default-text-scale, but I don't think its the only one).

This sends window-manager window (aka Emacs frame) resize commands, which get ignored, making the frame flicker when scaling fonts for eg.

Running toggle-frame-maximized solves this until the window manager moves the frame which resets Emacs internal state.

I tried:

(add-to-list
  'default-frame-alist
  '(fullscreen . maximized))

Which works at startup until the frame is moved.

How to configure Emacs so it's always maximized, or so that plugins don't think it's possible to resize the frame?

Tested with spectrwm and notion window managers.


texts:
Q: how do I change text properties conditional on other properties?

I have text between region beg and end.  Each character has
text properties.  I know I can change those text properties in an
unconditional way with something like:

(add-text-properties beg end '(some-property t))

How can I change the text properties of characters conditional on their existing properties?

Here's an example.  Each character in the region has two text
properties, prop1 and prop2, that take on t or nil
values.  I want to set the value of prop1 to t for only those
characters whose prop2 value is t.  How do I do that?


texts: Changing background color based on first character on line

texts:
How can I change the font background based on the first character on a given line? Take for example:

(set-face-attribute 'marker-2 nil :background some_function)

where some_function returns "blue" if the first character of a line is equal to %, otherwise it returns "red"?


texts: How do I disambiguate mentions of a minor mode in a docstring?

texts:
The docstring of the following function doesn't make Emacs happy:

(defun foo-all-the-bars ()
  "Foo all the bars.
Starts by fooing some bars by enabling `prettify-symbols-mode',
then manually foos any remaining bars."
  (prettify-symbols-mode))

Checkdoc complains with the following message:

  Disambiguate prettify-symbols-mode by preceding w/ function,command,variable,option or symbol.

Which one should I use?


texts: If a function is passed as an argument to another function, is the first function's name accessible?

texts:
I have some code that takes as an argument a function:

(defun message-name (fn)
  )

I would like to be able to, if the function has a name, message it. For example, if called this way:

(message-name #'get-buffer)

I would like this code to message The function's name is get-buffer:

(defun message-name (fn)
  (message "The function's name is %s."
           (????? fn)))


texts:
If we have a class like the one below emacs is indenting the : (to the initialization list). To be able to match some other editor, is it possible in emacs to indent the : like below?

class Test
{
public:
   Test(int a, int b)
   :
      m_a{a}, m_b{b}
   {
   }
private:
   int m_a, m_b;
};

currently the indentation is like this:

class Test
{
public:
   Test(int a, int b)
      :
      m_a{a}, m_b{b}
   {
   }
private:
   int m_a, m_b;
};


texts: support for regex look behind and ahead?

texts:
I need to perform regex query replace, such that

foo in foo bar is matched, but foo in foo baz is not. Normally I would use regex look ahead, e.g. foo(?=bar).

However, it seems like Emacs cannot do this? Vim seems capable, but evil mode in spacemacs cannot.


texts: Define a function to execute multiple commands

texts:
Here is part of my init.el:

(defun xx-devanagari-script ()
  (interactive)
  (save-excursion
    (face-remap-add-relative 'default :family "Lohit Devanagari")
    (text-scale-increase)
    (text-scale-increase)))
(global-set-key (kbd "C-c d") 'xx-devanagari-script)

All I am trying to do is change the font of the current buffer to 'Lohit Devanagari' and increase the text scale twice.

It changes the font. But the text scale does not increase. It also produces an error:

  Wrong number of arguments: (1 . 1), 0

How do I get my first elisp function going?


texts: How to know if Emacs is running in batch mode

texts:
I have one file that needs to behave differently depending on whether Emacs is running in batch mode (non interactive) or normal mode.

(if batch-mode-t
    a-func
  b-func)

How can I detect this?


texts: Make highlight-changes-mode untrack specific changes

texts:
I recently discovered highlight-changes-mode and I added it to my proofs-typesetting setup (LaTeX). I usually make some temporary changes to my buffer that I like not to be tracked (highlighted) when higlight-changes-mode is active.

Is it possible to do it? If so, how?

Edit. As for regexp highlighting in my question highlight-regexp: what's the variable in which they are stored? I imagine it can be done by let binding the variable(s) in which overlays are stored. Unfortunately I've not been able to find it.

A MWE of what I'm searching for can be explained by the following example.

Let's say I'm working on a LaTeX project in the proofreading stage. At a certain point I want to highlight a word/regexp in the PDF output. I can do:

(save-excursion
  ;; "WORD" --> "{\color{red} WORD}"
  (perform-replace "WORD"
                   "{\\color{red} WORD}"
                   nil nil nil 1 nil (point-min) (point-max))
  (save-buffer)

  ;; pdflatex the buffer-file
  (tex-file)

  (perform-replace "{\\color{red} WORD}"
                   "WORD"
                   nil nil nil 1 nil (point-min) (point-max))
  (save-buffer)
  )

In this case highlight-changes-mode will track all my temporary changes. My purpose is to create a wrapper form this kind of operation that makes them not be tracked by highlight-changes-mode.


texts: How can I have more control over repeating tasks in Org?

texts:
I began exploring org-mode lately and I love it. But, I'd like to know how I can have more control over repeating tasks, like if I've set a task to repeat everyday, how can I make it exclude weekends?

Also, is there a option like a holiday mode or something similar which when turned on asks for the duration i'll be away and all my repeating tasks(if I have any that are scheduled during the time I take off) are rescheduled automatically to the next scheduled day after the holiday ends.


texts: How to use Flyspell to efficiently correct previous word?

texts:
From the moment when I started using Flyspell, it always was painful to
use. I rarely check entire buffer for misspelled words, usually I type and
once I see underlined word I want to correct it instantly and continue
typing. This is simply because I fear to forget to correct the word later
and because when I start comprehensive checking of buffer, iSpell gives too
many false positives. So, almost always I correct words as soon as possible
while I type.

Here is built-in functions I know about and reasons why they are not
efficient (for me):

flyspell-correct-word — This is bound to mouse click. Forget it, I'm not
going to use mouse.
flyspell-correct-word-before-point — I used it for some time. It has two
downsides:

By default it shows GUI menu that is difficult to operate without mouse
and it's really cumbersome when you have list of corrections with more
than 10 items.
It doesn't work for word long before point. I type fast and when I
spot misspelled word I typically have one or two words between the
misspelled word and point. I need to move point, correct word, return
back. Oh.

flyspell-auto-correct-word — See point 2 ↑ plus it doesn't work well
when you have long list of completions (because of cycling).

Q: How can I use Flyspell efficiently, with keyboard, being able to
choose from list of completions without cycling, and with ability to correct
even more or less distant words?

Acceptable answers include packages that help to navigate to previous
misspelled word, correct it and get back or something like that as well as
little snippets, possibly from your own configuration file, since I believe
other people figured out their ways to efficiently interact with Flyspell.


texts: What is the best way to search forward/backward for a token?

texts:
Sometimes I want to search for a specific word but I don't want to find words which have my search string as a substring.

For example, if I search for "pan" (bread, in Spanish), I don't want to find the words "expansión", "sepan", or "panorama". A partial work around would be to search for " pan " (with spaces around), but in this case, I will not find the word "pan" when it is at the end of the sentence ("pan.") or near a comma ("pan,").

Is there a straightforward way to accomplish that?


texts: How do I use split-window-sensibly with ediff-setup-windows-plain together?

texts:
I want ediff to use split-window-sensibly so it will stack the diffs on top/bottom when the window is narrow, but side-by-side when the window is wide. I'd like to use a single frame instead of the overlay help window (ediff-setup-windows-plain).

So I set these two settings in my .emacs:

(setq ediff-split-window-function 'split-window-sensibly)
(setq ediff-window-setup-function 'ediff-setup-windows-plain)

and M-x vc-ediff in a git-controlled and modified file.

Then ediff fails to display the top window. Only the help buffer and buffer B are displayed (with diff highlighting and ediff keybindings). As far as I can tell, all I can do to fix this is to use ediff-setup-windows-multiframe instead.

I'm using Emacs 24 on Ubuntu (I'm also using spacemacs, but I reproduced without my .emacs.d)

Any idea what I can do? I'm not even sure where I'd report a bug (emacs bug, ediff bug, already fixed bug?).


texts: Is there an emacs command to go to end of code line (before line comment and whitespaces start)

texts:
say you have that:

stuff
    indented stuff   # commented stuff

We already got move-beginning-of-line and back-to-indentation for the left side. Now, for the right side...

I'd love to know if you are aware of a function that goes at the end of the code line (square position)

stuff
    indented stuff□   # commented stuff

should be able to understand the comment symbol depending on mode I guess.


texts: Emacs Magit not working after OSX Catalina upgrade

texts: Since upgrading my mac to Catalina yesterday, I managed to get Emacs working again after allowing Ruby access to all files in the settings, and most of it works fine, but I can't get Magit to recognise the repo that it is in. C-x g simply does not work, so I tried M-x magit-status in the minibuffer and it asks if I want to create a repo, but I'm already in the the right place, still working on the same things I was working on last week. The only change is the Mac OSX upgrade (work machine so enforced).


texts: Rewriting `defadvice' as `advice-add' makes advice ineffective

texts:
I am trying to make undo-tree auto compress the history save file. The document suggests adding the following advice

(defadvice undo-tree-make-history-save-file-name
    (after undo-tree activate)
  (setq ad-return-value (concat ad-return-value ".gz")))

This works as expected, but defadvice is now obsolete, so I want rewrite this piece of code with advice-add. Here is what I've done

(defun undo-tree-advice-history-save-file-name (history-save-file-name)
    (concat history-save-file-name ".gz"))
(advice-add #'undo-tree :filter-return #'undo-tree-advice-history-save-file-name)

This doesn't produce any error or warning, but it has no effect: save files were not compressed into a .gz archive, but were left as plain text files instead. So I took this answer as reference and tried

(defun undo-tree-advice-history-save-file-name (old-function &rest arguments)
    (concat (apply old-function arguments) ".gz"))
(advice-add #'undo-tree :around #'undo-tree-advice-history-save-file-name)

Again, this advice is ignored. What am I doing wrong?


texts: Is there a builtin function to guess the MIME type of a file in Emacs Lisp? I would like to display the MIME type for files in Dired buffers.


texts:
When I try to evaluate a Quelpa expression that fetches a package from Github, it throws the following error

Debugger entered--Lisp error: (error "Command ’(env LC_ALL=C git clone https://github.com/ahobson/mac-classic-theme.el.git /Users/amaro/.emacs.d/quelpa/build/mac-classic-theme/)’ exited with non-zero status 128: Cloning into '/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme'...\nfatal: could not read Username for 'https://github.com': Device not configured\n")
  signal(error ("Command ’(env LC_ALL=C git clone https://github.com/ahobson/mac-classic-theme.el.git /Users/amaro/.emacs.d/quelpa/build/mac-classic-theme/)’ exited with non-zero status 128: Cloning into '/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme'...\nfatal: could not read Username for 'https://github.com': Device not configured\n"))
  error("Command '%s' exited with non-zero status %d: %s" ("env" "LC_ALL=C" "git" "clone" "https://github.com/ahobson/mac-classic-theme.el.git" "/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme/") 128 "Cloning into '/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme'...\nfatal: could not read Username for 'https://github.com': Device not configured\n")
  quelpa-build--run-process(nil "git" "clone" "https://github.com/ahobson/mac-classic-theme.el.git" "/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme/")
  quelpa-build--checkout-git(mac-classic-theme (:repo "ahobson/mac-classic-theme.el" :fetcher github :url "https://github.com/ahobson/mac-classic-theme.el.git") "/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme/")
  quelpa-build--checkout-github(mac-classic-theme (:repo "ahobson/mac-classic-theme.el" :fetcher github) "/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme/")
  quelpa-build-checkout(mac-classic-theme (:repo "ahobson/mac-classic-theme.el" :fetcher github) "/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme")
  quelpa-checkout((mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github) "/Users/amaro/.emacs.d/quelpa/build/mac-classic-theme")
  quelpa-build((mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github))
  quelpa-package-install((mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github))
  quelpa((mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github))
  eval((quelpa '(mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github)) nil)
  eval-expression((quelpa '(mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github)) nil nil 127)
  funcall-interactively(eval-expression (quelpa '(mac-classic-theme :repo "ahobson/mac-classic-theme.el" :fetcher github)) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Given fatal: could not read Username for 'https://github.com': Device not configured, it seems the issue relates to Github authentication issue but on the same machine ssh -T git@github.com successfully authenticates.

Should I configure something on the Emacs side to make it work with Github?


texts: Is there a configuration option in Magit that will force the "git status" window to always appear in a  vertical split?  I didn't see anything about that in the documentation, and Google was rather useless.


texts: Bug in downcase-region when using cua-set-rectangle-mark?

texts:
Is the following a bug or a feature?  If the former, how do I file?  If the latter, can someone explain the logic?

On the following content in my buffer (*scratch*), upon marking the inner rectangle consisting of "FG" and "JK" using C-return

ABCD
EFGH
IJKL
MNOP

Applying downcase-region yields the following unexpected result:

ABCD
Efgh
ijKL
MNOP

I would expect "fg" and "jk" to be downcased, and not "fgh" and "ij".


texts: Using straight.el to develop your own package which is also on github

texts:
I am considering using straight.el, but reading the docs, I have difficulties to understand whether the particular use cases I am interested in are handled as I hope to. Here are the cases:

I have some packages of my own which are hosted on github. Currently, I have a local git repository, and I git fetch it to a directory within the load-path. So I basically hope that by using straight.el, I could reduce it to one directory, the local git repository. But what happens when I edit a file in this repository? As far as I understand, straight.el will detect the modified file and rebuild the package. But that would mean that I cannot properly develop the package because it will always affect my current setup. So how do we get around that? Would I need, say, spin off a develop branch and tell straight.el to use the master branch? I do not understand how straight.el would handle the case that the current branch is not the branch which should be used for compiling and packaging.
The second use case is actually very similar: I clone a github repo and want to edit it, possible to create a PR. Again, my question is: How do I prevent that my edit destroys my current setup, or that it is destroyed when the repo is fetched again from upstream?

Maybe someone could help me to clarify this. If these use cases are not handled properly, I won't change to straight.el, I guess.


texts: how to use multiple emacs distributions?

texts:
I'd like to use multiple emacs distributions e.g. spacemacs, prelude, starter-kit and my personal config for demonstration purposes.

What would be some recommended ways to realize this?


texts: Get rid of evil's state info such as ` -- INSERT -- ` in the echo area

texts: How can I get rid of the state information of evil in the echo area? I've already displayed it in the status bar and there is no need to occupy the echo area.


texts:
The exported pdfs from M-x org-beamer-export-to-pdf and C-c C-e l o give different results. I have frames set to be created at level 1 headers (options: H1), but these headers only create frames when using M-x org-beamer-export-to-pdf. Using C-c C-e l o the level 1 headers are treated as sections. Setup below:

#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [presentation]
#+OPTIONS: H:1


texts:
When exporting and org file in emacs to either html or md for a jekyll-based web page, the yaml front matter gets twisted.

As suggested here, I have attempted enclosing it in an html block in the org file thus:

#+begin_html
---
layout: post
title:  "La redistritación"
---
#+end_html

It should output this:

---
layout: post
title:  "La redistritación"
---

Using org-html-publish-to-html, I instead get this:

&#x2014;
layout: post
title:  "La redistritación"
&#x2014;

I also attempted enclosing in a source block (as suggested here) thus:

#+begin_src yaml
---
layout: post
title:  "La redistritación"
---
#+end_src

which comes close, but prepends empty (code) spaces and is therefore not recognized as front matter by jekyll.

(And adding exports and results specs, as suggested here, returns a Wrong type argument: stringp, nil error message.)

How should I configure export settings to get proper yaml front matter?


texts: Macro with optional paramaters that checks for whether an optional paramater is defined?

texts:
Due to my lazy nature, I made something like this:

(defmacro iλ (x)
  `(lambda () (interactive) ,x))

(defmacro iλd (x y)
     `(lambda () ,x (interactive) ,y))

(global-set-key (kbd "<f8>") (iλ (message "hello lambdas")))
(global-set-key (kbd "<f7>") (iλd "Func Docu" (message "hello lambda with docus")))

Due to my lazy nature, I would like to merge these two but it's 10:16pm in the evening and I can't seem to figure it out. I would like something like this (Pseudo code follows):

 (defmacro iλ (x &optional y)   ;y is optional parameter:
  if x & y are defined:
  `(lambda () ,x (interactive) ,y))
  else if only x is defined:
  `(lambda () (interactive) ,y)
  )

Can this be done, if so how?

[edit solution]
As per Malabarba's answer below, I now use the clever bit of code:

(defmacro iλ (x &rest y)
    (if (and (stringp x) y)
        `(lambda () ,x (interactive) ,@y)
      `(lambda () (interactive) ,x ,@y)))
;Example usage:
(global-set-key (kbd "<f8>") (iλ "A message that prints a hello" (message "hello 2")))
(global-set-key (kbd "<f9>") (iλ  (message "hello 1")))


texts: Escape sequences like [<8;38;34m being inserted into my document when I middle click

texts:
I recently updated to emacs 25.1, and I'm noticing that sometimes escape sequences like [<8;38;34m or [<8;20;27m are being inserted into my document. I use emacs in the terminal (emacs -nw). I use iTerm2 on macOS.

I haven't yet figured out what I do when this happens (I have thus far only noticed it after it happened). If I do I'll post more here.

Can any shed some light on what might be causing this? I can't figure out what ANSI escape sequence this might be. I haven't found a great list of sequences, but none of the ones I've seen have anything close to this.


texts: Cannot find @Org Custom Layout in spacemacs

texts:
I have recently started using spacemacs. After sifting through their documentation I found that spacemacs ships with a custom layout for org-mode. However, I cannot seem to find the layout by following their documentation.

Can someone help me?


texts: SES does not initialize properly when opening existing spreadsheet files

texts:
When I attempt to open an existing SES (Simple Emacs Spreadsheet) file in GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601), the file comes up, but SES has not been properly initialized, even though the file extension is .ses, and there is an apparent (SES) mode-indicator in the emacs mode-line.  The header row doesn't show any column letters A, B, C, ..., and standard SES keys are not bound to their proper SES commands (e.g., M-k is bound to the default Emacs kill-sentence instead of the correct ses-delete-column, etc.).  The file incorrectly comes up in a full height (i.e., un-narrowed) buffer, but the SES command ses-renarrow-buffer is unavailable because its standard key C-c C-n is undefined.  In short, this version of SES can create spreadsheet files from scratch, but once the file is closed, SES will not properly re-open it.  Typing M-x ses-mode to a freshly opened existing SES file gives the error message "Invalid printer function".
Update -- Just before taking a suggestion of phils to try starting Emacs with the option -Q, I added three simple lines of code to my .emacs file which completely solved my immediate problem, but do not provide a basis for diagnosing the exact nature of the problem.  This new code loads a file defining a non-trivial printer function which is used to print most of the columns in my speadsheets, and adds that function to SES's list of "safe-functions".  Designating the function as "safe" avoids the need for a safety dialog that SES would otherwise insist on having at "find-file" time, in which the same question is asked for each column in my spreadsheets that use the function.  I strongly suspect that something about my impatient y/n responses to those questions led to the problem, but I haven't been able to reproduce the original problem in about 45 minutes of trying.  The mere occurrence of the dialog does not lead to the problem.  Given that the problem no longer stands in my way, I am unwilling to spend more time trying to find out exactly what triggered it in the first place, and why it was so persistent.