texts: Apply function to a list until first success (non-nil) and return this value

texts:
I have little experience with CL/ELisp and don't know any function that iterate list and apply another function until get non-nil value, which is returned from loop, leaving rest list unprocessed.

It like lazy mapcar or merged or with apply.

For example I like fold while loop into more declarative code in:

(defvar autobm-try-thingatpt-things
  '(symbol url email))

(defun autobm-try-thingatpt ()
  (let ((things autobm-try-thingatpt-things) name)
    (while (and things (not name))
      (setq name (thing-at-point (car things)))
      (setq things (cdr things)))
    name))

UPDATE With answer of I rewrote code to:

(require 'cl-lib)

(defun autobm-try-thingatpt ()
  (cl-some #'thing-at-point autobm-try-thingatpt-things))

It look elegant! Only question to experienced elispers why cl-extra does not provide itself? So I must use (load "cl-extra")  instead of (require 'cl-extra)...


texts: Longer flashing of search string during multi-file searches

texts:
When the cursor is in the *xref* buffer, following dired-do-find-regexp, the found string in the adjacent frame flashes, but too briefly, making it quite hard to see.

A simple solution is to increase the duration of the pulse of the found string.

The code goes through the following functions in xref.el(.gz):

(On macOS: /Applications/Emacs.app/Contents/Resources/lisp/progmodes/xref.el.gz)

xref-next-line
xref-show-location-at-point
xref--show-location
xref--show-pos-in-buf
xref-after-jump-hook
xref-pulse-momentarily
pulse-momentary-highlight-region

and the calls continue in pulse.el.gz:

(on macOS: /Applications/Emacs.app/Contents/Resources/lisp/cedet/pulse.el.gz)

pulse-momentary-highlight-region
pulse-momentary-highlight-overlay

It would be enough to increase pulse-delay

defcustom pulse-delay .03

but that doesn't change the pulse time.

How can I increase the duration of the pulse?

This is a sequel question.


texts: `mouse-1` (button 1) follows links, like `mouse-2` does - how to modify the behavior?

texts:
I'm a beginner in Emacs.

In dired+, if I query the mouse click on a directory item with C-h k, I get the following:

----------------- up-event (short click) ----------------

<mouse-2> at that spot is remapped to <mouse-2>, which runs the
command dired-mouse-find-file-other-window, which is an interactive
compiled Lisp function in `dired+.el'.

...

----------------- up-event (long click) ----------------

Pressing <mouse-1> at that spot for longer than 450 milli-seconds
runs the command mouse-set-point, which is an interactive compiled
Lisp function in `mouse.el'.

Can I set these "short" and "long" clicks somewhere? I couldn't find anything about mouse-up events; is this specific to dired+? Also, it seemed to me that the short click is mapped to mouse-2 somehow; if I set mouse-2, then the mouse-1 short click changed accordingly. I find this a bit annoying though, because I can't set mouse-2 and the mouse-1 short click to different commands. I'd like to also be able to set them differently.


texts: How to publish a HTML manual with each (sub)sections as a separate page and a front page with TOC?

texts:
I am using org-publish to generate a static web site. I have a large org file with many subtrees (max depth 5).
I'd like to be able to generate a site very similar to the org-mode manual where each section is its own page and a TOC front page with links to all the subsections. Is this possible with org-publish? I assume the org-mode manual is made with standard org tools??
My basic understanding of org-publish is that each html page needs its own .org file. That would be a nightmare for me to split up by big org file into subfiles (one per subtree) and put them into a nested folder structure. Ugh.... I hope there is a smoother way.
I am aware that ox-hugo and other packages exist.... hoping this can be done readily with org-publish itself.
The org-mode manual also comes in a complete version: 1 html page with everything included, i.e., all sections included in one long web page. I am able to make a single html file like this using org-export.

After searching, I found the related (if not exact) query here. One of the answers points to makeinfo(which resonates with @NickD comment below)


texts:
Now I read lots of good stuff about spacemacs and want to try it out.
I like the way iterm2 separates hosts/projects cleanly.
Can I use iterm2 + spacemacs (maybe in terminal mode?)
Or do I lose most of spacemacs functionality if I don't use gui


texts: I installed Smalltalk from source which comes with its own mode. The files smalltalk-mode.el and smalltalk-mode.elc are placed in /usr/local/share/emacs/site-lisp/ and this path is in my load-path but Emacs can not recognize .st files as Smalltalk mode. I also tried (require 'smalltalk-mode) in my init.el, but didn't help. Why is this happening?


texts:
Sorry, but elisp is not my best.
I need to combine two lists of strings in this way:

("a" "b" "c") + ("d" "e" "f") -> ("a" "b" "c" "d" "e" "f")

Well, the order is not important, so I wrote this code:

(while lista
  (add-to-list 'listb (car lista))
  (setq lista (cdr lista)))

It works, but I'm wondering if there's a function that already does this.

Any clue?
Thanks in advance.


texts:
I have free-form text logs with JSON-ish objects that I would like to selectively hide when analyzing the logs. They look something like this

2018-10-09 09:47:34.269 [T] T {

2018-10-09 09:47:34.269 [T] T   {

2018-10-09 09:47:34.269 [T] T      foo

2018-10-09 09:47:34.269 [T] T   }

2018-10-09 09:47:34.269 [T] T }

and I might want to collapse the inner pair and not show the line with foo on it, for example.

As far as I can figure out, hideshow.el does this, but I have not managed to enable it for text mode. I have the following in my .emacs

(defvar hs-special-modes-alist
      '((c-mode "{" "}" "/[*/]" nil nil)
        (text-mode "(" ")" "{" "}" "\[*\]" nil nil)))

which Emacs swallows, but if I try to enable hs-minor-mode while in text mode I still get Text Mode doesn’t support Hideshow Minor Mode. I cannot figure out what the nils are for here, or how many I should have (if any).

I don't necessarily have to use hideshow if that is the wrong package to use for this.

Solution

Solved by negas answer below.
comment-start defines what a comment looks like, which I don't need, but it needs to be set for hideshow to be happy. I solved my problem by setting comment-start to something that won't likely occur in my logs:

(setq-local comment-start "///COMMENT")


texts: Why function which uses the setcdr modifies its argument? and how to avoid?

texts:
I thought function in elisp can't modify its argument, but it is not true when some special primitive functions such as setcar/setcdr/delq/delete (not including setq) are called when defining new function in elisp, for example, in following the value of x gets changed after calling (foo x), which is not unexpected and undesired to me.

(defun foo (x) (setcdr x nil))

(progn (setq x '(1 2))
       (foo x)
       x)
;; => (1)

I know I can make a copy of x before using setcar to avoid the problem, is this the right way?

Besides, It also looks like it is impossible to write a setcar implementation in elisp function.

It bothered me when I was writing my-insert-nth, I had to make a copy of argument list in function body since list's value should be changed, while I'm not quite sure.

(defun my-insert-nth (list element n)
  "Insert ELEMENT at Nth of LIST."
  (if (<= n 0)
      (nconc (list element) list)
    (let ((len (length list)))
      (if (>= n len)
          (append list (list element))
        ;; FIXME: Why need another copy? Does `defun' already do that?
        (let ((new-list (copy-sequence list)))
          (setcdr (nthcdr (1- n) new-list) (cons element (nthcdr n new-list)))
          new-list)))))

(let ((l '(a b c)))
  (list (my-insert-nth l 'beg 0)
        (my-insert-nth l 'mid 2)
        (my-insert-nth l 'end 3)))
;; => ((beg a b c)
;;     (a b mid c)
;;     (a b c end))


texts: Why does my org-link-beautify extension generate many timers?

texts:
I wrote an extension org-link-beautify. It uses text properties to
display all-the-icons icon for links.
When I use list-timers, I found many timers like this:
UPDATED of command list-timers (show more link path in hash-table)
1179.80          -    #f(compiled-function () #<bytecode
-0x120012ba5f9562c1> [#<hash-table equal 1440/1642 0x1565afccff6b>
("-1003358868.jpg" :v-adjust 0.01) remhash])
1179.80          -    #f(compiled-function () #<bytecode
-0x11c7991bee93a665> [#<hash-table equal 1440/1642 0x1565afccff6b>
("1004068059.jpg" :v-adjust 0.01) remhash])
1179.80          -    #f(compiled-function () #<bytecode
0x1d09e6f58d6a9d3f> [#<hash-table equal 1440/1642 0x1565afccff6b>
("-1004540555.jpg" :v-adjust 0.01) remhash])
1179.80          -    #f(compiled-function () #<bytecode
-0x728e7a4499562c5> [#<hash-table equal 1440/1642 0x1565afccff6b>
("-1010525956.jpg" :v-adjust 0.01) remhash])
1179.80          -    #f(compiled-function () #<bytecode
-0x8917a573e9562c5> [#<hash-table equal 1440/1642 0x1565afccff6b>
("-1011541969.jpg" :v-adjust 0.01) remhash])
       1h 54m 24.9s            - #f(compiled-function () #<bytecode 0x15627c2da862a7a4> [#<hash-table equal 236/325 0x157dcf12ae9d> ("https://www.zhihu.com/question/281992632/answer/612244555" :v-adjust -0.05) remhash])
       1h 54m 24.9s            - #f(compiled-function () #<bytecode 0x185dd8418bb95f95> [#<hash-table equal 236/325 0x157dcf12ae9d> ("https://www.zhihu.com/question/312702679/answer/648228648" :v-adjust -0.05) remhash])
       1h 54m 24.9s            - #f(compiled-function () #<bytecode 0x1543f4c7ed08f637> [#<hash-table equal 236/325 0x157dcf12ae9d> ("https://www.zhihu.com/question/19918564" :v-adjust -0.05) remhash])
       1h 57m 50.2s            - #f(compiled-function () #<bytecode 0x1624e8d5c40e6cd7> [#<hash-table equal 236/325 0x157dcf12ae9d> ("https://wangdoc.com/ssh/" :v-adjust -0.05) remhash])
       1h 57m 50.2s            - #f(compiled-function () #<bytecode 0x1d58d576aa4ef853> [#<hash-table equal 236/325 0x157dcf12ae9d> ("https://emacs-china.org/t/linux-kvm-windows/15134" :v-adjust -0.05) remhash])
       1h 57m 50.3s            - #f(compiled-function () #<bytecode 0x33bd87bdd6ddd93> [#<hash-table equal 236/325 0x157dcf12ae9d> ("https://www.douban.com/gallery/topic/720/" :v-adjust -0.05) remhash])
       1h 57m 50.3s            - #f(compiled-function () #<bytecode 0x63ad8d9a555e907> [#<hash-table equal 83/97 0x157dcf01dea5> (".org" :face org-link :v-adjust 0) remhash])
       1h 57m 50.4s            - #f(compiled-function () #<bytecode 0x12ca43d2c81e6703> [#<hash-table equal 83/97 0x157dcf01dea5> ("Computer Todos.org") remhash])
       1h 57m 56.6s            - #f(compiled-function () #<bytecode 0x1681d642b3ef7697> [#<hash-table equal 83/97 0x157dcf01dea5> ("init-emacs-appearance.el") remhash])
       1h 58m 14.6s            - #f(compiled-function () #<bytecode -0xf96db9ba05420ab> [#<hash-table equal 83/97 0x157dcf01dea5> ("init-emacs-frame.el") remhash])

The more Org mode buffers opened, the more timers created.
I'm wondering iff there is a problem in my source code - or maybe this is a mechanism in Org Mode?
Can you tell me how these timers were created? And how to avoid creating them in my extension?


texts: Emacs 26 build on RHEL6 has blank window frame

texts:
I just built Emacs 26.1 (stable) on Centos 6 (RHEL 6.9). When I fire up the executable with src/emacs -Q over X11 it shows an empty window with no minibuffer:

I built Emacs without gnutls, but that should be possible. Do I miss any essential libraries?

According to this question the issue might be related to the X-toolkit I'm using (GTK2). Does Emacs 26 not support GTK2?

The output of my ./configure --without-gnutls can be seen in this gist; the output of the make all in this.

Notes:

The build runs fine in a terminal via src/emacs -Q -nw
I have built Emacs 25 on the same machine and it runs successfully over X11.


texts: How to sort file list in helm-find-files

texts:
When I use helm-find-files to search for a directory. I would like it to display exact matches and directories first in the list of candidates, followed by files.

For example, searching for "src" gives the following results:

How can I make "src" show up first, since it's an exact match and also a directory? Or, baring that, making hidden "." files go to the end of the list (since it seems to be in alphabetical order?)


texts: Count the total no. of lines for a set of marked files in dired

texts:
I would like to be able to return the total no. of lines for a set of marked files in dired.

i.e. if I marked 3 text files:

file 1 contains 100 lines
file 2 contains 50 lines
file 3 contains 60 lines

result would be 210 lines

Any ideas on how one might achieve this?


texts:
When I'm writing a comment and press M-j to continue the comment on the next line (using single-line comments), if I press it multiple times say because I want to leave the next comment line "empty" for separation, the cursor ends up appearing right after the comment delimiter. Instead, I always want the cursor to be separated from the comment delimiter by one space. I'd like this to be the case in every mode, globally if possible.

As an example, if I have this:

;; comment|

If I press M-j I get this:

;; comment
;; |

It's correctly separated from the comment delimiter by one space.

If without doing anything else I press M-j again, I get this:

;; comment
;;
;;|

So from then on there is no space added between the comment delimiter and the cursor. I want there to always be a space of separation.

By comparison, in c++-mode I always get the space.

I'd like to know if there's a way to get this in other modes (or even all other modes) before I resort to hacking it in by wrapping the function myself.

EDIT: I ended up advising comment-indent-new-line to add one space if there aren't any spaces following the comment-start:

(define-advice comment-indent-new-line
    (:after (&optional soft) at-least-one-space)
  "Ensure that at least one space is added after the comment-start."
  (let ((start (regexp-quote comment-start)))
    (when (and (nth 4 (syntax-ppss))
               (looking-back start (+ (point) (length start)))
               (not (looking-back " "  (+ (point) 1))))
      (insert " "))))


texts: Implement vim's Ctrl-O and Ctrl-I in emacs

texts:
I find this to be a great feature from vim, and I miss it.

I've looked around, and it seems that one can add the current position to some mark ring, and then come back. But that's explicit. I need to know ahead that I'll need to remember where I am, add it to the ring, and move. Normally, I don't know I'll need this until it's too late.

How could this be implemented?


texts: Use magit to compare all changes in two revisions

texts:
Is there a way to invoke Ediff from Magit in order to compare the changes to all files between two revisions, not just the changes in a single file?

My use case is a coworker will ask me to review the changes that she made in a branch, which might run over several commits.  I can easily figure out that her code branched from the main branch at revision M, but I am not sure how to get magit to compare everything for me.

It appears that I can do M-x magit-log and then E r <M> <branch name>, but then it asks me for the file to compare.  In this case, there are about 20 files that changed, so it is going to be annoying to related the E r sequence for each.  Additionally, I would have to remember which files I have already looked at.

Ideally, I would like to either of these:

a buffer that lists each file and lets me click on it to start ediff, and shows when I have started ediff (or lets me delete file from the last)
start an ediff session for each changed file, with a buffer that lists the sessions and lets me go to them.

I am thinking of something like what ediff-directories does.

Does that capability exist?

This is different from How can I compare two commits in magit?: that wants to look at the changes in those two revisions.  I want to look at the differences in all the files that are different between those two revisions, regardless of if the change occurred in the revision or a non-common ancestor.


texts:
I want child org items to inherit priority from their parent.

I tried setting org-use-property-inheritance '("PRIORITY"), but it did not have any apparent effect.

Use case: I often have high priority projects whose tasks are mostly equally important. I don't want to waste time setting priorities for each individual child task unless it differs from the parent (e.g., an optional subtask may have lower priority).

Update: I e-mailed the org mailing list. Will report back if I get a useful response.


texts:
Is there any way to add the date specified with #+DATE to #+export_file_name?
for example my buffer is named buffer and I want the result to be named 0401_buffer.pdf, so something like
#+export_file_name: < date >_buffer.pdf
I'm exporting to beamer pdf if it makes any difference


texts: Why aren't recently visited files at the front of the list for `ido-switch-buffer`?

texts:
I don't understand why, no matter what, scratch, Messages, Compile-Log etc are always the buffers that show up first.

I use now this little function

(defun ido-recentf-open ()
  "Use `ido-completing-read' to \\[find-file] a recent file"
  (interactive)
  (if (find-file (ido-completing-read "Find recent file: " recentf-list))
      (message "Opening file...")
    (message "Aborting")))

But isn't this how ido-switch-buffer is supposed to work in the first place?


texts:
my toolbar is filled with many buttons, and I'd like to know if it is possible to remove the text so it only shows the icon (and if it is possible, how to do it).
I currently have this :

But as you can see it is way too long, having just the icons would help a lot.


texts: Command that does different things based on whether something is selected

texts:
I am trying to make emacs function somewhat like sublime text, where C-x cuts text that is selected and cuts the whole line when nothing is selected. I got the full-line cut to work using

(global-set-key (kbd "C-x") 'kill-whole-line)

but I'm not sure how to get C-w's functionality (kill-region) to happen when text is selected and then use C-x. Is there a way to say something like

(if region-selected
    ('kill-region)
  ('kill-whole-line))

(And yes, I know I'm rebinding C-x, but I'm sick of trying to switch mental muscle memory modes from sublime text to terminal editing.)


texts:
I like how org-mode allows me to quickly create and edit tables. However, I do not like the table's appearance and I would like to modify it.

Customizing the face only lets me change foreground and background color. I want to change the grid only. The essence of this question was asked about 8 years ago here. Did anything change since then?

I also tried to solve this by font-locking the "|" (pipe/bar) character, however, it seems that my regular expression does not find it reliably and does not set the face.

(add-hook 'org-mode-hook
          (lambda ()
            (font-lock-add-keywords 'org-mode
                                    '((" | " .
                                       'font-lock-keyword-face)))))

So my question is:
Can I hide the grid in org-mode tables?


texts: How do I verify a large package in a git repo is safe?

texts:
I'm looking at emacs helm specifically, which has the following properties:

it has thousands of commits
it is largely maintained by one user
the maintainer has no other profiles (social media, etc.) I was able to find on a few searches
it is actively maintained (today)

Since I'm about to install arbitrary code on my computer to use in my text editor, I wanted to verify if this has undergone any review process. I'd like to say "well it's open source" but I really am far from the elisp ability to audit all the code myself. I would like to assume others in the community have reviewed it but one that's probably false, and two there are up-to-the-minute commits. Are there other strategies I am missing?

For the record the vector is simple: "open source" doesn't matter all that much if the contributor is working under a throwaway account, or if there's no review process.


texts: "replace-string" with Org-mode capture buffer and link URLs

texts:
I want use Org-mode to keep track of e-mails. When I've read the e-mail, and added it to Org, I want to archive the e-mail but still have a link to the archived e-mail.

Pretty much exactly this:

https://stackoverflow.com/questions/15736590/how-to-automatically-track-links-in-org-mode-to-gnus-messages

I've followed the answer, but it doesn't work. It seems the hook has been updated to: org-capture-before-finalize-hook so I've updated the code as necessary, and it runs.

However, I'm getting the message:

  Replaced 0 occurrences (skipped 1 filtered out)

So, it seems that while the buffer is in org-mode, the hidden URL link text gets filtered out if I use replace-string on the buffer. Is there a way around this?


texts: Is it possible to organize the capture templates selection screen?

texts:
As it can be seen above, I have around fifteen capture templates. I think this list may grow or shrink, but in the case that it grows, is there any way to make it more segmented?

Like dividing it across some categories, just for visual organization. Something like:

Notes

books
web pages
miscellaneous
articles
uni notes

Media

movie
game
book

Actions

goals
tasks
weekly review

Writing

new post
thesis
journaling

Or even dividing it horizontally instead of vertically. And so forth and so on.

Yes, this degree of organization could be reached through diminishing the number of capture templates and further customizing them to make them more specific, but then I would have to stack them in the same file. And since I use Emacs mostly for writing, my org files tend to get huge very quickly and I like to spread them out to avoid making things a mess.

Is this setup somehow feasible?


texts:
The general case:
Simply put, given that I start two processes (Aand B) with, e.g., async-start-process, what is best way of killing B if A terminates?

My specific usecase:
I'm debugging embedded software on an external chip and launch a GDB server that interfaces the chip and GDB like this (gdb ... "-ex \"target remote ...\"") and I want to kill the GDB server process when GDB quits.

Additional edit:
It would be nice to be able to kill the GDB server when quitting GDB, though. I.e., the opposite way around: hitting q in the GDB buffer would shut everything down.

I tried searching through the Emacs/elisp documentation, but I'm pretty new to elisp :) Any suggestions?


texts: Symbol documentation and implementation code in haskell-mode

texts:
I'm learning Haskell. One of first steps was to make pleasant development environment. I've already found haskell-mode, intero and some more useful packages but I miss offline/online documentation for the symbol at point.

What I've already found looks alike what I need is this but have no success with configuration. I have cabal installed from haskell-platform on ubuntu 14.04 but don't have ~/.cabal/share/doc/. What I expect is when the cursor is on e.g. repeat function and C-c C-d is presed it shows the some documentation for the function. It's nice to have some basic information about function signature in mini buffer but for a newcomer it would be great to have access to full documentation.

What is prefered way to get symbols full documentation inside Emacs?


texts: Pasting unicode from external applications with mouse wheel on Unix

texts:
On upgrade from Emacs 24.3.1 to Emacs 25.0.50 pasting unicode from external applications with mouse wheel appears broken.

I start emacs -Q and select e.g. title of https://en.wikipedia.org/wiki/Paul_Erdős wikipedia entry in firefox. However with mouse wheel I get

Paul_Erd\u0151s

where as with normal clipboard-yank works fine:

Paul_Erdős

Pasting the same with mouse wheel (aka <mouse-2>) from Emacs selection works fine.


texts: Byte Compiling Functions Using `defalias` for `progn`

texts:
The following code:

(defalias 'new-progn 'progn)
(defun foo ()
  (new-progn "foo"))
(byte-compile 'foo)
(foo)

gives this error:

Debugger entered--Lisp error: (invalid-function #<subr progn>)
  new-progn("foo")
  foo()

Using prog1 or prog2 has a similar problem. Replacing progn with other special forms like and or or will not issue such an error.

Why progn is special in this case?


texts: Is there a way to disable all mouse functionality in spacemacs?

texts:
I have tried doing this which I found in another StackExchange post but it doesn't work for me, is there another way to disable the mouse in spacemacs completely, I use evil mode, thanks.

How to disable mouse in Spacemacs


texts:
I am writing a font-lock rule that calls a function to decide what
face to apply to a symbol. Here's a simplified version:

("\\(?1:\\s_+\\)"
 (1 (the-function 1)))

The problem is that this function needs to generate some data that is
just a little bit slow to compute. So, when jit-font-lock starts
calling this function for every symbol in the visible buffer, the lag
is noticeable.

I could setq this “slightly-expensive” data to a variable,

(setq data-cache (generate-data))

and then the-function could just use data-cache instead of calling
generate-data every time. But then I would have to jump through some
non-trivial hoops to make sure that this cache is always properly
invalidated.

Q: Does the font-lock engine offer help in this regard? How can I make
sure it only runs (generate-data) once per redisplay?

Ideally, I would like to specify something like “let-bind data-cache to
the return value of (generate-data)”. This way I would know that
this cache was never outdated.


texts: Tramp and X11 forwarding when changing user (su)

texts:
I can connect to a remote server with Tramp

C-x C-f /ssh:group@remotehost:

and get a plot output window (with ess R). But if I change user

C-x C-f /ssh:group@remote|su:user@remote:

there's no X11 forwarding anymore, i.e. not output window. Here's the error reported in R:

Error in .External2(C_X11, d$display, d$width, d$height, d$pointsize,  :
  unable to start device X11cairo
In addition: Warning message:
In (function (display = "", width, height, pointsize, gamma, bg,  :
  unable to open connection to X11 display ''

My ssh config file has ForwardX11 yes and ForwardX11trusted yes as described in Tramp manual. Am I missing something in my ssh config file or emacs init file, or is it on the server side?


texts: How do I change the Magit section heading background color?

texts:
I'm trying to customize the look and feel of my Magit setup. How do I change the background color of the section heading below?

In particular, I'd like to change the black background color next to the "Unstaged changes" text.

(Normally I could do a C-u C-x = to get the face, but in this case I cannot click on this section heading)


texts:
I have defined a key-binding for M-TAB , as follows:
(global-set-key (kbd "M-TAB") 'suspend-frame)

This works fine but once in a while it prints ;9~. I am not sure the main cause of this. Is there any way to prevent this from happening.
I am using emacs inside tmux that has following setup set -g default-terminal "screen-256color".


texts: how to "slow" down the execution of code blocks

texts:
on OSX 10.13.4 with emacs 25.3 and org-mode 9.1.12. Python is 3.5.2 with matplotlib 2.2.2

I am trying to find a way to have org-mode babel for python to slow down in some of the points of my code otherwise some matplotlib plot do not always get inserted in the final produced pdf.
I have tried with time.sleep(nb_seconds) in my python code but it does not solve the problem.

Minimal example:

* import necessary modules and make plot with data

#+BEGIN_SRC python :session jk :exports results
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

# make the data
x = np.linspace(-2*np.pi, 2*np.pi, 50)
y = np.sin(x)
'x is \n{0}\n\n y is \n{1}'.format(x[:5], y[:5])

# make the plots
plt.figure(figsize=(3,3))
plt.plot(x,y)
plt.savefig("myfig.pdf")
#+END_SRC

* Finally, show the plot

#+BEGIN_SRC python :session jk :exports results :results file
"myfig.pdf"
#+END_SRC

Is there anyway I can set this up?


texts: Remove image & link related keybindings in eww

texts:
I'm using xah-fly-keys which provides a few custom keys for easy navigation.

u = backward-word
o = forward-word
i = previous-line
...

Unfortunately, my keybindings are overshadowed when point is on a visible/hidden link and sometimes even text.

Is there a simple way to force my keybinds over others (shr-probe-link/save-image, etc) in eww?

Using bind-keys, only forward-word works, i and u fail. Even v which normally runs eww-view-source switches to shr-browse-url when point is on a link.
This is the webpage, it has nested paragraphs inside a tags which highlights the issue: http://www.ultratechnology.com/blog.htm

Below is the code i tried.

(bind-keys
 :map image-map
 ("i" .  previous-line)
 ("u" . backward-word)
 ("o" . forward-word)
("v" . eww-view-source) )

(bind-keys
 :map shr-map
 ("i" .  previous-line)
 ("o" . forward-word)
 ("u" . backward-word)
 ("v" . eww-view-source) )

(bind-keys
 :map shr-image-map
 ("i" .  previous-line)
 ("o" . forward-word)
 ("u" . backward-word)
 ("v" . eww-view-source) )


texts: Tab-completing functions in Emacs outside of parentheses or quotes

texts:
In Emacs version 25.1.1 (and probably other versions), tab completion not work for function names unless they are enclosed in parentheses or quoted.  For instance, after running emacs -Q, setting tab-always-indent to 'complete and attempting to complete "seq-" after (require 'seq), no completions are offered.  However, "(seq-" completes as one would expect.

Is there a way to complete function names outside of quotes?

Edit: this issue also occurs with normal functions and not just generic ones as pointed out in the comments.

Edit: If helm is used for completion, one approach is to use the following code:

(add-hook 'emacs-lisp-mode-hook (lambda ()
                                  (setq-local completion-at-point-functions '(helm-lisp-completion-at-point))))


texts: How to make "M-x man" buffers use all the available width of the screen?

texts:
The problem
When opening man in a terminal emulator, man tries to use as much width as possible. However, when opening man inside emacs, man doesn't use all the width (even after Man-update-manpage has been executed.)
In the gif shown below, I open the emacs manual page in a terminal emulator and we can see that the manual page uses all the available width. However, this doesn't happen when this manual page is opened inside emacs. The instance of emacs shown in the GIF was opened by executing emacs -Q.

The question
How can I make M-x man display manual pages so that they use all the available width?


texts: Prevent parsing of text inside verbatim org results block

texts:
How do I tell emacs to not not apply treatments to text within a block like this. My issue is that, the * foo at the end causes the export
to go bad.
I'm using something similar to carl's setup -> https://carl.ac/blogging-with-emacs-org-github-pages/

I tried the tricks mentioned in "https://stackoverflow.com/a/39823812"

#+OPTIONS: toc:nil num:nil
#+PROPERTY: header-args :eval never-export
#+BEGIN_EXPORT html
---
layout: post
title: "Redacted"
permalink: /:title/
tags: [redacted]
---
#+END_EXPORT

Summary

#+BEGIN_SRC sh :results output drawer :wrap SRC text
gem install rails_apps_composer
rails new unnamed -m https://raw.github.com/RailsApps/rails-composer/master/composer.rb
#+END_SRC

#+BEGIN_SRC text
Fetching: i18n-0.9.5.gem (100%)
Successfully installed i18n-0.9.5
Fetching: rails_apps_composer-3.1.36.gem (100%)
Successfully installed rails_apps_composer-3.1.36
2 gems installed

      create
      create  README.md
      create  Rakefile
      create  .ruby-version
      create  config.ru
      create  .gitignore
      create  Gemfile
         run  git init from "."
Initialized empty Git repository in /Users/administrator/unnamed/.git/
      create  package.json
      create  app
      create  app/assets/config/manifest.js
      create  app/assets/javascripts/application.js
      create  app/assets/javascripts/cable.js
      create  app/assets/stylesheets/application.css
      create  app/channels/application_cable/channel.rb
      create  app/channels/application_cable/connection.rb
      create  app/controllers/application_controller.rb
Bundle complete! 28 Gemfile dependencies, 103 gems now installed.
Gems in the group production were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
         run  bundle exec spring binstub --all

* foo
#+END_SRC


texts: How to write a transparent "pass-through" function wrapper?

texts:
What I mean by a "transparent 'pass-through' function wrapper" is a function, let's call it wrapper, that returns the result from passing all its argument to some other function, let's call it wrappee.

How is this done in Emacs Lisp?

NB: The ideal wrapper function is agnostic about the wrappee function's signature; i.e. it knows nothing of the number, positions, names, etc. of wrappee's arguments; it just passes all its arguments along to wrappee, just as if wrappee had been the one originally called.  (There's no need, however, to mess with the call stack to replace the call to wrapper with a call to wrappee.)

I posted a partial answer to my question:

(defun wrapper (&rest args) (apply 'wrappee args))

This works only when wrappee is not interactive.  Apparently, the way interactive functions get their arguments represents a different "channel" from what's covered by the (&rest args) incantation.  What I still need, therefore, is an equally-wrappee-agnostic counterpart of the (&rest args) signature for the case where wrappee is an interactive function.

(This question was motivated by a problem described in this earlier question.)

In case further clarification of what I'm asking for is needed, below are a couple of examples, showing the Python and JavaScript equivalents of what I'm after.

In Python a couple of standard ways to implement such a wrapper are shown below:

def wrapper(*args, **kwargs):
    return wrappee(*args, **kwargs)

# or

wrapper = lambda *args, **kwargs: wrappee(*args, **kwargs)

(Here *args stands for "all the positional arguments", and **kwargs stands for "all the keyword arguments".)

The JavaScript equivalent would be something like this:

function wrapper () { return wrappee.apply(this, arguments); }

// or

wrapper = function () { return wrappee.apply(this, arguments); }

For the record, I disagree that this question is a duplicate of How to apply mapcar to a function with multiple arguments.  I am at a loss to explain why, since the two questions look so obviously different to me.  It is like being asked "explain why an apple should not be considered equivalent to an orange".  The mere question is so crazy, that one doubts one could ever come up with an answer that would satisfy the person asking it.


texts: How to postpone loading a file until it's function is called?

texts:
Say I have foobar_utility.el that defines an interactive function foobar_utility.

How can I postpone loading foobar_utility.el until foobar_utility is called?

Example usage:

(load (concat user-emacs-directory "foobar_utility.el") :nomessage t)
(global-set-key (kbd "<f1>") 'foobar_utility)

Is there a better way  to do this besides moving the load into the key binding? e.g:

(global-set-key
 (kbd "<f1>")
 (lambda ()
   (interactive)
   (load (concat user-emacs-directory "foobar_utility.el") :nomessage t)
   (call-interactively 'foobar_utility)))


texts: Do I evaluate "(require 'eclimd)" successfully?

texts:
In a buffer in fundamental mode, I type Ctrl-x Ctrl-e at the end of the line

(require 'eclimd)

the minibuffer at the bottom says eclimd. Does it mean I run the command successfully?

If yes, why does require output eclimd?


texts: use org-mode babel execution to generate templates for org-mode execution

texts:
Background
I want to use org-mode to create a WBS to then create JIRA issues.
org-babel looks like the right option as I can use shell to invoke curl commands to invoke the JIRA API for create issues.
So this is a multi-step process:

write the WBS as a normal org-mode hierarchy
use org-babel to process the tree and generate the curl commands
use org-babel to invoke the curl commands

Problem
My problem, I can't find any documentation that tells me how to do this in two passes, that is being able to manually invoke the results of one org-block.
It's not really source code blocks ability to pass variables, functions, and results to one another
Section 15.6 Results of Evaluation doesn't show which magic incantation of collection, type, format is needed either.
The Worg's The Library of Babel or Worg's Babel: Introduction didn't have any examples.
It's almost Babel src block inside src block which was useful for the links on escaping org-mode special syntax, and the link to 12.6 Literal Examples


texts:
How can I control the indentation of a line in a plain text file?

In fundamental-mode, when you begin to type a line (call it Line A) after a previous line by hitting return, the line will automatically inherit the indent of the previous line.

When I manually delete the automated indent, and want 3 tabs as indent instead by hitting tab three times, it seems that the second tab is converted to spaces, because I saw the cursor didn't jump by tab but by a character when I hit the second tab.

When I create another line (call it Line B) and remove any automated indent of it, if I hit just one tab key, it will jump to the same indent as that of Line A, and Line A has an indent more than just one tab.


texts: Maintaining consistent visual fill column under `org-indent-mode`

texts: How can one enable org-indent-mode (or otherwise indent content to Org headings) while still maintaining a consistent visual fill column?


texts:
Background:

I'm mostly a vi user and am converting to Emacs.

Past the basics and now use it for writing code in C and some Python with plans to do an R conversion too.

I wrote (Common) LISP for years over two decades ago when I was in grad school but now I've severely lapsed (can write hello world but that's it).

Question:

What would you recommend for a guy in my position to get learning the Emacs LISP environment and start hacking Emacs.

Are there books, blogs, resources I should read, exercises I should do?


texts: How to tell if a keybinding will overwrite another

texts: I configure numerous additional keybindings, and sometimes I unintentially overwrite others.  Is there a way to determine if a keybinding is taken before binding a key, and if so throw an error?


texts:
In below example, the text should be show on the right side if compile the latex code with pdflatex command. but in org-mode, the right side text missed:

#+HEADER: :fit yes :imagemagick yes :iminoptions -density 300
#+HEADER: :packages '("\\usepackage{tikz} \\usepackage[most]{tcolorbox} \\tcbuselibrary{listings}")
#+BEGIN_SRC latex :file sidebyside_20190530.png :results raw file :exports both
\newtcblisting{mybox}{%
    text side listing,
    lefthand width=1.5cm,
    }
\begin{mybox}
\begin{tikzpicture}
\draw[thick, blue] (1,0) -- (0,0) -- (0,1) -- cycle;
\end{tikzpicture}
\end{mybox}
#+END_SRC

Current output image is:

But the actually output should be (if compile from console by pdflatex):

Code almost the same but org-mode latex will lost the right side text!


texts: How to create a customized translation table when using the command translate-region?

texts:
When using the command translate-region, the command asks to use which table. There are already some predefined tables (by pressing TAB) such as

cp51932-decode  cp51932-encode  eucjp-ms-decode     eucjp-ms-encode     japanese-ucs-cp932-to-jis-map japanese-ucs-glibc-to-jis-map     japanese-ucs-jis-to-cp932-map   japanese-ucs-jis-to-glibc-map   jisx0213-to-unicode     ucs-normalize-hfs-nfd-table ucs-normalize-nfd-table     ucs-normalize-nfkd-table    unicode-to-jisx0213

What if someone likes to create its own table?

For example, assume that one would like to create a conversion table like below:

1 --> 2
a --> x
n --> m
8 --> 0
σ --> s

What I have tried: based on one of the above tables, I defined a table as bellow, but I get the error apply: Wrong type argument: integerp, x

(let ((map
       '(
     (1 . 2)
     (a . x)
     (n . m)
     (8 . 0)
     (σ . s)
     )))
        (define-translation-table 'my-conversion-decode map)
  (mapc #'(lambda (x)
        (let ((tmp (car x)))
          (setcar x (cdr x)) (setcdr x tmp)))
    map)
  (define-translation-table 'my-conversion-encode map))


texts:
My text is written in paragraphs that are split into lines, which makes it difficult to search for strings that might be spanned across several lines. For instance, given the following text

This is an example
of a text.

when searching for the string "example of" in an unmodified emacs version it finds no occurrences. However, if I add the following customization, which was suggested in another post on the emacs stack exchange, the search works as desired:

(setq isearch-lax-whitespace t)
(setq isearch-regexp-lax-whitespace t)
(setq search-whitespace-regexp "[ \t\r\n]+")

My question is how to configure the query-replace operation (M-%) so that it will behave as my modified search operation, i.e., be able to find and replace strings, while ignoring white spaces.


texts:
I have tried to get new version of Emacs using guix package manager. Which done successfully. Now I also have Emacs 26.1 alongside Emacs 24.

But I am facing a problem that the gui menu-bar titles appear as condensed. Little or no space in between. Please see the image.

I want it to look like properly legible and clear. I googled for the same but could not found the solution. Please guide me for that.


texts:
What's a recommended way to set the font size for org-mode (or any other major mode) to a certain value that is different from the global font size?

By looking at documentation C-h k C-x C-+, this is what I came up with:

  (defun scale-up-font ()
    (text-scale-increase 2))
  (add-hook 'org-mode-hook 'scale-up-font)

With this, I've noticed loading time for org-mode files to be slightly longer. Is there a better way to do this?


texts: electric-pair for parentheses does not work in latex-mode

texts:
electric pairing for () does not work in latex-mode.

I have included regular parentheses () in my electric-pair-pairs list in .emacs. The list also includes [], {}, and "". However, when editing LaTeX documents, pairing of () does not work, only the other electric pairs.

I already checked the variable electric-pair-pairs when in LaTeX mode, but it is unchanged compared to the .emacs definition.

Here is a snippet of my .emacs dealing with electric-pairing

(electric-pair-mode 1)
(setq electric-pair-pairs
    '(
     (?\" . ?\")
     (?{ . ?})
     (?( . ?))
     (?[ . ?])))

I appreciate any help form you guys.

Ulrich

Emacs 25.1.1 on Debian Stretch


texts: Add `tikzpicture` environment to the list of choices for AUCTex's environment insertion shortcut?

texts: I use AUCTex for all my Latex needs, and it works great. However, I wanted to insert a tikzpicture environment in my document, and I pushed the key C-c C-e for environments, but tikzpicture is not listed amongst the choices. Is there a way to include the \begin{tikzpicture} ... \end{tikzpicture} environment in the list of AUCTex environments? I am not sure what variable I would need to change or how in my dotfile. I use Spacemacs, so I would probably need to append something to the list of environments,right?


texts:
How to do searches in MediaWiki mode?  If I instead do searches in Web browser, and then copy the URI of the page into Emacs, it sort of defeats the purpose of using Emacs as and MediaWiki power editor or IDE.

Use case description:

I open Emacs with Mediawiki mode, and connect and login to wikipedia.org.  I want to search for an existing article whose title is roughly Mao Zedong.  I know there must be an article about the person, but the title may have a small difference.  In Web browser, searching "Ma Zedong" will go to this page if it's the exact title, or a list of found results that has titles close to my search term.  What's the equivalent process in Emacs?


texts: Auto insert include guard in cpp header when inside projectile project

texts:
I am currently learning C++ and I came across include guards to avoid double inclusion.
Now I would like to use the google's style convention like this :
// project/src/app.hpp

#ifndef PROJECT_SRC_APP_HPP_
#define PROJECT_SRC_APP_HPP_
...
#endif  // PROJECT_SRC_APP_HPP_

and also
// project/src/util/test.hpp

#ifndef PROJECT_SRC_UTIL_TEST_HPP_
#define PROJECT_SRC_UTIL_TEST_HPP_
...
#endif  // PROJECT_SRC_UTIL_TEST_HPP_

So the macro name is basically the path of the header file in the current project.
My goal is to automate this task of writing the include guards each time I create a new .hpp file.
I looked at the emacs auto insert mode which looks adapted to the situation but the question is the following :
I am using projectile so how can I get the full path from the root directory of the current project to construct the macro name?
Can anyone point me into the right direction? (btw I am using spacemacs)


texts: Opening an Emacs file to a specific word in the file

texts:
In Vim it is trivial to open a file from the command line to a specific word in the document. For e.g. to open the file "Contacts.txt" to "Bob" one would type:

vim Contacts.txt +/Bob

In Emacs it seems that one can only to this with a line number and or column but not a word.


texts: grep -l: Shouldn't I be able to load the files?

texts:
Example in eshell:

$ cd ~/src/Sporth
$ grep -rl Name *

I get as output:

-*- mode: grep; default-directory: "~/src/Sporth/" -*-
Grep started at Fri Feb  1 17:07:41

grep -n -rl Name LICENSE Makefile README.md config.def.mk examples/ ftmap.c func.c h/ hash.c parse.c plumber.c sporth.c stack.c ugen_reference.txt ugens/ util/
ugen_reference.txt
util/sp_jack.c
util/ugen_lookup
util/chorth/include/chuck_oo.h

Grep finished with matches found at Fri Feb  1 17:07:41

Nice! When I press RET on any of the files, I expect the corresponding file to be loaded. At least that would be very convenient. Instead I see in the *Messages* buffer: compilation-next-error: No grep hit here

Is there something broken? Is additional configuration necessary?

emacs-version evaluates to: GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-07-05


texts: How to keep cursor position after quitting undo-tree-visualize

texts:
After using undo-tree-visualize and going back to some previous state, I wanna return back to final state (i.e., no undo) with my cursor staying at the position at that previous state.  Is it possible?  I tried to use save-excursion as follow, but it doesn't work:

(defun undo-tree-visualizer-abort-keeping-cursor-position ()
  (interactive)
  (save-excursion (undo-tree-visualizer-abort)))


texts: Is there a major mode for .inf files (https://en.wikipedia.org/wiki/INF_file)? If there is one, it's proving to be most unGoogleable.


texts: Mark and open multiple files with Helm and Projectile

texts:
Helm seem to support marking files in helm-find-files. Is it possible to open the marked files, each one inside of its own buffer from within the find file buffer?

Update: I noticed that I was using helm-projectile-switch-project rather than the Helm enhanced find-file command.


texts: I have a .cls LaTex template I would like to use regularly. Where/how should I save it so that AucTeX is aware of it? How does one set up LaTeX templates in Emacs/Spacemacs in general? I find very few resources specific to Emacs that do not require Org-mode.


texts: How to limit the length of function name shown by (which-function-mode t)

texts:
I am using (which-function-mode t) to show current function name / org-heading on the mode line.  I would like to limit the number of characters it shows on the mode line, but I couldn't find any option like max-func-name in which-func.el.

I can limit the string by redefining which-func-update-1 with (which-function) replaced by (truncate-string-to-width (which-function) 30):

(defun which-func-update-1 (window)
  "Update the Which Function mode display for window WINDOW."
  (with-selected-window window
    (when which-func-mode
      (condition-case info
          (let ((current (truncate-string-to-width (which-function) 30)))
            (unless (equal current (gethash window which-func-table))
              (puthash window current which-func-table)
              (force-mode-line-update)))
        (error
         (setq which-func-mode nil)
         (error "Error in which-func-update: %S" info))))))

But it is too hacky..

I tried to use advice as follow:

(defadvice which-func-update-1 (around testing activate)
  (cl-letf (((symbol-function 'which-function) (lambda () (truncate-string-to-width (which-function) 30))))
    ad-do-it))

But it generates infinite loop.

Anyone know how to limit the string length without modifying which-func.el?  Thanks.


texts: How can I diagnose which `git` magit is running?

texts:
I'm trying to use Magit with TRAMP.  The remote host has multiple git versions, necessitating

(add-to-list 'tramp-remote-path "/usr/sup/bin")

in my .emacs.  However, when I run magit-status in a TRAMP buffer, I get this error message in *Messages*:

magit-insert-head-branch-header: Wrong type argument: stringp, nil

And it is accompanied by this message in *Warnings*:

Error (magit): Magit requires Git >= 2.0.0, but on /ssh:nr@homework: the version is 1.8.3.

If multiple Git versions are installed on the host, then the
problem might be that TRAMP uses the wrong executable.

First check the value of `magit-git-executable'.  Its value is
used when running git locally as well as when running it on a
remote host.  The default value is "git", except on Windows
where an absolute path is used for performance reasons.

If the value already is just "git" but TRAMP never-the-less
doesn't use the correct executable, then consult the info node
`(tramp)Remote programs'.

Information about the context:

The value of magit-git-executable is "git".
The value of tramp-remote-path is ("/usr/sup/bin" tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin").
On the remote host, there is a /usr/sup/bin/git with version 2.19.1.

My question: how I can figure out the absolute pathname of the git that Magit is running on the remote host?

Possibly relevant question: magit with tramp is not working with git correctly


texts: Org Mode Python block evaluation cannot print result in the shell session

texts:
I have a python source block in org mode as below

#+BEGIN_SRC python :session
  print('hello world')
#+END_SRC

and I have a Python shell already run, so when i press C-c C-c, the code gets evaluated by the Python shell. Below is what I have in the Python shell:

In [12]: print('hello world')
hello world

In [13]: open('/var/folders/y1/197_jjzs1yv2qz0m26z1jkxw0000gn/T/babel-
2T9E0c/python-zCCqcO', 'w').write(str(_))

In [13]:
Out[13]: 20

'org_babel_python_eoe'
In [14]:
In [14]:
In [14]: Out[14]: 'org_babel_python_eoe'

why there are so many extra lines output? and how can I avoid them?

I am using spacemacs with emacs v26.1 with elpy on a Macbook.


texts:
I use C-s to search a pattern in a buffer. Then when I move the cursor, the highlighted matches lose highlight. Can I keep highlights however I move my cursor, or even edit the buffer?

What about when I search using regex?

Thanks.


texts: M-x list-package fails with error "certificate could not be verified"

texts:
My environment:

Linux Mint 17.3 (based on Ubuntu 14.04)
Emacs 25.3.1
The value of package-archives:

(("gnu" . "https://elpa.gnu.org/packages/")
  ("melpa" . "https://melpa.org/packages/")
  ("marmalade" . "https://marmalade-repo.org/packages/"))

When I ran M-x list-packages, the minibuffer shows:

"Continue connecting? (No, Session only, Always)".

While a *Nework Security Manager* buffer shows up with some information, and the error:

The TLS connection to elpa.gnu.org:443 is insecure for the following reason:

certificate could not be verified

Please see the attached picture for the detail.

I could choose Session only to proceed though.

What debugging technique is available to help narrow down the issue?


texts: ein login error due to curl version not support compressed

texts:
I am using win10, emacs version is GNU Emacs 26.3. python version is Python3.6.8.
After install EIN (EIN version is 20190813.2156) package and try to run M-x ein:login, I got below error message:

ein: [error] Login to http://127.0.0.1:8888/?token=b804af75f6744bf1b247909945a875ba1056143bca05a330 failed,
error-thrown (error . exited abnormally with code 2 ),
raw-header curl: option --compressed:
the installed libcurl version doesn't support this

    curl: try 'curl --help' for more information

Mark set [3 times]

How should I fix this curl issue?


texts: Pass a subset of the columns of a table to a script

texts:
I would like to pass only some columns of a table to a script:
#+name: table
#+RESULTS:
| Col0  | Col1 | Col2 | Col3 |
|-------+------+------+------|
| Line1 |    1 |    2 |    3 |
| Line2 |    4 |    5 |    6 |

#+name: log
#+begin_src emacs-lisp :var data="" :results value
data
#+end_src

#+call: log(data=table[,0;3])

Expected:
#+RESULTS:
| Col0  | Col3 |
|-------+------|
| Line1 |    3 |
| Line2 |    6 |

Actual:
#+RESULTS:
| Line1 | Line2 |

The ; syntax is not in any manual, I made that up :-). How can I get a subset of the columns of a table?
Workaround
It is possible to use Lisp to filter the list ourselves:
#+name: filter-columns
#+begin_src emacs-lisp :var data='() :columns='()
  (let ((result (mapcar (lambda (line)
                          (mapcar (lambda (column) (seq-elt line column)) columns))
                        data)))
    `(,(car result)
      \hline
      ,@(cdr result)))
#+end_src

#+call: log[:colnames no](data=filter-columns[:colnames no](data=table,columns='(0 3)))

#+RESULTS:
| Col0  | Col3 |
| Line1 |    3 |
| Line2 |    6 |


texts: Add CC and BCC when composing an email with mu4e

texts: If I compose an email with mu4e I can only enter a recipient in the TO: field. But there are no fields for CC (carbon copy) and BCC (blind carbon copy). How can I use those fields?


texts: Cannot use find-dired: setq: Searching for program: is a directory,

texts:
The error is raised by shell-command--shell-command-with-editor-mode. But further stack trace is obfuscated by bytecompiled output. Recently I had to set

(setq explicit-shell-file-name "bash")

to be able to run M-xshell (it would give a similar error). I think this may be related, but I cannot find what exactly is broken.

This is Ubuntu 16.04.


texts: Org Mode - HTML Export Table Of Contents Without H2

texts:
Looking for way to export a document with table of contents anchor links only (without the H2 that says "Table of Contents").

Basically would like to change from this:

Table of Contents

Heading
Heading
Heading

To this:

Heading
Heading
Heading

In the final export.


texts:
I've run into a very strange issue with Org-mode 8.2.10 footnotes. Given the following text, where | represents point and [empty-line] represents an empty line,

[empty-line]
Foo bar baz =$= | foo bar baz
[empty-line]

It is not possible to insert a footnote at point, any position on the line after point, or on the immediately following line. Cannot insert a footnote here is displayed when typingC-c C-x f.
If the ='s are removed, inserting footnotes works fine.
Has anyone encountered this before? I'm guessing that it has something to do with the $ being a LaTeX operator?


texts: Make pdf-tools highlight persist after searching

texts:
Is it possible to make the highlight of searched terms persist after pressing RET? I had liked very much the behavior of zathura in this aspect.

My question is :

Can pdf-tools be tweaked to have the same behavior of isearch with isearch-lazy-highlight-cleanup set to nil? (i.e. make highlighting persist after stop searching)


texts: How set python shell arguments with python-mode.el?

texts:
When I use default inferior shell I can set something like this:

(setq python-shell-interpreter "python"
    python-shell-interpreter-args "-i /absolute/path/to/manage.py shell_plus")

How set this with python-mode.el?


texts: Confused about .emacs vs .emacs.d/init.el

texts:
I read somewhere the two files were interchangeable, so I cut/paste the content of the former, shown below, to the latter. But then Xreader was missing when I tried to view a document generated by AUCTEX, which tells me they are not interchangeable.

 (custom-set-variables  ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.  ;;
 Your init file should contain only one such instance.  ;; If there is
 more than one, they won't work right.  '(TeX-view-program-list (quote
 (("Xreader" ("xreader %o") "xreader"))))  '(TeX-view-program-selection
 (quote
     (((output-dvi has-no-display-manager)
       "dvi2tty")
      ((output-dvi style-pstricks)
       "dvips and gv")
      (output-dvi "xdvi")
      (output-pdf "Xreader")
      (output-html "xdg-open"))))) (custom-set-faces  ;; custom-set-faces was added by Custom.  ;; If you edit it by hand, you
 could mess it up, so be careful.  ;; Your init file should contain
 only one such instance.  ;; If there is more than one, they won't work
 right.  ) (put 'upcase-region 'disabled nil)

What are the different purposes of .emacs and .emacs.d/init.el?

UPDATE:

Here's the content of .emacs.d/init.el after the modification discussed above:

(require 'package)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)
(require 'org)
(define-key global-map "\C-cl" 'org-store-link)
(define-key global-map "\C-ca" 'org-agenda)
(setq org-log-done t)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-view-program-list (quote (("Xreader" ("xreader %o") "xreader"))))
 '(TeX-view-program-selection
   (quote
    (((output-dvi has-no-display-manager)
      "dvi2tty")
     ((output-dvi style-pstricks)
      "dvips and gv")
     (output-dvi "xdvi")
     (output-pdf "Xreader")
     (output-html "xdg-open")))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(put 'upcase-region 'disabled nil)


texts: In an org-capture template definition, how can I have dynamic insertion of content into the target element?

texts:
A complete org-capture template consists of six elements: keys, description, type, target, template, and properties. The manual explains how to use %-escapes to allow dynamic insertion of content into the template element, but is there any way to do the same thing into the target element?

For example, I have a set of templates I call annoyances in which I capture things that frustrate me about various pieces of software (I dunno why -- maybe so I can gather them together and one day sue someone!) They capture to a single file, but under headings grouping either a vendor or particular piece of software. Something like this fragment:

("a"  "Annoyance")
("aa" "Apple"
 entry (file+headline "~/org/annoyances.org"  "Apple")
"* ANNOYANCE %^{Title}\n%?"
 :prepend t :empty-lines: 1)
("ae" "Evernote"
 entry (file+headline "~/org/annoyances.org"  "Evernote")
 "* ANNOYANCE %^{Title}\n%?"
 :prepend t :empty-lines: 1)
("ag" "Google"
 entry (file+headline "~/org/annoyances.org"  "Google")
 "* ANNOYANCE %^{Title}\n%?"
 :prepend t :empty-lines: 1)

... and so on

But other than the names of the culprits, those templates are all identical, and my actual templates are a bit longer than those I've shown, and the list of people-or-code-I-love-to-hate is growing, so to save a lot of duplication what I'd rather have is a single template that Just Figures It Out from the content I provide during capture. Something like this (obviously broken) fragment:

("a"  "Annoyance"
 entry (file+headline "~/org/annoyances.org"  %^{Culprit})
"* ANNOYANCE %^{Title}\n%?"
 :prepend t :empty-lines: 1)

An alternative method would be to use tags since those live in the template element and so can make use of the %-escapes, and then I can use sparse trees if I want to home in on a particular culprit. But is there a way to have the target element dynamically created in the process of entering a capture, e.g. by somehow getting a %-escape value into the target?


texts:
I installed a minor mode for coq-mode, called company coq. It binds the <menu> key to company-coq-toggle-definition-overlay here:

(defconst company-coq--core-map
  (let ((cc-map (make-sparse-keymap)))
    (define-key cc-map [remap proof-goto-point] #'company-coq-proof-goto-point)
    cc-map)
  "Keymap for core company-coq keybindings.
Do not edit this keymap: instead, edit `company-coq-map'.")

(defvar company-coq-map
  (let ((cc-map (make-sparse-keymap)))
    ;...
    (define-key cc-map (kbd "<menu>") #'company-coq-toggle-definition-overlay)
    cc-map)
  "Keymap of company-coq keybindings.
These keybindings are activated by `company-coq--keybindings-minor-mode'.")

(define-minor-mode company-coq--keybindings-minor-mode
  "Minor mode providing convenient company-coq keybindings."
  :lighter nil
      :keymap company-coq-map)

It says: Do not edit this keymap: instead, edit `company-coq-map'

But no matter how I try to edit company-coq-map, I still can't change it. I tried this:

(defun my-company-coq ()
      (local-set-key (kbd "<menu>") 'kill-ring-save)
      )

(eval-after-load 'company-coq-mode
      '(define-key company-coq-map [(menu)] 'kill-ring-save))

(add-hook 'cc-mode-hook 'my-company-coq)

How to reset this key to kill-ring-save?


texts: Emacs ships with two packages for creating and inserting templates: Tempo and Skeleton. As far as I can tell, they fulfill the same purpose. Am I missing something?


texts: How to set mark in elisp and have shift selection?

texts:
The normal behavior of Emacs when transient-mark-mode is active is that when you make a shift-selection, then if the next command is a non-shift movement, the mark is deactivated. For example, after the commands M-l (to mark the current line with the function below) and C-f, the mark is deactivated. How to emulate that behavior from elisp after (set-mark-command nil)?

For example:

(defun my-mark-current-line ()
  (interactive)
  (beginning-of-line)
  (set-mark-command nil)
  (end-of-line)
  (forward-char))

(global-set-key (kbd "M-l") 'my-mark-current-line)

Now do M-l C-f and the region will grow, but instead, I want the default behavior, i.e. the region to deactivate when C-f, and grow with C-S-f.

EDIT: should use a function different to set-mark-command that allows this? I couldn't find any.


texts: have a function to disable close confirmation on terms. work on all terms but shell?

texts:
so i have this function i found on the interent

   (defun set-no-process-query-on-exit ()
 (let ((proc (get-buffer-process (current-buffer))))
   (when (processp proc)
     (set-process-query-on-exit-flag proc nil))))

(add-hook 'term-exec-hook 'set-no-process-query-on-exit)

it works great by disabling confirmation when you close a terminal. it works on multi-term, ansi-term, ehsell but for some bizzaro reason not on shell. any one knows why?


texts:
Upon working on org agenda, it's super convenient to employ  (org-agenda-follow-mode)

The Org Manual: Agenda Commands

It display the original contents on other window instantly while scrolling around the agenda.

  F (org-agenda-follow-mode)
   Toggle Follow mode. In Follow mode, as you
  move point through the agenda buffer, the other window always shows
  the corresponding location in the Org file. The initial setting for
  this mode in new agenda buffers can be set with the variable
  org-agenda-start-with-follow-mode.

When it comes to Dired Dired - GNU Emacs Manual

You have to invoke C-o to achieve the same result.

Is it possible to enable follow-mode in Dired?


texts: Problem with add-to-list in babel src block

texts:
When I execute a babel src block with add-to-list function like this:

#+begin_src emacs-lisp
(add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental)))
#+end_src

I will get this error message:

executing Emacs-Lisp code block...
orgtbl-format-line: Wrong type argument: listp, fundamental

The syntax is correct, as I can evaluate it on .emacs buffer without a problem.

The org-mode version is 8.2.10 if it helps.


texts: Using `C-n` and `C-p` to iterate as cycle in `find-file` instead of up/down arrow keys

texts:
Following answer related to “Open Recent” in Emacs indicates that

  After you press C-x C-f, press up and down to navigate the history of
  opened files.

I have added following lines but they do not show cycle behavior like up, down arrow keys

It says: beginning of history or end of defaults no next item

(define-key minibuffer-local-map (kbd "C-n") 'next-history-element)
(define-key minibuffer-local-map (kbd "C-p") 'previous-history-element)

[Q] Instead of using up or down arrow keys, is it possible to use keybinding as C-n(down) and C-p(up) to iterate after typing C-x C-f?


texts:
In Vim you can press . to repeat the latest change, including inserting text.

While in Emacs C-x z only repeats the last command. I am aware that macros can be used here, but more than often I realize that I need to re-insert the same text too late. When I need to re-insert it only one more time, defining a macro then is pointless.

Q: Is there a way to repeat the insertion of text inside of Emacs?


texts: Executing company-tabnine-install-binary has no effect

texts:
Let's say I opened a .cpp file and started to type a method call. Now I get the message that I should execute M-x company-tabnine-install-binary which I do execute. It succeeds yet when I try to type a method call (or anything similar) I get the same message, I should execute M-x company-tabnine-install-binary. I even tried restarting emacs after a successful(?) install, yet all in vain.
What should I do?


texts: How to auto copy when a region is selected?

texts:
Chrome browser has an excellent extension called autocopy, which copies text whenever some text is selected/highlighted.

To copy a region in emacs, I have to select the region and then press M-w to copy it. But whenever I select a region, I want the region to be copied automatically. How can I achieve that in emacs?


texts: org-mode : in a table, calculate a person's age based on their birthday

texts:
Let's say I have the following table:

| Name   | Age              | Date of Birth    | Income |
|--------+------------------+------------------+--------|
| Joe    |                  | <1984-02-20 Mon> |  84000 |
| Mark   |                  | <1974-04-15 Mon> | 120000 |
| Sophie |                  | <1970-08-28 Fri> | 150000 |
| Anna   |                  | <1988-02-29 Mon> | 160000 |

I want the second column to be the amount of years elapsed since the date in the third column.

I can't figure out how to do this with the TBLFM settings.


texts: Ignore certain system keyboard shortcuts

texts: I'm using the homebrew-emacsmacport version of Emacs on OSX 10.10 Yosemite. I've created an OSX shortcut to do something in iTunes, but when I'm in Emacs, this is captured and displays M-s-- is undefined (It's Command-Alt--). I understand that this is the correct behavior, but is it possible to have Emacs ignore this shortcut, so it can get to iTunes? Or is there some subset of keys that Emacs ignores generally?


texts: What is the distinction between copying text between a region BEG/END, and copying a region?

texts:
I was trying to add a custom functionality when using C-u before the "copying" command or kill-ring-save. So I jumped into the source code (pasted below for convenience) to examine what it originally does.

For brevity I will use the default binding M-w instead of M-x kill-ring-save.

It happens that doing C-u M-w sets the optional argument REGION to non-nil. From the function docstring, that would not just copy the text between BEG and END but also copy the region.

I did not understand that and so I tried out C-u M-w. But I saw no difference between M-w and C-u M-w.

Can someone please provide a way in which I can distinguish the behavior between the two?

Update

On closer inspection, I realized that actually C-u M-w and M-w will do the exact same thing.. because (prefix-numeric-value current-prefix-arg) will return 1 if no prefix arg is used, and will return 4 if C-u is used. In either case the REGION variable will be set to non-nil and the region-extract-function will be used.

So the core question is:

When does the REGION argument not get set to a non-nil value? Wouldn't prefix-numeric-value ALWAYS return something non-nil?

Source code of kill-ring-save

(defun kill-ring-save (beg end &optional region)
  "Save the region as if killed, but don't kill it.
In Transient Mark mode, deactivate the mark.
If `interprogram-cut-function' is non-nil, also save the text for a window
system cut and paste.

If you want to append the killed line to the last killed text,
use \\[append-next-kill] before \\[kill-ring-save].

The optional argument REGION if non-nil, indicates that we're not just copying
some text between BEG and END, but we're copying the region.

This command is similar to `copy-region-as-kill', except that it gives
visual feedback indicating the extent of the region being copied."
  ;; Pass mark first, then point, because the order matters when
  ;; calling `kill-append'.
  (interactive (list (mark) (point)
             (prefix-numeric-value current-prefix-arg)))
  (copy-region-as-kill beg end region)
  ;; This use of called-interactively-p is correct because the code it
  ;; controls just gives the user visual feedback.
  (if (called-interactively-p 'interactive)
      (indicate-copied-region)))


texts: Can I use Emacs as an external editor of Thunderbird in MS Windows OS?

texts:
I want to edit the text in Emacs when using Thunderbird.
I've installed the exteditor (https://github.com/exteditor/exteditor/releases)
and specified path to "Emacs.exe" as an editor, but it was not invoked
when I select "tools" -> "edit with external editor (Ctrl-E)" in mail
composition mode of Thunderbird.

I also tried to specify "Emacsclient.exe" with "M-x server-start" on,
but it was not working, too.

I appreciate if anyone knows what could possibly be a problem on this trouble.

Thanks in advance.


texts: How to get correct list numbering with code blocks items in Org-babel?

texts:
Here is a minimal working example of Org file for LaTeX export:
#+OPTIONS: toc:nil

* A list with R source blocks
1. This is the first item.
#+begin_src R :results output :session *R* :exports both
x <- 2
print(2*x)
#+end_src
2. This is the second item.

* Local Variables :noexport:
Local Variables:
org-latex-listings:nil
End:

Here is the output I get:

As you can see, the numbering of items in org lists is "broken" if one of the items contains a source block. Is there a way to avoid that, and to have the second item correctly labeled "2." ?
Thanks!


texts:
In CSV files (especially ones with a lot of columns and/or a lot of rows) I find that it's hard to tell which column I'm on.  Normally I'd like to know either the column heading, or sometimes the column index (usually I want the index only if there are no headings).  I know about csv-align-fields, which helps, but:

The heading names are not visible when you scroll down
Even with two windows displaying the CSV buffer (one scrolled to the top always), it takes mental effort to figure out which column you are on, and it is inconvenient to set up that window configuration for each CSV file you visit.

I can already just create two windows, but that is a bit tedious and does not solve problem 2.

I guess ideally I'd want something like which-function-mode but showing the current CSV heading name and index, AND also have headers always visible at the top of the frame or window by some means?

Short of that, I think this could be solved by some way to apply a saved window configuration to a buffer?  Then I could have one very short window at the top of the frame, scrolled to the top so that the headings are visible, and another window at the bottom displaying the same buffer for viewing/editing the bulk of the CSV.  Note that all the window configuration tools I've come across save the buffers together with the window configuration, but here I want a particular set of windows & their sizes to be restored and then have both windows display the same buffer.


texts: New version of Org mode throws dbus-call-method: peculiar error: "Emacs not compiled with dbus support"

texts:
I upgraded Org from the built-in 9.1.9 to the maint branch 9.3.3 (directions here). I now get this error when I clock in or out:

Debugger entered--Lisp error: (dbus-error "Emacs not compiled with dbus support")
  signal(dbus-error ("Emacs not compiled with dbus support"))
  dbus-call-method(:session "org.freedesktop.Notifications" "/org/freedesktop/Notifications" "org.freedesktop.Notifications" "Notify" :string "Emacs" :uint32 0 :string "/Applications/Emacs.app/Contents/Resources/etc/images/icons/hicolor/scalable/apps/emacs.svg" :string "Org mode message" :string "Task ‘zero email inbox’ should be finished by now. (0:30)" (:array) ((:dict-entry "urgency" (:variant :byte 0))) :int32 3000)
  notifications-notify(:title "Org mode message" :body "Task ‘zero email inbox’ should be finished by now. (0:30)" :timeout 3000 :urgency low)
  org-show-notification("Task ‘zero email inbox’ should be finished by now. (0:30)")
  org-notify("Task ‘zero email inbox’ should be finished by now. (0:30)" nil)
  org-clock-notify-once-if-expired()
  org-clock-update-mode-line()
  org-clock-in(nil)
  funcall-interactively(org-clock-in nil)
  call-interactively(org-clock-in nil nil)
  command-execute(org-clock-in)

From the depth of the error in the stack trace, I think this is a bug with Org mode or an incompatibility with my system (Emacs 26.3 (9.0) and macOS Mojave 10.14.6). I tried to catch the error with:

(condition-case nil
    (org-clock-in)
  (message "caught error clocking in"))

and I still get the error.

Is this a bug I should report? How can I silence it in the meantime?


texts: orgmode - inline image resize not happen

texts:
I have installed emacs 25.3.1 ("GNU Emacs 25.3.1 (x86_64-w64-mingw32)of 2017-09-26) and Imagemagick-6.8.8 on windows10. when I try below orgmode document (The tiger png file is downloaded here:

#+ATTR_HTML: :width 600px
[[./tiger.png]]

The displayed image still very small (resize not happen):

And below variable all nil:

#+BEGIN_SRC elisp :results output
(print org-image-actual-width)
(print (image-type-available-p 'imagemagick))
#+END_SRC

#+RESULTS:
:
: nil
:
: nil

Not sure if emacs still support imagemagick!


texts: command run in docker-tramp running on the host rather than remote

texts:
The setup:
I have a docker container connected with a mounted volume containing an org file. The docker container has both texlive and emacs (configured exactly the way it is on my host) installed. I can open the org file and run org-latex-preview on the math components without any problems.
The problem:
I recently installed docker-tramp and figured I wouldn't need a separate installation of emacs in my docker containers. However, when I opened the same org file and ran org-latex-preview I got the following message in the *Org Preview LaTeX Output* buffer:
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=latex)
 restricted \write18 enabled.
entering extended mode
! I can't find file `/tmp/orgtextfP6YZ.tex'.
<*> /tmp/orgtextfP6YZ.tex

(Press Enter to retry, or Control-D to exit)
Please type another input file name
! Emergency stop.
<*> /tmp/orgtextfP6YZ.tex

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

Now the orgtextfP6YZ.tex file is not in the docker container's /tmp folder; however, it has been generated in the host's /tmp folder. So the command that org-latex-preview uses (dvipng) accesses the host's /tmp folder, which means that dvipng was run on the host rather than the remote (docker container).
When I'm using a buffer I accessed through docker-tramp, any command I call using M-! runs in the remote. So how do I configure it (or TRAMP in general) so that commands used indirectly (called by a function in emacs) are also run in the remote?


texts:
My e-mail client is mu4e. I can easily create links to org-mode files via org-mu4e-store-and-capture, as described here https://www.djcbsoftware.nl/code/mu/mu4e/Org_002dmode-links.html, for instance.
Now I would like to additionally link from some non-emacs MacOS app, such as the calendar, to e-mails in mu4e. I have to solve two problems for this:
(1) When I have already a link to an e-mail message of the form mu4e:msgid:....@....com (like the links stored in org mode). How can I open such a link via emacsclient?
I would like to run the command
/usr/local/bin/emacsclient --eval 'SOMEFUNCTION "mu4e:msgid:....@....com"'

in a shell, where SOMEFUNCTION is the function that org-mode calls when a link of the form mu4e:msgid:....@....com is clicked. How can I determine the name of this function, in order to use it in the above shell command?
(2) When I am viewing an e-mail in mu4e, I would like to call a function that provides me with the mu4e:msgid:....@....com link to this e-mail. This happens (among other things) in org-mu4e-store-and-capture, how can I use this to copy a link to the clipboard in order to paste it to another MacOS application?
Thanks in advance for any advice!


texts: How to prevent scroll up doing nothing when the value is too big?

texts:
When calling (scroll-up N) with a large value that would exceed the buffer length - nothing happens.

For example:

(global-set-key (kbd "<f4>") (lambda () (interactive) (scroll-up 10000)))

Prints End of buffer but doesn't scroll.

Is there a way to scroll that clamps to buffer bounds instead of failing silently?


texts:
Suppose I want to show text data in two columns like here:

As you can see the font in the columns is proportional (not monospace).

How can text data be shown in an emacs buffer like this, with the first characters in the two columns lining up nicely like on the picture? With proportional font.


texts: Syntax highlight narrowed python string literals as code

texts:
I have some python code, that has some long string literals containing more python code. These strings should most of the time be uniformly colored, as happens by default.

However, I would like to be able to some times narrow my buffer to any of these strings, and then have emacs syntax highlight them as if they were code, not strings within code (i.e. as if the """ weren't there in the original buffer)

Is there any way to do that, that does not involve lots of elisp?

NOTE: I do not need to necessarily need narrowing, just seemed better to change the syntax highlighting like that, as in the full buffer it would be confusing...


texts: EmacsLisp comments invisible after switching to Solarized theme

texts:
On Arch Linux, running Emacs within Alacritty, comments in .el files are invisible since switching to the Solarized-Light theme. Tinkering with some of the color settings in my alacritty.yml hasn't yielded any success--I was operating off the assumption that it was the matter of two color settings that were identical when they shouldn't be, but tampering with the relevant colors didn't appear to do anything. In addition to the comments being invisible, my cursor disappears entirely when I move it over commented text.
I'm not sure if this matters, but I'm running Wayland rather than X11.
Here's the color section of my alacritty.yml:
# Colors (Solarized Light)
colors:
  # Default colors
  primary:
    background: '0xfdf6e3'
    foreground: '0x586e75'

  # Normal colors
  normal:
    black:   '#073642'
    red:     '#dc322f'
    green:   '#859900'
    yellow:  '#b58900'
    blue:    '#268bd2'
    magenta: '#d33682'
    cyan:    '#2aa198'
    white:   '#eee8d5'

  # Bright colors
  bright:
    black:   '#002b36'
    red:     '#cb4b16'
    green:   '#586e75'
    yellow:  '#657b83'
    blue:    '#839496'
    magenta: '#6c71c4'
    cyan:    '#93a1a1'
    white:   '#fdf6e3'

Please let me know if any other information is required.


texts: Edit simultaneously many buffers and save all of them after edit

texts:
Windows 10, Emacs 25.1, Helm

I open 3 different files:

I need:

Edit simultaneously all buffers. Add text "customer/" to the node "bodyFileName"in all buffers.
After edit save all buffers,

Here result:

Is it possible?


texts: How to set schedule and deadline for entires being inserted via org-capture template file?

texts:
I'm trying to leverage the power of org capture templates. There are a few tasks I know I will be scheduling on particular dates of the month.
Setting their schedule and deadline in the capture template automatically would be quiet cool, however I'm unable to get to a decent solution.

Consider this example: year and month-name are variables I have initialized via setq (is it an acceptable way to do this?)

** TODO pay salaries
   %(org-schedule 0 (format "%s %s 1 9am" year month-name))

However when this is evaluated, what I get in the file looks like this:

** TODO pay salaries
    Scheduled to <2019-09-01 Sun 09:00>

Besides constructing the scheduled and deadline strings manually, is there any other way to achieve this?


texts:
I want to color a word in emacs. So I open a somefile (C-x C-f somefile) and a write some silly sentence.

Now I want to colorize the word silly with yellow. So, with the mouse I chose Edit > Text Properties > Other and in the mini-buffer I write yellow.

Finally I save the file (C-x C-f) and close it (C-x k).

Now when I open the file again, the word silly will not appear in yellow.

The result is the same whether enriched-mode is set or not.

Can someone please explain me why?

This post is similar to the one found here Colors with enriched-mode which has no accepted answer and (unfortunately) a downvote, but no good explanation and that's the reason I post this question.

I'm running emacs 25.1.1.


texts:
When I edit C/C++ files time to time in the middle of buffer,
I decide to add #include at the begin of buffer.
Save position jump to begin of buffer, then insert suitable line, then
jump back is boring.

I wonder may be there is standard (emacs build-in/elpa/melpa) solution to deal with such problem?

I mean some elisp code to find #include directives at the begin of file and insert new one.

If there are no, may be there is such solution for other languages for import (Java, Python), use (Rust) and so on which I can modify for C++?


texts: How to get the arguments of an advised function?

texts:
After my initial config, ido-read-internal becomes advised by flx:

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

So now I get this:

(help-function-arglist 'ido-read-internal t)
;; => (&rest rest)

instead of this:

(help-function-arglist 'ido-read-internal t)
;; => (item prompt hist &optional default require-match initial)

I've found a small work around for this:

(ad-deactivate 'ido-read-internal)
(help-function-arglist 'ido-read-internal t)
(ad-activate 'ido-read-internal)

Is there a better way to do this? Are there any side-effects of
calling ad-deactivate and ad-activate?


texts: How to programmatically execute a command in eshell?

texts: I want to execute simple commands in eshell without explicitly typing them into the prompt, using something like with-current-buffer How can I do this?


texts:
I am using org-babel to write R code in Emacs org-mode. Here's an example:

#+BEGIN_SRC R :session *R* :results output graphics :width 5 :height 5

data(AirPassengers)
AP <- AirPassengers
plot(AP)

#+END_SRC

What I would like to do with this, is to add a header argument that tells babel to save the outfile using org-attach, so that I don't have to specify a filename or directory.

There used to be a way to do this with org-R using the header args #+R outfile:"png". But this seems to be depricated in org-babel... Any ideas?


texts:
I am viewing remote log files using tramp mode in emacs. Is there a way to get tramp to auto-refresh  these buffers when they change remotely? If this is not possible, is there a way to reload a buffer every time it is opened?

I have tried to set (global-auto-revert-mode t), but this does not work.

Edit: Just found out that this is intended behaviour:

  You can also tell Emacs to revert buffers periodically. To do this for
  a specific buffer, enable the minor mode Auto-Revert mode by typing
  M-x auto-revert-mode. This automatically reverts the current buffer
  every five seconds; you can change the interval through the variable
  auto-revert-interval. To do the same for all file buffers, type M-x
  global-auto-revert-mode to enable Global Auto-Revert mode. These minor
  modes do not check or revert remote files, because that is usually too
  slow.


texts: Turn on projectile-mode only for files in actual projects

texts:
Projectile is pretty great, but I'm finding it difficult to have it turned on only in places where it would be effective.

As I understand it, the two standard choices are to turn it on manually, as in major mode hooks, or to enable it globally with projectile-global-mode.  I find the former not broad enough; I want to be able to access projectile commands while visting any file in a project, regardless of its type.  But turning the mode on globally is too broad; it gets turned on even when visiting such manifestly non-project directories as my home directory, /tmp, /etc, etc.

Is there a standard way to activate projectile-mode only when visiting a file that lives in an actual project, as might be determined by, say, checking for the existence of a .git, .svn, etc, directory in some ancestor directory of the current file?


texts: Swiper - How to move pointer to the next search item in the same line

texts:
I use swiper package to search and to navigate and I use C-n & C-p to search next and previous items. However, this doesn't go through the search items on the same line even though they are highlighted. I think it only cycles through the first items per given line.

Is there a way to move pointers to all search items even if they are on the same line?

I tries looking around for answers but was unsuccessful.

Any suggestions would be much appreciated.


texts: How filter text in shell interactively ("on fly")?

texts:
windows 10, Emacs 26.1

M-x shell

I start Android application that very long time generate many lines in shell.

adb logcat -vtime

Here example:

In all of this text I need only lines that contain this text:

com.example.myprojectname

I need to filter this "on fly" interactively. It's very important.
So the result must be.

M-x shell
Start my Android app
On shell show ONLY lines that contains text com.example.myprojectname
This MUST be happen "on fly" interactively

Is it possible?


texts: How can I turn of highlighting of empty lines/spaces?

texts:
http://i.imgur.com/3wZ7XKs.png

How can I turn off this highlighting of empty lines/spaces?

I am using spacemacs, so I would appreciate if answers could tell me how to disable the highlighting through the spacemacs infrastructure rather than through vanilla Emacs.


texts: Exporting Devanagarai text from org-mode to LaTeX?

texts:
I have a .tex file with text in Devanagari script. I am able to convert to pdf using XeLaTeX outside of Emacs without any problem. However, when I try it within Emacs, the resulting pdf does not have any Devanagari text.

I am new to emacs, and am using spacemacs 25.1.

Here are the solutions I have already tried, but I couldn't get them to work:

https://www.r-bloggers.com/hindidevanagari-presentations-using-orgmode-r-latex-and-beamer/
https://tex.stackexchange.com/questions/21200/auctex-and-xetex
https://stackoverflow.com/questions/15926817/add-xelatex-to-the-command-list
http://orgmode.org/worg/org-faq.html#using-xelatex-for-pdf-export

I have tried many combinations and variations of these to no success.

How do I generate a pdf from within Emacs that shows the Devanagari script?

EDIT:

Here is the minimal example which works in a .tex file if compiled with xelatex outside of emacs environment:

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{sanskrit}
\setotherlanguage{english}
\setmainfont[Script=Devanagari]{Arial Unicode MS}
\newfontfamily\devanagarifontsf[Script=Devanagari]{Arial Unicode MS}

\begin{document}

मया emacs बहु रोचते।

\end{document}

However, when I try to write the same in org mode, desired output is not generated. Here is the content of my org mode file:

#+Title: Generating Devanagarai text in LaTeX?
#+LATEX_CMD: xelatex
#+LATEX_HEADER: \usepackage{polyglossia}
#+LATEX_HEADER: \setmainlanguage{sanskrit}
#+LATEX_HEADER: \setotherlanguage{english}
#+LATEX_HEADER: \setmainfont[Script=Devanagari]{Arial Unicode MS}
#+LATEX_HEADER: \newfontfamily\devanagarifontsf[Script=Devanagari]{Arial Unicode MS}

मया emacs बहु रोचते।

If the org file is exported as html, the output has both Devanagari and English text as expected. However, no pdf output is generated when exporting as latex.


texts: Change fill-column-indicator rule color immediately

texts:
How can I change the color of the fill-column-indicator and have the changes visible immediately?

(defun my:change-fci-color (color)
  (setq fci-rule-color color)
  (fci-redraw-frame))

The previous code doesn't change the color in existing buffers until the major mode is changed or I reload the buffer.

The following code works but feels like a gross hack.

(with-current-buffer "fill-column-indicator.el"
  (when fci-mode
    (turn-off-fci-mode)
    (turn-on-fci-mode)))

Ultimately, I want to change fci-rule-color based on the current theme's background color.  So, when I change from a light theme to a dark theme, fci-rule-color remains a subtle shade off of the background color.


texts:
I was trying to use this code shared by @JordonBiondo over here to collect regex matches in a list.

(defun matches-in-buffer (regexp &optional buffer)
  "return a list of matches of REGEXP in BUFFER or the current buffer if not given."
  (let ((matches))
    (save-match-data
      (save-excursion
        (with-current-buffer (or buffer (current-buffer))
          (save-restriction
            (widen)
            (goto-char 1)
            (while (search-forward-regexp regexp nil t 1)
              (push (match-string 0) matches)))))
      matches)))

When we run this code:

(insert
(print (format "%s"
 (matches-in-buffer "//select/items/[A-Z_0-9]+" (current-buffer)))))

We get a nice list of matching items printed out below, as expected.

(//select/items/1_7YBDN5YT //select/items/1_8JVACVAG //select/items/1_8JVACVAG)

Question

My question is: How do we print out the elements on the list line by line?

//select/items/1_7YBDN5YT
//select/items/1_8JVACVAG
//select/items/1_8JVACVAG

Running the code below results in an error.

(setq rslt
      (format "%s"
              (matches-in-buffer "//select/items/[A-Z_0-9]+" (current-buffer))))

(defun print-elements-of-list (list)
  "Print each element of LIST on a line of its own."
  (while list
    (print (car list))
    (setq list (cdr list))))

(print-elements-of-list rslt)

Error:

(wrong-type-argument listp "(//select/items/1_7YBDN5YT //select/items/1_8JVACVAG //select/items/1_8JVACVAG)")

Sample Data:

* Lorem Ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit. [fn:105d40022edca6cb:This is a footnote with citations. [[//select/items/1_8JVACVAG][Author,Title]]，pp.502-2. ]Phasellus vitae luctus risus, nec porta est. Nunc ut turpis quam. Phasellus at porta justo, non pellentesque ante. Mauris volutpat egestas tristique. Proin rhoncus diam at diam tincidunt vestibulum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Quisque gravida gravida lorem, ullamcorper porta sem auctor non. Nullam tincidunt maximus rutrum. Fusce nec ante leo. Suspendisse vel rutrum lorem. Donec vitae mattis orci.

Curabitur sed orci fringilla, molestie ex non, venenatis urna. Ut sollicitudin leo eu dolor tincidunt porta. Nullam neque justo, ullamcorper quis ligula fringilla, mollis faucibus elit. Duis at eleifend ligula. [fn:9fc32cc5941ded6: This is another. [[//select/items/1_8JVACVAG][Title]]，pp,502-2. ]Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce vel consectetur ligula, eu tempus ipsum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris et mauris eget odio eleifend lobortis. Nunc non est eros. Morbi scelerisque non libero sit amet egestas. Nullam finibus sagittis dictum. Quisque feugiat, nisl ullamcorper pharetra pretium, quam metus consectetur sapien, in imperdiet purus velit ut nulla. Aenean pretium, ex vitae convallis facilisis, diam eros posuere est, ac consectetur nulla nunc vitae augue. Nullam hendrerit ligula ac nisi malesuada tempor.

Duis sit amet leo ultricies, ullamcorper purus eget, rhoncus ipsum. In hac habitasse platea dictumst. Sed quis sem urna. Maecenas orci magna, eleifend at libero vel, accumsan ornare ipsum. Suspendisse potenti. In tincidunt, neque ut bibendum molestie, augue sapien semper libero, sed pretium odio felis nec mauris. [fn:1d9d0df7958ea454:For a different book see [[//select/items/1_7YBDN5YT][Author, Title]]. ] Aenean nisi quam, semper vel mi nec, hendrerit convallis turpis. Maecenas at rutrum orci, quis ultrices felis. Fusce quis mi dapibus nibh elementum condimentum et id dolor. Sed varius neque eu ante vestibulum dapibus. Sed ac pharetra turpis, a laoreet nunc. Proin dignissim magna nec magna venenatis, eget placerat nunc mollis. Praesent pretium, erat id imperdiet fringilla, nibh dui luctus ligula, at aliquam metus neque quis ex.


texts: How to create shortcut that will kill process for buffer with fixed name

texts:
I have code like this to run R command from Emacs:

(defun call-r-command (command-list)
  "run R command in shell buffer window

  if there is displayed buffer that have shell it will use that window"
  (let* ((name "*R*")
         (new-buffer (get-buffer-create name))
         (old-buff (get-buffer name))
         (script-proc-buffer
          (apply 'make-comint-in-buffer
                 "script"
                 new-buffer
                 "c:/Program Files/R/R-3.5.2/bin/R.exe"
                 nil
                 command-list))
         (old-window (if old-buff (get-buffer-window old-buff)))
         (window (or old-window
                     (get-window-with-mode '(comint-mode eshell-mode))))
       (script-proc (get-buffer-process script-proc-buffer)))
    (if window
        (set-window-buffer window new-buffer)
      (switch-to-buffer-other-window new-buffer))))

I use this function to build R package:

(defun build-r-package ()
  (interactive)
  (call-r-command `("CMD" "INSTALL" ,(git-root-repo))))

for this I don't need to kill the process but I need this when I run process that still running (I call this function that run shiny server):

(defun shiny ()
  "run shiny R application in shell buffer"
  (interactive)
  (let ((R (concat "shiny::runApp('" default-directory "')")))
    (call-r-command `("-e" ,R "--no-save"))))

So who can I make it so when I press q it will kill the process when I'm in *R* buffer? Do I need to use set-process-sentinel function? Do I need to create minor mode to add q into *R* buffer?

I completely don't know how to make this work. Any help is appreciated. If you provide code that will make it work, it would be awesome.


texts: Differences between evil-normal-state-map and evil-motion-state-map

texts:
Documentation for evil-normal-state-map:

  Keymap for Normal state.

Documentation for evil-motion-state-map:

  Keymap for Motion state.

Does Vim have a so-called "motion mode"? In Vim, executing :help Normal-mode would give you the documentation on Vim modes, while :help Motion-mode tells me E149: Sorry, no help for Motion-mode.

Also, when mapping keys in evil-state, which statement should I use?

(define-key evil-normal-state-map (kbd <key>) <command>)
(define-key evil-motion-state-map (kbd <key>) <command>)

I'm using Spacemace, in case it's relevant.


texts: Get describe-key links to bring me to org-mode config files, not .el config files?

texts:
For my Emacs configuration, I use a literate programming setup. My config files are in org-mode format, and my init.el file consists mostly of org-babel lines like (org-babel-load-file "~/emacs/startup.org").

I often use describe-key to look up custom functions I have created in order to edit them. However, describe-key gives me something like:

M-s-g runs the command gnugol, which is an interactive Lisp function in `startup.el'.

in which startup.el is a link to that file. However in my case, startup.el is a file that's automatically generated (tangled?) every time I launch Emacs, so any edits I make to it will get overwritten.

How do I tell describe-key to instead give me a link directly to startup.org (or whatever config file contains the defun) so I can edit my actual config files?


texts:
I clone git project. Current branch is main.
Nice. Now I want to  create new branch: my-branch
Magit Branch Read Upstream First: Value Menu read upstream first
I try this:
magit-branch-create

Create branch starting at (default  main): my-branch

But I get error:
Not a valid starting-point: my-branch


texts:
Is it possible to detect and set the correct ispell language based on the contents of the buffer?

And beyond that: A markdown file can contain multiple human languages at the same time, perhaps Swedish in paragraphs but english in code sections, is it possible to use different dictionaries for different parts of the buffer?