texts: How to get org-mode not to change fold-state upload loading?

texts:
I sometimes edit org files in non-org-mode. (e.g artist mode).

Upon returning to org-mode, it will mess with the fold/collapse state.
E.g it will collapse all headers so that I loose my current spot and have to find it again.

I tried editing org-startup-folded and tried all the 4 options, but all of these mess with the collapse state in some way or another. I cannot find an  option to leave expanded state as is when loading org-mode.

Is this possible?


texts:
It might be trivial, but google searches do not help.

What does "W" mean mean in Worg?


texts: Creating backup and auto-save files that are not hidden

texts:
I use the following code for backup and auto-save files:
(setq delete-old-versions -1)
(setq version-control t)
(setq vc-make-backup-files t)
(setq backup-directory-alist `(("." . "h:/saves")))
(setq auto-save-file-name-transforms '((".*" "~/.auto-save-list/" t)))

The backup files created are all hidden. I would like to change that so that they are made in a non-hidden format.
An example is: !drive_c!home!.emacs.d!recentf.~2~


texts: Unable to Send Commands to Omxplayer from Dired

texts:
When opening a video file with Omxplayer through dired using dired-do-shell-command, I am unable to send commands to the external program to, for example, pause the video. The file plays fine but all keyboard input gets sent to the buffer from which the file was launched.

This occurs on my Raspberry Pi running Arch Linux ARM on a TTY. Does anyone have an idea of what I can do to curb this behavior and force Emacs to allow other programs to accept keyboard input?

EDIT: To get to my issue, I've ran emacs -q then C-x d to open the directory containing a video file. While the file is at point in dired, run dired-do-shell-command (with ! if you'd like) and type omxplayer RET. The video plays as normal over Emacs and I expect to be able to pause the video with SPC or seek with <right> and <left> but instead of going to Omxplayer, those commands runs in dired. I'm not sure what else to try. The same process works fine in the Vim File Manager (vifm). It seems Emacs is running the shell command asyncronously even though I've specified for it not too.


texts: How to set default program to open a file in helm?

texts: In helm, when finding a file, C-c C-x would prompt for open with external program option. Is there a way to set a default program, say, smplayer for .mov file. Then I can just press Enter to open it.


texts: Emacs change window fringes (vertical padding)?

texts: I have Emacs 24 running in Linux Mint 18 Xfce.  As shown in the picture below by the red arrows, how can I decrease the width of the gray zones that are to the left/right of each Emacs window? The so-called "padding", I guess.


texts: Save filesets-data in file which is not the custom-file or other emacs config file

texts:
Background
I store Emacs my configuration in a .emacs and separate custom file.  I    would like to store both in a public repository like Github.  I also use filesets which saves filenames & file paths in one of these files.  Data associated with the variable filesets-data gets placed in my custom file because I set the variable custom-file in my .emacs like this:

(setq custom-file "~/.emacs-custom-work.el")

I use Emacs at work and I don't want to put private data (filenames & paths) in public repositories.

Question Detail
I need a way to store data associated with filesets (Emacs uses the variable filesets-data) in a file separate from my custom file (also not in other standard Emacs init files).  I will not place this separate file (which would be a dedicated place to store filesets-data) in a public repository.

Not looking for alternatives to the functionality provided by the filesets package at this time.

Currently running Emacs 24.4 on Ubuntu 14.4 at work.

The Emacs manual and the emacswiki site are usually helpful but not with this.


texts: From an external script, open file and run some simple expression whether emacs already running or not

texts:
Context / initial need (works fine)

I wrote and use a script that generates a file and uses emacsclient to edit it in an existing or new instance of emacs, in a new window.

Similar to Set up Emacs on Windows to start a single instance and open files in the existing instance - Emacs Stack Exchange, it boils down to:

exec emacsclient -c -s "$SOCKETNAME" -a emacs "$GENERATEDFILENAME" <>/dev/null

It's been working for years. emacs open a new frame, opens the requested file there.  Works both if emacs already launched or not (my init files include server-start).  So far, so good.

Wish: open file and run some simple expression

That on opening the new file, the cursor, instead of landing on the first line, lands (1) at the end of the buffer or (2) at the end of some specific line.

Search before you ask

I actually use several one emacs instance per project, similar to frames - From File Manager, open file in specific instance of Emacs - Emacs Stack Exchange. So there are several emacs instances with servers that may be active at a given time.

But there's no finite, known-in-advance, list of servers/projects.  So running that many servers in .xinitrc like in emacsclient - Multiple Emacs instances each with their own server? - Emacs Stack Exchange is not an option.

Try before you ask

Interactive experiment in emacs session, OK

Interactively,

M-x end-of-buffer

goes to the end of the buffer, and

C-u 11 move-end-of-line

move the cursor 11-1 lines down then at the end of that line.

So far, so good.

Scripted, new emacs instance: OK

Let's try first running a new instance.

emacs --eval "(find-file \"$GENERATEDFILENAME\")" --eval "(end-of-buffer)"

Line above correctly runs a new emacs instance, opens the requested file and puts cursor at end of buffer.  So far so good.

Scripted, existing emacs instance through emacsclient: OK

Let's run an emacs instance and make sure server-start is run.

emacsclient -s "$SOCKETNAME" -e '(end-of-buffer)'

Line above outputs nil, showing that it connects to the emacs-server, but does not move the cursor.

emacsclient -c -s server- --eval "(find-file \"$GENERATEDFILENAME\")" --eval "(end-of-buffer)"

Line above appears to open file and put cursor at end.

Having emacsclient do the job in both cases (emacs already running, and new emacs): NOK

Let's add -a emacs.

emacsclient -c -s server- -a emacs --eval "(find-file \"$GENERATEDFILENAME\")" --eval "(end-of-buffer)"

Result:

If emacs already runs with server, work okay.
If emacs does not already run, instead of running the expressions, if opens two buffers names like the expression, as if the command was emacs "(find-file \"$GENERATEDFILENAME\")" "(end-of-buffer)"

Bad bad bad. :-(

Showing why "no emacs running" case fails

strace shows what happens.

When running emacs directly:

execve("/usr/bin/emacs", ["emacs", "--eval", "(find-file \"2015y12m28d-18h23m49"..., "--eval", "(end-of-buffer)"], [/* 68 vars */]) = 0

When emacsclient calls emacs (in this case GENERATEDFILENAME is gfn.txt).

execve("/usr/bin/emacsclient", ["emacsclient", "-c", "-s", "server-", "-a", "emacs", "--eval", "(find-file \"gfn.txt\")", "--eval", "(end-of-buffer)"], [/* 68 vars */]) = 0
execve("/usr/bin/emacs", ["--eval", "(find-file \"gfn.txt\")", "(end-of-buffer)"], [/* 68 vars */]) = 0

As you can see, emacsclient does not call emacs the same way when using --eval.  Instead argv[0] is --eval which does not conform to exec tradition, and the other --eval is skipped.

Probably emacsclient does not assume that alternate editor is emacs or even emacs compliant.

Just in case, environment is Linux Mint 17.2 64-bit, which is base on Ubuntu 14.04.

Now what? Questions

Should we consider emacsclient behavior in the exec() call a bug?  It sure has some inconsistency.
Is there a simple way to have desired behavior: run the expressions either on an existing emacs instance or a new if none exists?


texts: In org-mode how to disable auto numbering of numbered list?

texts:
Here is an example of the text that I want the number of the list items to be frozen, no longer automatically updated in org-mode text.

2. List the customer number, customer name, event number, date held, facility
   number, facility name, and estimated audience cost per person (EstCost /
   EstAudience) for events held on 2013, in which the estimated cost per person
   is less than $0.2

Some text...

3. List the customer number, customer name, and total estimated costs for
   Approved events. The total amount of events is the sum of the estimated cost
   for each event. Group the results by customer number and customer name.

In the export to PDF or some other operation, the first list item, the '2' above would become '1', and '3' to '1'. I want them to remain what they were.

I tried to search for a solution, but couldn't find.


texts:
When I started Emacs with emacs -q

I customized the variable "Bidi Paragraph Direction" to 1 (right to left)

It only affected this "Customize .." buffer and the bottom buffer. One of them is illustrated in the following picture:

Other buffers are left to right.

I tried this without -q and it didn't work either after restarting Emacs.

My emacs-version is GNU Emacs 25.2.2


texts: how to use minibuffer instead of pop-up window for GPG files?

texts:
I am looking for Emacs password manager, and org-password-manager looks nice for my needs.

But when I am trying to open created passwords.org.gpg file (I use symmetric encryption for more ease), Emacs each time show me a pop-up windows, asking my passphrase. Is it possible to use minibuffer for this (instead of pop-up window)?

I have (setq use-dialog-box nil) in my .emacs file, but it does not help in this case.


texts: How disable "unexpected" scrolling behavior in small frames

texts:
I find the way that the cursor scrolls in small frames unintuitive. When I press C-p I expect the cursor to move up a line. Instead, in the org-mode file below, right before the cursor gets to the #+RESULTS line it jumps up several lines to the displayed image. Maybe this is a bug?

I experience the same behavior in a small frame containing a shell buffer.

If not, and this is the intended scrolling behavior in small frames, is there a way to disable it to get line-by-line scrolling?


texts: How to make irony-mode to change compilation database

texts:
I have irony-mode configured and I'm using it for a C++-project. The code is built using Make. I have a number of different make targets to build the code; test code, release code, unit test code etc. Each make target uses its own set of compilation flags and the unit test code is placed in a subdirectory. All this makes using one single compilation database for irony-mode less than ideal.

For each make target I have defined a corresponding make target that runs the build through Bear to generate a compilation database for the specific make target. Then I try to make irony-mode switch to using this newly generated compilation database by running the function irony-cdb-json-select. It is documented as

Select CDB to use with a prompt.

It is useful when you have several CDBs with the same project
root.

But when I do irony-cdb-menu nothing has changed, the compilation flags that should have been there are not there.

How do I force irony-mode to update the compilation database?

Edited

Using one Make target for release code and another for unit tests means a specific source file can be compiled using two different sets of compile flags. Unit tests makes use of mock objects which means in this context the list of includes (-I) might differ compared to compiling release code. So depending on if I work on release code or unit tests I think I need two different compilation databases.

The file compile_commands.json generated by Bear contains an entry for each source file. Does irony-mode read each entry and use the specific settings for one specific source file? Or does irony-mode read the first entry in compile_commands.json and applies these settings to all source files in the project? I could create one compile_commands.json by appending output from release builds and unit test builds so that the resulting compile_commands.json would have entries with different sets of include flags (-I) without duplicates for the same file of course. Is irony-mode sensitive to this?


texts: In Ivy, it can not to create directly a new file in a new folder (as type C-x C-f, then write a file path /current_path/new_fold/new_file). If there is a better way to do it, how to use the key binding along with a suitable Elisp?


texts: Is there any difference between \` and backquote?

texts:
I was surprised to find that if I use M-x ielm, I get a literal backquote:

ELISP> (read "`foo")
`foo

However, if I use M-: (read "`foo") then *Messages* and the minibuffer show (\` foo).

Are these two equivalent? Why doesn't (equal (read "`foo") `foo) return t?


texts:
I am trying to use cl-labels, but i have run into errors i do not understand. Here is elisp code i am using:

(defun nthelt (N ARRAY)
  "Behaves like nth but for arrays"
  (if (and (>= N 0)
           (< N (length ARRAY)))
      (elt ARRAY N)
    nil))

(defvar *neraser-board*
     [(*sync* . 7)
      (*cell* . 3)
      (*cell* . 2)
      (*cell* . 2)])

(defun neraser-check-victory ()
  "Check if victory or loss condition (weak) has been reached"
  (cl-labels ((victory-key (board-elem)
                           (cond
                            ((eq (car board-elem) '*c-sync*)
                             (nthelt 0 (cdr board-elem)))
                            ((eq (car board-elem) '*sync*)
                             (cdr board-elem))
                            (t 0))))
    (let ((victory-index (position 0 *neraser-board*
                                   :key 'victory-key
                                   :test-not 'eq)))
      (if (null victory-index)
          (message "Congratulations!")))))

When i try to run neraser-check-victory, i get this error:

  Debugger entered--Lisp error: (void-function victory-key)

How can i resolve this error?


texts:
Emacs 26.1, Windows 10 (64 bit)

M-x eshell

Here result:

But it's read only. But I need to type text in any place in any place in eshell.

Also I want to move cursor in any place in eshell buffer.
All of this I can do in shell buffer, but can't in eshell buffer. Also I want to change text in any place in eshell buffer.


texts: Uneven line numbers with display-line-numbers

texts: Emacs for some reason did not vacate equal spaces for each line number, So the lines were starting at different places which made it harder to keep track of alignment. It wasn't just the relative mode which had this problem, even the absolute mode does. Linum mode is quite heavy when compared to display-line-numbers.el.


texts: How to call an interactive function while building helm-sources?

texts:
With a region selected I can call this function "accdeb" (below) that gives me the right results in a list. How can I feed this list to helm ?

With the code below I get: wrong-number-of-arguments.

What am I doing wrong ?

(setq some-helm-source
      '((name . "stacktrace from region")
        (candidates . accdeb)
        (action . (lambda (candidate)
                    (message "%s" candidate)))))

(defun my-first-helm-command ()
  (interactive)
  (helm :sources '(some-helm-source)
        :buffer "*helm backtrace*"))

(defun accdeb (beg end)
  (interactive "r")
  (mapcar (lambda (arg)
            (shell-command-to-string
              (concat "/home/demetra/scripts/eaddrs2line.sh /my/workspace"
                      " "
                      arg)))
          (split-string (buffer-substring-no-properties beg end) "\n")))


texts: Installing PDF-Tools Windows(non-geek tutorial)

texts:
I want to use pdf-tools to anotate pdf files using org-mode or viewing pdf outputs of my tex files which I hope it wil support syntex. I am following the official help to build for windows. I want to comprehensively tell my situation before and after the steps I've taken.

I have cygwin, Imagemagick, git before being introduced to pdf-tools
Emacs: I have a windows built not a cygwin built. I downloaded the
200 MB version of emacs 26.

Now following what Official help requires:
If using the GNU binaries for Windows, support for PNG and zlib must first be installed by copying the appropriate dlls into emacs’ bin/ directory. Most third-party binaries come with this already done.
I check the bin folder of emacs and these files were there: zlib.dll, libjpeg-8.dll, libpng16-16.dll. I tested to see if I can open PNG or JPEG files in emacs and I could.
Then I installed msys2.
Then I clicked start button typed msys and chose MSYS2 MinGW 64bit.
Then I followed all the steps below:

$ pacman -Syu
$ pacman -S base-devel
$ pacman -S mingw-w64-x86_64-toolchain
$ pacman -S mingw-w64-x86_64-zlib
$ pacman -S mingw-w64-x86_64-libpng
$ pacman -S mingw-w64-x86_64-poppler
$ pacman -S mingw-w64-x86_64-imagemagick

For this step Install PDF tools in Emacs, but do not try to compile the server. Instead, get a separate copy of the source somewhere else. I went to Emacs folder and right-click on lib folder and clicked GITBash here, and then entered git clone https://github.com/politza/pdf-tools and this created a folder named PDF-Tools in lib folder with the size about 4MB.
I don't know how to effect the next two steps, i.e.:

Open mingw64 shell (Note: You must use mingw64.exe and not msys2.exe)
Compile pdf-tools $ cd /path/to/pdf-tools $ make -s

I don't know where my mingw64.exe is located. Would you please help me.
Thanks in advance.
P.S. I tried this command make install-server-deps on cygwin and also MSYS2 MinGW 64bit but both of them returned this: -bash: make: command not found.


texts:
In the quick capture window, I can add a deadline for 12pm today by typing C-c C-d 12pm:

** TODO test
DEADLINE: <2019-03-26 Tue 12:00>

If I add minutes with 12.30, it moves the date to 2030:

** TODO test
DEADLINE: <2030-04-12 Fri>

and 12.30pm is invalid.

Can I set minutes into a deadline in quick capture?


texts: Automatically open headline on internal link

texts:
The following example implements an internal link to a headline:

* Heading1
- Important facts
* Heading2
- Jump to [[*Heading1][Link]]

When following/opening the "Link" with C-c C-o, point moves to "Heading1". If the headline is closed, I would like it to open (unfold, expand) automatically when point lands. If the headline is already open, then do nothing (meaning, org-cycle can't be used).


texts: I have a long spreadsheet 30 rows and 60 columns . It is difficult to work on columns as I can not freeze the columns. Is it possible to collapse the columns ?


texts: Getting auto-complete-mode user dictionary to work

texts:
I have been having trouble getting user-defined dictionaries to work with auto-complete-mode. I have read the documentation, and I have the following configuration in my init file:

(use-package auto-complete
   :ensure t
   :init
   (require 'auto-complete-config)
   (add-to-list 'ac-dictionary-directories "~/.emacs.d/es-ac-dict")
   (setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
   (add-to-list 'ac-modes 'sql-interactive-mode)
   (add-hook 'sql-interactive-mode-hook (lambda () (auto-complete-mode 1))))

I only use auto-complete mode with sql-interactive mode and I have a file called sql-interactive-mode in the directory ~/.emacs.d/es-ac-dict with the following:

select
where
from

However, when I am in a sql-interactive-mode buffer, my dictionary doesn't seem to be used. Once I type select, the next time I type select I will get a completion from ac-source-words-in-same-mode-buffers, but I don't get completions initially from my dictionary. Do I have the format of the file/directory structure wrong, or is it something else in my auto-complete-mode configuration? Thank you!


texts: How to make emacs align and indent a bibtex entry?

texts:
I want bibtex-mode to align and properly indent fields.  I copied a bibtex entry for the following article into Emacs:

(Article source here)
But, with a simple paste, the alignment is lost in Emacs and the indentation is messed up:

The TAB key doesn't work to align or indent the entry. How to solve this problem?


texts:
I was a happy ESS and R user to obtain tex and pdf files from Rnw file with sweave and knitr. I have followed the answer given here, everything worked fine but after several updates or maybe new installation I cannot even find the ess-sweave customization group in Emacs. M-x customize-group: ess-sweave is [No match].
I am using GNU Emacs 25.1.1 on Debian 9 (stable).

> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

> packageVersion("knitr")
[1] ‘1.21

ESS version is 20190306.2305.

What am I missing to start to use knitr with ESS?


texts: Is it possible to detect C/C++/Java variable declarations.?

texts:
I'm writing a minor mode to handle automatic spacing of operator characters, but I'm having some trouble with C/C++. The problem is that I can't figure out how to tell in general whether a * is a multiplication or a pointer type. Similarly for &, and </> in C++ .

I've currently got some basic hacks to detect the built in types (int, char, etc.) and to detect types ending in _t. I've also found the c-guess-basic-syntax function which can tell me when point is in a function header so I can handle function argument and return types. However I can't find any way to detect when point is in a normal variable declaration.

Is it possible without implementing a C compiler?


texts: Get emacs to read unquoted strings in json

texts:
I am trying to use emacs-lisp to interact with a MongoDB. Here is an example of a string that mongo returns, that emacs cannot read. The problem is the unquoted ObjectId and ISODate items (if I put quotes around them, then it parses fine).

(json-read-from-string "[ { \"_id\" : ObjectId(\"589f59860a25be50ecd9a6d0\"), \"date-added\" : ISODate(\"2017-02-11T18:35:50.046Z\") }, { \"_id\" : ObjectId(\"589f598c0a25be50ecd9a6d1\"), \"date-added\" : ISODate(\"2017-02-11T18:35:56.634Z\") } ]")

Is there a way to get the json library to read this kind of json? Right now what I do is "quote" and "dequote" the json string, but it means I have to keep it up to date with all the things that mongo might return one day.


texts:
My use-case: So, I have two windows in a frame. Each window has a different buffer rendering in it. Out of them one was previously displayed using the function display-buffer.

Now, I want that buffer to get hidden (or out of sight) programmatically so that only one buffer is visible in the frame. What is the relevant Emacs API for that ?


texts: How to configure linum-mode in spacemacs?

texts: How can I configure spacemacs to always have linum-mode active in C/C++ buffers (cc-mode)?


texts:
I'm writing a loop to perform some interactive replacements on matched strings:

(while (search-forward-regexp "REGEXP" nil t)
  (read-char "Options:...")
  ; Replacements...
  )

and I need the matched string to be "temporarily" highlighted until the replacement has done (or skipped).

What is the best way to get this behaviour?

(I figure out something like this:

(while (search-forward-regexp "REGEXP" nil t)

  (push-mark (match-beginning 0))
  (let ((x (make-overlay (mark) (point))))
    (overlay-put x 'face '(:background "grey20")))

  (read-char "Options:... ")
  (remove-overlays (mark) (point))
)

but I'm pretty sure it is not the best choice)


texts: Org Mode: Difference in results when evaluating code block and evaluating called code block

texts:
I am a beginner who wants to evaluate a Call to a code block in an org-file and get the same results as when I evaluate the actual code block. Like so:

#+NAME: Myblock
#+BEGIN_SRC emacs-lisp :results output raw
  (progn
    (princ "Hello"))
#+END_SRC

Which gives:

#+RESULTS:
Hello

But when I do

#+CALL: Myblock()

It gives me

#+RESULTS:
: Hello

I tried to give arguments to the call, but it didn't seem to affect it at all.

Please help!

/HC


texts: What paradigm shift of my thinking must happen to understand the essence of Emacs/Emacs Lisp?

texts:
I've always had "AHA!"-moments when encountering new concepts or ideas in programming.

That's when things start clicking for me.

And I think I haven't yet had that moment with Emacs/Emacs Lisp yet.

Or for that matter, is there even one?

For example:

Object-Oriented Programming

"AHA! I can make my own types that behave just like regular types!"

Functional Programming

"AHA! I can divide every everything into functions!"


texts: Prevent TAGS file from opening in buffer

texts: I have a TAGS file, generated by Projectile, its size ~1Gb and when i accidentally switch current buffer to TAGS, Emacs freeze for long. Is there way to prevent TAGS buffer from opening?


texts:
In my initialization file, I have got:

(require-package 'clips-mode)

The thing is that, lately, this package fails to be loaded sometimes (it's already downloaded but I guess it fails when it tries to check for new versions of the package), and when this happens, the initialization file stops reading and subsequent sentences are not read.

I'd like to know if there are a way to ignore errors and keep going even if this specific require-package sentence fails, so the rest of the initialization code is applied anyway.


texts: Symbol's function defintion is void: org-show-all

texts:
I get the above error when trying to archive my org agenda using C-c C-x C-a and/or C-c C-x C-s, according to instructions over here. My archive location is set the default.

UPDATE:
After following @Tobias' instruction below, I get this error when using TAB on my headings to fold them:
org-cycle-internal-local: Symbol’s function definition is void: org-flag-region [7 times]

I just installed the newest version. Now I have two separate org.el:
./.emacs.d/elpa/org-20190701/org.el
./.emacs.d/elpa/org-20190624/org.el

But the flag region issue still persists.
I think Emacs seem to be confused over which init.el to read as well, because all my settings are left unevaluated after a restart.
Can't seem to locate the system org.el (if it exists).

Follow-up QUESTION
A natural follow-up question would be: How to prevent such confused situation when updating org to the newer version?


texts: What does S mean in emacs keybinding notation (org-mode)

texts:
Looking at the keybindings here http://orgmode.org/guide/Structure-editing.html#Structure-editing, it asks us to use

M-S-<RET>

to add a TODO at the same level. What does the S here mean? I have tried shift and capital S, neither have worked.


texts: No PHP blade block syntax highlight or indentation

texts:
I am creating an app with Laravel using Emacs and I can't get Emacs to highlight syntax using web-mode in blade with neither @php @endphp blocks or using <?php ?> blocks. I saw this question before but no one came with an answer. There is a way to do this with web-mode? Or should I choose another mode for editing blade templates.
MRE
In an Emacs buffer with web-mode and blade engine paste the following
@php
  switch ($type) {
    case 'Help':
      $variant = 'info';
      break;
    case 'Text':
      variant = 'success';
      break;
  }
@endphp

<?php
  switch ($type) {
    case 'Help':
      $variant = 'info';
      break;
    case 'Text':
      variant = 'success';
      break;
  }
?>

In neither case you get highlighting or indentation properly (in the image I do the intentation myself).


texts: HTML-mode insert tag without attribute(s)

texts:
In HTML-mode C-c C-o is bound to sgml-tag which inserts a tag of choice and one or more attributes. My question is this:

How can I insert a tag with sgml-tag and skip insertion of an attribute. For instance, if I call the function interactively trying to insert a p-tag, I am not able to exit the insertion process without entering an attribute. Using C-g seems to abort the process, resulting in a broken opening tag.

Is there a way of entering a tag without attribute(s)? I have not found an answer in the EMACS documentation.


texts:
I have a document full of internal org-mode links of the form:

* Target Heading

...

[[Target Heading][Description]]

However, these break whenever I edit the heading that they link to, so I want to replace them with links of the form:

* Target Heading
  :PROPERTIES:
  :ID:       403847B2-3D4C-4EFB-96DE-E0C5C52A02B5
  :END:

...

[[#403847B2-3D4C-4EFB-96DE-E0C5C52A02B5][Description]]

I have started on some code that will follow the link at point, add an id to the heading it finds and save the link to that heading. I then want to update the link with the new target:

(defun adam-open ()
  (require 'org-id)
  (save-excursion
    (save-restriction
      (call-interactively 'org-open-at-point)
       (call-interactively 'org-store-link)))
  (org-insert-link))

The trouble with this is that because the link under point already points to a text-based link, org-insert-link fails to replace the target with the stored id. Also, org-insert-link works interactively

Is there any way to pass the id as a parameter to org-insert-link so that it overrides the default text-based target and avoids the interactive prompt?


texts: How to temporarily start emacs without loading spacemacs?

texts: Emacs with spacemacs takes a long time to load and for some things such as git commit messages I would like to start basic emacs without loading spacemacs. I don't want to wait for spacemacs to start up just for editing a git commit message and closing it right away.  Is there a way to do that?


texts:
While I enjoy the table mode of org and love the way I can work with the data in these tables with eg Python or R I am currently stuck with a simple problem: How can I exclude the table from being exported?

#+TBLNAME: data
| Col1 | Col2 | Col3 | Col4 | Col5 |
...
#+TBLFM: ...

While i do know where I would include the respective option when executing R code (here I write :exports results so that the source is hidden) and while I know that |: as an option should seal the deal:

#+OPTIONS:     H:2 num:t toc:t ::t |:f ^:t f:t tex:t

I still have my huge table in my document. What am I doing wrong?


texts: Function to delete all comments from a buffer, without moving them to kill ring

texts:
I need to be able to remove all comments from a buffer from elisp code. For now, I am using:

(goto-char (point-min))
(comment-kill (count-lines (point-min) (point-max)))

However, comment-kill is an interactive function, and its primary usage is to delete one comment at a time. Additionally, it has annoying visible side-effects, since it adds all the comments it killed to the kill-ring.

Is there a function allowing to delete (not kill) some or all comments from a buffer?


texts:
Is there a way to create folders within speedbar?

I am using sr-speedbar and to add a folder I am using the dired mode like:

Ctrl+X D (C-x d), then + to create a directory.


texts: Convert tabs to spaces when copying text to external applications

texts:
I use tabs in C/C++ but want to convert those tabs to spaces when copying code that I'm going to paste into an external program. However, I want the original code to retain tabs. Additionally (if possible), I'd like to keep the tabs when copying/pasting within Emacs.

I sort of adapted the code at this link and tried:

(advice-add 'kill-ring-save :before 'untabify)
(advice-add 'kill-ring-save :after 'tabify)

but it doesn't copy all the text and converts away from tabs when copying and pasting within Emacs.

For instance, if I use the above setup on

int main()
{
        int i = 5;
}

it only copies

int main()
{
        int i

I'm not a Lisp programmer and am relatively new to Emacs, so forgive me if I'm missing something obvious here.


texts:
How am I supposed to organize my daily mail with Gnus?
Where to put my old mail (without deleting it) and stay in touch with all those old or incoming TODOs and topics?

Background:

I already got a working Gnus configuration. I can see and reply to email.
I could not yet find an article about: how to actually work with Gnus.
Gnus does not (easily) seem to support moving mails to another folder(?)

How do I work until now:

until now I am using Claws-mail.
I receive mail daily. This mail need to be read and after that, I use this mail in my Inbox as an TODO item. This is not the best approach, but it works.
When I finished the TODO, or the mail is just an information, I stuff this mail into a subfolder (I have nearly 120 of them, all with different topic).
From time to time I need to look up some information from old mails (even from 3 years old mails). The information is stored in excel sheets, word documents, Zip-archives, PDFs, text files, web links, or just the mails body. I then navigate to the folder and see the mail at once or I search this folder
what is not working with claws:

claws-mail does not support searching an entire folder subtree (this would be nice to have)
clwas-mail does not support searching in archives, PDFs strange document formats (I do not care about this)

What would I like to be able to do:

I do not need to have the same workflow in Gnus, but I need to find all topic related information from mails fast.
When talking about finding mails: not always the mail subject is useful. Sometimes the date, when the mail arrived, has to be taken into account.

Remarks:

It is too time consuming to retype everything into some sort of database and imho sometimes not possible. So I would like to use the information already stored in those emails.
I do not care if I need to reorganize the exiting mail folder tree.
This question is not about org-mode, but I most probably will use that, too. (its the initial reason, why I would like to switch)
I liked the idea of mu4e and notmuch, but they do not support s/mime (and X-Mail-Headers) properly, so I can't use them.


texts: How to change the font color of popup in haskell layer

texts:
I am not good at emacs because using spacemacs only for haskell coding.
I want to change the font color of popup from white to black. White text on yellow popup is too hard to read.
It's solarized dark theme and haskell-layer.

Please let me know how to change this font color.


texts: Emacs can't write to its own init file on Windows 10

texts:
I have been using Emacs on Windows for decades now and it essentially always worked fine except for minor annoyances.  However, I recently had to buy a new machine with Windows 10 (the last Windows I used Emacs on was Win7) and now I'm in the strange situation that Emacs can't write to ~/.emacs anymore.  Whenever I try to do that, I get a message about wrong file permissions.  If I then close and restart Emacs, it can't even read the file anymore, so I have to fix the permissions (which I usually do with Cygwin).  To be clear: The file permissions are fine before Emacs tries to write to ~/.emacs, but then Emacs itself somehow messes up and as a result it can't read or write the file anymore.

I have "fixed" the problem for now by renaming the file to ~/_emacs, but I'd like to know what the reason for this behavior is.  (And in the long run I'd like to get rid of the warning message that the underline is deprecated...)

Emacs version is: GNU Emacs 25.0.94.2 (x86_64-w64-mingw32) of 2016-05-26

(I'm also using Emacs via a pretty old version of gnuserv in case that matters.)


texts: How do I display dashs as minus signs outside comments and strings?

texts:
In source code, I'd like to display “-” as “−”.  In the font I use, the dash is very short and doesn't match the “+” at all.  This is only to improve visual appearance.  The character in the file must remain the same because it is code, which need to stay correct.

So far, I've used:

(add-hook 'python-mode-hook
          (lambda ()
            (font-lock-add-keywords nil
                                    '(("\\B-\\B"
                                       (0 (progn (compose-region (match-beginning 0) (match-end 0)  "−"
                                                                 'decompose-region)
                                                 nil)))))
            ))

The \B-\B magic is so that this does not apply in text, i.e. within strings or comments, because I need it still displayed as a dash there.

Unfortunately, this cause a lot of false negatives.

Is there a way to automatically display one character as another outside strings and comments?


texts:
When an Emacs buffer is modified, a broken link is created.
The link's name is a concatenation of '.#' followed by the file's name.
For example:

$ ls .#spacemacs_ref.org -l
lrwxrwxrwx. 1 wolfv wolfv 44 Aug 18 01:11 .#spacemacs_ref.org -> wolfv@localhost.localdomain.17997:1502966690

The '.#' link goes away when the file is manually saved, but not when auto-saved.
Auto-save happens in 30 seconds and the mode-line's '*' changes to '-'.
If I manually save the file after auto-save occurs, the mini-buffer says "(No changes need to be saved)".  Which is true, but the '.#' link remains.

In my .spacemacs configuration file sets auto-save to original file:

(defun dotspacemacs/init ()
...
(setq-default
...
 dotspacemacs-auto-save-file-location 'original

What is the purpose of the '.#' links?

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


texts: Use two major-mode-maps in the same buffer

texts:
I've run into a few situations where it would be highly convenient to
have to have the keymap of one major-mode act as a fallback keymap for
another major-mode. For instance:

I write a lot of LaTeX in some of my org documents, so it would be
great to have latex-mode commands easily available while editing
org-mode.
I frequent an irc room with Markdown support, so it would also be
nice to have markdown-mode keybinds added to erc-mode.

In both cases this extra keymap should act as a fallback (this why
I can't just use a minor mode for this). I don't want latex commands
to override any org-mode keys. What I want is:
If a key is defined in latex-mode-map AND it is not defined in
org-mode-map then use the latex-mode-map binding.

Q: How can I set a keymap as a fallback keymap for a major-mode?
OR
Q: How can copy keys from one major-mode-map to another, without overriding anything?

Just to be clear. I know I could define these keys one by one, but
it would be infinitely more convenient to have an automated solution.


texts: How can I use Emacs to edit questions, answers, and comments here?

texts:
Emacs as a StackExchange client?

How can I use Emacs to edit questions, answers, and comments here on the Emacs Stack Exchange site?

Broadly, what possible methods exist?

Kill and yank

This works, but the method is so cumbersome that it's not worth it for short posts or even medium-length posts.

Browser plugin

There is a relatively well know browser plugin for Firefox that lets your push the text content of any <textarea> back and forth between the editor of your choice.  I presume it works via temp files and I haven't evaluated it.  Using the plugin with emacs has been discussed on StackOverflow.  I don't use Chrome any more.

Stack Exchange API

Something called Stack Exchange Mode for Emacs exists.  I have not evaluated it.  The source isn't too stale, but the project is obviously not completed.

Other options?

I seek suggestions!

Motivations

Regardless of what method is used to edit questions, answers, and comments in emacs, I am sure that doing so will enable us to do some common tasks with ease:

Adhere to conventions.  Something like M-x record-keystrokes-and-write-them-out-as-markdown RET C-x C-s C-g RET ...might yield:

C-x C-s C-g
Ask what an error message means: M-x post-region-on-emacs-se-as-question RET ...


texts: Can I automatically see pre-commit hook output when committing with magit?

texts:
A coworker has just set up our main repo to use overcommit. It's lovely, and keeps us from invoking long CI builds which will fail for trivial reasons by warning us about issues using pre-commit hooks. But I don't feel it integrates as well with magit as I would like. Right now, my workflow looks like:

hit c c in magit to commit
quickly hit $ to pop open the process buffer and watch the checks run (and they're a bit ugly too because of escape codes for color)
enter my commit message if successful
move on with my life. Hooray!

What I'd like would be:

hit c c in magit to commit
magit automatically opens a buffer containing the pre-commit output, respecting color codes
magit lets me enter my commit message as usual

Surely there's a way to get here. How would you approach it?

N.B. I have seen "Magit show git hook output" on Emacs StackExchange, but the answer was given in 2015 and doesn't work any more!


texts: Default keybindings for evaluating code?

texts:
As far as coding so far I have only used emacs for R (using ESS). Now I am trying it with js and may use it for more languages. I wonder if there are default keybindings for evaluating code?
Using ESS I mostly use C-c to send a code block and C-Ret for sending the current line. Now looking at sites regarding js, people seem to use C-x C-r for region for example.
Is it wise to adhere to a "standard", or just set them up as you go?


texts: Removing unwanted colors (and other decorations) from yanked text

texts:
I have a Java properties file that, when opened with Emacs, shows up in a color coded form, as below:

I also have a simple text file.
When I yank something from the properties file into the text file, the font colors are yanked along with the content.

How can I strip a selection of such text in the text file of any colors and any other unwanted decorations?


texts: How to highlight a buffer between given pairs of points?

texts:
I have a list that looks like this:

(((assoc)
  (start (assoc) (line . 430) (col . 28))
  (end (assoc) (line . 430) (col . 37)))
 ((assoc)
  (start (assoc) (line . 433) (col . 14))
  (end (assoc) (line . 433) (col . 23))))

I'd like to highlight all the regions specified by the start/end pairs. I should be able to do this if I had a function that highlighted a region in an emacs buffer, but I see no such function. I checked the hl libray but all the commands seemed to design for interactive use. Is there anything that can help me?


texts: use-package & quelpa: resolve dependencies with elpa?

texts:
When modifying some packages I'm using (use-package :load-path "my-forked-project") but to make my config work in any machine I want get that package from say my github repo.
I'm now trying quelpa alongside quelpa-use-package but I'm having the following problem:
the dependencies of the package I'm loading from my github repo are also handled my quelpa, and thus instead of downloading the requirements of that package from elpa, their git repositories are cloned (and also I'm in a situation where this broke my config cause apparently the upstream repo has a problem..?).
Is there a way to have the dependencies of the package I'm getting from my git repo to be fetched with the normal use-package instead of quelpa?
I guess I can fix this by installing first myself the dependencies with use-package, but is there another way to handle this?


texts: How can I add meta data to text files by using "file-props.el"

texts:
I have a large number of text files with notes, and would like to add meta data (tags and comments) to each file, and display them when using dired. I am using windows 10, and emacs 25.0.93.1 (x86_w64-mingw32).
So I have installed file-props.el for this purpose, with file-props.el in my load path and  the following lines added to my init.el file:
(require 'file-props)
(file-props-load-properties)
(file-props-dired-activate-display)
(file-props-dired-setup-keybindings)

But when I try using the
file-props-add-to-current-file (when inside a text file) or
file-props-dired-add-tags (when having marked a text file in dired)
I get the following error message:

Can anybody see whats wrong in my use of file-props? Thanks in advance for any help!
Are there other functions than file-props to add meta data to text files, when working in emacs?


texts: How can I catch a block of text to be used in a replacement-part code?

texts:
I want to save a block of text in a variable and then do a replacement using that variable in the replacement part.
For instance, suppose to do the following replacement:
block_of_text

--->

\begin{env}
  block_of_text
\end{env}

where block_of_text can contain chars to be escaped (mainly \, [ and ]).
Define markers at the beginning and at the end of block_of_text and call them pos1 and pos2, respectively. At this point, I generally use buffer-substring-no-properties to catch my block_of_text.
If block_of_text contains \, I use the following code:
(setq text (replace-regexp-in-string "\\\\"
                                     "\\\\\\\\"
                                     (buffer-substring-no-properties pos1 pos2)))

but how can I do if block_of_text contains [ and/or ]?
More clearly, I wonder how to use buffer-substring-no-properties to do my replacement with a "query-like" approach or if there is a more suitable function in order to catch a block of text to be used in a replacement-part code (this is my real question; example and code are given for greater clarity).
Code
;; search part omitted

(save-excursion
  (let* ((pos1 (copy-marker (match-beginning 0)))
         (pos2 (copy-marker (match-end 0)))
         (text (replace-regexp-in-string "\\\\"
                                         "\\\\\\\\"
                                         (buffer-substring-no-properties pos1 pos2))))

    (query-replace-regexp text
                          (concat "\\\\begin{env}\n"
                                  text
                                  "\n\\\\end{env}")
                          nil pos1 pos2)

    ))

I know that there are other ways to do what I ask, but, due to my work, it is very important that emacs queries me about replacements to be done.


texts: What options are there for writing better non-programming text in Emacs?

texts:
This is a fork from the question What options are there for doing spell-checking in Emacs?

Because I'm currently doing a lot of non-programming tasks in Emacs I'm wondering whether Emacs can support me in writing better texts.

So, let's open with the obligatory question phrase

  Are there any packages/libraries/built-ins tailored to help me write better, more correct and concise texts in Emacs?

Specifically,

for grammar spell check. Something similar to (but hopefully better than) the MS Word spell-checker which recognizes if a sentence is grammatically wrong
for improving your phrasing and the expressions you are using. Something along the lines of Dead Poets Society:

  So avoid using the word 'very' because it's lazy. A man is not very tired, he is exhausted. Don't use very sad, use morose. [...]

for anything which I forgot or am not aware of but you can think of (phrasing/language improvement-related, duh...)


texts: isearch looses focus when trying to paste into the isearch buffer

texts: strange issue. when i launch isearh and want to paste text into it, after pressing C-s the paste (S-insert) always pastes the text to the current edited buffer and not the isearch window. has anyone come across anything like this?


texts: Set font for Devanagari Characters in Doom Emacs

texts:
Running Doom Emacs 2.0.9 on Emacs 27.1.
I want to always display Devanagari characters in a specific font (Sarpanch). This font is installed on my computer and I can use it in all other applications like Libre Office, etc.
How do I achieve this?


texts: What piece of code in Emacs makes `line-number-mode` print "??" as line number in buffers with long lines?

texts: I'm using line-number-mode to have an indicator of the current line in my modeline, however for large files or rather, files with long lines, it starts displaying two question marks instead of a line number. I've digged a bit and found out that while line-number-mode is defined in simple.el, the customizable variables (and probably all logic involved) are defined in xdisp.c.  Changing the line-number-display-width variable to an arbitrarily high number might fix this, but I'm far more interested in the piece of code and the logic that makes it print the two question marks. It'd be very useful if any of you could find it for me, maybe even explain the logic behind it.


texts:
When loading auto-complete via auto-complete-config with use-package, then :config is not executed and local keymap is not set. (See example below)

Why that and how to solve this?

Example: save following into a file foo.el and run with emacs -Q -l foo.el.

(message "DEBUG: my-shortconfig start")

;; init package and use-package
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")))
(require 'package)
(package-initialize)
(require 'use-package)

;; auto-complete-config:
(use-package auto-complete-config
    :commands (global-auto-complete-mode auto-complete auto-complete-mode)
    :bind (("M-<tab>" . my--auto-complete)
           (:map ac-mode-map
                 ("M-<tab>" . auto-complete)))
    :init (progn
              (message "DEBUG: auto-complete-config init")
              (defun my--auto-complete ()
                  (interactive)
                  (message "DEBUG: my--auto-complete inside")
                  (unless (boundp 'auto-complete-mode)
                      (global-set-key (kbd "M-<tab>") nil)
                      (global-auto-complete-mode 1))
                  (auto-complete))
              (setq ac-auto-start nil
                    ac-quick-help-delay 0.5))
    :config (progn
                (message "DEBUG: auto-complete-config config")))

(message "DEBUG: my-shortconfig done")

The expected Messages, after pressing M-tab in *scratch* buffer, are:

DEBUG: my-shortconfig start
DEBUG: auto-complete-config init
DEBUG: my-shortconfig done
DEBUG: my--auto-complete inside
DEBUG: auto-complete-config config

But I only get:

DEBUG: my-shortconfig start
DEBUG: auto-complete-config init
DEBUG: my-shortconfig done
DEBUG: my--auto-complete inside

Also M-tab is not bound in ac-mode-map

Note:
I found some questions to similar problems, but they do not help.
auto-complete-config provides auto-complete-config and :config stuff should be executed after (require 'auto-complete-config)


texts: Rename org buffers to org's +TITLE instead of filename

texts:
I have hundreds of org files in a single directory that I use as a personal knowledge base and use deft to quickly find and open them. Each file is automatically named based on the current time (yyyy-mm-dd-hhmm.org) but Deft displays the org file's title instead, which is identified at the beginning of the file with the syntax #+TITLE: <title>.

When using ivy's switch-to-buffer minibuffer, only the filename is displayed for other org file buffers. I would like it to instead display the title listed as <title> above (and potentially display in a different color as well). I'm very new to elisp and can't quite figure out how to do this.


texts: How to get rid of strange tab in "emacs-mac" frame

texts:
On macOS High Sierra I have install the  "emacs-mac" Emacs port via homebrew. The Emacs version now is 25.3.3.

When starting up Emacs I get this strange tab in my Emacs frame:

I have set the Document tab setting "Prefer tabs when opening documents" in the Dock Preference pane to "Manually". I still have this useless tab.

How can I get rid of it?


texts: Carbon Emacs ⌘-shortcuts in Mituharu-Emacs?

texts:
I've been using vanilla Emacs on OSX (via MacPorts or from emacsformacosx.com) pretty happily until a bug forced me to try a different version. I was recommended Mituharu's branch, and have been very happy with its mild enhancements over vanilla Emacs.

However, over the years I've grown used to using Alt as my Meta key, and Mituharu's branch defaults to Cmd/⌘. This is easily changed by customizing mac-command-modifier, however it lacks the OS X-style shortcuts that vanilla has (⌘-C/V for copy-paste for one).

What's the easiest way to get those shortcuts? The only thing I found was mac-key-mode, but that's not (yet?) packaged anywhere. Is there a better alternative?


texts:
When I try to enter tags, autocomplete is tedious. I do C-c C-q enter first few characters, hit TAB then select. And repeat if I want to add more than one tags.

I can do the same by entering : in the heading, enter the first few characters of the tag followed by ESC TAB.

I find both the option tedious. What I would love to have, instead, is after the heading, I enter : and ANY characters in a previously entered tag. Possible completions are shown right there. I select the one I want and enter a : and repeat if I want to add more tags.

Is there a way to achieve this? If it can not be done in the heading itself, I am OK with entering C-c C-q and doing the same thing.

Important thing is enter any characters, ignore case while matching, and choices are shown right there.


texts: Prevent :EXPORT_LATEX_HEADER: in a subtree from overriding all buffer #+LATEX_ lines

texts:
Possibly a bug: When using :EXPORT_LATEX_HEADER: in a subtree's :PROPERTIES: it overrides all the buffer-level #+LATEX_HEADER: commands as well as everything given in an external file with #+SETUPFILE:.

So when having something like:

#+SETUPFILE: setup.org
#+LATEX_HEADER: \command1

* Headline
  :PROPERTIES:
  :EXPORT_LATEX_HEADER: \command2
  :END:

All you get in the exported .tex file is \command2 in the header, without \command1 and nothing from the setup file. Feature or bug, and if feature, how to unfeature it?


texts: How to display only the pop-up capture frame

texts:
During (org-capture) invoked from any other app on OSX, Emacs displays the non-capture frame as well (behind the capture frame).  Is there a way to get Emacs display the capture window only when (org-capture) is invoked?  In other words, what is the way to separate the capture buffer frame from the main Emacs frame and display only the capture frame?  Thank you.
-jay


texts: Hide SCHEDULED items in org-agenda until they are past their scheduled date and time

texts:
When processing my tasks in org-mode I use a custom view that displays my unscheduled/undeadlined TODOs, as well as the next two days of my days-agenda. I would like to use SCHEDULED dates as the start date for a task, i.e., this task cannot even be started until the SCHEDULED date and time have past. With this in mind, a task that is scheduled for 5pm tomorrow is not only useless to me today, it is equally useless tomorrow until after 5pm. Is there any way to hide SCHEDULED tasks from TODO lists and agendas if it is before their due date and time?

I am aware of the settings (setq org-agenda-todo-ignore-scheduled 'future)
and (setq org-agenda-tags-todo-honor-ignore-options t). However, the former seems only to apply to the global todo list, and the latter is for tags-todo search; neither setting seems to have any effect on the daily/weekly agenda. In addition, the settings mentioned above only seem to consider the scheduled date not the scheduled time, so even in the global todo list, items scheduled for tomorrow at noon will be visible from tomorrow after midnight on.

I assume this is possible because the agenda is date and time aware, but I have not been able to find a solution.


texts: replace-regexp-in-string: How to prepend a string to the entire string matched?

texts:
I am adding divider lines to certain sections of the reports generated by the binary ledger [ https://www.ledger-cli.org/ ] through the function ledger-do-report in the ledger-mode Lisp library [ https://github.com/ledger/ledger-mode].  To accomplish this goal, I have chosen replace-regexp-in-string.  I wish to prepend the divider line followed by a new line; i.e., "======\n".
Q:  Is there a built-in way to prepend the additional string without the need to create an empty substring at the beginning of the REGEXP; i.e., \\(\\)?
In the following example, I have begun my REGEXP with ^\\(\\) so that I can replace that number 1 subsexpression with the new string.  However, I have a feeling that there is a more correct approach to simply prepend a string without using an empty placeholder in the REGEXP.
NOTE:  The ^[ is defined by Emacs as:    old-name: ESCAPE; general-category: Cc (Other, Control); decomposition: (27) ('^[')
  ;;;           $ 98,477.47  ASSETS
;;;  =>
;;;
;;;           $ 98,477.47  ^[[34mASSETS^[[0m
;;;
(setq report (replace-regexp-in-string
               "^\\(\\)[\s]+$[\s]\\([0-9,.]+\\)[\s]+^[\\[34m\\(ASSETS\\)^[\\[0m$"
               (concat (make-string (- (window-width) 1) ?=)" \n")
               report nil nil 1))


texts:
I downloaded clojure-lsp (https://github.com/snoe/clojure-lsp) and tried to add it as a client in my init.el:

  (use-package lsp-mode
    :ensure t)
  (use-package lsp-ui
    :ensure t
    :config
    (add-hook 'lsp-mode-hook #'lsp-ui-mode))
  (lsp-define-stdio-client
   lsp-clojure-mode
   "clojure"
   (lambda () default-directory)
   '("~/bin/clojure-lsp")
   )

However when I do M-x lsp-mode in a clojure file, I only get this error after a short while:

Error during redisplay: (eval (lsp-mode-line)) signaled (wrong-type-argument lsp--workspace nil)

How do I correctly add clojure-lsp to lsp-mode?


texts: Magit: edit Git command before running it

texts:
I would like to manually edit the Git command run by a Magit popup. Is there a way to do this?

For example, in magit-log-popup, I want to add --date default to the git log command that Magit is going to run. The --date option is not one of the options supported by the log popup.

UPDATE: Feature request: https://github.com/magit/magit/issues/2700.


texts: [up/down]case-region: Skip read-only text; Operate on read-write text; No Error

texts: The buffer contains a mixture of text that is read-only (with 'read-only text properties) and read-write (i.e., no 'read-only text properties).  I want to [up/down]case-region as to the read-write sections, but am unable to do so due to the 'read-only sections.  How can I [up/down]case everything that is read-write within the defined BEG/END of the region, skipping the read-only text, and not yielding any error message?


texts: org-mode code block for an unknown language?

texts:
I want to display a block of code in a documentation file as, well ..., a block of code.
In markdown language, this can be achieved by quoting the code using a pair of backticks "`".
Can this be safely done in org-mode?
The language is not on the org-babel supported list:
https://orgmode.org/manual/Languages.html#Languages
, so I am not sure what to use for the required  field of #+begin_src.
By the way, I do not intend to execute the code in the .org file.


texts: Pixelwise access to the fringe? Making a basic progressivescroll/metalscroll/VS-mapmode

texts:
Is there a way to create a fringe in emacs that can allow for arbitrary pixel-wise access from elisp?  Rather than 8x8 char-wise access that I think is the only option now.

What I'm looking for is a way to add small markers in the right fringe area to indicate where modified lines or other points of interest, like breakpoints/fly-check markers are in the buffer.

So these markers would be small and buffer relative, that is correspond to the vertical scroll-bar position.

Identical functionality can be seen in the Metalscroll, Progressive scroll or map-mode extensions to visual studio.

If there are any C patches for the emacs source that do something similar that anyone knows about I’d be really interested too.

Cheers,
  Rob


texts: visit buffer without setting mode in script

texts:
I'm trying to write a small program to indent lisp files using lisp-mode so I can get Emacs-compatible indentation even when using a different program.

Here's my first attempt to write a program to visit a file, override its mode and, indent it, and then write it back.

I'm wondering if there's a way to non-interactively open a buffer to a file without enabling the modes associated with that file. It seems more elegant than enabling text-mode and then lisp-mode.

#!/bin/sh
:;exec /usr/bin/env emacs -Q --script "$0" "$@"

(mapcar (lambda (filename)
          (find-file filename)
          (text-mode)
          (lisp-mode)
          (indent-region (point-min) (point-max))
          (basic-save-buffer))
        argv)

I copied the file into indent2.el and ran indent.el a few times with indent2 as an argument.

It seems to be working correctly, but produces the message

> ./indent.el ./indent2.el
Setting up indent for shell type sh
Indentation variables are now local.
Indentation setup for shell type sh
Indenting region...
Indenting region...done

which means that Emacs is processing the shebang even when being used non-interactively. Is there a way to get it to bypass that step?


texts: One yasnippet snippet for multiple modes

texts:
I have the following snippet:

# -*- mode: snippet -*-
# contributor: Song Qiang <tsiangsung@gmail.com>
# key: m
# group: Math
# name: Inline math \( ... \)
# --
\\($1\\)$0

and I want it to be available for both latex-mode and org-mode. How can this be achieved? I could symlink, but I'm trying to find a smarter way.


texts:
Let's roll:

$ emacs -Q
M-x shell
$ while true; do echo XXXXXXXX; done

Depending on how much RAM you have in total, wait for some reasonable amount.  For instance, I'm typically waiting until the shell buffer is around 5M lines and the corresponding memory consumption is around 5G.

It is indeed clear why it grows.  However, when I kill the buffer, the amount of memory occupied by Emacs is still 5G.  I'm aware of garbage collection (GC) and two variables gc-cons-threshold and gc-cons-percentage, for which I tried different values without luck (including default).  Waiting for some time does not seem to somehow lazily trigger any GC process either.  Finally, even directly issuing

M-x garbage-collect

has no effect at all; the amount of occupied memory by Emacs remains at 5G and Emacs does not freeze even for a second to perform GC (which should definitely happen for such a large amount of memory).

Does anybody experience the same issue?  I observe this on both 24 and 25 series.  The reason why this issue has become really annoying lately is because I have to run many buffers tailing various continuously written logs, but killing any of these buffers does not seem to release the memory back.  As a result, I simply run out of memory hourly, what forces me to quit Emacs and restart it to be able to continue work.  What to do?

  NOTE:
  Of course,

(setq-default garbage-collection-messages t)

  does show the "Garbage collecting...done" messages in minibuffer continuously,
  what means that GC is indeed performed but, in fact, that confuses me even more.  Why the memory is not released when the buffer is killed?


texts: How to check if a string exists in the current buffer?

texts: I want to know how do you use Emacs lisp to check the content of the current buffer, specially to know if certain string exists within the current buffer.


texts: How to apply overlay or text properties to text matching a regexp?

texts:
I want to transform a text file with many lines :

  | refXXXXX | here useful text, first sentence, last word. |
  | refYYYYY | First word, second sentence.                 |

into :

  here useful text, first sentence, last word. First word, second sentence.

but appearing as :

  [refXXXXX] here useful text, first sentence, last word. [refYYYYY] First word, second sentence.

Where [refs within brackets] would be Overlays or Text Properties.

(The aim would be to be able to make use of C-s or M-x occur to retrieve directly "last word. First word", at the end of first sentence + beginning of second sentence in the example.
Btw, I know how to do the corresponding search in the source file with a regexp, but it's not the solution I want.)

My question is :

is this possible with Overlays or Text properties, with a defun retrieving all the "refs", cutting them from the text and replacing them by Overlays/TextProperties?

Something like :

(defun source-to-final ()
    "cut refs from the txt, but letting them appear as overlays (or text properties)"
    (while
        (search-forward-regexp "| ref.*?|")
      (replace-match "")   ;; cutting the ref text
      (set-some-overlay-or-textproperty-here (match-string 0))
      (search-forward-regexp " +|\n") ;; assembling current sentence with next one
      (replace-match "")
      ))

where I just don't know how the defun set-some-overlay-or-textproperty-here should look like.


texts: key binding isearch-forward with Greek keyboard

texts: I use Emacs with various languages and have had trouble invoking isearch-forward from a keystroke when my keyboard layout (OS-level) is set to Greek. If I try the usual C-s, it says there is no binding for C-σ (since the 's' key is now the 'σ' key). I tried setting up a new key binding using global-set-key, switching to Greek, typing C-σ, switching back to English, and then indicating isearch-forward. This works fine for the first search, but I want to be able to hit C-σ again to search for the next occurrence, the way it works with C-s when my keyboard layout is set to English. But this doesn't work. Instead, it prompts me for a new search string. How can I set it up so that C-σ works exactly like C-s, so that I can hit C-σ again to advance to the next occurrence of my (Greek) search string? Of course I also want to do the same thing with C-ρ for isearch-backward.


texts:
I had the following tags for a given file.

#+TAGS: @Completed(c) @Doubts(d) @Discuss(D) @Not_Implemented(n) @KR28(R28) @KR29(R29)

I added the last two tags today and they did not get populated when I pressed C-c C-q

What am I missing?


texts: Discarding modified hunk at current position

texts:
I'd like to discard modified hunks (and ideally, view the diff before) basing on the current buffer position.

I have diff-hl so that it's quite obvious which part of a buffer are modified. Now, how to view the diff for the current hunk and/or discard it?

One way I though this might work is some way to jump to magit's view, moving to the selected hunk - this would show the diff, and then k would discard it. I was also looking at vc-mode, but didn't find anything that would fit that use-case.


texts: Is it possible to include a base64 image in org file?

texts:
currently i save my pictures with org-download as an attach for an org file or via directory method.
I wonder, if it possible to include a picture as base64 coded string (or anything else) to always have text and picture in one file.
Attach or directory method saves the picture into another directory below org dir.
A very user friendly solution will be an automatic encode into base64 after drop an image and automatic decode, if i want to view it.

I want to put both in one org-file.
Does anybody know a solution, or is there any existing solution?

Thanks
Poul


texts: autoload of general.el not working in spacemacs?

texts:
I have this in my personal spacemacs layer's packages.el:

(setq mylayer-packages
      '(general
        (mylayer :location local)
        evil-org
        ))

Then later in the same file:

(defun mylayer/post-init-evil-org ()
  (spacemacs/set-leader-keys-for-minor-mode 'evil-org-mode
    "ot" 'counsel-org-tag
    )
  (general-define-key
   :states
   '(normal)
   :keymaps 'evil-org-mode-map
   "O" 'mylayer/either-O-or-org-open-above
   "o" 'mylayer/either-o-or-insert-heading-respect-content
   )
  )

When I start spacemacs (conventionallly configured: ~/.emacs.d is a symlink to my spacemacs git repo), I get this:

An error occurred while post-configuring evil-org in layer mylayer (error: (void-function general-define-key))

general-autoloads.el is there in the package directory as I expected:

spacemacs/elpa/25.1/general-20171106.818/general-autoloads.el

I expected that emacs would have read that autoload file at startup before my layer's post-init function for evil-org was read, and that I would therefore be able to call general-define-key.

What's going on, and how can I avoid the error?


texts: Evil mode: How to run evil-indent on the text I've just pasted

texts:
When I copy line three below in evil-mode

function foo() {
}
var bar; #copy

and paste it at line two, I get

function foo() {
var bar; #paste
}

instead of the correctly indented

function foo() {
  var bar; #paste
}

I'd like to automatically indent my newly-pasted lines of code, and in vim, the fix for this is to remap the p key to "nnoremap gp p`[v`]=".

I figured that I could use the following in my init.el file to replicate the behaviour:

(fset 'paste-and-indent
  "p`[v`]=")
(define-key evil-normal-state-map (kbd "p") 'paste-and-indent)

But when I try to use the code, upon pressing p I get "After 0 kbd macro iterations: Lisp nesting exceeds 'max-lisp-eval-depth'." I'm confused by this, as max-lisp-eval-depth is set to 800!

Can anyone offer advice on how to implement this behaviour in evil-mode emacs?


texts: Persistently hide cursor [evil-mode problem]

texts:
If I hide the cursor in a buffer with

(setq cursor-type nil)

it will reappear if I move it around.

Is there a way for hiding the cursor all the time (only for one specific buffer)?


texts: JavaScript regular expressions in re-builder

texts:
Is there any package that allows me to input regular expressions following the JavaScript syntax (or even Perl Compatible Reg. Exp.)?

I want to have an interactive regular expression builder (like re-builder), but using standard syntaxes rather than the clumsy default syntax in emacs.


texts: Force a single font for all unicode glyphs

texts:
I'm using GNU Emacs 24.4.1 in a GUI on OS X.  I want to force every character to be displayed using just a single font rather than allowing Emacs to choose a supposedly most appropriate.  I understand that no font will include every glyph, but I use a limited subset of unicode which many good fonts cover satisfactorily.

I've seen a lot of talk about using the unicode-fonts package to set fonts for ranges of characters, but I don't want to have a thousand extra lines in my config to set every block separately.

How can I simply stop Emacs from automatically mapping different glyphs to different fonts?

Thanks.


texts:
I have used Emacs Org mode for my notes for several years, and I use Prelude configured with evil.  Everything works fine.
Until a few minutes ago, I found the note file is empty of content. and the file size change to 2 bytes. I try to undo but it's useless(I get nothing through undo). How can it be fixed?


texts: Org sql header args dont seem to work why?

texts:
Can anyone explain why this does not work, i want to set the parameters global to the current document using PROPERTY but this does not work and results in this error.

(wrong-type-argument stringp nil)

#+PROPERTY: header-args:sql :engine oracle
#+PROPERTY: header-args:sql+ :dbhost 172.17.0.6
#+PROPERTY: header-args:sql+ :dbport 1521
#+PROPERTY: header-args:sql+ :dbuser db_user
#+PROPERTY: header-args:sql+ :dbpassword db_pass
#+PROPERTY: header-args:sql+ :database XE

#+BEGIN_SRC sql
SELECT * FROM dual;
#+END_SRC

How ever this does work but i need to copy it for each block.

#+header: :engine oracle
#+header: :dbhost 172.17.0.6
#+header: :dbport 1521
#+header: :dbuser db_user
#+header: :dbpassword db_pass
#+header: :database XE
#+BEGIN_SRC sql
SELECT * FROM dual;
#+END_SRC


texts: How to add org-babel-execute function for plantuml?

texts:
I installed "PlantUML Mode for Emacs" using Melpa successfully, and I am able to switch to Plantuml-mode.  However, when I try to evaluate code with C-c C-c, inside of org-mode, I get the error:

org-babel-execute-src-block: No org-babel-execute function for plantuml!

How do I add this?


texts:
I was working away in emacs using org-mode to register some task I was doing, when I noticed a new buffer had appeared called "**dates**".  It had a number of dates presented in it such as "ISO date", "Gregorian", "Number of days until the end of the year", etc.  Where did that come from?

Alas I had left it too late to use C-h l to see what key combination brought it up.  Searching within emacs help system and google is proving futile....


texts:
hi i'm new to emacs and i'm really amazed about the org-mode. But i have some problems with the tables.

i want a nice looking table but i get always a strange format

example:

But i want it like this:

i have the configuration from https://github.com/myTerminal/super-emacs
but it also doesn't work without this configuration (standard configuration).

My system font on Arch Linux is Liberation Sans and Liberation Mono

On my Windows computer emacs org-mode tables work fine i have this problem only on my Arch Linux.

I hope somebody can explain me what i have to change.


texts: 'First Sun of the month' TODOs disappear from agenda even when not done

texts:
I can schedule a TODO on the first Sun of the month like so:

*** TODO  Pay bill                                   :Monthly:
SCHEDULED: <%%(diary-float t 0 1)>

This shows in the Agenda for the first Sun of the month. But if not done, it does not appear in the agenda for the next day --- unlike other tasks with a simple SCHEDULED: <2017-11-05 Sun> entries.

How do I ensure that the 'First Sun of the month' TODOs continue to appear in the agenda till done?


texts: org-archive-location ignore heading cookie

texts:
I have an org file that looks something like this:

* Tasks
** TODO A test task
* 2019
** 2019-12 December
*** 2019-12-10 Tuesday
**** Day planning
***** Tasks for today [0/1]
****** TODO Another testing task

I am trying to create a function which can "archive" the task under "Tasks" into the "Tasks for today". Here's what I have so far:

(defun archive-task-today ()
  (interactive)
  (let ((org-archive-location (concat "%s::datetree/** Tasks for today")))
    (org-archive-subtree)))

I think this is pretty close, except that it doesn't ignore the [0/1] cookie at the end of the "Tasks for today" heading. How can I match the heading when the cookie at the end is variable?

Thanks!


texts:
I'm on Windows 7, running GNU Emacs 24.4.1, and I have also installed Cygwin and I am trying to use Cygwin as the shell in Emacs. I followed the answer here:

https://stackoverflow.com/questions/235254/how-can-i-run-cygwin-bash-shell-from-within-emacs

And have this in my init-file

(setq shell-file-name "C:/cygwin64/bin/bash")
(setq explicit-shell-file-name shell-file-name)
(setenv "PATH"
(concat "~/bin:/usr/local/bin:/usr/bin:"
    (replace-regexp-in-string " " "\\\\ "
        (replace-regexp-in-string "\\\\" "/"
            (replace-regexp-in-string "\\([A-Za-z]\\):" "/\\1"
                (getenv "PATH"))))))

When I try to compile on Latex, I get this error:
"ERROR: LaTeX Error: File `fullpage.sty' not found."

Disabling cygwin in my init file fixes the problem. I feel like enabling Cygwin might mess up Emacs with path names, so it can't find the fullpage.sty and other Latex packages. Anyone ideas on how to fix this?


texts: How do I construct a Platypus script to open a file in emacs from the finder?

texts:
I am trying to use Platypus to wrap a bash script to open a file in emacs using emacsclient.
The script that I am using looks like:
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -c "$@"

When I associate a file (using it to open org-mode files from DevonThink) to the new Platypus created app, emacs fires right up, but it opens the scratch buffer rather than a buffer with the file contents.
The above script does work when invoked from the command line.
Does anyone have any ideas?


texts: How to make fonts show anti-aliased on Linux/X11?

texts:
With Linux/X11, certain font's show without anti-aliasing.

JetBrains Mono
Cascadia Code
These two fonts show with anti-aliasing in other programs (st terminal for example).
All other fonts show with anti-aliasing (Source Code Pro, Fira Code Medium, Courier Code, Monoid).
This is the feature-set of emacs XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD LCMS2

Any hints on how to resolve this?

This is X11 with JetBrains Mono-13 font, I think this is related to Emacs, not fontconfig, since the st terminal displays the font properly.

This is emacs -nw running in st terminal.


texts: How to let `recentf` not to remember real path when there's a symbolic link?

texts:
Since my .emacs.d is a symbolic link of ~/dotfile/dot/.emacs.d, recentf keeps duplicated thing like

/Users/user/.emacs.d/init/init-editor.el
/Users/user/dotfile/dot/.emacs.d/init/init-editor.el

because some command/functions the symbolic link path and some use the real one.

How to let recentf not to remember real path when there's a symbolic link of a parent directory ? The real path is so long, I prefer the short one.

I used

(defvar recentf--exclude-remote-regexp "\\/\\w*?:\\w*?@\\w*?:\\/")
 (defun recentf//file-symbolic-link-in-recentf-list (file)
   "Test whether there's a symbolic parent of FILE in `recentf-list'."
   (cl-some (lambda (x)
              (and (string= (file-truename x) file)
                   (not (string= x file))))
            recentf-list))

 (defun recentf//exclude-symbolic-vc-files (file)
   "Exclude local FILE that has a symbolic parent in `recentf-list'."
   ;; Unless the file is local
   (unless (string-match recentf--exclude-remote-regexp file)
     (recentf//file-symbolic-link-in-recentf-list file)))
 (add-to-list 'recentf-exclude #'recentf//exclude-symbolic-vc-files)

before, but this is a bit slow which take almost 2 second to handle with a recentf-listin length of 500.

Also I find that there's recentf-filename-handlers which may be used to combine with directory-abbrev-alist. But this require manually add all the mappings.

Any suggestions will be appreciated! Thanks!


texts: Hide or fold stash section automatically in magit-status

texts: I tend to stash a lot when using git, so my "stash" section in magit-stashes is getting pretty long. I'm not running out of hard-drive space or anything, so I don't want to delete the stashes. Can I make it so that when I open up magit-status, they're automatically hidden (as if you'd pressed tab while over the "Stashes" heading)?


texts:
Is it possible to ADD commands to the "Buffers" menu?  I'd like to add menu entries for:

Open new window below current buffer
Split window
Close current buffer

...and maybe more.  I'd want to add them after the existing:

Next Buffer
Previous Buffer
Select Named Buffer...
List All Buffers

Is that possible?  If so, how?


texts: Documentation for mode-line-emphasis and mode-line-interactive

texts:
I'm seeing mode-line-emphasis and mode-line-inactive used in color themes to change the mode-line face value for used and unused buffers.

describe-function and describe-variable don't have an entry for mode-line-emphasis or mode-line-inactive

Where can I find information on this?


texts: Org Latex preview produces empty box when I use a certain package, how can I debug the issue?

texts:
The following line in my org file is causing problems
#+LaTeX_HEADER: \usepackage{prooftrees}

If this line is there, then org latex preview produces an empty box.
If I remove it, things work just fine.
The output of *Org Preview LaTeX Output* is:
This is dvipng 1.17 Copyright 2002-2015, 2019 Jan-Ake Larsson
[1]

so I can't tell what's going wrong.
Finally, the *Messages* buffer only says: "Creating image...done", which doesn't help me understand why it's failing.
I know that the prooftrees package works, because I can get it to work in my normal latex compilation, so this seems to be a problems specifically with emacs org-mode.
How can I troubleshoot this issue? How can I see what latex it's generating and what commands it's running to produce the image?
Thanks
Edit:
The issue was with dvipng: this program would output a messed up png after processing the output dvi file. I tried changing to imagemagick but got a mysterious error. Changing to dvisvgm fixed the issue, so I guess this program is somehow better at processing dvi files that contain prooftrees.
To change to dvisvgm I did

M-x customize-variable ENTER org-preview-latex-default-process
then changed the value to "dvisvgm"

To catch the temporary tex files before emacs deleted them I used the following shell command in the /tmp directory:
inotifywait -mr --format '%w%f' -e create . | while read file; do if echo "$file" | grep '^./orgtex.*\.tex$' > /dev/null; then echo "file: $file"; cp $file ${file}.bkp; fi; done


texts: How to install/setup yasnippet for buffer-local usage?

texts:
The instructions for installing yasnippet globally are set forth in the Github README.mdown -- https://github.com/capitaomorte/yasnippet -- and also in the comments at the top of yasnippet.el library.

I prefer not to to use yasnippet globally, and would rather enable it on a buffer-local basis or only for specific major modes.

How can I install/setup yasnippet for buffer-local usage?


texts: how to start outline-minor-mode with latex-mode?

texts:
I have the following in my .emacs:

(add-hook 'latex-mode-hook #'outine-minor-mode)
(add-hook 'latex-mode-hook
      (lambda ()
          (outline-minor-mode 1)))

(I am aware this redundant, I am just trying to demonstrate that neither method works). Yet, when I open a *.tex file I see the following upon executing C-h m:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Column-Number File-Name-Shadow Font-Lock Global-Font-Lock
Global-Hl-Line Global-Linum Line-Number Linum Mouse-Wheel Openwith
Override-Global Tex-Pdf Tool-Bar Tooltip Transient-Mark

(Information about these minor modes follows the major mode info.)
LaTeX/P mode defined in `tex-site.el':
Major mode in AUCTeX for editing LaTeX files.
See info under AUCTeX for full documentation.

I understand from the above list of minor modes that the outline-minor-mode has not turned on. Why?


texts:
I have this by default in my auto-mode-alist:

("\\.js\\'" . javascript-mode)

(even with emacs -Q).  I'd like to substitute js2-mode for javascript-mode.  Of course, I could use assq-delete-all and then add-to-list again, but I'm wondering whether there isn't a better way.

Edit: I explicitly do not want to use Customize, I prefer crafting my init.el myself.


texts: extra e character is inserted before every character

texts:
I have a problem every so often where I accidentally hit a key combination (don't know what it is) and I get into a state where the letter e (sometimes it is another letter IIRC) is inserted before every normal character. Modifiers are ok like M-x or C-x, but not C-x b - it gets interpreted as C-x e. Backspace is also ok. I've checked my Messages buffer but don't see anything there (see pasted below). Is there somewhere else I could look or something else I could try to debug or undo when this happens? I would like to find a way out of it so I can undo it when I accidentally do it (having to quit emacs is a pain even with my session saved, since I lose all my active shell buffers and their histories - and my normal steps of saving them manually has a lot of backspacing to remove extra e chars).

Mark set
Mark saved where search started
Mark set
Grep finished (matches found)
Mark set [3 times]
After 0 kbd macro iterations: isearch-search: Keyboard macro terminated by a command ringing the bell [3 times]
Quit [3 times]
After 0 kbd macro iterations: isearch-search: Keyboard macro terminated by a command ringing the bell
Quit [4 times]

GNU Emacs 25.0.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F34))
 of 2015-01-14 on pbuckleys-mbp.bos.dataxu.net


texts: `projectile-find-file` completions display in the mini-buffer rather than in a separate `helm` window

texts:
My Emacs system satisfies the following three conditions:

The Emacs packages helm and helm-projectile are installed on it.
The directory ~/MyProj/ is recognized as a projectile project (it is a Git directory).
~/MyProj/ contains the following text files (and possibly other files):

README.md
file1
file2

Consider the following scenario:

Open a new Emacs session.
Execute M-x cd <RET> ~/MyProj <RET> to switch the default directory to the project directory.
Execute C-c p f to run the projectile-find-file command.

The mini-buffer now displays:

  [-] Find file: {README.md | file1 | file2}

Why are the completions listed horizontally in the mini-buffer rather than vertically in a separate helm window, as is the norm with helm commands? Compare the above screencap to the following, resulting from executing C-x c C-x C-f (= helm-find-files).

I find the latter display style more convenient that the former. Is it possible to view the results of the various projectile commands this way?


texts: Diary specific date but displayed in every year

texts:
Reference to 31.10.1 The Diary File
It provides example as
 April 15, 2020 Income tax due.

M-x calendar to the date of Apr 15, 2020 and strike d, it prompts a buffer as
2020-04-15 Wednesday
=====================
ISO date: Day 3 of week 16 of 2020
Last Quarter Moon 7:01am (CST)
Sunrise 5:23am
Sunset 6:30pm
 2020 Income tax due.

It seems to work properly, but if I check the date of Apr 15, 2021
2021-04-15 Thurday
=====================
ISO date: Day 4 of week 15 of 2021
Sunrise 5:24am
Sunset 6:29pm
 2020 Income tax due.

The "Income tax due" appeared again and it actually displayed every year on the date Apr 15.
What's the problem?
Org mode version 9.4 in Emacs 26.3 with Ubuntu 19.10


texts: Why does the zenburn colour scheme look different on different computers

texts:
I have just started using the zenburn theme in emacs on my macbook and I really like how it looks. It looks like this:

However when I put it on my ubuntu pc (my .emacs.d directory is synced with git and I double checked it was working properly by copying it over through dropbox as well and the files should be identical in both .emacs.d directories) it looked like this:

Can anyone suggest what's going on here and how I can get emacs to look the same on my ubuntu machine as on my macbook?


texts: GNUS - how to persist "R" (read) state of the email back to gmail?

texts:
When I read an email in gnus, the email state changes to read whose symbol is R, The problem is that when I then open gmail on the browser I find that the already read email is still marked as unread.

what should i do to sync it back to Rsync?


texts: Preview LaTeX fragment on indirect buffers

texts:
I am writing my research notes in org-mode and they contain many LaTeX formulas. I use the preview feature (C-c C-x C-l) a lot. As the notes are rather large, I also tend to use an indirect buffer, to jump around to have a quick glance to refer to some other part of the text.
While the indirect buffer will show the rendered formulas when I open it (assuming the original buffer was showing them), I cannot make them go doing C-c C-c. Conversely, if I open the indirect buffer while the original buffer is NOT showing the formulas, I cannot generate them in the indirect buffer. I get a message saying

user-error: Can’t preview LaTeX fragment in a non-file buffer

So, is there an easy way to enable org-mode to render and hide the formulas in indirect buffers?

I would not mind if doing this would mess-up (i.e. also hide, also display) the formulas in the main buffer (as long as I can re-render/display once I am back there).

For reference: GNU Emacs 25.1.2; Org-mode version 8.2.10


texts:
There are buffers that prevent you from being able to execute interactive commands (by overriding the default M-x binding). For example, *ansi-term* buffer would do this.
(I know you can do C-cM-x to invoke the command).
Is there an existing way to rename a buffer that isn't the current buffer? (It's easy to write a function for it, but it seems like it should've been already written...)


texts: Different indentation styles for different projects

texts: I work on many different C projects with unique indentation styles. How do I get Emacs to do per-project indentation settings without polluting the upstream project trees with .dir-locals.el files? I want to match the projects using their paths on disk.


texts: Automatically open the exported file as soon as `org-export-dispatch` succeeds

texts: What is the simplest way to configure org-mode to automatically open the exported file as soon as org-export-dispatch succeeds?


texts: I have a set of functions that I'd like to put to menu bar for ease of access. For this, I need to create new menu item on menu bar. How can I achieve that?


texts:
I am behind a web proxy trying to connect to marmalade. Strangely, elpa works just fine, but marmalade fails. This is the traceback:

Debugger entered--Lisp error: (error "Error during download request: handshakefailed")
  signal(error ("Error during download request: handshakefailed"))
  error("Error during download request:%s" " handshakefailed")
  package-handle-response()
  package--download-one-archive(("marmalade" . "https://marmalade-repo.org/packages/") "archive-contents")
  #[nil "\301\302\"\207" [archive package--download-one-archive "archive-contents"] 3]()
  package-refresh-contents()
  call-interactively(package-refresh-contents record nil)
  command-execute(package-refresh-contents record)
  execute-extended-command(nil "package-refresh-contents")
  call-interactively(execute-extended-command nil nil)

I've no idea how to debug this. I tried emacs 24.4 and 24.3, and both http and https.


texts: Projectile: how to exclude deep subdirectories by pattern?

texts:
Is it possible to exclude from a project all directories matching a pattern at other than the project root level? In my case, I want to exclude subdirectories (deeper than the project root level) with the name matching split*, for instance, exclude a path <project_root>/egs/foo/exp/bar/split8. These directories are autogenerated, and the number after "split" changes, so I cannot explicitly list them. Anything I tried in the .projectile file did not work.

Tracing the code suggests this is not likely possible, but I am still daring to ask in case I overlooked something.


texts: How to save last Emacs session time and hostname to a log file on quit/close

texts:
Background / Problem: I have 2 machines sharing a file directory using Google drive.  I edit the shared files using Emacs on both machines alternatively everyday.  I would like to make sure that at most one active Emacs session is running at a time to avoid sync conflict due to multiple active sessions with unsaved files.

Idea: I would like to make Emacs to save the time-stamp and hostname to some shared log file whenever I close it, so that I can check the log entry when I open Emacs on another machine next time.  That makes sure my previous Emacs sessions was closed and all files were saved and synced/up-to-date.

Implementation: I would like to add a function to kill-emacs-hook to append or replace time-stamp and hostname in a log file.  The log file can be a org-mode file with a heading "Last session close time", so that I can replace the old content (i.e., old time-stamp and hostname) under that heading in the function.  How can I do that?

Or: Is there any package provide the "last session time" logging for us?

Another question (please let me know if I should create a new question on stackexchange): We can open an org-mode file automatically when starting Emacs.  Can we make sure a specific heading (in my case "Last session close time") is shown on startup?


texts:
I'd like to select a simple formula like 17+5 and replace that by the computed result, 22 in this case. And I need this to work during keyboard macro execution, to quickly process large portions of my file. What's the quickest way to achieve this?

My best bet at this point would be some form of embedded calc mode: select the region, then do C-u 0 C-x * e C-x * e to turn embedded mode on on the selected region, then turn it off again. But when executed inside a macro, the prefix argument appears to be handled somewhat differently. I get the message

After 0 kbd macro iterations: calcDigit-nondigit:
Keyboard macro terminated by a command ringing the bell

and the buffer stays in embedded calc mode.

Note: I'm seeing similar issues when I try some other approach. For example, at some point I tried using space instead of plus, and then followed this post to compute the sum using C-x * G V R + C-u y to grab the expression to the stack, reduce it using a sum there, then paste the result back replacing the selection. Again things work when recording the macro, but executing it I don't see the grabbed region on the stack, but instead see an empty grab vector followed by an empty arg vector. Perhaps there is some trick to make macro playback and calc mode cooperate more nicely for both these situations?


texts:
In this example I changed the date for Entered to 12/07/2019 at the capture editing stage. Yet it gets filed under today's date. How can file it under the right date, that is 12/07/2019? Ideally in one step. But if not, the obvious additional steps would be 1/ create a headline for 12/07/2019, and its parents. 2/ org-refile under the hl created in 1/. How to do 1/?

PS: I'm using a variant of the capture proposed here:

(defun my-org-capture ()
  "Read file name to capture to."
  (interactive)
  (setq my-org-capture-filename
        (read-file-name "Capture to: " "~/Documents/write/notes/journal"
                        "inbox.org" t))
  (call-interactively #'org-capture))


texts: How to temporarily disable/reset idle timers?

texts:
I have a package which uses mouse motion, currently the idle timers aren't reset on mouse motion - causing idle timers to run, even when from a user perspective - Emacs is not idle.

How can I stop idle timers from running while my function runs?


texts: How to non-interactively use regular expressions over more than one line?

texts:
Consider a buffer as below. As explained in the documentation . matches any character but newline. Also \n matches newline. So evaluating (re-search-forward "a\(.\|\n\)*b" nil t) should normally have a match in this document. But it does not.

(As explained in https://emacs.stackexchange.com/a/9549/ when using regular expressions interactively, a\(.\| C-q C-j \) seems to be fine in this situation).

a
b


texts: Too much whitespace on setting org-mode tags

texts:
If I create the following in an org-mode buffer:

* one
** two
** three

then move point to the line containing "two" and do C-c C-c spam <RET>, I get this:

* one
** two                                                                :spam:
** three

Why all that whitespace between "two" and ":spam:"?  Can I stop org-mode from inserting it somehow?


texts: How can I search a list of files for content that matches a regexp?

texts:
I am trying to write an interactive command that will search a set of files for a regexp. The files are selected programmatically, for example, as a list of files that match some date criteria, or recently modified criteria and are in a list of paths that has been computed. These paths are likely to be in different directories, and not to match a regular pattern. The command will compute this list, e.g. for files in the last week, or last month, etc.

I want to search this list of files for a regexp. I have been able to get an approach like this to work with grep. Here, assume that the list of files is computed elsewhere

 (grep
  (format "grep -nH -i %s %s"
      regexp
      (mapconcat 'identity files " "))))

But I wondered if there is a better way to let-bind a variable to a file list, or to use occur/swiper, etc on this list. So far I have only found ways to search files that match a regexp, for example, and not to search a set of files.

Also I am concerned about what would happen if you had hundreds of files and if the length of that command got very long, so it might be better to search in buffers?

Something like swiper-multi would be great, but I can't figure out how to specify the list of buffers/files for it.


texts: How to open sourcegraph files directly in Emacs on Linux

texts:
There's the open-in-editor extension on sourcegraph, which

Adds a button at the top of files in both Sourcegraph app and code hosts like GitHub (when the Sourcegraph browser extension is installed) that will open the current file in your editor of choice.

It supports vscode, sublime, and idea out of box, but other editors needs to be manually configured. I'd like to open files in my emacs. How?


texts: Sometimes Emacs gets stuck with non-working capslock key

texts:
I'm using Emacs 26.1 on Windows 10.

Sometimes, the capslock key stops working: The key is activated but typing letters does not result in capital letters being inserted into a buffer. It works with the number keys above the regular keys though.

Example:

Caps-Lock is activated (observable in other applications and through the keyboard indicator led)
Using German keyboard layout
Typing 'a'  -> 'a' is inserted (wrong)
Typing '1'  -> '!" is inserted (ok)

This happens about twice a day but I was not able to figure out what triggers the condition.
The only way to get the key fully working again in emacs is quitting and restarting emacs.

Switching the keyboard layout to English (and back) does not change anything.

Note that I have not remapped the capslock key. I just want the regular capslock functionality.

Any ideas on how to get this "un-stuck" or how to diagnose the problem further are appreciated.


texts: Using org-map-entries to add properties to all entries with tags

texts:
I'm trying to make a function that will allow me to add properties to all entries in an org file that contain a particular tag ("drill"):
(defun add-to-chinese-anki ()
  (interactive)
  (org-entry-put (point) "ANKI_DECK" "Chinese Org Notes")
  (org-entry-put (point) "ANKI_NOTE_TYPE" "chinese-org-drill")
  (org-entry-put (point) "ANKI_TAGS" "languages")
  )

(defun add-all-to-chinese-anki ()
  (interactive)
  (org-map-entries (lambda () (add-to-chinese-anki) "drill" 'file))
  )

However the above code is adding the tags to every entry in the file, and not filtering by tag. Any help would be appreciated!