texts: org-mode call python source within latex source block

texts:
I have a piece of python code that outputs latex code. I'm trying to call the python source block from within a latex source block so it will format the output as latex when I export.

Any idea how to do this? I was hoping something similar to the below would work.

#+name: gradient_potential
#+BEGIN_SRC python :exports none :results output
from sympy import symbols, sqrt, diff, latex

x, y = symbols('x y')

U = x * y

print(latex(diff(U, y)))
#+END_SRC

#+begin_export latex
\begin{align}
#+CALL: gradient_potential() :results output
\end{align}
#+end_export


texts: How to locate all unused Lisp functions / variables

texts:
I am converting a few old libraries into one new library using different names for all of the functions, macros, variables, etc.  Some of the functions / variables will never be used, and I would like to eliminate those unused functions / variables.  Other than grepping each item one by one to see whether it is referenced somewhere within other Lisp libraries that will be using the new definitions, or haphazardly / randomly commenting stuff out and restarting Emacs (to see if it complains of missing stuff), is there a more efficient method of obtaining a list of unused functions / variables?

By analogy, when building Emacs from source, I can use the -Wall CFLAGS and see stuff that is unused:  https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html


texts: What is the hook used by company-mode to perform autocompletion?

texts:
According to describe-key (C-h k), every character I type runs self-insert-command and I suspect that self-insert-command calls some undocumented hook to perform text completition.

I am trying to debug company-mode, which occasionally fails to complete my input. So, describe-function says that self-insert-command calls post-self-insert-hook. I set it to nil and tried to type something that would be autocompleted — and it was completed anyway! In addition to this, self-insert-command calls expand-abbrev and auto-fill-function, but I tried to call both, and neither shows a popup text. So, it seems like every keypress runs some other hook used by company-mode.

I found that company-complete-common is the function that does autocompletition, so I set a breakpoint there to find this mysterious hook by using a backtrace. And… it didn't work! It works if I call company-complete-common interactively, but if I trigger completion by typing a character, and the same window pops up, the breakpoint is ignored!

I'm out of ideas, I hope somebody knows how this works.


texts: Is it possible to use whitespace-mode without specyfing a background (or foreground) color?

texts:
I like having non-breaking spaces and a few other characters represented in my buffer as visible characters. The problem I have is that whitespace-mode seems determined to set the background color. In modes where the background color is different (for example, in src blocks in Org), the ordinary space characters are really obtrusive.

I can workaround this by not having those blocks appear in a different background color, but that seems like it shouldn't be necessary.

I've tried a few things that I've found by searching, but none appear to work.


texts:
I'm new to Emacs.  How do I customize a setting?

This is actually a generic question inspired by the org-mode manual:

In this description, it says to (setq org-clock-persist 'history).  Where should I set this?

I'm a new user to Emacs, and I'm starting with org-mode. If I need to set this in the .emacs file, I do not know how to locate it and do it.

Step by step guidance would be helpful.


texts: Cannot use `pbpaste` in Emacs to paste Chinese characters

texts:
I'm using macOS. I tried using the following command to paste from clipboard in Emacs(started with emacs -Q)
(call-process "/usr/bin/pbpaste" nil t nil)

It works fine for English characters, but not for Chinese characters. For example, if I copy the following Chinese characters in web browser
中文测试

Then run the call-process command above in Emacs, the result would be
????

My system encoding is UTF-8 and I checked Emacs' encoding system was UTF-8 too(By checking the value of buffer-file-coding-system in Emacs, which was 'utf-8).
How to sovle the problem?


texts: Package duplicates in emacs package manager

texts: I recently reinstalled emacs after some technical difficulties. I managed to keep some of my personal configuration files, which I believe may have caused an issue. As I went to install packages, I discovered that each non-installed package had a duplicate. I figure this is due to remnant from when I transferred my data over, but I am unsure as to exactly what.


texts: Org table spreadsheet use column name on left hand side

texts:
I have the following table and formulas:

|   | Runde | 0 | 1 | 2 | Resultat |          % |
|---+-------+---+---+---+----------+------------|
| ! | name  |   |   |   |   result | percentage |
| # | Alice | 1 | 1 | 0 |        2 |      66.67 |
| # | Bob   | 0 | 0 | 1 |        1 |      33.33 |
#+TBLFM: $6='(+ $<<<..$>>>);N
#+TBLFM: $7='(format "%2.2f" (* (/ 100 (float (+ @3$result @4$result))) $result));N

Using numbers on the left hand side works fine, but it would be even better if I could do the formulas as follows:

#+TBLFM: $result='(+ $<<<..$>>>);N
#+TBLFM: $percentage='(format "%2.2f" (* (/ 100 (float (+ @3$result @4$result))) $result));N

However, as soon as I put in column names on the left, the formulas are not working properly any more. Is this a bug, or is my understanding of how the formulas work wrong?

Version:

GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-09-20 on lcy01-07, modified by Debian
org mode version from package list: org  9.1.13  available  gnu        Outline-based notes management and organizer


texts: How to display intermediate code block results?

texts:
Here is an example to let me explain what I would like to achieve:

#+NAME: heavy_computation
#+BEGIN_SRC shell :results table
echo -e "A\t32\nB\t17"
#+END_SRC

#+BEGIN_SRC python :var data=heavy_computation
return sum([i[1] for i in data])
#+END_SRC

The second code block uses the results of the first one. When running the second code block the result is correctly displayed:

#+RESULTS:
: 49

However I would also like to see the results of the first code block, without having to run it independently. Therefore, under the first code block, I would like to see:

#+RESULTS: heavy_computation
| A | 32 |
| B | 17 |

How can I achieve that? My question looks similar to this question but as far as I understood, the anwser seemed specific to Lisp.


texts: Raise the emacs application window when opening a file triggers a prompt?

texts:
In case it's relevant, I'm on a Mac, running OSX 10.12 and Carbon Emacs 24.3.1.

