texts: Is there keyboard shortcut for changing DEADLINE warning date?

texts:
In org-mode, warning date for a TODO's DEADLINE can be designated by giving the - date.
For example,

DEADLINE: <2004-02-29 Sun -5d>

Is there any keyboard shortcut for changing this warning date descriptor?
Because, my current operation for changing this descriptor would be to
move the cursor into the timestamp and to edit it manually; it can be better, I think...


texts: How do you recompile an .el source file and make it active in my current session

texts:
I have been writing some elisp code, current i have to open the file edit quit and reload emacs seems there must be a better way ?

I know i can recompile the current file but that does not seem to make my changes active with in emacs until i restart is there something else i should be doing to make emacs use the new compiled file ?


texts: Define a function alias within a let binding?

texts:
How can I define an alias within a script with let-binding?
I tried

(let (b-s)
  (defalias 'b-s 'buffer-string))

But it doesn't work.

I figured out to let-bind the variable where aliases as stored in, but I've not been able to find it.


texts:
IntelliJ has a nice feature in the overview of the staged area, where you can make changes to the files in the staging area while having the diff overview. In the Magit overview of staged changes I would also like to make changes. Is this possible?

How can I make changes to files in a view where I see the diff?


texts: How to get rainbow-delimiters/rainbow-blocks to highlight in-line math in LaTeX equations

texts:
I'm using spacemacs with AUCTeX for LaTeX editing and would like to make rainbow-delimiters and/or rainbow-blocks highlight LaTeX math equations. Unfortunately this only works partly, i.e., some equations get highlighted and some don't:

In the example screenshot, in-line math enclosed in $ does not get highlighted while the rest - including in-line math enclosed in \(...\) - does.

With rainbow-blocks it gets worse, as it will sometimes work in one place of the document and sometimes won't work regardless of scope.

Q: Does anyone know why this happens or how to get rainbow-blocks working for in-line math in LaTeX? Are there any working alternatives?


texts: Emacs lisp forward-sexp: Scan error: "Containing expression ends prematurely"

texts:
When writing Emacs Lisp code, I use forward-sexp (C-M-right) and backward-sexp (C-M-left) to navigate the buffer. However, in some cases these functions stops with error like:

  forward-sexp: Scan error: "Containing expression ends prematurely"

Here is an example:

(defun my-test1()
  (message "ok1"))

(defun my-test2()
  (message "ok2"))

