texts:
I have installed the official Git documentation in Texinfo format on my computer and for Emacs. But when I try to search for something with I in the info buffer (C-h-i d m git) it  reports no indices. I'm new to Texinfo and is it because the official documentation doesn't include indexing facilities or because I didn't do something right? I need this feature because I find it quite useful. Here's how I build the official doc:

Install asciidoc and docbook2X.

$ sudo dnf install asciidoc docbook2X

Download the Git repository. These instructions assume that you want the latest, bleeding edge. Replace “master” with an appropriate tag like “v2.20.1”.

$ wget https://github.com/git/git/archive/master.tar.gz
$ tar xf master.tar.gz
$ cd git-master/Documentation

Build the info files.

$ make git.info gitman.info

Error: docbook2x-texi: command not found

SUBDIR ../
make[1]: 'GIT-VERSION-FILE' is up to date.
DB2TEXI user-manual.texi
/bin/sh: line 1: docbook2x-texi: command not found
make: *** [Makefile:413: user-manual.texi] Error 127

This is the docbook to texi converter from the docbook2X package (which has not been updated since 2007). For Red Hat and Fedora, the EPEL package repo provides docbook2X. However, the name of the script is changed because there is a newer docbook package. So, in the git source directory, edit the file "Documentation/Makefile" and change one line:

DOCBOOK2X_TEXI = db2x_docbook2texi

Install the info files into "~/.local/share/info".

$ mv git.info gitman.info ~/.local/share/info
$ cd ~/.local/share/info
$ install-info git.info dir
$ install-info gitman.info dir

Add "~/.local/share/info" to the variable "Info-additional-directory-list" to make the directory acessible to Emacs.