If I open a file using /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n filepath the Emacs window comes to the top and gets focus unless opening the file triggers a minibuffer prompt (such as Symbolic link to Hg-controlled source file; follow link? (yes or no).

Is there a way to configure Emacs to grab focus and raise its window in these cases as well?


texts:
I'm trying to write a function that will take a heading and refile it to one specific location. The doc for org-refile is

(org-refile &optional GOTO DEFAULT-BUFFER RFLOC MSG)

and RFLOC is

RFLOC can be a refile location obtained in a different way.

but I have no clue what "a different way" would be and I've been googling for half a day and not seen any examples.  I know the file and I know the headline for the target but I don't know the syntax to form it into what it wants. The closest I've gotten is:

(org-refile nil #("~/Org/bookmarks.org")

which will then prompt me for the headline, but of course I don't want it to prompt me, I want to provide it.

I'm new to elisp and I've guessed at every syntax I can think of. Does anyone know how to phrase this?


texts: Is there a locate-library equivalent for Common Lisp files?

texts:
When editing Common Lisp code, is there an Emacs command that behaves like locate-library that would take a name and attempt to find the location for a Common Lisp file with that name?
Looking at Slime and SLY manuals I did not find that feature.  Does it exists?
I know I can find the location of a specific function when using Slime or SLY.  But let's say I just downloaded a library, possibly with Quicklisp, and I'd like to look at its code, I'd use that command to quickly visit or edit these files.


texts: How do I use TAB instead of Enter for completion in ido-mode?

texts:
When I do C-x C-f .emacs.d/i TAB Emacs displays a new buffer which presents "Possible completions", which are in my case auto-save-list/, history and init.el. I would like to have it complete to just .emacs.d/init.el.

I have the following inside init.el regarding ido:

(require 'ido)
(ido-mode 1)
(setq ido-enable-flex-matching t)


texts: How can I get electric-pair-mode to not pair quotation marks (single or double)? I still want it to pair everything else (brackets, braces, etc.), just not quotes.


texts: Can I show the time spent in the currently active task in my orgmode clocktable?

texts:
When I press R in my orgmode agenda to view the clocktable (or v R for clockReport), I get a list of clock times for finished tasks.  Is it possible to also show the time so far spent on the currently active task (i.e., the time shown in the modeline), and include it in the total work time today?  If so, how can I do that?

Currently, if I want to see how many hours I have worked so far today, I have to clock out of and into my current task and then refresh the clocktable.


texts: emacs org mode do not expand heading when pasted

texts:
I often cut and paste folded top-level headings (only the heading is displayed, not its subcontent and tree).
When I do a paste, the heading is pasted unfolded - ie all subcontent and the tree is shown. After the paste, the current cursor point is at the bottom of the subcontent.
If I have eg 200 lines of subcontent, then I have to scroll back up to the heading to fold it.
Is there a setting in org mode to paste a heading and subcontent but not expand/unfold the subcontent?
Thanks ahead of time for any help......


texts: mark-whole-region and pbcopy without losing current point/region

texts:
I wrote a hydra today (I think my very first one) - I always do Meta-| pbcopy after doing a C-x h, so why not let hydra help out:
    (global-set-key
     (kbd "C-x h")
     (defhydra hydra-my-mark-whole-buffer
       (:body-pre (mark-whole-buffer))
       "hydra-my-mark-whole-buffer"
       ("h" mark-whole-buffer "this was not needed")
       ("p" my-pbcopy "Meta-| pbcopy")))

    ;; https://emacs.stackexchange.com/a/13177
    (defun my-pbcopy (beg end)
      (interactive "r")
      (message (if (zerop (shell-command-on-region beg end "pbcopy")) "copied" "copy failed")))

(btw I'm always in emacsclient -nw mode)
Anyway, I'd like two more things:

not lose the point/position
if a region was marked before calling the hydra, if should stay that way after pbcopy has been done.

How can I tweak my code to do that?


texts: Org Mode - Stop Recurring Events From Appearing as Late on Agenda

texts:
I am using the org mode agenda and my issue is that recurrent scheduled items appear as late everyday.

For example an event that happens every Tuesday will also appear every Wednesday as 1 day late, on Friday as 2 days late etc...

There is no reason why I would want that, so how can I stop those "late" events from appearing, except on the dates they are scheduled to happen?


texts: Error in custom eshell function (exit and close window)

texts:
I got the below function from an article on howardism.org. Its purpose is to exit eshell and close the corresponding window.

;; GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-29
(defun eshell/x ()
  (insert "exit")
  (eshell-send-input)
  (delete-window))

(setq debug-on-error t)

Looked pretty straightforward to me. But when I start emacs -Q (See above code block for version info), then evaluate the above code and type x<RET> in an eshell window. I get the following:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  eshell-lisp-command(eshell/x nil)
  eshell-plain-command("x" nil)
  eshell-named-command("x")
  (prog1 (eshell-named-command "x") (run-hooks (quote eshell-this-command-hook)))
  (condition-case err (prog1 (eshell-named-command "x") (run-hooks (quote eshell-this-command-hook))) ((debug error) (run-hooks (quote eshell-this-command-hook)) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))
  (condition-case-unless-debug err (prog1 (eshell-named-command "x") (run-hooks (quote eshell-this-command-hook))) (error (run-hooks (quote eshell-this-command-hook)) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))
  (eshell-condition-case err (prog1 (eshell-named-command "x") (run-hooks (quote eshell-this-command-hook))) (error (run-hooks (quote eshell-this-command-hook)) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))
  (let ((eshell-this-command-hook (quote (ignore)))) (eshell-condition-case err (prog1 (eshell-named-command "x") (run-hooks (quote eshell-this-command-hook))) (error (run-hooks (quote eshell-this-command-hook)) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))))
  (eshell-trap-errors (eshell-named-command "x"))
  (progn (eshell-trap-errors (eshell-named-command "x")))
  (catch (quote top-level) (progn (eshell-trap-errors (eshell-named-command "x"))))
  (progn (run-hooks (quote eshell-pre-command-hook)) (catch (quote top-level) (progn (eshell-trap-errors (eshell-named-command "x")))) (run-hooks (quote eshell-post-command-hook)))
  (let ((eshell-current-handles (eshell-create-handles t (quote append))) eshell-current-subjob-p) (progn (run-hooks (quote eshell-pre-command-hook)) (catch (quote top-level) (progn (eshell-trap-errors (eshell-named-command "x")))) (run-hooks (quote eshell-post-command-hook))))
  (eshell-commands (progn (run-hooks (quote eshell-pre-command-hook)) (catch (quote top-level) (progn (eshell-trap-errors (eshell-named-command "x")))) (run-hooks (quote eshell-post-command-hook))))
  eval((eshell-commands (progn (run-hooks (quote eshell-pre-command-hook)) (catch (quote top-level) (progn (eshell-trap-errors (eshell-named-command "x")))) (run-hooks (quote eshell-post-command-hook)))))
  eshell-send-input(nil)
  funcall-interactively(eshell-send-input nil)
  call-interactively(eshell-send-input nil nil)
  command-execute(eshell-send-input)

Without debug-on-error the "Wrong type argument"-message ends up in the buffer I was working in when invoking eshell.
To add to my confusion, this only happens the first time I call eshell/x.
Stepping through the function with edebug suggests that the error occurs in neither of the functions called inside eshell/x as the debugger only starts after I stepped over the last function call. Also when changing the function to this

(defun eshell/x ()
  (insert "exit")
  (eshell-send-input)
  (delete-window)
  (message "done deleting window"))

The debugger only gets entered after "done deleting window" appeared in the echo area.

Now I don't know how to continue searching for the error. Can someone please help me identify the error?


texts: Yasnippet not working with auto-complete-mode

texts:
I am just starting to experiment with Yasnippet, and it worked very well until I tried to combine it with auto-complete-mode. The problem is that Auto-Complete is taking over completely. For example, in c-mode I can type pr and then press TAB to expand a printf snippet, but after activating auto-complete-mode this does not work, but auto-complete-mode itself works just fine. Instead, I would like to have Yasnippet to have priority over Auto-Complete when I press the TAB key.

I am using Emacs 24.4 on Ubuntu 14.04, Yasnippet version: 0.8.1, and Auto-Complete version 1.5.0.

Here is minimal example

$ emacs -Q -l init.el t.c

where init.el is:

(require 'package)
(package-initialize)
(setq package-enable-at-startup nil)
(yas-global-mode 1)
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(ac-config-default)
(add-to-list 'ac-sources 'ac-source-yasnippet)

If I now type pr and then press TAB, I get the Auto-Complete popup menu, (whereas I would like to expand the printf snippet instead). If I type M-x auto-complete-mode to turn off auto-complete-mode and then type pr and TAB, the printf snippet expands as expected.

Other information:

C-h v RET ac-source-yasnippet gives:

((depends yasnippet)
 (candidates . ac-yasnippet-candidates)
 (action . yas/expand)
 (candidate-face . ac-yasnippet-candidate-face)
 (selection-face . ac-yasnippet-selection-face)
 (symbol . "a"))

C-h v RET ac-sources gives:

(ac-source-yasnippet ac-source-gtags ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers)

Clearing ac-source-yasnippet variable ((setq ac-source-yasnippet nil)) does not help.

References:

About auto complete and yasnippet in emacs
emacs 24 autocomplete yasnippet


texts: Turn off prompting for executing shell links in org mode

texts:
If I add the following to an org-mode file:

[[shell:DIR]]

It creates a link which will run 'DIR' and show the output in a separate window.

Here's the result:

Now, right after you open the link, you are prompted about running the command:

I'm working with an org-file that I created and thus I trust the commands in it. Is there a way to turn off this prompting?


texts: How to resize vertical split with mouse when using telephone-line instead of mode-line?

texts:
According to this StackOverflow answer, one can resize a vertical split with the mouse by dragging the mode-line in a specific spot.

I'm using telephone-line and can't find any spot on there to resize the vertical splits. Dragging the telephone-line itself only resizes horizontal splits.

How can I resize vertical splits with my mouse when not using the default mode-line?


texts: Powerline mode-line menues in terminal mode

texts: When inside terminal mode (emacs -nw) I can open the menu using M-F10 in terminal mode. Is there a similar possibility for the powerline mode-line  menue on the bottom of the window?


texts: display in the mode-line the number of characters in the selection

texts:
I'm used to have display of the number of selected characters in the mode line when there is an active selection (in vim).

Is it possible to achieve this in emacs?

I managed to display the column index besides the line index, which is something... But not quite enough. I also looked at the mode line format documentation, but without success.

I also found smart mode line but I think that it doesn't offer the feature as of now.


texts:
In my emacs/AUCTeX setup, when I write (, \left( or \( a corresponding ), \right), or \) is inserted automatically.
Is there a way to override this so that inserting ( produces instead something like \parent{} while \left( and \( work the same way?


texts: Cannot override C-l bindings in helm-mode

texts:
I'm trying to override the keymap C-l binding when in helm mode.
However, it doesn't seem to be working - even though my other bindings work.

I've tried setting C-l to nil and also binding to both helm-map and helm-find-files-map but it still has the default binding.

    (define-key helm-find-files-map (kbd "C-l") nil)
    (define-key helm-map (kbd "C-l") nil)

    (define-key helm-map (kbd "C-l") 'helm-execute-persistent-action)
    (define-key helm-find-files-map (kbd "C-l") 'helm-execute-persistent-action)

Is there something that I'm missing here that is preventing me from overriding this keybinding?


texts: How can I use more than 9 regex capture groups in Emacs Lisp?


texts: Emacs - Lisp to parser text block to plantuml

texts:
Some document said emacs-lisp is more powerful than perl/Python to parser text file, but I still didn't see good example for reference.

For example, if input below text block:

12-22 07:43:14.699  1640  2722 E JavaBinder:    at android.util.ArrayMap.allocArrays(ArrayMap.java:175)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at android.util.ArrayMap.put(ArrayMap.java:463)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at android.os.BaseBundle.putInt(BaseBundle.java:455)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at android.content.Intent.putExtra(Intent.java:7174)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at com.android.server.audio.AudioService$VolumeStreamState.setIndex(AudioService.java:4289)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at com.android.server.audio.AudioService.setStreamVolumeInt(AudioService.java:1929)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at com.android.server.audio.AudioService.onSetStreamVolume(AudioService.java:1670)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at com.android.server.audio.AudioService.setStreamVolume(AudioService.java:1769)
12-22 07:43:14.699  1640  2722 E JavaBinder:    at com.android.server.audio.AudioService.setStreamVolume(AudioService.java:1683)

I wish to produce below output: (extract the file name, function name and line number, then reformat as plantuml input text)

-> AudioService:setStreamVolume():1683
AudioService -> AudioService:setStreamVolume():1769
AudioService -> AudioService:onSetStreamVolume():1670
AudioService -> AudioService:setStreamVolumeInt():1929
AudioService -> AudioService:setStreamVolumeInt():4289
AudioService -> Intent:putExtra():7174
Intent -> BaseBundle:putInt():455
BaseBundle -> ArrayMap:put():463
ArrayMap -> ArrayMap:allocArrays():175

Then we can use plantuml to covert it to a UML diagram (org mode).

How can we do that with emacs-lisp (maybe in org mode)?

My idea is put the input text in a code block, then run the emacs-lisp code in another code block. The result will be the output as expected above

#+NAME: myinput
#+BEGIN_EXAMPLE :session
input text here
#+END_EXAMPLE

#+BEGIN_SRC emacs-lisp :exports both
(message 'process myinput here')
#+END_SRC

#+RESULTS:
: output reformat result here


texts: How to automatically load flyspell-mode when Markdown (.md, .mdwn) file is open?

texts: When editing Markdown files (.md, .mdwn, etc.) and Mediawiki files (.mw), I almost always need to have flyspell-mode loaded.  How to have that automatically happen via configuration?


texts: How to make org show all properties as default?

texts: I want to show all properties of all subtrees while folding all of them is the default option but I can't find a option to this.


texts: How to call an interactive function and pass arguments to it from within Elisp?

texts:
I'm trying to compose a link to the describe-package help buffer to the xref package like this:
[[(elisp:(describe-package "xref"))][xref]]

But it can't execute. So I wonder how to pass arguments to an interactive function from within Elisp. I don't believe anyone has asked this question, and after much searching I still couldn't find the answer. I've tried the following forms and none of them worked.
(describe-package "xref")
(call-interactively 'describe-package "xref")
(call-interactively (describe-package "xref"))
(call-interactively (lambda () (interactive) (describe-package '("xref"))))
(command-execute (describe-package "xref"))
(command-execute 'describe-package "xref")


texts: Org headlines are never exported to \paragraph in LaTeX

texts:
I want to export an Org file into PDF, with any depth titles showed in TOC; however, cannot works. Even though adding \setcounter{tocdepth}{5}, TOC still only contains the title of 3rd depth (\subsubsection).

I check the TeX file it exported: org-export seemed to ignore my setting for org-latex-classes, and just convert **** into '\item instead of \paragraph. But I cannot find some worked solution for this...

Following is my org-latex-classes:

(setq org-latex-classes
  '(("article"         "
\\documentclass[10pt,a4paper]{article}
\\usepackage[margin=2cm]{geometry}
\\usepackage{fontspec}

\\XeTeXlinebreakskip = 0pt plus 1pt
\\linespread{1.36}

\\setcounter{tocdepth}{5}

\\usepackage{multicol}

\\usepackage{hyperref}
\\hypersetup{
  colorlinks=true,
  linkcolor=[rgb]{0,0.37,0.53},
  citecolor=[rgb]{0,0.47,0.68},
  filecolor=[rgb]{0,0.37,0.53},
  urlcolor=[rgb]{0,0.37,0.53},
  pagebackref=true,
  linktoc=all,}
"
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
    )
  )


texts: How to select and replace the content of all specific org-headings?

texts:
I am trying to select each content-heading extracted with org-noter and then remove all erroneous newlines.

This is my function.
(defun sanitize-noter-import ()
  "Sanitizes org-noter imports. This removes white-spaces from all '* Contents' headings."
  (interactive)
  (let (($headings nil)
        (nl "
") ; newline
        (nlb "-
") ; newline with hyphen-break
        heading)
    (org-map-entries
     (lambda ()
       (setq heading (org-entry-get (point) "ITEM"))
       (if (string= heading "Contents")
           (progn
             (message heading)
             (next-line)
             (mark-paragraph)
             (replace-string nlb "" nil (point) (mark)) ; reconnect hyphenated words
             (replace-string nl " " nil (point) (mark)) ; remove line breaks
             (message "point is %s" (point))
             (message "mark is %s" (mark))
             ))))
    ))

This is some example text.
** Skeleton

*** Highlight on page 2
:PROPERTIES:
:NOTER_PAGE: (2 . 0.18962766666666667)
:END:

**** Contents
Gamification is the application of game features, mainly video game elements, into non-game
context for the purpose of promoting motivation and engagement in learning. The application of
gamification in a pedagogical context provides some remedy for many students who find
themselves alienated by traditional methods of instruction. The use of gamifica-
tion could provide...

When I call the function nothing gets replaced and I get the output
Contents
point is 3983
mark is 4022
Mark set
Replaced 0 occurrences

Point and marker are here:
*** Highlight on page 2
:PROPERTIES:
:NOTER_PAGE: (2 . 0.18962766666666667)  // point
:END:                                   // marker

How do I select the headings "body" and perform a text-operation on it?


texts: wgrep for special multiline grep (pcregrep)

texts:
wgrep works well for every line in context search like grep -C 2. It also works for grepmail, special grep-like program for mailboxes. You can edit each line of output.

How to force pcregrep with multiline request like ^[ \t]+-.*\n +CLOCK to cooperate with wgrep correctly (with ability to edit each line, not only the first)?


texts:
Vim has a plugin called SuperTab that uses the tab key to complete words in the current buffer (roughly speaking).

For example, if a buffer's contents are:

;; This buffer is for notes you don't want to save, and for Lisp evaluation.
;; If you want to create a file, visit that file with C-x C-f,
;; then enter the text in that file's own buffer.

Then typing eval and then pressing tab will complete eval to evaluation, since the latter word is already in the buffer.

I am looking for a emacs equivalent. I know of hippie-expand, but I do not quite like its behavior; sometimes, instead of completing just a word, it will try to complete an entire line.

Searching on the emacs-wiki, I found smart-tab, which almost does what I want. The only rub is that, in the example above, it will complete eval to evaluation. instead of evaluation.

The question is the following:

Is there a direct SuperTab equivalent for emacs that I haven't discovered?
If not, is there a way to change smart-tab's behavior so that the extra period is not part of the completion?


texts: Unable to link org-mode capture items to mu4e email messages

texts:
I have been using org-mode for a while and started using mu and mu4e recently.

The following capture template stores a link from a "normal" file but not from a mu4e message:

(setq org-capture-templates
  '(("f" "Todo (linked to file)" entry (file+headline "~/org/gtd.org" "project")
 "* TODO %?\n%a"))
  )

In a buffer with a mu4e message, I do M-x org-store-link and get this message in the minibuffer:

  No method for storing a link from this buffer`.

The author of this thread reported that

  The link (%a) gets initialized,

and the only other thread I found is two years old and mentions that the problem went away with version 0.9.18 of mu.

I am running Org mode version 9.1.9 and mu version 1.0.

How can I get the link to work?


texts: how to fix an overlay at end-of-line highlighting too much?

texts:
I have added the following definitions to my initialization file in order to make the mark show up as a red highlight:
(defface mmv-face
  '((t :inherit default :background "red"))
  "Face used for showing the mark's position.")

(defvar mmv-mark-overlay nil "Overlay for showing the mark's position.")
(make-variable-buffer-local 'mmv-mark-overlay)

;; The three optional arguments are needed to cover the optional arguments of
;; those functions that this function will modify through `advice-add'.
(defun mmv-show-mark (&optional ARG1 ARG2 ARG3)
  "Make the mark's position stand out by means of a one-character-long overlay."
  (unless mmv-mark-overlay
    (setq mmv-mark-overlay (make-overlay 0 0 nil t))
    (overlay-put mmv-mark-overlay 'face 'mmv-face))
  (let ((mark-position (mark t)))
    (when mark-position
      ; Function `mark' returns non-nil only if the buffer's mark is set, so
      ; doing the following is pointless if `mark-position' is nil.
      (move-overlay mmv-mark-overlay mark-position (1+ mark-position)))))

(advice-add 'set-mark :after #'mmv-show-mark)
(advice-add 'pop-mark :after #'mmv-show-mark)
(advice-add 'push-mark :after #'mmv-show-mark)

It works well otherwise, except that if the mark is at the end of a line, everything to the right of the mark is also highlighted; see the screenshot below. Why would this be, and how can it be fixed?


texts: Using `with-silent-modifications` when modifying the buffer and undoing those modifications without using `undo`

texts:
I wrote a wrapper for the existing export function. My wrapper adds an appropriate bibliography: link, calls the original export function and then removes the bibliography: link. In summary, the function modifies the buffer, but undoes those modifications (without actually using undo).

Is it safe to put the body of such a function inside with-silent-modifications?


texts:
My organization uses PGP-encrypted email, but are unable to use it
with our mailing list because we send emails to the mailing list
address, and not to the addresses on our member's individual PGP keys.
I was told by one of my colleagues that Thunderbird's Enigmail plugin
had an option to "Edit per-recipient rules." Using this, they were
able to send encrypted emails to me and other members encrypted with
their own PGP keys.
I'm using Notmuch as an email frontend on Emacs and smtpmail to send
it. I haven't been able to find any similar options on here^1,
here^2 and here^3.


texts: Making skewer-repl work on external sites

texts:
skewer-mode works perfectly with their default demo page
(http://127.0.0.1:8080/skewer/demo). I'm able to send commands from
skewer-repl like alert('hello world') and it appears on that particular URL.

Now, how to make the same functionality to work with external sites ?
I have already injected the greasemonkey
script
in the external site but it doesn't seem to work for me. The problem
is that skewer-repl seems to only interact with it's demo url:
http://127.0.0.1:8080/skewer/demo . Is there a way to make it work
with external sites ?


texts:
Context

In my spare time, I've been adding very limited support for org-mode syntax in the Atom text editor for my friends that absolutely will not switch to Emacs.

Over the last few years I've found approximately 10 org syntax parsers which all focus on converting org-mode files into markdown or other file formats.

The 2 most popular parsers that I use everyday and recommend are:

pandoc
org-ruby gem which provides limited support org-mode syntax for both Github, GitLab.

Question

Outside of Emacs what other software supports org-mode syntax?

  Note: I acknowledge that StackExchange platform is not really ideal for this type of question but I believe the Emacs StackExchange community would benefit from multiple well researched answers about this topic.

How to Answer this Question

Each answer should:

Limit answer scope to a single software source, e.g. discuss pandoc or org-ruby but not both in the same answer.
Briefly describe what software can do with org-mode file, e.g. pandoc can convert org-mode to docx, markdown and json file formats.
Provide a simple example of using the software, e.g. pandoc --from org --to docx -o example.docx example.org.
List dependencies, e.g. ruby is required to use org-ruby.
Link to official software page.

Vote for the most useful answer


texts: How do I configure home-brew-provisioned emacs to run a GUI-based emacsclient properly?

texts:
Configuration

MacOSX 10.11.5
emacs version 24.5.1
brew 0.9.9

I want to have the following behavior in my emacs setup:

At login, automatically start an emacs server process.
Running the /Application/Emacs.app executable opens a frame to a running emacs server. If the server is not running, then run it and try again (i.e. emacsclient -a ''&).
When executed from the command-line, have this behavior but use the current terminal instance to host the emacs session (i.e. emacsclient -nw -a ''&).

There are several pages that cover this information, albeit incompletely:

http://blog.haberkucharsky.com/tech/2015/01/26/emacs-on-osx.html
https://korewanetadesu.com/emacs-on-os-x.html
How can I run Emacs 24.x app on Mac OS X in daemon mode

What I've Tried

I was able to accomplish (1) by installing the homebrew launch-agent. See brew info emacs for more detail.
Once (1) is running, it was easy enough to get (3) working.
The problem with the above links was that the my version of homebrew (0.9.9) doesn't have emacsclient in a subdirectory of the app bundle. That's not too big of a deal, I was able to locate the correct binary at /usr/local/Cellar/emacs/24.5/bin/emacsclient and modify the scripts appropriately.
I created an AppleScript app to replace the standard link to the Emacs.app in /Applications. The AppleScript has the following code

tell application "Terminal"
    try
        do shell script "/usr/local/bin/emacsclient -c -n -a ''&"
        tell application "Emacs" to activate
    on error
        do shell script "/usr/local/bin/emacsclient -c -n -a ''&"
    end try
end tell

There are two problems here:

The try block doesn't do anything; it doesn't error out (i.e. throw an exception).
Even though the shell script command works on the command-line, running it from AppleScript doesn't respawn the server process.

My main problem is the sometimes I accidentally kill the server process. Trying to activate the Emacs.app GUI frame doesn't work until I manually go to the command line and run emacsclient -a ''&. At that point I am able to use Emacs from the GUI.

Using the vanilla emacs provided by homebrew, how do I setup a system where activating Emacs.app restarts the server if it's been terminated? I suspect it has something to do with the way AppleScript sets up its environment to call emacsclient.


texts: Make the mode-line display percentage and not "Top/Bottom/All"

texts:
Mode line's %p displays the percentage of the current view of the buffer:

  %p The percentage of the buffer text above the top of window, or
  ‘Top’, ‘Bottom’ or ‘All’. Note that the default mode line construct
  truncates this to three characters.

I don't like the Top/Bottom/All and I'd like to always display the percentage. Is there a way to achieve this?


texts:
Description

When calling org-todo from a function, e.g., via org-map-entries  or search-forward (see example code below), then the todo state change logging is only applied to one matched heading.

For example, calling one of these mark-done functions:

(defun mark-done ()
  (interactive)
  (org-map-entries
   (lambda ()
      (org-todo "DONE"))
   "/TODO" 'file))

(defun mark-done ()
  (interactive)
  (let ((case-fold-search nil))
    (goto-char (point-min))
    (while (search-forward " TODO " nil t)
      (org-todo "DONE"))))

On this file:

#+TODO: TODO(t) WAIT(w) | DONE(d!)
* WAIT W1
  SCHEDULED: <2000-01-01 Sat>

* TODO T1
  SCHEDULED: <2000-01-01 Sat>

* WAIT W2
  SCHEDULED: <2000-01-01 Sat>

* TODO T2
  SCHEDULED: <2000-01-01 Sat>

Results in this file (State line not added to T1, only added to T2):

#+TODO: TODO(t) WAIT(w) | DONE(d!)
* WAIT W1
  SCHEDULED: <2000-01-01 Sat>

* DONE T1
  CLOSED: [2000-01-01 Sat 00:01] SCHEDULED: <2000-01-01 Sat>

* WAIT W2
  SCHEDULED: <2000-01-01 Sat>

* DONE T2
  CLOSED: [2000-01-01 Sat 00:01] SCHEDULED: <2000-01-01 Sat>

  - State "DONE"       from "TODO"       [2000-01-01 Sat 00:01]

This could be a bug, but my (e)lisp knowledge is basically nil, so I am not sure how to investigate it further or if I am calling the function incorrectly.

Question

How do you make org-todo apply todo state change logging to all headings, when called from a function? I.e., how can you replicate the behavior of manually calling org-todo on each headline?

Version

This was run as emacs -Q in:

GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, X toolkit, Xaw scroll bars) of 2019-03-25.
Org mode version 9.1.9 (release_9.1.9-65-g5e4542 @ /usr/share/emacs/26.1/lisp/org/.


texts: Distributing emacs packages with module functionality

texts: How to distribute an emacs package via Elpa that includes OSX and Linux module written in C that needs to be compiled locally?


texts:
I'm curious about the Emacs architecture. Do you know where are the structures for keeping opened text file? Where are the main functions for opening, editing and closing text files? How in general terms text is stored.

I once opened one xml file, which was 100 MiB large and had only two lines of text. Then I typed a character in the large one, emacs stopped reacting for a several minutes with a 100% cpu usage. So, I guess, emacs did kept that 100 MiB line as a single memory block, and moved 99.999999 of them to the right then this happened. I'm curious where exactly in the code this happened, what's the file name + function name.


texts:
I'm using yasnippets to create code blocks in org mode to document and execute DevOps activities. To improve productivity, it would be nice to have a possibility to create org tables with rows of values and instantiate my snippet for each row in the table, using the respective values as input.
A simple example:

Table:

| one  | two  | three |
| four | five | six   |

Snippet:

echo "$0 $1 $2"

Result:

echo "one two three"
echo "four five six"

Is something like this possible without major elisp programming efforts? Any hint is very appreciated.

//Michael


texts:
Running Doom Emacs 2.0.9 on Emacs 27.1 on Manjaro KDE.
When I compile a latex documents, it produces a PDF file and opens an emacs window to display it. But what is displayed is some text and not the PDF file.
The *Messages* buffer carries an error that says:

File mode specification error: (error Error running
‘/home/user/.emacs.d/.local/straight/build/pdf-tools/epdfinfo’:
/home/user/.emacs.d/.local/straight/build/pdf-tools/epdfinfo: error
while loading shared libraries: libpoppler.so.101: cannot open shared
object file: No such file or directory

If that is of any use, this is happening after a massive update to the OS. Earlier, the new window would show the PDF file.
How do I correct this error?


texts:
After updated to macOS Catalina (10.15) I've been trying to use R in Emacs 26.3. However, Emacs is not fetching R by using M-x R (Emacs says [No match]).

I already checked the paths for both R and Emacs in the Terminal, both are in /usr/local/bin. Also, I checked M-x getenv PATH within Emacs. This is the result:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Library/TeX/texbin:/opt/X11/bin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14

Can anyone help me with this please? Any ideas to fix the problem? Please let me know if you need more info.


texts: Writing helm search for MediaWiki-powered wikis

texts:
Related: How to do searches in MediaWiki mode

In the absence of specific support for searching MediaWiki sites, helm seems like a good framework for search and navigation.

How does one write a helm extension for WikiMedia-powered wikis? Is this even generalizable across wikis in the helm framework?


texts:
Using pdf-tools I attempt to print via pdf-print-misc-document though nothing gets printed?

In messages I see without any errors:
Print job started: /usr/bin/lpr -P myprinter -o media=a4 -o InputSlot=Tray2 /home/temp.pdf

Running the same command from the terminal prints immediately

$ /usr/bin/lpr -P myprinter -o media=a4 -o InputSlot=Tray2 /home/temp.pdf

.spacemacs

(custom-set-variables
'(pdf-misc-print-programm "/usr/bin/lpr")
'(pdf-misc-print-programm-args (quote ("-P myprinter" "-o media=a4" "-o InputSlot=Tray2")))
)


texts:
(still a complete beginner to org in general)

I managed to setup org-habit, that also feeds into org-agenda to neatly see habits. I would like to track a few variables that go along with my habits (e.g. track my weight).

I see 2 options:
1. add notes via the :LOGGING: property
2. create a custom property (?)

How can I track variable values over time?


texts: How to select (and highlight) non-consecutive blocks?

texts:
The title says it all.

I'm looking for a C- or M- built-in way to select non-consecutive lines and blocks of text, like usual consecutive lines with Shift or C-SPC.

I.e. I need a switch that turn selecting off and back on, but previous selections stay.


texts: What module handles word+period within paragraph fill?

texts:
I'm experienced with elisp, and I'm using emacs 24.5.

I want to modify how fill-paragraph works for a special application, and I'm trying to figure out which elisp code handles the case where a short word followed by a period always goes to the next line.

For example, assume that some text looks like this:

Period at the end. And then blahblahblah and additional blahblahblah.

This text gets filled as follows (assume fill-column is 30):

Period at the
end. And then blahblahblah and
additional blahblahblah.

Note that the word "end" gets moved to the next line, even though the text length hasn't reached the fill-column value.

I'm trying to find the elisp code that handles this, so I can write my own version of this which overrides this behavior. I want the result to look like this:

Period at the end. And then
blahblahblah and additional
blahblahblah.

Could anyone point me to the 24.5 elisp code which handles this case?

Thank you very much.


texts: How to memorise the cursor position and return to it?

texts:
Say I was working in a big file somewhere in the middle and all of the sudden I realise that I need to edit the top of the file. I do a M-< to go to the top and make my edits. Now I want to move back to the exact point where I was working before.
Is it possible to call a function before moving to the top, memorising the current point then going somewhere and calling the same function again but this time the cursor is moved to the point which was previously memorised and the memory is erased; ready to memorise a new point.
Edit: Here is what I ended up with,
(defconst POINT-REGISTER 0
  "Register to save the current point in.")

(defcustom saved-point nil
  "Whether a point is saved in `POINT-REGISTER`."
  :type 'boolean)

(defun save-or-goto-saved-point ()
  "Interactively memorise a point and return to it."
  (interactive)
  (if saved-point
      (progn (register-to-point POINT-REGISTER)
             (setq saved-point nil))
    (progn (point-to-register POINT-REGISTER)
           (message "[<Your Name>] Point saved!")
           (setq saved-point t))))


texts: Wrong indent with emacs 24 and 25 in shell-script-mode?

texts:
I get the following indentation for my bash script

for i in *; {
    echo $i
}
         echo done

The last indent is wrong and should be zero spaces.

How can this be fixed?


texts:
I've use js2-mode but it don't indent html in javascript properly. I've found this repo https://github.com/jsx/jsx-mode.el but it's not for react, it's for some other jsx.

What do you use for editing react application with jsx files?


texts: Defining keyboard shortcuts from an argument in a function

texts:
I would like to write a command that defines key bindings for me, so that I can feed in key y (for example) and have it define key bindings for M-y, C-y etc.
I'm trying to concat the command argument into a string, but it gives me the error Invalid modifier in string.
(defun my/keypress-definer (keypress)
  (interactive)
     (concat "\C-" keypress))

(my/keypress-definer "a")

Is there any way to achieve this?


texts: How to fold / collapse the first comment block on file load?

texts:
Is there a way to fold the first comment of a file on load?

While I don't like code folding in general, it can be handy in this one instance when every file has a boiler plate header which isn't useful to see each time.

Is there a way to setup emacs to do this?

I'm not looking for an advanced code-folding feature, just the most simple code folding, with a way to see the first comment if it's needed.


texts: How to rearrange menu bar to show mode-specific items first

texts:
The Emacs menu bar places mode-specific menus after most of the default menu items, but before the "Help" menu*. Specifically: "File", "Edit", "Options", "Buffers", "Tools", mode-specific menu items, "Help". For example:

Lisp Interaction mode:

Prolog mode:

Is there a way to rearrange the menu items such that the mode-specific menu items always appear before all the other menu items? For example, in Lisp Interaction mode, I would like the "Lisp-Interaction" menu item to be the first menu item (i.e. appearing to before "File").

* The "Help" menu always appears last because of the variable menu-bar-final-items which is '(help-menu) by default.


texts:
I've seen a tip several times that ido-file-extensions-order can be used to easily order files. Setup is straightforward (code at bottom), but these filetypes are only given preference when choosing between two otherwise identical files.  Is there a way to order files based on type in the minibuffer (or any way other than alphabeticaly?).

(setq ido-file-extensions-order '(".org" ".py" ".txt" ".cpp" ".tex")
      ido-enable-flex-matching t)
(ido-mode 1)


texts: dired by name - change directory and create new file

texts:
I want to open a new file in a different directory than the current one.
Pressing C-x C-f -> I could enter a file name. But I don't.
Pressing RET
The directory listing (mode (dired by name)) comes up and I can navigate through it by using the cursor and RET. No problem.
I navigate to the existing directory I want to create the new file in.
How can I enter the name of the new (nonexisting) file in that case?
EDIT: Because I am quite new to emacs: How could I answer such simple questions to my self?


texts: Why some packages included with Emacs don't have their documentation in the main manual?

texts:
I wanted to read the Ido documentation offline from Emacs.

I read in the NEWS file of Emacs 24.5 that since the 24.4 version an "Ido user manual is now included" (line 608). But it was not possible to find anything in the main manual about Ido.

Then, after searching more, I found out that the info-display-manual command made possible to reach the ido manual. I also found later that it was listed in the INFO tree (M-x info-directory).

I admit that I should have known more about how to access info-display-manual and the INFO tree, but why these kind of  packages (part of the vanilla Emacs) are not linked in the main manual (as far as I know)?


texts: Prevent byte-compiler warnings after requiring features

texts:
In Elisp packages, we sometimes want to use a feature only if the user has installed another package without specifying that package as a dependency for our own. E.g.

(when (require 'markdown-mode nil 'noerror)
  (markdown-mode))

This, however, causes a byte-compiler warning:

  Warning: the function markdown-mode is not known to be defined.

What's the right way to address this? with-no-warnings is one option, but it needs to be wrapped around every such use. Is there a better way?


texts: How to detect whether current major-mode allows dashes ("-") in its symbol names?

texts:
To enable smart-dash ("an Emacs minor mode which redefines the dash key to insert an underscore within C-style identifiers and a dash otherwise") after falling in love with Kebab/Lisp case,
I want to check whether current programming language supports Kebab case and activate smart-dash when it doesn't.
Approaches tried:

Exhaustively call (add-hook <mode-hook> #'smart-dash-mode) for every known non-Kebab case language.
Find current major-mode's syntax, so far I have not found a uniform way, for Common Lisp it's a variable: lisp-mode-symbol-regexp, for Python it's (python-rx (syntax symbol))
Utilize smartparens:

(defun smart-dash-maybe (&rest _)
  (when (require 'smartparens)
    (unless (member major-mode (append '(
                                         sh-mode ;commands with "-" are common
                                         cobol-mode forth-mode css-mode ;According to Wikipedia
                                         )
                                       sp-lisp-modes))
      (smart-dash-mode))))

But it requires an external package.


texts: Org presentation using "transitions": revealing items?

texts:
I want to use org-mode for presentations within emacs.

There seem to be a couple of libraries for this linked to by:

https://www.emacswiki.org/emacs/EmacsPresentation
http://sachachua.com/blog/2013/04/how-to-present-using-org-mode-in-emacs/

org-present and org-presie seem like the candidates, but neither seem to support the delayed revealing of child entries.

Example

I have an org file like

* One
** child1
** child2
* two
** child1
** child2

I want to be able to go through displays like

* One

then

* One
** child1

then

* One
** child1
** child2

then

* Two

then

* Two
** Child1

then

* Two
** Child1
** Child2


texts: Use several Emacs configurations/versions simultaneously

texts:
I want to use several emacs configurations/versions simultaneously so that no configuration disturbs each other, each with their own configuration directory and elpa repository.  I heard about the trick with symlinking ~/.emacs.d and ~/.emacs, but that is not what I want, because it'd be best if I can run my default emacs installation and simultaneously a testing installation (new emacs releases) or another setup like Spacemacs or Prelude.

Is there any decent way to do this?


texts: Often I have many buffers open and, for whatever reason, I no longer wish to use a particular minor mode with them. Is there currently a built-in way to disable a particular minor mode for all open buffers, or does this require writing a custom elisp function?


texts: Why is Emacsclient inserting quotes around output strings?

texts:
I would like to have output from Emacsclient without quotes, but

$ emacsclient -s my-server -e '(princ "hello")'

gives output:

"hello"

Expected output would be:

hello


texts: Open File and Directory: What's the Emacs command?

texts: I would like to set custom keyboard shortcuts for the Open File and Open Directory commands listed in the File menu. The only problem is that I don't know the corresponding Lisp commands. I've tried open-file but it doesn't work. I've tried Googling for the answer, but it too failed.


texts: how to solve conflicts between operating system shortcuts and emacs shortcuts?

texts:
In some cases operating system shortcuts takes precedence and in other cases emacs shortcuts takes precedence. what's the reason for this kind of behaviour?

Eg:

(Mojave shortcut) Command + shift + 5, screenshot utility take precedence over (Emacs shortcut) M-% (Command + shift + 5, query replace) when using emacs

(Emacs shortcut) C-M-f forward-sexp takes precedence over (Mojave shortcut) Control + Shift + F full screen when using emacs

Expected behaviour : Emacs shortcuts precedes when using emacs (could you provide solution for this)

Emacs version: 26.1 on macOS Mojave


texts: Can body-only exports be performed by default?

texts:
I have an org file:

#+TITLE: Hello!

Hello world!

I can perform a "body-only" export of this file to html by issuing C-c C-e C-b h h. Here, the C-b keystroke toggles the "body-only" variable from Off to On.

Is it possible to set the default value of "body-only" for my org file to On? It seems that something like

#+TITLE: Hello!
#+OPTIONS: body-only:t

Hello world!

should work.


texts:
Emacs blue (on dark background) is too dark. classA is readable with difficulty in the example below:

How to fix the dark blue colour?


texts: Why doesn't emacs store buffers internally as a tree (better random access, no line-number limitations)?

texts: In section 11.18 of the GNU Emacs Manual, it's mentioned that buffers with a large number of lines line-number-display-limit or with particularly long lines line-number-display-limit-width might experience slow performance with line number calculation and so line number calculation is disabled by default. It seems to me that using a tree-like structure you could get logarithmic-time insertion and random access if every subtree kept track of the number of elements in it. What advantage is there in doing things the way emacs does?


texts:
Recently I was looking for run emacs as daemon in linux, whats give me the oportunity to use org-carture from everywhere in the sistem for example. My first aproach was start it in the init.el file, but the I discover that I can run emacs --daemon in my sistem init, but there is a problem. when I try to exec: emacsclient -ne "(make-capture-frame)" which open a new frame directly in org-capture I get an error: *ERROR*: Unknown terminal type, but if I irun server from an emacs instance and not an emacsclient, The function works well so I cant find my mistake.

Anyone knows what it's happening?


texts: Part II -- Colorizing `functions/variables' within comments in `c-mode'

texts:
I have implemented the solution of Yasushi Shoji in a previous thread -- Colorizing `functions/variables' within comments in `c-mode' -- to highlight Lisp function/variable names in c-mode comments that begin with a back-tick and end with a single quote:

/* See the doc-string for `pos-visible-in-window-p'.  */

The function c-font-lock-doc-comments unfortunately does away with the ability to highlight the comment beginning/ending with font-lock-comment-delimiter-face, which is a member of c-literal-faces.  What happens is that the entire comment (except for the function/variable) gets highlighted with c-doc-face-name.

The unsophisticated approach is to redefine c-font-lock-doc-comments by removing or commenting out the offending code:

(c-put-font-lock-face region-beg region-end c-doc-face-name)

However, doing so will break the intended functionality for the three (3) other forms of predefined c-doc-comment-style -- i.e., javadoc, autodoc, and gtkdoc.

I am looking for a more sophisticated means to preserve the font-lock-comment-delimiter-face for comment beginning/ending and preserve the font-lock-comment-face for everything except the function/variable that is highlighted with Yasushi's solution.

The prior solution of Yasushi is as follows:

  (require 'cc-mode)

(setq yashi-font-lock-doc-comments
  (let ((symbol "[a-zA-Z0-9_-]+"))
    `((,(concat "`" symbol "'")
       0 ,c-doc-markup-face-name prepend nil))
    ))

(setq yashi-font-lock-keywords
  `((,(lambda (limit)
        (c-font-lock-doc-comments "/\\*" limit
          yashi-font-lock-doc-comments)
        ))))

(add-hook 'c-mode-hook
          (lambda ()
            (setq c-doc-comment-style '((c-mode . yashi)))))


texts: How to get the point position relative to thing-at-point?

texts:
When using thing-at-point to get a word or filename - for example, how can I get the cursor position relative to the text?

Either by getting the absolute starting location of the thing, or a relative character index.


texts: align doesn't indent multiple lines of C code correctly

texts:
This is my simple C code block:

int main() { // the enty function
        in x = 100; // my new variable
        for(int i=1; i<2012; ++i) { // loop a lot
                x -= i;
        }
} /* end of all things */

I want to indent this block into:

int main() {                        // the enty function
        int x = 100;                // my new variable
        for(int i=1; i<2012; ++i) { // loop a lot
                x -= i;
        }
}                                   /* end of all things */

But after I select this region and M-x align, it becomes:

int main() {                    // the enty function
        in      x  = 100;       // my new variable
        for(int i=1; i<2012; ++i) {     // loop a lot
                x -= i;
        }
}                               /* end of all things */

If align cannot handle all comments to the same column, that's fine, but I don't understand why this line of the code:

            in x = 100; // my new variable

becomes:

            in      x  = 100;       // my new variable

See, it adds multiple spaces around x. Why?

FYI: I did this in Emacs both with my .emacs.d and without my .emacs.d(emacs -q)


texts: Org-mode: How to render latex inside ~code~

texts:
This seems a catch-22: I want to render code in an org-mode export (html or latex pdf) where the snippet below done as a ~code block

> (cons 1 nil) \to (1)

actually renders \to as a proper right arrow (yields). Of course if I do the snippet as inline latex

$> (cons 1 nil) \to (1)$

I get the properly rendered right arrow, but now it's not in the sans mono code font. What can I do to have my cake and eat it too?


texts: how to make emacs follow links to files outside of org mode?

texts:
I'd like to embed a link to a file in say Python code, is there a way to let emacs know to look for org style links outside of org files?
Or is there a better way of achieving this?
Cheers


texts: Checking if there exists a buffer whose name starting with a particular string

texts:
According to the documentation the function get-buffer checks if there is a buffer with a specific name. More precisely

(get-buffer name)

Return the buffer named name (a string).
If there is no live buffer named name, return nil. See the related question on stackoverflow.

Is there a similar way to check if there exists a buffer whose name starting with a specific string?


texts:
I'm using Emacs24 on windows with AUCTEX for Latex.
When I try to toggle preview it doesn't show, insteed there is a little "not working" picture on each equation and I get an error

  Running `Preview-PDF2DSC' with ``pdf2dsc "region".pdf
  "region.prv/tmp9244b3d"/preview.dsc''
  Files\gs\gs8.71\bin\gswin32.exe/==/ was unexpected at this time.

  Preview-PDF2DSC exited abnormally with code 255 at Wed Sep  6 14:30:04
  PDF2DSC sentinel: Opening input file: No such file or directory,
  c:/Users/menis/Dropbox/master/LaTex/region.prv/tmp9244b3d/preview.dsc

Note: I checked and Emacs is able to read PNG files.
Also Latex-preview-pane is working properly so I guess ghostscript and doc-view are also working fine.

Any ideas what the problem is?


texts:
Emacs' indentation of Emacs lisp code is really great, except for one thing:

(defconst one-to-ten '(one two three
                           four five six seven
                           eight nine ten))

Is this actually the preferred way to indent this block? As opposed to

(defconst one-to-ten '(one two three
                       four five six seven
                       eight nine ten))

I find it especially confusing when compared to the default for alists:

(defconst one-to-ten '((one . 1) (two . 2) (three . 3)
                       (four . 4) (five . 5) (six . 6) (seven . 7)
                       (eight . 8) (nine . 9) (ten . 10)))

Is there a reason for this behaviour? I could possibly understand it for back-quoted lists, as it would yield better indentation for macros, but what about lists?


texts:
Basically, I want to ensure that the elfeed package is available and load it with use-package, but only on one computer, so I wrote something like this:

(unless (string= system-name "here-elfeed-shall-not-run")
  (use-package elfeed
    :ensure t
    :config
     (setq elfeed-feeds '(blabla doesnt matter))))

The problem is that even though the use-package part is not supposed to run (because system-name == "here-elfeed-shall-not-run"), it, in fact, runs.
I dealt with this by using an if keyword:

(use-package elfeed
  :if (not (string= system-name "here-elfeed..."))
  ...)

Which would be great, if I could still ensure that elfeed is available on the computer on which I want it to be.

What can I do to ensure that elfeed exists on one PC, but shouldn't be downloaded on the other?


texts: Yasnippet invoked org-time-stamp function inserts double timestamp

texts:
I created a yasnippet template to quickly timestamp a note I'd like to make in org-mode. The body of the yasnippet file reads

$0
:PROPERTIES:
:CREATED: `(org-insert-time-stamp nil t t)`
:END:

However, the effect is the CREATED property being populated with double inactive timestamps, e.g., :CREATED:  [2015-06-16 Tue 10:08][2015-06-16 Tue 10:08]. Why is this behavior occurring, and how do I prevent the redundant timestamp?

References:

Elisp - Avoid prompt in interactive function
in org-mode, how to insert timestamp with today's date?

Note: Trying either one of the methods described in the reference links yields the same doubled timestamp result.


texts: M-x compile and shell-command ignore default-directory

texts:
On one computer I use, my emacs will always run commands in my home directory, rather than the directory of the currently open file (i.e. default-directory).

A standalone reproduction is executing the following:

(let ((default-directory "/tmp/")) (compile "pwd"))

On the computer in question, it prints the path to my home, not /tmp as it does on all other computers-with-emacs I have access to. (The same thing happens with M-!/M-x shell-command.)

I recently installed 24.5 into my user folder (the global install is 23.4), and installed Emacs Prelude but the behaviour described above happened/happens in all configurations (it certainly happened before I made any modifications) and happens if I run emacs -Q (for both 24.5 and 23.4) to avoid reading my configurations (as lawlist asks).

If there's no obvious problem/fix, is there a good way to start to debug a problem like this?


texts:
I have the following line in my .init.el

(ansi-term "/usr/bin/bash")

, because I usually like to have a terminal running in my emacs. The problem is that sometimes I don't, for instance, when I just do some quick edit, like when I git commit. In this case, exiting emacs involves prompts about running processes, and usually I like these safety warnings. I know I can create an alias something along the lines of

alias emax='emacs --eval "(ansi-term \"/usr/bin/bash\")"'

This leaves the normal emacs command unchanged and everything would be fine, if I only start emacs from terminals. If I want to start it from the "Start" menu however, then I'm out of luck again.

So, the question is, is there some clever mechanism, where emacs usually starts with an ansi-term, but somehow knows, when I don't want one. One such possibility would be creating something like a custom emax.desktop file, but I'd also have to use the alias above and I'd like to avoid maintaining code in two different places.

So hopefully this question is understandable. I'm open to any linuxy hints, but simpler is better of course.


texts: Avoid spurious buffers with helm-find-file

texts:
I have C-x C-f bound to helm-find-files. Mostly this works really well, but if I hit TAB when there are no completions for an item (most often because I've fumble-fingered the directory or filename that I want completed) Helm unhelpfully creates a buffer with that mangled name.

Anyway to prevent that?


texts:
Windows 10, Emacs 25.1, Dired+

Suppose I has folder

d:\TEMP\test\com\myproject\android\common\

Here:

I want in dired mode by one step to rename full path to net\newproject\iphone\data.
So as result I want to get the next path:

d:\TEMP\test\net\newproject\iphone\data\


texts: Linking source file in org mode with specific revision

texts:
I need org-mode version of links like this https://github.com/emacs-mirror/emacs/blob/cd2c1561636597c67edbf3daf10388e5385a93fc/etc/NEWS#L1119 for local files inside local repo.

A way to specify not only the line and file that I want to link locally but also its version so when the file visited the specified revision will be displayed.

Example: file:my_versioned_file.el::<GIT_HESH>::<LINE_NUMBER> should visit local my_versioned_file.el file at <GIT_HESH> revision and line <LINE_NUMBER>


texts: Org mode headlines without bold font inside emacs

texts:
Is it possible to set org-mode to show the headlines inside emacs without bold font?
My emacs:

* Headline 1    <-- This is bolded
a paragraph       <-- This is not bolded
**  Headline 2   <-- This is also bolded

I would like to have:

* Headline 1        <-- Not bolded
a paragraph        <-- Not bolded
** Headline 2      <-- Not bolded

Note: I have found a set-up that eliminates all fontification from the headlines:
(setq org-level-color-stars-only t)

but I would like to keep colors and just eliminate boldness from the headlines at all levels.
Hopefully my question is understandable.
Thx!


texts: I want to write some AppleScript to raise individual Emacs frames, with a given name. Also to send keyboard events to those frames, and to resize and position them. I think that Emacs is "unscriptable," but I am not sure if there is a way to do this nonetheless. Can anyone help?


texts: can show-trailing-white-space be forced to ignore blank lines

texts:
I'm trying to use the flag show-trailing-white-space and it usually shows me what I want.
I.e., I never want dangling white space at the end of a line containing text.   However,
between lines of text, I really don't care that there is white space.   In fact, the
editor enforces white space which is for indentation purposes.

In the image shown here, the red mark between :empty-set and :else is really annoying,
but the red marks at the end of the other three lines is helpful.

Is there a way to tell show-trailing-white-space either to ignore any whitespace starting at the beginning of a line, or perhaps ignore indentation white space, or perhaps ignore whitespace before the first non-white-space-character?


texts: Creating function to move top-buffer to other window

texts:
TL;DR: Any suggestions as to what function(s) can help me restore (to any given window) the buffer that was visible most recently?  It's important that the currently visible buffer is not killed, just moved to the back.

This is partly an exercise in Elisp for me so my preference is for building such a function myself instead of using off-the-shelf packages.

The long version:

I'm trying to create a function which effectively "throws" a newly created buffer to the other window.  I've captured some but not all of the necessary functionality.

An example:

Let's say that my current frame is split vertically into two windows,
|Window 1|Window 2|; I'm editing foo.el in Window 1 and
some-junk.el in Window 2.
Now, let's say that I open a file
bar.el which I want to see alongside foo.el (via ido, helm,
etc.).
However, I accidentally opened bar.el in in Window 1,
thereby covering up foo.el.
(I find myself in similar non-accidental situations, hence the motivation for such a function)

The goal is to have a function which will "throw" bar.el to Window 2, i.e., two steps: (i) have Window 2 show bar.el and (ii) have Window 1 show foo.el.

So far, I've been able to come up with an implementation of (i) but am stuck on (ii).  in other words, I can get Window 2 to show bar.el but I'm having trouble getting Window 1 to revert to foo.el:

(defun dc/move-top-buffer-to-other-window ()
  (interactive)
  (let* ((current (selected-window))
         (other   (next-window))
     (current-buffer (window-buffer current)))
     (set-window-buffer other current-buffer)
     (other-window 1)))

I thought there might be a variable that represents a notion of "buffer-order" for each window (e.g., in the example 1, such a variable for Window 2 would hold a list of buffers in the following order, as per the example above, [bar.el foo.el ...]), since Emacs is able to "remember" which buffer I had open last.  But I haven't been able to find it.

Any suggestions?


texts:
I am migrating from GNU/Linux to Mac. I am using an MS Windows numeric keyboard (Logitech K200), and I cannot seem to map the keypad keys (kp-N) into anything (I had been doing that using global-set-key in my .emacs).

When I run describe-key and press a key I see it gets translated to the related number key, e.g. describe-key then press kp-5 yields: 5 (translated from <kp-5>) runs the command Custom-no-edit....

Similarly for Ctrl-/Meta-/Shift-. Adding e.g. (global-set-key <C-kp-5> 'goto-line) to my .emacs does not change anything that I can see, so I assume the translation is happening before the key mapping.

How can I disable the translation of all the kp-Ns so I can redfine them using global-set-key?


texts: Treemacs stops working when global-visual-fill-column has been enabled manually

texts:
As @drew asked me to do here I'm asking one question per problem
I'm trying to enable/disable visual-fill-column when there is one window/multiple windows.
(defun my-visual-fill-one-window ()
  (global-visual-fill-column-mode -1)
  (if (one-window-p)
      (global-visual-fill-column-mode 1)
    (global-visual-fill-column-mode -1)
    )
  )

(add-hook 'window-state-change-hook 'my-visual-fill-one-window)

Treemacs stops working (I can't open its window) with the following error:
treemacs--popup-window: Wrong type argument: window-live-p, nil


texts:
Is there a way to make pdf-export of files named in russian?

I use xelatex which is set up like:

(setq org-latex-pdf-process
      '("xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"
        "xelatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

latin named files are ok to be exported, but if I name it Документ.org then there is an error:

*messages*

org-latex-compile: PDF file ./Документ.pdf wasn't produced

*Org PDF LaTeX Output*

This is XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016/W32TeX) (preloaded format=xelatex)
 \write18 enabled.
entering extended mode
! I can't find file `'"c:/Users/user/org/work/Документ.tex"''.
<*> .../work/Докуметн.tex"'

(Press Enter to retry, or Control-Z to exit)
Please type another input file name
! Emergency stop.
<*> .../work/Документ.tex"'

No pages of output.
Transcript written on .//texput.log.


texts: When to call find-font if launching emacs in daemon mode?

texts:
I would like to use certain unicode characters in the mode-line only if the Symbola font is available on the system.

So I put this in my emacs config and it's a great way to check if those fonts are available for a regular, non-daemon emacs session

(defvar font-symbola-p nil
  "If non-nil, Symbola font is available on the system.")

(when (find-font (font-spec :name "Symbola"))
  (setq font-symbola-p t))

But when I run emacs using emacsclient -a '' -c aka daemon mode, the value of font-symbola-p stays nil.

It seems as if emacs reads the "font database" at some point after the above code is eval'd from my config.

Q:
What is the right time to call find-font when running emacs in daemon mode?

PS: I tried the below too but that too didn't work ONLY in daemon mode.

(add-hook 'window-setup-hook
          (lambda ()
            (when (find-font (font-spec :name "Symbola"))
              (setq font-symbola-p t))))


texts: How to reference the contents of a variable in a keyboard macro definition?

texts:
I have a macro called f5, which I globally bind the keyboard key <f5> to:
(fset 'f5
      [?i ?\[ ?* ?* ?P ?1 ?  ?\] escape ?h ?a])

(global-set-key (kbd "<f5>") 'f5)

So when I press f5, it inserts [**P1 ], and backs up the cursor and leaves me in input mode, which is fine.
But I have reached a stage where, depending on what I am doing, I don't want it to always insert "P1". Sometimes I might like it to insert, say, "P2". What I really want is that it inserts the content of a variable, which variable I can set depending on what I am doing.  But I don't know how to reference the contents of a variable in a macro definition. Surely this is possible; how is it done?


texts: What are good tools for Emacs package development?

texts: We already have a question about tools useful specifically for testing, but what about actually writing the code?  Which packages do you find speed up your development?  Which aids do you use to quickly and easily navigate and understand your projects?


texts: emacs ruby mode: can I reorder methods in file (alphabetical order)

texts:
After opening the file

app/controllers/pages_controller.rb

Which has

class PagesController < ApplicationController
   def foo
     puts "foo"
   end

   def baa
     puts "baa"
   end

end

I want to add a function/method to this file, but before that
I would like to tell emacs to reorder things so that def foo
comes after def baa because of alphabetical order.


texts: I want company-mode to show completions list after the second character

texts:
When typing in a buffer with company-mode the completions popup shows after typing the third character:

Is it possible to do this after typing the first or second charater?


texts: How to setup ediff to open a new frame with the two comparison buffers

texts:
When I issue M-x ediff-buffersI'd like ediff to create a new frame with the two buffers (and close this frame when done with the comparison). How can I customise ediff to do so?
I tried
(defun leo-ediff-before-setup ()
  (make-frame))
(add-hook 'ediff-before-setup-hook 'leo-ediff-before-setup)

but this sets the initial frame and a new frame up for the comparison.


texts: How many Python REPL's are there for emacs and their relative merits?

texts:
How many Python REPL's are there for Emacs and their relative merits?
What OS have you tested them on?
How long have you been using them?
What version combos of python/emacs/ repl integrating software have you used and the problems you encountered.
I would like to hear your experiences.
This thread
How do you create a robust Python IDE with Emacs (as the Text editor)
is about creation but does not compare and does not use the string REPL even once as I tried now.


texts: Why is M-x remapped in ansi-term char mode?

texts:
I understand that you can use M-x in ansi-term's char mode by doing C-x M-x, but why can't it just be used normally? Is there some historical reason? I can use other meta commands (like M-f or M-b), why does M-x need the C-x prefix key?
(Also, I understand that M-x works normally in line mode.)


texts:
If you used shell-mode for a while, you probably ran into situation where there's a process spitting lots of output very fast, so that C-g and C-c C-c don't really help.
One way I found to be somewhat efficient to deal with this problem is: now I have an interactive function bound to C-c y to kill the process associated with the shell buffer and then start a new shell buffer.
It sort of works, but isn't perfect. The obvious problems are: it loses the state of the shell (current directory, SSH session, Python's virtual environment, just environment variables I set in that shell...). Some seem easier to work around, while others are quite a bit harder... anyways, this doesn't seem like the best option I have there. And, truth be told, it's still slow.
So. What would be the better way to deal with this problem?


texts: Exporting org mode includes as latex lstinputlisting, or equivalent

texts:
Latex has the ability to include the contents of a file using the lstinputlisting command.  When exporting an org-mode file to latex #+include: somefile inserts the file contents at that point in the document, this makes sense for org files, but for many files it would make more sense to use the listing command when exporting to latex. Is there a way to do this?

Edit:
Here's some examples of what the org code and respective latex code would be.  One file is a plain text file, the other is marked as a c file so that it gets syntax highlighting.

In the .org file:

#+INCLUDE: results.txt
#+INCLUDE: main.cpp src C++

In the .tex file:

\lstinputlisting[]{results.txt}
\lstinputlisting[language=c]{main.cpp}

The main advantage with using the lstinputlisting over copy/pasting the file contents into the latex document is when the exported document will be edited further. The listing makes it more readable and allows easily incorporating changes made to the included files.

Edit: I've looked a little bit at exporter's source code, and I'm not sure this is possible at the moment.


texts: Change major mode for buffer without a corresponding file

texts:
I want to change the major mode from fundamental-mode to compilation-mode for a buffer which contains some generated output named for eg. *results*. I've tried to add an entry to auto-mode-alist but if i understand correctly this works only with buffers which have a corresponding filename.

I've tried to add it in the list like this but this is not working.

(add-to-list 'auto-mode-alist '("\\*result\\*" . compilation-mode))

  UPDATE:

After some digging in I found that this particular lisp snippet is filling the buffer with data.

(start-process "result" "*result*" "some_unix_command")

  UPDATE:

This buffer is generated from a 3rd party plugin so i'd rather not start and change the src lisp code. I'd like to handle this on a different level.

I've already checked if I can attach a hook somewhere where the buffer is created and the answer is negative.

Anyone with some ideas on how I can do this?


texts: using prefix binding along with Key-chord binding

texts:
I am using my capslock key as a prefix key and have already set "capslock-v" to 'helm-show-kill-ring. This however does not work with copying outside code into emacs so now I want a set up as such:

capslock-v (wait 1 sec) 'helm-show-kill-ring

and

capslock-vv 'yank

Is it possible to do this? Here is the relevant portion of my .emacs

(setq w32-enable-caps-lock nil)

(progn
  ;; define a prefix keymap
  (define-prefix-command 'my-modes-key-map)

  (define-key my-modes-key-map (kbd "v") 'helm-show-kill-ring)
  (key-chord-define my-modes-key-map (kbd "vv") 'yank)

  )

(global-set-key (kbd "<capslock>") my-modes-key-map)


texts:
Is it possible to use org mode tags :LIKE_THIS: inline in the heading text, the way #twitter_style tags are used elsewhere?

If I add any text after a :tag:, it stops being highlighted as a tag, and C-cC-q stops to recognize it, too.

On the other hand, I would like to avoid duplicating text in a header, like below:

*** TODO Make foo use bar           :foo:bar:


texts: How to append contents of multiple files into one file?

texts:
Emacs 26.1, Windows 10, Dired+

How to append contents of multiple files in one folder into one file?


texts:
Some of my major modes, installed via ELPA, error during load as, for instance for markdown-mode,
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "../../../../.emacs.d/elpa/markdown-mode-20210405.1...")
  markdown-mode()
  set-auto-mode-0(markdown-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)

. I've tried understanding why the load-path is relative and doesn't work. But without any clues. Need help.
Update:
After having set debug-on-message I've found some more clues.
The error is trigger by the expression
(with-demoted-errors "File mode specification error: %s"
(set-auto-mode))
in the function normal-mode when I open a D (.d) file.
Prior to the call to with-demoted-errors the load-path looks ok and does not contain any relative paths. I'm attaching a screen from the EDebug session.
Several other elpa packages such as magit are affected. I don't see any common property of those failing packages.
The let of the variable enable-local-variables sounds suspicious...


texts:
In emacs with helm, I can C-x C-f find file. After type part of the folder name, helm find the right folder. At this point, I can

hit Enter to enter Dired mode. and C-s to search a second level folder...
or hit tab to complete the folder name, and continue type part of the second foler name.

Is there a way to find-file quicker like in the sublime text editor? (fuzzy search both the file names and folder names).


texts:
I'd like to register an after-save-hook that is only active in certain buffers that I specify.

For example, assume there are 3 functions currently registered in my after-save-hook: hook-01, hook-02, and hook-03. In all cases after save-buffer is called, I'd like hook-01, hook-02, and hook-03 to be invoked, and I realize that this is the normal after-save-hook behavior.

However, in certain buffers and only those buffers, I want an additional hook, special-hook, to also be called after save-buffer is invoked, so that in these special buffers, all 4 hooks are run after the buffer is saved.

Is there a way to register a hook function that is added to after-save-hook only within certain specified buffers?

I control when those special buffers are entered, so I can cause special elisp code to run upon entry into those buffers. I just don't know how to specify a hook that is only valid in a given buffer.


texts:
When running ert tests, the seem to be run by default in string< order. For instance running tests

(require 'ert)
(ert-deftest t1111 () (print 'AAAA))
(ert-deftest t3333 () (print 'BBBB))
(ert-deftest t2222 () (print 'CCCC))
(ert-run-tests-batch :new)

will print

;; Actual output              ;; Wanted output

AAAA                          AAAA

   passed  1/3  t1111            passed 1/3  t1111

CCCC                          BBBB

   passed  2/3  t2222            passed 2/3  t3333

BBBB                          CCCC

   passed  3/3  t3333            passed 3/3  t2222

For interpretation it would be helpful to guarantee the order of the tests. How can this be achieved?


texts:
Indentation for R inside functions seems to be broken for pipes and '+'s:

f <- function(something){
    mutate(something, l="aaaa") %>%
        select(l) %>%
            str_replace("a", "A") %>%
                tolower()
}

The same happens with ggplot.

Is there anyway of fixing this behavior?


texts: org-file with embedded latex and pseudo code converting to html via MathJax

texts:
I would like to use org-mode files with embedded latex code.
Some of the latex content is based on packages like

\usepackge{algorithm, algorithmic}

to generate pseudo-code.

These org-files should be converted to HTML via preferably MathJax,
without intermediate steps.
My trials so far have yielded complete failure.

For instance, if I would like to use ORG --> MATHJAX --> HTML for
the following example, what is needed ?

#+begin_src latex :results html replace :exports results :eval t
\begin{algorithm}
\caption{Calculate $y = x^n$}
\begin{algorithmic}
\REQUIRE $n \geq 0 \vee x \neq 0$
\ENSURE $y = x^n$
\STATE $y \leftarrow 1$
\IF{$n < 0$}
\STATE $X \leftarrow 1 / x$
\STATE $N \leftarrow -n$
\ELSE
\STATE $X \leftarrow x$
\STATE $N \leftarrow n$
\ENDIF
\WHILE{$N \neq 0$}
\IF{$N$ is even}
\STATE $X \leftarrow X \times X$
\STATE $N \leftarrow N / 2$
\ELSE[$N$ is odd]
\STATE $y \leftarrow y \times X$
\STATE $N \leftarrow N - 1$
\ENDIF
\ENDWHILE
\end{algorithmic}
\end{algorithm}
#+end_src

If I evaluate this example via C-c C-c,
within the org file, I obtain the same thing with the following

#+RESULTS:
#+begin_export html
 same code as above
#+end_export

(The resulting html side though has that not correctly rendered at all ...)

My preamble looks something like this.

#+HTML_HTML5_FANCY:
#+HTML_INCLUDE_SCRIPTS:
#+HTML_INCLUDE_STYLE:
#+HTML_LINK_HOME:
#+HTML_LINK_UP:
#+HTML_MATHJAX: align: left indent: 5em tagside: left font: Neo-Euler
#+INFOJS_OPT: view:info toc:t
#+LATEX_HEADER: \usepackage{tikz}
#+LATEX_HEADER: \usepackage{amsmath}
#+LATEX_HEADER: \usepackage[linesnumbered, ruled]{algorithm2e}
#+LATEX_HEADER: \usepackage{algorithm}
#+LATEX_HEADER: \usepackage{algorithmic}
#+OPTIONS: ':t *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline author:t c:nil
#+OPTIONS: creator:comment d:(not LOGBOOK) date:t e:t email:nil f:t inline:t
#+OPTIONS: num:t p:nil pri:nil stat:t tags:t tasks:t tex:t timestamp:t toc:t
#+OPTIONS: todo:t |:t
#+CREATOR: Deloitte  (version 0.0.1)
#+DESCRIPTION:
#+EXCLUDE_TAGS: noexport
#+KEYWORDS:
#+LANGUAGE: en
#+SELECT_TAGS: export
#+OPTIONS: html-postamble:auto html-preamble:t tex:t
#+HTML_DOCTYPE: HTML5
#+html_head_extra: <link rel="stylesheet" type="text/css" href="code.css"/>


texts: Unable to load bookmarks list on emacs master

texts:
Whenever I try to execute bookmark-bmenu-list (which loads the bookmarks file), I get the following error: bmkp-multi-sort: Symbol’s function definition is void: bmkp-info-cp.

I am running on emacs master build version: GNU Emacs 26.0.50 (build 1, x86_64-apple-darwin16.6.0, NS appkit-1504.83 Version 10.12.5 (Build 16F73)) of 2017-07-08 on Mac OS Sierra.


texts: Replicate ipython history behaviour in Emacs

texts:
Say, we've entered the following in the normal ipython shell.

In [1]: 1+1
Out[1]: 2

In [2]: 1+2
Out[2]: 3

In [3]: 2+4
Out[3]: 6

If I now enter:

In [4]: 1+

and press the up arrow key, ipython will offer +1 and +2, i.e. I can skip over 2+4. How do I replicate this behaviour using Emacs' ipython shell (IPy mode).


texts: How to make Lisp state a default instead of normal?

texts:
I'm learning Clojure and Emacs at the same time  I use Spacemacs with Evil.

Recently I've learned about Lisp state and I find it very handy. The only problem is that whenever I switch to insert state to type some code and then leave it, I end up in normal state and have to go back to Lisp state with SPC k ., which is quite a streak. In Clojure (including Cider REPL) I find Lisp state superior to normal, so I would like to have it like that:

When entering Clojure buffer start in the Lisp state
When leaving insert / visual / etc., e.g. by pressing ESC - go to Lisp state
When pressing ESC in Lisp state - go to the normal state
When pressing ESC id normal state - go to Lisp state

So basically, in Clojure mode, I want to make Lisp state a default, just like normal is right now, with additional feature of having ESC switch between the two.

Does it make sense? Is it possible? I bet it is :) How?


texts:
I am trying to figure out how to add autoload features to a private library. Let's say I have developed a private Lisp library "my-lib.el". It consist of a set of functions, some can be used from any mode, others are only used for a particular mode. According to the manual I could put a autoload cookie above each function definition, and then call update-file-autoloads. Is this correct? But when do I call update-file-autoloads? In the beginning of the Emacs init file?

For example, in my ~/.emacs init file, I could write:

(update-file-autoloads "my-lib.el")
(require 'my-lib)

Where in "my-lib.el"

;;;###autoload
(defun my-func()
  (interactive)
  (message "Hello"))

;;; more functions, omitted here...

(provide 'my-lib)

But this gives error from update-file-autoloads if the file is not in the current directory. Or if "my-lib.el" is in the current directory, I get the error: Wrong type argument: stringp, nil.

My aim is to be able to type M-x my-func (as an example), and my-func should autoload at that point if this was the first time I called it.


texts: How do I use keys bound to a command with universal argument in Spacemacs?

texts: In spacemacs, a lot of commands have bound keys such as leader x a. For those commands that accept universal argument, how can I pass them to these command with key bindings? leader space leader x a does not seem to work.


texts: How to quickly format selected code in org-mode?

texts:
When input some code in orgmode, I can type:

<s Tab

and it expands to this:

#+BEGIN_SRC cursor

#+END_SRC

This is fine for writing something from scratch. But most of the time, I'd copy some paragraph which contains some code. (Code interposed in paragraphs).

In this scenario, after Tab, I have to select the code snippet, cut and paste them between BEGIN and END. Or cut the END_SRC, paste it at the end of the code.

Is there a way to do this automatically?

The ideal process would be:

Select some code
run a command, the code is well formatted by the BEGIN, END markdowns.


texts: When I enter a new line the cursor always jumps to the column which was the starting column the line before! I would like for the curser to stay in the first column until I hit enter!


texts: Extra output after every command running zsh in terminal

texts:
When running a command in the *terminal* in emacs, I always have the command I executed repeated twice with some extra text before the output of the command.

For instance:

$ echo "test"
2;echo1;echotest
$ cd ~/a_path
2;cd1;cd

Any idea why this might be happening? I'm using yadr for my zsh configuration (I'm trying out emacs from vim) and spacemacs for emacs.


texts: Why doesn't this script set package-archives in Aquamacs?

texts:
This is the script I used to initialise packages in emacs:

Inside ~/.emacs.d/init.d

(load (expand-file-name "package_init.el")
      user-emacs-directory)

Inside ~/.emacs.d/package_init.el

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/") t)
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

These two scripts work well in emacs 24.

However it does not work in Aquamacs (melpa is not added to the variable package-archives)

I have already verified that aquamacs reads init.el when it starts. Here is the start up message in *message* buffer

Loading prestart plugin files ...
... done.
Wrote /Users/antkong/Library/Preferences/Aquamacs Emacs/Packages/.nosearch
Shell: /bin/zsh
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/Recent Files.el (source)...done
Cleaning up the recentf list...done (0 removed)
22 environment variables imported from login shell (/bin/zsh).
Loading /opt/homebrew-cask/Caskroom/aquamacs/3.2/Aquamacs.app/Contents/Resources/lisp/aquamacs/edit-modes/auctex.el (source)...done
Loading plugins ...
Loading /opt/homebrew-cask/Caskroom/aquamacs/3.2/Aquamacs.app/Contents/Resources/lisp/aquamacs/site-start.el (source)...done
... done.
Loading `custom-file' failed.
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/Preferences.el (source)...done
Mark set
one-buffer-one-frame-mode disabled.
Mark set [26 times]
Loading /Users/antkong/Library/Preferences/Aquamacs Emacs/frame-positions.el (source)...done
file-error: (Opening directory no such file or directory /Users/antkong/Library/Logs/CrashReporter)
Mark set [5 times]
Aquamacs is based on GNU Emacs, a part of the GNU/Linux system. It is Free Software: you can improve and redistribute it under the GNU General Public License, version 3 or later. (C) 2014 Free Software Foundation, and D. Reitter. No Warranty.


texts:
I running Emacs 25 on Debian 9.0 stretch. The version is 25.1+1-4+deb9u1.

I have a local copy of AUCTeX installed via Melpa. The relevant line in M-x list-packages is:

auctex           11.88.3       installed       Integrated environment for *TeX*

See the screenshot below. The text

\url\expandafter{\

in the macro \PrintDocTable is highlighted in brown and is a larger size for no apparent reason. This is also messing up bracket matching, which is really what bought it to my attention. For me, this falls into the trivial bug aggravating category.

Suggestions to debug are appreciated.

If I copy this to another file, this issue disappears.
Copying between buffers in emacs also makes the issue disappear.
Running M-x latex-mode also makes the issue disappear, but it
reappears on re-opening the file.


texts: M-x shell's M-r doesn't search bash_history

texts:
All,
When I in the emacs shell (run by M-x shell) and press M-r, it only search a very limited command history and doesn't search the bash_history file. But it is said Emacs shell will read my bash's history file to initialize it's history (https://www.gnu.org/software/emacs/manual/html_node/emacs/Shell-Ring.html). How can I make M-r in shell to search the bash_history?


texts:
In particular, I am using undo-tree-undo.

When I type a few words in a line, and undo, all those words disappear. Same thing happens when I type a function name and screw up a couple of symbols in the end - undo eats up the whole line.

Is there a way to adjust how eager undo is?

(Similar question for native undo: fine-grained undo)


texts: Programmatic access to a heading's todo state changes

texts:
Is there a mechanism in org-mode to programmatically extract all TODO keyword/state change information from a heading?  For example with the following:

* DONE Test
- State "DONE"       from "CANCELED"       [2017-10-20 Fri 15:50]
- State "CANCELED"   from "WAIT"       [2017-10-20 Fri 15:33]
- State "WAIT"       from "TODO"       [2017-10-20 Fri 15:14] \\
  Foo
  bar
  baz
- State "TODO"       from "WAIT"       [2017-10-20 Fri 15:14]
- State "WAIT"       from "TODO"       [2017-10-20 Fri 15:11] \\
  Waiting for something

Obtain a list of alists/plists- each with the old-state, new-state, timestamp string, and the possibly multiline note.  If not- what would be a robust approach to do so?

Some observations:

A close relation to these state changes are clocking entries, but they follow a different structure.  Are there other similar such entries used elsewhere in org-mode?
State entries may be intermixed with clock entries- at least.
There is commonly variation in indentation.
State and clock entries may optionally be constrained to drawers (per the org-log-into-drawer and org-clock-into-drawer values).
A drawer is probably necessary to unambiguously extract a final note value.

If the format is used by org-mode for encoding other types of information a more generalized solution would be fine.


texts: What is the select word/symbol function bound to

texts:
I love the ability to select word/symbol at point which I currently do with double mouse click.  I would like to be able to do it from the keyboard, and so I'd like to bind it to a keystroke (or maybe it already is?), so I need the name of the function.  I assume the function must already exist, but I cannot figure out what it's name is.

I tried C-h k but then when I double click the mouse the help for <down-mouse-1> shows up (I assume the help system doesn't wait for the second click or something).  I also searched the documentation where this functionality is defined in section 21.2, but it does not say the name of the function.

Update: For typical keybinding I suppose it is the equivalent to <C-left> followed by <C-S-right> which are left-word and right-word respectively, although the shift key is held for the latter.  (I do not fully understand the relationship between keyboard designations with the shift key and their mapping to functions, the help for <C-S-right> translates it to <C-right> before it identifies it as right-word)


texts: How can I set and retain font size of the solarized-theme?

texts:
I like the solarized (light) theme in emacs but i have a 27" mac so the font is too small.
I know I can enlarge with C-x C-+ but I do not know how to set the font size and retain that setting so I need not change manually.
Any advice?
Thanks


texts:
Here is my environment:

project A is on the server. My PC connects to the server by 1 Gbit ethernet. Ping latency between PC and server are about 0.3 ms.
project A's source code size is about 75 MB. But its ".git" directory is about 800 MB.

My magit is quite slow. Run magit checkout to another branch (with nothing different between these 2 branches) in project A could take as long as 25 seconds.

Here is my profiling info for checkout to branch:

I've checked the performance tips in magit doc and tried it, but no obvious improvement.


texts: local-function-key-map gets overwritten by emacsclient

texts:
The following .emacs file works as expected, so long as I invoke emacs the "normal" way (ie by launching the emacs executable directly).

(global-unset-key (kbd "C-]"))
(global-set-key (kbd "H-C-]") 'abort-recursive-edit)
(define-key local-function-key-map (kbd "C-]") 'event-apply-hyper-modifier)

But when I start emacs via emacsclient -n -c -a  "", the value of local-function-key-map gets overwritten somewhere along the way.  I have used print statements to make sure that my .emacs file is getting run, and that the value of local-function-key-map gets updated.  But by the time I land in the *scratch* buffer, my binding is missing from local-function-key-map.

Has anyone experienced this before, or knows a reason why local-function-key-map would get clobbered when starting emacs via emacsclient?

I am running emacs-25.1 on CentOS 7


texts: How remove the numbers and cross on Elscreen tab?

texts:
I use Elscreen, a sort of screen ulitily manager.

It's like tabs like you have in Chrome. I use when I have too many buffers/windows to handle it, and when I run 2 different projects next to each other. I know there are other alternatives, but for now it suits me.

There is ony thingy that drives these fanatical tinker crazy. I can't change the way how the tabs looks. I added a screenshot:

As you can see, you see [X] # which # stands for number. I would like to remove the [X] # by default in all Elscreen tabs. When I took a dive in the source code of Elscreen, I couldn't find where he defines the numbers, so that I could disable it in my Emacs init setup.

I ever thought Lisp was easy, but I can't really find any numbers and cross defined to disable it.

Any input would be appreciated.