texts: How to set field separators in bibtex-mode's autokey generator?

texts:
Q: how do I set a specific separator in bibtex-mode's autokey generator?

Background

I am working
with
bibtex-mode.
It has a feature
to
auto-generate the entry key,
which is customizable.

Goal

My goal is to get the autokey to work as follows:

One author: authorname:year.
Two authors: authorname1-authorname2:year.
Three or more authors: authorname1-etal:year.

Almost There

The following settings almost get me there:

(setf bibtex-autokey-additional-names "etal"
      bibtex-autokey-name-separator "-"
      bibtex-autokey-name-year-separator ":"
      bibtex-autokey-year-length 4
      bibtex-autokey-names 1
      bibtex-autokey-names-stretch 1
      bibtex-autokey-titlewords 0)

The Specific Problem

It works for one and two authors.  However, for three or more
authors, the generated key is:

authorname1etal:year

rather than the desired, hyphen-separated

authorname1-etal:year

How do I get the hyphen separator between the author name and the
etal?

Examples

@Article{,
  author       = {Bob Smith},
  title        = {A title},
  journal      = {A journal},
  year         = 2014
}

produces smith:2014

@Article{,
  author       = {Bob Smith and Frank Jones},
  title        = {A title},
  journal      = {A journal},
  year         = 2015
}

produces smith-jones:2015

@Article{,
  author       = {Bob Smith and Frank Jones and Joe Johnson},
  title        = {A title},
  journal      = {A journal},
  year         = 2016
}

produces smithetal:2016 (and I want smith-etal:2016)


texts: How do I replace only the first space on a line?

texts:
I'm trying to use M-x replace-regex to find and replace the first space on each line.  What regex would I use to do this?

Everything I've tried either finds no matches or every space.

The lines never start with a space.

As an example, if my line consisted of What did the fox say? I would like to replace the space between What and did.  I would not like to match the What.


texts: How to set width for subfigures inside a table in a org-mode file?

texts:
I'd like to use subfigures in org-mode files. In MS Word, this could be easily done by inserting the subfigures of a figure into a table with invisible borders. Then the size of each subfigure can be adjusted as you like.
Is there a way to use subfigures like this in Org-mode?
I tried to set size with e.g. #+ATTR_ORG: :width 400, and it only works on a single figure.
So, this works with the intended figure size:
#+CAPTION: Test Figure
#+NAME: fig:test0
#+ATTR_ORG: :width 400
[[file:build/test.png]]

But when put into a table, the specified figure size (width) is ignored. (And the actual size of the sub-figure is used, which is way too large).
#+CAPTION: Test Figure
#+NAME: fig:test
#+ATTR_ORG: :width 400
| [[file:build/test.png]] | [[file:build/test.png]] |

I have (setq org-image-actual-width nil)  in my init.el. And this is under Emacs 26, Ubuntu 20.04, and Org mode version 9.3.7 (9.3.7-8-g3ed035-elpaplus). I am interested in exporting the org file to multiple targets including ODT. (So, I am looking for a generic solution.)
If the above usage is wrong, what is the correct usage to get properly sized subfigures?
-- Update --
This blog about extending org link syntax seems relevant. I guess I am looking for an extended way of specifying the image size as part of the link, with something like this:
[[file:build/test.png :width 300]]

as in
#+CAPTION: Test Figure
#+NAME: fig:test
| [[file:build/test.png :width 300]] | [[file:build/test.png :width 300]] |

Is this doable in org?


texts:
When running previous-line, C-p or <up> the cursor jumps up a line without any issues or lags. When running next-line, C-n or <down> the cursor properly jumps down a line, but with a significant lag. When I hold the down key I can't even see the point moving, it just appears somewhere below. I ran the Emacs profiler and it seems that the culprit is cl-position. What it works out to be is that previous-line literally just moves the cursor, while next-line runs a whole lot of functions.

What is the issue and how can it be fixed?


texts: How do I install GnuTLS for Emacs 25.1 on Windows?

texts:
I just upgraded Emacs on my Windows 10 machine from 24.5 to 25.1. For Emacs 24.5 I had GnuTLS correctly setup and for 25.1 I did what I thought I remembered I did:

Got prebuilt Emacs binaries from the GNU Emacs website's download page. I'm using 32 bit Windows, so I got the i686 version of Emacs.
Got a copy of GnuTLS from ezwinports and extracted the zip file to the same directory as Emacs --the way the gnutls zip is organized means that this way both the dll's and the exe's for gnutls wind up in the same directory as the Emacs exe's. (I got version 3.3.11 this time; I don't remember what version of GnuTLS I had when I had version 24.5 of Emacs.)

That didn't work this time. gnutls-available-p returns nil, the package manager is only able to connect to http repositories and not https ones, eww can't handle https either.

How do I setup GnuTLS for Emacs 25.1? Am I misremembering what I did for 24.5? Maybe the binaries from the GNU Emacs website are compiled without GnuTLS and for 24.5 I actually got binaries from somewhere else...


texts: How to let eshell remember sudo password for two minutes?

texts:
In a general term runing bash, when I run a sudo ... command, bash will remember my password for a while. This makes package management task easier.

For example:

sudo apt-get update
# password ......
sudo apt-get install turing-brain
# execute without requiring password again.

Is it possible to accomplish it in eshall?

(I know term or ansi-term in Emacs can do this. But eshell integrate better with Emacs.)


texts: How to create back/forward directory aliases for eshell?

texts:
For years I've been using a zsh script that causes a pushd to implicitly happen everytime you change directories. The script also sets up 'b' and 'f' aliases, short for backwards and forwards, that move you up and down the stack, similar to the back and forward buttons in a web browser. Example session:

/etc $ cd /tmp
/tmp $ cd /bin
/bin $ b
/tmp $ b
/etc $ f
/tmp $ f
/bin $

I've found it incredibly useful and I was wondering, what's the best way to set this up in eshell?

Edit: See the code I went with here, slight modification of below: https://gist.github.com/jgarvin/0627ed76a773ade222f6


texts: Highlight a single visual line within a physical line

texts:
I want to have a single line in a long-word wrapped line highlighted. The default setting of hl-line seems to highlight the whole wrapped line as shown below.

Which setting do I have to change to highlight only the line in which the cursor is located in a longer wrapped line? In the screenshot this would be the first line of the text.


texts: How to make find-file-other-window reuse existing window

texts:
Is it possible to make find-file-other-window open the file in a pre-existing window instead of creating a new one?

Currently:

|A---|B---|                              |A-|C-|B---|
|----|----| -> `find-file-other-window`  |--|--|----|
|----|----|                              |--|--|----|
|----|----|                              |--|--|----|

What I want is for the newly created file to be opening in window B instead of creating window C.


texts: How can I create custom org-mode templates?

texts:
I use org-mode to maintain my personal site. Whenever I create a new .org file in my website, I find myself retyping the following

#+TITLE:
#+OPTIONS: html-postamble:nil whn:nil toc:nil nav:nil
#+HTML_HEAD:
#+HTML_HEAD_EXTRA:

Is it possible to bind this template to a keystroke?


texts: orgmode - babel language elisp vs. emacs-lisp

texts:
I am not sure what's the difference between elisp and emacs-lisp.
In my environment, both work for elisp code but I did not found elisp from the load language list:

#+BEGIN_SRC elisp :results output
(print org-babel-load-languages)
#+END_SRC

#+RESULTS:
:
: ((emacs-lisp . t) (python . t) (ipython . t) (plantuml . t) (dot . t) (calc . t) (C . t) (latex . t) (sqlite . t) (java . t) (shell . t))


texts: Why does Emacs take longer to start on Windows than on Linux?

texts:
Configuration:

One system
OS Windows 10 as dual boot
OS Ubuntu 15.10 as dual boot
Emacs 25.0.1 with GUI

I have one dot-emacs file and everything in my .emacs.d folder (the packages also are located in .emacs.d). All of these files are located in one Dropbox folder.

On Windows 10:
I symlinked the dot-emacs and .emacs.d from the home folder in Windows to the locations in Dropbox.

