texts: Magit: Howto create a new commit ignoring white-space differences

texts:
I'm using magit 20191128.39 on Emacs 26.3
When changing a python script resulting in a new unstaged change, git/magit should ignore whitespace-differences. A git diff -w will do the trick, but I'd like to get the same result inside magit. Any hint here?


texts: Navigation ignores comment blocks in (La)TeX mode

texts:
I sometimes leave large blocks of comments in LaTeX source code:

Text text text text.

% Comments comments comments comments.
% Six lines of comments.
% More comments.

% Separate comment block.
% Eight lines of comments.
% More comments.

More text.

Navigating within these comment blocks can be difficult, because emacs
acts as though they were not there at all; C-up
(backward-paragraph) and C-down (forward-paragraph) skip
past any number of comments and blank lines, and the cursor ends up past
the next block of text lines.

I would like emacs to treat such comment blocks exactly as it treats
normal text, so that C-up and C-down will stop on blank lines between
comment lines and regular text, or between comment lines.

I looked at tex-mode.el. There's a macro named tex-search-noncomment
that seems related to this, but I'm not sure what to do about it. My
elisp-fu is very weak.

I'm using emacs 23.4.1.


texts: How should I configure irony-mode if my project has no "compilation flags"?

texts:
irony-mode is: an Emacs minor-mode that aims at improving the editing experience for the C, C++ and Objective-C languages. It works by using a combination of an Emacs package and a C++ program (irony-server) that uses libclang. (provides code completion with either company-mode or auto-complete)

So, For tiny projects that I might be working on, which are compiled with a simple g++ foo.c -o foo, how should I put the compile files to make irony-mode work?

And what about larger projects that uses CMake, SCons and others! How do I get those compilations flags for projects that make use of these piece of software to build themselves?

Sorry, but irony-mode assumes a lot of things and dismiss any in deep explanation about these things it mentions, and since I'm not a full time C++ developer, figuring out myself is quite hard.


texts: Spacemacs and org-mode configuration problem

texts:
I recently started using Spacemacs. With the default configuration, everithing works fine, but I would like to change a few configurations to org-mode, so i changed the dotspacemacs/user-config function to this:

(defun dotspacemacs/user-config ()
  (with-eval-after-load 'org
    (unless (boundp 'org-latex-classes)
      (setq org-latex-classes nil))
    (add-to-list 'org-latex-classes
                 '("koma-article"
                   "\\documentclass{scrartcl}"
                   ("\\section{%s}" . "\\section*{%s}")
                   ("\\subsection{%s}" . "\\subsection*{%s}")
                   ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
                   ("\\paragraph{%s}" . "\\paragraph*{%s}")
                   ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
    (org-babel-do-load-languages 'org-babel-load-languages
                                 '((dot . t)
                                   (maxima . t)
                                   (python . t)))
    (setq org-babel-python-command "python3")
    ;; Settings to export code with `minted' instead of `verbatim'.
    (setq org-export-latex-listings t)
    (setq org-latex-listings 'minted
          org-latex-packages-alist '(("" "minted"))
          org-latex-pdf-process
          '("pdflatex -shell-escape -intera")))
  )

After that, every time I try to export an org file to LaTeX I receive the following error:

user-error: Unknown LaTeX class ‘article’

What is happening? What did I do wrong? How do I fix it?
Thanks in advance.


texts: Clojure code evaluation in org-mode produces no output

texts:
I am trying to run clojure code from my org file in order to do some literate programming.

What is not working:

When I execute the source code block I get No output produced.

Sample src code block

#+begin_src clojure
(+ 2 2)
#+end_src clojure

What is working:

cider-jack-in is working and I am able to execute code in the nREPL
I am able to execute code from a .clj file

Thanks

Details

Emacs 25.1 using Spacemacs

Org-Mode 9.0.5

Org babel configuration

(defun dotspacemacs/user-config ()
  (require 'ob)
  (require 'ob-clojure)
  (require 'paredit)
  (require 'org-babel-clojure)
  (setq org-babel-clojure-backend 'cider)
  (require 'cider)
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((clojure . t)))
  )

Please let me know if you need any other information


texts: Retrieve property from org item programmatically

texts:
I am trying to track my diet using org-mode. The workflow so far looks like this:

Nutritional value data is stored in a file (Food_DB.org) where each food is represented by an org item with nutritional values as properties
The food I eat during a day is captured in the datetree of another file (Food.org). I use a capture template that allows to copy items from the Food_DB.org to the current day in the datetree of Food.org. After copying I set an additional property "WEIGHT" in this copy of the food item located in Food.org
This step is problematic: I would like to be able to see a summary of nutritional values for the day using column view. This is my approach to this:

(eval-when-compile (require 'dash-functional))

(defun org--nutri-product (val weight)
  (* (float val) (/ (float weight) 100.0)))

(defun org--nutri-get-weight ()
  (with-current-buffer "Food.org"
    (string-to-number (org-entry-get nil "WEIGHT"))))

(defun org--columns-summary-nutritional (values printf)
  (format (or printf "%s")
          (apply #'+ (mapcar (-cut org--nutri-product <> (org--nutri-get-weight))
                             (mapcar #'string-to-number values)))))

where org--columns-summary-nutritional is used as a org-column summary function.

Where this actually breaks is the function org--nutri-get-weight. What I intend to do there: Obtain the WEIGHT property from the item the org column view functionality is currently looking at, which is required to calculate the actual amounts of nutrients that have been consumed. I attempt to do this using org-entry-get since this is the only function from the org-property API that makes sense to me to do something like this. However, when I activate column view, it looks like this function gets called on some item but not one that actually has the WEIGHT property, which causes an error since nil is returned. I do not know whether I am using the function the wrong way since it can take a marker as an argument and I am not proficient in markers. On the other hand, the functionality I require here looks to me like something  the developers of Org-mode have very likely thought of and already implemented. (At least that is what I would do if I was skilled enough to hack the org-core)

The question in short: Am I using the functions the wrong way, is there another de facto org function to use for this or will I have to engage in a big regex-orgy?

Minimum working example for org--nutri-get-weight

If org--nutri-get-weight is evaluated while cursor is on one of those headings, it returns the WEIGHT value.

**** Erdnussbutter
 :PROPERTIES:
 :KCAL:     629
 :PROTEIN:  25.4
 :FETT:     50.8
 :KOHLENHYDRATE: 15.2
 :WEIGHT: 38
 :END:
**** Vollmilch
 :PROPERTIES:
 :KCAL:     65
 :FETT:     3.6
 :KOHLENHYDRATE: 4.8
 :PROTEIN:  3.3
 :WEIGHT: 309
 :END:


texts: Automatic periodic reload of all orgmode agenda files

texts:
I use about 15 orgmode agenda files, and a number of them I use passively only.  Examples are my wife's agenda converted from Google calendar, a work agenda from Outlook and a list of git commits (which gives you the idea that you actually did do something today).  All are periodically updated outside emacs, usually by a cron job.

My problem is that reloading my agenda view does not (always) seem to reload these files, and often the only way to find this out is to try and edit an entry, at which point emacs will indicate that the file was changed and can be reverted.  The file is then reloaded by emacs, and pressing 'r' in the agenda view gives the updated entries.

Is there a way to have emacs regularly (e.g. every hour) reload selected agenda files, so that the info in my agenda is uptodate?  Alternatively, doing such a reload when pressing 'r' would be fine too.


texts:
Here is a super-short org mode file ready to export to pdf C-c C-e l o. It is a sample file to demonstrate long tables and the issue I am facing with the auto generated index of tables by org-mode.

#+TITLE: Testing out =longtable=

# below gets rid of the red boxes drawn around the links
# `hyperref' package is already included in org-latex-default-packages-alist
#+LaTeX_HEADER: \hypersetup{
#+LaTeX_HEADER:     colorlinks,%
#+LaTeX_HEADER:     citecolor=black,%
#+LaTeX_HEADER:     filecolor=black,%
#+LaTeX_HEADER:     linkcolor=blue,%
#+LaTeX_HEADER:     urlcolor=blue
#+LaTeX_HEADER: }

#+TOC: tables

#+CAPTION: This is a long table
#+ATTR_LaTeX: :environment longtable
#+NAME: tab:longtable
|----------+----------|
| Header 1 | Header 2 |
|----------+----------|
|        1 | Item 1   |
|        2 | Item 2   |
|        3 | Item 3   |
|        4 | Item 4   |
|        5 | Item 5   |
|        6 | Item 6   |
|        7 | Item 7   |
|        8 | Item 8   |
|        9 | Item 9   |
|       10 | Item 10  |
|       11 | Item 11  |
|       12 | Item 12  |
|       13 | Item 13  |
|       14 | Item 14  |
|       15 | Item 15  |
|       16 | Item 16  |
|       17 | Item 17  |
|       18 | Item 18  |
|       19 | Item 19  |
|       20 | Item 20  |
|       21 | Item 21  |
|       22 | Item 22  |
|       23 | Item 23  |
|       24 | Item 24  |
|       25 | Item 25  |
|----------+----------|

Using latex specific attributes, I am specifying org-mode to use the longtable latex package for creating that table.

The table renders fine, but the issue is that for each page the long table spans, an extra entry is created in the TOC for tables. The below example is short, but if I have a table spanning 5 pages, 5 entries are created in the TOC with the same table title!

Below screenshots show the 2 pdf pages:

How can I make org-mode put only one TOC entry per table (and not per table per page)?


texts: Add a group of options in a Magit transient

texts:
I would like to add a group of options to a transient, but I cannot figure out the POS parameter I should use.

(transient-append-suffix 'magit-push "-n" ;; after the last option of the first group
  ["My group"
   '("-M" "My option" "--my-option")
    ])

does not work, it throws this error: "Cannot place ["My group"] into magit-push at -n; suffixes and groups cannot be siblings".

(transient-append-suffix 'magit-push '(0) ;; after the first group
  ["My group"
   '("-M" "My option" "--my-option")
    ])

does not throw any error, but when I try to open the push transient, I have this error: "No key for quote".

What is the correct way to add my custom group after the first group?


texts: sending the results of org-mode block execution to another buffer

texts:
I'd like to be emulate something similar to using a repl with clojure/cider using org-mode  where the results of the evaluation are not put in directly into the document but sent to the repl buffer.
Is there a way to be able to configure this?


texts: Whitespace mode write dots for space chars

texts:
I'm using org-indent-mode. As far as I understand, the whitespace on the left is an overlay.

When you use this mode in conjunction with whitespace-mode, then there appears whitespace indications (dots) in the org-mode overlay on the left.

2]

Does anyone know how to get rid of it? Specifically, how to get rid of the whitespace markings in the org-mode-indent's overlay?

You might ask yourself, white not remove the whitespace-mode? It's useful in marking the whitepaces in the buffer itself. Like... well I use it quite successfully, I just want to remove it from the damn overlay.

Thanks

P.S. All of this is in emacs vanilla, no other programs than the one's packages by GNU.

The version is: 24.5.1


texts: PSGML conflicts with built-in `sgml-mode`

texts:
I’ve installed psgml 1.4.0-9 and psgml-html-mode for DTD-aware editing of HTML.* But the built-in sgml-mode/html-mode seems to be causing some problems: some tags are highlighted in font-lock-function-name-face (as the built-in sgml-mode does), some in font-lock-type-face (as PSGML does), and they get recoloured depending on what I do (scrolling generally causes font-lock-type-face to take over, but the initial screen full of code is in font-lock-function-name-face). Most annoyingly, aiui PSGML is supposed to offer SGML-correct indenting taking account of omitted close tags, but afaict sgml-mode is taking control of indentation, meaning when I indent-region etc, what happens is not DTD-aware. I also have two SGML entries in my menu bar: the first (the one on the left) is from PSGML, the second from sgml-mode.
Given that sgml-mode.elc and sgml-mode.el.gz are inside my system Emacs installation (which I am reluctant to go hacking around inside by deleting or changing files), how can I completely disable all their behaviour and everything that they’re loading?
* Yes, I’m aware that HTML is not technically an SGML application any more, but the syntax is close enough, and no other HTML editing mode I’m aware of (including html-mode, html-helper-mode, and the HTML server for lsp-mode) is properly aware of implicit close tags in HTML — they think
hello
world creates two nested p elements, rather than two consecutive ones. PSGML gets it right.
Edit: My setup for PSGML etc, if it helps, is here. Everything else needed should also be in the same repo.


texts: How to have all sections unnumbered in org-mode with inheriting property?

texts:
I would want to have all sections unnumbered. Instead to add the property

* Section Name
  :PROPERTIES:
  :UNNUMBERED: t
  :END:

to each subtree (which works well). I thought to use inheriting property in the top of the file as specified in the documentation :

#+PROPERTY: UNNUMBERED t

but this approach doesn't work. What I am missing?


texts: How do i implement my own hooks in elisp?

texts: What code do i need to implement in order to create a hook which can be set by the user and which is called in my own function?


texts: insert word under cursor in projectile search

texts:
when typing in some projectile filter string for instance (eg SPC p f) in spacemacs, I often would like to reuse the word under the cursor.

I know about C-y to paste. Which is the one to insert the word under the cursor? I stumbled on C-w but it's not that. And why does C-w does by the way??

(btw if there is something more spacemacs-y I'm interested)


texts: How to stop emacs re-indenting while typing? (cc-mode)

texts:
Using C/C++ (cc-mode), emacs sometimes re-indents text as I'm typing.

For example (# for indentation, the first 4 are a tab):

enum {
####/

Typing *, becomes:

enum {
######/*

(inserting 2 extra spaces)

Is there a way to disable this?


texts: golden ratio splits too narrow when having a vertical split on a horizontal portion

texts:
When I have a split as such

+++++++++++
|         |
+++++++++++
|b   |c   |
|    |    |
+++++++++++

Focusing in the a column works as expected, but for this layout

+++++++++++++++++++
|         |       |
+++++++++++       |
|b      | |       |
|       | |       |
+++++++++++++++++++

focusing on b squishes the layout directly beside it, rather than evenly distributing between the one that takes up both rows.


texts: How can I split the neotree window in spacemacs/emacs

texts:
I want my neotree window not to extend all the way to the bottom as shown here.

How is that possible? If I try to split it I get an error saying the side window can't be split.


texts: `\setcounter` in latex block to typeset matrices with more than 10 columns

texts:
I typesetting a matrix with 12 columns in a latex block in org-mode and discovered I couldn't do it by default. Reading this question on the TeX stack exchange site made me think that I could just place \setcounter{MaxMatrixCols}{20} as the first command in the block. This didn't work. However, it does export correctly. Is there a way to place this option in my init.el so I don't have to remember this every time?

 #+BEGIN_LATEX
  \setcounter{MaxMatrixCols}{20}
  \begin{equation*}
  \mathbf{X} =
  \begin{pmatrix}
  1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 \\
  \end{pmatrix}
  \end{equation*}
  #+END_LATEX


texts: mu4e does not sync the "move to folder" action to the IMAP server

texts:
I am using spacemacs (I don't think it should matter though) mu/mu4e and mbsync

When I use "move to folder" followed by "execute mark", I expect the "movement of message from Inbox to Archive" to be reflected on the IMAP server. But it doesn't :(

The message is "moved" from mu4e interface (I think that means mbsync locally considers the message moved) but this is not reflected on the server.

If I use (setq mu4e-change-filenames-when-moving t) in my .spacemacs there is an appearance of the movement (i.e. Message appears in the Archive folder, but it is a copy. i.e. Message is still in the Inbox and the move created a copy into the Archive folder. I definitely don't want that. So I have commented the above config setting.

I am not even sure whether this is supported.

If yes, how do I fix this ? Pointer to documentation/URL should be OK too.

Thanks.

Edit: Additional info, part of my .mbsyncrc

# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
SyncState *

I am not using gmail. I'm using Zoho IMAP server, if it matters.


texts: Combine highlight-symbol-mode and hl-line-mode

texts:
I want to highlight the current symbol under the cursor as well as the current line, but with different background colors.

Combining highlight-symbol-mode and hl-line-mode only highlights the entire line with the hl-line-mode color.

I have hl-line+ installed and have tried reducing the hl-line-overlay-priority option but that does not seem to work. The entire line still get the same background color.

Are there any other modes or settings I can set to make this work?


texts: Can you split rx into multiple variables and concatenate the evaluation

texts:
I have a really useful regex for extracting DCOs:
(defvar my-dco-tag-re
  (rx (: bol (zero-or-more (in blank))                     ; fresh line
         (any "RSTA") (one-or-more (in alpha "-")) "-by: " ; tag
         (one-or-more (in alpha blank "-."))               ; name
         blank
         "<" (one-or-more (not (in ">"))) ">"))            ; email
  "Regexp to match DCO style tag.")

However I've just recently come up with another use case which doesn't want to start on the begining of the line. Is it possible to evaluate RX variables in RX? I thought I could do this:
(defvar my-bare-dco-tag-rx
  '((any "RSTA") (one-or-more (in alpha "-")) "-by: " ; tag
    (one-or-more (in alpha blank "-."))               ; name
    blank
    "<" (one-or-more (not (in ">"))) ">")             ; email
  "Regexp to match plain DCO tag")

(defvar my-dco-tag-re
  (rx (: bol (zero-or-more (in blank))  ; fresh line
         (eval my-bare-dco-tag-rx)))
  "Regexp to match DCO style tag.")

but it causes the evaluation to bug out. Any ideas?
Debugger entered--Lisp error: (error "Bad rx operator ‘(any \"RSTA\")’")
  error("Bad rx operator `%S'" (any "RSTA"))
  rx--translate-form(((any "RSTA") (one-or-more (in alpha "-")) "-by: " (one-or-more (in alpha blank "-.")) blank "<" (one-or-more (not (in ">"))) ">"))
  rx--translate(((any "RSTA") (one-or-more (in alpha "-")) "-by: " (one-or-more (in alpha blank "-.")) blank "<" (one-or-more (not (in ">"))) ">"))
  rx--translate-eval((my-bare-dco-tag-rx))
  rx--translate-form((eval my-bare-dco-tag-rx))
  rx--translate((eval my-bare-dco-tag-rx))
  mapcar(rx--translate (bol (zero-or-more (in blank)) (eval my-bare-dco-tag-rx)))


texts: C stackoverflow in my Prelude when edit .tex files

texts:
It occasionally happens to me that I get the notorious error message
Re-entering top level after C stack overflow

when I edit my .tex files.
I checked whether it occurs with emacs -q and it does not. It pops up only in my Prelude.
Now, my main problem is that I cannot debug it. This is what I've tried so far:

Try to decrease max-specpdl-size,  max-lisp-eval-depth, and various undo limits as here, but it does not help.
Tried to run gdb emacs. But the executable I have is not compiled with the debug symbols.

How do I even detect where this error comes from?

My workaround is that I open the file in emacs -q and paste the paragraph that caused my Prelude to crash. Then re-open the same file in Prelude and continue my work. This kinda suggests that the overflow happens in some checkers. To the best of my knowledge, the checkers run stuff as I type. It may be that some of them gets confused by some of my latex macros which eventually leads my whole Emacs to a stackoverflow.


texts: Replace element of alist using `equal` even if key does not exist

texts:
I have an alist whose keys are strings, and I need to set the value for one of its keys. If the key is not present, I need to add it. So for example,

(alist-set "a" "bb" '(("a" . "b") ("c" . "d"))) => '(("a" . "bb") ("c" . "d"))
(alist-set "a" "bb" '(("c" . "d"))) => '(("a" . "bb") ("c" . "d"))

Introducing duplicate entries is not acceptable. Mutating the original alist is allowed.

Here are some incorrect solutions:

Using alist-get:

 (setf (alist-get key alist) val)

This is incorrect because alist-get compares keys using eq, but string keys must be compared using equal. I could implement a new version of the setf accessor for alist-get that uses equal, but the original implementation in gv.el is 26 lines of code. That is a lot of boilerplate for this simple operation.
Using setcdr with assoc:

(setcdr (assoc key alist) val)
(setf (cdr (assoc key alist)) val)

This is incorrect because it fails when the key is not present in the alist to begin with.
Use the fact that earlier entries in an alist shadow later ones:

(push (cons key val) alist)

This is incorrect because it introduces a duplicate entry for key in the alist.

Here are some questions whose answers do not answer this question:

Looking for a simple way to update an alist without introducing degeneracies
How to replace an element of an alist?


texts:
In a .org file, I can align all my tags to the right with C-u C-c C-q.

I'd like more space before text runs into tags in a file.

Is there a variable for the location of the tags column in the org document?


texts:
A common git style rule says that commit messages should be at most 50 characters long and commit descriptions at most 72.
Can magit truncate the lines in the COMMIT_EDITMSG buffer in accordance with those rules? That is, truncate once the line exceeds 50 characters if it is the message line or 72 characters if it is the description line.


texts: How to show git repo status info in mode-line

texts:
Here is my current custom, but I don't know how to customize its face. And it
only shows branch name, no other status info.

(setq-default
 mode-line-format
 (quote
  ((:eval
    (if vc-mode
        (progn
          (list
           (propertize " ⭠"
                       'face '(:foreground "sky blue"))
           ;; TODO: propertize this. set face height to 75
           `(vc-mode vc-mode)
           ))))
   )))

I hope someone can give out a better solution.
Or at least tell me how to custom my upper status (vc-mode vc-mode) face.


texts: Should magit revert a buffer after I discard a change from it when magit-auto-revert-mode is t?

texts: With magit 1.4.1, I have magit-auto-revert-mode set to t. When I visit a file in a buffer, make a change and save, then call magit-status and run magit-discard-item on the modified file, then switch back to the buffer, I would expect not to see the change, ie, I'd expect the buffer to have been reverted since I discarded the change. But that's not the case. I still see the change. Is this the expected behavior or a bug?


texts: How to font-lock only strings and comments (syntactic font-locking)?

texts:
I generally want font-locking only for comments and strings.  This would seem easy to do: customize the relevant font lock faces to make them identical to default.  That unfortunately is not satisfactory, because many other places which actually benefit from some highlighting (dired, org, probably magit) reuse the font lock faces.
The next best solution seems to be adding some buffer-local face remaps in prog-mode buffers.  I've been using this for some time, and it mostly works fine.
One problem with this approach is that the font lock colors "leak" into other buffers that copy the original buffer's content (since my face remaps are buffer local).  This is particularly bad for Swiper, consult-lines and the like, since the superposition of match highlights with the font locking becomes quite disconcerting (to me at least).
Is there a (simple, major-mode indepedent) way to tell font-lock-mode to actually not add any face properties except for those I want?


texts: How can I create a frame and open two files split vertically in it?

texts:
I am trying to write an Elisp function that will create a new frame and in that new frame open two files split vertically.
I have been unable to find anything about this in the Elisp manual, node Creating Frames
How can I do this?


texts: Help with my double tap key-binding function

texts:
I'm writing a function to enable binding a "double tap" on a key (or one key then another key in rapid succession) to a function.

It almost works, but not quite. Here is the code I have in my lisp evaluation test chamber:

(setq doubletap-secondtap nil)

(defun doubletap (doubletap-key1 doubletap-key2 doubletap-wait doubletap-function)
  (let* ((doubletap-secondtap 't)
         (doubletap-event (read-event nil nil doubletap-wait)))
           (if doubletap-event
             (if (equal doubletap-event doubletap-key2)
                 (funcall doubletap-function)
                 (setq unread-command-events
                   (append (list doubletap-key1 doubletap-event) unread-command-events)) )
           (setq unread-command-events
             (append (list doubletap-key1) unread-command-events)) )))

(defun doubletap-j-j-godmodeall () (interactive)
       (if doubletap-secondtap
         (funcall 'self-insert-command 1)
         (doubletap 106 106 0.3 'god-mode-all)))

(funcall 'doubletap-j-j-godmodeall)

(global-set-key (kbd "j") 'doubletap-j-j-godmodeall)

(global-set-key (kbd "j") 'self-insert-command)

The first function is intended to do the following:

wait doubletap-wait seconds for input

then

if input is not given, simulate a keypress of doubletap-key1
if input is given and it is not doubletap-key2, simulate two keypresses, first doubletap-key1 then doubletap-key2
if input is given and it is doubletap-key2, call doubletap-function

Because we use plan to bind doubletap-key1 to call the interactive function doubletap-j-j-godmodeall, we make a flag doubletap-secondtap to tell doubletap-j-j-godmodeall whether we are already inside the first function. If the flag is nil, it will call doubletap, but if it has a value, it will perform the default action self-insert-command.

doubletap-j-j-godmodeall works perfectly when it isn't bound to anything, as can be seen by evaluating the first three expressions and then evaluating the fourth expression, which is designed to activate god-mode for all buffers when two "j"s are pressed within 0.3 seconds, but otherwise behave like a normal function.

(this will only work if you have god-mode installed; if you don't, try a different function)

Unfortunately, when we evaluate the fifth expression, we find that its behavior becomes bizarre and unexpected. It hangs indefinitely until you either cancel it with "C-g" or press "j". If you press "j," it will toggle god-mode (even if you do it well after 0.3 seconds have passed).

Evaluate the last expression to restore normal behavior.

Can anyone explain this behavior, and more importantly, does anyone know how to make the function work correctly?


texts:
See https://lists.gnu.org/archive/html/emacs-devel/2015-12/msg01046.html for more background.

YAML defines a comment as a # either preceded by the beginning of the line or whitespace (more specifically, TAB or SPC).  This means that foo#bar is a normal token, not foo with a #bar comment.  You can get most of the way there with the traditional syntax rules:

(modify-syntax-entry ?# "<")
(modify-syntax-entry ?\n ">")

Unfortunately this will highlight foo#bar incorrectly.  I've been pointed to syntax-propertize-function which allows for more powerful syntax rules, but behaves weirdly.  Depending on the specific code I write, either insertion of new characters or deletion invalidates the existing fontification.

Example 1 (marking # preceded by non-whitespace as _):

(modify-syntax-entry ?# "<")
(modify-syntax-entry ?\n ">")

;; invalidated by deletion
(syntax-propertize-rules
  ("[^ \t]#" (0 "_")))

Example 2 (marking # preceded by whitespace as <):

(modify-syntax-entry ?\n ">")

;; invalidated by insertion
(syntax-propertize-rules
  ("^#" (0 "<")))
  ("[ \t]#" (0 "<")))

If I rewrite either of these in terms of a function scanning for appliable parts and edebug it, edebug does not take me through the function for the invalidating case.  Any idea why?

Bonus - Syntax propertize functions:

Example 1:

(defun yaml-mode-syntax-propertize-function (beg end)
  (save-excursion
    (goto-char beg)
    (while (search-forward "#" end t)
      (save-excursion
        (forward-char -2) ;; move to char preceding #
        (when (looking-at "[^ \t]")
          (forward-char 1) ;; move to # again
          (put-text-property (point) (1+ (point))
                             'syntax-table (string-to-syntax "_"))))))

Example 2:

(defun yaml-mode-syntax-propertize-function (beg end)
  (save-excursion
    (goto-char beg)
    (while (search-forward "#" end t)
      (save-excursion
        (forward-char -1)
        (if (bolp)
            (put-text-property (point) (1+ (point))
                               'syntax-table (string-to-syntax "<"))
          (forward-char -1)
          (when (looking-at "[ \t]")
            (forward-char 1)
            (put-text-property (point) (1+ (point))
                               'syntax-table (string-to-syntax "<"))))))))

Test file:

keyword: token#token
#comment comment
token #comment


texts:
I'm trying to write a little compilation monitor frame that gets compilation updates written to it without the overhead of seeing absolutely everything going on in the compile. I've been working with frames a little bit, and it's mostly a huge pain.

I'd like to figure out if the frame that I'm creating exists yet. I've come up with two ways to do that:

1) Loop through all the frames in (frame-list) and do a string match on the title.

2) This doofy bit of code:

  (if (not (select-frame-by-name "COMPILATION MONITOR"))
  (selected-frame)
(print "ERROR" (get-buffer "*monitor*"))))

select-frame-by-name returns an error if it can't find a frame, which isn't actually a value, as near as I can tell. It just quietly exits. But if it DOES find the frame that I want, it returns nil, and focuses the frame. (Then I can return the frame if I need it using 'selected-frame'. Ignore the error reporting to my buffer--that's not terribly relevant here.)

Is there some better way? With buffers, I can use get-buffer-create to create something new if it doesn't exist and use it if it does. Am I missing something in frame creation? Maybe what I need to know is how the error handling code works, so I can catch the error that select-frame-by-name throws when it can't find what I want?


texts:
I am using mew for my e-mail.  I need to use TLS with my email provider for SMTP.  However, when I try to invoke that, Emacs freezes.

I would like to take this opportunity to learn more about Emacs packages.  How would I go about debugging this issue?  Is there some kind of built-in debugger, like in Common Lisp?  Could I use logging?


texts: Hide leading stars in helm-org-in-buffer-headings

texts:
Currently, when I run helm-org-in-buffer-headings in see something like this:

* main topic 1
** Subtopic 1.1
** Subtopic 1.2
*** Sub-subtopic 1.2.1
* main topic 2

I would like to hide the leading stars and remove the indentation, so that instead, what you see is this:

main topic 1
Subtopic 1.1
Subtopic 1.2
Sub-subtopic 1.2.1
main topic 2

Any ideas?


texts: Tramp hangs in "Waiting for prompts from remote shell"

texts:
new emacs user here.

I'm trying to get tramp to work but can't figure out what's wrong. I do:

M-x councel-tramp
select /ssh:myserver

But I just get "Waiting for prompts from remote shell" and it hangs for ever.
I saw this related post on stackexchange:
 Tramp: Waiting for prompts from remote shell

Which suggests adding

     case "$TERM" in
        "dumb")
            export PS1="> "
            ;;
        xterm*|rxvt*|eterm*|screen*)
            tty -s && export PS1="some crazy prompt stuff"
            ;;
    esac

to the .zshrc or .bashrc, but that doesn't make a difference for me.
Can someone help me fix this? Any idea what's wrong?

Thanks!


texts: Trigger action when countdown timer is consumed

texts:
I would like to start the countdown function, (org-timer-set-timer) (C-c C-x ;), and trigger an action once the timer is over.
Any hints on how this could be achieved?
Shall I just use the run-at-time function instead? (This wouldn't show the countdown timer in the mode bar, but I guess I could survive).


texts: Unable to find projectile in the package list

texts:
I have added these lines to a file ~/.emacs.d/package_init.el

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

Then I both restarting aquamacs and runing m-x package-initialize, but I fail to find projectile in the listing. Here is a partial screenshot of the result of m-x package-list-packages

I have confirmed that this package exists on MELPA http://stable.melpa.org/#/projectile

What have I done wrong? How can I install this package?


texts: How to cancel or reverse the remapped keybinding?

texts: In my environment, the find-file is remapped to ido-find-file. How could I cancel the remap and just get the non-Ido version?


texts: How to include the output of a shell command in org-mode source code block?

texts:
For example, I got a demo to show a command and its output, and I want to insert them into an .org file like a source code snippet of C or something. I then want to be able to export the file to an HTML file, and have the block highlighted just like examples are in many books.

For example, I have

#+BEGIN_SRC shell
$ ls
dir1
dir2
file1
file2
...
or any other examples like this
...
#+END_SRC

but it cannot be converted to HTML: An error message that reads

  shell-mode: Wrong type argument: processp, nil

shows up all the time. What mode should I use to replace shell, and if I should not use the #+BEGIN_SRC...#+END_SRC format, what should I use instead?


texts: How can I save the text-scale info when `desktop-save-in-desktop-dir`?

texts:
By default, even if I text-scale-decrease in some frames before I desktop-save-in-desktop-dir, when I restart Emacs and desktop-read, all frames show in the default text-scale.

How can I save the text-scale info for each frame every time I evoke desktop-save-in-desktop-dir command?


texts: When rebinding command with [remap ...] which key is bound?

texts: If command command is bound to 2 keys kb1 and kb2, and if I remap like this (define-key somemap [remap command] #'some-other-command), which of kb1 and kb2 is now bound to some-other-command in somemap?


texts: orgmode table time string delta with formula

texts:
I wish to calculate time string delta as below:

| date       | delta |
|------------+-------|
| 2018/12/28 |     0 |
| 2018/12/31 |    -1 |
#+TBLFM: $2=if(2==@#, 0, ($1 - @-1$1); %.0f

The expected answer should be 3 but now it's -1. I do not wish to change the time string format in table.

How can I modify the formula to covert timestring to datetime correctly?


texts: How to modify fringes only for magit mode?

texts:
I have tried:

(defun my-change-fringes ()
  (set-window-fringes (selected-window) 20 0))

(add-hook 'magit-mode-hook 'my-change-fringes))

The problem seems to be that when I open a magit buffer for the first time, the selected window is for some reason the previous window.


texts:
I have a regular expression that can match several lines of text, and I want to use it to search every file in a directory. The problem is that standard regrep command works line by line, so this multiline regular expression won't work.

Is there any alternative Lisp function/command that can do what I want?


texts:
Disclaimer: Pretty new to Emacs and running Spacemacs, have no idea what I'm doing with elisp.

We run all our projects under vagrant, so I'm interested in getting some things, such as inf-ruby-mode consoles, to ssh into my vagrant box before running their commands. In particular, I'm currently looking at the run-ruby function right now.

I decided that aliasing bundle to run under the ssh box would do this, so I made myself an eshell alias, but that doesn't seem to get loaded in comint-mode, which I'm fairly certain is how such commands are run.

Another approach might be to have a comint hook which first SSH's into the box before running another command.

Is this possible? Any other suggestions?

Thanks!

I added the docker tag to this because the workflow can be quite similar, and there's no existing vagrant tag.


texts:
I've tried this:

(setq pkg-list '(rust-mode lsp-mode))

(dolist (pkg pkg-list)
  (when (package-installed-p pkg)
    (package-delete pkg)))

But it doesn't work.


texts: Is it possible to remove matches manually in grep mode?

texts:
After running (grep) the grep buffer appears with matches. Some of the matches are not relevant, and it would be good to remove them manually. This way I can use the grep buffer to hold only those matches which are relevant to the current investigation.

Is this possible?


texts:
I use fcitx-mozc for typing Japanese and I would like to use it in emacs over the inbuilt as it is more powerful.

I tried using mozc-mode (mozc.el) but that says there's "communication error with the helper process". I tried using fcitx.el and

(fcitx-aggressive-setup)
(setq fcitx-use-dbus t)

to my .emacs file and ran fcitx-aggressive-setup but neither work.


texts: How to query the name of the current branch in an elisp function?

texts:
I'd like to know the current branch I'm in (in elisp), is there a generic function that returns the name of the current branch?
From looking into vc-mode mode-line logic it seems this relies on private functionality.
Is there a generic way to access the current branch in Emacs? (Using git but via vc this might work for other version control systems too).


texts: Switch syntax highlighting of open buffer from web-mode (freemarker) to sql

texts:
we use web-mode (freemarker engine) to edit source files that contain freemarker directives and a lot of SQL.

Editing in web-mode (freemarker engine) works fine.

It would be very helpful if we could switch syntax highlighting from web-mode (freemarker) to SQL for open buffers.
Is that possible?

Thanks for any suggestions.

Meikel


texts: Modifying Sparse Trees and Exporting in Org Mode

texts:
I want to use org-mode's sparse trees to export some of the headings in a document. Specifically, I want headlines and entries for all matches of a tag search, plus parents. org-show-context-detail controls this, but doesn't have quite the right setting. local is closest, but local also includes the next heading at the same level of match; I do not want next heading.

* Heading
  :PROPERTIES:
  :EXPORT: yes
  :END:

  * Subheading
    :PROPERTIES:
    :EXPORT: yes
    :END:

    I am some content! I should be exported and visible!

  * Definitely Don't Want This Subheading
    :PROPERTIES:
    :EXPORT: NO
    :END

So how do I make and export a sparse tree using an EXPORT=yes tag search, containing Heading, Subheading, and the entry of Subheading, without including the next heading? (Note: I do know about C-v in the org export dispatcher -- but it will still include a visible-but-folded headline, like Definitely Don't Want This Subheading.)


texts: Add fuzzy completion to custom helm source

texts:
I am experimenting with custom helm sources, but I cannot figure out how to get fuzzy completion to work with it. Here is an example:

(defun my-helm-test()
  (interactive)
  (let ((some-helm-source
         '((name . "my helm test")
           (candidates . ("abc xyz" "age hgi" "afg ggg" "ahh iii"))
           (fuzzy-match . t)
           (action . (lambda (candidate)
                    (message-box "%s" candidate))))))
         (helm :sources some-helm-source)))

When I type a followed by SPACE followed by x in the helm window, I was hoping to be able to select the "abc xyz" candidate. Instead, once I type SPACE no candidates are left.


texts:
Suppose I'm at point Grandchild below:

* Parent                                                           :@Project:
** Child
**** Grandchild

How can I construct an elisp function that goes up the hierarchy until it finds the first org header that directly has the @Project tag, and returns its name (i.e., in this case "Parent")?


texts: converting emacs calc eqn to latex in org table

texts:
Is it possible to convert column 2 to latex in org-table using a command?
It seems that the technology already exists with calc-embed but I don't know how to use it here.

  | G | 7*(-2:5)+5*(4:7)                | \frac{2}{35}  |
  | H | 1:3 + 1:6 + 5:12                | \frac{11}{12} |
  #+TBLFM: $3='(calc-eval $2)

Desired input

   | G | 7* \frac{-2}{5} + 5 * \frac{4}{7}      | \frac{2}{35}  |
   | H | \frac{1}{3}+ \frac{1}{6}+ \frac{5}{12} | \frac{11}{12} |
  #+TBLFM: $3='(calc-eval $2)

Update
I forgot to mention just in case someone missed it, calc-embedded need to be activated, calc-embedded-activate


texts:
I'm trying to achieve the automatic authentication of my registered nickname on Freenode, so that I can join the #emacs IRC channel.

Since I upload my Emacs config to a public repository, I've opted to grab the personal data of my nickname and password from a file on my local machine.

Below is the code I've come up with trying to achieve this. And I don't know why it's not working.

It seems like a trivial task to accomplish, but I'm at a loss; not knowing if it's a problem with the syntax, semantics, and/or the way the package handles my nickname/password.

(defun jd:get-string-from-file (filePath beg end)
  (with-temp-buffer
    (insert-file-contents filePath nil beg end)
    (buffer-string)))

(defvar jd:irc-nickname (jd:get-string-from-file "~/.authinfo" 0 15))
(defvar jd:irc-password (jd:get-string-from-file "~/.authinfo" 16 26))

;;;;;;;;;;;;;;
;;; `rcirc.el'
(setq rcirc-default-nick jd:irc-nickname)
(setq rcirc-authinfo '(("freenode" nickserv jd:irc-nickname jd:irc-password)))
(setq rcirc-server-alist '(("irc.freenode.net" :port 6667 :channels ("#emacs"))))


texts: Org-column face settings not coming through in org-mode column view

texts:
I'm trying to use a fixed width font when in org-mode's column view (I use variable width font otherwise). Customizing the org-column face attribute doesn't seem to do it. How can I get this to work?

There's some related discussion out there (referenced in Org-mode FAQs), but it doesn't seem to help my situation. I'm thinking this excerpt from the documentation is the key, but I'm not sure how.

  Face: org-column (sample) (customize this face)

  Documentation:
  Face for column display of entry properties.
  This is actually only part of the face definition for the text in column view.
  The following faces apply, with this priority.

  The color of the reference face.  This is normally the level fact that
  is used in the outline.  In agenda-mode, it will be the face of the
  first character in the line.  The color is explicitly retained to
  make sure that the column line still looks a bit like the structure
  line it is masking.
  The `org-column' face.
  The remaining properties of the reference face.

  Since column view works by putting overlays with a display property
  over individual characters in the buffer, the face of the underlining
  character (this might for example be the a TODO keyword) might still
  shine through in some properties.  So when your column view looks
  funny, with "random" colors, weight, strike-through, try to explicitly
  set the properties in the `org-column' face.  For example, set
  :underline to nil, or the :slant to `normal'.

  Under XEmacs, the rules are simpler, because the XEmacs version of
  column view defines special faces for each outline level.  See the file
  `org-colview-xemacs.el' in Org's contrib/ directory for details.

  Defined in `org-faces.el'.

           Family: Lucida Console
          Foundry: unspecified
            Width: unspecified
           Height: 120
           Weight: normal
            Slant: normal
       Foreground: unspecified
DistantForeground: unspecified
       Background: grey90
        Underline: nil
         Overline: unspecified
   Strike-through: nil
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
          Inherit: unspecified

If it helps, I'm running Emacs 24.5 windows version on Mac OS X.

EDIT
When I call the function that has the default keybinding C-u C-x = (I don't know the function's name) with my point in the org-column view region I get the following (excerpt):

  There is an overlay here:

  From 24 to 25

  display              [Show]
   face                 ((:foreground unspecified) (:height 120 :family >"Helvetica") org-agenda-column-dateline org-agenda-date-today)
   keymap               [Show]
   line-prefix          ""
   org-columns-format   "%-70.70s | "
   org-columns-key      "ITEM"
   org-columns-pom      nil
   org-columns-value    "Saturday    6 June 2015"
   org-columns-value-modified "Saturday    6 June 2015"
   wrap-prefix          ""

Where does emacs invoke this overlay? It looks like it's calling the Helvetica font family in the face--this is precisely what I'm trying to prevent. I believe this is what is overruling the Lucida Console family that I defined for the org-column face (above).


texts: Retrieve past command from Emacs history using first letter of command

texts:
In Vim I could retrieve past commands by typing :<first-letter-of-command>↑ . If my Vim command history is:-

colorscheme +
source %
shell
set spell
colorscheme?
bp
term

Typing :s↑ directly shows me the command set spell.

How can I achieve this in Emacs? I already have the line (savehist-mode 1) in my init.el but pressing M-x <first-letter-of-command>↑ does not work. I am using Emacs 25.3.1 on Windows 10.

Edit: My question is not a duplicate of this suggested question. My question is about accessing past commands based on the first letter of the command. For instance, pressing M - x b followed by the up arrow should take me to the most recent command beginning with the letter 'b'. The suggested question is about going through the command history one-by-one without using the arrow keys.


texts: What's the difference between the different vim implementations?

texts:
I'm aware of several different vim implementations in Emacs. There's evil-mode, viper, vimpulse and vim-mode. Are there others? How do they compare?

I note that there are a lot of evil-* packages on MELPA, suggesting none of them are 100% feature-complete. What vim features do they provide, and what vim features are missing?

(I'm not interested in the reverse where "a set of vi macros that [are] a fairly full Emacs implementation"!)


texts: xterm-mouse-mode use mouse on clickable texts

texts:
I am using emacs with PuTTY. I have xterm-mouse-mode turned on, and it works nicely, except that nothing happens when I click on "clickable texts" for example on the start page, or in neotree.

Is there a way to use mouse clicks for these?


texts: Impossible to answer y-or-n-p prompt in EXWM if X window is focussed

texts:
When a y-or-n-p question (e.g. The file you want to open is very large. Really want to open it?) pops up in the minibuffer while an EXWM buffer is focussed, I have no option to answer the question (using y or n).

In that situation, ALL inputs are forwarded to the buffer's X window, including key bindings I use for EXWM (for example s-q to close the current window/buffer or s-w to change the active window).

In order to rescue the situation, I have to close the active window (if it's got a menu to do so, as I can't use my exwm hotkeys), which allows me to answer the question (in case the subsequently focussed window is an Emacs (text) buffer).

I have no clue how/why inputs are handled in a different way during this (y-or-n-p) question (probably because it's blocking the Emacs event queue which is required for handling X commands?).

How can I debug/fix this issue?


texts: Not work "subscr": Symbol’s function definition is void:

texts:
Emacs 26.1, I try to use function subscr

Example:

subscr({a,b,c,d,e,f,h},{1,2,3})

But I get error:

eval: Symbol’s function definition is void: {a


texts: How to set the keybinding for "Select All" to Ctrl-A?

texts:
I would normally be able to do this myself by merely adding:

(global-set-key (kbd "C-a") 'select-all)

to my ~/.emacs file but select-all isn't the command for the "Select All" option in the Edit menu (which selects all text in the current buffer). I have tried searching for "select" in the list of commands via pressing Ctrl-h-a and typing "select", but that did not return any result with "Select all" in its description. Any ideas? If it at all relevant I am using the experimental 25.1.90 release (the one tagged in the emacs-mirror/emacs GitHub repository) of GNU Emacs.


texts: How to create named functions for dynamic key bindings?

texts:
I am creating a keymap based on a configuration file.
The resulting keys all call the same function but with different arguments.
Here is the code I am using for a single key:

(defun add-do-my-stuff-keybinding (config-pair)
  "Add config to do-my-stuff-map"
 (define-key do-my-stuff-map (kbd (config-get-key config-pair))
   `(lambda ()
      (interactive)
      (do-stuff ,(config-get-name config-pair)))))

My question is, is there a way to avoid the lambda so that the inspection of the keybindings does not show a lambda but a helpful function name?

Something like generating defuns oder named lambdas?


texts: Modifying the indentation of some Emacs Lisp forms

texts:
I would like some Emacs Lisp forms to be indented like Common Lisp.  For instance, in Emacs Lisp, if is indented like this:

(if COND
    THEN
  ELSE)

whilst I would prefer it like this:

(if COND
    THEN
    ELSE)

I could do this:

(setq lisp-indent-function #'common-lisp-indent-function)

But this impacts all forms, thus breaking the indentation of Emacs Lisp macros, like cl-letf and any user-defined macro.


texts: Emacs is asking me for a coding system on each save

texts:
I consolidated many text files (win, mac, unix) into a single orgmode file. For some characters I was seeing numbers instead of the right characters. Things like \314\203.

I used "revert-buffer-with-coding-sytem" and choose utf-8-hfs-unix.
That fixes it.

But now every time I save, Emacs asks me to choose a coding system. If I choose raw-text it stops asking but when I open the file again the numbers are back.

How do I fix this?


texts: In spacemacs org-mode, is there a way to select a region, and surround it with #+begin_quote and #+end_quote?

texts:
I'm tired of typing #+begin_quote and the other one manually (couldn't type it, too tired). Is there a way to surround a region with this? I can't help but feel like there must already be a function for it that I just have to bind to some keystroke.

I'm a new emacs (spacemacs) user, using the vim keybindings, if that makes any difference.


texts: Automatically update default-directory when PWD changes in shell-mode and term-mode

texts:
Are there any options or packages which cause default-directory to be updated if the working directory changes in shell-mode and term-mode? I.e. when using cd, but the solution would have to be more robust than just look for this particular command and maybe a few others - it should actually check the value of $PWD after every command, I would think.

More importantly though it should also work when connecting to a remote machine from inside a shell-mode or term-mode buffer which was first created with default-directory being a local directory. That's actually the feature I really need: being able to tell programmatically whether the commands I type into such terminals are run on a remote machine. I would like to get that information in form of a properly set default-directory and figure if there is a way to get that, then the tool doing this would also work locally as described above.


texts:
How to move to previous or next buffer in a fixed & arbitrary order? I am using C-<left> and C-<right> but they move in a variable order, depending on the last viewed buffer, but if I want to switch back and forth between the two last files I worked in, with C-x b RET, then C-<left> and C-<right> would be always setting the two last viewed files in the ring, making it pointless.

When moving with next/previous, the idea is to have different alternatives: a manually sorted ring, last viewed ring, and other sorts (alphabetical, size, etc.). This by preserving or integrating the option of moving back and forth between the two last viewed the way C-x b RET does.

Individually sorting buffers is maybe too much, but is kind of important, since the typical tab system of ordinary editors allow for manually sorting the tabs.

Hopefully the sorting work for picking the buffers with ido-mode too.

Need to install a library or not necessary?


texts: How to generate directory structure out of org-mode outline?

texts:
I want to create the directory tree structure like this out of org-mode outlines.

  Dir1

    Dir-1.1

    Dir -1.1.1

    Dir-1.2

    Dir 2

    Dir-2.1
    Dir-2.2

I am new to emacs and I have tried a few shell commands from here like

  xargs -d '\n' mkdir -p -- < test.txt

For that to work I need a file with the following structure.

# Test.txt
A1/A2/A3
B1/B2/B3
C1/C2/C3

TLDR: Generate Directory structure out of org outlines.


texts: Link string to url and make it clickable

texts:
In my LaTeX code I have strings like:
\arXivid{1602.00735}

that create, in the generated PDF file, a link to, e.g. https://arxiv.org/abs/1602.00735.
I'd like to have the string \arXivid{1602.00735} clickable, like urls in goto-address-mode, opening the relative url in the browser.
How can I do it? Do I need to use a text-property?
I don't really need to fontify the string like goto-address-mode does.


texts: in org-mode, how to view TODO items for current buffer only?

texts: In org-mode, I like to run org-todo-list, which displays the global todo list including all my org-agenda files. How do I view a TODO list for only the current buffer, ignoring my other org-agenda files?


texts: Bookmark Plus: Correct bookmark file after directory/file rename

texts:
I had a couple of bookmarks for a given file, then I decided to rename the directory of the file. Now list-bookmarks ( I am using the bookmark+ package) shows all the bookmarks for the given file in yellow (indicating that they are no longer valid).

How can I easily repair the bookmark file?


texts: How check that text in quotes are lowercase text

texts:
example1:

test "one" hi
this is test "two" check
I need to "three" this

example2:

test "one" hi
this is test "Two" check
I need to "three" this

Is it possible to check that text (some function) in quotes (one, two, three) are lowercase text ?
In example1 this function return true , but in example2 this function return false;


texts: How call a function, when the user confirms the question?

texts:
I'm trying to write some Emacs Lisp. But I stumble on one thing.
The code is structured as following:

(defun foo ()
    (interactive)
    (if (yes-or-no-p "Do you want to call the function bar?")
        (progn
            'bar
            ))
            )

(defun bar (string)
  (interactive "sType your input here? ")
  (message string))

Okay, when the user confirms the question, the function bar will be called. But nothing happens when I press y.

When reading the Elisp cookbooks and tutorials, they all says that yes-or-no-p functions returns a true when the user confirmed it.
And the if is structured as following:

COND THEN ELSE

So the second argument should be calling since yes-or-no-p evaluates to true. Since this seems not the case, I'm missing something?


texts: emacs --daemon crashes when parent ssh session dies

texts:
I'm using emacs 26.1 (although I don't think this is a new issue with this verison).

Note - this is not the GTK bug which results in the daemon crashing if X Connectivity is lost.  I am aware of that bug and the workaround (specify lucid, motif or no toolkit at compile time rather than GTK).

The GTK issue happens every time you close down an emacsclient session - either gracefully or because of connectivity loss.

My issue is that the daemon will still crash when you exit the ssh session from which the emacsclient session started.  Which somewhat defeats the object of having a daemon.

So you can start ssh -X me@foo.bar (or however you connect), you can then use emacsclient -c -n, and kill and recreate emacsclient sessions as many times as you like (this would die on GTK).

But as soon as you kill the parent ssh session, the logout process typically freezes, and when you kill it with ^C or similar the daemon crashes.

At first I thought this was an issue with either the terminal emulator (mintty) or the X Server I was using (ming, or cygwin's own).  However I have now observed this behaviour on native Kubuntu 17.10, so it's nothing to do with Windows.

The issue is annoyingly sporadic - it doesn't happen every time I exit ssh - but it's fairly common.

I can find reference to what I think is the same issue here, in rson's comment.  The answer given doesn't help - there should be no need to run --daemon inside a tmux session.  If you execute standard emacs inside a tmux and use M-x server-start, just to labour the point, then emacs hangs after disconnecting any ssh session where an X emacsclient has been started from.

Finally note that this is specifically an X-Window issue.  If I start a daemon, and connect to it using emacsclient -nw switch I can connect and disconnect the parent ssh session as many times as I want in terminal mode.

This is basically forcing me to remain in terminal mode for all my work, as having a reliable daemon is more important than the nice stuff I miss from having a proper windowing system.  I'm hoping someone else has seen this or can offer any advice on diagnosing further - it's driving me crazy :-)


texts: Change location of latex options (\bibliography{}) in exported .tex file

texts:
I just spend hours trying to figure out why bibtex citations don't work. Turns out it's because \bibliography{testbib} needs to come after begin{document}.

This is my test.org:

#+LATEX_HEADER: \usepackage{natbib}
#+LATEX_HEADER: \bibliographystyle{plainnat}

* Test
This is a test. \citep{Nobody06}

#+LATEX_HEADER: \bibliography{testbib}

This is the generated test.tex (only the relevant parts):

% Created 2018-11-01 Thu 13:28
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
[ ... ]
\usepackage{natbib}
\bibliographystyle{plainnat}
\bibliography{testbib}
[ ... ]
\section{Test}
\label{sec:orgfb2727b}
This is a test. \citep{Nobody06}
\end{document}

Manually changing the file to this:

% Created 2018-11-01 Thu 13:28
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
[ ... ]
\usepackage{natbib}
\bibliographystyle{plainnat}
[ ... ]
\section{Test}
\label{sec:orgfb2727b}
This is a test. \citep{Nobody06}
\bibliography{testbib}
\end{document}

Fixes the issue so that I can run the pdflatex and bibtex commands to generate the references in the final pdf file.

Is there some way I can force the line \bibliography{testbib} to be inserted in the right spot from within Emacs? I.e. so that I can just run C-c C-e l p to export a pdf without having to manually run pdflatex and bibtex?


texts: Invoke Interactive Function From org-capture-templates

texts:
I have a function called create-org-link that creates a file link based on an arbitrary string that I pass to it. I would like to be able to invoke this function when I invoke org capture.

Here's what I have tried:

(setq org-capture-templates
  '(("w" "Work Log" entry (file+headline "c:/td/gtd/org/WorkLogs.org" "Today") "** %(create-org-link) %?")
))

I know that the function works because I can use it outside of this template.
However, when I execute if from here I get the following output:

** %![Error: (wrong-number-of-arguments (lambda (title) Foobar de roobarb (interactive sPlease enter a title: ) (insert (format [[file:%s-%s.org][%s - %s]] (format-time-string org-link-date-stamp-format (current-time)) (replace-regexp-in-string    title) (format-time-string org-link-date-stamp-format (current-time)) title))) 0)]

Is there a different template element that I should be using?

Edit - 5/5/2014 @ 12:48

Here's the function that is being called:

(defun create-org-link (title)
  "Foobar de roobarb"
  (interactive "sPlease enter a title: ")
  (insert (format "[[file:%s-%s.org][%s - %s]]" (format-time-string org-link-date-stamp-format(current-time)) (replace-regexp-in-string " " "" title) (format-time-string org-link-date-stamp-format(current-time)) title)))

(defvar org-link-date-stamp-format "%y%m%d"
  "Format of date stamps to use in Org links")

Ha ha - I guess I should take out my placeholder comments before asking questions about it in a forum :-)


texts: How do I hide markup in Markdown mode with use-package?

texts:
I'd like to hide the markup in my Markdown buffers. I can do that manually using markdown-toggle-markup-hiding. However I'd like to configure this once and for all in my init.el so that I don't have to do this manually every time.

I tried setting markdown-hide-markup to 1, but it doesn't work. I believe I'm missing something here in my use-package configuration.

If anyone knows a fix, can you let me know?

Here are the things I've tried that do not work.

;; Markdown Mode
(use-package markdown-mode
  :ensure t
  :init
  (setq markdown-asymmetric-header t
        markdown-hide-markup 1)
  :config
   (add-hook 'markdown-mode-hook
             '(lambda ()
                (setq markdown-hide-markup t)
                (visual-line-mode)
                ))
  (progn
    (with-eval-after-load 'markdown
      (markdown-toggle-markup-hiding))))


texts: Search and replace isn't working in my function

texts:
I created the following function to remove macrons from vowels (this is a reduced version that only searches for the vowel "ā"):

(defun nv/eliminatemacron ()
  ""
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (search-forward "ā" nil t)
      (replace-match "a"))))

However, it always fails and prints Replaced 0 occurrences.

I also tried with query-replace but with the same negative results.

Any ideas on what's going on here?


texts: Inconsistent behavior when calling #'funcall with a macro

texts:
I would have thought that both of the funcall's the follow would have yielded the same result, but they don't and I'm trying to understand why.

(defmacro test/z () "z")
(funcall (function test/z)) ;; => "z"
(funcall (eval `(function ,(intern "test/z")))) ;; => Invalid function: test/z

Looking at the arguments of each call, they evaluate to the same thing:

(eq (function test/z) (eval `(function ,(intern "test/z")))) ;; => t

What really has me scratching my head that is that if I use defun instead of defmacro funcall then works in both calls..

I think I'm missing something in my understanding and I'm hoping someone can straighten me out. I'm reading the elisp info manual, but haven't found anything.

What's going on here?


texts: ido-find-file: directory names with hyphens are listed first

texts:
When using ido-find-file (C-x C-f) to navigate through directories, directories that have a hyphen in the name are listed before shorter matches with no hyphen. For example, if directories named "dir1" and "dir1-backup" are present, "dir1-backup" is selected first.

I could just customize ido-ignore-directories to ignore names with -backup in them, but I'd like to understand why this is occurring in the first place. It seems like the shorter name should be listed first in general.

This seems to only be a problem if I'm using the variable ido-file-extensions-order, but I don't see what file extensions have to do with directory names.

(setq ido-file-extensions-order '(".org" ".txt" ".py")) and dir1-backup is listed first.

(setq ido-file-extensions-order nil) and dir1 is listed first.

What is causing dir1-backup to be listed first?


texts: How to turn on a minor mode in my init file?

texts:
I want to add global-semantic-idle-summary-mode in my .emacs file instead of calling everytime it by using M-x.
I tried with (setq ...) but it doesn't work. What's the right way?


texts:
The docs made me no wiser:

  This function returns the value stored in symbol's value cell. This is
  where the variable's current (dynamic) value is stored. If the
  variable has no local binding, this is simply its global value. If the
  variable is void, a void-variable error is signaled.

What is the point of symbol-value? Where and when do I need to use it?


texts: Prevent *org todo* pop-up window from displaying in new frame (dedicated window scenario)

texts:
I have the following setup, created through a function I've defined in this reddit post, which states in relevant part:

(defun hd/weekly-review ()
  "Organize a series of windows for weekly reviews"
  ;; Define Keyboard Macro to narrow to weekly review checklist
  (fset 'hd-km/narrow-weekly-review-list
   [?\M-< ?\C-s ?w ?e ?e ?k ?l ?y return ?\C-x ?n ?s])

  (interactive)
  (delete-other-windows)

  ;; Start with org-agenda
  (org-agenda nil "R")
  (set-window-dedicated-p (selected-window) 1)
  (delete-other-windows)

  ;; Create a window for follow-mode (and blank it out with *scratch* so it's less distracting)
  (split-window-horizontally)
  (display-buffer "*scratch*" t)

  ;; Create the third window for the maintenance.org
  (other-window 1)
  (split-window-vertically (floor (* 0.78 (window-height))))
  (other-window 1)
  (find-file "~/org-docs/org-system/maintenance.org")
  (set-window-dedicated-p (selected-window) 1)
  (execute-kbd-macro (symbol-function 'hd-km/narrow-weekly-review-list))
  (show-all)
  (other-window -2)

  ;; Add to registers config for quick switch back within this session
  (window-configuration-to-register ?w))

To summarise, two windows are dedicated to buffers, and one is left undedicated:

-------------------------------------------------
|                 |                             |
|                 |      2a: agenda 'follow'    |
|                 |        (not dedicated)      |
|                 |                             |
|  1a: org-agenda |-----------------------------|
|   (dedicated)   |                             |
|                 |                             |
|                 |   2b: reference .org file   |
|                 |          (dedicated)        |
|                 |                             |
|                 |                             |
-------------------------------------------------

If I perform an action in 2a which creates a pop-up window (e.g. C-c C-t on a org file heading which brings up org todo), emacs creates a new frame to display the contents of the pop-up (which steals focus & remains even after the action associated with the pop-up is completed).

After alot of reading it seems that this problem could be avoided by adding a custom entry to display-buffer-alist.

However, this post suggests that approach will not work since emacs essentially ignores display-buffer-alist for the org todo keywords buffer. The solution proposed is to amend the buffer switching functionality of org-fast-todo-selection. Whilst the change is trivial, I'm reluctant to do so for forwards compatibility reasons.

Is there a better way to achieve what I want here?


texts:
I have a symlink on my Desktop that points to my Dropbox folder. Clicking on this link takes me through to Dropbox, which is located elsewhere. But if I try navigating to ~/Desktop/Dropbox using Emacs, it tells me that the symlink is the sole completion and will not go further.

How can I get Emacs to let me to TAB through the symlink, so that I can start with ~/Desktop and then navigate to say:

~/Desktop/Dropbox/folder/inside/Dropbox/...?


texts: exporting when narrowed to subtree fails due to unresolved references

texts:
I am having a large org-mode file and would like to export to HTML only a particular subtree. So I narrow to that subtree using M-x org-narrow-to-subtree and then export to HTML with C-c C-e h h.

However, the export fails since some references can no longer be resolved (as they point to other parts of the tree), so I simply get a message like the following:

Unable to resolve ID "mpm-2015-09-02"

The message appears in the mini-buffer and then the export fails.

When I try to export the entire document (without narrowing) I succeed.

Is there any way to instruct org-mode to just export the text of the link instead of failing?


texts: Use emacsclient as $EDITOR for zsh edit-command-line

texts:
I have emacsclient set as my $EDITOR. Yet, when I invoke the zsh function edit-command-line (C-x C-e) from Terminal I briefly see the Emacs frame open but then it closes immediately. How can I use emacsclient as the $EDITOR for edit-command-line?

Here is my how my $EDITOR variable is set: export EDITOR='emacsclient -t -c '

Here is my zsh config: bindkey '\C-x\C-e' edit-command-line


texts: Auto-reverting only renderable PDF buffers

texts:
I'm using pdf-view mode and the global auto-revert mode with LaTeX and
latexmk.  This works fine, except that, a couple of times during the
compilation, the PDF is in a useless state and the PDF window shows raw
data.  I was wondering whether it is possible to detect these useless,
unrenderable, states and dispense with the automatic reversion when they
obtain.  That is to say, whether it is possible to have PDF buffers
reverted only when the PDF is renderable.


texts: Close completing-read dialog before continuing

texts:
I've written an elisp script to automate the process of taking screenshots. The script uses maim and imgur.sh. Not really important however. Here is the code:
;;; ../../.local/share/git/dotArch/.config/doom/userconfig/screenshot.el -*- lexical-binding: t; -*-

(defun db/screenshot ()
  "Interactive menu for screenshots. Requires main, xsel, xclip and curl to be installed."
  (interactive)

  (let* ((actions '("Section" "Whole Screen"))
        (targets '("Imgur" "Clipboard" "Locally"))

        ;; The default extension used for images.
        (ext "png")

        ;; The default temporary directory used to store images.
        (tmp-dir "/tmp/")

        ;; The default temporary name used for images.
        (tmp-name "screenshot")

        ;; The full file path to a temporary image.
        (tmp-file (concat tmp-dir tmp-name "." ext)))

    (setq action (completing-read "Take screenshot of ..." actions )
          target (completing-read "Save screenshot ..." targets ))
    (setq result (db/screenshot-return-cmd action target tmp-file ext))
    (call-process-shell-command (nth 1 result) nil nil nil)
    (cond ((equal target "Locally")
           (message (concat "Image will be saved to: " (nth 0 result))))
          ((equal target "Imgur")
           (message "Image will be uploaded to Imgur. URL will be saved to the clipboard."))
          ((equal target "Clipboard")
           (message "Image will be saved to the clipboard.")))))

(defun db/screenshot-return-cmd (source target tmp-file ext)
  "Build the command to be executed for taking screenshots."
  (let ((cmd ""))
    (cond ((equal source "Section")
           (cond ((equal target "Locally")
                  (print "section local")
                  (setq tmp-file (concat (read-directory-name "Select directory: " "~/") (read-string "File name (Without extension): ") "." ext))
                  (setq cmd (concat "maim -s " tmp-file)))
                 ((equal target "Imgur")
                  (setq cmd (concat "maim -s " tmp-file "; imgur " tmp-file " | xclip -selection clipboard")))
                 ((equal target "Clipboard")
                  (setq cmd (concat "maim -s | xclip -selection clipboard -t image/png")))))
          ((equal source "Whole Screen")
           (cond ((equal target "Locally")
                  (setq tmp-file (concat (read-directory-name "Select directory: " "~/") (read-string "File name (Without extension): ") "." ext))
                  (setq cmd (concat "maim " tmp-file)))
                 ((equal target "Imgur")
                  (setq cmd (concat "maim " tmp-file "; imgur " tmp-file " | xclip -selection clipboard")))
                 ((equal target "Clipboard")
                  (setq cmd (concat "maim | xclip -selection clipboard -t image/png"))))))
    (list tmp-file cmd)))

I'm still a noob with elisp, so any suggestions regarding my code are welcome.
I use completing-read to ask the user what he wants to screenshot and where to save it (For example 1: Whole screen, 2: Upload to imgur):
;; ...
    (setq action (completing-read "Take screenshot of ..." actions )
          target (completing-read "Save screenshot ..." targets ))
;; ...

After that I execute the corresponding command using maim. However the problem is that the second completing-read-dialog, where the user selects the target is still visible when maim takes the screenshot, resulting in something like this:

I hope you get my problem. I want the completing-read to close before I take the screenshot. Does anyone know how to achieve that?


texts:
windows 10, emacs 26.1

In dired mode I enter a zip archive by press enter

Nice.

Now I want to delete one file and one dir inside archive. I mark it by d and press x .
But I get this error:

No such file or directory, zip


texts: Add a constant decimal value to a column of numbers


texts:
I have multiple scheduled tasks/events in different files properly labeled and I can't find a way to have the weekly schedule agenda view to filter by these labels. It just shows all the labels per day.

I've tried using the m option but It misses the weekdays and the properly structured view from the agenda weekly schedule.


texts: Query the org agenda from the commandline?

texts:
I'd like to display event counts in a conky window. Things like tasks scheduled for today, within the next 3 days, 15 days, count of pending todo items, etc. Since conky doesn't "talk" org-mode, the next best way is to call a shell script and use its output.

Can I call emacs in batch mode for this? Is there an org-agenda function that prints event counts? Should I do my own parsing instead?


texts: "Symbol's function definition is void: org-agenda-skip-scheduled-if-done"

texts:
I've recently started using Org-mode, and when I last restarted Emacs, I got the error message Symbol's function definition is void: org-agenda-skip-scheduled-if-done. Upon opening Emacs again using --debug-init, I get the following backtrace:

Debugger entered--Lisp error: (void-function org-agenda-skip-scheduled-if-done)
  (org-agenda-skip-scheduled-if-done t)
  eval-buffer(#<buffer  *load*> nil "/home/daniel/.emacs.d/init.el" nil t)  ; Reading at buffer position 3069
  load-with-code-conversion("/home/daniel/.emacs.d/init.el" "/home/daniel/.emacs.d/init.el" t t)
  load("/home/daniel/.emacs.d/init" t t)
  #[0 "^H\205\262^@ ;; more stuff after this that wouldn't paste for some reason
  command-line()
  normal-top-level()

This is likely referring to the following line in my init.el file:

(org-agenda-skip-scheduled-if-done t)

If I comment this line out and evaluate it, I get the following backtrace:

Debugger entered--Lisp error: (void-function org-agenda-skip-scheduled-if-done)
  (org-agenda-skip-scheduled-if-done t)
  eval((org-agenda-skip-scheduled-if-done t) nil)
  eval-expression((org-agenda-skip-scheduled-if-done t) nil)
  call-interactively(eval-expression nil nil)

I'm using GNU Emacs 24.3.1 on Ubuntu 14.04.2. I have no idea what's happening. Can anybody help?


texts:
When working with the same buffer in multiple windows within one frame, it seems like the location of the cursor in, say, window A gets inadvertently set as a marker such that right after the buffer using C-x C-s in window B, the cursor in B jumps to the same cursor location as in A.

Is this normal behavior?  What are the commands or settings controlling this?


texts:
magit-version: Magit 20170407.2107, Git (unknown), Emacs 25.1.1, darwin
git version 2.12.2
OS x 10.12.4

git status on command line works fine
git rev-parse --git-dir gives .git

magit-status asks for a directory, then asks to "Create repository in xxx?", then "user-error: Not inside a Git repository"

Any ideas?


texts: Debugging / understanding placement of keymap with text-properties

texts:
Q:   Why does there appear to be a keymap on the hyphen of hello-world in the following example?

GOAL:  Place text properties before the hyphen and after the hyphen -- without any keymap being placed on the hyphen itself.

Background:  The following example has been constructed to place text properties only on the word "hello" and the word "world".  As far as I can tell, the hyphen between "hello" and "world" should not have any text properties.  Yet when I place the cursor at the hyphen and type M-x describe-key RET RET, I see that it is linked to my-follow-link from my-mouse-map.

  (defvar my-mouse-map
  (let ((map (make-sparse-keymap)))
    (define-key map [mouse-2] 'my-follow-link)
    (define-key map [return] 'my-follow-link)
    (define-key map [follow-link] 'mouse-face)
      map)
  "Keymap for mouse when in `my-mode'.")

;; Author:  Drew Adams -- http://emacs.stackexchange.com/a/13411/2287
;; Modified by @lawlist for purposes of testing different scenarios.
(defun my-follow-link (event)
"Doc-string."
(interactive (list last-nonmenu-event))
  (run-hooks 'mouse-leave-buffer-hook)
  (with-current-buffer (window-buffer (posn-window (event-start event)))
    (let ((foo  (get-text-property (posn-point (event-start event)) 'test)))
      (message "%s" foo))))

(defun test ()
(interactive)
  (fundamental-mode)
  (let* (beg end)
    (save-excursion
      (goto-char (point-min))
      (setq beg (point))
      (insert "hello")
      (setq end (point))
      (add-text-properties beg end (list
          'test "This is my first half of the test."
          'face '(:foreground "cyan" :weight bold)
          'mouse-face '(:foreground "red" :weight bold)
          'help-echo "mouse-2, RET:  My first message."
          'keymap my-mouse-map))
      (insert "-")
      (setq beg (point))
      (insert "world")
      (setq end (point))
      (add-text-properties beg end (list
          'test "This is my seond half of the test."
          'face '(:foreground "orange" :weight bold)
          'mouse-face '(:foreground "blue" :weight bold)
          'help-echo "mouse-2, RET:  My second message."
          'keymap my-mouse-map)))))


texts:
I'm transitioning from VIM (using GNU Emacs 24.5.1). I want to move between "windows" using familiar keys i.e.

(global-set-key (kbd "C-k") 'windmove-up)
(global-set-key (kbd "C-j") 'windmove-down)
(global-set-key (kbd "C-h") 'windmove-left)
(global-set-key (kbd "C-l") 'windmove-right)

However in org-mode...

  C-k runs the command org-kill-line, which is an interactive Lisp
  function in `org.el'.

  It is bound to C-k.

  (org-kill-line &optional ARG)

  Kill line, to tags or end of line.

So I tried removing the org-kill-line mapping but I couldn't get it to work:

(eval-after-load "org"
   '(define-key org-mode-map [remap org-kill-line] nil))

Disclaimer: I've only been using emacs for 3 days so far.


texts: AUCTeX: Inserting and deleting matching pairs of parentheses

texts:
For some reason electric-pair-mode doesn't work well with AUCTeX: It works for ( and [ but not {. But it used to work.

So I disable electric-pair-mode and use tex-electric-left-right-brace instead. The annoying thing is that when I want to delete (), with electric-pair-mode turned on I can just press backspace once, but with electric-pair-mode turned off I need to press it twice to delete the whole pair. What do I need to do to be able to delete matching parens with a single key stroke?

To summarize, I need auto-closing for (, [, and { in AUCTeX, as well as the ability to easily delete pairs of matching parens.

Thanks.


texts:
In an org mode buffer (not in an org-agenda buffer) I fairly often want to shift a date by one week at a time.

How can I do that?


texts: What options are there for doing spell-checking in emacs

texts:
Because I'm currently doing a lot of non-programming tasks in Emacs, spell-checking became one of my major concerns once again.

I noticed that there is no question related to the options for spell-checking in Emacs yet, so here we go:

  What are my options to do spell-checking in Emacs?

Specifically,

for general purpose spell-checking, i.e. sensible suggestions for typos, spell correction of words
for selective spell-checking, e.g. general purpose spell-check but only in comments
for anything which I forgot or am not aware of but you can think of (spell-check related, duh...)

Edit: Forked off the "other" stuff in a separate question, What options are there for writing better texts in emacs


texts: Setting An Org Heading Property From Yasnippet

texts:
I have a yasnippet snippet for adding the boilerplate to my "daily review" org document. Here's what it looks like:

# key: ndr
# name: newdailyreview
# --
* Accomplishments
  :PROPERTIES:
 :CUSTOM_ID: accomplishments
  :END

  - $1

* Goals For Tomorrow
  :PROPERTIES:
 :CUSTOM_ID: goals
  :END

  - $2

* Observations
  :PROPERTIES:
 :CUSTOM_ID: observations
  :END

  $0

The problem is that when the property drawer is malformed when printed. I tried preserving white space by adding this at the top:

# expand-env: ((yas-indent-line 'fixed) (yas-wrap-around-region 'nil))

But that didn't make a difference. I then tried setting the property like this:

`(org-set-property "CUSTOM_ID" "report")`

Unfortunately, this actually changes the buffer, which I believe is a deprecated feature of yasnippet.

Is there another way to solve this problem?


texts: How to open a folder with a local file manager?

texts:
I use Emacs 26.3 on Ubuntu 20.04 and I often need to manipulate org files with Ubuntu file manager. It would save me a lot of time if I could open directories from emacs file links. For example, I would like to be able to open folder PRISM through the following link :
[[./References/Deliverables/PRISM/proposal.org][PRSM Proposal]].


texts: Is there a timsort implementation in Emacs Lisp?

texts:
Timsort is the default sort algo of Python and Java and it performs better than mergesort on roughly sorted lists. I could not find any implementation of this in Elisp. How can I find out whether there is such a thing in Emacs Lisp?

OP EDIT, adding more context:

There is a real situation to this demand. There is literally an I/O of about 30 sec (a question to the final user) in each comparison. And in 80% of the cases the list is already kind-of sorted, where timsort takes big advantage above mergesort. In my case EACH question saved worth too much! If you are curious about the project, look at this: https://github.com/felipelalli/org-sort-tasks

Related issue: https://github.com/felipelalli/org-sort-tasks/issues/3


texts: How do I compare regions in the same file?

texts:
ediff allows comparing files, buffers, and regions in different buffers.
However, it does not let one compare sections in the same buffer.

Until now I used isearch for that: C-s at the beginning of the 1st identical section, the beginning of the second section is highlighted, then C-w to increase the search string until the second section no longer match.

Today I got Too many words error after several C-w.

So, what do people use these days to compare sections of the same buffer?

(yes, I can copy one of the sections into a throwaway buffer, but this is ugly).


texts: Quick access to the previous search terms after calling isearch-forward without switching to the minibuffer

texts:
I frequently re-search the terms previously searched by isearch-forward in my current session.
Assume that I have searched term1, term2, ... during my previous I-searches.
When I do a new isearch-forward, I would like to have a quick access to my previous search terms (say term1, term2, ... ), maybe to use them again. For this I have to switch to the minibuffer by putting the cursor in front of I-search: then pressing Up-Arrow Down-Arrow to have the access to the previous search terms, then pressing RET after selecting one of them.

Is there the possibility to do this without switching to the minibuffer? I mean pressing Up-Arrow Down-Arrow just after calling isearch-forward results in the access to previous search terms.


texts: Remove linebreak arrow and move last word to next line

texts: When I write text in the emacs editor and the text reaches the right border of the program, emacs continues on the next line and puts an arrow on both sides of its borders. I want to know if its possible to remove these ugly arrows and modify emacs in a way, that the last word is put on the next line instead of the last letters. So it would quite more readable because no words are cut due to a linebreak.


texts:
I found a function in lisp/subr.el that I would like to use: version>=. How do I use it?
(require 'subr) does not work: Required feature ‘subr’ was not provided.


texts:
I'm currently learning C with a book that has many small code examples that the reader is supposed to write, run and experiment with. I'm using Emacs as my primary tool for everything that has to do with writing, especially LaTeX and Org-Mode to date.
I'm already using Emacs for my C-stuff but there are always ways to optimize.
Specifically i'm searching for a way to have a key-binding, that saves, compiles and runs the file that is my current buffer!

Chances are, that there are some included files that also need to be considered in the build process.

All IDEs that i know of have a "compile and run" button and are not using any Makefiles and such (which would be overkill in my situation).

Is there a way or a package to achieve my expected behavior or would i be better off with using Qt-Creator or Visual Studio? I've done a quick google search but have found nothing satisfying yet.
Would be thankful if someone could help me out because manually saving, compiling and calling the binary can get tedious if you're writing 20-30 smaller programs a day


texts:
As far as I remember, verbose log in Magit 1.x was on lL. However, in Magit 2 lL does something different altogether. I know it is possible to activate verbosity by toggling --stat or --patch options. However, that's not quite what I need.

Is it possible to generate verbose log, but without any diff details?


texts:
I need to mark when I need to pay attention to a task in org-mode.

So far, I've been using SCHEDULED for this. In this sense, SCHEDULED may just mean "look at this on this date". This is my way of implementing a variation of of GTD. I know this may be abusing org-mode's SCHEDULED property.

One issue I have is that the model of tasks overlaps two concepts:

Tasks that are indeed scheduled to be completed on a particular date.
Tasks that I just need to look at on a particular date/period.

I could circumvent this by adding a new TODO state SCHEDULED. So far, instead, I've been using tags such as nextweeklyreview, etc.

This issue manifests when I plan tasks for future weeks: I can only plan them for a specific day (usually the first day of that week), making it look like Monday is going to be awfully busy.

What I really would like to do is to schedule a task for a week, or a month, or a year. I know I can add ranges, but that would make the task show up in red in the agenda if the start date is now past. It's also far too much work.

I want something like:

* A
  SCHEDULED: 2017

Or, alternatively:

* A
  :PROPERTIES:
  ON_DATE_YEAR: 2017
  :END:

Is any of this possible? How can I make it convenient to use?

EDIT (2017/07/09 11:15CET, due to comment received): I really need to schedule a task for a week/month/year. This is not something that, afaik, GTD suggests, but I work best this way.)


texts:
I have (somewhat) successfully installed and configured web-mode.

But one thing doesn't work /w (react.js) JSX: I'm doing a project that requires the files to have the suffix '.js' and I'm trying to override the built-in js-mode assigned to them. I have gotten to having web-mode loaded for them (mode part of modeline says (Web ARev yas Trim)), but tag coloring and indentation doesn't work for .js suffixed files, but does for .jsx suffixed ones.

My web-mode loading and configuration currently looks like this:

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.js\\'" . web-mode)) ;; Override?
(add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))

(defun my-web-mode-hook ()
  "web-mode settings"
  (setq web-mode-markup-indent-offset 2)
  (setq web-mode-css-indent-offset 2)
  (setq web-mode-code-indent-offset 2))
(add-hook 'web-mode-hook  'my-web-mode-hook)

Anything obviously wrong? (Perhaps naively) it looks to me like the js-mode major mode is loaded first, and only afterwards web-mode, which doesn't manage to "take over" the buffer completely.

I guess I could look at the system sources and erase all configuration of js-mode from there, but that sounds too heavy-handed in my ears, so I'd prefer to avoid that, and I'm not even sure my theory about loading order is correct.

Emacs 24.5.1 on OS X installed via Homebrew.


texts:
In git I run this command to show recently used branches:

git for-each-ref --sort=-committerdate --count=10 refs/heads

How do I do this in magit?


texts: Fix indentation of LaTeX code without wrapping lines

texts:
If I select everything in LaTeX-mode (AUCTeX) and auto-fill the region, the indentation of all lines is corrected. This is the part I like.

However, it also breaks all long lines (which I think is the actual purpose of that function). But I don't like hard line wrapping.

Is there a way I can fix the indentation of an entire file without the lines being wrapped in the actual text? Wrapping them in the displayed text is desired.


texts: How to make dabbrev support CamelCase or a better auto-completion in java buffers

texts:
I use dabbrev as my auto-complete function (and since most of what I code is snake_case it works well).  However, I'm now doing a Java project and everything is CamelCase.  How do I make dabbrev support CamelCase?  Or is there a different auto-complete function I should be using in .java buffers?
In particular, if the text dabbrev is copying is in some form of CamelCase e.g.
GenericValue genericValue = new Ge...

and I type M-/ where the ... is, I'd like it to expand the rest of the text in CamelCase without touching the case of the letters currently typed and thus correctly cased. thus geM-/ -> genericValue and GeM-/ -> GenericValue.
I am willing to try another function to see if it works better.  And, if I have to hack dabbrev, I can do that too.


texts: How can I use multiple dictionaries with the Emacs spell checker? Specifically I want to use a British English dictionary and a medical English dictionary at the same time.


texts: How can a file be configured to recognized as a certain language only in that session?

texts:
I am editing a Drupal module file which doesn't use either a .php or .module extension.

How can I configure emacs to recognize the file alone as a PHP file:

regardless of the extension and
only for the session

If the file was the only file with that extension in the session how would I set the mode by the extension?


texts: How to display both output and value results in org mode for a source code block?

texts:
I have the following:

#+BEGIN_SRC lisp :results value
  (dolist (x '(1 2 3))
    (print x))

#+END_SRC

#+RESULTS:
: NIL

I want my results block to contain both the output and the value for my source. How do I do that?


texts: helm-multi-occur, navigate through the search occurrences

texts:
I use helm-multi-occur to search for a pattern in all open buffers. Search results are displayed line by line in the buffer *helm multi occur*.
When i press enter after selecting an item, it enters a newline instead of taking me to the source code, where that pattern is located.
Screenshot is,

Here pressing enter on the green bar adds more and more blank lines, but i would like to switch the buffer to buttopane.js-ln#86.


texts:
I have been trying to get FiraCode to work inside of Doom Emacs and have mostly succeeded. Everything works except for italics, even bold and ligatures are fine strangely enough.
When I switch to another font in Doom Emacs I can also get everything.
Does anyone have some ideas on how to get this to work?
The relevant sections from my config:
(setq doom-font (font-spec :family "FiraCode Nerd Font" :size 12)
      doom-variable-pitch-font (font-spec :family "Hack" :size 12)
      doom-big-font (font-spec :family "FiraCode Nerd Font" :size 17))

If I replace FiraCode Nerd Font with something else, say hack for example, everything works fine but this doesn't.


texts: How to get asm file highlighting to be to be similar to vi?

texts:
Here I have a random (invalid, but shows the important syntax highlighting) asm file as in Vim:

Emacs seems to be highlighing incorrectly (? there are many flavours of asm but I've never seen something like this):

I was wondering if there was a setting or plugin that would allow me to achieve the same kind of highlighting in Vim (disregarding individual colour schemes, the "sets" of things being highlighted together seems weird in Emacs).
I would appreciate any help.


texts: Error when trying to clock in agenda buffer

texts:
I get the following error when trying to clock into the agenda buffer.

byte-code: Before first headline at position 406 in buffer *Org Agenda*

Doesn't matter the location in the agenda buffer.  If I go to the org file org-clock-in works fine.  Org clock out works fine from the agenda-buffer.

This feature was working before just fine, I didn't add any new packages, or change my init file before it started, but I tried generating the agenda file off two different org files and see the same thing.


texts: emacs org src output with accented characters

texts:
When I perform

#+BEGIN_SRC sql coding: utf-8-with-signature :results list :var did='2019-03-10' cid=77
  select t.titre from titres t inner join selections s on s.tid=t.tid where s.did="$did" and s.cid=$cid and s.choice=1;
#+END_SRC

I get

("Airbnb, la fÃªte est-elle vraiment finie ?" "" "")
("Apprendre Ã  manager une Ã©quipe en coachant des moutons" "" "")
("Â« StupÃ©fiant ! Â» met Ã  nu le mystÃ¨re Houellebecq" "" "")

when I cast titre to binary and convert to utf8...

#+BEGIN_SRC sql coding: utf-8-with-signature :results list :var did='2019-03-10' cid=77
  select trim(convert(cast(t.titre as binary) using utf8)) as titre from titres t inner join selections s on s.tid=t.tid where s.did="$did" and s.cid=$cid and s.choice=1;
#+END_SRC

I get

("Airbnb, la fête est-elle vraiment finie ?" "" "")
("Apprendre à manager une équipe en coachant des moutons" "" "")
("« Stupéfiant ! » met à nu le mystère Houellebecq" "" "")

which is nice and I can live with it... but I want the output without the quotes and the parentheses, so I added org to the list of results parameters

#+BEGIN_SRC sql coding: utf-8-with-signature :results list org :var did='2019-03-10' cid=77
  select trim(convert(cast(t.titre as binary) using utf8)) as titre from titres t inner join selections s on s.tid=t.tid where s.did="$did" and s.cid=$cid and s.choice=1;
#+END_SRC

and I get

Airbnb, la f\303\252 est-elle vraiment finie ?

but when I copied the previous sentence into the emacs.stackexchange.com text input it reads like it should, i.e.

Airbnb, la fête est-elle vraiment finie ?

the buffer coding system (shown in the lower left corner of the emacs window) says (multi-byte) utf-8-unix.

How can I get the output to print in a human-readable way?

Update
I added

 #+name: echo_me
 #+BEGIN_SRC sh :var data="" :results output
   echo "$data"
 #+END_SRC

and added a :post option to the src block

#+BEGIN_SRC sql coding: utf-8-with-signature :results list org :var did='2019-03-10' cid=77  :post echo_me(data=*this*)

now it works fine, but before the output is generated Emacs asks me to pick a coding system (raw), since utf-8-unix does not contain the accented characters. I wonder whether there is a better solution, and I'd like to understand what is happening.


texts: Changing fill-column of elisp docstrings

texts:
When I'm writing the docstring for a defun or a defvar, if hit
M-q the paragraph always gets filled to 65 characters, regardless of
the value of
fill-column.

Q. How can I get fill-paragraph to always respect the configured
  fill-column
  inside emacs-lisp-mode?