(add-to-list 'Info-additional-directory-list "~/.local/share/info")

Restart Emacs to initialize the info files.


texts:
Here is a simple file:

#+TAGS: math(m) music(u)

* Gödel :math:
* Bach :music:
* Gauss :math:
* Beethoven :music:
* Mozart :music:

Then I tried M-x org-tags-view

Match: +math

I expected that Gödel and Gauss will be printed, but instead I get an empty buffer that says:

Headlines with TAGS match: +math
Press ‘C-u r’ to search again with new search string

What's wrong?


texts: How to do remote compile on Windows from Linux

texts: How can I configure Emacs, such that I am able to compile files remotely on a Windows machine, while Emacs is running under Linux? I am using tramp via the smb method to edit files on the Windows machine, but I could not get remote compilation to work until now.


texts: Org-export: LaTeX--->PDF with multipage #+INCLUDE

texts:
I'm new to the #+INCLUDE command, and am using it to assemble a book of sheet music.

At the top of the file I've placed a #+LaTeX_HEADER to use the \fancyhdr package for footers for all the pages in the book. After a few pages of text introduction, I insert sheet music:

#+INCLUDE: "/home/me/music.ly" src lilypond :file output.eps

This does kind of work, but there are about 4 pages of outputted sheet music, and only the first ends up in the exported PDF. Additionally, there is this collision between the sheet music and the footer:

I wonder, on the one hand, if it's possible to get #+INCLUDE to include all of the pages of sheet music within the bounds of the margins of the page---and on the other hand if doing this with Org might be less sensible than directly using LaTeX or Lilypond-book. I'm struggling to get my head around it all, and would appreciate any voices of experience.


texts:
In Emacs, I show the newline convention used by emacs for the current file, by
M-x describe-variable, then buffer-file-coding-system. The result is utf8-mac.

Does mac, dos, unix after the hyphen mean the newline convention only? or do they also give information about other things, beside the newline convention?

Thanks.


texts: Is there a built-in or package solution for managing references in text files?

texts:
I'm currently writing up a design document and I want to include a number of references to external documents/URLs. I can manually add reference brackets and links so that:

See the external file blah.txt [1]
....
(at bottom of file)
References
==========
[1] http://example.com/blah.txt

However this is going to be prone to errors over the document as I add new references. Is there a built-in or 3rd party package to make adding and managing these references easier?


texts: how to make counsel-locate respect my cwd

texts:
Emacs has a concept of "current directory",
shown by doing

M-x pwd

I can change to specific directory by doing M-x cd

I recently installed swiper/counsel/ivy, to make searching easier.
Since the locate command is not that great on MacOS, I added this bit

(setq locate-command "mdfind")
(setq counsel-locate-cmd 'counsel-locate-cmd-mdfind)

My issue is this. Let's say I cd  to /folder1/, and then
I invoke M-x counsel-locate and start typing

id rsa

I am shown id_rsa.pub files from other folders, for example /folder2/id_rsa.pub. I was expecting counsel-locate to respect my "current directory" when doing its recursive search.

What am I doing wrong?


texts:
I recently installed Arch Linux on my new laptop. Shortly, afterwards, I also installed the X Window System and Emacs 24. I like the DejaVu Sans Mono font so I added it  to my .Xresources:

URxvt.font: xft:DejaVu Sans Mono:size=12
emacs.font: xft:DejaVu Sans Mono:size=12

The font works perfectly for my terminal emulator URxvt, however when I start emacs this message popped up:

$ emacs
     Font `xft:DejaVu Sans Mono:size=12` is not defined

Apparently Emacs was built with xft, as shown below:

$ ldd `which emacs` | grep libXft
     libXft.so.2 => /usr/lib/libXft.so.2 (0x00007f8498c37000)

How can the font not be defined in emacs?


texts: org-babel-load-file doesn't load entire file

texts:
In ~/.emacs.d/init.el I'm calling my annotated configurations file settings.org like so:

(require 'ob-tangle)
(org-babel-load-file
 (expand-file-name "~/.emacs.d/settings.org"))

This generates settings.el however for some reason the file only includes what corresponds to the first 100 lines of code.

Nothing in the section Keymappings is making its way into settings.el. What am I doing wrong?

Edit

It solely seems to be a problem with keybinding commands. I moved things around and add stuff to sections that work and none of this causes an issue. Yet keybinding definitions don't seem to work with org-babel.

Settings.el

Lines 86-100 EOF in settings.el

...
;; Headings
(setq foreground1 "#ea056d")
(setq foreground2 "#e0f200")
(setq foreground3 "#ea056d")
(set-face-attribute 'org-level-1 nil
                     :foreground foreground1
                     :height 1.3
                     :weight 'bold)
(set-face-attribute 'org-level-2 nil
                     :foreground foreground2
                     :slant 'italic)

(setq org-src-fontify-natively 1)

;(require 'org)

EOF

Settings.org

The corresponding section in settings.org is this:

...
Syntax highlighting in org code blocks
#+begin_src emacs-lisp
(setq org-src-fontify-natively 1)
#+end_src

Load org mode
#+begin_src emacs-lisp
;(require 'org)
#+end_src

* Keymappings
** Switching between windows
This defines easy window switching, similar to my vim setup.
#+begin_src emacs-lisp
(define-key evil-normal-state-map (kbd "C-h") 'evil-window-left)
(define-key evil-normal-state-map (kbd "C-j") 'evil-window-down)
(define-key evil-normal-state-map (kbd "C-k") 'evil-window-up)
(define-key evil-normal-state-map (kbd "C-l") 'evil-window-right)
#+end_src emacs-lisp
...


texts: "eval: Attempt to modify read-only object" when setcdr to magic-fallback-mode-alist

texts:
I try to replace html-mode with web-mode:

(ignore-errors (require 'web-mode))

(when (featurep 'web-mode)
  (mapc (lambda (spec)
           (when (eq (cdr spec) 'html-mode) (setcdr spec 'web-mode)))
        magic-fallback-mode-alist))

and get error:

progn: Attempt to modify read-only object: ("\\(?:<\\?xml[
]+[^>]*>\\)?[
]*<\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[
]*<\\)*\\(?:!DOCTYPE[
]+[^>]*>[
]*<[
]*\\(?:!--\\(?:[^-]\\|-[^-]\\)*-->[
]*<\\)*\\)?[Hh][Tt][Mm][Ll]" . html-mode)

How can I modify html-mode to web-mode?

We have in lisp/files.el:

(defvar magic-fallback-mode-alist
  (purecopy ... ))

in src/data.c:

DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
       doc: /* Set the cdr of CELL to be NEWCDR.  Returns NEWCDR.  */)
  (register Lisp_Object cell, Lisp_Object newcdr)
{
  CHECK_CONS (cell);
  CHECK_IMPURE (cell, XCONS (cell));
  XSETCDR (cell, newcdr);
  return newcdr;
}

in src/puresize.h:

/* Signal an error if OBJ is pure.  PTR is OBJ untagged.  */

#define puresize_h_CHECK_IMPURE(obj, ptr) \
  (PURE_P (ptr) ? pure_write_error (obj) : (void) 0)

INLINE void
CHECK_IMPURE (Lisp_Object obj, void *ptr)
{
  puresize_h_CHECK_IMPURE (obj, ptr);
}

From (info "(elisp) Pure Storage"):

  Pure storage is used for certain data in the preloaded
  standard Lisp files—data that should never change during actual use of
  Emacs.

Emacs have no a way to check if object is in pure storage from Elisp ((


texts: I'm new to org-mode. I'm liking it so far. The one growing pain that I have is missing Markdown-style block quotes: I would like to start a line with > to quote it. How would I go about writing an extension (or better yet, finding one already written!) that would let me use that syntax?


texts:
Is there a way to do ignore whole file names the same way as
'completion-ignored-extensions' ignores filename extensions?
For example, I would like to blacklist __pycache__/, so that if the default directory contains __init__.py and __pycache__/ (and these two are the only files whose names start with underscore), I can do C-x C-f _ TAB and get right to __init__.py as the only choice, without Emacs offering me __pycache__/ after me hitting TAB once more to reveal the second underscore.  Is this possible?


texts: GNUS - mark all articles in the thread as Unread

texts: I was searching through docs at https://www.gnu.org/software/emacs/manual/html_node/gnus/ but could not find the proper key sequence for this. What is the key sequence for this?


texts: How to keep cursor position after calling ediff-current-file?

texts:
I would like to use ediff-current-file to jump to some of my previous changes/edits.  However, when I type 'q' to quit ediff after calling ediff-current-file and navigation (using 'p'/'n'), the cursor always jumps to the change near the end of the file.

Is it possible to stay at the line I chosen during ediff?


texts: Fullscreen with no titlebar and no menubar in MS-Windows

texts:
Is there a way to easily switch to no-distractions writing environment in Emacs for MS-Windows?

I would prefer to have Emacs started without window titlebar and without menubar and have that without any complex patching or other intrusive system modifications.


texts:
My problem: With my Emacs 26.1 on my 10.13.6 Mac, I have a opened a third-party text file, and it turns out I have the wrong encoding set : the text is in French , and the accentuated characters are displayed incorrectly (thus "é" is displayed as a brown \216, "î" as a brown \224, etc).

What I tried : I tried

M-x revert-buffer-with-coding-system latin-1 and
M-x revert-buffer-with-coding-system utf-8 emacs
and nothing changed in the display.

I also tried (and failed) to guess the encoding : it must be an encoding in which "é" is the 216th character. Now é is U+00E9 in Unicode, which gives 233 in decimal. Also é is number 130 in extended ASCII.


texts: What is the mechanism by which org-export collates links for the summary?

texts:
I use org-export to generate my end of week email reports. One of the links I have in those reports is for mu4e searches. I have a helper function to translate them into something more useful:
;; Exporting
(defvar my-org-mu4e-index-links
  (rx
   (: (or "query:i:" "msgid:") (group-n 1 (one-or-more any))))
  "A regex to match mu4e links of the form:

    query:i:20170228171921.21602-1-ale+qemu@clearmind.me
")

(defun my-org-mu4e-export (path desc format)
  "Format mu4e links for export."
  (when (string-match my-org-mu4e-index-links path)
    (cond
     ((eq format 'html)
      (format "%s"
              "https://www.google.com/search?q="
              (match-string 1 path)
              desc))
     ((eq format 'jira)
      (format "[%s|%s%s]"
              desc
              "https://www.google.com/search?q="
              (match-string 1 path)))
     ((eq format 'ascii)
      (format "%s\nMessage-Id: <%s>" desc (match-string 1 path))))))

(use-package ox
  :config
  (org-link-set-parameters "mu4e" :export 'my-org-mu4e-export))

However what I really want is what happens with other links where the link text is surrounded by [] and the link is displayed at the bottom of the section. e.g.:
Task 1
======

  - posted message [about foo] to mailing list

[foo] Message-Id: <bar>

However I've not been able to work out where in the exporter transcoders and filters this is done. I assume I should be able to set some sort of parameter for mu4e style links to deal do this.
EDIT TO ADD
The overall export is slightly more complex as it involves parsing and filtering out lines that are no longer relevant. This is done by calling org-export-as with the following code block:
#+name: get-task-list-as-exported-text
#+begin_src emacs-lisp :exports code
  (defun my-filter-out-done-lines (s backend info)
    "Filter out lines ending in :done"
    (apply 'concat
           (--remove (s-matches? (rx ":done" (zero-or-more blank) eol) it)
                     (s-slice-at (rx bol "-") s))))

  ; headline _back-end _info
  (defun my-filter-out-old-completed-todos (s backend info)
    "Filter out DONE items if they where completed over a week ago."
    (let ((date (plist-get info :with-date))
          (todo (plist-get info :with-todo-keywords))
          (todo-type (org-element-property :todo-type s))
          (output s))
      ;; getting there
      (setq my-global-debug-var
            (add-to-list 'my-global-debug-var
                         (list :string s
                               :date date
                               :todo todo
                               :todo-type todo-type)))
      ;; strip ~~~\n lines
      (let ((start (string-match "~+\n" output)))
        (if start
            (concat (substring s 0 start)
                    (substring s (match-end 0)))
          output))))

  (org-export-define-derived-backend 'my-status-report 'ascii
    :options-alist
    '((:with-todo-keywords nil)
      (:num nil))
    :filters-alist
    '((:filter-plain-list . my-filter-out-done-lines)
      (:filter-headline . my-filter-out-old-completed-todos)))

  ;; Snarf the weeks activities
  (save-excursion
    (goto-char (point-min))
    (when (re-search-forward "* Tasks")
      (goto-char (match-beginning 0))
      (org-export-as 'my-status-report t nil t )))
#+end_src


texts:
Following the advice given here, I  wrote the following code  to enclose the text selection in phpbb italics tags :

(defun wrap-in-phpbb-italics-tag (b e)
  "does what its name says."
  (interactive "r")
  (save-excursion
      (goto-char b)
      (insert (format "[i]"))
      (goto-char e)
      (insert (format "[/i]"))))

This code almost does  what I want : the left tag is positioned correctly but the right tag is three characters too early.
Thus, if the selected goes Adjust end index in selected region, the result will be [i]Adjust end index in selected reg[/i]ion.

I tried to fix it as follows, replacing the (e) with (e+3) :

(defun wrap-in-phpbb-italics-tag (b e)
  "does what its name says."
  (interactive "r")
  (save-excursion
      (goto-char b)
      (insert (format "[i]"))
      (goto-char (e+3))
      (insert (format "[/i]"))))

But with this new code, the right tag simply disappears. What is going on here ? How can I fix this ?


texts:
I use colorized output in ghci. And if run it:

in comint-mode, or in eshell, then colors displayed
fine, but a lot of escape sequences displayed like ^A^Bλ ^A^B> ^A^B^B.
in ansi-term, then I got much better result like λ > ^B.
in tmux in ansi-term it displayed perfect (like colored λ >) but except performance.

Why output speed reduced so significant in this case?

Not sure if this information may be helpful: emacs launched under tmux (surely, it in different tmuxsession, than that in ansi-term with ghci) in rxvt-unicode terminal emulator.

UPD: prompt example :set prompt "\001\ESC[33m\002λ \001\ESC[01;34m\002> \001\ESC[m\002\STX"


texts: org messes up indentation levels when including files

texts:
Consider the following setup:

$ cat contents.org
#+INCLUDE: preamble.org
#+INCLUDE: introduction.org
$ cat preamble.org
* Preamble
** subsection 1
** subsection 2
$ cat introduction.org
* Introduction
** Subsection 1
** Subsection 2

Now, if I convert this to LaTeX:

$ cat compile.el
(require 'org)
(require 'ox-latex)

;; Generate LaTeX
(with-current-buffer (find-file-noselect "contents.org")
   (org-latex-export-to-latex nil nil nil t))
$ emacs -Q --batch -l compile.el
Saving file /home/nikratio/tmp/org-bug/contents.tex...
Wrote /home/nikratio/tmp/org-bug/contents.tex

Then the output looks rather wrong - everything in the second file is treated at the wrong indentation level:

$ cat contents.tex
\section{Preamble}
\label{sec-1}
\subsection{subsection 1}
\label{sec-1-1}
\subsection{subsection 2}
\label{sec-1-2}
\subsubsection{Introduction}
\label{sec-1-2-1}
\begin{enumerate}
\item Subsection 1
\label{sec-1-2-1-1}
\item Subsection 2
\label{sec-1-2-1-2}
\end{enumerate}

What am I doing wrong? I'd like to have the following output (ommitting the labels for brevity):

\section{Preamble}
\subsection{subsection 1}
\subsection{subsection 2}
\section{Introduction}
\subsection{subsection 1}
\subsection{subsection 2}

This is with org 8.3.4.


texts: Automatically reply to input-requests in compilation buffer

texts:
My situation is this: I compile by invoking a system that runs perl scripts that invoke the Visual Studio compiler, as well as running some pre-compile tasks. By and large, the system works fine.

The problem comes when something in the pre-compile step fails. There's an error, but the compilation scripts expect input (since this would've normally been run in an interactive terminal). I usually just fix the problem and hit compile again, which kills off the previous process without issue. This isn't great, though, since I don't get any notifications that the compilation has 'finished', so sometimes I don't notice that I need to restart it. (I could stare at the compilation until it finishes, but that would get on my nerves really fast.)

So I guess what would be ideal would be to parse the compilation buffer until I see "Press a key to continue" and then send some sort of input that would finish the compilation and get my compile-finished-hooks to run. I've written compilation error regexps, but is it possible to cause a matched line to call a function? Or perhaps, since the output stops, I can use that as some sort of signal?


texts: Keyboard map in X version of Emacs not respecting system map

texts:
When I use emacs -nw in the terminal, it respects my keyboard map, but when I use the X version, I get a completely different map.  I would expect that my X keyboard mapping would be respected as it is in all my other Linux installations.
I'm at a loss as I've never encountered this problem before.  It's probably a simple reason, but the usual searches are bringing up nothing.  Is there a setting that I have overlooked that needs to be made?
TIA


texts:
I get this message when I try to resize the neotree window using my mouse:

  No resizable window on the left of this one

Does anyone know how I can make the neotree window re-sizable?


texts: Macro expansion inside quail-define-rules

texts:
Why can't I expand a macro inside (quail-define-rules)?

(defmacro quail-test ()
    `("c" ["success!"]))

(quail-define-package "experiment" "Experiment" "X" t
                                            "Just an experiment."
                                            nil t t nil nil nil nil nil nil nil t)
(quail-define-rules
 ("a" ?!)
 ("b" ["circus"])
 (quail-test))


texts: Org-Mode: How to create an "org mode markup" keybinding?

texts:
I know I can use *bold*, /italic/, _underline_, =verbatim=, ~code~, and +strike-through+ to apply markup to text in org-mode. But how do I create key bindings for applying these changes to a region of text? For example, if I want to make some text bold, is there an easier way than

navigating to the front of the text
prefixing it with a *
navigating to the end of the text
appending a *?

I can't seem to find any command that "bolds" a stretch of text, such as org-make-region-bold. Is there such a command?


texts:
I'm trying to get Norwegian spell checking working in Emacs, and I'm having trouble with the Norwegian dictionary.

System

Ubuntu 17.04
GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.31) of 2017-02-05 (installed with Nix)
Also tried with GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-03-29, modified by Debian (installed with Apt-get)
Spacemacs v.0.200.9

I use the Spacemacs layer spell-checking for spell checking. This "just works" for text in English.

Things I've tried

Activate the Spacemacs layer spell-checking. Spell checking English text now "just works".
I M-x ispell-change-dictionary and pick norsk from the menu suggestions. This shows up in *Messages*:

Local Ispell dictionary set to norsk
Starting new Ispell process /usr/bin/aspell with norsk dictionary...
Error in post-command-hook (flyspell-post-command-hook): (error "Error: The file \"/usr/lib/aspell/norsk\" can not be opened for reading.")

I check the folder, finding filenames not matching:

$ ls /usr/lib/aspell | grep no
no.dat
no.multi
no_phonet.dat
norwegian.alias

The documentation for the ispell minor mode recommends installing Ispell. I install the Norwegian ispell dictionary, same error as above.
Another answer recommends installing hunspell. I install the Norwegian hunspell dictionary, same error as above.
I also installed the Norwegian aspell dictionary. Same error as above.

Any suggestions? Any relevant information I can provide?


texts:
macs -nw fails to color code certain declarations of pointer arrays seemingly depending on the structure being pointed to. For example: SomeStruct *one[4] is all white (I have dark background), but OtherStruct *two[4] has the correct color scheme (green type, yellow name). (note SomeStruct one[4] has correct color scheme)

Both structures are defined and included from the same file, and everything compiles and runs as expected, but the coloring is just inconsistent, which is really annoying from a UI perspective for someone with OCD :)


texts: How to quiet "Starting new Ispell process" on opening every file?

texts:
Using  flyspell by default is handy, but the message on every file gets annoying (especially since it doesnt go away).

eg:

Starting new Ispell process /usr/bin/aspell with american dictionary...

Is there a way to disable this, or at least clear the message? I checked ispell.el and there wasn't an obvious way.


texts: How to exclude or remove certain modes from major mode?

texts:
I tried to use column-enforce-mode but I don't want it on web-mode I tried to disable it but without success.

(global-column-enforce-mode t)
(remove-hook 'web-mode 'column-enforce-mode nil)

The code above doesn't work. What is the proper way on doing it?


texts: Occasionally, defcustoms change their :type and I fail to update my customizations. How can I get Emacs to list all the variables where customize things there's a type mismatch?


texts: Company not active in shell/SQL, but it's says otherwise

texts:
I use company-dabbrev as backend (source: How add company-dabbrev to the Company completion popup?).

When I open sql-mysql, after filling my credentials, I type show databases; one of the databases is information_schema displayed in the buffer.

When I type informatio in the buffer, there is no completion from Company. When I do C-h v company-backends, I see the following:

(company-wsd-mode
(company-edbi :with company-yasnippet)
(company-bbdb :with company-yasnippet)
(company-nxml :with company-yasnippet)
(company-css :with company-yasnippet)
(company-eclim :with company-yasnippet)
(company-semantic :with company-yasnippet)
(company-clang :with company-yasnippet)
(company-xcode :with company-yasnippet)
(company-cmake :with company-yasnippet)
(company-capf :with company-yasnippet)
(company-files :with company-yasnippet)
(company-dabbrev-code company-gtags company-etags company-keywords :with company-yasnippet)
(company-oddmuse :with company-yasnippet)
(company-dabbrev :with company-yasnippet)
(company-yasnippet :with company-yasnippet)
(company-etags :with company-yasnippet)
(company-gtags :with company-yasnippet)
(company-sql :with company-yasnippet))

So Company-dabbrev is listed in the output. But why is there no completion for information-schema in SQL interactive mode buffer, while  company-mode is active as minor mode in same buffer and company-dabbrev is listed as backend?


texts: My reasons for doing so are exactly like https://unix.stackexchange.com/questions/271550/how-can-i-search-for-bolded-or-underlined-text , but the accepted solution there is to use vim. I don't fancy that, especially when we can use man directly in emacs.


texts: fill-paragraph (`M-q`) for s-expressions?

texts:
With M-q (aka fill-paragraph), it is possible to format a single line of text nicely.

Is there a command or function which does a similar thing for lisps s-expressions?

It should break one-liner lisp expression where it is reasonable.
A command or function is searched.
I do not want a mode which is constantly formating the s-expressions.

Edit: Thanks to Drews comment I realized that fill-paragraph does not get called by M-q in paredit mode.


texts: Function to duplicate and mark duplicated text

texts:
In order to be able to chain the following command, I need the yanked text to be marked. That is because the end goal is to call (pop kill-ring) so that I can still use whatever was at the top of the kill-ring before duplicating.

I think all of that could be avoided if there was a way to duplicate region without using the kill-ring.

(defun me/duplicate-downward (begin end)
  (interactive "r")
  (kill-region begin end)
  (yank)
  (let (deactivate-mark)
    (push-mark)
    (yank)
    (setq mark-active t)))

Results

Region is correctly duplicated, but region isn't active.

Expected behavior

[] is region, | is point.

Before:

[Lorem
 ipsum]
|

After:

 Lorem
 ipsum
[Lorem
 ipsum]
|


texts: How to show the common part of company candidates?

texts:
Recently I have used company and I like it. But I feel prone to the mistake using the command company-complete-common. For example,
when I make company-mode enabled on emacs-lisp-mode,

I'm going to input the function "find-file". I typed "fin" one part of the function.
Many emacs-lisp functions "find-file","find-file--read-only",...,"finger" are included in company candidates.
Since the candidate popup often shows "find*" functions on display hiding the "finger" function, I execute company-complete-common by mistake. But the cursol is just moved down without completing common part.

So I want to know the common part before executing company-complete-common. Showing it like displaying continuing string with only one company candidate is ideal, I think. So is there the pacakge enabling it, or how to write the function to do so? I also want to know other ways to display the common part.


texts: How to disable the map from esc to meta?

texts:
I installed the oh-my-emacs configuration and try to use emacs in the terminal.

oh-my-emacs configuration enables evil-mode in default, and my problem is that, I found esc is mapped to meta, while the original command in my Mac is somehow disabled.. These kinds of remapping do not happen when I use emacs with oh-my-emacs configuration in GUI. So I basically have no idea why.

I really cannot get used to the map from esc to meta, even though esc can still be used to switch from input mode to command mode in evil. I just want to disable this mapping. Does anyone know how to do it?

By the way, I found I can use space+j to achieve the M-x, so I am not worried that I can not use command in Mac to invoke M-x command. But basically why the command does not work in terminal environment?


texts:
I am trying to setup org-mac-iCal See https://orgmode.org/worg/org-contrib/org-mac-iCal.html.

Nothing happens when Emacs loads. Even when I run the specific function org-mac-iCal, nothing happens still.

My configuration:

#+BEGIN_SRC emacs-lisp
(require 'org)
(require 'org-mac-iCal)
(add-to-list 'org-modules 'org-mac-iCal)
#+END_SRC

#+BEGIN_SRC emacs-lisp
(setq org-agenda-include-diary t)
#+END_SRC

#+BEGIN_SRC emacs-lisp
(setq org-agenda-custom-commands
      '(("I" "Import diary from iCal" agenda ""
         ((org-agenda-mode-hook
           (lambda ()
             (org-mac-iCal)))))))
#+END_SRC

The diary file remains empty. Incidentally, if the diary does not exist, this complains about that, but that's not really an issue.

My iCalendar has many calendars. They are all checked, per the documentation in the link above.

UPDATE: This package might be just too old?


texts: How safe is "with-silent-modifications" to mask (hide) strings before and after buffer modification?

texts:
In my LaTeX code I want to replace one-line eqnarray environments with the equation environment. To do that I need to "count" the new-line (\\) strings in a region and I also need to ignore some new-line strings that may occur in some math sub-enviroments like array, matrix etc.

If I have, e.g.:

\begin{eqnarray}
x+y&=& 1
\begin{array}{ccc}
a & b & c\\
d & e & f\\
\end{array}
\end{eqnarray}

I need to ignore the \\ strings inside the array environment.

To do that I can, temporarily replace these strings with arbitrary strings but I have the downside of the reappearing of them (the arbitrary strings) when i undo some changes.

So I tried to use the with-silent-modification macro:

(defun latex-one-line-eqnarray-to-equation ()
  (interactive)
    (save-excursion
      (let* ((a (copy-marker (point-min)))
             (z (copy-marker (point-max))))

    (goto-char a)
    (unwind-protect
        (while (search-forward-regexp "\\\\begin{eqnarray}" nil t)
          (save-excursion
            (let ((b (copy-marker (match-beginning 0)))
                  (e (copy-marker (search-forward-regexp
                                   "\\\\end{eqnarray}" nil t))))

              ;; *LaTeX sub environment line break occultation:*
              (save-restriction
                (narrow-to-region b e)
                (goto-char b)
                (while (search-forward-regexp "\\\\begin{array}" nil t)
                  (save-excursion
                    (let ((i (copy-marker (match-beginning 0)))
                          (f (copy-marker (search-forward-regexp
                                           "\\\\end{array}" nil t))))

                      (with-silent-modifications
                        (perform-replace "\\\\" "❤❤" nil nil nil 1 nil i f)))))

                (when (= 0 (how-many "\\\\\\\\" b e))
                  (perform-replace "{eqnarray}"
                                   "{equation}" t nil nil 1 nil b e))))))

      ;; *UNWINDFORMS*
      (with-silent-modifications
        (perform-replace "❤❤" "\\\\" nil nil nil 1 nil a z))))))

In this case the trick seems to work because I (temporarily) replace my target string with one of the same length (\\ with ❤❤).

Is it a coincidence? Is it safe to operate this way?

Note. I'd prefer to use some "tex property" to hide my target string to the how-many function but I've not been able to find the way to do it.

Note 2. I red the with-silent-modifications docstring:

  If BODY performs real modifications to the buffer’s text, other
  than cosmetic ones, undo data may become corrupted.


texts: I would like to have a function to add an event to my google calendar, and I don't want to sync or download the calendar.  What's the most simple solution to that?


texts:
I'd like to use the key binding M-n p for ess-swv-purl in .Rmd documents and thus tried (define-key global-set-key (kbd "M-n p") 'ess-swv-purl). If I'm in an .Rmd (Rmarkdown) document, M-n p still shows (M-n p is undefined).

I understand that global key settings are overwritten in many ways, but if the key combination is not bound, where is the problem? (I can execute the function with M-x ess-swv-purl). In case this helps, C-h b shows that M-n is a "Prefix Command" under poly-markdown+r-mode. I tried something like (define-key poly-markdown+r-mode-map (kbd "M-n p") 'ess-swv-purl) (which was just a guess, I don't know what should come after define-key in this case) but then get

Warning (initialization): An error occurred while loading ‘/Users/<user>/.emacs’:
Symbol's value as variable is void: poly-markdown+r-mode-map


texts:
Running plain Emacs with emacs -Q then running ansi-term, if I input some long text in the prompt such that the text breaks into the next line (without hitting Return), then I hit C-x 2 to create another frame, for some reason the prompt is half repeated.

Is there a way to fix this?

In my actual setup, I use zsh with a multiline prompt, so that everytime I invoke a command that creates a temporary frame, like helm-mini, the prompt is repeated creating a mess out of my terminal.


texts: How to restore Emacs after testing the bug on clean Emacs?

texts:
I want to submit an evil bug report as described in
https://github.com/emacs-evil/evil/blob/master/CONTRIBUTING.md#bug-reports

  Test the bug in a clean Emacs environment without any additional packages loaded (besides Evil itself). You can easily get such an
  environment by executing either make emacs (for X) or make terminal
  (for terminal mode) in Evil's source directory. If your bug is related
  to some other package, try to load only this package from the clean
  environment after using M-x package-initialize first.

After testing the bug on clean Emacs as described in step 2, what is the procedure for restoring Emacs to how it was before the test?

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


texts: how to debug constant freezing with emacs org-mode on windows?

texts:
I use org-mode with emacs heavily. On LINUX, everything is great.

When I have to use windows emacs regularly freezes and I have to kill via task manager and restart.

Any suggestions on how I can debug this? Or better yet how to stop it?

Thanks.


texts: emacs 25: display-buffer-other-window behavior change, how to tune for the old way?

texts:
I have a number of macros for browsing source code for many emacs versions.  I wrote this in 2009 and it's been solid until upgrading to U18.04.  I know it worked in U16.04:

(defun get-file-from-buffer-other-window ()
  "Load a file into another window referenced by the string on the current line"
  (interactive)

  ;; get the filename and lineno
  (setq vals (get-fileline))
  (print vals)

  ;; load the filename into the next window and goto linenumber
  (switch-to-buffer-other-window (find-file-noselect (nth 0 vals)))
  (goto-line (nth 1 vals))
)

I split a frame and have a file list in one window, select a file from the list, which loads it into a buffer and loads the buffer in the other window.  Two windows in the frame.

In the new version 25.2.2, the default behavior changed.  Now selecting a file opens a NEW window in the frame. Look at five files (key bind to f8) and five new windows are created. I traced the issue to the windows.el display-buffer macro. There is a tuning action named display-buffer-base-action. I try changing the behavior, specifically to display-buffer-reuse-window but cannot get it to recreate the behavior emacs has defaulted since I wrote it in 2009.  WTF?

Any ideas?  I'm sure it is something to do with display-buffer-reuse-window and this documentation.
https://www.gnu.org/software/emacs/manual/html_node/elisp/Precedence-of-Action-Functions.html

Dave


texts: How to set major mode localleader keybinding to both `SPC m` and `comma` in Doom

texts: I want to be able to use both SPC m and , as major mode localleader keybinding in Doom. With my current Doom setup, I can only use , as localleader key. SPC m is undefined currently.


texts: I am using company-mode for completion purposes. But somehow, some package always draws in auto-complete as well, which collides with company-mode, since both offer a popup with completion candidates. I want to blacklist auto-complete, since I do not need it. How can I do that? I know there is a variable package-pinned-package, but I cannot see how to blacklist a package — maybe by using an invalid archive?


texts: I am using paredit. It terminates ( and [ and " fine, but does not close the { in any modes. How can i configure it to do this too? I have emacs24.


texts: Tag search in org mode delivers empty list although searched Tag exists

texts:
I have an .org file and some headlines have the tag Contact attached to them yet searching for tags (C-c a m) and entering Contact delivers nothing (see attached screenshot). What do I do wrong?
Thanks for your help.


texts:
Playing around with some uuid generation code, I found this

(defun get-random-uuid ()
    (interactive)
    (with-temp-buffer
      (call-process "uuidgen" nil t nil)
      (buffer-substring-no-properties 1 (line-end-position 0))))

i.e.,

"732e8146-8fc3-4325-a99c-1699817790c7"

It works, but it outputs the uuid as a string. I just want it to be plain. This outputs without quotes, but seems to generate a number first, then the uuid

(defun new-insert-random-uuid ()
  (interactive)
  (shell-command "uuidgen" t))

i.e.,

ELISP> (new-insert-random-uuid)
201 (#o311, #xc9)
ELISP> b413aed2-0da3-45fd-95f8-699b94d152fb

How would I get it without quotes and without the initial number generated?


texts: How to check whether an optional param was input?

texts:
I have a command with an optional argument whose value is a number.
I need:

If no input argument then use default value (1000) else use input arg.

(random t)
(defun insert-random-number-at-point(&optional to)
  "Insert at point a random number (default from 0 to 1000)."
  (interactive "nInsert at point a random number (default from 0 to 1000): ")
  (if (= (to) nil)
      (insert (number-to-string (random 1000))) ;; then use default value
    (insert (number-to-string to)))) ;; else

Start :

Insert at point a random number (default from 0 to 1000): 15

Error:

Symbol’s function definition is void: to


texts: Is there a way to make org-mode count repetitive tasks done certain hours past midnight as done in the previous day?

texts: A lot of times we sleep after 12 o'clock, and some of the tasks that are done before we sleep will be counted as being done in the second day, which causes the repetition schedule to be a bit messed up. This is especially annoying for org-habit, since it will then say there's a break in the middle of the habit chain and that you've actually done the task for the following day instead, which forces you to manually edit the timestamps in the affected tasks to get the counting right again. In the flashcard app Anki, there is an option to treat cards finished certain hours past midnight as still being finished in the last day. I wonder if a similar functionality is available/can be configured in org-mode?


texts: Is there a python tool for parsing org-mode tables?

texts:
I often use python scripts to parse information stored in many of my org tables. To get python to read these tables I have a script that exports specific tables from a specified org document to csv. I then use

csv.DictReader(open('/path/to/csv/table.csv'))

to parse the information with python.

It recently dawned on me that python could (more or less) read the org tables themselves with something like

csv.DictReader(open('/path/to/org/doc.org'), delimiter='|')

but this would require doc.org to consist solely of an org table. I'm curious if anyone has come across a tool for python that can search an org document for a specified table and parse the table as if it were a csv file. Does such a tool exist?


texts: helm-dash on windows and viewing docs inside emacs

texts:
I am trying to get helm-dash to work on Windows and I want to view the docsets in emacs. Here is what I did so far:

downloaded ZealPortable (I don't have admin rights)
downloaded some docs
pointed helm-dash-docsets-path to the docsets folder
activate at least one docset

when I now invoke helm-dash and search for a function, the docset opens in the default browser.
What I want is to view the docsets inside emacs. For that I can set the handy variable helm-dash-browser-func to eww.
Problem: eww is not able to resolve URLs to local files. At least for me. It interprets the c: in the path as the hostname.
Has anyone ever stumbled upon that issue? Is there a way to solve it? Perhaps a different browser than eww?

Btw.: I'm using spacemacs but that shouldn't make any difference, should it?


texts: Emacs: Org-mode: How calculate duration of specific task?

texts:
Windows 10 (64 bit), Emacs 25.1

Suppose I have one org mode file. In this file I have my tasks with it's duration. After all my tasks was finish I calculate all tasks duration. I use command:

org-table-recalculate

It's work fine.
See screenshot:

As you can see the all tasks duration = 22.16 hours.
OK!

But I also (sometime) need to calculate duration of specific task
(e.g. Task-1144)
Here screenshot:

As you can see the duration of task Task-1144 = 3.50 + 0.08 + 3.50 = 7.08 hours.

So the question is:
How in Emacs I can calculate duration of specific task?
Thanks.


texts: Add to a list that defcustom has not yet defined

texts:
We can avoid adding duplicate elements to a list variable by using add-to-list.

When setting a customizable variable (i.e. one that is or will be defined by defcustom) from our init file, we're encouraged to use custom-set-variables (or customize-set-variable) rather than setq, to ensure the variable's setter function is run. This also correctly handles cases where the variable hasn't been defined yet, by "remembering" it and setting the desired value once defcustom has defined the variable.

But if the customizable variable will hold a list, how should we add to it? I've been using this sort of thing:

(with-eval-after-load 'savehist
  (add-to-list 'savehist-additional-variables
               'evil-ex-history))

But I just read in the Elisp manual:

  Normally, well-designed Lisp programs should not use with-eval-after-load. If you need to examine and set the variables defined in another library (those meant for outside use), you can do it immediately—there is no need to wait until the library is loaded.

Is there another way to handle adding to a customizable list variable that may not have been defined yet? For that matter, even if it has been defined, is there a recommended way to use the custom setter function when dealing with a list variable?


texts: Load a large TAGS file from a remote host at a Windows machine

texts:
I run Emacs locally on my Windows machine, but edit everything remotely, via tramp & plink (PuTTY's implementation of ssh). This all works just fine, but, as I found out today, TAGS files for large projects do not work. It's not that these files are that large - 12 Mb, in my case, a few thousand .cpp files, but still.

If I load TAGS file with visit-tags-table remotely, with /plink:user@host:/home/user/project/TAGS path, my Emacs just hangs forever, eating 100% of one of the CPU cores. It does not happen for smaller files, these work just fine, but for larger ones in happened every time I tried.

If I load it remotely, but with pscp, /pscp:user@host:/home/user/project/TAGS, it just does not load, tags-apropos shows no tags loaded.

If I copy the TAGS file to my local machine, visit-tags-table load tags just fine, but when I use them, Emacs expects the files mentioned there to be where the TAGS file is, i.e. on my local machine. If I generate TAGS with relative paths, it would try to open c:/emacs/home/path/file.h, if I use --tag-relative=no when generating TAGS to obtain absolute paths, the path changes to c:/home/user/project/path/file.h.

Of these three fails the last one looks the most 'fixable' (for the first two I suspect some shady network configuration issues), but I have yet to find how to make a local TAGS file work for remote projects.

Dirty hacks like changing all paths in TAGS with sed from /home/... to /plink:user@host:/home/... don't work, I tried (Emacs just tries to open c:/plink!user@host!/home/... file in this case).

In this question someone offered rewriting a etags-file-of-tag function from etags.el - this looks promising, but that does not work for me either (either this is a wrong function, or I'm doing something very wrong: no matter how I change that one, it doesn't seem to affect anything). Unfortunately, I have a quite limited understanding of elisp and how Emacs works in general, so I am stuck at the moment.

I really want TAGS to work for this project, so any ideas or advice will be appreciated.


texts:
I am trying to switch from vim to evil mode and got very far. The last thing what is missing is debugging with "gdb". I want to be equally productive as with clewn in vim (this means source level debugging, not a bare command line interface). So I tried with gud-many-windows.

But with gud I experience lots of issues, which make it totally unusable for me. The most prominent is, that gud doesn't seem to follow jumps in other functions or other files. So if I step into function, the white indicator simply goes away. Manually invoking gud-refresh sometimes helps. But sometimes, the source also pops up in some other window then (e.g. the input/output window) or not at all. So I have to go some steps "in the dark" before gud-refresh helps again.

There are many people in the web experiencing similar problems, but there doesn't seem to be any solution (at least none, I could understand so far). In some forums it is stated, that debugging in emacs 24 is broken and I should go back to 23.

Another issue seems to be that it is totally unconfigurable. So making the input/output window disapear meant to literally copy 50 lines from the gud sources and modify them via defadvice ... What the heck?

I also tried realgud, but was not even able to invoke gdb with it. On 25.0.50 I had the same problems then with 24.

Best regards,
Kilian.


texts: Process Python not running on ob-ipython

texts:
I think I must be missing something silly. I am trying to use ob-ipython in my org-mode files.

When I press C-c C-c I get Process Python not running.

Do I need to startup some process or something before I can use the installation? I have followed the directions as best as I could and double checked my steps.


texts: Calling the calc stack from babel: displaying percentages

texts:
Calc supports displaying results as percentages with c %. How can I make babel return this?  I tried:

#+BEGIN_SRC calc
1
2
'/
'c%
#+END_SRC

But this just gives an error. I also tried with a space separating c and % as well several other variations. How can I input this command? These kinds of commands are fairly common in calc, so surely there is a way to input them from babel.


texts: How to prevent shr from making network connections

texts:
Recent versions of Emacs have a really good renderer for HTML written entirely in Elisp.  This renderer (shr) can be used for displaying HTML emails, documentation, etc.  However, it seems that shr retrieves remote resources referenced in HTML documents (e.g. images).  If the HTML is untrusted, as in the case of spam emails, this leads to a number of security and privacy concerns.

Question: How is it possible to prevent shr from accessing remote resources when rendering HTML?


texts:
I've come to rely a lot on projectile-toggle-between-implementation-and-test to jump between implementation and test when developing Clojure. However when I tried to use it in my Haskell projects it didn't work at all. I found that two things needed adjusting.

The project type was wrongly set to make. I fixed that by explicitly setting it to haskell-cabal in my .dir-locals.el:
((nil . ((projectile-project-type . haskell-cabal))))

Second, the test suffix, Spec, didn't match what I use so I put this in my config:
(with-eval-after-load 'haskell-mode
  (plist-put (alist-get 'haskell-cabal projectile-project-types)
             'test-suffix "Test"))

I'm not very experienced with configuring Emacs, so I'm wondering if this is a good way of doing it, or if there's a better way?


texts: init file -- How to customize user options?

texts:
One of the recommanded solution to customize user options in the init file is customize-save-variable. This command saves some code that initializes custom variables, at each startup of the editor.
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages '(sx ivy doom-themes)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )

Thus, it is rather obvious that customize-save-variable should be called interactively by the user. This command should not be invoked in the init file.
However, setq and setq-default can't set every customizable variable (see below).

C-h f customize-set-variable
If VARIABLE has a ‘custom-set’ property, that is used for setting VARIABLE, otherwise ‘set-default’ is used.

An alternative way should be to define all relevant settings (like those found in Customize) in a new theme.
N.B.: Maybe, I'm overreacting to this issue. However, I have the impression of having contradictory instructions to set customizable variables.
See Also

[ISSUE] use-package: Init file vs. Customize
[ISSUE] Another relevant comment

More about the issue
It is inconvenient to modify some settings in the init file because the Custom interface seems unavoidable. It's like mixing two different user interfaces to achieve the same goal, although in practice we must use these interfaces in parallel.
The expected result is to use a single interface in a transparent way. I am really surprised that no solution has been implemented since the issue has been around for a long time (~2002).
Question: How to configure user options without mixing code in the init file?


texts: Having clean-buffer-list skip buffers with server-buffer-clients?

texts:
I have Emacs run in daemon mode at system startup, and run emacsclient automatically when I login to X. I also recently started running midnight-mode, which regularly runs clean-buffer-list, which wants to kill the buffer showing my home folder since I rarely visit it. This is a problem because that buffer is associated with the emacsclient invocation, so killing it closes all my frames.

Is there a way to decouple emacsclient from that particular buffer? I have to run emacsclient on something in order for it to open a window, so I give it $HOME.

Alternatively, is there a way to get clean-buffer-list to look at server-buffer-clients and skip buffers with it set?


texts: If a hydra is opened, how do we check programmatically that it is actually open and displaying?


texts:
I'm very new to Emacs and Org mode, so I'm basically fumbling around. I'm getting an alarm bell ding whenever I type in an table in an *.org file.  A message says "invalid function: org-table-with-shrunk-field" in the echo area.

I get the error even with a simple example such as the following:

| A | B | C |
| a

When I type "a", I get the alarm.

I'm using Emacs 26.1 and Org mode version 9.2.

Here is the Debugger info:

Debugger entered--Lisp error: (invalid-function org-table-with-shrunk-field)
  org-table-with-shrunk-field(nil)
  org-self-insert-command(1)
  funcall-interactively(org-self-insert-command 1)
  call-interactively(org-self-insert-command nil nil)
  command-execute(org-self-insert-command)

Any idea what I can do about this?

I am using org-version 9.1.9 when I use -Q and 9.2 when I start it up as usual.

Also, when I commented out the following lines from my init file, I did not get the error. This isn't a solution, however, as I need a couple packages.

(setq package-archives '(("melpa" . "http://melpa.org/packages/")
             ("org" . "http://orgmode.org/elpa/")))
(package-initialize)


texts:
The term is used many times here
https://github.com/oystersauce8/elfeed/blob/master/elfeed-show.el

Googled it:
https://duckduckgo.com/?q=elisp%3A+what+are+enclosures+in+elisp&t=h_&ia=web
not much info actually.


texts: I am using a MacBookPro with macOS High Sierra 10.13.2 using Chrome as a browser. I cannot access elpa.gnu.org or www.gnu.org. As a result my emacs installation does not work anymore.


texts: How to return to the place of the last inserted character?

texts:
Assume that I open a file and start editing it (at least one character is inserted).
Assume that the cursor is at Place A when the last change to the file is done (i.e. the last character is inserted).
Then I take the cursor to another place in the same buffer (say place B).
During this, I don't insert anything, but perhaps I execute some commands.

Is it possible to return from the place B to the original place A?


texts: Building emacs without certain packages/components

texts:
I'm a longtime Emacs user, and I've decided to take the plunge and build it myself, because I can, and because maybe I'd like to choose a different graphical toolkit. By the by, is there any way, when compiling Emacs, to only compile certain portions?

As in, I know I'm never going to use the IRC client, the mail client, the two browsers, etc. So is there a way for me to build Emacs without those components that I don't need and will only be taking up binary space?


texts: How add specifc string(ex: TODO) along with a comment character for a specifc mode?

texts:
Based on specific mode, by using a keybinding I want to add a TODO string that is preceded by an unique comment character. For example, (org-mode is exception since ** does not stands for comment and TODO shouldn't followed by :)

python-mode: => # TODO:
for script-mode: => # TODO:
for latex mode: => % TODO:
for org-mode: => ** TODO

Basically comment character of the current mode on the buffer followed by TODO: .


texts: Org agenda using default face for some things (not caused by font-lock)

texts:
Org agenda is using the default face for some items, preventing customization. I've seen Org Agenda faces do not appear after applying themes, but font-lock is not enabled for my agenda buffer (the value of font-lock-mode is nil there). The items it's using default face for are:

Multi-day calendar events. For one-day or sub-day events, the face is set to org-agenda-calendar-event but where the event spans multiple days the entries of the form "(2/5): My Event" have the face text property set to nil.
Upcoming deadline warnings when org-agenda-skip-deadline-prewarning-if-scheduled is set to pre-scheduled. If I set this variable to nil, the warnings have face org-upcoming-deadline but if I set it to pre-scheduled any upcoming deadlines that do show (because the item is scheduled) have the face text property set to default (not nil).

I've tried moving my .emacs aside and starting emacs in default configuration and these items still have default face.

Is it possible to configure the appearance of these items?


texts: Include reveal.js presentation in publish process

texts:
I have the following folder structure:

~/org/notes/x.org with notes in org files
~/org/presentations/y.org with reveal.js presentations in org files
~/org/img/demo.png with static images used in notes and presentations

I now want to publish all of them to ~/public_html/. My spacemacs config contains the following configuration, which does not work:

(setq org-publish-project-alist
    '(
      ("org-presentations"
       :base-directory "~/org/presentations"
       :base-extension "org"
       :publishing-directory "~/public_html/presentations"
       :recursive t
       :auto-sitemap t
       :publishing-function org-reveal-export-to-html
       :with-sub-superscript nil
       :headline-levels 4             ; Just the default for this project.
       :auto-preamble t)

      ("org-notes"
       :base-directory "~/org/notes"
       :base-extension "org"
       :publishing-directory "~/public_html/notes"
       :recursive t
       :auto-sitemap t
       :publishing-function org-twbs-publish-to-html
       ;;:publishing-function org-publish
       :with-sub-superscript nil
       :headline-levels 4             ; Just the default for this project.
       :auto-preamble t)

      ("org-static"
       :base-directory "~/org/img/"
       :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
       :publishing-directory "~/public_html/img/"
       :recursive t
       :publishing-function org-publish-attachment)

      ("org" :components ("org-notes" "org-presentations" "org-static"))))

The presentations don't get published. Any idea for the correct publishing-function for reveal.js presentations?


texts: Adding package from non-standard ELPA Repository to Layer

texts:
So I have a package I would like to add from an ELPA repository different than MELPA. The repository is called "billpiel" and the link is http://billpiel.com/emacs-packages/. I would like to add the package sayid to a layer (specifically the clojure layer, though that is unimportant). How would I do this in spacemacs?

I've tried adding this line to the top of the layer file, to my user-init method and to the dot-spacemacs/layers method (I know, I shouldn't): (add-to-list 'configuration-layer--elpa-archives '("billpiel" . "http://billpiel.com/emacs-packages/")) and then installing the sayid package as an additional package but that didn't work.

Trying to add the package as (sayid :location "http://billpiel.com/emacs-packages/") also failed.

The package documentation is here: https://bpiel.github.io/sayid/. How can I add this package to a layer in a way that I can distribute the layer?


texts: Set a field in yasnippet to edit/modify rather than replace default contents

texts:
I'm curious if it's possible to define a yasnippet completion field with a default value specified to initially edit/modify the value rather than replace it.  For this elementary example:

${1:defaultValue}

On completion when the point is at the beginning of the field anything typed will replace the value.

foo → foo

Moving the point allows modification of the default value:

→foo → dfooefaultValue

(For those about to check, moving it back results in the former behavior):

→←foo → foo

I'm hoping to retain this observed behavior in general, but be able to change the behavior in an individual field.  So that this snippet (with some modification to the snippet definition of the second field) would yield the below behavior.

${1:thing} ${2:else}

ATabB → A Belse

This is just a minimal example.  It would make sense in this case to simply move the default value outside the field like ${1:thing} $2else), but doing so doesn't allow modification of that value during completion.

Once part of the contents of a field has been modified it is possible to modify from the beginning of that field.  I'm thinking this is the hack that is going to be necessary.

${1:defaultValue}

→ABksp←foo → foodefaultValue

The desired behavior would be

foo → foodefaultValue


texts:
I want a numbered list of instructions where one or more steps show commands to be typed in.   I use BEGIN_SRC blocks and when exported to LaTeX the numbering has started over.  Even using [@4] doesn't work

* Instructions
To do the thing
1. Wax on
2. Wax off
3. From the cmd line
#+BEGIN_SRC bash
$> cd foo
$> bar --out results.txt
#+END_SRC
4. Lather
5. Rinse
6. Repeat

How can I have the list stay  continously numbered?


texts:
I am using Emacs 25.1.1 on Windows 10 OS with auctex, and cdlatex minor mode.

Cdlatex has a very useful feature of command input, which is typing a shortcut followed by TAB. for instance:

When I type eqt TAB, it will input a whole latex equation environment and move the cursor into this environment.

my question:

Regarding the indentation of this environment input. It just doesn't respect the current indentation (like child, subchild, etc). I search around and there seems no information about this.

Is there any hot fix for this general environment input indentation thing?

Thanks a lot.


texts: Add operating system clipboard to kill ring

texts:
Often I find myself copying a code snippet into my operating system's clipboard from the internet.  Then, I take the following simple steps:

Switch to my Emacs window
Find the place where I want to paste the code
Use C-y (yank) to insert the copied text.

However, sometimes I find (to my great disappointment) that I unwittingly used some form of kill command (such as kill-word or kill-line) while I was on step 2.  In such cases, the copied text from the "clipboard" never makes it into the kill ring.

Is there a way to make sure that copied text from other applications always makes it into my kill ring?

I work in Linux most often, but I also use Emacs regularly on Windows and Mac OS X, so an OS-agnostic answer is preferred.


texts: Show only direct subheadings with todo states

texts:
is it possible to show only direct subheadings (children) of a subtree, that have any todo state?

I tried the function org-show-todo-tree which shows a list of all subheadings with a todo state no matter how deep they are nested.

And I tried the function org-show-children, which displays all the children, but also those with a DONE keyword.

But if I runt both functions in sequence one overrides the other. This means I either get only todos or only direct children, not only direct children that are todos.


texts: backspace and backarrow don't work properly in node.js repl in emacs term

texts:
I have opened a terminal using M-x ansi-term.  Everything else seems to work as expected.  However, when I use the node.js repl, or the mongdb repl, or any other interactive node program, backspace rewrites the whole line like this:
    $ node

  console> consol> conso> cons> con> co> c>

This also happens with interactive node js programs written with nodejs's 'readline' module.

I'm using the following versions on ubuntu:

$ node --version
v6.9.1
$ emacs --version
GNU Emacs 24.5.1

All other REPLs seem to work as expected. (bash, python, irb)

Any ideas?


texts: Why does the alt+enter combination only work sometimes in org mode?

texts:
I used to be able to use alt+enter to create new entries in org mode. EMACS suddenly stopped responding to the combination and started to return "M-kp-enter is undefined". How can I get it to work again?

Many thanks.

PS I'm using EMACS on Windows 8.


texts: How do I edit an XML file in Emacs with tag autocompletion from a known XSD schema?

texts:
I'd like to use Emacs for XML editing.

A long, long time ago I recall using pSGML to do that.

Now that I've returned to Emacs I'd like to have tag autocompletion and easy navigation in XML files. Unfortunately, pSGML has fallen into disrepair and I have to make do with nXML.


texts: Org-mode: how to collapse or merge contiguous clock time intervals

texts:
I use Org-mode in Emacs to keep track of time. I sometimes clock in and out of the same task back-to-back, leading to two contiguous clock time intervals, such as:

CLOCK: [2019-02-27 Wed 10:21]--[2019-02-27 Wed 10:24] =>  0:03
CLOCK: [2019-02-27 Wed 08:40]--[2019-02-27 Wed 10:21] =>  1:41

To reduce clutter and disk space, I would like to combine them into a single interval such as:

CLOCK: [2019-02-27 Wed 08:40]--[2019-02-27 Wed 10:24] =>  1:44

Can Org-mode automatically collapse or combine clock times together?

Update: this question refers to clocks under the same heading, and so is different and simpler than Merging clock logs together in org-mode, which merges clocks from sub-headings to the parent heading.


texts: Can I edit a commit message in Magit before the commit is started?

texts:
I tend to write the commit message as I go along and stage changes.

At the moment I use a scratch buffer for this, but it would be nicer if I could edit it in Magit from the start. Is this possible and if so how?

EDIT:
I should say that I am a little unusual when it comes to commit messages: I write the problem that the commit solves rather than what has changed.

e.g. "get_prop("1") raises exception" rather than "cast strings to integers in get_prop"

Personally I think this is much more sensible than saying what you've done (which is evident in the the commit already).

Consequently I have to write the commit message first.


texts: Docstrings don't automatically indent themselves in elpy-mode. How do I fix this?

texts:
This is an example function that shows that docstrings do not automatically indent.

def testing_docstring():
    """
docstring is not indented automatically!
Even after a newline.
"""
    body_is_indented_though
    return

Selecting a region inside the docstring and hitting tab won't work either. Only hitting tab on a single line will toggle the indent level. How can I set docstrings to automatically indent?


texts: Indenting specific environment deeper in AUCTeX

texts:
Is it possible to encourage AUCTeX to indent specific environment contents deeper than other environments? My specific case is getting the following indentation for chorus:

\begin{song}
\begin{verse}
  Normal 2-spaces indentation
\end{verse}
\begin{chorus}
      Would be great to have it indented
      deeper.
\end{chorus}
\end{song}

I tried playing with LaTeX-indent-environment-list. It works well to avoid indenation where inappropriate, the following

(add-to-list 'LaTeX-indent-environment-list '("song"  (lambda() 0)))

nicely disabled indentation inside song, but similar trick:.

 (add-to-list 'LaTeX-indent-environment-list
     '("chorus"  (lambda() (* 3 LaTeX-indent-level))))

ends up closing such environment incorrectly:

\begin{verse}
  Normal 2-spaces indentation
\end{verse}
\begin{chorus}
      Would be great to have it indented
      deeper.
      \end{chorus}

Is there any workaround?


texts: Limit the scope of bidirectional display to single line

texts:
I have set the variable bidi-paragraph-direction to nil in my init.el so that lines starting with (strong) Arabic letters are displayed from right to left, and lines with English are displayed from left to right.

It works fine except that I have to insert an empty line between lines with different directionality so that the next line won't be affected by the previous line directionality. I'm not sure if this is a bug or an expected behavior:

أبجد هوز
ABCD

*******************************************

أبجد هوز

ABCD

Is there a way to limit the scope of directionality to a single line? or redefine the number of lines in a single paragraph? (GTK+ is doing it right).


texts: what does the vertical bar "|" mean in sentence-end?

texts:
Reference to 12.1 The Regular Expression for sentence-end of Elisp introduction

It illustrate alternatives of sentence-end as

 \\($\\| \\|  \\)
        ^   ^^
       TAB  SPC

and explains:

  Two backslashes, ‘\\’, are required before the parentheses and
  vertical bars: the first backslash quotes the following backslash in
  Emacs; and the second indicates that the following character, the
  parenthesis or the vertical bar, is special.

But what does the vertical bar "|" mean?


texts: List-packages requiring me to select coding system

texts: Out of nowhere in the past couple days, running M-x list-packages has started requiring me to select a coding system because of Chinese(?) characters in the buffer. Selecting the default, utf-8, works just fine. How can I avoid needed to select a coding system when trying to update my packages?


texts: Unexpected behavior using SHIFT+arrows and CTRL+arrows on emacs (orgmode) + terminal + mosh + screen

texts:
I am connecting in a machine using a terminal, mosh and then screen. Then, in my orgmode file I can't use the shortcuts like SHIFT+up, SHIFT+left or CTRL+up etc. If I press that, it produces something like 2A instead the expected behavior. It leads onto accidental mistakes inserting undesired chars on a source code, for example.

I tried to insert the following lines into my .emacs config file but it did not work.

;; Fix SHIFT+arrows and CTRL+arrows on screen
(define-key input-decode-map "^[2A" [S-up])
(define-key input-decode-map "^[2B" [S-down])
(define-key input-decode-map "^[2C" [S-right])
(define-key input-decode-map "^[2D" [S-left])
(define-key input-decode-map "^[5A" [C-up])
(define-key input-decode-map "^[5B" [C-down])
(define-key input-decode-map "^[5C" [C-right])
(define-key input-decode-map "^[5D" [C-left]))

Any ideas? Thank you!


texts: Is there an equivalent of string-match for regexp?

texts:
I'd like to write something like this except to compare the region with a regexp.

(if (string-match (buffer-substring-no-properties (point) (mark))
                  "foo")
    (bar))

Is there an equivalent of string-match for regexp that I can use like this

(if (regexp-match (buffer-substring-no-properties (point) (mark))
                  "^[A-Z]")
    (bar))

so that it returns true if the selected region is "Apple" and nil if it's "apple"?


texts:
I have written code to customize the compile-command to use MSBuild.exe if a .vcxproj file is found in the current directory for c-mode files via a c-mode-common-hook. Since MSBuild is not in the path my code sets compile command so that it includes the full path and file name of MSBuild.exe. This is obtained from the Windows registry.

The final compile command is for example

"\"C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\amd64\\MSBuild.exe\" \"JAWSCore.vcxproj\" /p:Configuration=Debug"

The problem is that when I do a M-x compile I get the following error.

'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

Is there a way to resolve this issue or would I be better off modifying my code to simply add the directory containing MSBuild to the exec-path and then simply setting compile command to the following.

"MSBuild.exe JAWSCore.vcxproj /p:Configuration=Debug"


texts: How to fold a cell of table in org mode?

texts: In an org-mode table, I have a cell with a long line of text.  How do I fold that line/cell so that its column won't be too wide on the screen?


texts: How can I make C-g run both evil-force-normal-state and keyboard-quit?

texts:
With evil-mode, I found myself pressing escape very often, but it's a bit far to reach. Also, it seems semantic wise, keyboard-quit is similar to evil-force-normal-state, so I would like to use C-g for both of them with the following conditional logic that
Only when cursor is a buffer with evil-mode's insert state, then C-g should execute evil-force-normal-state, other it should execute its normal binding of keyboard-quit

I guess that there might be a sub-key-map for evil with insert state?

If you have ready example, I'd appreciate your sharing.

In the meantime, I'll check the possibility of customizing the key-binding with evil's input state. I'm studying this link now:

I tried the following, but it didn't work:

(evil-define-key 'insert evil-insert-state-map (kbd "C-g") 'evil-normal-state)

and

(evil-define-key 'insert evil-insert-state-map (kbd "C-g") 'evil-force-normal-state)

C-g still executes keyboard-quit

I found that I can use key-chord to execute evil-force-normal-state:

(key-chord-define evil-normal-state-map ",," 'evil-force-normal-state)
(key-chord-define evil-visual-state-map ",," 'evil-change-to-previous-state)
(key-chord-define evil-insert-state-map ",," 'evil-normal-state)
(key-chord-define evil-replace-state-map ",," 'evil-normal-state)

Thanks,


texts: emacsclient spending a lot of time resetting faces

texts:
When I launch emacsclient or make a new frame it spends ~2s in:

   - make-frame                                                   312  42%
    - frame-creation-function                                     311  42%
     - apply                                                      311  42%
      - #<compiled 0x3edba9>                                      311  42%
       - x-create-frame-with-faces                                311  42%
        - face-set-after-frame-default                            287  39%
         + face-spec-recalc                                       274  37%

I have 523 faces in frame-face-alist which explains why it's slow. But they all seem to be from packages I use regularly so I can't just get rid off them.

If I replace face-spec-recalc with an empty function, the new frame loads instantly so I'm pretty sure that's the culprit.

Is there anything I can do to make new frames load faster?

Maybe load faces lazily or cache them somewhere?

I'd be fine with a hack that meant that I had to restart emacs to pick up new faces.


texts: Saving searches in Customize Group in Emacs

texts: If I type M-x customize in Emacs I am taken to customize-group for the Emacs group. At the top of the screen is a search entry dialogue box where I would normally search for a given string. Is there a way of saving searches typed in this dialogue box?


texts: Run elisp when `async-shell-command` is done

texts:
I want to run some Elisp when my command executed by async-shell-command terminates.

How can I do this? Does it have completion hooks?


texts: What is the easiest way to search all useful files inside a single project?

texts:
What is the easiest way to search for a regexp throughout the contents all files in the current project, skipping files that are not useful?

Useless files are things like compiled files, imported libraries,
version-control files, etc.

I’m aware of rgrep, but it just searches everything. Is there a
package that searches ‘inteligently’ and knows about several
different programming languages, so I wouldn’t have to configure it
for each individual project?


texts: Is is possible to treat any symbol in the buffer as word when moving around?

texts:
When I move around specifically using M-f/b, I want to treat any symbol such as

", ', ., -, _, ?, !, *...

as one word, so M-f/b will move around them instead of skipping them and jump to the next/previous word.

Is there any variable builtin to do that? If no, how can I do that?


texts:
To sync (I mean to have forward and reverse search working) Emacs with Okular (https://okular.kde.org/) I usually use this command:
okular -geometry 983x1388+47--10 --unique file.pdf & emacs file.tex --eval '(server-start)'

Is there a way to sync Emacs if it's already open? I mean if I open a .tex file just with:
emacs file.tex

then compile my .tex file (e.g. with the tex-file function) and, only at this point open Okular and get it to be in sync with Emacs.


texts: prevent mu4e convert html email to text when replying email

texts:
If some people send emails to me, they use outlook or other modern email client, writing html email with image. When I reply these html emails, mu4e usually converted them into text content, it make other people uncomfortable. They complain to me why use this email client(mu4e).
I want to know if it has a way to keep email original format without changing it when replying emails using mu4e(maybe org mode can help, but I do not know).


texts: Change order of buffers in Helm buffers list?

texts:
When I run M-x helm-buffers-list it shows list of buffers in the order of their last visit.

Since I open quite  a few dired buffers, when helm-buffers-list is invoked, dired buffers are occupying lots of visible space.

How can i move all dired buffers to bottom and have other files at top?


texts: I am using gnus for reading my gmails. But almost always by checking the INBOX of my gnus and comparing to my actual gmail account, i have new (or old) mails which are not shown in gnus. Does anyone have an idea what could be the problem?


texts: open org mode link in a different browser to the default browser

texts: Is there a way in the org mode syntax to create a link and to define which browser to open the link in? I have some links that I want to open in a different browser than my default one.


texts: Using advice to run function before tag symbol lookup

texts:
I use xref-find-definition to look up the definition of a symbol name. When I call xref-find-definition, I want to Emacs to automatically find and load an appropriately named etags file. For this purpose, I have a function, open-tags-file:

(defadvice xref-find-definitions (before before-xref-find-definitions activate)
  (open-tags-file))

(defun open-tags-file ()
  (interactive)
  (if (booleanp tags-file-name)
    (when (file-exists-p "my_tag_file")
      (visit-tags-table "my_tag_file"))))
  )
)

This works fine when I run xref-find-definitions with the cursor already over an existing symbol name. It also works if I do not have the cursor over a symbol name -- Emacs will prompt me to enter a symbol name, such as "CreateFood". Either way, The tags file is automatically loaded, and then the symbol is looked up.

However, when Emacs prompts me to enter a symbol name, I want to be able to type a partial symbol name, such as "Cre", and then press Tab and have "CreateFood" be auto-completed. If I do that, Emacs will prompt me to load the tag file, and it will expect it to have the name TAGS. This means that my defadvice xref-find-definitions is not being run before Emacs prompts me to enter the symbol name, it is only run after that symbol name is entered.

Is there a way to run open-tags-file before the symbol name is entered, so that I can auto-complete "Cre" into "CreateFood" when entering the symbol name to find the definition of?


texts: How do you handle a key sequence inside a function?

texts:
I want to run a function and do different actions based on the next key sequence.

I have this.

(defun ask-for-C-b-or-M-b (key-sequence)
   (interactive "KPress Key")
   (cond
    ((seq-set-equal-p key-sequence
                      [?\C-b]) "C-b pressed")
    ((seq-set-equal-p key-sequence
                      [?\M-b]) "M-b pressed")))

 (call-interactively 'ask-for-C-b-or-M-b)

This works for C-b but not for M-b and I would like to use the kbd function

(kbd "C-b") instead of [?\C-b]
(kbd "M-b") instead of [?\M-b]

I'm trying to get extra keys in a hydra without making a new hydra

(defhydra hydra-test
   nil
   "test hydra"
   ("SPC" ask-for-C-b-or-M-b "Do complicated thing"))


texts: make magit check uncommited changes when opening a file

texts:
Sometimes I am interrupted while coding and forget to commit. I would like to be warned about this next time I open a file with uncommited changes.

I tried

(defun my/magit-check-file-and-popup (file)
  "If the file is version controlled with git and has uncommitted
changes, open the magit status popup."
  (require 'magit-core)
  (when (and file (magit-anything-modified-p t file))
    (magit-status)))

(add-hook 'after-load-functions 'my/magit-check-file-and-popup)

which worked for a while, but after recent package updates it goes into recursive require, so I guess it is not the right approach. Using Emacs 25.2.2 if that matters, and latest magit from MELPA.


texts: Is there an LSP setup that can autocomplete java libraries inside of a jython script? I have looked everywhere but naturally google thinks I meant "python" when I type "jython" and does not return very helpful results.


texts: How to override the :hook section of a use-package declaration

texts:
I am attempting to change the :hook section of a use-package declaration that I cannot directly modify. In my case, I want to remove hooks that are getting set, not just add more hooks. Is there a way to do this similar to how the :init and :config sections can be modified via use-package-inject-hooks?
Reference points:

The use-package library provides a use-package-inject-hooks variable that can be enabled in order to activate hooks for the :init and :config sections:
[use-package-inject-hooks]

If non-nil, add hooks to the `:init' and `:config' sections.
In particular, for a given package `foo', the following hooks
become available:

  `use-package--foo--pre-init-hook'
  `use-package--foo--post-init-hook'
  `use-package--foo--pre-config-hook'
  `use-package--foo--post-config-hook'

This way, you can add to these hooks before evaluation of a
`use-package` declaration, and exercise some control over what
happens.

NOTE: These hooks are run even if the user does not specify an
`:init' or `:config' block, and they will happen at the regular
time when initialization and configuration would have been
performed.

NOTE: If the `pre-init' hook return a nil value, that block's
user-supplied configuration is not evaluated, so be certain to
return t if you only wish to add behavior to what the user had
specified.

The :hook section provides an alternate interface for special-case usage of the :init section (see documentation):

The :hook keyword allows adding functions onto package hooks. Thus, all of the following are equivalent:
(use-package ace-jump-mode
  :hook prog-mode)

(use-package ace-jump-mode
  :hook (prog-mode . ace-jump-mode))

(use-package ace-jump-mode
  :commands ace-jump-mode
  :init
  (add-hook 'prog-mode-hook #'ace-jump-mode))

Given the above two points, I thought that maybe hooking into the :init section using use-package-inject-hooks would allow me to override the :hook section, but that was not the case. Looking at the source code for use-package, I can see that :hook and :init are implemented differently (:hook is not a special wrapper for :init) so I can see why that would not work.
Any advice would be much appreciated. (On that note... I suppose a clever use of the advice mechanism in Emacs could provide a workaround, which I hadn't considered until I wrote that last sentence. That said, I would like to avoid such a kludge if possible.)


texts:
I've read the Emacs documentation for align-regexp but still have difficulty in understanding how it works. What I'm talking about is its prefixed form C-uM-xalign-regexp, not the simple form M-xalign-regexp. Here are my questions:

Does the first parameter (the regex) have to match the whole line of string? What if the regex only matchs a part of the string?
What to supply to the second parameter (Parenthesis group to modify (justify if negative))? As I understand here I need to supply a captured group number (count from 1), right? Does "justify if negative" means, if I want group 3 to right aligned, I'll supply -3 as the input?
What does the third parameter "amount of spacing (or column if negative)" mean? I just totally don't understand what this parameter does.

I've collect some text examples to practice. If anyone can use below text as examples that will be very helpful.

From

class CreateStudents < ActiveRecord::Migration
  def change
    create_table :students, :comment => "学生信息表" do |t|
      t.string :political_status, :comment => "政治面貌"
      t.string :education_level, :comment => "培养层次"
      t.string :enroll_method, :comment => "入学方式"
      t.date :enrolled_at, :comment => "入学时间"
      t.string :charge_type, :comment => "收费类别"
      t.string :enrolled_year, :comment => "学籍年度"
      t.string :enrolled_place, :comment => "生源所在地"
      t.string :bank_card_number, :comment => "银行卡号"
      t.string :bank_account_number,  :comment => "银行账号"
      t.boolean :is_active_duty, :default => false, :comment => "是否现役军人"
      t.boolean :is_equivalent_degree, :default => false, :comment => "是否同等学历"
      t.boolean :is_on_record, :default => true, :comment => "是否在籍"
      t.boolean :is_at_school, :default => true, :comment => "是否在校"
      t.timestamps
    end
  end
end

To

class CreateStudents < ActiveRecord::Migration
  def change
    create_table :students, :comment => "学生信息表" do |t|
      t.string  :political_status,     :comment => "政治面貌"
      t.string  :education_level,      :comment => "培养层次"
      t.string  :enroll_method,        :comment => "入学方式"
      t.date    :enrolled_at,          :comment => "入学时间"
      t.string  :charge_type,          :comment => "收费类别"
      t.string  :enrolled_year,        :comment => "学籍年度"
      t.string  :enrolled_place,       :comment => "生源所在地"
      t.string  :bank_card_number,     :comment => "银行卡号"
      t.string  :bank_account_number,  :comment => "银行账号"
      t.boolean :is_active_duty,       :default => false,  :comment => "是否现役军人"
      t.boolean :is_equivalent_degree, :default => false,  :comment => "是否同等学历"
      t.boolean :is_on_record,         :default => true,   :comment => "是否在籍"
      t.boolean :is_at_school,         :default => true,   :comment => "是否在校"
      t.timestamps
    end
  end
end

From

my @primes = (
    1,2,3,5,7,
    11,13,17,19,23,
    29,31,37,41,43,
);

To

my @primes = (
    1,  2,  3,  5,  7,
    11, 13, 17, 19, 23,
    29, 31, 37, 41, 43,
);


texts: How to use web-mode engine-specific checkers in flycheck?

texts:
Flycheck seems to enable checkers based on the major mode.  Meanwhile, web-mode can be used to edit a variety of different types of files (html, javascript, etc.) which would each have their own distinct set of checker(s) that make sense to use.

For example, I've just enabled linting of my jsx files using the javascript-eslint checker, but now when I open an html file (in web-mode) flycheck tries to lint that using javascript-eslint, which fails miserably, of course, since the file is html, not javascript.

Is there any other way to tell flycheck which checker to use other than by the major mode?  Is there a way to tell flycheck to enable checkers for a given mode but only if some predicate passes, for example?

There's an answer to this question that recommends completely disabling flycheck depending on the file type, but I don't want to do that since I'd like to lint my other web-mode files as well.


texts: string-rectangle command pollutes kill-ring after upgrade to Emacs 25

texts:
In Emacs 24 I used to have a workflow for inserting a string into multiple lines at once:

Go to the desired position in the first line.
Press C-Space to place the mark.
Go to the last line (while remaning in the same column).
Press C-x r t for the string-rectangle command.
Input the desired string into the minibuffer by either

typing it
or pressing C-y (yank) to use the most recent kill.

Finally hit Enter.

After upgrading from Emacs 24 to 25, I found that step 5.2 inserts what I just selected in steps 1 to 3: pressing C-x r t behaves as if I had pressed M-w (kill-ring-save) as well. As a result, I have to press and extra M-y (yank-pop) in step 5.2.

Is there any way to prevent the selection from getting pushed onto the kill ring when invoking string-rectangle?

Please note that I use Xorg, so the X clipboard also affects Emacs's kill ring. Additionally, I have a clipboard manager running (Diodon) that synchronizes the X clipboard and the X primary selection (which is basically the last text selected using the mouse). So the selection may end up on top of the kill ring through either the X clipboard or the X primary selection. Nonetheless, this didn't use to happen in Emacs 24 and I would not like it to happen in Emacs 25 either.


texts: How to create a file from a template if it does not exist or open existing copy?

texts:
Trying to make a function that I can call to create a file from a template or open an existing file. Current attempt is as follows:

(defun journal-entry ()
  (interactive)
  (let ((daily-name (format-time-string "%Y-%m-%d)"))
        (journal-path "~/Dropbox (Personal)/journal/"))
    (find-file (concat journal-path daily-name ".md"))
    (insert "JOURNAL" "\n" daily-name)))

Problem with this is that every time I call it. The ( insert ) content gets re added


texts: Spell checking and hunspell on windows (preferably from scratch)

texts:
I really need to get spellchecker on emacs (there are few who don't), and hunspell seems like the best option. The other options (aspell and ispell) are said to be ancient and also require a fair amount of configuration, so I figure there is no benefit to using those. Most instructions tell you to get a 4-year old pre-compiled 32-bit hunspell binary from ezwinports, though I've heard that it no longer works (and may not even be compatible with 64 bit emacs). So I'd like to compile it from the newest source from scratch.

I already have compiled hunspell for windows 10 x64 using msys2, per instructions from  hunspell. All I have now is just the DLL and no dictionaries or executables. Does anyone know where to go from here to set up spell checking? I've seen the instructions on how to modify the .emacs file, but none seem tell you how to actually what a hunspell installation ought to look like. (and I don't see anything along the lines of "point Emacs to the .dll; then point emacs to the dictionaries directory).

p.s. does anyone know why this is so difficult? :)

-- thanks for bearing with me.


texts:
I'm using a rather stock Prelude emacs version with super-save disabled, but still whenever I change buffers using C-x o, whatever buffer I currently have focused writes to disk. I still want the auto-save to happen, but not the full write that triggers a bunch of rsync stuff.

Where do I find the command that writes the file to disk so I can throw a debugger in there to find the stacktrace?


texts: Prevent org-hide-emphasis-markers to modify headers

texts:
I am trying to set org-hide-emphasis-markers to t but when I do so the headers are messed up

With org-hide-emphasis-markers disabled

* A
** B
*** C
**** D

With org-hide-emphasis-markers enabled

* A
** B
* C    <- Bold asterisk
** D  <- Bold 2 asterisks

Am I missing something in the configuration?


texts:
I currently have a few latex templates stored in a folder. Then I copy and paste to create a new document. I want to streamline this process because, well, I am lazy and I like to play.

Preferably, my latex templates are stored in a single org file as BEGIN_LATEX blocks. And I want function(s) (create-latex-doc-from-template template-name) so that I can turn it into a org-mode link. When I click on the link, it'll create a new buffer with the specified template.

Since these templates are usually pretty big in size, I need proper syntax highlighting to edit them. So yasnippet doesn't work for me.

Any ideas on what I need for this? Thanks.


texts:
The day before yesterday, I have experienced my Ubuntu package ess (Version: 17.11-3bionic0) no more configuring properly during apt-get update.  I then tried apt-get install -d ess and:

dpkg -i /var/cache/apt/archives/ess_17.11-3bionic0_all.deb

I get:

Preparing to unpack .../ess_17.11-3bionic0_all.deb ...
Remove ess for emacs25
remove/ess: purging byte-compiled files for emacs25
Unpacking ess (17.11-3bionic0) over (17.11-3bionic0) ...
Setting up ess (17.11-3bionic0) ...
Install emacsen-common for emacs25
emacsen-common: Handling install of emacsen flavor emacs25
Install ess for emacs25
install/ess: Handling install for emacsen flavor emacs25
ERROR: install script from ess package failed
dpkg: error processing package ess (--install):
installed ess package post-installation script subprocess returned error exit status 1
Processing triggers for install-info (6.5.0.dfsg.1-2) ...
Errors were encountered while processing:
 ess

I am using Ubuntu 18.04 with GNU Emacs 25.2.2.

Looking in the emacs package manager, it says:

  ess                17.11         incompat   melpa-s... Emacs Speaks Statistics

So, it seems that the package from melpa is uninstallable because of being incompatible with my current Ubuntu emacs version, and the Ubuntu package of the same version can neither be installed.

I have tried this solution from Ubuntu SX but it didn't work for me.

What else can I do now?

Thank you for your help.


texts: How to use the Insert key to toggle `overwrite-mode` when using a PC keyboard in OS X?

texts:
By default, when using a PC keyboard attached to a Mac, OS X treats presses of the  Insert key as presses of the Help key that appears on the extended Mac keyboard.

How do I map that keypress to have the same result in GNU Emacs that it does when running in, say, Windows or Linux: toggling overwrite-mode on and off?  (https://www.gnu.org/software/emacs/manual/html_node/efaq/Overwrite-mode.html)

In a GUI window, Emacs treats Insert presses as Help key presses and shows the help, which is logical.  Googling, I can't find anywhere that discusses remapping the Help key.

In OS X's Terminal.app, as far as I can tell, the key presses aren't passed to the terminal itself at all.  At a Bash prompt, Ctrl-v Insert results in no output.  Pressing another key behaves as if typing Ctrl-v <key> with no intervening press of Insert.

EDIT: I've gotten closer.  I think.

I used Karabiner [1] to map Insert to something more useful than Help, since Terminal.app doesn't see Help.  I picked F13.

[1] pqrs.org/osx/karabiner/

<item>
    <name>Map Insert to F13</name>
    <identifier>private.map_insert_to_f13</identifier>
    <autogen>__KeyToKey__ KeyCode::PC_INSERT, KeyCode::F13</autogen>
</item>

Ctrl+v Insert in Bash then shows ^[[25~.

Taking inspiration from http://www.emacswiki.org/emacs/LinuxConsoleKeys I added the following to my .emacs:

(define-key input-decode-map "\e[25~" [(f13)])
(define-key key-translation-map (kbd "<f13>") (kbd "<Insert>"))

Now pressing Insert once doesn't do anything.  Pressing it twice shows

<f1> <Insert> is undefined.

Pressing Insert Down shows

<f1> <down> is undefined.

I don't know where to go from here.


texts: auto-insert a skeleton and run a function when creating a new file

texts:
auto-insert-alist by default matches files created in .../bin/ directories and enables sh-mode.

There are examples on the wiki showing how to use a skeleton to insert some text, but I want to both insert some text and enable sh-mode. Some other examples show using a vector to run multiple actions, but not with a skeleton.

I'm unsure of the syntax. This doesn't work:

(auto-insert-mode +1)
(setq-default auto-insert-query nil)

(define-auto-insert
  '("/bin/.*[^/]\\'" . "Shell-Script")
  ['("Default shell script: "
    "#!/bin/bash" \n \n
    > _)
   sh-mode])

Can you show the correct way to use vectors and skeletons?


texts: SLIME not starting properly on MacOS Emacs

texts:
Pretty new to Emacs && Lisp, trying to get started....
I'm trying to get SBCL working via SLIME in Emacs 27.1 (9.0). After following the instructions to add the MELPA repo to my .emacs and installing slime from there, my .emacs looks like this:
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired.  See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
;;(add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(inhibit-startup-echo-area-message "")
 '(inhibit-startup-screen t)
 '(package-selected-packages '(slime)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(setq inferior-lisp-program "/opt/local/bin/sbcl" )

SBCL in this case is v. 2.0.7, installed from MacPorts.
After starting emacs and running the MELPA package install for slime, I restart Emacs and run:
M-x slime

Which produces a few pages of compiler messages (looks like), ending with:
 wrote /Users/jeff/.slime/fasl/2.26/sbcl-2.0.7-darwin-x86-64/contrib/swank-quicklisp.fasl
; compilation finished in 0:00:00.002

debugger invoked on a SB-BSD-SOCKETS:SOCKET-ERROR in thread
#<THREAD "main thread" RUNNING {10009F8083}>:
  Socket error in "bind": 49 (Can't assign requested address)

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [USE-VALUE] Try a port other than 0
  1: [ABORT    ] Exit debugger, returning to top level.

(SB-BSD-SOCKETS:SOCKET-ERROR "bind" 49)
   error finding frame source: Bogus form-number: the source file has probably
                               changed too much to cope with.
   source: NIL
0]

This looks to me like some kind of local process is to be started inside the SBCL...interpreter?...VM?..not sure about terminology here; and wants to call back into emacs via a network port, which it cannot seem to bind to, or find. Any ideas?
Thanks so much for the help!


texts: Is there a way to reuse patterns in a RegExp?

texts:
Somethimes I need a RegExp which uses a complex pattern multiple times. If I copy the same pattern there it works, but this is error prone as I then need to change each occurence of the pattern individualy if I want to make changes in the future.

Is there a way to either name a pattern, or even better, store it somewhere so that I can reuse it over multiple functions?

Consider the following code:

(defun complex-stuff ()
  ""
  (interactive)
  (beginning-of-buffer)
  (save-excursion
    (query-replace-regexp
      "a \\(<complex-patten>\\) b \\(<complex-pattern>\\)"
      "x \\1 y \\2")))

Here, <complex-pattern> is some valid expression that I wish to reuse.


texts:
new Emacs user here. I'm having trouble using org2blog to post to a client's WordPress site. The site has 2FA turned on, and won't let me post with it turned off. I got an application-specific password from WordPress for Emacs to use, and have tried to use the following code in my init.el file, entering that password manually:

(setq org2blog/wp-blog-alist
      '(("myblog"
         :url "https://XXXX.wordpress.com/xmlrpc.php"
         :username "XXXX")))

With XXX replacing the data of course.

This gives me:

(error XML-RPC fault ‘Sorry, you are not allowed to edit pages.’)

I also tried using this code to make the authentication automatic:

(setq auth-sources '("~/.netrc"))
(setq credentials-my-blog (auth-source-user-and-password "my-blog"))
(setq org2blog/wp-blog-alist
      `(("my-blog"
         :url "https://XXXX.wordpress.com/xmlrpc.php"
         :username ,(nth 0 (auth-source-user-and-password "my-blog"))
         :password ,(nth 1 (auth-source-user-and-password "my-blog")))))

and the .netrc file:

machine my-blog
login XXXX
password XXXX (this is the application-specific pw)

That just gives me an incorrect password error.

I'm flummoxed. I know that application-specific passwords can get me around 2FA because I've been using the Ulysses writing tool to access the same blog for a long time.

Can anyone help a bewildered Emacs n00b?