On Linux/Ubuntu 15.10:
I have also symlinked the dot-emacs and .emacs.d from my Ubuntu home folder (/home/user/ to the locations in Dropbox.

So all files related to Emacs, are stored in one Dropbox folder across various operation systems.

Windows and Linux are running as dual boot on same disk, so also same hardware.

When I start Emacs on Windows, it takes 7.4 seconds to start.

When I start Emacs on Linux, it takes only 2.3 seconds to start.

This is both with the Emacs with graphical GUI and version 25.0.1. Both operating systems are located on same computer on same SSD drive. So it's also the same hardware.

The following things are identical on the operating system (Windows 10 and Ubuntu 15.10):

Emacs software, version 25.0.1
Configuration files (.emacs.d)
One harddisk (all files inside `.emacs.d) and both OS'es are on same SSD).
Hardware

One difference:

Compiled Emacs for Windows or Linux  is running on Windows or Linux platform respectively. That's the only difference.

I'm struggling to understand why Emacs have noticeably shorter startup time on Ubuntu than Windows.


texts:
Is it possible to customize the org mode export options template?

12.1 Export options

C-c C-e #

    Insert template with export options, see example below.

#+TITLE:       the title to be shown
#+AUTHOR:      the author (default taken from user-full-name)
#+DATE:        a date, fixed, or an Org timestamp
#+EMAIL:       his/her email address (default from user-mail-address)
#+LANGUAGE:    language, e.g. ‘en’ (org-export-default-language)
#+OPTIONS:     H:2 num:t toc:t \n:nil ::t |:t ^:t f:t tex:t ...

Is there a way to do this that retains the dynamic fields (e.g. user-full-name, timestamp, user-mail-address, etc.) Implementing with easy templates or yasnippets is acceptable.


texts: variable project root folder in .dir-locals.el

texts:
I'm using company-mode for completion in C++ code. To tell clang backend of company where the include files for the current project are I have to use the following .dir-locals.el file

((c++-mode (eval setq company-clang-arguments (append
                                               company-clang-arguments
                                               '("-I/full/path/to/project/root/include"))))

I have to specify the full path always. Is there a way to replace full/path/to/project/root with a variable that stores the path the the .dir-locals.el file?

I tried

 (c++-mode (eval setq company-clang-arguments (append
                                               company-clang-arguments
                                               (list concat "-I" default-directory "src")))))

but since default-directory is evaluated in the file that I'm opening it doesn't return to path the the project root but some other path inside the project.


texts: Adjust the line according to the screen width

texts:
I copied a long sentence to org-mode

  As I mentioned in the last section, Richard Stallman, the founder of the Free Software Foundation, was more than a programmer. He was an educated social critic, and his vision of the future was to have an enormous impact on the world.

I tried to achieve line-break automatically with auto-fill-mode, but get a result as

How could I enable it to extend and shrink according the the screen width rather than the line limitation of 80 words.


texts: Avoid displaying "=>" when a field is clipped in org-table?

texts: How can I avoid displaying "=>" when a field is clipped in org-table? Those arrows dominate some narrow cells, and I can view the full field in a tool-tip window anyway, so I'd like to get rid of them.


texts: What is the proper way to record when an item is captured?

texts:
I would like org-capture template to capture time at creation so I can use this recorded time later for routine cleaning of old tasks.

Currently I use this template with the %t expansion.

(setq org-capture-templates
  '(("p" "PRIVAT-TODO" entry (file+headline "/home/max/org/organizer.org" "Private")
     "* TODO %? %^g\n %t")))

But org uses timestamp to schedule and not for recording capture time.

What is the proper way to record when an item was captured?

How can I then us the time to sort in todo list views.


texts: wrong location of displaying image in org mode

texts:
After running C-c C-c with ob-plantuml, I got this wrong location of image.

,

The correct location (as usual) should be,


texts: Open file by name matching recursively from current folder

texts:
Our project has a folder structure which makes navigating files a bit of a hassle.

basefolder
--> libs
    --> libA
    --> libB
    ...
--> utils
    --> utilA
    ...
--> apps
    --> appTypeA
         ---> appA
         ---> appB
         ...
    --> appTypeB
    ...
--> external
    -->
    ...
...

My colleague uses SublimeText and he has this search bar, which just treats all files as if they were in the current folder in combination with a fuzzy name matching which works great for our project.
Can I achive something similar with my emacs?

Edit: using projectile solves the question. One simple way to get this to work is by installing prelude, which also includes helm and helm-projectile.


texts: Override org-mode indentation function in evil insert mode

texts: How can I override the org-mode indentation function of TAB in evil-insert-state-map? I'd like it to always fold and unfold the current or parent header, and switch the indentation functionality to another keybinding.


texts: Using ido or helm to auto complete email addresses in mu4e

texts: Is there a way to auto-complete email addresses in the mu4e compose window using Ido or Helm rather than the standard *Completions* buffer?


texts: How to reveal all nodes containing a given substring?

texts:
Given a simple org-mode outline (i.e. consisting only of heading lines) in its OVERVIEW global state (IOW, only the top-level nodes are visible), I want to make simultaneously visible all the nodes that mention a given substring.

From the point of view of this aim, Emacs' standard isearch-forward (C-s) command has two shortcomings:

in a given search, only the "current" match is visible; I can reveal subsequent matches by repeatedly hitting C-s, but only one1 matching node is visible at a time.
revealing all matches requires hitting C-s for each match, which is tedious or impractical when the number of matches is large.

Therefore, I'm looking for a way to reveal all the matching nodes at once, and to do so in a way that minimizes the number of "open" nodes.  (IOW, any node that does not contain additional matching nodes among its strict descendants should remain closed.)

How can I achieve this?

Example:

Consider this artificial example in which the "leaf-level" headings are all 27 length-3 combinations of the characters a, b, and c, and the headings of intermediate nodes represent prefixes of their descendant headings.  (Thus, the leaf node with heading abc is a child of the node with heading ab, which in turn is a child of the node with heading a.)

In the initial (i.e. OVERVIEW) state, this outline would look like this:

* a...
* b...
* c...

Now, if I perform the desired operation (as described above) on this outline, using the substring ab as my search term, the outline should look like this:

* a
 * aa
  * aaa
  * aab
  * aac
 * ab
  * aba
  * abb
  * abc
 * ac...
* b
 * ba
  * baa
  * bab
  * bac
 * bb...
 * bc...
* c
 * ca
  * caa
  * cab
  * cac
 * cb...
 * cc...

Note that the only "open" nodes are those that must be open in order to reveal nodes containing the substring ab.

EDIT: Following up a suggestion in the comments, below is the result of running C-c / / ab on the example's outline:

* a
 * aa...
  * aab...
 * ab
  * aba
  * abb
  * abc...
* b
 * ba...
  * bab...
* c
 * ca...
  * cab...

This does not really match the description of the desired result, as given in the example, but it is not a bad alternative.

1 Well, not precisely: in addition to the current matching node, any other matching node that happens to be an ancestor of the current one will be visible as well, but only as a "byproduct" of the current matching node's visibility.


texts: Don't execute org-mode links to executables

texts:
I've managed to set up my org-file-apps mostly the way I want it, although one thing remains: I'd prefer if executable files were opened directly in Emacs since most of them are scripts that I'd like to edit instead of run.

My current settings are:

(setq org-file-apps
'(("\\.docx\\'" . default)
  ("\\.x?html?\\'" . default)
  ("\\.pdf\\'" . default)
  ("\\.log\\'" . emacs)
  (sh-mode . emacs) ; <-- didn't work, it detects the executable bit then runs
  (auto-mode . emacs)))

I was looking around for something along the lines of executable-mode or the like but came up short. Is there some other symbol to do this (I'm aware of the problem that it will open binaries in the editor but that seldom how I link)?


texts: Automatically re-indenting elisp code when adding or removing code before an indented block

texts:
Say I have a elisp code like:

(+ 2 3▮(+ 3
          4))

Is there a way to automatically re-indent the sexp after the cursor, when I add or remove symbols?

So after pressing SPC 4 SPC, I would automatically get:

(+ 2 3 4 ▮(+ 3
             4))

I can do this manual by calling mark-sexp followed by indent-region. Are there better ways of doing this?


texts: Magit status Recent commits foreground color

texts: I have a terminal with a dark background color. Magit shows recent commits and uses a dark color for the commit hashes so I can't see them. I tried customizing frame-background-mode to be dark but the hashes are still not visible. Any way to fix this? Thanks!


texts: Problem with Org mode's export to markdown

texts:
I'm trying to use Org mode's export to markdown, and am finding some unexpected results.

For a file:

* Section

This is some test.[fn:1]
@@markdown:This should appear in markdown export.@@

* Footnotes

[fn:1] This is a footnote.

The export backend produces:

# Table of Contents

1.  [Section](#org26628a6)

# Section

This is some test.1

# Footnotes

1 This is a footnote.

Which looks very much like a mixture of markdown with html markup. Plus @@markdown: ...@@ does not seem to work.

What am I missing? Any ideas of how I could get better results?

Update: Says the Org mode manual:

  The md back-end is built over HTML back-end: any construct not supported by Markdown syntax (e.g., tables) will be controlled and translated by
  ‘html’ back-end.

So that's probably the explanation to the result, as neither ToC nor footnotes seem to be supported by vanilla markdown.


texts: Is there a 'local undo' extension for Emacs?

texts: It happens quite often that I want to undo changes locally or line-wise. For example, when I change multiple lines in a source code and I want to revert only one of them, then I have to step through the entire undo tree to find the state I want to return to. It would be better if I could only revert the marked region or the line where the point is. Is there something like this already in existence?


texts: Provide hint about which windows for a function to use?

texts:
I like follow-mode which I have recently discovered.

But I would like to avoid completely losing my window setup within a frame.

Is there a way to label a window as usable by a function?


texts: Centering text in emacs window is unresponsive

texts:
On this site i found a very nice snippet of code to center a textblock of fixed width in my frame https://stackoverflow.com/a/23731757/4310112

The idea is that whenever the window size is change, the margins of the window are adjusted in a way that the text block keeps a pre defined fixed size. (The code is below.)

However it does not exactly what i expected. When i resize the window the text width changes as well. The will be some margins but not of the size intended. If i switch to another buffer and back the margins change to the correct size.

Something similar happens when i execute some command, for example C-c C-c in AucTex or just M-x C-g. Then all margins vanish and the text occupies the whole frame width. Again, switching buffers will restore the intended frame width.

;;Add left and right margins, when file is markdown or text.
(defun center-window (window) ""
  (let* ((current-extension (file-name-extension (or (buffer-file-name) "foo.unknown")))
         (max-text-width 80)
         (margin (max 0 (/ (- (window-width window) max-text-width) 2))))
    (if (and (not (string= current-extension "md"))
             (not (string= current-extension "tex")))
        ;; Do nothing if this isn't an .md or .tex file.
        ()
  (set-window-margins window margin margin))))

;; Adjust margins of all windows.
(defun center-windows () ""
  (walk-windows (lambda (window) (center-window window)) nil 1))

;; Listen to window changes.
(add-hook 'window-configuration-change-hook 'center-windows)


texts:
I am trying to find an emacs mode for the Cronell Note taking system. It doesn't have to be exact, but allows for SQ3R(Skim, Question, Read, Recite, Review) or a similar variation. Something more creative like counting the lines and if a certain number is exceeded automatically a new heading is created with similar structure (a way to create pages) and hopefully this could be exported nicely into pdf.

  The Cornell method provides a systematic format for condensing and organizing notes. The student divides the paper into two columns: the note-taking column (usually on the right) is twice the size of the questions/key word column (on the left). The student should leave five to seven lines, or about two in (5 cm), at the bottom of the page.

https://en.wikipedia.org/wiki/Cornell_Notes


texts: What is the relationship between Emacs and various spellcheckers (ispell, etc.)?

texts:
A. Is there a spellchecker built in to Emacs?

This seems to say that there is a "built-in ispell package" that "handles spell-checking and correction".

The manual (Emacs > Fixit > Spelling > 16.4) makes it sound like nothing is built in: "These commands only work if the
spelling checker program Aspell, Ispell or Hunspell is installed.  These
programs are not part of Emacs, but one of them is usually installed in
GNU/Linux and other free operating systems."

B. If there is a spellchecker built in to Emacs, how do I use it? The commands in the manual (Emacs > Fixit > Spelling > 16.4) do not work.

When I try "M-x ispell", I get this:

Starting new Ispell process ispell with default dictionary...
apply: Searching for program: no such file or directory, ispell

C. If there is not a spellchecker built in to Emacs, what is the most simple way to get one working on a Windows 8 or 10 machine? I don't even care about "on-the-fly" spellchecking. I'd be happy with being able to type a command and have the spellchecker check the buffer.

Thanks!


texts:
Wondering if it's possible to indicate intent to add a file via magit.
The intention would be to stage parts of an untracked file for a commit but leave the rest, rather than the default git add behaviour of adding the entire file (which might have various wip bits).


texts:
I like to use writegood-mode for my source code comments. I feel that there should be a way to make it check comments only. However, my python files display that kind of things:

and so does bash mode:

How can I setup writegood-mode to check only comments, or what are alternatives for style checking my comments?


texts: How to go through command history based on what's been typed (matlab style)

texts:
Using examples from octave mode to explain this, but it would be useful in other places as well.

When going through the command history it would be nice to only display entries that match what's already been typed.  For example,
if I've typed out x= pressing  M-p would go to the last commands beginning with that, eg x=3 or x=y+4, even if several unrelated commands have been entered.

What's the simplest way to achieve this in emacs?


texts: start emacs with org-agenda-list AND todo items

texts:
Is there any way to start emacs with both weekly agenda and todo list at startup? Similar to Doom Emacs shortcut <SPACE> - o - a - a - n (Agenda and all TODO's).
I can't seem to find a way to do this and both of these will overwrite the previous if used together, in separate windows:
(add-hook 'after-init-hook 'org-todo-list)
(add-hook 'after-init-hook 'org-agenda-list)


texts: How to pass function as argument in elisp

texts:
I am reading SICP recently to learn lisp programming.

There is an example in the book to make a high level function sum as below.

 (define (sum term a next b)
   ...
   (term a)
   ...
   (next a)
   ...

In this function, term and next are functions.

I want to write the same function in elisp like this.

 (defun sum (term a next b)
    ....
    (funcall term a)
    ...
    (func next a)
    ....

Then I define some test functions to test sum

 (defun inc-test (x) (+ x 1))

 sum inc-test 1 inc-test 10

but it show errors like this: Invalid function: inc-test

As I am new to elisp, can anyone call tell me how to fix it?
very appreciate


texts: Org-mode: How to fix table width to page width for dynamically generated tables?

texts:
I am using dynamically generated table to create a tabulated to do list with various parameters using:

#+COLUMNS: %ITEM %SCHEDULED %DEADLINE

for more info see: Org-Agenda export to dynamic Org-Table

The exported table in PDF runs off the width of the page.

How to fix it?


texts: Piping contents of buffer into eshell command

texts:
I know eshell supports output redirection to buffers

cmd > #<buffername>

Is there a way to do piping buffer contents into command? I would like to have something like

cat #<buffername> | cmd

The problem is that cat is not a builtin so it doesn't know emacs buffers.
I could always save the buffer buffername to a file and then cat it but that is not always desired (e.g r-o filesystem)

In more detail

I am passing from using a terminal emulator with zsh towards using eshell. Often I write scripts that run a command, pipe the output into grep,gawk, sed or whatnot and then pipe the result into another program.

I would like to separate this into steps. I know eshell supports output redirection to buffer via

cmb > #<buffername>

I would then process the contents of buffername using powerful emacs tools.
I know then that eshell does not support input redirection. I read in some manual to use pipes instead.

If I saved the output to a file with cmb > filename I could then do

cat filename | cmd2

but sometimes saving a buffername to a file filename is impossible or inconvenient. Any tips?


texts:
A natural approach to sorting an outline recursively would be the following:

(org-map-entries (lambda ()
                   (org-sort-entries nil ?f 'my/sort-function)
                   nil 'tree)

This doesn't work; it stops after sorting the top-level heading because org-sort-entries throws an error on any leaf node:

user-error: Nothing to sort

Do any alternatives exist?


texts: How to warn before sending email if Subject: is empty

texts:
If I hit C-c C-c in message-mode (I use notmuch) in order to send an email I've composed, I want to be warned if the Subject: header is empty.  E.g. "Really send without Subject? (yes or no)"

When composing new email I fill in the Subject after I have written the body because only then I know exactly what Subject: matches this emails contents best.  Sadly I often forget to actually set the Subject and with message-mode the email is sent without Subject:.

I searched online, but I'm astonished that this does not seem to be a recurring topic let alone an already answered FAQ.


texts: Say I have two directories A and B, with A containing B. Both A and B have directory local variables specified through their own .dir-locals.el files. B/.dir-locals.el whenever emacs visits a file in B. However, I want emacs to load B/.dir-locals.el and A/.dir-locals.el. Is there a way to customize this behaviour? If not, how do I achieve this behaviour?


texts: The format of ispell personal dictionary

texts:
I'm having difficulty getting flyspell to accept a personal dictionary.

In my .emacs file I have the line:

(setq ispell-personal-dictionary "~/.karpov_dic")

This .karpov_dic file only has a few words such as:

Orionis
Virginis

The words are separated by \n characters. There's only one word per line, which is how I have seen ispell/aspell  customized dictionaries so far.

Yet, in Emacs, when I start

M-x flyspell-mode

I get this:

Error: The file "/home/karpov/.karpov_dic is not in the proper format.

Any clues?


texts:
I've installed smex through MELPA as a replacement for the default M-x (execute-extended-command). The issue is that in smex, certain global keybindings don't work. For instance, C-h should work as backspace, yet in smex it's still bound to default help.

(global-set-key (kbd "C-h") 'delete-backward-char)

Any idea why the above global-set-key might not work in smex, while it does elsewhere (in minibuffer, eshell, etc.)?

Addendum to Jesse's answer

When using ido-vertical-mode one should also rebind M-p:

(defun ido-vertical-define-keys ()
(define-key ido-completion-map (kbd "C-n") 'ido-next-match)
(define-key ido-completion-map (kbd "C-p") 'ido-prev-match)
(define-key ido-completion-map (kbd "M-p") 'previous-history-element))


texts:
I just started using tramp mode, and it looks amazing. However, there's one issue that's making it non-usable for me. I have several boxes which I log into with one user, say, user. He's in sudoers groups. Now when I go and edit a file, it gets opened in read-only mode. I would like to be able to sudo save, or even better, sudo open.

I tried several approaches first, but none seem to actually work, given that emacs and dired changed how some variables get passed around (namely, buffer-file-name).

I'm on GNU Emacs 24.5.1.


texts: How to make strings literal when formatting?

texts:
When string formatting is supported, it's sometimes possible pass in a string which could contain a percentage symbol which would then be interpreted.

For example, this frame-title-format has a bug when the file name contains %b.

(setq-default frame-title-format
  '((:eval
      (if (buffer-file-name)
        (abbreviate-file-name (buffer-file-name))
        "%b"))
     (:eval (if (buffer-modified-p) " *")) " emacs"))

How can a string have formatting characters converted into literals?


texts:
I'd like to know if Emacs has an option to highlight the portions of C++ source inside .diff files generated by e.g. git diff HEAD~1 or git log -p

Right now I have to rename my .diff file to something like .diff.cpp or just use M+x cpp-mode and use regular C++ highlighting which somewhat works. Can I get that in diff mode?


texts: Easiest way to render an overline in org mode?

texts:
Org mode has support for showing unicode in place of latex commands through org-pretty-entities. Org mode also has support for underlining through font locks that are activated through the _ character. If everything fails then I can directly input unicode characters through the character viewer (on OSX).

However, I have never been able to get emacs to render overlines or characters with bars on top, e.g. ̅B , using any of the above three methods. Is there a way to show such characters in org-mode? Can font-lock automatically render code like \bar{B} as  ̅B ?

UPDATE: Thanks to the comment I made partial progress. By adding ("̅" (:overline t)) to org-emphasis-alist barber is rendered with a bar/overline when I enter C-x 8 RET 0 3 0 5 RET
barber
C-x 8 RET 0 3 0 5 RET
.

But what I'd really like is to just enter, \bar{barber} to toggle its overline attribute. Is this possible?


texts: the '(' is not aligned properly when using Mono font in Emacs

texts:
I am using Emacs to edit. all the ( in the picture are all at the same point on each line. But they are not aligned.

Major Mode: verilog-mode
Theme     : manoj-dark


texts: How to get process name (or process) from PID in lisp?

texts:
I would like to check if my shell is running ssh or not by checking the process name.  I tried to get the process name by:

(let* ((proc (get-process "shell")) (proc-child-id (process-running-child-p proc)))
  (if proc-child-id
     (message (process-name proc-child-id))))

But it doesn't work because process-name expect a PROCESS instead of PID.  How can I get PROCESS from PID?  Or how can I get the child process name directly?


texts: byte-recompilation of files under a directory

texts:
As I move all my emacs.d between my machines using Git, and, obviously, I don’t version control byte-compiled files (*.elc), I sometimes get into a situation when my .el files are newer then the corresponding .elc files.

Right now I construct a find(1) command using find-cmd, to find all .elc files, check if they are older then their .el counterpart, and byte-compile them if so.

(defun recompile-stale-elcs ()
  (interactive)

  (with-temp-buffer
    (setq-local default-directory user-emacs-directory)

    (let ((find-command (find-cmd '(prune (name ".git"))
                                  '(name "*.elc"))))

      (shell-command find-command t t))

    (goto-char (point-min))
    (setq more-lines t)

    (while more-lines
      (let ((start (progn (beginning-of-line)
                          (point)))
            (end (progn (end-of-line)
                        (point))))
        (let ((el (buffer-substring start (- end 1)))
              (elc (buffer-substring start end)))

          (if (file-newer-than-file-p el elc)
              (byte-compile-file (buffer-substring start (- end 1))))))
      (setq more-lines (= 0 (forward-line 1))))))

Is there a way to change that find-cmd call to pure Elisp?

Of course, if there is any other solution for the base problem, I’m open to hear that (probably in comment/chat.)

(Also, I was in doubt when selecting tags for this question. Please add some more relevant ones if such exist.)


texts: elpa.gnu.org:443 has a running process;kill it? message at install AUCTeX package on emacs 27.1 on windows 10

texts:
Trying to install AUCTeX on emacs 27.1 on Windows 10, when install AUC TeX through manage emacs packages when press install while the process work appears this mesage
Buffer "*http elpa.gnu.org:443 has a running process; kill it?(Y or N) I pressed Y

what does that message mean?
It is an error message? it's an issue?
is it wrong to have finished the process?
AUCTeX was installed correctly? How do I know if AUCTeX is installed correctly?


texts: Copy/Paste&Cut with Spacemacs on Terminal

texts:
I'm new with emacs, and I'm a developer that uses IDE to develop, and I want to learn emacs.
I choose Spacemacs as customization because I think has a good keybinding for me, but now I miss a feature that is on the IDE, that IDE the possibility to paste copy and go back with the keyboard shortcut.
So, in conclusion, my question is:
What is a method to configure emacs (into terminal) to allow me to copy and paste from a view to another, and how I can change the keybinding with somethings more similar to SPC C to copy SPC V to paste and SPC go back?


texts:
Attempting to bind M-ESC M-ESC in the global map to a command:

(global-set-key (kbd "M-ESC M-ESC") #'my-command)

results in the following:

Debugger entered--Lisp error: (error "Key sequence M-ESC M-ESC starts with non-prefix key M-ESC ESC")

I supposed this is due to meta-prefix-char being ESC by default, so M-<char> gets translated into ESC-<char>. Therefore, M-ESC M-ESC is ESC ESC ESC ESC, and ESC ESC ESC is already bound to keyboard-escape-quit.

Is there a safe way to separate the Meta and ESC keys so a binding like M-ESC M-ESC is possible? If so, how?


texts:
Note: This question was asked here before, with no success.

Org-mode’s ability to display inline images is fantastic for writing
my weekly scientific reports. I can include graphs, link them with
their data, link with the conclusions, and really harness the power of
org-mode.

The only problem I have is that org needs the images to use
conventional image formats (jpeg, png, etc), while I prefer for my
graphs to be in PDF.

How can I display inline pdf images in org-mode?

My final objective is to just write a link like this in org-mode:

[[file:~/Work/grap.pdf]]

And have it displayed inline just like it would happen if it were a png.

I know I could just have a copy of each graph in jpeg or something
(which is what I do right now), but it’s slightly cumbersome and it
always carries the risk of the pdf graph being updated and me
forgetting to update the jpeg.


texts: Have Ctrl-a increase a number just like in vim

texts:
In spacemacs Ctrl-a is being used to move to the beginning of the line. I'm more used to 0 to move to the beginning of the line and $ to the end, which works in spacemacs.
Ctrl-a increases numbers in vim and I'd like to use that key in spacemacs too. How can I do so?
I tried to unbind the keys with the following in my .spacemacs:

(define-key org-mode-map (kbd "C-a") nil)
(define-key global-map (kbd "C-a") nil)

Now the key doesn't move to the beginning of the line, but it also doesn't increment numbers, it does nothing. When I use it, it simply shows "C-a is undefined".


texts: How to prevent `*scratch*` or `*Messages*` buffer to show up when I open via `emacs -Q`?

texts:
I realize when I open emacs using emacs -Q I can see *scratch* for a very short time. Sometimes 1ms or half a second.
=> How to prevent *scratch* or *Messages* buffer to show up when I open via emacs -Q along with a theme?

My eval file is:
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)

(setq inhibit-splash-screen t)
(setq inhibit-startup-message t)
(setq initial-scratch-message "")

==> emacs -q -l ~/emacs_q.el hello_emacs


texts: How to remove email address from local database in mu4e?

texts:
I use mu4e to read and write email. One email address that was in the LDAP server before no longer exists, but it still shows and auto-completes in mu4e.

How can I remove that address from the local database? And where is that database stored?


texts: Some commands in init.el don't run on startup, but others seem to run fine

texts:
I am having a very weird issue with my init.el file. At startup, some of the commands in it run fine (so I know Emacs is able to pick the correct file), but others only run when I manually load the file using M-x load-file RET ~/.emacs.d/init.el RET (so I know those commands are syntactically correct as well). Here is a working example:
(setq package-enable-at-startup nil)
(setq doc-view-continuous t)
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))
(use-package yasnippet
  :config
  (yas-reload-all)
  (yas-minor-mode 1)
  :ensure t)
(use-package auto-complete
  :ensure t
  :config
  (auto-complete-mode 1)
  )

; The following command is not run at startup. But runs when I load the file manually.
(setq line-spacing 0.3)

(yas-minor-mode 1)

(global-display-line-numbers-mode)
;If I remove the next command, startup line numbers are no longer relative, but they are with it.
(setq display-line-numbers-type 'relative)

I tried removing the top commands (all upto to line-spacing), but on removing them even the line numbers were no longer working on startup.
I am using Mac OS X Mojave. M-x emacs-version RET gives the following:
GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02. I had installed it along with AucTex.
I am fairly new with Emacs and Lisp, so please let me know if I should provide some more information.


texts: Sequence of packages to be installed to make emacs an ide for c/c++

texts:
Hi everyone I am new to Emacs and was taking help of tutorials to make emacs an IDE for languages like c/c++.

I started out with the youtube tutorials by b yuksel at https://www.youtube.com/channel/UCibKclzsnnHjQZFOLuykZ1A

But these tutorials are 2 years older now and many packages have changed their structure therefore it is not clear how to move forward. However I am taking help from stackoverflow but still it seems insatiable.

And many packages ask for some other package to be installed first and that package have some other prerequisite.

Currently I am stuck with irony-mode for C++.

I have installed packages (in this sequence) auto-complete, yasnippet, auto-complete-c-headers, iedit, flymake-google-cpplint, google-c-style and semantic and cedet.
Now I wanted to install the irony-mode package with clang, so i started with downloading irony-mode zip from github and along with it mjpa-SimlpeJSON.
Now I have to move simpleJSON to lib folder in irony-mode directory. But there is no lib folder in irony-mode directory?
Then somehow I managed to install irony-mode but next step was to install doxygen and when i tried it it asked for some prerequisite packages like flex, bison, libiconv and strip.
And to install bison i need some other packages installed.

Therefore I am confused what to install and in which sequence.

My motive is to improve my editing experience in emacs for c/c++. And I being a dilettante in emacs just followed the simple instructions posted by people on internet.

But now I am stuck and need help.

So can anyone please post an easy way to install irony-mode with clang. And if you can explain why each package is necessary and what does it do(significance of each package), then I will be very grateful.

I am using ubuntu 16.04.


texts: How to make vc-* and magit treat a symbolic link to a real file in git repo just like the original file?

texts:
Say, I got ~/.emacs which is a soft link to ~/.emacs.d/init.el(using ln -s ~/.emacs.d/init.el ~/.emacs) which is in a git repo, because this will make it easier to reach init.el, outside or inside Emacs.

When I edit the file using bookmarks(bookmark for ~/.emacs not ~/.emacs.d/init.el) or C-x C-f to ~/.emacs directly, it will only edit the link, I use (setq vc-follow-symlinks 'nil) to not prompt to ask yes/no and not follow to the real file, (e.g., M-: (buffer-file-name) shows the /home/user/.emacs not /home/user/.emacs.d/init.el).

But sometimes I want to show the diff of this file, the C-x v = will not work for the link, it works in the file if I follow the link to it or open ~/.emacs,d/init.el directly. I don't want to do M-x magit-status and then ~/.emacs.d/ repo and then find the init.el and then TAB, so is there an easy way to show the diff of the file??


texts: How can Emacs set an environment/shell variable in a subordinate shell?

texts:
I often use subordinate shells within Emacs.  (I instantiate these shells with M-x shell.)

I put all these shells under auto-save-mode (through my shell-mode-hook; see below).

Is there some way that I can have Emacs set an environment variable in a subordinate shell equal to the value of buffer-auto-save-file-name?

For what it's worth, below is the hook code I use to put my subordinate shells under auto-save-mode:

;; NB: I define the global variable auto-saves-dir elsewhere in my init file.

(defun cd-to-auto-saves-dir ()
  (unless (file-directory-p auto-saves-dir)
    (make-directory auto-saves-dir t))
  (cd auto-saves-dir))

(add-hook
    'shell-mode-hook
    (lambda ()
        ;; the silliness with cd-ing to/fro auto-saves-dir is the
        ;; only way I've found to trick Emacs into putting the
        ;; auto-save'd file in auto-saves-dir
        (let ((orig-dir default-directory))
           (cd-to-auto-saves-dir)
           (auto-save-mode)
           (cd orig-dir))
        )
    )


texts:
I'm trying to implement a tokenizer for Haskell, it has a bit involved token structure that can be seen in code here:

https://github.com/ghc/ghc/blob/master/compiler/basicTypes/Lexeme.hs

In regexp-like terms it would be:

(LowercaseLetter|OtherLetter|_)(UppercaseLetter|LowercaseLetter|OtherLetter|TitlecaseLetter|DecimalNumber|OtherNumber|'|_)*ModifierLetter*#*

In human terms: a non-uppercase letter or underscore, followed by any numbers of letters, numbers, underscores, apostrophes followed by any number of modifier letters followed by any number of hashes.

How do I write a regexp in emacs lisp that uses Unicode General Categories as indicated above?


texts:
line-spacing adds space at the bottom. Here is what I mean - Image link.
The docs say that the space is added below lines of graphic displays. I want the space to be added at the top. How do I do that?


texts: rjsx-mode can't uncomment c-style block comments

texts:
I recently switched from web-mode to rjsx-mode in my react-native project. In my code I have a lot of C-style block comments, like this:
/* var a = "a";
 * var b = "b";
 * var c = "c"; */

When I try to M-x uncomment-region, it removes the starting and ending comment characters but
leaves the continuing *, like this:
var a = "a";
 * var b = "b";
 * var c = "c";

which of course creates a syntax error and is annoying to clean up.
rjsx-mode has special features for commenting and un-commenting JSX code, but as far as I understand, it delegates to its parent JS-mode for comments in plain old javascript code (which is what we're talking about here).
I found that the same problem occurs when opening the file in plain JS-mode, but I was able to take inspiration from this answer and came up with this code to fix it:
(defun my-js-comment-setup ()
  "Configure multi-line comments for js."
  ;; You may want to use `setq-local' instead.
  (setq-local
        c-line-comment-starter "//"
        c-block-comment-starter "/*"
        c-block-comment-ender "*/"
        comment-multi-line  t
        comment-padding     " "
        comment-style       'extra-line
        comment-continue    " * "
        comment-empty-lines t))

(add-hook 'js-mode-hook #'my-js-comment-setup)

Using M-x c-toggle-comment-style I am able to switch between C and C++ style comments now in JS-mode and it un-comments both just fine. Unfortunately, the fix doesn't work in rjsx-mode. The problem remains as before. Any hints on other settings that may help?


texts: How to copy text from another application to emacs in ubuntu?

texts:
I am using emacs 23.3 on Ubuntu 12.04 LTS. I am having problems trying to copy text from another application (most of the time, Firefox) to emacs. Sometimes it works and sometimes it doesn't. Any way to fix this?

Thanks


texts: Configure compilation mode to use custom shell

texts:
On windows I have set (setq explicit-shell-file-name "c:/Program Files/Git/bin/bash.exe") to use git-bash for e.g. M-x shell. In compilation mode however, the standard windows console still seems to be used, as far as I can tell. Can this be changed somehow?

FWIW, I'm actually using projectile-run-project to trigger compilation in this particular scenario.
One possible solution is to place (projectile-project-run-cmd . "\"c:/Program Files/Git/bin/bash.exe\" build_and_run.sh") in .dir-locals.el, but then I cannot use the same dir-locals on linux. It is important that the output of build_and_run.sh is displayed in compilation-mode, because it might contain links with build errors.


texts:
In Helm I can see something like that:

Bibtex entries:
  2 Title of my first article
  3 Title of other article
  4 Title of still another article

How could I directly select (but not execute the default action) one entry by it's "line" number? (like number 4 here) I tried to look at the documentation, but can't find anything. The binding I found execute the line, and they are relatif, not absolute.


texts:
Installing Emacs 24.4 broke my haxe mode. The mode for the HaXe language doesn't seem to be maintained any more so I'm trying to fix it myself.

Firstly, I had a cl-macroexpand-all problem which forced me to add

(require 'cl)

before loading the mode.

Secondly, and that's where things get tricky, the indenting of typeful function declarations is broken (or at least that's where I think the problem is originated):

class Test {

    public function notFailingAfterThis() {

    }

    public function butFailingAfterThis(): Int {

    }

                                           public function failingHere(): Void {

                                           }

                                                                          public function hereEvenMore() {

                                                                          }
        public function endOfTheFailure() {

    }

}

My knowledge of Emacs lisp is too limited to find the error (if you want to test this yourself, you can download haxe mode's source and create this Test.hx file).

HaXe allows typeless and typeful declarations, with a syntax similar to ActionScript.

var myVar: MyVarType;
function myFunction(): MyFunctionReturnType {}
var myUntypedVar;
function myUntypedFunction() {}

Any ideas how to fix this, before I'm forced to make the whole plugin myself?
It seems to be a feature that put the carret at the right indenting after a carriage return, which it didn't do before I updated emacs.


texts: Helm won't let me select available emacs commands

texts:
I have emacs set up so that when I type M-x the helm completion buffer pops up. My problem is that helm wont let me select M-x align if I have previously called M-x align-current, because it is only letting me select the completion from the Command History List and not the list of all available commands.

Any idea how I can overcome this problem?


texts: Why can't Emacs find counsel and swiper, even though they (and Ivy) seem installed, and Ivy working?

texts:
Why can't Emacs find counsel and swiper, even though they (as well as ivy) seem installed, and moreover Ivy mode is enabled, and seems to be working?

This is what I get when I try the following:

(package-installed-p 'ivy)
t

(package-installed-p 'counsel)
t

(package-installed-p 'swiper)
t

And I can also see the version information for Ivy:

(pkg-info-version-info 'ivy)
"0.11.0 (package: 20190412.840)"

But when I try to get version information for counsel, I get an error:

(pkg-info-version-info 'counsel)

Debugger entered--Lisp error: (error "Can’t find library counsel")
  signal(error ("Can’t find library counsel"))
  error("Can't find library %s" "counsel")
  find-library-name("counsel")
  pkg-info-library-source(counsel)
  pkg-info-library-version(counsel)
  pkg-info-version-info(counsel)
  eval((pkg-info-version-info 'counsel) nil)
  elisp--eval-last-sexp(t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  funcall-interactively(eval-print-last-sexp nil)
  call-interactively(eval-print-last-sexp nil nil)
  command-execute(eval-print-last-sexp)

Interestingly enough, if I visit the the packages list, counsel is listed as installed and I can get the following details:

counsel is an installed package.

     Status: Installed in ‘counsel-20190414.1926/’ (unsigned).
    Version: 20190414.1926
     Commit: 0e62f0d1f61b825ca5eb4b55e47ecb37b3e2834e
    Summary: Various completion functions using Ivy
   Requires: emacs-24.3, swiper-0.11.0
Required by: counsel-tramp-20190125.751
   Homepage: https://github.com/abo-abo/swiper
   Keywords: convenience matching tools
Other versions: 20190414.1926 (melpa).

My Emacs version is:

"GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32)
 of 2018-06-19"

and I'm encountering this issue on MS Windows 10 (version 1607).


texts: How to change mode line color based on host?

texts:
For terminal, there is an app called byobu which shows different mode line based on host.

If I open terminal in system 1, mode line will be like this.

If I ssh into system2 from system1, mode line will automatically changes to something like this.

If I ssh into system3, mode line will change to something like this.

In emacs, when I open a file/dired using tramp, I want to change mode line color automatically.
How can I achieve that?


texts: File-local variables not parsed in lilypond file

texts:
I have a definitions.ly file that ends with the following:
%%% Local Variables:
%%% LilyPond-master-file: "score.ly"
%%% End:

However, the value of LilyPond-master-file is still nil when I visit the file.
If I do M-: RET (inibit-local-variables-p) RET I get nil.
If I save the exact same file with a different extension (eg. .foo), emacs asks me (upon loading) if I want to set the unsafe variable, as expected.
I've tried using a directory-local variable, but it doesn't work either.
I've tried setting another variable, like fill-column, using the snippet above, in the same file, without success.
Maybe there's something in lilypond-mode preventing the parsing of local variables?
I'm out of ideas and I don't know how to debug this...


texts: How to export org-mode to ODT with endnotes?

texts:
If an org-mode document includes footnotes, and you export to ODT, you get footnotes at the bottom of every page.

For a journal submission, I need these to be endnotes.

This is fairly easy in LaTeX export, but I can't find the switch for ODT export. I did find that I can manually edit the ODT in LibreOffice to move footnotes to "end of document," so I think I can do what I need by hand. But... would be nice if it could "just work."


texts: Apropriately indent multi-line x=($()) in shell-script-mode?

texts:
Bash allows capturing output of a subshell as elements of an array line-by-line with the construct
IFS=$'\n'
myArray=($(someCommand))

However, auto-indentation fails to produce a useful result for multi-line subshells
myArray=($(
             myCommand1
             myCommand2
         ))

and semi-fails for multi-line subshell captures
myArray=$(
    myCommand1
    myCommand2
       )
#      ^ why on this column?

while it works fine for ordinary array assignment
myArray=(
    value1
    value2
    value3
)

Is there any way to correct this behavior?


texts: Show all (or some) markup in current line in Org-mode

texts:
I want to unhide/show all the markup of the line my cursor is on.
For example:

If the image is in preview mode, when I put my cursor on the line the image is in, I want it to show the full link e.g. [[/home/me/image.jpg]] instead of the actual image.
I want to see the full messy latex code (I need this for editing equations), even though I have #+STARTUP: latexpreview
I want to see all the bold and italic syntax. e.g. *whatever* instead of whatever


texts:
I installed Counsel/Ivy/Swiper and so far everything works fine. But when I call counsel-M-x via key bind M-x an "^" char is always added. I have no clue why this is happening and how to get rid of it (it does not interfere with the counsel-M-x command, it is just annoying). I'm using emacs on OS X and remapped the Meta key to the Command key (setq mac-command-modifier 'meta), but even with Alt as standard Meta key "^" is automatically inserted when calling counsel-M-x.

I use the basic settings provided here

(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key (kbd "M-x") 'counsel-M-x)


texts: how do you turn off smart brackets//parenthesis in prelude

texts:
I hate it when prelude auto adds the ending } when I type {
(this is ruby mode)

This is very common, for example typing ( auto adds a )
This is really annoying when trying to edit code, or a lot of copy/pasting.

I want emacs/prelude to permanently not do this kind of thing. I have started customizing ~/.emacs.d/personal/personal.el for other things, but not sure how I should go about getting this done.


texts:
I'm editing a text file containing Japanese kanji characters.  単 does not show up in Emacs, how to fix?  It shows up as some sort of white space.

Update:

I'm using GNU Emacs 24.3 (9) for Mac.

After examining my .emacs, I actually copied from someone else's configuration and has

(create-fontset-from-fontset-spec
  "-unknown-Source Code Pro-normal-normal-normal-*-16-*-*-*-m-0-fontset-myfontset")
(set-fontset-font "fontset-myfontset" 'han "XinGothic CiticPress")
(set-fontset-font "fontset-myfontset" 'kana "HanaMinPlus")
(add-to-list 'default-frame-alist '(font . "fontset-myfontset"))

but I don't quite understand what it does.  Apparently it doesn't work for some Kanji characters.

Update 2

I've confirmed font HanaMinPlus can display that character correctly by evaluating (set-frame-font "HanMinPlus" nil t) in my mini-buffer and observing 単 showing up correctly in scratch buffer.  But I wonder how to tweak/correct the above code to let it automatically detect and set font.  I don't understand how fontset work in Emacs.  But

describe-fontset

gives

Fontset: -apple-Menlo-medium-normal-normal-*-16-*-*-*-m-0-fontset-auto1

not myfontset.  And describe-font gives

name (opened by): -apple-Menlo-medium-normal-normal-*-16-*-*-*-m-0-iso10646-1
       full name: Menlo-Regular
            size: 16
          height: 19
 baseline-offset:  0
relative-compose:  0

Update 3

Experiment 1

/Applications/Emacs.app/Contents/MacOS$ ./Emacs --no-init-file

and then open a text file containing

すべての人間は、生まれながらにして自由であり、
かつ、尊厳と権利と について平等である。
人間は、理性と良心とを授けられており、
互いに同胞の精神をもって行動しなければならない。

I see all characters showing up correctly.  And describe-font with default selection shows

name (opened by): -apple-Menlo-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1
       full name: Menlo-Regular
            size: 12
          height: 14
 baseline-offset:  0
relative-compose:  0

and describe-fontset shows

Fontset: -apple-Menlo-medium-normal-normal-*-*-*-*-*-m-0-fontset-startup

Experiment 2

/Applications/Emacs.app/Contents/MacOS$ ./Emacs --no-site-file

and then open the same test file.  I see all characters showing up correctly.  And describe-font with default selection shows

name (opened by): -apple-Source_Code_Pro-medium-normal-normal-*-12-*-*-*-m-0-iso10646-1
       full name: SourceCodePro-Regular
            size: 12
          height: 16
 baseline-offset:  0
relative-compose:  0

Why it's not font size 16?!

and describe-fontset shows

Fontset: -apple-Source_Code_Pro-medium-normal-normal-*-12-*-*-*-m-0-fontset-auto1


texts: How can I use par as my paragraph formatter

texts:
I'm coming from vim, which has a gq operator that acts much like emacs' fill-paragraph function (M-q). There's a 'formatprg' setting that allows you to point gq at an external program for its formatting decisions, and I've found that using par yields much nicer results than vim's default formatting logic.

I'd like to do something equivalent in emacs (get it to use par). I see there's a fill-paragraph-function variable, and I know that basically anything is possible in emacs, but I'm not sure how to go about wiring it in. How could I do so?


texts: How to achieve dynamic projects without fixed paths for publishing from Org mode?

texts:
One usually adds entries to org-publish-project-alist to describe what and how needs to be published, including :publishing-directory, fancy :publishing-function and alike. However it seems handy for some projects to reside in version controlled repository with all that it entails, i.e. different users, different checkout paths. My problem is that I cannot wrap my head around how would I go about making it all flexible.

I'd like everything to go by a "standard" project name no matter what repository clone I'm in, i.e. if I have multiple cloned copies of my repository, I'd like to have same project name while exporting files from subfolders. And I'd like for an export to take place, e.g. to a sibling folder, i.e. not some hard-coded paths.

It seems that .dir-locals.el is the way to go. But it is getting gnarly with on the fly evaluation of various path names, etc and I have to mark variable and values as safe. But minor changes cause pollution of safe-local-variable-values in my custom-file.

Is there a canonical way on how to achieve such setups in general?

Update:
Currently, I'm having a custom function that overrides quite many things (starting with looking up a working repository copy root containing .git) on a global scale with setq and this function is wrapped into a minor mode. It is still somewhat broken (autoload part) due to my knowledge (or lack thereof) of Elisp so I have to re-evaluate the file as some variables aren't set right. And a huge shortcoming is that I have to restart Emacs to get variables back to their original values as it is too many of them that I change (like org-twbs-tag-class-prefix, org-twbs-format-headline-function, org-latex-classes, org-babel-default-header-args:dot and more).


texts: Emacs Equivalent of Vims's Auto Commands?

texts:
I'm currently trying to move from vim to emacs so be gentle with me ;)

In Vim, one of my favorite features is auto commands, I'll have one for each project for example:

au BufEnter c:/projects/foo/* :call FooSetup()
au BufEnter c:/projects/bar/* :call BarSetup()

This will call the correct setup whenever I switch buffers and change setting like the root directory, make program, error format etc.

The closest emacs equivalent I've been able to find is mode hooks, which seem much more limited.

Edit - The solution, by combining both answers below:

(defun my/test ()
  (when (and buffer-file-name (string-match "c:/projects/foo/.*" (buffer-file-name)))
    (message "foo")
    (setq default-directory "c:/projects/foo"))
  (when (and buffer-file-name (string-match "c:/projects/bar/.*" (buffer-file-name)))
    (message "bar")
    (setq default-directory "c:/projects/bar")))
(add-hook 'buffer-list-update-hook #'my/test)


texts: execute a function when emacsclient opens a frame

texts:
I am using emacs-evil and when I open a new frame on X11 I can normally use ESC key switch between writing and command mode. But in terminal it won't work, and it just trigers meta.
I have been able to fix this issue with this code:
(defvar personal/fast-keyseq-timeout 200)

(defun personal/-tty-ESC-filter (map)
    (if (and (equal (this-single-command-keys) [?\e])
             (sit-for (/ personal/fast-keyseq-timeout 1000.0)))
        [escape] map))

(defun personal/-lookup-key (map key)
    (catch 'found
        (map-keymap (lambda (k b)
                       (if (equal key k) (throw 'found b))) map)))

(defun personal/catch-tty-ESC ()
"Setup key mappings of current terminal to turn a tty's ESC into `escape'."
    (when (memq (terminal-live-p (frame-terminal)) '(t pc))
        (let ((esc-binding (personal/-lookup-key input-decode-map ?\e)))
          (define-key input-decode-map
                      [?\e] `(menu-item "" ,esc-binding :filter personal/-tty-ESC-filter)))))

(personal/catch-tty-ESC)

This code fixes the problem and in terminal I will get my ESC key back but there is one problem. I cannot get this to work in a scenario where I have started the emacs daemon and I just open a new emacsclient -t frame.
This code snipet won't work:
(add-hook 'after-make-frame-functions #'personal/catch-tty-ESC)

Basically I am out of option and I wonder why it doesn't work!


texts: Is it possible to get the start and end points in the buffer in which text is pasted?

texts:
Like if you have a buffer containing hel! and paste in lo world after the third letter you get 4 and 11 respectively?

Emacs has many state variables, are there any that could help me in this case?


texts: Changing linum-mode face background uniformly

texts:
I've been trying to change my line numbers background to be a different colour other than the background colour of my frames and it ended up looking like so :-

How can I change the line numbers background colour to be uniform throughout and not only till the last line of the buffer?


texts:
windows 10, emacs 26.1,

I use package magit to work with git.
Nice.

When I press C-<tab> is collapse/expand recent commits:

Nice. But if I press <tab> magit do same thing as when I press C-<tab>.
So press <tab> and C-<tab> do same things.

How I can disable C-<tab>. I want to bind C-<tab> to another command (no magit command).


texts:
Note that I use spaces for tabs.
When I am working in erb files for rails such as example.js.erb or example2.html.erb, I am getting some very odd (and annoying) auto-tabbing behaviour, which I can't figure out.

For example, in a js.erb file I'll type:

function blaah(){  //a comment
  var a = 5;
}

Then I'll press tab on each line and I'll get

function blaah(){  //a comment
                   var a = 5;
}

It would appear as though the 2nd line is attempting to align with the comment above, but for what reason I do not know.

Here is my .emacs file:

(require 'package)
(add-to-list 'package-archives
         '("melpa" . "http://melpa.milkbox.net/packages/")
         t)
(package-initialize)

(load-theme 'misterioso)
(setq inhibit-splash-screen t)

; remove tool/scroll bars
(tool-bar-mode -1)
(scroll-bar-mode -1)

; (row,column) shown in bottom bar
(line-number-mode)
(column-number-mode 1)

; line numbers on the left
(global-linum-mode 1)

; highlight current line num
(require 'hlinum)
(hlinum-activate)
(setq hl-line-sticky-flag nil)

(require 'smartparens)
(smartparens-global-mode t)
(require 'smartparens-config)
(sp-pair "%" "%" :wrap "C-%")

(add-to-list 'load-path "c:/Users/darre00/AppData/Roaming/.emacs.d/web-mode-master")
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(setq web-mode-enable-auto-pairing nil)

(require 'json-mode)
(add-hook 'json-mode-hook 'hs-minor-mode)

(require 'org)
;; Make org-mode activate automatically for files ending in .org
(add-to-list 'auto-mode-alist '("\\.org$" . org-mode))

(require 'multiple-cursors)
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
(global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this)

(require 'expand-region)
(global-set-key (kbd "C-=") 'er/expand-region)
(global-set-key (kbd "C-+") 'er/contract-region)

; scrolling starts 2 lines away from top/bottom
(setq scroll-margin 2
      scroll-preserve-screen-position 1)

; indentation
(setq-default c-basic-offset 2)
(setq-default js-indent-level 2)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq-default web-mode-code-indent-offset 2)

; full file path in title bar
(setq-default frame-title-format '((:eval (if (buffer-file-name)
                                              (abbreviate-file-name (buffer-file-name)) "%f"))))

(ido-mode 1)

; FUNCS
(defun kill-dired-buffers()
  "Kill all dired buffers open."
  (interactive)
  (mapc (lambda (buffer)
      (when (eq 'dired-mode (buffer-local-value 'major-mode buffer))
        (kill-buffer buffer)))
    (buffer-list)
   )
  (message "Killed all dired buffers")
)

(defun toggle-comment ()
  "comment or uncomment region or line"
  (interactive)
  (let (beg end)
    (if (region-active-p)
        (setq beg (region-beginning) end (region-end))
      (setq beg (line-beginning-position) end (line-end-position)))
    (comment-or-uncomment-region beg end)))

; KEYBINDINGS
(global-set-key (kbd "C-c k") 'kill-dired-buffers)
(global-set-key (kbd "C-c /") 'toggle-comment)

Any help is much appreciated.


texts:
I am trying to initialize Magit Forge's forge-alist programatically. Therefore I put together my first couple of emacs-lisp code. It looks like the following:
(let ((gitlab-install (lambda (host) (list host (concat host "/api/v4") host forge-gitlab-repository))))
  (dolist (host '("gitlab.example.com" "gitlab.foobar.com"))
    (print host)
    (print (funcall gitlab-install host))
    (add-to-list 'forge-alist (funcall gitlab-install host))))

Unfortunately it seems that the final forge-alist has strange entries even though the (print) statement prints out the entries correctly.
((#1="gitlab.foobar.com" "gitlab.foobar.com/api/v4" #1# forge-gitlab-repository)
 (#2="gitlab.example.com" "gitlab.example.com/api/v4" #2# forge-gitlab-repository)
  ...)

What am I doing wrong?


texts: I need a key binding of: "M-x compile" then in Compile commant type the "Compile command: love2d /home/huseyin/Documents/Programming/Lua/"

texts:
I need a key binding of: M-x compile then in compile command type like Compile command: love2d /home/huseyin/Documents/Programming/Lua/
I am tired of doing that again and again.


texts: How to get automatic backlinks when linking files in in org-mode?

texts:
Is it possible to automatically create backlinks to org-mode links? When a link to file B is added to file A, then also a link to file A is added to file B (i.e. the links are symmetrical - going both ways).

A concrete example:

I have two files a.org and b.org.

Inside a.org in heading Links I insert an org-link (with a new function org-link-with-backlink) to the file b.org.

So file a.org looks like this:

* Links
  [[~/org/b.org][b]]

* Heading 1
  lorem ipsum....

I'd like this to happen automatically:

the file b.org is opened (if not open already)
and inside its Links heading a link to a.org is created.

If Links doesn't exist yet, create it by prepending the file and add the link.

If b.org already has a link to a.org in its Links heading then do nothing.

So that b.org looks like this after the operation:

* Links
  [[~/org/a.org][a]]

* Heading X
  foo bar....

If now I inside file c.org add also a link to b.org, then b.org now looks like this:

* Links
  [[~/org/a.org][a]]
  [[~/org/c.org][c]]

* Heading X
  foo bar....

I think some sort of advice around org-link should accomplish this, but unfortunately this is beyond my elisp skills...

Thank you very much!

PS [optional]: I intend to use it in conjunction with org-wiki, to the solution could use the wiki style links as an alternative.


texts:
I recently installed Graphviz and Cogre to make UML diagrams in Emacs. Though when I run cogre-uml-quick-class with the Class name, it says "Layout engine failed. You need to install Graphviz".

The problem is I have installed Graphviz and it is working properly, I have tried making sample graphs and compiling them in graphviz dot mode and I have graphviz-dot-mode.el in my load path.

I added this to my .emacs file

(add-to-list 'load-path "~/.emacs.d/cedet/srecode")
(add-to-list 'load-path "~/.emacs.d/cedet/cogre")
(add-to-list 'load-path "~/.emacs.d/elpa/graphviz-dot-mode-20150525.1000")

(load-file "~/.emacs.d/elpa/graphviz-dot-mode-20150525.1000/graphviz-dot-mode.el")

I'm using Emacs 24.4 on Windows 8.1

Cogre - http://cedet.sourceforge.net/cogre.shtml

Graphviz - http://www.graphviz.org/

Any help is appreciated.


texts: How to set the y-coordinate (in pixels) of the current line

texts:
I want to scroll the buffer so that the the current line is, say, 300
pixels from the beginning of the window.

Something like this:

. \
. | (300 pixels)
. /
| <-- (current line)

Any ideas?

Note that the buffer may contain figures and different font sizes, so scrolling a fixed number of text lines won't do the trick.


texts:
In my init.el, I have the following line
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))

which is supposed to set the file custom.el into .emacs.d config folder for getting all customization tidy. Over the years, emacs populated this file with various things.
I ran customization with M-x customize-variable and made some change and saved them. Afterwards, I discovered that emacs added the new custom into custom.el, overwriting the previous version of the file.
What's the mistake? Should I put (load custom-file) after the line above? Can this be the problem?


texts: Emacs: Get user input when using interactive Python with `getpass`

texts:
I am, unfortunately, using Windows 7 and am running GNU Emacs 25.3.1 (x86_64-w64-mingw32) of 2017-09-26. Everything functions as expected from the command line.  However, within Emacs, I encounter a problem.

I have started Emacs using -q.  I start an interactive Python session with M-x run-python.  Regular input works fine.  However, when I try to use getpass, no input is accepted and all text is printed to the screen.  Pressing Enter only inserts a new line.  To demonstrate:

Text transcript of Emacs input:

Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup failed
>>> user = input('Username: ')
Username: bob
>>> import getpass
>>> pw = getpass.getpass('Password: ')
my secret password
wait, why is it printing to screen?
and why does pressing return only insert a new line?
I can't seem to get out of this!
I'm going to press C-c C-c now  C-c C-c  C-c C-cTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Users\AppData\Local\Continuum\anaconda3\lib\getpass.py", line 110, in win_getpass
    raise KeyboardInterrupt
KeyboardInterrupt
>>>   File "<stdin>", line 1
    my secret password
            ^
SyntaxError: invalid syntax
>>>   File "<stdin>", line 1
    wait, why is it printing to screen?
                           ^
SyntaxError: invalid syntax
>>>   File "<stdin>", line 1
    and why does pressing return only insert a new line?
      ^
SyntaxError: invalid syntax
>>>   File "<stdin>", line 1
    I can't seem to get out of this!
        ^
SyntaxError: invalid syntax
>>>

I'm not sure what to do next in fixing this.

Does anyone else have this issue?
If so, might it be a problem with python.el and a bug report need to be submitted?  And where would that bug be reported?
Any ideas or suggestions?


texts: How to sometimes but not always add a note to an Org TODO state change?

texts:
I have this in an Org mode projects file:

#+TODO: TODO(t!) WAITING(w!) DONE(d!) CANCELED(c@)

When I move something from TODO to WAITING, it adds a timestamp without asking for a note.  That's fine 8 or 9 times out of 10 ... but sometimes I want to add a note too.

If I use the @ it will always ask me for a note, and I have to C-c C-c to get out of that.  I'd like to avoid that if I can.

Is there a way (a prefix or alternate command) that I can use to have Org let me add an optional note when I change a TODO state?

C-c C-z (org-add-note) adds a note, but it does it to the item as a whole, not to the WAITING workflow change, like so:

* WAITING Find out how to sometimes add a note when I change to WAITING
  - Note taken on [2014-09-23 Tue 11:36] \\
    Asked on SE
  - State "WAITING"    from "WAITING"    [2014-09-23 Tue 11:30]
  - State "WAITING"    from "TODO"       [2014-09-21 Sun 11:25]


texts: How to have c-offset style correctly detect a Java constructor and change indentation?

texts:
Currently my team (non-Emacs users) indent java like so:

public DiskThresholdDecider(Settings settings,
                            NodeSettingsService nodeSettingsService,
                            ClusterInfoService infoService,
                            Client client) {
    String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK,
            "85%");

There are two different indentation settings for the same c-style offset, for example (| denotes the cursor):

public DiskThresholdDecider(Settings settings,
                            |NodeSettingsService nodeSettingsService,
                            ClusterInfoService infoService,
                            Client client) {

C-c C-s (c-show-syntactic-information) returns (arglist-cont-nonempty ... ...)

Just a couple of lines down, on the method invocation, C-c C-s also returns (arglist-cont-nonempty ... ...) here:

    String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK,
            |"85%");

In my configuration, I have this set up as:

(defconst intellij-java-style
  '((c-basic-offset . 4)
    (c-comment-only-line-offset . (0 . 0))
    (c-offsets-alist
     .
     ((inline-open . 0)
      (topmost-intro-cont    . +)
      (statement-block-intro . +)
      (knr-argdecl-intro     . +)
      (substatement-open     . +)
      (substatement-label    . +)
      (case-label            . +)
      (label                 . +)
      (statement-case-open   . +)
      (statement-cont        . ++)
      (arglist-intro         . 0)
      (arglist-cont-nonempty . ++) ;; <-- the actual setting
      (arglist-close         . --)
      (inexpr-class          . 0)
      (access-label          . 0)
      (inher-intro           . ++)
      (inher-cont            . ++)
      (brace-list-intro      . +)
      (func-decl-cont        . ++))))
  "Elasticsearch's Intellij Java Programming Style")

The problem is I need Emacs to treat class constructors as different indentation style than regular method invocations. This is so it will line up lines on the ( only for constructors.

Is there a function I can use to set for arglist-cont-nonempty that will indent this correctly or a way to do this?


texts: Cannot add general block header arguments in org mode

texts:
While I'm learning javascript following a book, I Like to take notes with org-mode. I use Indium and followed this instructions to handle it working

It works well, and I get my work done, interacting with browser, and getting great notes and structure about code, following exercises ...

But I need to type on every src block the session:

#+begin_src js :session "*JS REPL*"
console.log("calimero");
#+end_src

I tried to add, this at the begining of the file but not work:

#+PROPERTY: header-args:js :session "*JS REPL*"

or

#+PROPERTY: header-args:js :session *JS REPL*

or this after the line of the section title:

* my title
 :PROPERTIES:
 :header-args: :session *JS REPL*
 :END:

or

* my title
 :PROPERTIES:
 :header-args: :session "*JS REPL*"
 :END:

or even scaping the * "\JS REPL\*", but nothing works. I only get this error:

/private/var/folders/zs/t9wnzpqj2bdgjjgjwb8pqxc80000gn/T/babel-PdF5nq/js-script-46M5ix:1
require('sys').print(require('sys').inspect(function(){
               ^

TypeError: require(...).print is not a function

at Object.<anonymous> (/private/var/folders/zs/t9wnzpqj2bdgjjgjwb8pqxc80000gn/T/babel-PdF5nq/js-script-46M5ix:1:16)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11


texts: How to get back to ediff mode from edit mode

texts:
Bear with me as I am a neophyte to Emacs. I followed http://pragmaticemacs.com/emacs/visualise-and-copy-differences-between-files/ to fire up Ediff in Emacs.

It opened two buffers in two windows side-by-side.
I then used p and n to move to the hunks and used b to copy from B to A file.
I then used C-x o to move to the edited buffer and used C-x C-s to save it and then I am lost..

I want to go back to ediff-mode and want to use special keys p, n, etc. Now when I am trying to hit these keys it starts editing the buffers even the ediff help key ? is not working.

How can I get back to ediff-mode from this edit kind of mode?


texts:
I don't know what the formal name of it is (this being one of the reasons that I can't find how to achieve it). But, what I want is to make Emacs start the second bracket with the same amount of space that is used in the first one and when you press Enter to go in a new line, that line to start with the same amount of spaces if there is a bracket.

I am not looking for a weird customization (unless it is a last resort). I just am looking for a typical feature in most IDE, that I am sure you use if you write code in your Emacs.

What I want to achieve is this:

for(i=0;i<10;i++)
{
    if(i<5)
    {

        /* I want by pressing Enter the cursor to start in here
        so to write the print */
        print("Text")

    }
    /* I want this bracket to close automatically
    under the first one (of the if) and not in the beginning. */

}


texts:
I'm using ein to view and work with Jupyter Notebooks.

I'd like to be able to set the cell width to that of the window so that text wraps as little as possible.  In a browser this can be done with...

from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

..but since this isn't HTML and doesn't work under EIN in Emacs.

Nothing in the docs suggests a way of controlling this.

Any pointers to documentation on how to do this or suggestions would be very much appreciated.


texts: changing display function in define-word package

texts: How to replace the displayfn from message to a function which displays the result in a temporary window? (I have limited knowledge of elisp.)


texts: How to quickly jump to a directory in emacs?

texts: Say I have a project directory called "project". In the directory there are two directories "mini1" and "mini2". Suppose my active buffer is deep within a subdirectory in "mini1". Is there a way to make a C-f like binding where the pre-existing directory text is /project/mini2/ and not the deeply nested directory under mini1 that I'm in?


texts: How do I change permanently the encoding of a text file?

texts:
I have a bunch of html files encoded as iso-8859-1-unix and a few encoded in utf-8-unix. What I want is to encode all of them in utf-8-unix.
I have already tried (I think they are the same command, actually):

C-x C-m f utf-8-unix
C-x RET f utf-8-unix

the modeline changes from 1 to U, but after I close the file and reopen it, the modeline shows 1 again. It seems that I cannot make the change permanent no matter what I try and I don't understand why.

Following the suggestions below, I have created a new file with this content

home

bio

research

software

contacts

C-h v buffer-file-coding-system returns this:

Its value is utf-8-unix
Local in buffer new.htm; global value is the same.

so it looks okay. I save, kill the buffer, reopen the file and C-h v buffer-file-coding-system returns this:

Its value is undecided-unix
Local in buffer new.htm; global value is utf-8-unix

I am really confused.

EDIT: thanks everybody for helping making this clear!


texts: package-selected-packages. What is it useful for?

texts:
What is the usefulness of setting

(setq
 package-selected-packages
 '(auctex                 ;
   jedi                   ;
   magit                  ;
etc))

Doesn't emacs set the user-installed packages in package-selected-packages?
What would we be doing if we override this variable?


texts: using display-frame-alist to force switch to buffer

texts: Could someone please explain how to use default-frame-alist  to make list-buffers switch to the resulting results buffer? list-buffers uses display-buffer so I am thinking that display-buffer-alist is the object I should be tweaking to ensure that the buffer "*Buffer List*" gets focus via switch-to-buffer.


texts: Can I return multi value in emacs org src code?

texts:
As follow code,can I get a list for other code block?

#+name: test
#+BEGIN_SRC python -n  :exports both
for i in range(5):
    return i
#+END_SRC

#+RESULTS: test
: 0


texts: No Such File or Directory, Global, Error with Company Mode

texts:
I'm currently following this guide to expanding my emacs configuration on my Mac OS X system.

However, every time I (save-buffer) with C-x C-s, I get the following error message:

apply: Searching for program: No such file or directory, global

I installed GNU Global from homebrew, and have included it in my emacs path (when I print out the PATH variable, I get this in my minibuffer:

/usr/bin:/bin:/usr/sbin:/sbin: ... /:/usr/local/Cellar/global/6.6.2_1

As you can see, I have the GNU Global installation where in the Cellar directory, and have included this directory in my emacs path.

I'm not sure what's causing the error, or even how to fix it. Is there anything I can print out to help debug this?


texts: How to use multiple frame (C-x 5 2) within only one (system's) window in GUI Emacs?

texts:
In console version of Emacs (emacs -nw), I can create frame with C-x 5 2 and use C-x 5 o to switch between them. This concept is just like "workspace" in Linux desktop, or "Mission Constrol" in macOS.

However, when I use C-x 5 2 under GUI Emacs, Emacs create a new (OS's window, not the window in Emacs) window. I don't like it.

How to make frame's behavior in GUI the same as in console?


texts: How to get error messages for org-preview-latex-fragment?

texts:
(This took a long time to research, so I'm answering my own question, hoping to save others some time)

Let's say I have a file like this:

one by two is $\froc1{2}$

When I run M-x org-preview-latex-fragment, all I get is a white square indicating that something went wrong and in the *Messages* buffer the line:

  Cannot find image file ‘/home/.../ltxpng/....png’

How can I view the error message?


texts: How can I add a section like in helm-find files to helm-mini

texts:
How can I get a section to helm-mini which just behaves if I invoke helm-find-files?

Adding helm-source-files-in-current-dir does almost what I want, but doesn't allow me to navigate to subdirectories (it rather opens then a dired buffer). Adding helm-source-findutils doesn't seem to have an effect (at least there is not a section added).

Here is a minimal .emacs file to show what I tried:

;; -*-Emacs-Lisp-*-
;; -*- coding:utf-8 -*-

(require 'package)

(package-initialize)

(setq inhibit-splash-screen 1)

(require 'helm)

(require 'recentf)

(helm-mode 1)
(recentf-mode 1)

(setq helm-mini-default-sources '(
                  ;helm-source-findutils
                  helm-source-files-in-current-dir
                  helm-source-recentf
                  ))


texts: How can I correct an "Invalid face" error?

texts:
Issuing M-x org-html-htmlize-generate-css gives the error

Invalid face: font-lock-string

What does this error mean and how can I correct it?

Issuing $ grep -r "font-lock-string[^-]" ~/.emacs.d/ returns

~/.emacs.d/elpa/solarized-theme-20160106.15/solarized.el: `(kite-string((,class (:inherit font-lock-string))))


texts: bookmarks file and multiple emacs instances

texts:
Creating bookmarks in different emacs instances leads to loss of bookmarks data. Is there an easy way to fix this?
Something like merge current bookmark data with bookmark data from bookmarks file, before saving a new bookmarks-file version, would be nice.

Step by step example to reproduce:

run two emacs instances at once via command line: emacs -Q & emacs -Q
on each instance open an existing bookmark (C-x r b)
on each instance create a new bookmark (C-x r m) with different locations. On one instance name the bookmark test1 on the other instance name it test2
close the emacs instance with bookmark test1
close the other emacs instance with bookmark test2
open a new emacs instance with: emacs -Q
get a list of all bookmarks with C-x r l, you will see that bookmark test1 is lost


texts: Changing org colour order with solarized theme

texts:
Using the solarized theme from
this repository, how can I change the
colour order of org headings?  I like the default order better
than those defined in the solarized package, but would like the colours
in low contrast versions.


texts:
Is there are right aligned text block in Org-mode, like #+begin_center #+end_center? I haven't been able to find any reference in the official docs. on the other hand, this page uses a construct #+begin_right #+end_right but this doesn't work for me in LaTeX and odt export (see my MWE below and its LaTeX export). Is this type of alignment supported in Org-mode? If it is, how can I set it? If not, would it be a large issue to implement this type of text alignment and exporters?

I'm using Org-mode version 9.1.2 with Emacs 25.3.1.

My MWE is:

#+TITLE: Test

* Heading 1

#+begin_right
This text is right-aligned.
#+end_right

My LaTeX export is (I've trimmed unnecessary packages and meta-data from the export):

% Created 2017-10-11 Wed 11:24
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\title{Test}

\begin{document}

\maketitle
\tableofcontents

\section{Heading 1}
\label{sec:orgd88bdfd}

\begin{right}
This text is right-aligned.
\end{right}
\end{document}

Edit(): As Simon Fromme suggested in the comments below, I've added my MWE and the output.


texts: How to properly set mbsync and gpg binaries path with mu4e?

texts:
I'm trying to sync my emails from emacs using mu4e but I get the following error message:

Process mu4e-test exited abnormally with code 127
/bin/bash: mbsync: command not found

If I set mbsync with its full path in my init.el file:
(setq mu4e-get-mail-command "/usr/local/bin/mbsync -a")

Then I get the following error:

sh: gpg: command not found
Skipping account, PassCmd produced no output

I also tried setting the gpg path with: (setq epg-gpg-program "/usr/local/bin/gpg") and appending the global path with (setq exec-path (append exec-path '("/usr/local/bin/"))) but none worked.
Any ideas?


texts: How do I set up font fallback in a robust way?

texts:
TL;DR: What's a simple way to reliably say: use Consolas as the default font, FreeMono for the characters unsupported by Consolas, and Symbola for characters unsupported by both?

Since my main programming font does not cover all the mathematical symbols I need, I initially set up font fallback as shown below:

(set-fontset-font t 'unicode (font-spec :name "FreeMono") nil 'append)
(set-fontset-font t 'unicode (font-spec :name "Symbola") nil 'append)

Unfortunately this also changed the font for some of the character that my main font supports, so I changed it to

(set-fontset-font t 'unicode (font-spec :name "Consolas") nil)
(set-fontset-font t 'unicode (font-spec :name "FreeMono") nil 'append)
(set-fontset-font t 'unicode (font-spec :name "Symbola") nil 'append)

If my understanding is correct, this should ensure that characters that Consolas cannot handle are handled by FreeMono, unless FreeMono doesn't have them, in which case they should be displayed using Symbola. It is also my understanding that t does the same as "fontset-default" above.

Unfortunately, there were still cases where the right font wasn't selected; I found that changing to

(set-fontset-font t 'unicode (font-spec :name "Consolas") nil)
(set-fontset-font t 'unicode (font-spec :name "FreeMono") nil 'append)
(set-fontset-font t 'unicode (font-spec :name "Symbola") nil 'append)
(set-fontset-font "fontset-startup" 'unicode (font-spec :name "Consolas") nil)
(set-fontset-font "fontset-startup" 'unicode (font-spec :name "FreeMono") nil 'append)
(set-fontset-font "fontset-startup" 'unicode (font-spec :name "Symbola") nil 'append)

worked better, but not always: changing the font size using

(set-face-attribute 'default nil :height some-size)

caused the fallbacks to be ignored, due to new fontsets being created.

My current solution is to do

(set-fontset-font fontset 'unicode (font-spec :name "Consolas") nil)
(set-fontset-font fontset 'unicode (font-spec :name "FreeMono") nil 'append)
(set-fontset-font fontset 'unicode (font-spec :name "Symbola") nil 'append)

on each fontset (fontset-list), after each font size change.

What's the proper way to set font fallback?

Note: for testing purposes, here are a few math characters: ℕ⧺×≠≥≤±¬∨∧∃∀λ⟿⟹⊥⊤⊢
References: Emacs manual on fontsets and on modifying fontsets


texts:
How can I express syntax rules like "[0-9/.:*+!_'?-] are valid symbol constituent, but not as the first char"?

Or "/ is a valid symbol constituent, but can only appear once and in the middle of a symbol".


texts: writing a magit function that specifies the repo

texts:
I would like to write helper functions in elisp for putting dotfiles under version control using YADM.
From their documentation I learned that I could call up the magit status buffer for the YADM directory like so:
(defun yadm-status ()
    (interactive)
    (magit-status "/yadm::"))

I would like to write a similar function which takes a file I'm visiting, adds it to this repo, and opens a magit-status buffer.
Perhaps calling magit-mode-setup after setting the a variable representing that repo?
My elisp is very basic and I don't know how to read the internals of magit.


texts: Confusion by the usage of indent-tabs-mode nil

texts:
I use (setq-default indent-tabs-mode nil) in my init file so to avoid using TABs but when I write some files (like C++ files) then it allows me to insert TABs if I am in an if-statement for example. Why is that happening?

Also I thought initially that (setq-default indent-tabs-mode nil) prevents the usage of TABs completely but I have seen in a lot of answers that it converts TABs to spaces. How is it doing that?


texts: Mirror with character replacement in yasnippet

texts:
I would like to do 2 things: first mirror a field and replace spaces with "-". If nothing is typed in the field, junto to the mirror. The code is:

 \begin{theorem}[$1]
 \label{thm-${1:$( ???? )}}
 $0
 \end{theorem}


texts: How to use 'interactive' arguments when calling the command from code

texts:
I have a command called test which simply takes an input from the user and echoes it back:

(defun test (input)
  (interactive "MInput: ")
  (message "%s" input))

I want to write another function which would call it. The following fails:

(defun test-forward ()
  (interactive)
  (test))

with this error

test-forward: Wrong number of arguments: (lambda (input) (interactive "MInput: ") (message "%s" input)), 0

This makes sense, since test takes one input. Making test's input &optional simply makes test-forward return nil without doing anything. What is the right way of doing this?


texts: TRAMP mode hangs while copy large file from remote to local via Ssh

texts:
Trying here to download (scp file from remote to local) that was considered large file, then Emacs tried to compact it, then got stuck.

Even used scp command to do it because copying via ssh got stuck too.

Now there are two goals here: one is repair file copy from remote to local via ssh or set it to do not compact large files for copy via scp on TRAMP mode, but copy it at normal size.

Any ideas?


texts: How should I test that autoloads work properly with package.el?

texts:
I've added some autoloads to PACKAGE with the ;;;###autoload cookie and I've run M-x update-directory-autoloads which generated PACKAGE-autoloads.el.  I have the following form in my init:

(package-initialize)

;; ...
;; some stuff that needs package.el to be initialized
;; ...

(use-package PACKAGE
  :init nil
  :load-path "~/path/to/PACKAGE"
  :defer t)

What can I use as the :init form to load the autoloads as package.el would?  I'm assuming package.el loads the autoloads for every directory in load-path upon activation and before each package is require'd, but perhaps this is in an incorrect assumption.  This excerpt from package.el is what leads me to believe this is so:

;; At activation time we will set up the load-path and the info path,
;; and we will load the package's autoloads.  If a package's
;; dependencies are not available, we will not activate that package.

;; Conceptually a package has multiple state transitions:
;;
;; * Download.  Fetching the package from ELPA.
;; * Install.  Untar the package, or write the .el file, into
;;   ~/.emacs.d/elpa/ directory.
;; * Autoload generation.
;; * Byte compile.  Currently this phase is done during install,
;;   but we may change this.
;; * Activate.  Evaluate the autoloads for the package to make it
;;   available to the user.
;; * Load.  Actually load the package and run some code from it.


texts:
I use alot the M-o i shortcut (which, according to the key description, runs the command facemenu-set-italic) to emphasize parts of my text. Over the years I have changed several computers (hence OSes and distributions) and I notice that depending on the overall configuration, this command wraps the selected text (... below) either in

\emph{...}

or in

{\em ...}

For several (more or less technical or trivial) reasons, I prefer \emph{...} to {\em ...}, but in my current configuration I get the latter. I tried to find where this is configured, but without any success. Any ideas?