If cursor is on the first (, pressing C-M-right twice works fine. However, if cursor is on the first d (in defun), pressing C-M-right five times results in the error. Instead of the error, I would like to move further down the buffer to the next defun that is to the start of the line (defun my-test2()..


texts: How to install evil-snipe-enable-alternate-f-and-t-behaviors on Spacemacs?

texts:
I am trying to install "evil-snipe" with evil-snipe-enable-alternate-f-and-t-behaviors on Spacemacs.

The instruction on https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Bvim/evil-snipe are a bit vague.

evil-snipe-enable-alternate-f-and-t-behaviors should be set to 't'.
This is in my .spacemacs file:

...
dotspacemacs-configuration-layers
'(
  evil-snipe
...
(defun dotspacemacs/user-config ()
...
(setq-default dotspacemacs-configuration-layers
          '((evil-snipe :variables evil-snipe-enable-alternate-f-and-t-behaviors t)))
...
 '(package-selected-packages
   (quote
    (evil-snipe
...

And restarted Spacemacs.

But evil-snipe-enable-alternate-f-and-t-behaviors is nil, when I needs to be t.
SPC h d v (describe variable) evil-snipe-enable-alternate-f-and-t-behaviors:

evil-snipe-enable-alternate-f-and-t-behaviors is a variable defined in ‘config.el’.
Its value is nil

Documentation:
if non nil f/F/t/T behaviors are replaced by evil-snipe behavior.

I am using Emacs 25.2.1 with Evil Spacemacs and Ivy on Linux.


texts:
I would like to improve my notes capture flow to do the following:

Use C-c c then n to create a note.
Get a minibuffer that searches for an existing file to add the note to (ie. probably with helm), and creates a new file if the supplied file name doesn't exist.
Then resuming my typical capture flow.

My current config handles 1 and 3, but not 2.

  (setq org-capture-templates
  (quote
   (("l" "link" entry
     (file+headline "~/org/notes/links.org" "Buffer")
     "* %^L")
    (...)))


texts: When Emacs loads variable customization?

texts:
I have a minor mode that declare a customizable variable as its keymap prefix:

(defcustom mymode-keymap-prefix "C-c *"
  "Prefix for `mymode-mode'."
  :group 'mymode)

(defvar mymode-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd mymode-keymap-prefix) some-mymode-command-map)
    map))

(define-minor-mode mymode-mode
  "Mymode."
  nil
  " mymode"
  mymode-mode-map
  :group 'mymode)

In my init.el somewhere I have (require 'mymode-mode). I want to make this keymap prefix customizable for user.
This customization must be done before mode is loaded, after that it's too late, mode keymap is already made.
I've tried to open customization buffer with customize-variable mymode-keymap-prefix and change it but it doesn't work in my case.
When I query the variable after all is loaded it really have value I've put in it but my mode keymap still starts with old prefix as if nothing had happened.
Only approach that work for me is to put (setq mymode-keymap-prefix <new_value>) before (require 'mymode-mode) in init.el.


texts: Is there a way to have a minibuffer window for each window? I don't want recursive minibuffers, just one per window so that I don't have to look to the bottom of the screen when editing a window placed near the top.


texts: Is using cl-lib crucial for writing good Emacs Lisp code?

texts: As a beginner I understand that including cl-lib will allow me to use some code from Common Lisp. However, whenever I see this included in elisp code I wonder again, Should I really start with Common Lisp, then learn elisp? Is cl-lib giving elisp Common Lisp a common (or desirable) occurrence in best-practice elisp coding? I guess I'm looking also for "best practice" guidance here. But then "best practice" questions can be interpreted either way: as legitimate stackexchange-compliant question, or as a matter of opinion.


texts: erc-mode : how to hide alerts when users join/leave a channel

texts: I just began using erc-mode and I noticed that erc-mode alerts whenever people join or leave a channel. Is there a way I can somehow hide the alerts ?


texts: ido-find-file: lists of results in wrong order

texts:
When using C-x C-f (ido-find-file) to open files use I can use M-s to enable fuzzy matching.

If I type C-x C-f then M-s and then enter the the fuzzy search string, things work as they should.

However if I type C-x C-f then enter the fuzzy string and then type M-s I get something like this in the minibuffer:

  my-fuzzy-search[correct-completion]{some-totally-unrelated-file |
  correct-completion | ... }

Some unrelated file is always first in the list of results, and if I press enter here ido will open it. Is there a way to configure ido so that the correct match will be first in the list in this case?


texts: I re-installed Emacs and I tried to change the color theme. I saved the changes and the .emacs file was updated but when I restarted Emacs the theme was not active! I want to point out that the package is installed in the elpa folder. The theme was loaded when I pressed it and took effect but it was not working after the restart. When I did the same for the custom themes they were working fine. I had used the same theme previously with no problem. Also the problem is not because of the theme as I tried to install more with no success. What is the problem?


texts:
I just noticed that Emacs will trim a very big file before saving it. I opened a 4.6 GB file (not the best thing to do, but anyway) and after saving, the file was trimmed to around 375 MB. It didn't warn me about the file size, trimming or anything. I'm using Emacs 22.1.1 for Mac.

Is this default behavior (I definitely hope not) or a bug?


texts: Inconsistent hash indentation in ruby-mode

texts:
I've noticed that indent-region behaves this way in ruby-mode:

  {
    down_payment: 40.00,
    payment_day: 10
  }

  {
    "down_payment": 40.00,
   "payment_day": 10
  }

Both are valid Ruby hashes, so in principle they should behave the same way. My config for Ruby is:

(set-indent 2)
(setq ruby-deep-indent-paren nil)

Is there some configuration variable that I missed or misconfigured?


texts: How to suppress emacsclient --eval output

texts:
I am opening a file as follows:
$ emacsclient -qt -e '(progn (find-file "'filename.py'"))'
#<buffer filename.py>

which outputs #<buffer filename.py> in the terminal. Is it possible to suppress that output?

I have tried following which didn't help.
$ emacsclient -qt -e '(progn (find-file "'Driver.py'"))' 2> /dev/null


texts: How does AUCTeX determine the documentclass?

texts:
It's clear that AUCTeX has some way of determining the documentclass, since some functions behave differently depending on which documentclass is selected.  For example, LaTeX-insert-item behaves differently when the documentclass is beamer.

I'm writing some custom code that needs to test what the documentclass is.  Obviously, I could roll my own code to do this, but I'd prefer to use the same functionality as AUCTeX.  Is there a function or variable in AUCTeX that contains this information?  I looked, but did not find anything.

Thanks!


texts: Custom paragraph-start and paragraph-separate for editing *.srt files

texts:
I'm having some trouble coming up with regular expressions for variables paragraph-start and paragraph-separate to do what I want (to be defined shortly). I'm editing *.srt files (subtitles for school lectures) and trying to set my variables so that M - } and M - { take me up and back one block of text for editing. The file has the following format:
1
00:00:16,040 --> 00:00:23,130
Some text here that marks the beginning       <--
of a block.

2
00:00:23,390 --> 00:00:28,230
(Speaker): And some more                      <--

3
00:00:28,230 --> 00:00:32,350
text here that also marks the                 <--
beginning of another block. There
could be multiple sentences in here.

I want to set variables paragraph-start and paragraph-separate in such a way that M-{ and M-} (paragraph back and forward) take me between the beginning of the lines marked with <--.
I tried to set paragraph-separate to ".*-->.*" (since the arrow never appears in the subtitles text) and paragraph-start to match any after this line, but M-} always seems to place me on the timestamps line (the one including the -->), although I want to go to the line after it.
Any ideas what I'm doing wrong and how I can set the variables paragraph-start and paragraph-separate appropriately?


texts:
In many many Gnus screenshots, I see this kind of presentation for the Group buffer:

[groupname1 -- 3]
    2: subgroupname1
    1: subgroupname2
[groupname2 -- 6]
    6: subgroupname1
    0: subgroupname2

(ex: http://zarb.org/~gc/img/gnus-screenshot-1.png or http://ostatic.com/files/images/Gnus-%5B2%5D.jpg)

I want to set this up but I do not know how or where to search.
Do you have any clue how to reach this result ?


texts: How do I retrieve the machine's hostname?

texts: I'm currently hacking on an elisp IRC bot and have a section of code that I want to enable only when it's run on a remote machine with a specific hostname.  However, I couldn't find any premade function to retrieve the machine's hostname.  Eventually I settled for (shell-command-to-string "uname -n"), but this feels wrong and will certainly not work on other operating systems.  Is there anything better suited for this task?


texts: eval-expression that shows the current character

texts:
What is the correct eval expression which shows the current character in the message area?

I tried the following but they don't work.

(message (char-after))
(message '(char-after))
(message 'char-after)
(message char-after)


texts: insert cursor postion in org-structure-template-alist

texts:
It's easy to insert source code template in org 9.1 by

it is configured as

("s" "#+BEGIN_SRC ?\n#+END_SRC")

Of them, ? for cursor position,

unfortunately, it does not work in 9.2

Custormize org-structure-template-alist

org-structure-template-alist

("s" . "src ?\n")

it is dsplayed as:

#+begin_src ?\n
#+end_src

How could get the ? work properly as cursor position?


texts: How to define an org-mode "#+" type keyword?

texts:
I apologise if this has already been asked but I have no idea what are the "#+XYZ" commands in org-mode even called, tags? keywords? macros? I have a private Latex class whose usual header looks like this,

\documentclass{homework}

\author{Musa Al`Khwarizmi}
\class{CS 3141: Prof. Kamil's Algorithm Analysis}
\date{\today}
\title{Homework Class Test}
\address{Bayt El-Hikmah}

I wanted to use it with org-mode and setup everything and tested with this document header,

#+LATEX_CLASS: homework
#+AUTHOR: Musa Al`Khwarizmi
#+CLASS: CS 3141: Prof. Kamil's Algorithm Analysis
#+DATE: \today
#+TITLE: Homework in Org-mode
#+ADDRESS: Bayt El-Hikmah

It got me this Latex document,

% Created 2020-06-14 Sun 20:17
% Intended LaTeX compiler: xelatex
\documentclass{homework}
\author{Musa Al`Khwarizmi}
\date{\today}
\title{Homework in Org-mode}

How can I make the #+CLASS: and #+ADDRESS: work so \class{...} and \address{...} are also included in the Latex document?


texts:
Background
I'm writing a presentation mode for Emacs. I'd like the input to be org files, as org files are great for data.
Problem
I have to convert the org mode file into a list of "slide" data structures that I can iterate through. To do this, I'd like to take something like the following org-mode file:
* this is the first headline, with a title property and no contents
* this is the second headline, with contents
- dash list nested under the second headline
  - further nested
** nested headline

and be able to walk it. I've tried (org-element-parse-buffer), and that does give me a list of elements, but it's hard to figure out how to walk further in them. For example, calling (org-element-map (org-element-parse-buffer) 'headline #'identity) gives a list of three elements; the last one represents the "nested headline". I want "nested headline" to be a child of "this is the second headline, with contents".
Avoiding the XY problem
I'm certainly open to other ways of converting an org-mode file into an Elisp data structure. I don't think org-export is the right tool for me, because I don't want to end up with a new file containing the results, but a data structure I can iterate through. My naive way is something like "give me all the top-level headlines, and then I can get their properties and contained elements (e.g., plain text or nested lists -- whether further headlines or dash lists)".


texts:
If I try to change input method in emacs and send to some text.

buffer is read only message is shown in minibuffer.

How can I use other input method in emacs term mode?

I'm using emacs multi-term.


texts:
I am trying to match $$ resp $ pairs to switch into latex-mode via polymode in a markdown file. $$ is the delimiter for displayed math in this case and $ for inline math.

I know that this is not a good choice for delimiters because they are symmetric. However latex-mode itself i.e. when editing an usual latex-document just recognizes those pairs very well.

So is there any good regular expression I can use in my code below instead of just looking for $$ resp. $?

(require 'polymode)

(defcustom pm-host/markd
  (pm-bchunkmode "Markd"
                 :mode 'markdown-mode)
  "Markdown host chunkmode"
  :group 'hostmodes
  :type 'object)

(defcustom pm-inner/latex
  (pm-hbtchunkmode "latex"
           :mode 'latex-mode
           :head-reg  "\\$\\$\\|\\$"
           :tail-reg  "\\$\\$\\|\\$")
  "latex typical chunk."
  :group 'innermodes
  :type 'object)

(defcustom pm-poly/markdown-latex
  (pm-polymode-one "markdown-latex"
           :hostmode 'pm-host/markd
           :innermode 'pm-inner/latex)
  "markdown-python typical polymode."
  :group 'polymodes
  :type 'object)

(define-polymode poly-markdown+latex-mode pm-poly/markdown-latex)
(add-to-list 'auto-mode-alist '("\\.mdwn\\'" . poly-markdown+latex-mode))


texts: Why is cloning of file buffers prohibited?

texts:
Why does clone-buffer not work on file buffers.

I can make it work by the following advice:

(advice-add 'clone-buffer :around
  (lambda (oldfun &rest args)
     "Allow cloning file buffers."
     (interactive "bName of new cloned buffer: ")
     (let (buffer-file-name)
       (apply oldfun args))))

The clone is a non-file buffer. One can modify it and save it into a new file with save-buffer.

Everything is working quite fine. So why does the original command clone-buffer test whether the current buffer is a file buffer and disallow cloning in that case?

My current best guess for the motivation of the restriction:
The change from a file buffer to a non-file buffer is quite hard.

Examples:

Version control like vc-git does not work anymore.
compile-command compiles the original buffer file and not the clone


texts: Emacs implements an interpreter for elisp in C which serves as the de facto reference implementation. Are there any other implementations of elisp in other languages (particularly Javascript)?  What is a minimal set of primitives necessary to fully reimplement elisp?  What are the essential difficulties in doing so (e.g. dynamic scoping)?


texts: Emacs shell and telnet buffer auto jumps to end of buffer while browsing buffer contents

texts:
Was recently required to update to RHEL 7.x and with that came a newer release of Emacs (24.3.1).

With emacs I am a big user of shells and telnet sessions within emacs so that I can easily browse the data.  Have noticed with the newer emacs release that if there are updates to the shell or telnet buffers in emacs while I am browsing the data that my cursor automatically jumps to the end of the buffer vs. allowing me to continue browsing the shell while the new data collects at the end of the buffer.

Is there a method of disabling this automatic jump to the end of the buffer functionality via the emacs init file or any other means?


texts:
Is there a way to customize vc-next-action C-x v v so that it opens a URL on success?

I am using SVN and after each commit, I have to open manually a trac URL with the rev number. For example: http://server/trac/changeset/138258/project

I tried C-u C-x v v but without success.

Or is there an even better way to deal with SVN from Emacs?

Thanks.


texts:
So, at this point my .emacs.d and files with it is older than a lot of people reading this question, and with packages, version changes, packages that have gone obsolete, and so on. It's a mess.  It's time to declare emacs bankruptcy again.

So, with all the new features and such, what's the best way to get a fresh start?


texts: Splitting window vertically (rather than horizontally) when searching in Dired

texts:
My Emacs Dired window is wider than it is tall. After marking some files (say %m *.cpp) in Dired and running M-x dired-do-find-regexp <REGEXP> (A), I find myself in split-window-below (ex split-window-horizontally). I would like to split vertically (split-window-right) instead.

Neither setting

(setq split-width-threshold nil)

in my .emacs nor this suggestion work.

(Emacs 25.3.1 on macOS)


texts: Is there a general way to 'expand' a list for to be used as individual arguments to another function?

texts:
For example, say I have a list of strings L, perhaps from an &rest argument.  What can I do to L that would have the same effect as the following?

(concat (first L) (second L) ... (last L))

(I know mapconcat would work here for this example, but I'm looking for a general process.)


texts: How can I install Emacs25.2 on openSuse?

texts:
On Ubuntu I would install emacs dependencies with apt-get build-dep emacs24, extract the emacs25.2.tar.gz and install but the dependencies don't seem to be on openSuse's zypper (package manager).

Atm I'm getting this when trying to install emacs25.2

configure: error: You seem to be running X, but no X development libraries
were found.  You should install the relevant development files for X
and for the toolkit you want, such as Gtk+ or Motif.  Also make
sure you have development files for image handling, i.e.
tiff, gif, jpeg, png and xpm.
If you are sure you want Emacs compiled without X window support,   pass
 --without-x

How should I go about getting that dependency and other dependencies needed for emacs on openSuse?


texts: Add include paths to flycheck and to company-irony?

texts:
I am starting to develop a ROS (Robot Operating System) application for the first time using Emacs. Here is my ~/.emacs.d/init.el configuration for Flycheck and company packages:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Flycheck
;;;;;;;; Description: code linting (particularly C/C++ for me)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cc-mode)
(add-hook 'c++-mode-hook 'flycheck-mode)
(add-hook 'c-mode-hook 'flycheck-mode)
;; Check buffer on save, new line and immediately after anbling flycheck-mode
(setq flycheck-check-syntax-automatically '(mode-enabled save)) ;; new-line also possible
;; Add include paths
(add-hook 'c++-mode-hook
          (lambda () (setq flycheck-clang-include-path
                           (list (expand-file-name "/opt/ros/kinetic/include/")))))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; company-mode
;;;;;;;; Description: text completion framework
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'company)
;; Use company-mode in all buffers
(add-hook 'after-init-hook 'global-company-mode)
;; Use company-mode with Clang
(setq company-backends (delete 'company-semantic company-backends))
(set 'company-clang-arguments (list "-std=c++11")) ;; enable C++11 code completion

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Irony
;;;;;;;; Description: asynchronous completion capability for company-mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'c++-mode-hook 'irony-mode)
(add-hook 'c-mode-hook 'irony-mode)
(add-hook 'objc-mode-hook 'irony-mode)

(defun my-irony-mode-hook ()
  (define-key irony-mode-map [remap completion-at-point]
    'irony-completion-at-point-async)
  (define-key irony-mode-map [remap complete-symbol]
    'irony-completion-at-point-async))

(add-hook 'irony-mode-hook 'my-irony-mode-hook)
(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options)
;; Use comapny-mode with Irony
(add-hook 'irony-mode-hook 'company-irony-setup-begin-commands)
(setq company-backends (delete 'company-semantic company-backends))
;; Enable tab-completion with no delay
(setq company-idle-delay 0)
(define-key c-mode-base-map (kbd "<S-SPC>") 'company-complete)
;; Add support for completing C/C++ headers
(require 'company-irony-c-headers)
(eval-after-load 'company
  '(add-to-list
    'company-backends '(company-irony-c-headers company-irony)))
;;(add-to-list 'company-c-headers-path-system "/usr/include/c++/5.4.0/")
;; Integrate Irony with Flycheck
(eval-after-load 'flycheck
  '(add-hook 'flycheck-mode-hook #'flycheck-irony-setup))
;; Set cppcheck standard to C++11
(setq irony-additional-clang-options '("-std=c++11"))

My problem is that it seems like Flycheck is not recognizing where the ROS header files are located. On my system, they are all in /opt/ros/kinetic/include/ and I tried to include this path in the above code with the command:

;; Add include paths
(add-hook 'c++-mode-hook
          (lambda () (setq flycheck-clang-include-path
                           (list (expand-file-name "/opt/ros/kinetic/include/")))))

However, this seems to not fix things. I still get the error:

Please help me with an answer on the best practice of adding custom include paths for projects for both Flycheck and company-mode to use, with the include path in this particular case being /opt/ros/kinetic/include. Thank you!


texts: Which functions cannot be redefined after byte compilation?

texts:
Given a function that calls not:

(defun my-not (x)
  (not x))

M-x disassemble gives:

byte code for my-not:
  doc:   ...
  args: (arg1)
0       dup
1       not
2       return

I was surprised that this didn't do:

constant not
stack-ref 1
call 1

because otherwise I cannot redefine not and affect the original function.

I imagine this is done for performance. Which functions does apply to, and where it is it documented?


texts:
How do I find out if compilation was successful or not?

I would like to have a variable compilation-no-error set to true after successful compilation.

I looked at variables and functions starting with compilation-..., but I could not find a simple solution.


texts:
I just installed Emacs 25.1 for windows.
I want to modify the TODO keyword list, and I use this code:

 (setq org-todo-keywords
  '((sequence "TODO"
      "MAYBE"
      "NEXT"
      "STARTED"
      "WAITING"
      "DELEGATED"
      "|"
      "DONE"
      "DEFERRED"
      "CANCELLED")))

However, the TODO items keep cycling between the standard keywords.
Strangely enough, if I check the variable 'org-todo-keywords from within the customization buffer, I do see all the keywords I've defined.

Any hints on why the do not appear when cycling?


texts: Replace string in buffer programatically

texts: I'm writing some elisp code and would like to replace some string with some another string in a buffer. Which elisp function does that ? I did a search on documentation for the related function but all I'm getting is the interactive commands. Would love to see a sample code if possible.


texts: Recursive grep in directory with helm and/or projectile?

texts:
A recursive grep in a directory should be the simplest thing, but I haven't found the recipe to get it to work yet. I'm juggling between the following commands and am not sure which has the functionality buried within it:

helm-find-files: The problem is this is really bad at finding a directory recursively.
projectile-find-dir: This is great at finding the dir! However despite using helm complete you don't wind up in helm mode, so the C-u C-s command doesn't work here.
helm-find: gets the recursion right but targets files, not directories
helm-projectile-find-dir: Seems to be what I want.


texts: How to navigate to the next/previous python class?

texts:
I would like to navigate quickly between classes in Python code.
I'm looking for a command to go to the next / previous class so I
can bind that to a key sequence.  This question is not about
graphical navigation tools like treemacs.

It might be interesting to hear about things like hydras too, but
that's also not the focus of this question.


texts: How can I display any Unicode character in GUI Emacs for OS X?

texts:
I managed to make emacs dispaly any emoji in GUI Emacs for OS X thanks to the answer and comments here, but then I noticed I have other symbols that I can't display in Emacs like the because symbol "∵".

How can I set Emacs so that it can display any Unicode symbol?

I tried to set it so that it can display the because symbol in a new frame first by adding the snippet below to my init file, and it worked, but do I have to add a font-family for a specific symbol I found is not being displayed in Emacs one by one every time? I'm not even sure the new font family I just added, Arial Unicode MS, can display the rest of the unicode characters that emacs can't display by default.

(add-hook 'after-make-frame-functions 'my-set-font)
(defun my-set-font (frame)
  (interactive)

  (set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") frame 'prepend)
  (set-fontset-font t 'symbol (font-spec :family "Arial Unicode MS") frame 'prepend)

  )


texts: Jump to org-mode heading from external application

texts:
I want to create a URL that uses org-id to jump to its associated heading in Emacs org-mode.

I tried using:

org-protocol://org-id-goto?id=DC6BC674-8CE1-451D-A45F-05E09F1F743D

But this only opens Emacs with a blank *scratch* window. It does not actually navigate anywhere... am I missing something?

Also, I notice that each time I enter this link in my browser, I get a pop-up message, asking if I want to allow "Safari/Firefox/Chrome/Etc." to open Emacs. Is there anyway to disable this message for the future?


texts: Store/reuse value of element to `mode-line-format`

texts:
Q:  How to store/reuse the evaluated result of an element of the mode-line-format.

I am implementing a system within the mode-line-format that is similar to how flyspell.el handles deplacement-commands -- i.e., if this-command is eq to last-command and this-command is a member of the list of deplacement-commands, then skip the time-costly function(s).  I am storing the values for this-command and last-command in variables by way of the pre-command-hook, because those values could not reliably be used otherwise at the time the mode-line-format is evaluated during redisplay -- i.e., this-command and last-command have short life expetencies.

The following code was developed in a related thread for alphabetizing the minor-mode-alist:  Sort minor-mode-alist alphabetically (in the mode-line) using :lighter  However, it is too slow for rapid-fire repetitive commands such as previous-line, next-line, left-char and right-char.

When "this-command is eq to last-command and this-command is a member of the list of deplacement-commands", I would like to use the previous stored value for the alphabetized minor-mode-alist.  In other words, I do not want Emacs to recalculate the value -- I would like the old value to appear in the mode-line-format so that it costs nothing in terms of time.

  (require 'cl)

(defmacro non-empty-name-p (name)       ; Error if NAME is neither nil nor a string.
  "NAME if non-nil and not \"\", else nil."
  `(and ,name (not (string= "" ,name)) ,name))

(setq mode-line-format '(
  (:eval
    (let* (
        (copied-list
          (delq nil
            (mapcar
              (lambda (x)
                (when
                    (or
                      (and
                        (symbolp (cadr x))
                        (non-empty-name-p (symbol-value (cadr x))))
                      (stringp (cadr x)))
                  x))
              (copy-list minor-mode-alist))))
        (sorted-list
          (sort
            copied-list
            (lambda (x y)
              (let* (
                  (xname (cadr x))
                  (yname (cadr y)) )
                (when (symbolp xname) (setq xname (symbol-value xname)))
                (when (symbolp yname) (setq yname (symbol-value yname)))
                (when (and (stringp xname) (non-empty-name-p xname)
                           (stringp yname) (non-empty-name-p yname))
                  (when (eq ?\s (aref xname 0))
                    (setq xname (replace-regexp-in-string "^\s" "" xname)))
                  (when (eq ?\s (aref yname 0))
                    (setq yname (replace-regexp-in-string "^\s" "" yname)))
                  (string< xname yname)))))) )
      (list
    `(:propertize ("" mode-name)
      help-echo "Major mode help message."
      face '(:foreground "red")
      mouse-face '(:foreground "blue")
      local-map ,mode-line-major-mode-keymap)
    `(:propertize ("" ,sorted-list)
      face '(:foreground "purple")
      mouse-face '(:foreground "blue")
      help-echo "Minor mode help message."
      local-map ,mode-line-minor-mode-keymap))))))


texts:
I'm an experienced programmer, but totally new to (e)lisp, and I'd love some help orienting myself in a new project I'm trying out, specifically about any relevant org functions that maybe already do some of what I need.
Lets say I have two paragraphs of text, each in its own variable, one representing a question, the other an answer. I would like to insert these as two subheadings under a heading with some random name (say, the current time), which will go under an existing heading in an existing file.  The file is always the same (say, questions.org), and the existing heading (i.e. already part of the file) is also always the same (say, * New Questions). If it matters, that file only has two top-level headings).
> * New Questions
> ** New heading (e.g. 17:37)
> *** Question
>     Question1
> *** Answer
>     Answer1

I already have a capture template that I use to create these headers (semi) manually, so I thought maybe I could leverage that somehow..
Thanks for any help!


texts:
I create the id of the heading (with org-id-copy function) and somewhere in the file i create link to it: [[id:XXXXXXXXXXXXXXXXXXXXX][name]]. The problem is that the link works only on the computer i created it. When i move the file to another computer, the link stops working, giving the error:
No match - create this as new heading? (y/n)

How can i make it work on another computer? Is there any function to scan all ids and make links work again?


texts: Custom keybinding for jumping down 2 lines on spacemacs (evil-mode)

texts:
What I want is to have the option to scroll faster.

Currently when in evil-mode normal state when I press j evil-next-visual-line is called. If I hold jthen the cursor moves down.

What I want is that when i press J it scrolls down 2 lines at a time (i.e. twice as fast.).

I know that evil-next-visula-line has an optional count parameter but I am a emacs/elisp noob and don't know how I would use that to do what I want.


texts: How to modify string height while keeping the face?

texts:
Here's a code that works for setting a string foreground:

(defface test-face
  '((t (:height 1.2 :foreground "green")))
  "doc.")
(setq asdf (propertize "asdf" 'face 'test-face))
(add-face-text-property 0 (length asdf) '(:foreground "red") nil asdf)

asdf will still have the height 1.2 through test-face while gaining a red foreground, instead of green.

But this doesn't work:

(add-face-text-property 0 (length asdf) '(:height 1.0) nil asdf)

While the text properties will change, when inserting asdf into a fundamental-mode buffer, it will still have the height 1.2.  How can I set the height to 1.0, while preserving the face?


texts:
Today I discovered that if you re-evaluate a defun using eval-defun (C-M-x) in a buffer with lexical-binding set to t, the defun is recreated as an ordinary lambda, not a closure.

For example, after you evaluate this file:

;;; -*- lexical-binding: t; -*-

(defun foo (x) (lambda (y) (+ x y)))

Then (symbol-function 'foo) returns

(closure (t) (x) (function (lambda (y) (+ x y))))

But if you put point in the body of the function, press C-M-x, and evaluate (symbol-function 'foo) again, you get:

(lambda (x) (function (lambda (y) (+ x y))))

Certainly not the same thing, and in fact it throws a void-variable error when you call the returned function, if x is not globally bound.

Is this the intended behavior?  Do I just need to remember not to use eval-defun but rather eval-buffer whenever I modify a function in a file where lexical-binding is t?

I'm using Emacs 25.0.50.2.


texts: Showing arbitrary headers in mu4e's headers view

texts:
My incoming mail is spam-filtered by Rspamd on the server. Thus, every mail contains a header like this:
X-Spamd-Result: default: False [3.86 / 9999.00];

The first of those two numbers is the spam score assigned by Rspamd (ignore the second number…) I  would like for this number to be displayed as a column in the header view. I like to keep an eye on the spam scores to see if I need to readjust some of my filter rules.
I know I can basically add arbitrary functions to mu4e-header-info-custom. However, it seems like the function mu4e-message-field can only extract headers from the pre-parsed message plist. This plist does not contain the X-Spamd-Result header. It even looks like it does not contain a list of all headers, right? The documentation for mu4e-message-field-raw has an example of such a plist, and it only contains a :body-txt, not the full set of headers.
Is there any way of adding the spam score to the columns of the headers view?


texts:
This might be a fairly stupid question but I simply can't figure it out.

I've been trying to install doom-modeline for spacemacs:
https://seagle0128.github.io/doom-modeline/#install

I've added the use-package stuff to the configuration file like this:

...
   ;; configuration in `dotspacemacs/user-config'.
   dotspacemacs-additional-packages '((use-package doom-modeline
                                        :ensure t
                                        :init (doom-modeline-mode 1))
                                      (use-package all-the-icons))
   ;; A list of packages that cannot be updated.
   dotspacemacs-frozen-packages '()

...

Then I restarted spacemacs and it did install something. However, the modeline didn't change:

It doesn't look like in the screenshots here: https://seagle0128.github.io/doom-modeline/#screenshots

Do I somehow have to activate it or something?


texts: Why do some commands terminate when leaving the minibuffer (isearch) while others don't (find-file)?

texts:
Occasionally I start to open a file, and before I select the file for some reason I execute C-x o before answering the prompt. Then everytime I try and run find-file again it complains about Command attempted to use minibuffer while in minibuffer. However if I use a command like isearch-forward-regexp, (even if already in a find-file prompt), the error is not thrown and I can't switch back to the minibuffer using other-window.
Why is it that some prompts temporarily upgrade the minibuffer so that other-window considers the minibuffer a possible target, and others do not?

Just to clarify, I’m not asking how to get unstuck.
Originally when I encountered this, I would switch to the minibuffer and do Esc Esc Esc or C-g to escape the prompt, so that I could initiate a new command that uses the minibuffer. However, on pondering this question, I realized that abort-recursive-edit (C-]) will close this minibuffer in progress without having to do other-window + keyboard-quit.

Still, I'm not quite sure what the original use case is for. Perhaps, it’s meant to aid in copy pasting into a minibuffer prompt, or to assist running a command in the middle of a macro?

What I do want to know is if there is a way to disable this recursivity the way it is with isearch. Is isearch safe because it's using read-event instead of a blocking prompt? Is there a hook to trigger abort-recursive-edit when exiting the minibuffer?

TL;DR

Why do some minibuffer commands upgrade the minibuffer to a target for other-window, and block running new minibuffer commands, while others, such as isearch, do not?
Is there a way to disable this?
What is this feature's intended use case?


texts:
I have a running emacs daemon, and somehow lost the ability to connect to it.

Here are some relevant command output:

    $ pgrep -a emacs
    12664 emacs --daemon
    $ lsof -c emacs -a -u $USER -a -U  -w
    COMMAND   PID USER FD  TYPE         DEVICE   SIZE/OFF   NODE NAME
    emacs   12664 me   3u  unix 0xffff928d28f77000 0t0 113323181 type=STREAM
    # find /tmp -iname "*emacs*"
    #
    # find /tmp -inum 113323181
    #

I also tried manually searching through /tmp for the socket file.

The lsof result shows a unix socket exists, but it looks like I lost the 'filename' for it. Is that correct? Is there a way to recover it, so that I might re-connect to the running daemon?

I tried the following, to no effect (the socket file was blinking red on my terminal window):

$ ls /proc/12664/fd/3
/proc/12664/fd/3@
$ cp /proc/12664/fd/3 /tmp/user/1007/emacs-daemon_recovered_socket_file
cp: cannot open '/proc/12664/fd/3' for reading: No such device or address

Using 'cp -a' did perform a copy, but just of the broken link, so attempting to use it failed:

\emacsclient -nw -s /tmp/user/1007/emacs-daemon_recovered_socket_file
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: error accessing socket "/tmp/user/1007/emacs-daemon_recovered_socket_file"


texts: After setting bookmark: `Wrong type argument: listp, "~/.spacemacs`

texts:
So I did just M-x bookmark-save in my original .spacemacs file, which lead to the case that when I booted Spacemacs, I get the following error:

Upgrading bookmark format from 0 to 1...
mapcar: Wrong type argument: listp, "~/.spacemacs"PNG warning: Interlace handling should be turned on when using png_read_image

So I had to reset (basically rename) my .spacemacs file, to be able to start Spacemacs again.

But this error comes again when I try to set a bookmark in my .spacemacs file again:

Upgrading bookmark format from 0 to 1...
condition-case: Wrong type argument: listp, "~/.spacemacs"

I am using  the most recent versions of ManjaroI3 and Spacemacs, btw.


texts: Completing read with must-match and cannot be null

texts:
The function completing-read permits the user to simply press the enter key without selecting a match against the list of valid choices:
  (let* ((completion-ignore-case t)
       (client (completing-read "CLIENT:  " '("a" "b" "c" "d") nil t)))
  client)

Q:  Is there a similar completion function that will prevent the user from exiting by simply pressing the enter key without making a valid choice?


texts: What is the system-wide location for init.el?

texts:
Is there a way to have a common init.el for several system users?
/etc/emacs.d/init.el for example?


texts: Calc: copy only a value, not stack number

texts:
This seems so obvious that I feel sure that I've just missed something in the manual. I frequently do a calculation and then want to use that calculation elsewhere. But let's say my stack is currently:

--- Emacs Calculator Mode ---
1:  42
    .

Any way I've tried to copy the value 42 with incantations of M-w, what I get when I yank is

1:  42

including the newline.

The manual says

  Although a whole line is always deleted, C-k with no argument copies
  only the number itself into the kill ring, whereas C-k with a prefix
  argument of 1 copies the number with its trailing newline.

but that only works with C-k, weirdly, not with M-w (though otherwise the commands respond to arguments similarly), and still, that doesn't solve my problem, as I still get the stack number.

Amazingly, even moving the cursor, setting mark on 4 and point after 2 to set a region (which is highlighted, making me think this should work) doesn't get my the value: it still gives me the entire line.

I know about M-x quick-calc, which lets me enter an algebraic expression into the minibuffer whose result is placed into the kill ring, but that's not helpful if I'm doing a complex calculation or simply want to use the normal Calc RPN interface. (While there are methods described about how to move a quick-calc result into the calculator stack, I don't see a way to gain access to the stack from quick-calc. $1, etc., refer to prior results of quick-calc instead.)

calc-copy-to-buffer is bound conveniently to y, but I often want to use the result in the minibuffer or even in another program via kill-ring/clipboard integration, so this isn't a solution, either.

Of course I can yank or copy to a buffer and then edit the result and re-kill the edited result, but I do this so frequently and again, it seems like such an obvious use case that I really think I'm just missing something.

(I know there are Orgmode and database solutions for bulk transfer of Calc data, but I just want a single value to yank; it shouldn't be that hard.)


texts:
Is it possible to rebind the Capslock key to something else?

For example, suppose we want to invoke the Control-x commands by using CapsLock; so instead of pressing Control-xo, one can type Capslocko.


texts:
Let's say that I have a makefile in ./ and a file ./package/myclass.java. From ./, make works just normally, but using flymake-mode in Emacs, I always get the error

Flymake: No buildfile (Makefile) found for </absolute/path/to/myclass.java>. Flymake will be switched OFF.

The flymake manual says something about a customizable variable called flymake-buildfile-dirs, but this variable actually doesn't exist. I tried cd to ./, and to add ../ to flymake-master-file-dirs, which didn't help either.

The strange thing is that on my Macbook, this works with the same configuration, while on my Debian GNU/Linux Desktop, it doesn't. Does anyone have an idea?


texts: Emacs `captain-mode` auto-capitalization in comment

texts:
I installed captain-mode, and it worked as expected in org/text modes, but not so quite in programming modes' comment lines.

The problem is it can auto-capitalize the first word from the second sentence onwards, but not the first word in the first sentence.

// first sentence. Second sentence.

As you can see, first is not capitalized by the captain mode, but the Second is. Does anyone know what I may have done wrong?

here is my configuration related to this mode.

(global-captain-mode t)
;; don't capitalize in programming modes.
(add-hook 'prog-mode-hook
   (lambda ()
     (setq captain-predicate
           (lambda () (nth 8 (syntax-ppss (point)))))))
;; Or for text modes, work all the time:
(add-hook 'text-mode-hook
          (lambda ()
            (setq captain-predicate (lambda () t))))
;; Or don't work in source blocks in Org-mode:
(add-hook
 'org-mode-hook
 (lambda ()
   (setq captain-predicate
         (lambda () (not (org-in-src-block-p))))))
(setq sentence-end-double-space nil)


texts: Spacemacs - move org-mode customization to separate file

texts:
I have several hundred lines of customization code for org-mode in a private layer.  In Spacemacs, customization code typically goes in a function called $LAYER/init-$PACKAGE or in my case, joe/post-init-org.

However, this adds three layers of indentation and is annoying to re-eval code segments when modifying a config.

(defun joe/post-init-org ()
  "Init org."
  (use-package org
    :config
    (progn
      ;; Extensive list of customization...
      )))

Is there a proper way to do this in Spacemacs?  Or should I just do something like:

(defun joe/post-init-org ()
  "Init org."
  (use-package org
    :config
    (progn
      (load "~/path/to/my/file")
      )))


texts: In magit, the log '-s' option shows ESCAPE characters instead of changing the color of the selected text

texts:
Here is an example of a copy of the output of the magit log output with -s with the actual names omitted. (The ESC character precedes each of the [31 and [32 sequences in the following example in the Emacs output.)
b1fe5d2 Ignore files in the template

Author:    omit
Committer: omit

 .gitignore | 142 [32m+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[m[31m--[m
 1 file changed, 138 insertions(+), 4 deletions(-)

Update 2020-07-01
My ~/.gitconfig file had
[color]
    ui = true

as surmised by @phils
After the change to ui = auto, the colors in the diff stats are properly drawn, even when I add show graph in color -c flag as well.


texts: case-sensitivity of word completion using dabbrev

texts:
I sometimes use M-/ to complete words but it is not case sensitive. For example :

the word is : showPublic and when I write show and then put M-/, It completes as showpublic. How can I fix this ?

Or at least, how can I see the possible completion ?


texts: in org-mode, how to move point to next checkbox when it's marked completed?

texts:
I work with org-mode checkboxes, marking them as completed as I go.

* TODO clean kitchen
- [X] sink
- [ ] stove
- [ ] floors

I want org to move point to the next checkbox when when it gets marked - [X]

I tried this...

(advice-add 'org-toggle-checkbox :after 'org-next-item)

...which works when I do C-c C-x C-b. But how do I make org-next-item trigger automatically when point is on a checkbox and I do C-c C-c?


texts:
I recently created the alias in eshell:

alias hello 'echo "Hello World"'

So now whenever I type hello:

I am very used to creating temporary alias in the Terminal for more subtle use. And then putting my more permanent alias in the .bashrc file. So how do I remove the alias for hello? Do I have to set another alias for hello that does nothing? Is there an file that I have to edit to change this?


texts: Why Emacs using `dumping` during building?

texts:
I'm not a C programmer and I am reading the GNU Emacs Lisp manual. Something grabs my attention in E.1 Building Emacs is Emacs use dumping to get a executable program other than temacs.

I am wondering why Emacs choose to do this.  After searching through the documentation, my guess is Emacs use temacs to generate a platform specific version of Emacs and deal with some cross-platform problems.

If I am right, are there any other considerations (like performance) that Emacs chooses to do this?


texts: When is it better to use the backquote, `(…), and when to use (list …)?

texts:
The docstring for quote says,

Quoting should be reserved for constants that will never be modified by side-effects, unless you like self-modifying code.

Are there cases in which it is the best choice instead?
Are there any cases in which list should be avoided?

I've asked this question to complement When to use quote for lists? Modifying quoted lists in Elisp, which is mostly about the potential drawbacks of using quote. What I'd like to know is not only when it is ok to use it, but if there are cases in which it is the best choice over list or cons.

PS This question was originally about quote and list, then Dan made me realize I had conflated quote and backquote in my mind. The functions I was actually confused about were backquote and list. Sorry for the confusion.


texts:
I'm new to Emacs, and I'm storing my Emacs configuration in a GitHub repo. Whenever I move to a new computer, I want Emacs to install all packages I specify if they do not present on this computer. Pretty much like PluginInstall! in Vundle for Vim. Or like pip install -r requirements.txt. How can I do that?

I've just got my hands on Emacs. So if you know the answer, please provide some detailed instructions so I won't get lost.


texts: minibuffer resizes while typing into minibuffer

texts:
There is an annoying quirk of my minibuffer.  Can you help me trace its origin?

Typing into the minibuffer causes it to instantaneously resize to 2 or 3 lines in height, and then back to 1 line.  It happens far too quickly to take a screenshot.  Best guess is it is a side effect of minibuffer autocompletion.

Do minor modes in other buffers, like Yas and AC, apply to the minibuffer?  I thought not.

Thanks for your time!


texts: prettify-symbols-mode character replacement regex

texts:
I'm using the new emacs 24.4 prettify-symbols-mode, but it isn't behaving consistently.

I turn it on with:

(prettify-symbols-mode t)
(global-prettify-symbols-mode t)

And I'm trying to change the way python source code looks with the
follownig setup:

(add-hook 'python-mode-hook
          (lambda ()
            (push '("**2" . ?²) prettify-symbols-alist)
            (push '("_x" . ?ᵪ) prettify-symbols-alist)
            (push '("sum" . ?∑) prettify-symbols-alist)))

This works, but not consistently. For example,

x**2 x_x and sum(x) all look good.

The inconsistent part is that x**23 maintains the superscript 2, but
the 3 is regular. But if I say x**2+2, or x**2, then the **2 is not pretty (and it should be). I'd like the 2 to only be superscript when it is
followed by certain characters (space, plus, comma, etc.).
Alternatively, not superscript if followed by [0-9].

Meanwhile, sum behaves correctly. sum(, sum**2, sum+, and others are
pretty (as they should be) and summer is not (correctly).


texts: Emacs keybinding for switching tab via number

texts:
In Emacs 27.1, using tabbar. Trying to switch to tabs using numbers. Editing ~/.emacs with following lines doesn't switch tabs using C-1. Produces C-u 1 and so on. What is missing here? Any other comfortable option?
(require 'tabbar)
(global-set-key (kbd "C-1") 'tab-bar-select-tab 1) ; move to 1st tab
(global-set-key (kbd "C-2") 'tab-bar-select-tab 2) ; move to 2nd tab


texts:
I normally have many Emacs instances open (emacs 27.1 in Mac OS X Catalina), each opened from iterm2, based on different environment variable setups (they refer to different source control snapshots in a company custom source control).
I end up with many individual icons in the dock, each looking exactly the same and each having the exact same name when you hover over them ("Emacs"). So it's tricky to find the one I want.
It could be quicker if I could change the hover name. Not sure of the official title for this name. I have seen some postings that call it dockname for Java.
Is there a way, from within Emacs (Lisp), to set that name?


texts: How do I make Tramp stop mangling my PATH?

texts:
Tramp is very tenacious in overriding the PATH setting of a remote
machine.  How can I completely disable this, so that Tramp's PATH is
identical to what I get when I manually log in with ssh on the
terminal?
The ~/.bashrc in my remote machine looks as follows:
export PATH1=$PATH
# activate some Python virtualenvs, etc...
export PATH2=$PATH

I want the final PATH to be PATH2.  The closest I can get to that is
when setting tramp-remote-path to the value
'(tramp-own-remote-path), in which case my PATH ends up being
identical to PATH1.  (I'm checking this by doing M-x compile RET env RET while editing a remote file.)
One interesting solution (with other applications as well) would be to
stipulate, as a directory or connection-local variable, an additional
rc file on the remote machine that is sourced every time Tramp
connects.  Is this possible at all?


texts: Themes in emacs-nox displaying bottom part of frame black instead of background color

texts:
Edit: I tried many themes and it was an issue for all of them so this is not a Zenburn specific issue.

Edit: Docker is not part of the issue as there is the same behavior when this is done using just emacs-nox.

Edit:  In response to the comment from @caisah.
1) M-x version in emacs-nox outputs GNU Emacs 24.5.1 (x86_64-pc-linux-gnu) of 2017-09-12 on hullmann, modified by Debian.
2) I am running emacs-nox in LXDE terminal emulator version 0.2.0-1+deb8u1.  I also tested it with lxterm and it is the same.
3) toggling full screen on and off and switching between maximize and iconify for LXDE terminal editor or lxterm did not make the black band at the bottom of the frame go away.

I am working on creating a emacs-nox development environment that works in a docker container.  I have added the zenburn theme and followed the instructions to deal with the ugly terminal color issue here:
https://github.com/bbatsov/zenburn-emacs#ugly-colors-in-the-terminal-emacs-version

In a docker container in emacs-nox zenburn is not being displayed the same way as in emacs (gui version).  The last column on the second last row and all of the last row are black instead of the background color of the rest of it.

Here is what it looks like in a docker container in emacs-nox:

Here is what I would like it to look like without the black section at the bottom:

Note: This second picture is in emacs and I know it will not look exactly the same in emacs-nox.  I would just like to get ride of the black section at the bottom and am showing this as counter example.

The relevant parts of the .emacs file are:

;; add zenburn theme
(use-package zenburn-theme
  :ensure t
  :pin melpa-stable)

;; add custom theme path
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")

;; load zenburn theme on startup
(load-theme 'zenburn t)

The relevant parts of the Dockerfile are:

RUN echo "export TERM=xterm-256color" >> /root/.bashrc


texts: I'm trying to use helm-projectile-grep function on Windows 7, but it searches in every file, though in .projectile I excluded file types which I don't want to work with. Do I have to configure grep separately and how to do this? May be I should put something in pattern for grep? Thanks for advice.


texts: Emacs ZNC-ERC: How to make Customize save my preferences for all sessions

texts:
I am setting up my ERC client to connect to my ZNC IRC proxy server, and I am following this Emacs wiki. At the following step:

;; Configure
M-x customize-group znc RET

I am in the Emacs customize menu where I enter my ZNC server information, but this information is only saved for the current session, and I have to re-enter for every session.

Here is the menu, with a warning at the top indicating that I cannot save my custom settings:

I try to save with C-x C-s, but I get the following message in the mini buffer:
Saving settings from "emacs -q" would overwrite existing customizations. This doesn't make sense to me because I am not starting Emacs with a -q flag. I am using the default Emacs desktop file from my Ubuntu installation, which loads my .emac.d/init.el file.

I tried investigating this Emacs wiki page, where it says: Customize stores saved values (for future sessions) in the property saved-value, but I'm not sure how to set this value, or where to begin with setting variables inside the Customize code. Any suggestions?

The only other hint I have is that clicking on State > Show Saved Lisp Expression at the bottom of the page, reveals my values as follows:

'(("irc.lukeswart.net" 5005 nil
   ((irc\.freenode\.net "zncuser" "foo"))))

Update

Thank you for the tips, it led me to discover the underlying problem and eventually fix it.

The problem was in my Ubuntu desktop file, saved under ~/.local/share/applications/emacs24.desktop. Under this file, Emacs was starting with emacs -q --load ~/path/to/my/init.el. I initially missed this desktop file because I was checking under /usr/share/applications/emacs24.desktop. Anyway, here is the code that Customize adds to my init.el, although this should not be added manually:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(markdown-command "/usr/bin/pandoc")
 '(znc-servers (quote (("irc.lukeswart.net" 5005 nil ((irc\.freenode\.net "zncuser" "foo")))))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )


texts: How do I change the cursor face per buffer?

texts:
I have a custom emacs major-mode which I specified the background and foreground colors for. However, the default cursor color clashes with the background and you can't see it.

'set-cursor-color' changes the color for the entire emacs session which is undesirable. I tried using a mode-hook where I set the 'cursor' face locally using 'make-local-variable', that didn't work either (I saw no effect), I did see an effect if I set a font-lock face though, so I think the code is correct.

My guess is that the cursor is actually only settable as a global variable and is not evaluated per buffer. Is there a way I can set the cursor color per buffer so that it doesn't clobber the cursor color for other buffers? Or maybe is there a way where I can detect that I am 'entering' and 'leaving' the buffer and set the cursor color appropriately?


texts: Error running timer "show-paren-function" when displaying matching line in message/mini buffer

texts:
I want to display the line contains matching bracket in the message/mini buffer at the bottom of emacs. I found some code on emacs Wiki, after put it in init file, emacs do show the maching line in the message buffer:

Matches    myfucntion...()

But then it disappears very quickly (<1s) and is replaced by the following message:

Error running timer "show-paren-function": (wrong-type-argument stringp t)

I was wondering what is the cause of this timer error and just want the matching line info to be always displayed as long as my cursor stays, it would be the best if it can also display the matching line number.

Below is the code I'm using from:
emacswiki: How to show the matching paren when it is offscreen

(defadvice show-paren-function
  (after show-matching-paren-offscreen activate)
  "If the matching paren is offscreen, show the matching line in the
    echo area. Has no effect if the character before point is not of
    the syntax class ')'."
  (interactive)
  (let* ((cb (char-before (point)))
         (matching-text (and cb
                             (char-equal (char-syntax cb) ?\) )
                             (blink-matching-open))))
    (when matching-text (message matching-text))))

More pages that I found that is relavent but not constructive:

Request: show-smartparens and offscreen delimiter

I tried mic-paren with emacs 25.1, but it has the same problem as the matching message also disappears very fast.

Update:
Error message disappears after using:

(defadvice show-paren-function
  (after show-matching-paren-offscreen activate)
  "If the matching paren is offscreen, show the matching line in the
    echo area. Has no effect if the character before point is not of
    the syntax class ')'."
  (interactive)
  (let* (
     (cb (char-before (point)))
         (matching-text (and cb
                             (char-equal (char-syntax cb) ?\) )
                             (blink-matching-open)
            )
     )
    )
  )

 )


texts: Different fonts for different Emacs' windows

texts:
Usually I have two windows vertical split layout when using Emacs.  I'm curious is it possible to change default font size for one of them?

Typically, I use 14 points font height with 80 columns limit, when windows have same width this gives no line wrapping.  But I've found bigger font size is better for eyes and eases viewing perception, however if windows have equal width the lines become too long and wrapping appears.

So the idea is to have one wide (major) window with bigger font size, and another window being narrowed with smaller font-size.  I know I can set up font per buffer, but this is not what I need, e.g. I want same buffer being rendered with bigger font when visited in major window and with smaller font when visited in secondary window.

On a screenshot above there are major window is outlined with green colour and secondary window is outlined with blue one.  For example I want to have 18pt font size for major window and 12pt font size for blue window.


texts: org-mode XeLaTeX export to pdf: define font color for different structure levels

texts:
I would like to set the colors for a pdf export of an org-mode file based on the structural elements. That is something like

* This Headline Should Be Blue
** This subheadline should be green
   - List items should be black
Plain text should be black

Currently, I can modify the font and font color for the entire exported document with the following:

#+LATEX_HEADER:\usepackage{fontspec}
#+LATEX_HEADER:\setmainfont[Color=Green]{Fira Sans}
#+LATEX_HEADER:\setsansfont[Color=Green]{Fira Sans}

And I can set the color for a specific region with something like

\addfontfeature{Color=red} this part is red \addfontfeature{Color=black} and now back to black

But I'd like to define consistent rules across the document so I don't have to keep manually switching back and forth between colors.


texts: Show current ispell dictionary in modeline

texts:
FlyCheck had dynamic modeline that shows real-time errors information: FlyC:0/21

How to have the similar ability for flyspell, to show the current dictionary used in the current buffer, the info should be updated whenever the user switch to another buffer with different local dictionary value.

Eg: It should show FlyS:en

I've tried to use (flyspell-mode-line-string (concat " FlyS:" ispell-local-dictionary)) but it failed, I am sure it's because it's only accepted string, not lisp expression.

Thanks.


texts: How can I define a Yasnippet for #if AND if?

texts:
I would like to define one snippet for a cc-mode if statement and a different one for the preprocessors #if statement. I tried just defining those two:

For if:

# -*- mode: snippet -*-
# name : if (...) { ... }
# key: if
# expand-env: ((yas-also-auto-indent-first-line t))
# --
if ( ${1:condition} ) {
    $0
}

For #if:

# -*- mode: snippet -*-
# name: #if
# key: #if
# expand-env: ((yas-wrap-around-region t))
# --
#if ${1:MODULE_NAME}
$0
#endif // $1

but when I try to complete #if, I get the completion for if. Directly calling M-x yas-insert-snippet with #if as parameter works perfectly...

Thanks,
Markus


texts: How to override spacemacs package to use new ELPA version instead of pinned version

texts:
I'd like to use csv-mode 1.7 from ELPA, but spacemacs (develop branch) wants to use the pinned version spacemacs/.cache/stable-elpa/25.1.1/spacelpa-0.300/csv-mode-1.6.el (even if I delete that file and/or replace it with 1.7).

What's a nice way to force it to use the latest ELPA version (1.7)?


texts: magit commit does not permit adding a gpg signature

texts:
I am failing to run gpg to sign commits, after doing so successfully before an upgrade to Mojave and an upgrade to Emacs.  (I am not sure when I lost the ability to sign files in the past year.)

When I attempt to sign commits now this happens:

GitError! failed to write commit object  [Type `$' for details]

When I expand the '$' for details, I get this:

  0 git … commit --amend --only
hint: Waiting for your editor to close the file...
Waiting for Emacs...
[master e61729b] Master SQLite DB in ~/ingest.
 Date: Tue Sep 17 17:35:07 2019 -0500
 2 files changed, 70 insertions(+), 8 deletions(-)

128 git … commit --amend --only
hint: Waiting for your editor to close the file...
Waiting for Emacs...
error: cannot run gpg: No such file or directory
error: gpg failed to sign the data
fatal: failed to write commit object

My searches for fixes related to GNU gpg and the new Transient library and suggestions for that switchover in the Magit source have not led to a solution.

What I am looking for

I am interested in determining

How Emacs finds the paths to use gpg in Magit to run this command so
that I can debug the configuration.  Answered in the comment,    incorporated below:

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))
How can I see where the paths are that Emacs and GPG can use
internally when running any command?

I am interested in the solutions that others have had to this issue.

Versions of software and OS.

magit-version returns the following string

Magit 2.90.1 Git 2.20.1 (Apple Git-117), Emacs 26.1, darwin
on an iMac Pro (2017) running OS X 10.14.6

Version of Emacs: Emacs 26.1 (9.0)
https://www.gnu.org/software/emacs

Additional information - Added 2019-09-20 Friday

I solved the above issue with this correction:

Emacs EPA and Gnupg2 no usable configuration

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))


texts: Cannot open new chrome tab by `(browse-url "chrome://newtab")`

texts: I can open a web page by (browse-url "http://www.google.com"), but cannot open new tab by (browse-url "chrome://newtab").  Any workaround? I would like to have an Emacs shortcut to open a new chrome tab (on Mac and on Linux).


texts: Make buffer read-only on a per-file basis

texts:
I know I can set something like -*- mode: read-only-mode -*- inside a commentary and Emacs will open the corresponding file as read-only. My problem is that I still want to read files that include such a line with the org-mode major mode; Emacs opens these files in fundamental-mode.

How can I tell Emacs to open a file as read-only and still make it use the correct major mode?


texts:
It seems that whenever I press RET on my emacs init.el file comment lines that the previous line just randomly indents ~4 tabs. I only have a simple load path (nothing currently in there really except for load path and load org-mode).

Nothing happens when I press C-j in this position, only RET.

I am on Mac OS X 10.10, iTerm 2 using xterm-256color but I launch emacs -nw with TERM=xterm-16color because that is the only way that my colors work correctly.

Any ideas of where I should be looking to solve this problem?


texts: How to open multiple webpages from org mode?

texts:
I have a list of www addresses as a list like:

- https://www.nytimes.com
- https://www.foxnews.com

and so on. I can open single elements with the command org-open-at-point which is bound to the key sequence C-c C-o. A Firefox tab will open on the correct address.

However, how could I mark a list and open all of them each on a single tab?


texts: Exit Emacs Calendar without having to save the diary file

texts:
When I create appointments in Emacs diary via the calendar, I have to save  changes to the diary file before being able to exit the calendar. I have tried to set up Emacs to automatically save the diary file once changes have been made with this code:
(add-hook 'diary-mode-hook
          (lambda ()
            (add-hook 'auto-save-hook 'diary-show-all-entries nil t)
            (auto-save-mode)))

However, hitting q in calendar still prompts me with these words:
Diary modified; do you really want to exit the calendar? (y or n)

This from calendar.el:
(defun calendar-exit (&optional kill)
  "Get out of the calendar window and hide it and related buffers."
  (interactive "P")
  (let ((diary-buffer (get-file-buffer diary-file))
        (calendar-buffers (calendar-buffer-list)))
    (when (or (not diary-buffer)
              (not (buffer-modified-p diary-buffer))
              (yes-or-no-p
               "Diary modified; do you really want to exit the calendar? "))
      (if (and calendar-setup (display-multi-frame-p))
          ;; FIXME: replace this cruft with the `quit-restore' window property
          (dolist (w (window-list-1 nil nil t))
            (if (and (memq (window-buffer w) calendar-buffers)
                     (window-dedicated-p w))
                (if (eq (window-deletable-p w) 'frame)
            (if calendar-remove-frame-by-deleting
            (delete-frame (window-frame w))
              (iconify-frame (window-frame w)))
          (quit-window kill w))))
        (dolist (b calendar-buffers)
          (quit-windows-on b kill))))))

I would like to be able to save the diary file automatically and exit calendar without confirmation.


texts: Can't adjust font size anymore in emacs 25

texts:
I just upgraded Emacs to 25.1.1 (via the Arch Linux package manager pacman).

Now I can't set the font size in my .emacs anymore.

I am able to adjust it via C-x C-+ and C-x C--, and I can also use M-x customize to set the default font height to 83 instead of 103. This works for my current session in all buffers, then.

But when I save the generated config code (attached below) in my .emacs and restart, the settings are ignored and Emacs starts with the default font size instead. I am confused as to where to start searching for the cause of the problem, since it works if I adjust it in each session, but does not work when restarting Emacs.

There is no error message and nothing of help in the *Messages* buffer.

Where can I start looking for the problem?

I must add that I have no idea about how Emacs-Lisp works and can only copy-paste things into my config file. It's a very confusing language for me.

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "white" :foreground "black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 83 :width normal :foundry "PfEd" :family "DejaVu Sans Mono"))))
 '(tabbar-button ((t (:inherit tabbar-default :foreground "dark red"))))
 '(tabbar-button-highlight ((t (:inherit tabbar-default))))
 '(tabbar-default ((t (:inherit variable-pitch :background "#959A79" :foreground "black" :weight bold))))
 '(tabbar-highlight ((t (:underline t))))
 '(tabbar-selected ((t (:inherit tabbar-default :background "#95CA59"))))
 '(tabbar-separator ((t (:inherit tabbar-default :background "#95CA59"))))
 '(tabbar-unselected ((t (:inherit tabbar-default)))))


texts: How to delete a diff buffer, after running 'Jump to source'?

texts:
Id like to use a diff on my repository to quickly navigate changes, without keeping the buffer open.

Is it possible to make a function that runs 'Jump to source', and deletes the diff buffer?

(Am looking to make a key-binding, but expect this will involve writing a function)


texts: I don't understand skeleton.el indenting rules

texts:
As a fun (?) exercise, I am testing skeleton.el templates for some repeated, boring boilerplate coding tasks.
I want to generate something like this:
int main () {
    if () {
       if() {
         run();
       }
    }
}

Reading the Emacs manual, specifically the skeleton language, I have tried this:
(define-skeleton my-c-template
   "My C template." nil
   ?\n "int main () {"
   ?\n > "if () {"
   ?\n > "if () {"
   ?\n > "a = b;"
   ?\n > "}"
   ?\n > "}"
   ?\n > "}"
   \n)

But the result is
int main () {
    if () {
        if () {
            a = b;
            }
        }
    }

What I am doing wrong? Why the closing braces are not obeying the indentation rules?


texts: How to change syntax highlighting for mode?

texts:
I've been able to partially modify how emacs highlights syntax of python files. For example I find highlighting the definition of variable to be disturbing and I've done this

'(font-lock-constant-face ((t (:foreground "#2aa198" :weight normal))))
 '(font-lock-keyword-face ((t (:foreground "#859900" :weight normal))))
 '(font-lock-variable-name-face ((t (:foreground "#839496")))))

But I'd also like imports to be highlighted with different color, stop highlighting "sys.exit()" as a constant etc, treat print as a builtin function, not as keyword etc. So I need to change how emacs parses python code. In vim you can do this by creating a custom syntax file and placing it in special folder, how to do the same for emacs?

from abc import ABC
print('some')
map(int, ('1',))
int('1')

@cached
def name(a, abc='abc'):
    pass

name(1, abc='bca')

The right one is how I want syntax highlighting to look and the left one is emacs.


texts: What's wrong with my org-mode capture settings?

texts:
I've been trying to setting the capture configuration for org-mode, however, when I try to select a capture template, I get this message:

Template key:
byte-code: Capture template `p': listp

Here is my conf:

       (setf org-footnote-auto-adjust t
             org-directory (expand-file-name "~/org")
             org-archive-location (concat org-directory "/archivado.org::* Entradas viejas y archivadas")
             ;; ...
             org-agenda-files (list (concat org-directory "/trabajo.org")
                                    (concat org-directory "/notas.org")
                                    (concat org-directory "/otros.org")
                                    (concat org-directory "/agenda.org"))
             org-log-done 'time
             org-default-notes-file (concat org-directory "/notas.org")
             org-capture-templates '(("p" "Cosas por hacer" entry (file+headline (concat org-directory "/otros.org") "Tareas")
                                      "* Tareas %?\n  %i\n  %a")
                                     ("d" "Diario" entry (file+datatree (concat org-directory "/diario.org"))
                                      "* %?\nInsertado el %U\n  %i\n  %a")
                                     ("a" "Apuntes importantes" entry (file+datatree "")
                                      "* Notas importantes %?\nNota importante del %U\n  %i\n  %a")
                                     ("g" "Agenda" entry (file+datatree+prompt (concat org-directory "/agenda.org"))
                                      "* Agenda %?\n Ingresado el %T\nProgramado para el %:date\n  %i\n"))
             org-clock-persist 'history)

       ;; ...
       (define-key global-map (kbd "C-c c") 'org-capture)
       (org-clock-persistence-insinuate)

If I press a I get this error:

Template key:
org-capture-set-target-location: Invalid capture target specification

But according to the manual this (file+datatree "") should be valid, what I'm missing?


texts: Initialization warning after installing doom-modeline

texts:
So recently i decided to switch to Emacs (btw I am total noob) and began creating my init.el file
After downloading doom-modeline package from melpa and following it's installation guide I get an initialization warning:

Warning (initialization): An error occurred while loading ‘/home/telman/.emacs.d/init.el’:
File is missing: Cannot open load file, No such file or directory, doom-modeline

And this is my init.el setup:

(require 'package)
(require 'doom-modeline)
(doom-modeline-mode 1)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)
(global-display-line-numbers-mode)
(menu-bar-mode -1)
(tool-bar-mode -1)
(toggle-scroll-bar -1)


texts: Understanding "It is bound to ..." message in describe-function

texts:
If you ask for a function description, there is a line that starts:

It is bound to <...> <...> <...>

For example, for isearch it says:

It is bound to <menu-bar> <search> <isearch-forward>

What does it mean? Isn't it supposed to show the keybindings associated with the function?


texts: Are there any games to kickstart learning emacs like VIM Adventures?

texts: I am a newbie in emacs and have heard a lot about how powerful emacs is. But the leaning curve seems to be quite steep. If there was a fun way to learn emacs (something like the game VIM adventures) that could help me quickly to familiarize the key binding and modes, I could dig deeper into more advanced features of emacs.


texts: Is it possible to disable color highlighting in css-mode?

texts:
I'm using Emacs 26.1 in the terminal (emacs -nw).

When using css-mode, strings representing colors seem to be automatically highlighted. I don't find this feature useful, and further, the colors chosen often make the text illegible.

Is there a way to disable this while keeping CSS syntax highlighting and formatting?


texts: I have to enable `hl-todo-mode` in LaTeX-mode?

texts:
Currenty I am on LaTeX-mode-hook and added following line global-hl-todo-mode into .emacs file to use hl-todo. On its readme it says:

  To highlight keywords turn on hl-todo-mode in individual buffers or use the the global variant global-hl-todo-mode.

My setup:

; L A T E X ;
(setq LaTeX-item-indent 0)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'hl-todo-mode)
(require 'tex)

(add-hook 'LaTeX-mode-hook (lambda ()
  (TeX-global-PDF-mode t)
  (global-hl-todo-mode t)  ; <= added here
  ))

(global-hl-todo-mode 1) ; <= added bottom of the page

When I open emacs -nw file.tex, I need to disable and than re-enable global-hl-todo-mode in order to use it. Is there any way to fix this issue?

Please note that, this was working perfectly fine in python-mode.


texts: Can't exit Emacs with error "End of file during parsing"

texts:
Every time I press c-x c-c to exit Emacs, it shows "End of file during parsing" in the minibuffer.  I cursorily examined my .emacs and did not find any mismatching parenthesis. Any idea what's the best route to fix this?

Edit: I confirmed that .emacs does not have mismatching parentheses with check-parens.

Edit 2: About kill-emacs-hook, I found it is related to keyfreq.  After commenting out the following from .emacs, the issue is resolved.  But I don't understand why it suddenly stops working:

;; keyfreq
;; https://github.com/dacap/keyfreq

;(require 'keyfreq)
;(keyfreq-mode 1)
;(keyfreq-autosave-mode 1)


texts: How I can see difference between working file and index with vc-diff and vc-ediff command with vc-git?

texts:
vc-diff and vc-ediff seem to show changes between working file and HEAD. I would like to see difference between working file and index instead.
How can I do that?


texts: Any possibility to show multiple narrowed regions at the same time in a buffer?

texts:
As title self-explains, I would like to show multiple regions in different places.
narrow-to-region could be a possible solution, but as documentation indicated, only one region from begin to end could be narrowed. Any thoughts?


texts: Is there a way to make emacs fully complete a filename and cycle through the completions by hitting tab?

texts:
In Windows (the command prompt) when you hit TAB to complete a file name, you get a full file name, and can cycle through the completions by hitting TAB.

Is there any ready way to get emacs to do this, instead of (or additional to) displaying the completions for mouse choice in a buffer?


texts:
I plan & track my holidays in an Org mode file. In it I use Column
View to get a quick overview of what I've planned so far, so that I
know how many days I've got left. I use this column setup:

#+COLUMNS: %TIMESTAMP(When) %ITEM(What) %Confirmed(Confirmed?){X/} %Days{+}
#+Confirmed_ALL: "[ ]" "[X]"

It shows a table something like this:

| When                               | What                          | Confirmed? | Days |
|------------------------------------+-------------------------------+------------+------|
|                                    | * Holiday                     | [2/3]      |   14 |
| <2017-02-20 Mon>--<2017-03-01 Wed> | ** Picking fights with bears  | [X]        |    8 |
| <2017-05-04 Thu>--<2017-05-09 Tue> | ** Give bear-fighting lessons | [X]        |    3 |
| <2017-05-10 Wed>--<2017-05-12 Fri> | ** Lick wounds                | [ ]        |    3 |

Is there a way to make the {+} only add up the days that are
confirmed? I'd like to make the table look something like this:

| When                               | What                          | Confirmed? | Confirmed Days | Days |
|------------------------------------+-------------------------------+------------+----------------+------|
|                                    | * Holiday                     | [2/3]      |             11 |   14 |
| <2017-02-20 Mon>--<2017-03-01 Wed> | ** Picking fights with bears  | [X]        |              8 |    8 |
| <2017-05-04 Thu>--<2017-05-09 Tue> | ** Give bear-fighting lessons | [X]        |              3 |    3 |
| <2017-05-10 Wed>--<2017-05-12 Fri> | ** Lick wounds                | [ ]        |                |    3 |

Any help appreciated!


texts: How to get the IP address of a host in Elisp?

texts: I need something like get-host-by-name or getent-hosts but I can not find any. Do they exist?


texts:
I am new to Wanderlust so I've started configuring my wanderlust, but there's one thing I don't really understand, and that's how to add filters.
The documentation tells me that the syntax is the following:
‘/’ condition ‘/’ target-folder
I have no problem understanding the syntax, I just don't now where to write these filter, in which file, I've tried ~/.folder but that doesn't seem to work, it simply creates a folder in wanderlust called ‘/’ condition ‘/’ target-folder.

Thank you.


texts: Org tangle source blocks to a file with byte-order-mark (BOM) from org mode

texts:
Because Firefox doesn't load local files with UTF8 characters like ', …, ' in the HTML or the CSS correctly, since it does not receive a <meta charset="utf8" /> header, I need to tangle files with a Byte-Order-Mark.

I knew that my needed BOM was \xef\xbb\xbf or \357\273\277.

My first try was just prepending this block:

#+BEGIN_SRC fundamental
\357\273\277
#+END_SRC
That line in emacs is really 3 characters, not 12 as rendered here

When I tangle with C-c -v -t, I get a "Select coding system" prompt twice, where I have to choose `utf-8-with-signature' both times.

That puts the BOM at the front of the file, but also another time at the end. Then I find-file-literally the tangle result file, to remove the trailing one manually. And I have a "superfluous" Source Block...

The other work-around, which I have been using since then: Using sed externally:

#+BEGIN_SRC shell :tangle no
sed -i  '1s/^\(\xef\xbb\xbf\)\?/\xef\xbb\xbf/' Empty.org.htm
#+END_SRC

and then I just tangle that chapter, and execute the shell block afterwards. That became muscle memory and thus fast (enough). But also another source block needed in the doc.

I always wondered about the correct™ way to do this. From my reading I suspect, there is a variable I can set somewhere as a header var, or in a property drawer.


texts:
I have a simple template in emacs org-mode:

\begin{flushright}

Name:

Phone no:

Billed amount:

Date

\end {flushright}

Details:

I export the document to PDF and print it. I create multiple such documents in a day.

I want to capture the information to table as below for final accounting with a single keystroke:

| Name | Billed amount |

Note: I don’t want to parse multiple files in one go but do this for one file at a time.

Is this possible?


texts: Highlight text equivalent to the marked region and search and replace on the fly

texts:
Edit: Highlight text that matches the marked region, without the use of any key, but just by having a region marked. Then have two commands to directly move across the highlighted text, forward and backward.

Edit: For example if I mark "hello", automatically highlight all the occurrences that are equal to "hello". If I mark "hello w", highlight all the occurrences equal to "hello w". Then use two keys to move forward and backward respectively.

A third key to toggle between three options:

Search (default): take marked region as the search for parameter.
Search and replace: preserve search for parameter and prompt for the replace with parameter.
Search and replace with regexp: preserve replace with parameter and prompt the search for parameter as the starting point of the regexp.

A basic option would be a command to turn on/off the "on the fly" behavior. A more advanced option would be to use the "on the fly" behavior only for words/symbols/expressions marked in its entirety, or tweak minimum/maximum criteria required to perform automatic search, so that for example making it necessary that the mark have three or more characters, and no more than one line.

I already use such tool, but not to work the way mentioned ("on the fly"). Such tool is isearch. The best solution would be to use that same tool, but if not, then maybe there is a package or code that implement it in another way?

Hopefully it does not mess up with multiple cursors, so that multiple cursors have the highlight precedence.

If there is no complete solution, the most approaching is welcomed.


texts:
I'm a novice in Lisp, so I feel like I'm missing something very basic here. My intention was to create a function/shortcut to remove all whitespace and newline chars from the selected text and copy the resulting string to the X primary clipboard/selection. For example, when selecting the text:

line 1
line 2

The function should copy line1line2 to the clipboard. To be precise, it should be copied to the primary selection. I've written the following code for this presumably easy task:

(defun copy-no-white-space ()
  (interactive)
  (gui-set-selection
    'PRIMARY
    (replace-regexp-in-string "[\s\n]" "" (buffer-substring (region-beginning) (region-end))))

Unfortunately, this does not work this way. When I try to paste the modified pattern, it only yields the original region with no modifications and I just can not wrap my head around why: It works when PRIMARY is replaced with CLIPBOARD (only that I really want to use PRIMARY). What confuses me even more is the fact that it works with PRIMARY when I remove the regular expression in favor of a fixed string and that it also works when I put it outside of the function. (edit: only when nothing is marked) Why? ;)


texts: Getting number of occurrences, during incremental search (C-s / isearch-forward)

texts:
Inspired by modern browsers, I'd love to be able to see how many occurrences there are of some string, when I search for it – like the "10 of 37" at the top-right corner of the screenshot below.

Is there a way of getting this in Emacs? Presumably, so as to not be slow, it should run only after some idle time.


texts: Indenting within block comments in C-mode Emacs

texts:
After writing functions in C/C++, I like to format my block comments that explain a function's purpose, parameters, use, and so on.

(See example below)

However, to indent my comments in emacs, I need to do C-q TAB, which is a bit of an awkward set of keystrokes (not to mention having to press three keys as opposed to one).

My question is: what would the Elisp code be for:

See whether or not what I'm typing is in a comment block (I'm thinking it has to do with font-lock-comment-face but I'm not sure
If the text is inside a block comment, have TAB perform the same functionality as the aforementioned C-q TAB

For more information, some of the shortcuts given in the Emacs guide, such as M-j are helpful, but I still need to C-q TAB to initially indent a region within the comment.


texts:
I have chroot directory.
When I try to open /ssh:web@xxx.xxx.xxx.xxx:/, Emacs returns “Found remote shell prompt on”.
From console I login to directory.


texts: error Key sequence starts with non-prefix key

texts:
After trying to define a custom binding:

(global-set-key (kbd "g l") 'evil-end-of-line)

I get:

(error Key sequence g h starts with non-prefix key g)

because g is the start of navigation for many commands in evil.

How can I make it use my binding (which isn't bound to any other command: g l) whilst keeping evil's prefix binding?

Since g is the prefix for other evil commands, I'm unable to use it with another combo. I still want to keep other g <key> commands like g g


texts: Toggling minor modes based on other minor modes

texts:
I wrote a function to enable some minor modes when another minor mode is enabled:

(defun prose-mode()
  (display-line-numbers-mode)
  (variable-pitch-mode))

I added prose-mode as a hook for olivetti-mode:

(add-hook 'olivetti-mode-hook 'prose-mode)

The hook is working fine and prose-mode gets ivoked on M-x olivetti-mode.

However, when I do that again to disable the mode, the line numbers don't reappear. variable-pitch-mode is toggling and I get my monospaced font back.

In general, is this the right way to do what I'm trying to do?
Inside prose-mode, should I check for the current minor mode using a conditional statement to enable/disable the other modes?


texts: elisp - print result not found after eval-buffer

texts:
Create a test.el file as below:

(print "hello world!")

Then run M-x eval-buffer. No output can be seen even in *Messages* buffer. where is the print output for this case?


texts: Can't establish a hook for bookmark-bmenu-mode

texts:
Trying to solve the problem of hotkeys for bookmarks I decided to create a primitive version first. I wanted to attach bookmarks to keys <1> and <2>: when a certain key is pressed, I open the appropriate bookmark. But unfortunately the hook is not called when bookmarks list is opened. I have different functions bound to these keys:

1 - bookmark-bmenu-1-window
2 - bookmark-bmenu-2-window

Code
(defun jump-to-1th-bookmark ()
  (bookmark-jump "2015.txt"))

(defun jump-to-2nd-bookmark ()
  (bookmark-jump "emd"))

(defun my-bookmark-mode ()
      (local-set-key (kbd "1") 'jump-to-1th-bookmark)
      (local-set-key (kbd "2") 'jump-to-2nd-bookmark)
      )

(add-hook 'bookmark-bmenu-mode 'my-bookmark-mode)

How can I bind my functions instead of default?


texts: Treemacs is not allowing the resize the file explorer window in vanilla emacs

texts:
I've installed treemacs on vanilla emacs 27.1
when I did M-x treemacs it opens file explorer in the sidebar.
I want to resize (i.e., expand and reduce) the length of the file explorer sidebar but there is no option to do so.

os details -
$lsb_release -a
LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:    20.2
Codename:   Nibia

emacs version details -
$ emacs -version
GNU Emacs 27.1

How can I make sidebar resizing happening?


texts: Have Emacs remember text properties of buffer

texts:
I am using the following code to insert colored text into an Emacs buffer.

(insert
 (propertize "green"
 'font-lock-face
  '(:strike-through t
    :foreground "green"
    :background "blue")))

How can I have Emacs save these text properties so that when I reopen the buffer they are available?

Edit:
I am attempting to do this with a .el file and would like to save any text properties not just font properties. It would be nice if there was a way to do this for any type of file.


texts: Mouse 1 doesn't follow footnote in org-mode?

texts:
I define a footnote via :  C-c  C-x f  as described in the manual.
Then I have something like:

Leo once said [fn:1]  (reference)
..
..
..
* Footnotes
  [fn:1] To make the world a better place, one should use Emacs. (definition)

Now clicking on the definition [fn:1] To make .. jumps back to the reference.
But clicking on the reference doesn't jump me to the definition.

Jumping from reference to the definition still works via C-c  C-c, but id'd be nice to have Mouse-1 support.

Is this just me or is this the case for everyone out there? If so, is there a way to make it jump to definition when clicking the reference?

I'm using emacs 24.4.1 btw. If it makes a difference, I use org-mouse also.


texts: How to merge the completions of two completion-at-point-functions?

texts:
In company-mode, you can merge completions by listing them together in a list. I would like to do a similar thing, where if I have two completion-at-list-functions setup, instead of trying one after the other, I'd like their candidates to get merged into one list.

Is that possible?


texts: Add actual (scheduled) date in log for state change in org-mode

texts:
I just started to get into using emacs org-mode, and was wondering if this is possible. I put the scheduled in brackets in the title as I am not specifically interested only in timestamps which are "scheduled" in an org-mode sense, but was hoping this would work with any timestamp. I imagine that I include something like the following in my .emacs

(setq org-log-note-headings '((state . "%s %t for %Q")))

where %Q should represent the day the task was actually scheduled, but have no idea what I would have to use here (and if this is possible at all). In the org file I would then have a entry like

* TODO My task
  Next occurrence:
  <2015-10-02 Fri +1d>

which should when changing the state to DONE change to

* TODO My task
  - "DONE" [2015-09-30] for <2015-10-02 Fri>
    Notes on this...
  Next occurrence:
  <2015-10-03 Sat +1d>

An alternative I would also be happy with would be to have a function that shifts a recurring time stamp once by its rule (so in this case by one day) and inserts the corresponding note at the beginning so which would simply change the first example to

* TODO My task
  - <2015-10-02> ...
  Next occurrence:
  <2015-10-03 Sat +1d>

but here I have no idea how to start... Any suggestions appreciated.

Update:
Ok, based on this: How to make org prompt for a timestamp, when changing state of a TODO?

I achieved a behaviour close to what I was looking for, using two functions

(defun org-todo-with-deadline (&optional arg)
  (interactive "P")
  (cl-letf* ((my-current-time (org-get-deadline-time nil))
            ((symbol-function #'org-current-effective-time)
             #'(lambda () my-current-time)))
    (org-todo arg)
    ))

(defun org-todo-with-schedule (&optional arg)
  (interactive "P")
  (cl-letf* ((my-current-time (org-get-scheduled-time nil))
            ((symbol-function #'org-current-effective-time)
             #'(lambda () my-current-time)))
    (org-todo arg)
    ))

at least this works for SCHEDULED and DEADLINE marked entries, respectively. The downside is that it is not possible anymore to include the date when the state is changed (because this is temporally overwritten here) and it does not work with plain timestamps.


texts: Strange cursor behavior with inline images

texts:
When I try to type something right before an inline image, it inserts only one character there, and the cursor somehow moves to the end of that image link. When I try to type "foo" it goes like this ("_" is the cursor):

_[image]
f_[image]
f[image]_
f[image]o_
f[image]oo_

How can I fix this?


texts:
Does elisp calculate values of local variables at declaration or when calling them?

Say i want to find out what headlines in buffer are lvl2, and do stuff to them:

(defun map-org-heads ()
  (org-element-map (org-element-parse-buffer 'headline) 'headline 'do-stuff))

Would this:

(defun do-stuff (element)
  (let ((lvl (org-element-property :level element)))
    (if (eq lvl 2)
        (call-func-to-do-stuff))))

Have a better performance than this:

(defun do-stuff (element)
  (let ((begin (org-element-property :begin element))
        (end (org-element-property :end element))
        (lvl (org-element-property :level element))
        (title (org-element-property :title element)))
    (if (eq lvl 2)
        (........... do stuff))))

I have quite a big org-file with lots of headlines, so every bit of performance matters.


texts:
I would like to change the behavior of C-c C-x i so that it creates a "date created" timestamp i.e.

** TODO New Task
   :LOGBOOK:
   CREATED: [2016-03-29 Tue 11:41]
   :END:

I basically want to log the age of tasks, but I'm not interested in tracking the time spent on a task. Is there a strait forward way to do this?


texts: Execute keyboard macro in the current buffer

texts:
I need to be able to parse a string like the following:

M-: (forward-word 4) RET

and execute it from elisp.

For that purpose I'm trying to use execute-kbd-macro and edmacro-parse-keys but I'm a little bit surprised as these functions won't be executed in the current buffer (with current buffer, i.e. using with-current-buffer), please take a look:

(defun execute-macro-in-the-current-buffer ()
    (interactive)
    (with-current-buffer (get-buffer-create "*test-buffer*")
        (erase-buffer)
        (insert "Lorem Ipsum is simply dummy text of the printing and typesetting industry.")
        (goto-char 0)
        (execute-kbd-macro
          (edmacro-parse-keys "M->") t)))

When I execute it then my point moves to the end of the current buffer but not of the buffer *test-buffer* as I was expected. But why? What is wrong?

May be I need another way to parse a string and execute it? Which one?