texts: Emacs tea-time is supposed to be integrated in org-mode, but apparently, it's not

texts:
I'm talking about tea-time. In short:

  It allows you to set up time intervals and after this interval is elapsed, Emacs will notify you with sound and notification.

What I'm really interested in is the sound notification (otherwise, I'd miss it).

It also seys in the link that it's been integrated into org-mode:

  Functionality of this package was integrated into org-mode (edge on May 2009). Check http://orgmode.org/Changes.html#sec-1.4.2 for details.

I checked the link, but the only functionality that is mentioned is the use of org-timer (org-timer-set-timer, which I've been using for some time now). But org-timer doesn't have any (sound) notifications. Did I miss something?

Edit: It could be that I just don't know how to configure org-timer to play sounds. I'm not very good with lisp code (yet), can somebody please help me out on this?

Edit2: I found this piece of code org-timer.el:

(defun org-timer--run-countdown-timer (secs title)
  "Start countdown timer that will last SECS.
TITLE will be appended to the notification message displayed when
time is up."
  (let ((msg (format "%s: time out" title)))
    (run-with-timer
     secs nil `(lambda ()
         (setq org-timer-countdown-timer nil
               org-timer-start-time nil)
         (org-notify ,msg ,org-clock-sound)
         (org-timer-set-mode-line 'off)
         (run-hooks 'org-timer-done-hook)))))

I think org-clock-sound is a variable that I need to set to a specific *.wav file or something, but I don't know.


texts:
While looking to exclude the uses of the list function through the backquote substitutes in defmacros, my attempt failed when combined with the let and `let* recipe, together with the gensym function (as a source of uninterned symbols, as illustrated somewhere else), to create temporary variables - but the latter is not the issue.

A running MWE [EDITED: inserted macroexpand] is the following.

(defun w (a &optional b) ; line 1
  (let ((z (gensym)))
   `(let* ((,z (if (integerp ,b) '((,a ,b)) '((,a))))) ,z)))
    ⇒ w

(eval (w 3)) ; line 2
    ⇒ ((3))
(eval (w 3 0)) ; line 3
    ⇒ ((3 0))

The w is a defun above: when the optional integerp second argument is present, return the pair as a "doubled" list; otherwise return only the first argument, also inside two pairs of parentheses.

Now comes the tricky part: need to replace the defun with a defmacro (m for w).

(defmacro m (a &optional b) ; line 4
  (let ((z (gensym)))
   `(let* ((,z (if (integerp ,b) `((,a ,b)) `((,a))))) ,z)))
    ⇒ m

(macroexpand (m (+ 1 2) 0)) ; line 5
    ⇒ list: Symbol's value as variable is void: a

And also attempt to return the evaluation of (+ 1 2), i.e., ((3 0)). The loop shows the above line #4 is faulty.

Next use instead simple quotes, i.e., '((,a ,b)).

(defmacro m (a &optional b) ; line 6
  (let ((z (gensym)))
   `(let* ((,z (if (integerp ,b) '((,a ,b)) '((,a))))) ,z)))
    ⇒ m

(macroexpand (m (+ 1 2) 0)) ; line 7
    ⇒ (((+ 1 2) 0))

Okay, but there is no evaluation of the argument: not acceptable.

(defmacro m (a &optional b) ; line 8
  (let ((z (gensym)))
   `(let* ((,z (if (integerp ,b) (list (list ,a ,b)) (list (list ,a))))) ,z)))
    ⇒ m

(macroexpand (m (+ 1 2) 0)) ; line 9
    ⇒ ((3 0))

Finally, use the list function for a change: this time it works, yet there is one list too many.

The problem is then how can line #4 keep its minimalistic form using (back)quotes, so that line #5 would result as line #3 - using defmacro versus defun. There is a `(... within `(--- pattern. that might be the cause.

Appreciate all answers. Thank s.


texts: How to access buffer history/history of the document at any given time?

texts:
I looked up the manual, and it says that the history in a buffer is stored in buffer-undo-list variable. I printed out this variable to see what the contents are, but they don't seem to be making much sense to me.
This is the basic functionality I am after:
At any given point, I want to be able to see the old state of the document (I figured I could somehow piece together the document from the history, but I am getting quite bamboozled in this effort).
I am quite new to elisp, any help would be appreciated, thanks. (I know, there is the possibility that my whole approach to this is wrong.)
EDIT: I think I was kind of unclear as to what I wanted. My requirement is basically having a snapshot of the file, at every change. For instance, I have a file that says "Hello world!", and then I write after that "Hello beautiful world!", I want to be able to have both versions of the file somehow. Is this possible? Like, auto save the file on every change in the file, but auto save to a new file every time.


texts: Need help to debug an issue with query-replace command

texts:
The query-replace command used to work perfectly for me. Recently, it fails with a symptom like this:

[updated]
Assuming the code looks like: (for example)

set_flaag(var1);

set_flaag(var2);

Now I issued the command "M-x query-replace[RET]flaag[RET]flag[RET]"
It highlights all the "flaag" in the screen, note the cursor will be on '(' of first line after high-lighting the first "flaag" in line 1. Then as soon as I typed a 'y' to proceed, it puts the 'y' in the buffer and quit without replacing "flaag" to "flag". (So line 1 looks like "set_flaagy(var1)".)

If I change the command to:
"M-x query-replace[RET]flaa[RET]fla[RET]". This way the cursor will be on the letter 'g' instead of '(' after highlight the matching parts in line 1. And the command works correctly.

I guess may be some of my new settings in init.el may have screwed up something. But I have no clue how to resolve/debug this issue. Would appreciate a help.


texts: Python and electric-indent: newline autoindent disregards previous blank line

texts:
This is (yet) another question related to electric-indent-mode and Python, but since I couldn't find what I address here in the other ones, here we go.

I find the behavior of electric-indent-mode quite useful in general, but there is a minor thing that annoys me:

Say we have the following buffer, where | (pipe) represents the cursor position:

def example():
    if True:
        print("Electricity")

    |

With electric-indent-mode on, pressing RET results in the following state:

def example():
    if True:
        print("Electricity")

        |

The automatic indentation of the newline regards only the first non-empty (i.e., that consists not only of whitespace) previous line.
However, what I would like is to have it take into account the cursor position of the previous line if the previous line consists only of whitespace (and after pressing enter, still remove the whitespace on the previous line afterwards if there was any):

def example():
    if True:
        print("Electricity")

    |

How can I tweak electric-indent-mode configurations to achieve the desired behavior? Conversely, what are the possible solutions (regardless of using electric-indent-mode or not)?


texts: How to configure C-M-q and TAB key to expand pre-existing TAB characters into spaces in C/C++ files

texts:
In C and C++ files, I want to configure the mode so that any time I request indentation, that it will always expand all of the embedded TAB characters in indentation (at the start of the line, and no where else) into space characters. How do I do that using vanilla emacs execution (emacs -Q) plus some calls to setq of whatever variables, and not writing special Emacs Lisp or rebinding keys etc.?
Detail:
Version of emacs I am using is:
GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian

Execute emacs -Q (so as to get the default c-style-alist value which for this should imply using the gnu style) and then open a .C file and insert in exactly this code:
// A C++ file

void function_using_tabs_inside_indentation () {
  printf("A message\n");
  if (bad) {
    printf("A bad message\n");
    if (bad) {
      printf("A bad message\n");
      if (bad) {
    printf("A bad message\n"); // TAB!!
      }
    }
  }
}

Note the comment above about the indented tab.
Then type M-x whitespace-mode. You should see something like this that clearly shows that there is a TAB code embedded in the indentation:

Now set indent-tabs-mode to nil by typing M-: (setq indent-tabs-mode nil).
Move your point to the "v" in "void" and type C-M-q, which should execute the command c-indent-exp.
But notice that nothing changed: The embedded tab does not get expanded properly into spaces, as the TAB code is still there.
Then, move point directly on the TAB code in that file. Type the TAB key. Notice nothing changes, but I want it to be expanded into the required number of spaces.
Yes, I know I can resort to using expand -2 on the file, but that takes me out of Emacs and I want it to happen automatically when I indent the line.
I also don't want to have to manually backspace over the TAB code and then type the TAB key to insert the required number of spaces, either.  If I do that to fix it manually, then this is what I expect to see (well mostly):

Notice how when I "fixed" it, the whitespace-mode highlights it in brighter yellow (brighter than the other space "glyphs" it uses for space characters)? Why? Perhaps it it telling me something is incorrect there?
Update #1:
I know about M-x untabify and that does what I want, but I want it to happen globally across all C and C++ files I open, and without having to type it. Yes, I can write some Emacs Lisp code to rewire the TAB key binding and the C-M-q bindings, but I hope to avoid that complexity, as I need this to be something I can request my fellow Emacs-using developers to use in our projects development.


texts: How can I stop emacs from highlighting whitespace?

texts:
After a recent update, my Perl files are rendered like this:

Note that trailing spaces are shown in red and empty lines in yellow. This is happening despite my having the following in my ~/.emacs:

(setq cperl-invalid-face nil)
(setq sp-highlight-pair-overlay nil)

This does not seem to be related to anything in my ~/.emacs or ~/.emacs.d/init.el files since renaming them and launching emacs still shows the same behavior. However, the problem is not there if I launch with emacs -Q. In case they are relevant, here are my .emacs and .init.el files. Finally, I also tried launching emacs as a different user and had the same issue so it seems to be a site-wide problem.

I get the same behavior in Elisp, C and Perl/CPerl modes but not in Fundamental or shell modes. How can I remove this highlighting?

I am running emacs 24.4.1 on Debian.


texts: strange minor modes and how to diminish them

texts:
I am working in a python file and thought I have diminished all modes accordingly, also yapfify. However, that does not seem to be the case as one can see in the screenshot. What are those cryptic modes anyway?

Also, yapfify spamms my entire buffer list full.

Can anyone tell me why and how I fix that


texts: Recent files by project rather than recent files and recent projects separately

texts:
Note: This question is really about Projectile and Recentf. I'm using them in the context of Spacemacs, so I describe that context, but the question isn't really intended to be Spacemacs-specific.
The Spacemacs home buffer, which can be configured via dotspacemacs-startup-lists, show by default a number of recent files and projects. They are, however, displayed in two separate lists, so if I've been working with a lot of files in one project, then all the recent files are from one project, even if I set recents to a large amount like 24, all the recent files will be from one project. What I'd really like is to see the recent files by project. Suppose for example I had a vegetables project and a fruit project. I would want to see something like:

vegetables

vegetables/lettuce.el
vegetables/squash.el
vegetables/tomatoes.el

fruit

fruit/apple.py
fruit/orange.py
fruit/banana.py

How can I achieve this with Recentf/Projectile? Is this a matter of configuration, or of needing to just code up the logic myself?


texts: Rebind 'q' key in Emacs Dired to the command 'kill-this-buffer'

texts: If I press 'q' in Dired this buries the current buffer. I would prefer to have 'q' kill the buffer. Hence, I would like to bind the command "kill-this-buffer" to 'q' in Dired. Is this possible and advisable?


texts: How to execute shell command from editor window?

texts: I have two windows open - one in editor mode with some SQL, bash, etc and the other in ansi-term. I want to mark my text and then execute it in the ansi-term window. Yes, I could make a shortcut involving copy paste but I was curious if there was anything canonical. Copy-paste also forces me to switch out of terminal mode and into editor mode in ansi-term


texts: Exclude different subtrees from export when using different back-ends

texts:
For example, main.org:

* Heading
  * Common subheading
  * HTML subheading
  * ODT subheading

I want to set tags or properties in such a way, that allows to export into main.html HTML subheading but not ODT one:

* Heading
  * Common subheading
  * HTML subheading

And to export into main.odt ODT subheading but not HTML one:

* Heading
  * Common subheading
  * ODT subheading

There is an option EXCLUDE_TAGS, but it works on any export back-ends.  Are there any ways to do this?


texts: Construct window with list of keybindings for the Emacs Debugger

texts:
I always forget the keybindings for the Emacs debugger. I'd like to have a small window open at the same time the debugger window opens with a list of keybindings (I'm thinking of something that would appear similar to the bottom Ediff window in this screenshot https://gpvprasad.files.wordpress.com/2009/12/ediff.png).

I was hoping a package like guide-key could perform this task but it doesn't seem possible.

What is the simplest way to make a window appear containing a concise list of keybindings for the active window?


texts: Why does a package archive produce error "not an absolute file name"?

texts:
When starting an older Emacs (23.4, say) for testing, I get an error from package initialisation a certain package is not available for installation. list-packages also shows a failure but with no details.

Starting with --debug-init shows that the error is:

(error "Archive location https://melpa.org/packages/ is not an absolute file name")

What causes this?


texts: Enabling Devanagari ITRANS mode automatically

texts:
To enter Devanagari ITRANS input mode for a specific file, I need to type the following command in Emacs.

C-x RET C-\ devanagari-itrans RET

Is there something I could add to my file that would enable this mode automatically?

I was pointed to
 Specifying File Variables in the Emacs manual by someone in #emacs on Freenode, so that might be relevant.


texts: Copy/Paste relative links between buffers

texts:
How can I copy (relative) links and regions with (relative) links between buffers?

Buffer c:\path\to\a\a.org contains links of the form

* A section with links
This is a link to another org-file
[[file:../../b.org][A link]]
* This is a link to a picture
[[./pictures/pic.png]]

How do I copy a link (or a text block containing multiple links) and paste it to a file c:\other\path\c.org and keep the links working?

The expected behavior is to fix the paths in c.org so that the link points at the original file. Pasting into c.org would insert this:

* A section with links
This is a link to another org-file
[[file:../../path/b.org][A link]]
* This is a link to a picture
[[../../path/to/a/pictures/pic.png]]


texts: how to get correct indentation after pressing 'o' in haskell-mode using evil-mode in spacemacs

texts:
When using haskell-mode (the Haskell layer) with evil-mode keybindings in spacemacs, the indentation created by pressing the o key is often incorrect.

For instance, imagine I want to write the following Haskell file:

module Foo where

foo :: Int
foo = 3

However, I've only written the following.  I haven't yet created the function body for the foo function:

module Foo where

foo :: Int

If I am in insert mode and have my cursor after the "t" in Int and press Enter, the cursor goes to the next line in the first column, directly under the "f" in "foo".  Using an underscore (_) for the cursor position, it looks like this:

module Foo where

foo :: Int
_

This is correct.

However, if I am in normal mode and have my cursor anywhere in the line with "foo" and press o, the cursor goes to then next line in the third column.  It looks like this:

module Foo where

foo :: Int
  _

This is incorrect.  I have to press Backspace twice to put the cursor in the first column before I can start writing the definition of foo.

It seems like indentation rules are getting messed up.  Why is the indentation different depending on whether Enter is pressed in insert mode, or o is pressed in normal mode?

How can I get o to indent the same as Enter in insert mode?

Here is my current .spacemacs config file.  To my knowledge, I don't have any settings set that effect indentation.

edit: Just so my intentions are clear, I do want indentation to be happening when I press either Enter or o.  But I want it to be the appropriate indentation.  Currently, pressing o results in incorrect indentation.


texts: How to not include newlines in strip-export

texts:
I'm using the following snippet
#+NAME: save-file
#+BEGIN_SRC python :results silent :var filename="filename" plt="plt" :exports none
return f"\nfname = 'assets/' + filename + '.png'\nplt.savefig(fname)\nfname"
#+END_SRC

which I include in src blocks like so:
#+BEGIN_SRC python :var fig=1 filename="some-filename" :noweb strip-export :results file :session t :exports both :cache yes
import matplotlib.pyplot as plt

plt.plot(1, 1)

<<save-file("filename", "plt")>>
#+END_SRC

My issue is that save-file adds some extra newlines in export which I would rather omit. How to overcome this?


texts: Create temporary keybinding interactively

texts:
I sometimes find myself using a command repeatedly (using M-x) but I do not want to bind it to a key in my init-file, because I only use it in certain sessions. How would I bind a command to a key interactively?

Let's say I want to bind bury-buffer to C-c q. I could use M-: (bind-key "C-c q" 'bury-buffer) (I'm using use-package), but that's a lot of typing. What I want is to complete from a list of all interactive commands, and then input a kbd-string to which the chosen command should be bound.


texts: How to make yasnippet and company work nicer?

texts:
In my emacs,
let's say, I use a "elisp" yasnippet to extend a lisp block in
org-mode. But before I extend it, company is triggered first, which gives
me a menu like "1. elisp1, 2. elisp2" without an option "elisp". Now if I use tab to extend yasnippet, it is always annoying that "elisp1" always first goes on the screen. So I need to delete "1"firstly, and do the extension of yasnippet snippet.

So as a solution, I always use left arrow key to turn company completion menu off first, but the cursor now will go to "elis|p", so again I use right arrow key to move the cursor to end of "elisp|", and extend the snippet.

Here comes my question: how can I bind tab key firstly trigger yasnippet but not company to save me life?


texts:
I'm writing an org-mode document where I want to mark up only part of a single word; for example, I might want something like these examples, which were generated by the Markdown some*thing* like these `example`s.  The analogous org-mode code, however, doesn't work:

some/thing/ like these ~example~s

syntax highlights/exports (or rather, doesn't) as

  some/thing/ like these ~example~s

How can I get org-mode to produce the appropriate syntax highlighting/exported output, namely

  some/thing/ like these ~example~s

?  (Dropping the "/" and "~" in exported content, of course.)


texts: How to prevent parsing file-local variables?

texts:
I have the following text:

Local Variables:
eval: (face-remap-add-relative 'default :family "AR PL KaitiM GB" :foundry "ARPH")
End:

In my document as a code sample. However, whenever I open the document, Emacs reads these lines as file-local variables and tries to apply them... They are neither the first nor the last in the document.

Any trick to prevent Emacs from parsing them?


texts: Company mode does not complete automatically

texts:
So I have installed company mode with the backend company-gtags. This is what my init file looks like for company.

;; == company-mode ==
(use-package company
  :diminish company-mode
  :ensure t
  :init (add-hook 'after-init-hook 'global-company-mode)
  :config
  (setq company-idle-delay              0.1
        company-minimum-prefix-length   2
        company-show-numbers            t
        company-tooltip-limit           20
        company-dabbrev-downcase        nil
        company-backends                '((company-gtags))
      )
  :bind ("s-;" . company-complete-common)
  )

When I type part of a variable/function, and wait for company to autocomplete, nothing happens. Then when I press s-; I see the popup with completions.

However, I would like for company to start the completion automatically and I am not sure what I am missing.

Thanks!


texts: Nesting conditionals, consolidating functionality in elisp

texts:
Working in an org-mode file, I have this table

#+tblname: site-charac-matrix
|   | glaze | orn | color | thin |
|---+-------+-----+-------+------|
| A |     0 |   1 |     0 |    0 |
| B |     1 |   0 |     0 |    0 |
| C |     1 |   0 |     1 |    0 |
| D |     1 |   1 |     1 |    1 |
| E |     0 |   1 |     1 |    1 |

which represents archaeological dig sites (one per row) for pottery, where four characteristics of the pottery are noted, 1 or 0 for yes or no for that characteristic of the pottery. Here is the "internal" list for the table

#+begin_src emacs-lisp :var site-matrix=site-charac-matrix :results raw
site-matrix
#+end_src

#+RESULTS:
((A 0 1 0 0) (B 1 0 0 0) (C 1 0 1 0) (D 1 1 1 1) (E 0 1 1 1))

I created this function to input a site and a characteristic argument and get back a yes or no statement

#+begin_src emacs-lisp :var site-matrix=site-charac-matrix
(defun site-charac-4 (site charac)
  (cond  ((= site 1) (format "At site %d the pottery %s have the %s characteristic."
                 site (if (= 1 (nth (charac-to-index charac) (nth 0 site-matrix))) "does" "does not") charac))
     ((= site 2) (format "At site %d the pottery %s have the %s characteristic."
                 site (if (= 1 (nth (charac-to-index charac) (nth 1 site-matrix))) "does" "does not") charac))
     ((= site 3) (format "At site %d the pottery %s have the %s characteristic."
                 site (if (= 1 (nth (charac-to-index charac) (nth 2 site-matrix))) "does" "does not") charac))
     ((= site 4) (format "At site %d the pottery %s have the %s characteristic."
                 site (if (= 1 (nth (charac-to-index charac) (nth 3 site-matrix))) "does" "does not") charac))
     ((= site 5) (format "At site %d the pottery %s have the %s characteristic."
                 site (if (= 1 (nth (charac-to-index charac) (nth 4 site-matrix))) "does" "does not") charac))
     (t nil)))
#+end_src

As you see, I have a cond to sort for the incoming site number, but then I need another conditional, an if embedded in each cond to get the yes or no of the characteristic from the site's row list. In addition, to translate the characteristics, I have this function

#+begin_src emacs-lisp
(defun charac-to-index (charac)
  (pcase charac
    ('glaze 1)
    ('orn 2)
    ('color 3)
    ('thin 4)))
#+end_src

which gives nth an index for accessing the correct place in the site row lists. This all works

#+begin_src emacs-lisp :var site-matrix=site-charac-matrix
(site-charac-4 5 'color)
#+end_src

#+RESULTS:
At site 5 the pottery does have the color characteristic.

My Lisp beginner's question is, could some of this be consolidated, e.g., the charac-to-indexinto the main function? Also, how do you have nested conditionals? I can't help but think my use of if embedded in the format of each cond case is kludgy. Any insights appreciated.


texts: Why did I get the U+2019 right single quotation mark not plain ASCII single quote in C mode?

texts:
In Emacs under C mode, why did the single quote key give me a U+2019 right single quotation mark, not a plain ASCII single quote? (That was corrected by a bot https://stackoverflow.com/posts/64104679/revisions)
Does the U+2019 right single quotation mark not work in C code?
In emacs:

How can I tell, whether a single quote is a U+2019 right single quotation mark, or a plain ASCII single quote?

How can I type U+2019 right single quotation mark and plain ASCII single quote respectively under emacs with C mode?

How can I replace  U+2019 right single quotation mark with  plain ASCII single quote?


texts: ediff from within magit-diff lost in v2.1

texts: magit-diff displays a buffer, which lists all files, which differ between the two revisions one is looking at. In v1.4 it was possible to type 'e' on each of these lines or inside the diff part to call magit-ediff for this file. Somehow this functionality seems to have disappeared in v2.1. Is there any way to resurrect this?


texts: Display search results in their own buffer

texts: I've use helm and ivy with swiper the search is great but I like to be able to keep search results in a buffer, navigate and edit my code and switch back to my search results buffer.


texts: Tags show conflict when I use visual-line mode and fold the headline

texts:
I got a super useful snippet from org-hacks: http://orgmode.org/worg/org-hacks.html#unnumbered-66, which can automatically adjust the position of tags to right of the headline and make org-mode looks cleaner.

But since these days, I start to use visual-line-mode, an uncomfortable looks problems appeared. On the folded headline, the tags are wrapped strangely to below the headline, like wrapped to a new line. However, when I unfold the headline, the tags go to the right position, of course, the rightest of the headline. So what is the problem? Since the tags can move according to the windows size, why it can not go well when headline is folded?


texts:
I wonder if it is possible to change the following functions:

dired-do-rename
dired-do-copy

such that when I operate on a single file, it prompts the selected file's name as the default target name.

Most of my files have long names, when I copy/rename a file, I usually copy/rename it to a similar name. It's painful to type the entire name or copy it from the original file.

Thanks a lot for any suggestions!


texts: function that takes a function as argument and returns a new function

texts:
I'd like to write an elisp-function that has a function as argument and returns a new function.

Let's say the new function double-the-function should write the returned value of the argument-function twice.
(The argument function operates on a string and returns a string. This is ensured.)

So:

(reverse "abc") returns: "cba"

If I define the function f as follows:

(setq f (double-the-function reverse))

I expect that:

(f "abc") returns "cbacba"

which is equal to (concat (reverse cba) (reverse "cba")).

How to define double-the-function?


texts: Normalize string to make it file/path safe

texts:
Often I find my self doing this

C-x C-f to create a file, while in the mini buffer prompt,
paste a url like "https://github.com/seamusabshere/cache_method/issues/15" from the clipboard.

Since "https://github.com/seamusabshere/cache_method/issues/15" is not a "safe" file name, I end up manually fixing it to look like

https___github.com_seamusabshere_cache_method_issues_15

Can a pre-existing emacs function help me with this? I feel like converting a string to a filepath safe string is a common scenario in emacsland.

What I tried:
Looked in M-x list for words like "normalize" "sanitize"

Another scenario: I'm in M-x shell,
I have typed git checkout -b
and have a jira ticket url in the clipboard. I want to create branch named after the jira ticket url.


texts:
I found this code in the manual An Introduction to Programming in Emacs Lisp demonstrating recursion with the help of cond function to find out the number of pebbles based on the entered number of rows, i.e. if rows = 2, then pebbles should be 3, if 4 rows then it should be 10 pebbles there.

(defun triangle-using-cond (number)
  (cond ((<= number 0) 0)
        ((= number 1) 1)
        ((> number 1)
         (+ number (triangle-using-cond (1- number))))))

evaluate to 10 after passing argument 4:

(triangle-using-cond 4)

The manual did not explain clearly what happens at each step in this example code in particular and I couldn't figure out how recursion works here. Can you pls help me understand the mechanics step-by-step what happens at each instance?


texts:
Launch Emacs with emacs -Q, insert a line contains only a \t (| represents the cursor):

\t|

M-x whitespace-mode, it should looks like (_ represents visual space):

»________$

Insert 2 spaces at the beginning of the line, it should now looks like:

··»______$

But what i want is:

··»________$

I'm a little confused why Emacs doesn't display the \t and 2 spaces before separately. Is the before 2 spaces really inserted? Can anyone help me?

Edit:

I encounter this problem when using whitespace-mode to show tab mark. The details can be found here.


texts: Has anyone else encountered gui-get-selection: (error "Timed out...") bug?

texts:
When trying to paste into Emacs from my Linux system GUI, I'm getting
a 10-15 second Emacs freeze and:

gui-get-selection: (error "Timed out waiting for reply from selection owner")

I would post a bug, except I can't pin-point the condition to
reliably reproduce the bug. Has anyone else encountered this?
I'm on GNU Emacs 25.0.50.1.


texts: using bibtex in org-mode messes up inlineimages of latex preview?

texts:
I had latex preview working with inlineimages as in the following .org file:

#+STARTUP: latexpreview
#+STARTUP: inlineimages

$A \to B$

The latex formula is correctly changed into a png image as follows:

However, once I start to add a bibtex line, the image preview breaks down. With this slightly changed .org file:

#+STARTUP: latexpreview
#+STARTUP: inlineimages

#+LATEX_HEADER: \addbibresource{test.bib}

$A \to B$

, org-mode generates an incorrect image for the same formula with the name of the bibtex file (test.bib) in it:

Does anyone know what's happening here and how to fix it?

By the way, this is with the default Emacs 26 in Ubuntu 20.04. And I used the setup of this tutorial. When the .org file is exported to ODT format, the formula are actually correct, and bibliography (not shown in this minimal example) also works well. It's just the preview in emacs that went wrong (for every formula).


texts: Org mode: control whether `M-` inserts a newline or not for plain lists?

texts:
In the following text:

foo

- s
  - sdljk

with point at the end of the block, pressing M-<RET> will alter the buffer to then look like this:

foo

- s
  - sdljk

  -

Same situation, but with original buffer as

foo
- s
  - sdljk

M-<RET> will alter the buffer to become:

foo
- s
  - sdljk
  -

I have two questions:

What controls this behavior? What determines whether a newline is inserted or not? I cannot find documentation on this (C-h k M-<RET>, as well as a basic search of the Org manual yielded nothing).
How can I change it so that a newline is never inserted?


texts: Override `show-trailing-whitespace` in `diff-mode`

texts:
I have show-trailing-whitespace set to t globally in my .emacs file, and this is generally not a problem except for when I'm in diff-mode looking at a patch which has mandatory trailing white space for blank context lines.

One solution would be to simply turn off show-trailing-whitespace in diff-mode in some relevant hook, but actually I'd like for trailing white space in change lines to still show up. For example, if I've accidentally introduced trailing white space or if I'm removing it, that's ok, and I still want that to show up in the trailing-whitespace face. I just don't want the blank context lines to be treated as trailing white space since they are necessary for the diff format itself.

Here's an example of the current behavior that I get:

And this is what I would like:

Here's another example, but this time, with actual whitespace addition:

However if I disable show-trailing-whitespace entirely in diff-mode, then I wouldn't see any dark red at all. Instead, this is what I'm wanting:

Basically, I think this involves making show-trailing-whitespace aware that diff lines with just a single space are special.


texts:
Currently I have jsx in my js files but when using web-mode it is only possible to have single quotes or double quotes for html attributes with this setting the web-mode-auto-quote-style setting, e.g:

(setq web-mode-auto-quote-style 2) ; use single quotes

I would like to disable it all together but how is this possible when it only takes 1 or 2 as a value.


texts: why won't gethash return my key's value?

texts:
Experienced lisp, scheme, clojure programmer making the move to elisp from python for automating routine, everyday, basic tasks: I got an enormous surprise from the following in ielm

ELISP> (setq h2 (make-hash-table))
#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data ())
ELISP> (puthash "a" 1 h2)
1 (#o1, #x1, ?\C-a)
ELISP> (gethash "a" h2)
nil

huh?  The key and the value appear to be present:

ELISP> h2
#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data ("a" 1))

/slaps forehead.  I must be missing something totally obvious. Info says:

-- Function: gethash key table &optional default
 This function looks up KEY in TABLE, and returns its associated
 VALUE—or DEFAULT, if KEY has no association in TABLE.

great.  Let's see if we can get gethash to return anything other than nil:

ELISP> (gethash "a" h2 'fubar)
fubar

wow.  Ok, I'm a lot dumber than I thought.  What on earth am I doing wrong?


texts: How to make emacs to launch sql modes runtime window always at the bottom?

texts:
When using M x sql-postgres to launch the SQL mode window, emacs (as of 25.x) seems to be making smart choices about where the SQL run-time window will show. That is, it splits the viewport and shows the runtime at the bottom by default. But when I resize emacs to full screen (or enough width), SQL runtime shows on the right hand side. My question is:

Can one make the new SQL run time window to always appear at the bottom?

(I observed similar behavior for python and other programming modes when launching the runtime window. Sometimes, I just felt it easier that the runtime always pop up at the same location.)


texts: how to not save duplicate information in Customize?

texts:
On a fresh install of emacs, I loaded my personal init files with all my custom lisp code. Then I changed one setting using the Customize interface and saved my changes. But in the custom.el file, Customize saved not just that one change, but all non default states. So now I have a custom.el file filled with information that's redundant with my own personal init file. This makes it tedious to look through my custom.el file to see settings I've changed.

Is this default behavior? Is there any way to direct Customize to save only the changes I make through the Customize interface?


texts: Paradox problem: "Tried contacting Github, but I can't understand the result."

texts:
For some time now (a month or so, I reckon), I get a strange error message after running the paradox-upgrade-packages command:

Contacting host: raw.githubusercontent.com:443
Importing package-keyring.gpg...done
Contacting host: melpa.org:80 [2 times]
Contacting host: marmalade-repo.org:80 [2 times]
gnutls.c: [0] (Emacs) fatal error: The TLS connection was non-properly terminated.
Contacting host: orgmode.org:80
Contacting host: elpa.gnu.org:80 [2 times]
paradox--github-parse-response-code: Tried contacting Github, but I can't understand the result.  See *Paradox Github* buffer for the full result

My paradox config is this one:

;; ------------------ paradox -----------------------
(use-package paradox
  :ensure t
  :bind (("C-x C-u" . paradox-upgrade-packages))
  :config
  (setq paradox-execute-asynchronously t
    paradox-github-token "[private]"
    paradox-automatically-star t
    )
  :commands
  (paradox-upgrade-packages paradox-list-packages)
)

This is exactly the same config I have in my Macbook Pro machine, with no problems at all. However, in my Xubuntu 15.10 machine (with GNU Emacs 24.5.1) I get the said error message.

Any ideas?


texts:
I'm writing tests for an interactive function. I've been using the unread-command-events variable in conjunction with call-interactively to verify that it does the right thing.

However, I just discovered that this doesn't work in batch mode.

For example:

(defun my-dummy (s)
  (interactive "sWrite something: ")
  s)

(ert-deftest my-dummy-test ()
  (let ((unread-command-events (listify-key-sequence "Hi!\n")))
    (should (equal (call-interactively #'my-dummy)
                   "Hi!"))))

When running ert in interactive mode, this works. However, in batch mode, Emacs stops and read the keyboard without consuming input from unread-command-events.

In this a bug in batch mode or is this the expected behaviour?

Is there any other way to do this in batch mode?


texts: Helm - hide "boring buffers" in helm-mini but not helm-buffers-list

texts:
I'd like to filter *foo* buffers out of my helm-mini (C-x b) list, but occasionally I do need to operate on a buffer like that. The natural solution (to me, anyway) is to use helm-buffers-list (C-x C-b) to access those.

I successfully filtered out these buffers by adding \*.+\* to helm-boring-buffer-regexp-list but I can't figure out how to configure helm-buffers-list to include boring buffers.


texts: bind german mutated vowel keys to functions

texts:
I have a German keyboard and would like to bind Isearch to C-ö.

How can I do this?


texts: Defining key-bindings within `helm-map`: getting a `void-variable helm-map` error [continuation]

texts: Following the same steps as Dipak C in his question regarding void-variable helm-map error but still cannot solve the problem even after adding (package-initialize) just after (require 'helm-config) as I understand from the solution.


texts:
I've been trying to get nnmaildir to work along with mbsync (which syncs IMAP and Maildir mailboxes) and I just cannot get it to work with gnus.

With the following select method:

(nnmaildir "calgary"
           (directory "~/mail/ucalgary"))

I can open the connection and the server browse buffer shows all the groups:

K      0: Calendar
U      0: Inbox
K      0: Sent Items

When I open the Inbox I get the following error:

gnus-select-newsgroup: Couldn't request group nnmaildir+calgary:Inbox: No such group: Inbox

Now if I look in /home/crb/mail/ucalgary/Inbox/cur/ there are a number of read and unread messages for example 1443481160.3793_16.Feddie,U=16:2,S.

Any advice on how to fix this?


texts: Archiving DONE tasks in a reverse datetree

texts:
I have a todo.org file where I place my tasks as TODO headlines. When a task is DONE, a CLOSED timestamp is created, and I usually archive the task to a file archive.org. So as to organize my archive.org file nicely, I add this line in the header of todo.org:

#+ARCHIVE: archive.org::datetree/

Consequently, DONE tasks are archived into a datetree in archive.org, according to their CLOSED timestamps. I'm globally happy with this, but I would like that most recent DONE tasks appear at the top of archive.org, and not at the bottom. In other words, I would like archived tasks to be stored in a reversed datetree.

I know that there is a package org-reverse-datetree but it seems to provide a solution only when working with org-capture or refile. I did not manage to use this package for what I want. Is there any simple solution for this?

Thanks !


texts:
In dired-mode I can type ! to use the selected file as an argument for a command. For instance, if I type ! rm <RET> it will run the command rm filename.

What I wanted is a short-key to run the file (if it is executable). Let's say I have this short-key mapped to @. Then I would type @ arg <RET> and it would run the selected file with the given argument, i.e., ./filename arg.


texts:
If you invoke M-x eval-expression then you can evaluate elisp expressions there, but there is no syntax highlight.
If I turn on emacs-lisp-mode in the eval-expression prompt then the major mode is switched to emacs-lisp, but the typed expression is still not highlighted.
Why is that? Why doesn't font lock work in the minibuffer?


texts:
My secretory creates a daily agenda for me by capturing task to shared org file mytodo.org. When I open the agenda or mark the task done, her ability to capture new task gets limited as the mytodo.org gets locked. Or she gets a message : file is modified on disk. Would you like to continue?

How this can be tackled ?

Kindly help


texts: Org-Mode How to position tables correctly when exporting to Latex?

texts:
I have a document I have written in org-mode which contains several tables.
The tables all have the following attributes.

#+begin_table
#+LATEX: \caption{Initial risk List}
#+LATEX: \label{tab:risk-list}
#+LATEX: \centering
#+LATEX: \adjustbox{max width=\textwidth}{
#+ATTR_LATEX: :center t :placement [h]
|Col1|Col2|
|----+----|
| 1  | 2  |
|----+----|
#+end_table

The configuration is to allow my tables to scale correctly for my document without running off the page which works, however, the [h] argument isn't being read by LaTeX as all the tables get places on one page together in the pdf document instead of being at their positions in the text where I want them. Am I passing the wrong latex configuration or is it just not picking it up during the parsing? I am using spacemacs by the way I'm not sure if that changes anything.

After looking at the tex file org produced it seems there is no placement values put into the document.


texts: How to always hide a subtree in org mode?

texts: Is there a property or command that can help to hide/fold a subtree temporarily even when doing org-cycle?


texts:
I am using latest Helm from MELPA on Emacs GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) of 2015-09-11

When I issue sql-connect I see this:

The only connection I have saved (in custom.el) is the second one, boccaperta. First time I select boccaperta from that list this is the error I get:

Debugger entered--Lisp error: (setting-constant nil)
  (let ((nil (quote nil))) (sql-product-interactive (quote postgres) (quote nil)))
  eval((let ((nil (quote nil))) (sql-product-interactive (quote postgres) (quote nil))))
  sql-connect("boccaperta" nil)
  funcall-interactively(sql-connect "boccaperta" nil)
  call-interactively(sql-connect nil nil)
  command-execute(sql-connect)

It only happens the first time I select boccaperta. If I try again, I can connect to my DB.

It also happens with Helm disabled, by the way. And it happens with emacs -Q as well.


texts: Orgmode: Show some extra vertical space between level 1 and previous line

texts:
I want emacs to show put some vertical margin between my level 1 headers, so that they are more readable. Currently, they are really hard to read:

Compare with (I have manually added newlines between entries):

Note that I do NOT want to change my files, just how they are displayed. Bonus points for making the setting local to a file using some directive or something.
Kind of related (this question is fine with just inserting newlines manually):

Orgmode: Extra vertical space between level 1 and previous line


texts: Using Emacs 26.3, suddenly any package I install from Melpa shows Available Obsolete from melpa -- Install. All used to be fine. What is causing this?


texts: Set multiple dir-local variables for the same mode

texts:
I understand from here, that I can use dir-locals.el to customize modes, such as given in the example:
      ;; Warn about spaces used for indentation:
      (haskell-mode . ((eval . (highlight-regexp "^ *"))))
      (c-mode . ((c-file-style . "BSD")))
      (java-mode . ((c-file-style . "BSD")))
      ("src/imported"
       . ((nil . ((change-log-default-name . "ChangeLog.local"))))))

However, all of these make 1 change per language-mode.  I would like to make multiple changes to the same mode, python-mode, and I think my syntax is only keeping the first one.
What's the right syntax to combine these two variables settings in dir-locals.el?
I have:
;; misc
((python-mode
  (python-shell-buffer-name . "Python[This Project]")))

;; set the local pyvenv
((python-mode . ((pyvenv-activate . "./envs/default")
                 )))

;; find local pylintrc vs global
((python-mode . ((eval . (lambda ()  (setq flycheck-pylintrc ".pylintrc"))))))

Other refs consulted:

How to set up elpy to use python3?
https://stackoverflow.com/questions/25288836/elpy-and-pylint-where-should-a-pylintrc-file-be-placed-in-order-to-customize-py
https://www.reddit.com/r/emacs/comments/1s9f9y/using_a_functionhook_instead_of_dir_local/
https://seandavi.github.io/post/2018-12-08-directory-local-variables-for-custom-emacs-projects/
https://chromium.googlesource.com/chromiumos/chromite/+/master/.dir-locals.el
How to use .dir-locals.el with Projectile?


texts: PHP function descriptions not loaded. Try M-x php-extras-generate-eldoc

texts:
I keep getting this annoying error that pops up in a dialog every few seconds.

I've tried running php-extras-generate-eldoc but that seems to point to http://doc.php.net/ which does not seem to be responding, and hence seems to be stuck at Contacting host....

https://bugs.php.net/bug.php?id=76819

Is there a way I can disable this particular feature?

I've tried to remove all references to php-extras in my .spacemacs file, but no change in behavior.


texts: c/c++ disassembler for emacs and objdump

texts:
I'm trying to show assembly under the cursor in emacs (spacemacs, on mac os x) and although disaster.el does generate assembly with objdump, it fails to associate lines in source with lines in assembly.  Error: "couldn't find corresponding assembly line".

disaster.el has not been updated in 3 years either, so I'm wondering if there is another package for this, or if we can get disaster.el working?


texts:
When we open bookmarks panel we see the following:

% Bookmark
- --------
  mark-1                         ~/work/file-1.txt
  mark-2                         ~/work/file-2.txt
  ...
  mark-n                         ~/work/file-n.txt

So, to open n-th file I need to click <Down> key n times, algorithm complexity O(n). Supposing, that n < 10, can we attach the keys from 0 to 9 to the appropriate bookmark? So it will look like this:

% Bookmark
- --------
0  mark-1                         ~/work/file-1.txt
1  mark-2                         ~/work/file-2.txt
  ...
9  mark-9                         ~/work/file-9.txt

When the user clicks the key <n>, the appropriate file is opened immediately. In this case the complexity becomes O(1) - the user needs to make 1 action.

Or widening the idea: the user can attach hotkeys to bookmarks, making the number of bookmarks pretty big:

% Bookmark
- --------
0  mark-1                         ~/work/file-1.txt
1  mark-2                         ~/work/file-2.txt
a  mark-a                         ~/work/file-a.txt
b  mark-b                         ~/work/file-b.txt
  ...
z  mark-9                         ~/work/file-z.txt


texts: Error trying to add Table editor to .emacs

texts:
I downloaded the Table editor for emacs table.el. I then edited my .emacs file to load the table file as follows

(add-to-list 'load-path "~/.emacs.d/manual")
(load "table.el")
(require 'table)

Opening the emacs in debug-mode throws me the following error

Wrong type argument: integerp, (32 . 126)


texts: Add cell background colors to org-mode table in pdf export

texts:
I'd like to be able to select a specific cell in an org-mode table and add a background color to that cell for a pdf export. Such that

| This Cell is formatted normally | This cell is greyed a bit|
| This cell is greyed as well     | This cell is white again |


texts: How can I enable lexical binding for Elisp code in org-mode?

texts:
I have the following code:
#+begin_src elisp
(setq lexical-binding t)
(let ((a 1))                            ; binding (1)
  (let ((f (lambda () (print a))))
    (let ((a 2))                        ; binding (2)
      (funcall f)))) ; result: 2
#+end_src

Since I set lexical-binding to t, lexical bindings should be used instead of dynamic bindings. So I think the result of the above should be 1. But the result is 2. It's as if Emacs is still using dynamic bindings. Why? How can I make it use lexical bindings?


texts:
I have emmet-mode installed and smart-tab installed and I want to rebind the  default  C-j of  emmet to smart-tabs TAB.

(require 'emmet-mode)
(add-hook 'sgml-mode-hook 'emmet-mode) ;; Auto-start on any markup modes
(add-hook 'css-mode-hook  'emmet-mode) ;; enable Emmet's css abbreviation.
(setq emmet-move-cursor-between-quotes t) ;; default nil

(require 'smart-tab)
(global-smart-tab-mode 1)
(define-key emmet-expand-line [(tab)] 'smart-tab)

;;; http://www.emacswiki.org/emacs/TabCompletion
(defun hippie-unexpand ()
  (interactive)
  (hippie-expand 0))

(define-key read-expression-map [(shift tab)] 'hippie-unexpand)

This is the error

Warning (initialization): An error occurred while loading `c:/Users/Sayth/AppData/Roaming/.emacs.d/init.el':

Symbol's value as variable is void: emmet-expand-line

I am copying the format from here https://www.gnu.org/software/emacs/manual/html_mono/elisp.html#Remapping-Commands but I appear to be getting it wrong.

(define-key my-mode-map [remap kill-line] 'my-kill-line)

and this action is what is advised by the  package  author https://github.com/smihica/emmet-mode

  press C-j to expand it (or alternatively, alias your preferred
  keystroke to M-x emmet-expand-line)


texts: Error: No org-babel-initiate-session function for bash!

texts:
I would like to use the session feature for bash source blocks, and receive the error message.

No org-babel-initiate-session function for bash!

A simple code is shown below. The code can be executed through C-cC-c. Yet I received the error message when pressing C-cC-vz.

#+BEGIN_SRC bash :session *bash*
echo $0
#+END_SRC

#+RESULTS:
|           |
| /bin/bash |

Interestingly, C-c C-v z works for sh source block.

#+BEGIN_SRC sh :session *sh*
echo $0
#+END_SRC

#+RESULTS:
|         |
| /bin/sh |

I use doom emacs, and the vanilla configuration for both org-mode and org-babel. Anyone knows what the potential issues are.


texts: How to use re-builder with rx special forms?

texts: I opened re-builder and changed its syntax to "rx". My target buffer has plenty of digits and (rx (and "4")) highlights a lot of 4s, however, (rx (and digit)) is apparently valid but matches nothing on the same target buffer! So far I only got string literals to match.


texts: what does "let*" ( let asterisk) mean in elisp

texts:
I've used let before, but never used let*
what does let* ( let asterisk) mean in elisp?

fyi this one was hard to google because of the asterisk.


texts: Why doesn't autocomplete work on MS Windows?

texts:
my init.el file content:

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(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

;;disable splash screen and startup message
(setq inhibit-startup-message t)
(setq initial-scratch-message nil)


texts: Rewriting all file when save some changes

texts:
I work on Rails project in my Emacs25.

When I change one specific file and save changes I got all file changed (from git diff).
But when I try to old and new versions of this file in Meld - I get difference with only my few strings changes.

In this .rb file has linux line separator, 2 spaces tabulation just like in whole project.
There is a place to be only in this file (maybe other files has it but the most of don't).

Most important thing: I changed this file before many times with no problems.

Config information:


texts:
Whenever I open an info entry in emacs (C-h i) an additional frame pops up.  On my system, it is too small and I'd love to have it in the top left corner, being wider and longer as it was created by default.  The new frame is labeled "*info".

The same applies to the frame, that rises, whenever I use emacs various help functions (C-h k, C-h v, C-h f, ...).  Those new frames are labaled "Help".  This frame has a similar position and size, as the "info" frames.

I have defined a default-frame-alist as well as an  initial-frame-alist  in my ~.emacs file.

(setq initial-frame-alist
      '((top . 35)
        (right . 5)
        (width . 200)
        (height . 55) ))

(setq default-frame-alist
      '(
        ;(scroll-bar-foreground-color . "yellow")
        (vertical-scroll-bar . right)
        (scroll-bar-width . 17)
    (internal-border-width . 2)
        (top . 20)
        (left . 10)
        (width . 120)
        (mouse-color . "yellow")
        (cursor-color . "red")
    ))

Those new frames are obviously not the initial frame.  Therefore, it is okay to me, that the don't use the dimensions given in the 'initial-frame-alist'.

EDIT

This image shows the location of the two frames, after having pressed C-h i.  AS you can see, a new frame "* info *" was opened on top of the initial frame (which is now in the background).   Please notice also, the width of the new frame is not sufficient, to view the text, without breaking some longer lines.  Furthermore, I'd love to have the new frame on the left screen side.

But I'd like to define the dimensions as well.  That would save me to use the mouse, to correct their size and location.  Something like this is desired:

(Obviously, I picked the frame with the mouse, moved it to its desired location and resized it with the mouse.  I'd love to avoid using the mouse, instead I want to add some lisp code to my ~/.emacs to do this changes for me!

If I press than C-h k TAB I get another frame as shown here.  This should also open on the left screen side (and not on the right side, as shown here).

What do I have to add, to my '~.emacs' file, in order to define the size ('width' x 'height') and location ('left' and 'top') of this kind of frames.

Something like this (pseudocode)

(setq info-frame-alist
      '((top . 5)
        (left . 5)
        (width . 100)
        (height . 25) ))
(setq help-frame-alist
      '((top . 7)
        (left . 7)
        (width . 75)
        (height . 20) ))

Any suggestions?

EDIT

When I eval some functions in the new frames, I do get this kind of information:

(frame-root-window) ; => #<window 7 on *info*>

the number ("7" in this case) depends on how many buffers I have opened in the actual running emacs.  But the text "info" is exact the title of the frame in question.


texts: how to give optional arguments to commands

texts:
Looking at the documentation for shell-command (M-!) I see there are two optional arguments, OUTPUT-BUFFER, and ERROR-BUFFER. But when I type M-! it only asks me for the shell command.

How do I supply a value for OUTPUT-BUFFER and ERROR-BUFFER?


texts: Easiest way to install Emacs Windows support libraries

texts:
I installed binaries of Emacs 24.4 for Windows and want to install the support libraries described in the Emacs for Windows README. The latest precompiled libraries are available from the ezwinports project, but installing them is a little time-consuming. I have to select all of the libraries mentioned in Emacs's README, scan the ezwinports README for any further prerequisites, and download each one of the zip archives. Then unpack them, move them to a permanent location, and add the individual directories to my PATH variable. There are duplicate files within these archives, so I am wary of unpacking them all to the same directory without checking that they are identical.

Is there an automated way to do this?


texts: Replace normal state keymap in Evil with another

texts:
I don't like Evil collections or the Evil keybindings in the dired-mode. I would like to re-map only few keys in the normal state like j, k, and a few more keys with g prefix and I would like to keep the rest of the keys as in vanilla Emacs.

Is it possible to set all keys in the normal state to Emacs state in the dired-mode? Then I can just re-map a few keys with evil-define-key. I don't want to use Evil collections.

To clarify: I would like the normal state to have exactly the same keybidnings as the emacs state in the dired-mode, but then I will re-map some of the basic motion keys like j and k.


texts: How to add all-level headings of org-mode buffer to helm-mini (helm-for-files)?

texts:
Let's say I have an agenda-files:
(setq org-agenda-files '("~/todo.org"))

This is my helm-mini-default-sources:
(setq helm-mini-default-sources '(
                       helm-c-source-buffers
                       helm-c-source-recentf
                       helm-c-source-file-name-history
                       ))

I would like to add all the headers from the org file to helm-mini-default-sources.
I know there's helm-org-in-buffer-headers here and it does pretty much what I want.
How do I add its contents to helm-mini-default-sources?


texts:
The GNU page for Eshell says that

  Eshell is not a replacement for system shells such as bash or zsh. Use Eshell when you want to move text between Emacs and external processes; if you only want to pipe output from one external process to another (and then another, and so on), use a system shell, because Emacs's IO system is buffer oriented, not stream oriented, and is very inefficient at such tasks. If you want to write shell scripts in Eshell, don't; either write an elisp library or use a system shell.

This makes it sound as if this IO system being buffer oriented was unique to Eshell. I'm new to Emacs and still trying to wrap my head around what the various shell modes do (and what the differences between them are), but unless I'm quite mistaken, M-x shell, ansi-term, multi-term, etc. all use this form of buffer oriented IO too, correct? So this criticism isn't something unique to Eshell -- it is a valid criticism for running shells in Emacs in general?

In other words, zsh, say, in Emacs (through M-x shell or multi-term) would not inherently be superior to Eshell due to this consideration?

If this is the case, then I suppose if one wants to "main" Eshell it is a good idea to keep a real terminal emulator running for big compile commands, using cat on files that might end up being super long, and other things that are stream oriented. Is this what people who us Eshell/M-x shell almost exclusively do to avoid hanging Emacs with lots of output?


texts: Problem Installing Solarized Theme For Emacs Via Melpa

texts:
So currently I have

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/"))
(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

in my .emacs file. Mind you I am using emacs 24.5. Every single time I run

M-x package-install solarized-theme

I get no match found. Any ideas?


texts: Parenthesis-like effect for sparse tree queries

texts:
I'm trying to define queries for sparse trees that combine different conditions, for instance.

(DEADLINE or SCHEDULED closer to one year), and
(TODO keyword is NEXT or TODO or WAITING, or tagged as unplanned) and
...

This is in a normal buffer, not the agenda buffer. I do not need this in the agenda buffer.

This would be very easy to do if parenthesis were allowed in sparse tree queries, but they are not implemented.

I need to do this with many conditions. If I distribute conditions over, the number of combinations I'd need to write grows far too quickly and it becomes impractical.

A "solution" would be to apply an org-match-sparse-tree on the result of another, somehow nesting conditions.

Is this possible? If not, are there alternatives to solve the problem I'm trying to solve?

How much effort would it take to implement parenthesis in search, or cummulative filtering and searching in sparse trees?

EDIT: bounty, hence changing the "goal" of the question.


texts: Promote a major mode kbd to a higher priority than the same ones used by a minor mode

texts:
I am using emacs to write LaTeX documents with AucTeX and cdlatex. Both of them have the same feature of automatically closing parens and dollar sign symbols. However, AucTeX obviously did a better job implenting that functionality, which is what I prefer to use.

That said, currently it's cdlatex that is doing the job of closing parens, which is very annoying. I tried to turn it off in cdlatex's customization but that just disables the functionality entirely. Is there a way to lift AucTex to a higher priority?

Here's my init:

;; this is more on the global side but I have it enabled anyways
(electric-pair-mode 1) ;; automatically close parens, etc.

(setq LaTeX-electric-left-right-brace 1) ;; automatic close tags
;; matching dollar sign
(add-hook 'LaTeX-mode-hook
      (lambda () (set (make-local-variable 'TeX-electric-math)(cons "$" "$"))))

(add-hook 'LaTeX-mode-hook 'turn-on-cdlatex) ;; enabled in AUCTeX LaTeX mode
;; (setq cdlatex-paired-parens nil)
(setq cdlatex-paired-parens "[{($")

Solution:
As Stefan suggested below, I got it to work after adding the following lines to my init:

(eval-after-load 'cdlatex
    (lambda ()
        (substitute-key-definition 'cdlatex-pbb nil cdlatex-mode-map)
        (substitute-key-definition 'cdlatex-dollar nil cdlatex-mode-map)
     ))


texts: Better indentation and navigation in assembly source code

texts:
When I write C or Java code it's extremely regular, but with assembly (asm-mode), it's so disorganized.

I'm using auto-complete and yasnippet.  I created snippets and am using them, but the code organization and indentation are disorganized.

What package(s) would help me:

easily indent code and comments properly, so that I can see what each piece of code is doing;
navigate that large mass of code, so I can easily jump between pieces of code?


texts:
When I start emacs -q and run M-x shell there is formatting error when connecting to docker container as follows,

$ docker container exec -it b3c85fd9c5eaa2e64fc5aac9025d1f9c3b3fe47ca39008f40ddd436338d755f5 bash
]0;root@b3c85fd9c5ea: /root@b3c85fd9c5ea:/# ls
ls
bin   dev  home  lib64  mnt  proc  run   srv  tmp  var
boot  etc  lib   media  opt  root  sbin  sys  usr
]0;root@b3c85fd9c5ea: /root@b3c85fd9c5ea:/#

Here is its screenshot


texts: How to abort a command executing in sqli-mode?

texts:
Whilst using a sqli buffer I accidentally ran a mahoosive query. What's the easiest way to abort it?

I used sql-postgres to start the process.


texts: How to save expansion state of org-file?

texts:
Is there a way to setup org-mode so that the expansion state of everything within a file is automatically saved when closing the file or quitting?

The Org-Mode FAQ says this is not possible, but maybe someone has a hand-rolled solution.


texts:
The help for custom-set-variables says:

The arguments should each be a list of the form:

  (SYMBOL EXP [NOW [REQUEST [COMMENT]]])

This stores EXP (without evaluating it) as the saved value for SYMBOL.
If NOW is present and non-nil, then also evaluate EXP and set
the default value for the SYMBOL to the value of EXP.

REQUEST is a list of features we must require in order to
handle SYMBOL properly.

So if NOW is nil then EXP won't be evaluated immediately, which suggests to me that it should be possible for EXP to refer to variables or functions provided by features in the REQUEST list which are not yet loaded.

Even if my interpretation is wrong, it should be possible to safely use custom-set-variables to customize variables in features which are not yet loaded.  For example, if I have something like:

(custom-set-variables
 '(yas-snippet-dirs
   ('("~/.config/yasnippets/rails")) nil (yasnippet)))

Then I would expect this variable only to be set once yasnippet is loaded.

It turns out that custom-set-variables tries to load yasnippet immediately.  This means that the custom-file containing this directive has to be loaded after all other user init code which takes care of ensuring that yasnippet is available (e.g. loading it from MELPA or el-get or via req-package).  That's all well and good if yasnippet is available, but what if it isn't available, or at least not yet available, due to some deferred or lazy-loading?

Currently this will result in a backtrace ending in something like this:

Debugger entered--Lisp error: (file-error "Cannot open load file" "no such file or directory" "yasnippet")
  require(yasnippet)
  mapc(require (yasnippet))
  custom-theme-set-variables(user (yas-snippet-dirs (quote ("~/.config/yasnippets/rails")) nil (yasnippet)))

which will then break the rest of the user's initialisation, which is really bad.  OTOH, if I just remove the REQUEST argument in order to allow deferred loading, then presumably the value of specifying that argument is lost.

So what's the correct way to safely customize variables for packages which are lazy-loaded or loaded on demand?

(BTW in case it's not obvious, I'm looking for a solution which doesn't bypass custom.el, because then I lose the ability to customize via custom.el's nice UI.  Otherwise I would simply do setq inside the :config section of my use-package declaration ...  Doing custom-set-variables in the same place doesn't work either, because updating the value via the custom.el UI would still update the file pointed to by custom-file rather than this correct location.)


texts: How to prevent a file show up for a second when emacsclient starts?

texts:
I am using emacs-daemon. When every I re-start my daemon and do C-x C-b my Buffer List seems always full.

Later, when I start my emacsclient for a seconds(like a fast flash) it shows a file that located on the top of my Buffer List and opens the file I want to open. This is little annoying to face with all the time.

Example:

I type emacsclient -t file_a.py.
For a second or less, buffer called file_b.py opens (my lastly opened file).
Than file_a.py get opens.

This always repeats itself even I clean my buffer list doing following and open a new file (since buffer list now contains more than one file):

Link:

  Edit: There's also the boring old buffer menu you get with C-x C-b.
  In this menu, you can hold d until it marks each buffer for deletion,
  then press x to commit.

Even after doing this after that IBuffer shows up since it is the latest opened buffer.

[Q] Is it possible to prevent 1 second file show up when I start emacsclient? If possible I always want to keep my Buffer List empty, but not sure would it be a good idea, or some how keep a empty file at the top of the buffer list since it will show a blank frame.

This also occurs when I using emacs -nw where scratch* buffer or latest opened buffer shows up for as seconds as well.


texts: bookmark-jump to org-mode file with collapsed headings not working as expected

texts:
I have a bookmark in one of my org files (set using the usual emacs bookmarks), but I'm finding that when I try to jump to the bookmark (with the usual C-x r b, which invokes bookmark-jump), it doesn't jump to the right place if the heading containing the location for my bookmark is collapsed.

Is there a way to get org and bookmark-jump to cooperate? I think what I want is something analogous to S-tab and C-c C-r (org-reveal): after S-tab, point is not moved, but the headlines collapse; if I then do C-c C-r, org shows exactly those heading necessary to display the exact line point is on. I want bookmark-jump to do the same thing -- put point on the right line -- so that even if org has the heading collapsed, things like org-reveal do what I expect.

Is there a way to do this? Or an org-specific feature for this kind of bookmark?

I have emacs 26.1 and org-mode 9.3.1.


texts:
I can't set Inconsolata as default font in Emacs 24.4 Linux.

I changed the font in the menu -> Save options. The font changed but after a
restart the font is the same as it was by default.

Added this to ~/.Xresources:  Emacs.font: Inconsolata LGC
Then in init.el: (set-default-font "Inconsolata LGC"). Same story.

What I'm doing wrong?


texts: Count number of files with specific extension on a folder?

texts:
Let's say I'd like to know how many .png images I have in a folder. In shell I'd run:

ls -1 | grep .png | wc -l

Is there a way to achieve this in emacs (preferably not just reading in from a shell output)?


texts: Get fancy startup screen on new emacsclient frame

texts:
When I run emacsclient -c, How can I get a frame with the fancy-startup-screen similar to when emacs is started by itself.
I would like to see what I see with the start screen of the non-server version. That is, when its buffer is killed, it must not return until a new instance of the SERVER is invoked.
More straightforward instructions -

Start Emacs server
Create a buffer with the startup screen
When a client is started with the above command, show this startup screen if it exists, otherwise show the *scratch* buffer (like it does now).

How do you do this (in init file)?
Note -
Apparently fancy-startup-screen is the (non-interactive) function used to get that screen (hence the title), but Emacs asks for a GUI frame if you run emacsclient --eval "(fancy-startup-screen)". Besides, I need this buffer to be created once per server, not client.


texts:
Comments in source code often contain URL's.  It would be nice to have these (or links in any plain text context) rendered as clickable links for the convenience factor when navigating a file using the mouse.

Q: Is there built-in emacs functionality or a packate that automatically render text segments that appear to be URL's as clickable links?

If this doesn't already exist, I'm inclined to implement it as a minor mode using auto-overlays.  If you have implementation advice I would appreciate it!

Note:  I'm aware that browse-url defaults to the URL at point.

Edit for clarification:

I am specifically interested in rendering URL's so that http://www.google.com found anywhere within a buffer to which the link rendering behavior has been applied automatically render as

It has:

a distinct underlined link face applied
a keymap applied to that segment
a mouse face applied to emphasize that it is clickable
a 'help-echo value set that decodes url-encoded characters for readability

I only mention browse-url for completeness regarding the suggestion that fontifying the link is unnecessary.


texts:
I'm working on email templates using web-mode, which – alas – requires inline styling galore… many of my opening tags won't fit on a single line even on a 4K-Display due to the massive amount of Attributes.

In order to reduce the clutter when editing the content I would like to fold only the attributes of all HTML-tags. This could be achieved if there was a way to fold all strings matching the following regex: "[[:alnum:]]+=[^>]+" or the first group of this  one (probably safer): "<[[:alnum:]]+ +\\([^>]+\\)>".

By folding I basically mean hiding the text, possibly having it replaced by a clickable placeholder revealing it when clicked. AucTex does it like that.The replacement part is not necessary htough. Basically all I need is to temporarily get the clutter out of sight, e.g.:

<div class="someclass"> foo </div> → <div …> foo </div>

I've tried hs-mode, but it seems to only operate on blocks, which won't work in my case since the Attributes are on the same line as the possible START and END regexes supposed to surround a block.

It should be possible to fold a regex, given the way e.g. AucTeX folds the content of certain macros etc. Any suggestions?

Many thanks in advance

Oliver


texts: What is this square in the middle of the emacs' GUI?

texts:
I wonder how could I disable this annoying square which seems like it's zooming in the text under the emacs' cursor.

How can I get rid of it? And what is this exactly?

I am on emacs 24.5 (homebrew installed) and MacOS X El Capitán.


texts:
JSON:

{
  "name": "xxxxx",
  "job": "xxxxxx",
  "projects": [
    {
      "name": "xxxxx",
      "date": "xxxxx",
      "about": "xxxxxxxxxx"
    },
    {
      "name": "xxxxx",
      "date": "xxxxx",
      "about": "xxxxxxxxxx"
    },
    {
      "name": "xxxxx",
      "date": "xxxxx",
      "about": "xxxxxxxxxx"
    }
  ]
}

Elisp file:

(let ((json-object-type 'hash-table)
      (json-array-type 'list)
      (json-key-type 'string))
  (setq data (with-temp-buffer
               (insert-file-contents (elt argv 0))
               (buffer-string))))

How to access the first element in projects list (json array)?

Note:
According to https://github.com/thorstadt/json.el/blob/master/json.el (read-json) should be used instead of setq but it doesn't show a clear example on how to do that. Also I have chosen hash-tables as the json-object-type as in comparision of plist and alist it seems favorable to me.


texts: Gnus doesn't see mail, even though files are there

texts:
My message-directory is ~/.emacs.d/mail, this is where Gnus stores all my mail. Suppose I have a directory misc that contains some email in nnml format. I create a Group mail.misc, move directory misc under ~/.emacs.d/mail/misc. But Gnus doesn't see my mail automatically, even though the files, corresponding to articles, exist.

How to make Gnus see my email under the corresponding Group? I think it has to do with .overview file.


texts: How to hook a TAG file with Emacs (Git-bash / windows)

texts:
I've successfully created a Tag file and could wade through the code using keys like M-,, but every time I need to choose the tag file for searching, so, I am looking for a way to hook the tag file I created with Emacs , found one reference, but not sure how to execute it on git-bash or how execute it on Emacs command-line, Helps appreciated.......

https://www.gnu.org/software/emacs/manual/html_node/emacs/Select-Tags-Table.html


texts: unreadable characters in buffer and bars

texts:
I have installed emacs 24.3 from source on CentOS 6.9.

I configured, compiled and installed it with:

./configure --prefix=$HOME/install --with-xpm=no --with-gif=no --with-tiff=no
make
make install

The unreadable characters appear in the bottom bars as well as the buffers.

Same issue with emacs-24.5


texts:
Like in NERDTREE for vim, is there a way to list certain file types to be ignored (not displayed) by neotree ? for instance:

*.cs.meta


texts: Search for file content with swiper-all or similar interface

texts: I've been using swiper-all to search for content in buffers. This works really great as I easily can navigate between the files and select the ones I want to work with. Is there some way I can use a similar interface to search in files on disk. E.g. recursively in current directory.


texts:
I am looking for a way to count regexp matches across all buffers.

count-matches can count in current buffer. How to count across all buffers?


texts: Wanted: vim-like paste behavior from browse-kill-ring

texts:
When using the browse-kill-ring package to insert some text from the kill ring, the text always gets inserted before point.

This is not intuitive to vim users who are used to pasted text being inserted after the character to the right of point, as it is with the default evil/vim keybinding p (aka the evil-paste-after command).

I'd like to change browse-kill-ring's behavior so it acts more like vim (or evil-paste-after).

The following examples will illustrate what I mean.

Note: . in the examples designates the position of point.

Note: The example text inserted will always be XYZ

Before insert:
.abc

Current behavior after insert:
XYZ.abc

Desired behavior after insert:
aXY.Zbc

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

Before insert:
a.bc

Current behavior after insert:
aXYZ.bc

Desired behavior after insert:
abXY.Zc

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

Before insert:
ab.c

Current behavior after insert:
abXYZ.c

Desired behavior after insert:
abcXY.Z

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

Before insert:
.

Current behavior after insert:
XY.Z

Desired behavior after insert (same -- no change needed):
XY.Z


texts: Can I know whether the current window is selected during a modeline update

texts:
Is there a way for the code inside of an :eval form in the modeline format spec to determine whether the modeline will be drawn with the active or inactive face? I'd like part of the modeline to display differently based on whether its active or inactive. I speciafically don't want to use advice, since the code will end up being used in a package.

(eq (get-buffer-window) (selected-window)) always returns true from the code run in mode-line-format, so that doesn't seem to do the trick. I also tried adding a hook to buffer-list-change-hook as suggested by the manual, but that doesn't do; somehow some updates are missed.

Is there a way to check from the :eval portion of a modeline format spec whether the window is selected?`

(Based on the following code I'll bet no, but I'd love to be proven wrong:)

  Lisp_Object old_selected_window = selected_window;
  Lisp_Object old_selected_frame = selected_frame;
  Lisp_Object new_frame = w->frame;
  Lisp_Object old_frame_selected_window = XFRAME (new_frame)->selected_window;
  int n = 0;

  selected_frame = new_frame;
  /* FIXME: If we were to allow the mode-line's computation changing the buffer
     or window's point, then we'd need select_window_1 here as well.  */
  XSETWINDOW (selected_window, w);
  XFRAME (new_frame)->selected_window = selected_window;

  /* These will be set while the mode line specs are processed.  */
  line_number_displayed = false;
  w->column_number_displayed = -1;

  if (WINDOW_WANTS_MODELINE_P (w))
    {
      struct window *sel_w = XWINDOW (old_selected_window);

      /* Select mode line face based on the real selected window.  */
      display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w),
             BVAR (current_buffer, mode_line_format));
      ++n;
    }


texts: What methods are available for complex user input?

texts:
I am experimenting with writing a plugin which requires quite a bit of user input, its a front end to an api.

A typical request will have 4 required inputs and many optional inputs, obviously I can use interactive how ever that's less than ideal because you would have to hit enter on all the optional's to complete the interaction.

What other options do I have perhaps a buffer with input fields would be an option ? not sure what I would search for to achieve that ? or what are my other options ?


texts: Change escape behavior when inside LaTeX equations

texts:
I recently wrote a function which could cycle through LaTeX math delimiters. It relies on the texmathp function, built into AucTeX, which will return t if the point is inside an equation region. In addition, I use the texmathp-why function in order to determine what the math environment is (which was important to answering the posed question).

However, it was pointed out by the asker that the function does not work when the point is inside \text{} inside the equation (which I assume is intentional behavior within AucTeX). Is there a simple way to avoid this escape, or should I write a work around in the function to account for this?


texts: How to manipulate clock times (org-mode)

texts:
I often forget either to clock out of a task, or to clock a different activity in.

For instance, I was working on a (clocked) task right now, then my manager walked in and we embarked on a discussion which lasted a good 40 minutes... So not negligible.

What is the best way to go about this? I would like - if possible - to subtract the time of this discussion from the main task I was working on, and add it to a new activity.


texts: How to permanently change the default spelling dictionary?

texts:
In Aquamacs, the Emacs for macs, the dictionary can be changed in the Menu by going to Edit -> Spelling -> Change Dictionary...

In my case, I enter en_GB. How do I avoid doing this for every file again every time I open it? Where can I set this permanently as the default for all files?

I suppose I need to add a line in Preferences.el - but which one?

Neither of these two lines work

(setq ispell-dictionary "en_GB")

(setq ispell-dictionary "british")


texts: How to save a copy of a buffer to a file?

texts:
I would like to be able to save a copy (or a snapshot) of a buffer into a file. The behavior would be similar to write-file, except that it would not set the buffer to visit this file.

For a usecase, imagine that you have a shell session, and you want to quickly save it all into a log file. The buffer should not be renamed (so that functions relying on the buffer name still work), and it should not be visiting a file (so that the file is not accidentally overwritten, and there is no warning when exitting emacs).

I can imagine a few dirty ways of doing this, I will post one as a self-answer, but reading from the manual, the whole "visited file" system is more complicated than it looks, and I guess it is easy to draft a wrong solution. Is there a hidden, built-in, way of achieving this?


texts: Emacs 25 png background transparency issue and sluggish init

texts:
I have just upgraded to Emacs 25 (windows 32-bit version on Windows 10), and found out that there are still quite a few things to smooth out.
One includes potentially the PNG background not being transparent.
On Emacs 25:

On Emacs 24:

Or is it just me due to my settings? By the way they're using the same .emacs init file.

Oh, also my Emacs 24 starts in about 5 seconds, while the new Emacs 25 takes about 8 seconds.

Hope there can be some tips from members here. Thanks in advance.


texts: Detect variable use in an elisp function at run time

texts:
I try to understand a piece of elisp source code, with many nested and conditional functions calls, and I would like to know if a particular variable is used (and, if so, where in the code) at run time under various conditions/scenarios.

"used" does not only mean assigned a value but for instance printed ou used to evaluate an expression.

Is there a way to detect this variable use at run time, for instance with the debugger.


texts: org-capture: Capture abort: Wrong type argument: stringp, org-main-file

texts:
I know this error has come up here before, but none of the answers thus far have been able to help me and no amount of googling has got me anywhere. I've been using org-capture-templates for quite a long while now successfully, but recently (last 2 weeks, I guess), I've been getting this error message on most - BUT NOT ALL - of the capture templates. I have tried all sorts of things to troubleshoot it, including turning on debug, using literal file paths, alternate targets, alternate templates and nothing is working.
My org config is as follows:
(setq org-directory "~/Documents/org-files"
      org-main-file "~/Documents/org-files/Main.org"
      org-personal-file "~/Documents/org-files/Personal.org"
      org-default-notes-file "~/Documents/org-files/Main.org"
      org-agenda-files '(org-main-file org-personal-file))

(setq org-capture-templates
      '(("t" "Todo" entry (file+headline org-main-file "Inbox")
         "* TODO %? %^G")
        ("d" "Todo with deadline" entry (file+headline org-main-file "Inbox")
         "* TODO %? %^G DEADLINE:%^t")
        ("s" "Scheduled Todo" entry (file+headline org-main-file "Inbox")
         "* TODO %? %^G SCHEDULED:%^t")
        ("p" "Project" entry (file+headline org-main-file "Projects")
         "* NEW %? %^G :PROPERTIES: :STATE: %^{STATE} :PM: %^{PM} :END:")
        ("i" "Idea" entry (file+headline org-main-file "Incubator")
         "* IDEA %? %^G")
        ("j" "Journal" entry (file+olp+datetree org-personal-file "Journal")
         "** %U %?")
        ("w" "Work Journal" entry (file+olp+datetree org-main-file "Journal")
         "* %U\n %?")
        ("f" "Follow Up" entry (file+headline org-main-file "Inbox")
         "** FOLLOW UP %? %^G :PROPERTIES: :ASSIGNEE: %^{ASSIGNEE} :END:")))

All of the above templates were working a few weeks ago and now only the 'Work Journal' and 'Journal' templates are operational. I tried creating additional templates exactly like the Work Journal template (with a different key and title), to no avail.
The debugger gives the following info, which I don't find to be very helpful.
Debugger entered--Lisp error: (error "Capture abort: Wrong type argument: stringp, org-m...")
  signal(error ("Capture abort: Wrong type argument: stringp, org-m..."))
  error("Capture abort: %s" "Wrong type argument: stringp, org-main-file")
  org-capture(nil)
  funcall-interactively(org-capture nil)
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

Can anyone please help me figure out what I'm doing wrong here?
MacOS Big Sur 11.1 | emacs 27.1 | Org v9.3


texts:
I'd like to use lab hub wrapper for handling mr/issues of my own custom gitlab server. When I open a pull-request using hub (github) it's works fine the git-commit-mode from magit, syntax highlight  working and C-c C-c / C-c C-k keybindings for commit/abort.

However for lab doens't works. Seems that I need setup something in my config to the MERGE_EDITMSG buffer can work. After opening a mr https://imgur.com/35evjI7.png using lab mr create. I cannot abort easily and there is no syntax highlight too.  To complete the commit it's necessary just C-x C-c, it's ok, but would be better to be consistent with the rest o magit stuff.

Reddit thread: https://www.reddit.com/r/emacs/comments/b2kfrw/support_emacs_magit_lab/


texts: Helm Find Files: prefer certain extensions

texts:
Helm find files lists files of the same name alphabetically.

a.aux
a.log
a.tex
b.aux
b.log
b.tex

This is annoying as I want the .tex file 99% of the time. Is it possible to prefer certain extensions (by white- or blacklist) to either change the order for extensions only:

a.tex (prefered)
a.aux
a.log
b.tex (prefered)
b.aux
b.log

, or even "surpassing" filename priority, like so:

a.tex (prefered)
b.tex (prefered)
a.aux
a.log
b.aux
b.log


texts: How to change event color face in emacs-calfw?

texts:
I have tried to change the default color faces of emacs-calfw, but I can't change the color of the event in date box.

I can change the header color, grid color, button color, but how to change the event color (pointed by arrow)

This is my code

(defun my-calendar ()
  (interactive)
  (let ((buf (get-buffer "*cfw-calendar*")))
    (if buf
        (pop-to-buffer buf nil)
      (cfw:open-calendar-buffer
       :contents-sources
       (list (cfw:org-create-source "Dark Blue")
             (cfw:cal-create-source "Dark Orange"))
       :view 'two-weeks))))

(use-package calfw
  :bind ("C-c A" . my-calendar)
  :init
  (progn
    (use-package calfw-cal)
    (use-package calfw-org)
    (use-package calfw-ical)
    :config
    (progn
      (bind-key "g" 'cfw:refresh-calendar-buffer cfw:calendar-mode-map)
      (custom-set-faces
       '(cfw:face-title ((t (:foreground "#f0dfaf" :weight bold :height 2.0 :inherit variable-pitch))))
       '(cfw:face-header ((t (:foreground "#d0bf8f" :weight bold))))
       '(cfw:face-sunday ((t :foreground "#cc9393" :weight bold)))
       '(cfw:face-saturday ((t :foreground "8cd0d3"  :weight bold)))
       '(cfw:face-holiday ((t :background "grey10" :foreground "#8c5353" :weight bold)))
       '(cfw:face-grid ((t :foreground "#BADEAC")))
       '(cfw:face-default-content ((t :foreground "#ffffff")))
       '(cfw:face-periods ((t :foreground "#ffe259"))) ;;?
       '(cfw:face-day-title ((t :background "grey10"))) ;; rectangle in header
       '(cfw:face-default-day ((t :foreground "#ffffff" :weight bold :inherit cfw:face-day-title)))
       '(cfw:face-annotation ((t :foreground "#ffffff" :inherit cfw:face-day-title))) ;; data number in box(23 - 24)
       '(cfw:face-disable ((t :foreground "DarkGray" :inherit cfw:face-day-title)))
       '(cfw:face-today-title ((t :background "#7f9f7f" :weight bold)))
       '(cfw:face-today ((t :background: "grey10" :weight bold)))
       '(cfw:face-select ((t :background "#2f2f2f")))
       '(cfw:face-toolbar ((t :foreground "Steelblue4" :background "#3F3F3F")))
       '(cfw:face-toolbar-button-off ((t :foreground "#f5f5f5" :weight bold))) ;;top botton
       '(cfw:face-toolbar-button-on ((t :foreground "#ffffff" :weight bold)))))))


texts: Automatically installing a built-in package from MELPA

texts:
This post is asking this question more clearly and concisely.

My code contains the following function to install dependencies:

(defun literef-install-packages()
  "Install any missing packages. The code is taken from
`https://stackoverflow.com/a/10093312/2725810'."

  (setq package-list '(org org-ref pdf-tools smooth-scrolling company))

                    ; list the repositories containing them
  (setq package-archives '(("elpa" . "http://tromey.com/elpa/")
               ("gnu" . "http://elpa.gnu.org/packages/")
               ("marmalade" . "http://marmalade-repo.org/packages/")
               ("melpa" . "http://melpa.milkbox.net/packages/")))
  (package-initialize)
  (unless package-archive-contents
    (package-refresh-contents))

  (dolist (package package-list)
    (unless (eq (package-installed-p package) t)
      (when
      (yes-or-no-p (concat
            "The package " (symbol-name package)
            " is not installed. Install it? "))
    (package-install package)
    (when (eq package 'pdf-tools) (pdf-tools-install))))))

This code installs all the required packages besides org, whose earlier (compared to the version in MELPA) version is built-in. In particular, when I try to evaluate (package-install 'org), I get the message saying that the package is already installed. How do I get around this problem?


texts:
I wanted to bind M-n to transpose-chars in evil insert state, and tried
(define-key evil-insert-state-map "M-n" 'transpose-chars)
But that didn't work. What should I do?


texts: Getting operation not permitted when trying to open projects or use integrated terminal in emacs-doom

texts:
While using MacOS Catalina (which is suspect is the problem) I recently decided to try emacs, as a recommendation from a friend. I finally get it working and generally figure it out and now when trying to open a project or even trying to ls my Downloads or Documents folder I get an operation not permitted error. I have checked my user (whoami) which the user has permission to run the commands, and I have granted full disk access to all emacs applications I could find, yet to no avail.

UPDATE:
Got it working by running csrutil disable in recovery mode (yes I understand what the effects of this are), however I still have this error:

Any idea how to resolve this? The only way I can add files to the current project is by using :edit FILENAME however I can edit the files just fine, and can run find . in any folder using the integrated terminal.


texts: Custom behavior for cursor-in-non-selected-windows on first line

texts:
I like the hollow option because I know where the cursor is when I switch windows. I use ace-window to change windows. My problem is the ace character is difficult to read when the hollow cursor is on the first character and first line of the frame. Is there any good way to change cursor-in-non-selected-windows to nil when the cursor is on the first char of the first line.

(setq-default cursor-in-non-selected-windows 'hollow)


texts:
I'm using global-whitespace-mode with a particular whitespace-style as a default for all modes. How can I disable whitespace-mode completely for a single mode, eg. incoming email?

I tried the following, but I still get all the default whitespace styles when looking at incoming email.

(global-whitespace-mode)
(setq whitespace-style '(face trailing lines tabs big-indent))
(add-hook 'rmail-mode-hook '(whitespace-mode 0))


texts: extraneous stars when using org-indent-mode

texts:
Since a recent update from the org-mode repository, if I turn on org-indent-mode, all lines show up indented with stars rather than spaces.  Here's an example of how it looks:

Here's the file without indenting:

I am using Emacs 24.4.1 on Linux.

Do you know what may be causing this?


texts: How can I include variable values in tangled files?

texts:
I have a variable defined in my heading that I would like to use in one text source block that I tangle to a file.

Example:

* Test
:PROPERTIES:
:header-args:  :var foo=222
:END:

... use foo in some shell scripts ...

#+BEGIN_SRC text :tangle config-file
I want to include value of FOO here
#+END_SRC


texts: Clearing the Contents of an Org-Mode Header Programmatically?

texts:
If we have

* Header 1
Some contents.

Is there a way to programmatically kill the contents of Header 1 so that it remains like:

* Header 1

?


texts:
After doing a helm-ag search there is an option to 'save results in buffer'. My issue is that the result buffer disappears if another buffer or file is opened.

Is there some way to prevent the buffer from disappearing?
Or is there some generic way of saving a buffer to the buffer list?

Note that saving the buffer to a file is not an option for me, nor is using helm-resume (in stead of the buffer).


texts: Orgmode automatically increment an unordered list

texts:
I use org-mode for planning projects and tasks, etc. Say I am reading a book and I want to track my progress chapter by chapter. I want to create a list of repetitive elements with an incremented number like:

- [ ] chapter 1
- [ ] chapter 2
- [ ] chapter 3
...

Now, instead of typing out the incremented numbers each time, is there a way to just type the first entry, like - [ ] chapter 1 and then have org-mode complete n additional entries. So if a book has 10 chapters, then orgmode would increment the entry 10 times?

So I was just wondering if there is a way to do this in orgmode or a different package to use, etc? Note that I use Spacemacs.


texts: Force using fixed-width font in org-mode

texts:
What's the simplest way of forcing Emacs org-mode to use the same fixed-width Font Family and Height everywhere (but keeping other properties distinct, like Foreground)?

I could make all org-level-n faces inherit from fixed-pitch, or make variable-pitch actually reference a fixed-width font, for instance, but that would be cumbersome, I guess.

Thanks in advance.


texts: Alternative to save-excursion that only saves/restores point?

texts:
Q: is there an alternative to save-excursion that only saves/restores point?

When writing elisp functions, I often need to save point, do some stuff in the current buffer, and then restore point.  I had always used save-excursion for doing so, but the docstring notes that it will:

  Save point, mark, and current buffer; execute BODY; restore those things.
  Executes BODY just like progn.
  The values of point, mark and the current buffer are restored
  even in case of abnormal exit (throw or error).
  The state of activation of the mark is also restored.

Now: that seems like overkill if all I care about is point and I'm not touching (or otherwise don't care about) the mark and current buffer.  In the absence of something like save-point, I wrote the following macro:

(defmacro save-point (&rest body)
  (cl-declare (debug t) (indent 0))
  (let ((orig (cl-gensym)))
    `(let ((,orig (point-marker)))
       (unwind-protect
           (progn ,@body)
         (goto-char ,orig)))))

save-excursion is written in C, so it wasn't a priori clear that this macro would be faster than the C code despite saving and restoring fewer objects.  And, in fact, it's about an order of magnitude slower:

(benchmark-run-compiled 1000
  (save-point t))                   ; => .0005ish

(benchmark-run-compiled 1000
  (save-excursion t))               ; => .00005ish

It currently looks like the macro is a fool's errand.  So:

Does something like this save-point macro already exist?
How could one streamline this macro to speed it up?
Is there any way to make up the speed difference between the C code and the elisp code?


texts:
I would like tabs like firefox but for emacs.

I found this: http://emacswiki.org/emacs/TabBarMode

But it just add to each buffer (window in Emacs terminology) a bar that shows currently open buffers.

I would like a tab to be able to hold multiple buffers (windows in Emacs teminology), which I can split as desired.  I.e. each tab should correspond to a "window state" (in the sense of window-state-get).

I'd have one tab for my tasks, another for code, another for web-reading etc..

Is this possible? Can tabbar be tailored to do this?

[edit2]
This question has attracted more attention than I anticipated.
It looks like there is a solution, but one that would require a bit of research and tweaking.
While this/next week are a bit busy for me, I will parse through the answers and will try to build something that works and then I'll edit this question to reflect my findings. Please hold on =)

[edit]
Sort of similar to :
https://stackoverflow.com/questions/24157754/make-frames-in-emacs-gui-behaves-like-frames-in-terminal

I would settle with multiple frames in a single GUI session also.


texts: Dynamic generation of varlist in a let form

texts:
Let's say I have a let form and I want to generate the varlist
dynamically from another function. Something like this:

(let ((x 1)
      (y 2)
      (the-dyn-gen))
  body...
  )

I have some local vars already in the varlist namely x and y. But I want to call a function that I called the-dyn-gen which returns a list like this '((a 3) (b 4)) now I need to make these sub lists (a 3) & (b 3)  part of the varlist.
Is this possible?


texts: Label and reference LaTeX equations in org-mode

texts:
This is similar to Org export to latex and HTML references, but for equations.

I like to use LaTeX math snippets in my org-files, as in

* The Quadratic Equation
The roots of $ax^2 + bx + c$ are given by
\begin{equation}
\label{eq:1}
x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}
\end{equation}

According to Equation \ref{eq:1}, ...

When I export to LaTeX, the \ref{eq:1} correctly turns into a hyper link to the equation. But I want to achieve the following additional behavior:

Inside the org file, I can click the text \ref{eq:1} (the text doesn't have to be \ref{eq:1}, I just want a hyperlink) and be taken to to the equation. This functionality is present for headers, as in [[The Quadratic Equation]] becomes clickable in Org mode.
When I export to HTML, I want to the references to be kept (actually, the label (1) doesn't even show up in HTML export).

Is there a way to accomplish this?