texts:
I want to bind C-return to org-insert-item

  (global-set-key (kbd "<C-return>") 'org-insert-item)

When restart emacs, it does not work

consult to describe-key it still return the default key sequence.

<C-return> runs the command cua-set-rectangle-mark (found in
cua-global-keymap), which is an interactive autoloaded Lisp function
in ‘cua-rect.el’.

It is bound to <C-return>.

[Arg list not available until function definition is loaded.]

Start rectangle at mouse click position.

What's the problem with my key binding?


texts:
I am a beginner at org-tables, trying to use them for computing grades in a class I'm teaching. I have a table showing attendance records for a student, resulting in a mean that I'd like to use in a calculation in another table. Is it possible?

#+NAME: attendance
| time   | grade            |
|--------+------------------|
| week 1 | 1                |
| week 2 | 0                |
| week 3 | 1                |
|--------+------------------|
| grade  | :=vmean(@I..@-I) |

#+NAME: grades
| assignment | grade                            |
|------------+----------------------------------|
| attendance | [INSERT VMEAN FROM "attendance"] |
| paper 1    | 2.5                              |
| paper 2    | 2.5                              |
|------------+----------------------------------|
| final grade| :=vmean(@I..@-I)                 |


texts: How to embed pgfplots picture in org-mode

texts:
I want to include tikz/pgfplots pictures in an org-mode document both for inline visualisation and export.
I have tried approaches given in this emacs-orgmode thread and in the worg documentation dedicated to latex. However, none provided me with a working example.
Based on the sources above I've tried the following:
#+begin_src latex :results output file graphics :file test.svg
  \begin{tikzpicture}
    \begin{axis}[title=Title, xlabel={X}, ylabel={Y}, legend entries={A,V}]
      \addplot [mark=square, thin, blue] table [x=x, y=y, col sep=comma] {my_csv1.csv};
      \addplot table [x=x, y=y, col sep=comma] {my_csv2.csv};
    \end{axis}
  \end{tikzpicture}
#+end_src

This produces a svg picture with missing features. In comparison, the pdf produced with the same code leads to the expected figure.

I understood the process to generate a svg figure with a babel latex source code is different from the one to generate a pdf, hence the disparity. Actually, it seems that htlatex (called under the hood by org-babel-execute:latex) fails to produce the expected svg from the tex code.
How can I generate tikz/pgfplots pictures so they appear first inline in the org-mode document and then export them easily as I export the document to latex?
I'm using spacemacs with emacs 26.3


texts: How to use the menu bar in terminal emacs?

texts:
I am using emacs on the remote server, and I have no idea how to click on options in the menu bar across the top in this context.

Here is a screen capture:

For example, I want to click some options under "File" in the menu bar (on the top), how can I do that?


texts:
I use eww to open an image from wikipedia:

https://upload.wikimedia.org/wikipedia/commons/6/6a/The_Burning_of_the_Houses_of_Parliament.jpg

Now, I wanted to save it to my computer.

How can I do that?


texts: Why is company mode not working with company-tng?

texts:
I've got a setup like the following in my init.el
(use-package company
  :ensure t
  :after lsp-mode
  :hook (after-init . global-company)
  :bind
  (:map company-active-map
    ("<tab>" . company-complete-selection))
  (:map lsp-mode-map
    ("<tab>" . company-indent-or-complete-common))
  :custom
  (company-minimum-prefix-length 1)
  (company-idle-delay 0.0))

(use-package company-box
  :after company-mode
  :hook (company-mode . company-box-mode))

However, I keep seeing the error failed to define Autoloading file /Users/nland/.emacs.d/straight/build/company/company-tng.el failed to define function company-tng-mode I have no idea why this is happening. I've looked in company-tng.el and there is no function company-tng-mode and I'm kind of lost now.


texts: org-anniversary entries not appearing in Agenda

texts:
What would prevent org-anniversary entries from appearing in the Agenda? Entries such as:

%%(org-anniversary 2015 01 01) New Year's Day

fail to show in the Agenda. I have toggled org-agenda-include-diary FWIW.

Update: Using Org 9.0.4:

I have ensured that the %% starts flush on the left margin.
I have tested the anniversary entry under a * and ** headline.
I have included the PROPERTIES drawer, as included in some example.
I have  replaced the leading 0 characters in the dates with a space.

None of the above solved this -- the anniverary does still not appear in the agenda.

Starting Emacs with -Q and then evaluating only setq org-agenda-files ... to set my agenda file also doesn't result in the anniverary appearing in the agenda.

Including %%(org-calendar-holiday) results in those holidays appearing in the agenda.


texts:
I had a look over the weekend, and I cannot see an easy way to check whether a function is advised.

I must be missing something.

HELP! :)


texts: The orgstruct-mode seems to be gone from the org-plus-contrib

texts:
I've been using orgstruct in my message mode hooks but it seems it is gone now in the 20181230 org ELPA package.

(add-hook 'message-mode-hook 'turn-on-orgstruct)
(add-hook 'message-mode-hook 'turn-on-orgstruct++)

as described in the Org-mode info https://orgmode.org/manual/Orgstruct-mode.html are not working anymore.  Does somebody know what happened?


texts: Org-mode logbook: how to thange the structure in the first line of each log?

texts:
Emacs org-mode can add LOGBOOK entries to headlines, for instance to task headlines.

or more generally, to a plain text headline

In the two examples the first line in each log entry consists of a text with fixed formate, and these were, respectively,

- State "<new state>" from "<former state>"    [yyyy-mm-dd day HH:MM] //

and

- Note taken on [yyyy-mm-dd day HH:MM] //

How can I change the structure and fixed text of the first line in each log entry?

For instance, I would like to change the position of the date+time entry from the end to the start of the line, like this

   - [yyyy-mm-dd day HH:MM] State "<new state>" from "<former state>"    //

Thanks for any suggestions.


texts: Pulseaudio and `shell-command` calls in Emacs

texts:
I'm trying to execute shell-commands in emacs which play sounds or otherwise involve audio output, but I'm not having much luck.

When I execute:

(shell-command
 (concat "espeak -v mb-en1 -k5 -s150 " "'" "hello" " " "world" "'" " --stdout|paplay"))

No audio output is generated and I find the following message:

Connection failure: Connection refused
pa_context_connect() failed: Connection refused
1 (#o1, #x1, ?\C-a)

A different though related problem, if I try:

(shell-command
                (concat "mplayer -really-quiet " "/usr/share/sounds/speech-dispatcher/test.wav" " 2> /dev/null"))

Again, I don't actually get any audio output and I find the message:

(Shell command succeeded with no output)
0 (#o0, #x0, ?\C-@)

Both commands work as expected from the actual terminal shell (i.e. they produce audio output).

Edit: Ok, this seems to be part of a more general problem.  On my home computer I finally got everything to work by allowing greater permissions to pulse-audio. However, now on my office computer, I'm having trouble getting notify-send to work when issued in shell-command in Emacs.  I'm getting the same odd 0 (#o0, #x0, ?\C-@) message when I try to do this.


texts: Change the color of the wrap around arrow

texts:
So I would like to change the color of the arrow that shows the text is being wrapped. Specifically the red arrow shown here:

I have tried searching myself and the closest I came is finding out the sides are called "fringe"s and this answer. But where I hit a stump is figuring out the syntax of the function, set-fringe-bitmap-face bitmap &optional face.

I assume means something like this: (set-fringe-bitmap-face 'left-curly-arrow ((t (:foreground "#616161")))) But my problem is I don't know how to write the correct syntax for a [face] symbol. Also I don't even know if this would do what I want which is just to change the color of that red arrow to something that fits my theme.

Thanks for any help.


texts: Why is file buffer replaced by scratch buffer on startup?

texts:
When I open an R file in ESS-mode, I'd like emacs to setup my panes in a certain format.

To this end, I've added the following to my init.el.
(add-hook 'ess-mode-hook
          (lambda()
            (split-window-horizontally)
            (other-window 1)
            (vterm)
            (R)
            ))

When I run emacs myfile.R, emacs opens and prompts me to specify a project directory, which I do. This results in the vertical split on the right, which gives me pretty much what I show above. Awesome! But there is one problem. While myfile.R is opened as a buffer, the left-hand pane actually shows the scratch buffer. Why is that and how do I avoid it?


texts: How do I create a floating tikz figure when exporting to PDF in org-mode?

texts:
With org-mode 8.2.10 on Emacs 24.5.1, the following will produce a ditaa figure in the exported PDF (LaTeX):

#+BEGIN_SRC ditaa :file foo.png :cmdline -E -s 4 -S
+---------+
| testing |
+---------+
#+END_SRC
#+CAPTION: ditaa caption
#+LABEL: fig:ditaa
#+attr_latex: :width 1in
#+RESULTS:
[[file:foo.png]]

If I try to do the same thing but using tikz to generate a figure, it does not work.  The following example (copied from the org-mode documentation) simply produces a PDF containing the string "[[file:fsa.pdf]]".

#+begin_src latex :file fsa.pdf :packages '(("" "tikz")) :border 1em
  % Define block styles
  \usetikzlibrary{shapes,arrows}
  \tikzstyle{astate} = [circle, draw, text centered, font=\footnotesize, fill=blue!25]
  \tikzstyle{rstate} = [circle, draw, text centered, font=\footnotesize, fill=red!25]

  \begin{tikzpicture}[->,>=stealth', shorten >=1pt, auto, node distance=2.8cm, semithick]
    \node [astate] (1) at (0,0) {1};
    \node [astate] (2) at (1,0) {2};
    \node [rstate] (3) at (2,0) {3};
    \path (1) edge [bend left] node {b} (2)
          (2) edge node {b} (3)
          (2) edge [bend left] node {a} (1)
          (3) edge [loop above] node {(a, b)} (3);
  \end{tikzpicture}
#+end_src
#+CAPTION: tikz caption
#+LABEL: fig:tikz
#+RESULTS:
[[file:fsa.pdf]]

How do I generate a floating tikz figure without manually using \begin{figure}...\end{figure}?


texts:
I am working on Org 9.1.8 and emacs 26.1,

Every  time I invoke Enter, it prompts

Debugger entered--Lisp error: (wrong-type-argument wholenump -98)
  make-list(-98 nil)
  lisp-indent-initial-state()
  indent-sexp()
  paredit-newline()
  funcall-interactively(paredit-newline)
  call-interactively(paredit-newline nil nil)
  command-execute(paredit-newline)

What' s the problem?


texts:
I'm running Emacs on MacOS and I installed aspell and its English dictionaries through nix. When I open a file, flyspell throws the following error.

Error enabling Flyspell mode:
(Error: No word lists can be found for the language "en_US".)

When I set ispell-change-dictionary to english and then try to re-enable flyspell mode, flyspell throws this error message instead:

Error enabling Flyspell mode:
(Error: The file "/nix/store/my1hch4x12i5n1ffhlwpb6bpsiajbv3j-aspell-0.60.6.1/lib/aspell/english" can not be opened for reading.)

I don't know if this is actually the problem, but the above suggests to me that in both cases flyspell is not looking in the correct directory for dictionaries, which for nix should be /nix/store/<hash>-aspell-dict-en-<version>/lib/aspell. Would anyone know how I get ispell to look in the right directory?

If it's relevant, running aspell dump dicts from my shell lists all the dictionaries I have installed, but the output of aspell config makes no mention my nix store's aspell-dict-en directory.

edit: here are the requested variable values:

ispell-program-name == "aspell"
ispell-aspell-data-dir == nil
ispell-dictionary == nil
ispell-local-dictionary == nil
ispell-dictionary-alist == ((nil "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
      ("-B")
      nil utf-8)
 ("american" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-B")
  nil utf-8)
 ("brasileiro" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)
 ("british" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-B")
  nil utf-8)
 ("castellano" "[[:alpha:]]" "[^[:alpha:]]" "[-]" nil
  ("-B")
  "~tex" utf-8)
 ("castellano8" "[[:alpha:]]" "[^[:alpha:]]" "[-]" nil
  ("-B" "-d" "castellano")
  "~latin1" utf-8)
 ("czech" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B")
  nil utf-8)
 ("dansk" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-C")
  nil utf-8)
 ("deutsch" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C")
  "~tex" utf-8)
 ("deutsch8" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C" "-d" "deutsch")
  "~latin1" utf-8)
 ("english" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-B")
  nil utf-8)
 ("esperanto" "[[:alpha:]]" "[^[:alpha:]]" "[-']" t
  ("-C")
  "~latin3" utf-8)
 ("esperanto-tex" "[[:alpha:]]" "[^[:alpha:]]" "[-'`\"]" t
  ("-C" "-d" "esperanto")
  "~tex" utf-8)
 ("finnish" "[[:alpha:]]" "[^[:alpha:]]" "[:]" nil
  ("-C")
  "~list" utf-8)
 ("francais7" "[[:alpha:]]" "[^[:alpha:]]" "[`'^-]" t nil nil utf-8)
 ("francais" "[[:alpha:]]" "[^[:alpha:]]" "[-'.@]" t nil "~list" utf-8)
 ("francais-tex" "[[:alpha:]]" "[^[:alpha:]]" "[-'^`\".@]" t nil "~tex" utf-8)
 ("german" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C")
  "~tex" utf-8)
 ("german8" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C" "-d" "german")
  "~latin1" utf-8)
 ("italiano" "[[:alpha:]]" "[^[:alpha:]]" "[-.]" nil
  ("-B" "-d" "italian")
  "~tex" utf-8)
 ("nederlands" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C")
  nil utf-8)
 ("nederlands8" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C")
  nil utf-8)
 ("norsk" "[[:alpha:]]" "[^[:alpha:]]" "[\"]" nil nil "~list" utf-8)
 ("norsk7-tex" "[[:alpha:]]" "[^[:alpha:]]" "[\"]" nil
  ("-d" "norsk")
  "~plaintex" utf-8)
 ("polish" "[[:alpha:]]" "[^[:alpha:]]" "[.]" nil nil nil utf-8)
 ("portugues" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C")
  "~latin1" utf-8)
 ("russian" "[[:alpha:]]" "[^[:alpha:]]" "" nil nil nil utf-8)
 ("russianw" "[[:alpha:]]" "[^[:alpha:]]" "" nil nil nil utf-8)
 ("slovak" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B")
  nil utf-8)
 ("slovenian" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B" "-d" "slovenian")
  nil utf-8)
 ("svenska" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-C")
  "~list" utf-8)
 ("hebrew" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B")
  nil utf-8))

And the output of aspell dump dicts | grep en_US is:

en_US
en_US-variant_0
en_US-variant_1
en_US-w_accents
en_US-wo_accents


texts: ESS start process does not include new R version

texts:
I am using the windows version of emacs that includes AuTeX and ESS from Vincent Goulet. I was using an older version of this packaging with a couple different versions of R. I recently installed the new version of R (4.0.2) and am attempting to connect it to emacs. I have added the directory that contains the R version 4.0.2 to my path and also added the folder that contains the 3 different version of R that are installed on my machine. When I open a .R file and open an instance of R it opens an R version of 4.0.2. However, when I go to the ESS menu and try to start a new process (ESS>Start Process>Other>) the options that I see are R-3.4.4-32bit, R-3.4.4-64bit, R-3.5.1-32bit, R-3.5.1-64bit. Similarly, if I try to complete M-x R the options do not include the R-4.0.2 version. Also when I tried M-x R-newest I got the error: Symbol's function definition is void R-newest. I have tried again to run M-x R-newest but now it stats [no match].
I was previously using an older release version Vincent Goulet's emacs but updated it while attempting to fix this issue. The current version I am using is emacs 26.3 with ESS 18.10.2. I have tried changing the PATH variable in numerous ways to include/exclude the directory of the R verions for the older versions. I tried looking in the lisp and changing some custom variables in my .emacs file to no avail, such as
(custom-set-variables
 '(ess-rterm-version-paths
   (quote
    ("C:/Program Files/R/R-4.0.2/bin/x64/Rterm.exe" "C:/Program Files/R/R-4.0.2/bin/i386/Rterm.exe" "C:/Program Files/R/R-3.5.1/bin/i386/Rterm.exe" "C:/Program Files/R/R-3.4.4/bin/i386/Rterm.exe" "C:/Program Files/R/R-3.5.1/bin/x64/Rterm.exe" "C:/Program Files/R/R-3.4.4/bin/x64/Rterm.exe")))
)

How do I get ESS to recognize R-4.0.2 (both 32bit and 64bit) and add it to the list of available processes?


texts: How do I make emacs indent relative to the beginning of the previous line?

texts:
Here's how emacs indents e.g. Python code:
a = myfun(b,
          c)

I'd like it to be this way:
a = myfun(b,
    c)

Reasoning? If I later replace myfun with myfunction, in the first case it becomes:
a = myfunction(b,
          c)

I can probably use aggressive-indent-mode, but not everybody uses emacs. If I'd like to contribute to, say, an open source project, I can't just impose it on other people.
Is there a way out? For Python? Ruby? Or Javascript? Any of these?


texts:
* Core
- [X] CS 501
- [X] CS 502
- [X] CS 503
- [ ] ORG 601 [Fall 2021]
- [ ] ORG 602 [Fall 2021]
- [ ] ORG 603 [Fall 2021]

* Schedule
** Spring 2021
- [X] CS 501
- [X] CS 502
- [X] CS 503

** Fall 2021
- [ ] ORG 601
- [ ] ORG 602
- [ ] ORG 603

Link checkboxes from the Core header so that toggling ORG 601 anywhere, toggles it everywhere
* Core
- [X] CS 501
- [X] CS 502
- [X] CS 503
- [ ] ORG 601 [Fall 2021]
- [ ] ORG 602 [Fall 2021]
- [ ] ORG 603 [Fall 2021]

* Schedule
** Spring 2021
- [X] CS 501
- [X] CS 502
- [X] CS 503

** Fall 2021
- [X] ORG 601
- [ ] ORG 602
- [ ] ORG 603

->
* Core
- [X] CS 501
- [X] CS 502
- [X] CS 503
- [X] ORG 601 [Fall 2021]
- [ ] ORG 602 [Fall 2021]
- [ ] ORG 603 [Fall 2021]

* Schedule
** Spring 2021
- [X] CS 501
- [X] CS 502
- [X] CS 503

** Fall 2021
- [X] ORG 601
- [ ] ORG 602
- [ ] ORG 603

BONUS: Have [Fall 2021] get inserted automatically when linked under that header.


texts: List all customized variables and faces whose default has changed since a specified Emacs version?

texts:
I try to use "Easy Customization" for most of my customization of Emacs.  Some of my customizations are changes to the defaults, i. e. sentence-end-base gets customized from:

"[.?!][]\"'”)}]*"

to:

"[.?!][]\"'””)}]*\\( :-)\\)?"

When a new Emacs version is released, I have to go through all my customizations to see if the default has changed so that I need to reflect that in my customization as well.

Some/most customizable variables have information about when their default value was introduced or changed, for example:

(defcustom sentence-end-base "[.?!][]\"'”)}]*"
  "Regexp matching the basic end of a sentence, not including following     space."
  :group 'paragraphs
  :type 'string
  :version "22.1")

How would a sniplet look like that prompts for the Emacs version used previously and then lists all variables and faces that were customized and whose default has changed since that Emacs version?


texts: How to look up documentation for a minor mode?

texts:
I just decided that I should try the outline-minor-mode for showing and hiding Emacs lisp defun definitions in an Emacs Lisp file. So I typed M-x outline-minor-mode and then I would like to get an overview over the available keyboard shortcuts, so I typed C-h m and scrolled down until I found:

  Outline minor mode (indicator Outl): Toggle Outline minor mode. With a
  prefix argument ARG, enable Outline minor mode if ARG is positive, and
  disable it otherwise.  If called from Lisp, enable the mode if ARG is
  omitted or nil.

  See the command `outline-mode' for more information on this mode.

Ok, this seems nice, but still not what I was looking for.. so I clicked the link for outline-mode and found this:

  C-c C-t   make all text invisible (not headings).
  C-c C-a   make everything in buffer visible.

However, these keyboard sequences does not work. But after some googling, the Emacs Wiki page ( http://www.emacswiki.org/emacs/OutlineMode ) came to my rescue and informs that the actual keybindings are C-c @ C-t and C-c @ C-a (and not C-c C-t and C-c C-a) ..

I hope there is an easier way to find this information from within Emacs. Any suggestions?


texts: Getting rid of `nil` generated by R when having spaces in table cells

texts:
I have this very simple org file that generates nil values for apparently no good reason:
#+name: table
|     | 2014 |
|-----+------|
| A B |    1 |
| C   |    2 |

#+name: linechart
#+begin_src R :results value :var accounts="" :exports none
  accounts
#+end_src

#+call: linechart(accounts=table[,0])

#+RESULTS:
| A B | C | nil |

As you can see, the result contains a nil at the end. If I replace accounts with length(accounts) in the R script, I would get 3 instead of the expected 2.
This seems to be related to the space between "A" and "B". I've tried with Org 9.3.6, 9.3.7 and master. My R version is 4.0.2.


texts: Returning multiple files from src block in babel

texts:
Often, when creating a plot I would like several plots with the data.  It's possible to return the name of one file as output, using results: file, but what about returning several?

For reference, I'd like a solution that works for any language, but I'm working with Python at the moment.


texts: Mode not enabled when Emacs starts, but working fine after M-x eval-buffer on .emacs

texts:
I recently found yascroll and have added it to my .emacs to enable it permanently. Specifically, I added this line (as described here: https://github.com/m2ym/yascroll-el):

(global-yascroll-bar-mode 1)

When Emacs starts, evaluation of my .emacs halts with this error:

Symbol's function definition is void: global-yascroll-bar-mode

Strangely, though, everything works if I open .emacs and run M-x eval-buffer, which I thought was in essence the same thing.

I can also enable yascroll by simply running M-x global-yascroll-bar-mode. The problem only appears when Emacs is starting. What am I doing wrong?


texts: Leave point in original position when C-g is pressed?

texts:
I am writing a function to select a region (say 2 lines).

(defun select-some-region ()
  (interactive)
    (push-mark (point) nil t)
      (forward-line 2))

When point is in a buffer like this

 |this is first
 this is second
 this is third

If I run M-x select-some-region it will select two line and I press C-g it will deselect the region but leaves point somewhere else like this.

 this is first
 this is second
 |this is third

How can I leave point in actual position where it was before when C-g is pressed?

Update:

In my actual select-some-regions  function, I have to select few  lines before point and few lines after point.


texts: How to move to the next source offered by helm mini?

texts: Is there a way to jump in helm mini directly to the next source? Is it also possible to fold and unfold a source-list?


texts: Highlight labels/flet/macrolet definitions in lisp-mode

texts:
I found this solution (https://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00322.html, fully cited below), but it isn't working as expected. It highlights only the first definition inside labels/flet/macrolet.

... and here the source code of the example for reproduction:

(defun fn ()
  (labels ((%fn0 ())
           (%fn1 ())
           (%fn2 ())))
  (flet ((%fn0 ())
         (%fn1 ())
         (%fn2 ())))
  (macrolet ((%fn0 ())
             (%fn1 ())
             (%fn2 ()))))

I am wondering if there is a working solution to highlight in-function definitions?

Full quotation of https://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00322.html:

;; Highlighting of flet/labels/macrolet local functions/macros with
;; font-lock-function-name-face

(defun mm/match-labels (bound)
  (when (re-search-forward "(\\<\\(labels\\|flet\\|macrolet\\)\\>" bound t)
    (let ((local-functions '())
          (all-start (match-beginning 0))
          (all-end (match-end 0))
          (kw-start (match-beginning 1))
          (kw-end (match-end 1))
          (parse-sexp-ignore-comments t))
      (catch 'done
        (condition-case e
            (progn
              ;; go inside the local functions list
              (goto-char (scan-lists all-end 1 -1))
              (while t
                (save-excursion
                  ;; down into local function definition
                  (goto-char (scan-lists (point) 1 -1))
                  (let* ((name-end (scan-sexps (point) 1))
                         (name-start (scan-sexps name-end -1)))
                    (push name-end local-functions)
                    (push name-start local-functions)))
                ;; advance to the next local function
                (goto-char (scan-sexps (point) 1))))
          (error
           ;; (message "got error %s" e)
           (throw 'done nil))))
      (set-match-data (append
                       (list all-start all-end
                             kw-start kw-end)
                       (nreverse local-functions)
                       (list (current-buffer))))
      (goto-char all-end)
      t)))

(font-lock-add-keywords
 'lisp-mode
 `((mm/match-labels
    (1 font-lock-keyword-face nil)
    (2 font-lock-function-name-face nil t)
    (3 font-lock-function-name-face nil t)
    (4 font-lock-function-name-face nil t)
    (5 font-lock-function-name-face nil t)
    (6 font-lock-function-name-face nil t)
    (7 font-lock-function-name-face nil t)
    (8 font-lock-function-name-face nil t))))


texts: Emacs unable to execute shell commands despite them being in the Emacs shell PATH

texts:
I am on Ubuntu. I'm trying to run the latex command to run in the Emacs shell. I have done some research, and have already done the following:
I noticed that running env in the Emacs shell gave a different value for PATH than running env in the normal terminal. I installed purcell's exec-path-from-shell to solve this. Following the directions, I copied my current terminal PATH, went to .profile, commented out lines of the kind PATH = something_new:PATH and just replaced it all with PATH=my_whole_copied_path. I then added (exec-path-from-shell-initialize) just after (package-initialize) in my .emacs.
After doing this, running env in Emacs shell gives the same PATH as running env in my terminal. The latex binary lives in /opt/texbin, and my current Emacs PATH reads:
'PATH=/opt/texbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin'

Still, running latex give command not found. What am I missing?
Update: I have learned that /opt/texbin is actually a symlink to a different location, and I've noticed that I can't cd into it in the Emacs shell. Could this be why this isn't working? Can I get shell to understand symlinks with an option?


texts: How do I prevent magit from asking to set upstream while pushing?

texts: When I want to push to a different upstream than origin, I use P C-u C-u P so I can set the upstream of the command, however magit always prompts me with question to set upstream also. How do I prevent that prompt?


texts: Massively long text boxes and yasnippet highlighting

texts:
Why are my text boxes and yasnippet field highlights so massively long?

Is there a way to change this behavior?

If so, what are the necessary steps that need to be taken to solve this issue?

The behavior can be seen like so:
When customizing:

When using yasnippet:


texts: How can i prevent current clocked task from showing in modeline?

texts: Is there any way to disable clocked task from being shown in modeline? I tried searching for variables, but i couldn't find any that turns it off.


texts:
How can I retrieve the date/time of the creation of the current file (file-date-time-of-creation) on my system?
The same question can arise for the size.

A related question was asked here.  This is a Windows related question, but the question also arises for other OS's.


texts: How can i set the same file in org-mode to update only headings in one window and open headings on the other window?

texts: I'd like to set a list of headings on one window and write on the other, is is possible?


texts: What Debian packages are needed to build Emacs from source?

texts:
I know that I can run sudo apt-get install emacs25, but (for reasons I don't want to get into) I want to build Emacs from source.

In the past, in order to do this, I've had to apt-get install Debian packages required to build Emacs, but this time I cannot find any up-to-date and authoritative list of what those packages are for the latest version of Emacs.

Any information on this would be appreciated.

FWIW, the following (based on the INSTALL file included with the Emacs source) failed immediately:

% apt-get build-dep emacs25
Reading package lists... Done
E: Unable to find a source package for emacs25

EDIT: Below is what I have in my /etc/apt/sources.list file:

deb       http://http.us.debian.org/debian                 stretch           main   contrib   non-free
deb-src   http://http.us.debian.org/debian                 stretch           main   contrib   non-free

deb       http://http.us.debian.org/debian                 stretch-updates   main   contrib   non-free
deb-src   http://http.us.debian.org/debian                 stretch-updates   main   contrib   non-free

deb       http://security.debian.org/                      stretch/updates   main   contrib   non-free
deb-src   http://security.debian.org/                      stretch/updates   main   contrib   non-free


texts: call-process and Hunspell (in Emacs 24.4)

texts:
I am having problems running ezwinports Hunspell 1.3.2-3 in Emacs 24.4.1 for  Windows.

When calling ispell-buffer with debug, I see the following functions are called.

ispell-buffer -> ispell-region -> ispell-set-spellchecker-params -> ispell-find-aspell-dictionaries ->

(ispell-call-process ispell-program-name null-device t nil "-D")

which in turn will become:

(call-process "c:/path/to/bin/hunspell.exe" "NUL" t nil "-D")

This function returns this error, which eventually prevents the spell checking (actual c:\path\to\ is longer):

SEARCH PATH:
.;;C:\Hunspell\;C:\Users\admin\.openoffice.org\3\user\wordbook;c:\path\to\bin\..\share\hunspell;C:\Program files\OpenOffice.org 2.4\share\dict\ooo\;C:\Program files\OpenOffice.org 2.3\share\dict\ooo\;C:\Program files\OpenOffice.org 2.2\share\dict\ooo\;C:\Program files\OpenOffice.org 2.1\share\dict\ooo\;C:\Program files\OpenOffice.org 2.0\share\dict\ooo\
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
c:\path\to\bin\..\share\hunspell\default
c:\path\to\bin\..\share\hunspell\en_GB
c:\path\to\bin\..\share\hunspell\en_US
Can't open affix or dictionary files for dictionary named "ENG".

The strange is that running from Windows prompt (terminal):

c:\path\to\bin\hunspell.exe -D

one gets (without errors):

SEARCH PATH:
.;;C:\Hunspell\;C:\Users\admin\.openoffice.org\3\user\wordbook;c:\path\to\bin\..\share\hunspell;C:\Program files\OpenOffice.org 2.4\share\dict\ooo\;C:\Program files\OpenOffice.org 2.3\share\dict\ooo\;C:\Program files\OpenOffice.org 2.2\share\dict\ooo\;C:\Program files\OpenOffice.org 2.1\share\dict\ooo\;C:\Program files\OpenOffice.org 2.0\share\dict\ooo\
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
c:\path\to\bin\..\share\hunspell\default
c:\path\to\bin\..\share\hunspell\en_GB
c:\path\to\bin\..\share\hunspell\en_US
LOADED DICTIONARY:
c:\path\to\bin\..\share\hunspell\default.aff
c:\path\to\bin\..\share\hunspell\default.dic
Hunspell 1.3.2

Testing separately:

(call-process "c:/path/to/bin/hunspell.exe" "NUL" t nil)

it gives:

Can't open affix or dictionary files for dictionary named "ENG".

While from the prompt:

c:\path\to\bin\hunspell.exe

starts the spelling.

Emacs errors can be replicated using eshell mode, which is perhaps based on call-process.

Noted that this works as expected:

(call-process "c:/path/to/bin/hunspell.exe" "NUL" t nil "-vv")
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.3.2)

I tried with other commands to replicate the call-process error. But, whenever I run   (call-process "c:/path/to/foo.exe" "NUL" t nil "some args"), the result is always the same as
c:/path/to/foo.exe some args from the terminal.

It should be noted that the code in ispell-set-spellchecker-params
is run only at the first ispell invocation, so on a second spell-checking request the action can be completed.


texts:
I need to change a space to a | here and there and i guessed that the best possibility were to bind a mouse click and the insertion of the pipe

(global-set-key [s-mouse-1] '(insert "|"))

But when I tested my idea I was told

Wrong type argument: commandp, (insert "|")

I have read 49.3.10 Rebinding Mouse Buttons but it did not mention which types of commands are bindable to mouse clicks.


texts:
There are certain things like the display of trailing whitespace, display of buffer boundaries, rainbow-colored delimiters and many more I'd like to enable in most modes or rather, all programming- and text-related ones (because displaying trailing spaces in, say ediff-mode, would clash with the major mode) instead of using a globalized minor mode with exception rules. Since most modes are derived from either prog-mode or text-mode, adding the function in question to both prog-mode-hook and text-mode-hook does work, however there are enough modes not following this specification, such as css-mode or LaTeX-mode.

I'd like to define a hook that encompasses all these modes for the time being to only add functions to one hook. Let's call it non-special-mode-hook (to distinguish it from special-mode-hook). How would I be able to create such a hook that is run for all major modes it is made for?


texts: Export code blocks in org-mode with minted environment

texts: After inspecting the LaTeX generated for my org-mode file, I figured out that the code blocks are exported with the verbatim environment. Are there any way to tell org-mode to export code blocks using the minted environment for the appropriated language?


texts:
I have started using org-capture extensively, and now have capture lists for just about everything: books to read, movies to rent, articles to write, research topics, business ideas – you name it.

The trouble is, my org-capture menu is filling up fast, and I am now starting to run out of letters in the alphabet to represent all my lists!

So I am wondering - is there an org-capture module for helm that will display a source with all my capture lists and then let me start typing the name of the list, to narrow down my selection?


texts: Is there a way to set the global agenda sorting?

texts:
I know that I can setup custom agenda commands with sorting specified using:

(org-agenda-sorting-strategy '(priority-down todo-state-up))

Is there a way to set the global agenda sorting somehow?


texts: EMMS doesn't seem to see anything from MPD

texts:
I've set up MPD, and it's definitely running and indexing everything correctly. I followed the instructions here to set up EMMS to work with MPD, and after running M-x emms-cache-set-from-mpd-all, it indexed the right number of tracks, and connecting via emms-player-connect seems to work without error. However, when I call M-x emms, all I see is an empty window. What am I missing?

For reference, this is my config:

;;Media
(require 'emms-player-mpd)
(require 'emms-setup)
(emms-standard)
(emms-default-players)
(setq emms-player-mpd-server-name "localhost")
(setq emms-player-mpd-server-port "6600")
(add-to-list 'emms-player-list 'emms-player-mpd)
(add-to-list 'emms-info-functions 'emms-info-mpd)


texts: Visualizing D language coverage results in the fringe

texts:
I want to visualize coverage data from the D compiler DMD on the fringe. This packages makes use of linum-.*. Is this the best way to visualize such things in the margin?

The Emacs package diff-hl seems to be a good template. But does it have to be this complicated?


texts:
I've seen snippets like this:

(set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?┃))

That claim to make emacs use a prettier window divider character. However, standard-display-table is nil in a emacs24.4 -Q. How can I fix this?


texts: Aborting emacs batch mode when no user input available

texts:
I have a small script that runs the following command to export my org-mode agendas automatically:
emacs -batch -l ~/.emacs.d/init.el -eval '(org-batch-store-agenda-views)'

Occasionally, a required agenda file is missing or unavailable, which causes emacs to pause at the command prompt with something like the following:
Non-existent agenda file ~/gtd/missing.org.  [R]emove from list or [A]bort?

Emacs will then hang until I kill it using Ctrl+C.
Is there a way to get emacs to automatically abort in batch mode if user input is not available? Or is it possible to set a timeout on the running of emacs in batch mode, so that it automatically exits after a certain period of time.
(I tried using the timeout shell command — e.g. timeout 10s emacs -batch ... — but that doesn't work either.)


texts:
There are files like session.10110ac205e127d7e2143131143297155100000021880037 in my .emacs.d folder. I would like to do something about it but could not figure out what to do.

What are these files for ?
Why emacs generate multiple files ?


texts: How to find what causes ESS to run very slow?

texts:
When working with an iESS session of R and an R file open side-by-side, I noticed extremely slow performance when typing indetifiers. Typing braces and operators is fine, however, when an identifier is typed, there is very significant input lag (typed letters are appearing several second late). During this period, the the status of the iESS buffer flashes between run and no process. This happens most often when I am typing inside a function argument list and with a subordinate R process that consumes a sizeable chunk of memory (around 3G, a couple of big data frames and sparse matrices).

I have disabled eldoc-mode and company-mode, but ESS still seems to do something to the background R process synchronously.

What causes this? How can I profile ESS to find out how it spends time communicating with R?

I tried profiler-start and its friends, which show that Emacs spends 45% of its time in term-emulate-terminal (I ran htop in an ansi-term buffer to see the CPU usage of emacs and R) and 16% in the Automatic GC. That's hardly suspicious. I guess the time spent waiting for the subordinate process is considered idle time by the profiler.


texts:
Transpose words (M-t) always swaps the word with the next.

How can this be performed with the previous word?


texts: How do I outline/hide/show text when writing prose?

texts:
I want to use Emacs to write prose (specifically, fiction).

I have used Scrivener and Ulysses in the past but I am not happy with them.  I want to try Emacs, but don't know how to replicate the workflow I am used to.

I use writeroom-mode to get a distraction-free environment, but it's just one piece of the puzzle.
I like the way Ulysses and Scrivener allow you to focus on a chunk of text, and I'd like to know how to replicate this functionality.  I would like org-mode or another outliner to allow me to focus on a piece of text and hide the rest.  Ideally, I'd like to have a sidebar (like Ulysses), in which I can arrange pieces of text manually, like in this screenshot:

PS I have read the "Emacs for Writers PDF but it doesn't address the need to organize and structure your text.


texts:
Is there a way to have a buffer with a project view i.e. Project file tree?

I have seen this before in Emacs but unsure if this is related to projectile or cedet though. Although I have a feeling there should be something in projectile. If I am not mistaken, cedet is not being used so often anymore.


texts: helm-occur: how to make it behave more like isearch?

texts:
I switched to helm-occur for searching within buffers. However, I can't help missing two of the nice features of isearch:

isearch remembers the position where it was invoked in a buffer; helm-occur doesn't: when typing a search query, the focus is on the first match of the buffer overall, not on the first match after the cursor position in the buffer.
When typing C-s within isearch, at first the last search query is reactivated, and then, upon further uses of C-s, it cycles through all the matches in a buffer. On the contrary, with helm-occur, I have to first reactivate the last search query with M-p, and then do the browsing with some third key binding, e.g. <down>.

How can I make helm-occur act just like isearch in these two respects?


texts: Where are face attributes defined for the `*Agenda Commands*` buffer?

texts:
I'm trying to modify some face attributes in the buffer that appears when the org-agenda command is called. This buffer displays *Agenda Commands* and Fundamental (mode) in the mode line. I've tried modifying fundamental-mode face attributes but to no avail. Also, I can't seem to run the what-cursor-position function (i.e., C-u C-x =) like I normally would to find out more information regarding buffer properties--any one keystroke closes this buffer.

What properties is this buffer calling on?


texts: Hide non-breaking spaces in org-mode, but show them in code blocks

texts:
Default Emacs settings show non-breaking spaces as a kind of underscore. This is very useful because these otherwise invisible characters would break code execution in many programming languages, and would be very hard to debug.
The setting, documented here, can be changed with the variable nobreak-char-display. Org-mode also gives ways to specify file local variable values.
What I would like to achieve, though, is hiding these non-breaking spaces (which are very usual in the French language) everywhere in my org-mode file except in code blocks, where I need them to be plainly visible.  To give an illustration, I want the non-breaking space before the interrogation point below hidden, but the other two visible.
Is there any way to achieve that?


texts: How can I customize the compile command?

texts: In one of my projects I need to run make package install when building instead of make. It remembers the last compile command I used, but resets to make -k every time emacs starts up. How can I customize M-x compile to default to make package install?


texts: Open PDF files with pdf-tools does not work

texts:
I want to use pdf-tools to read my pdf with emacs. I am on Emacs 27.1 with spacemacs 0.300.x.
I have pdf-tools as a package in my .spacemac file and also require
 '(TeX-view-program-selection
   '((output-dvi "open")
     (output-pdf "PDF Tools")
     (output-html "open")))

However compiling a file with auctex I have Docview that is opening instead of pdf-tools.
pdf-looks looked installed, reinstalling it does not fix the problem.
Using describe-variable I get the following:
 '(TeX-view-program-selection
   '((output-dvi "open")
     (output-pdf "PDF Tools")
     (output-html "open")))

TeX-view-program-list is nil
TeX-view-program-list-builtin is a variable defined in ‘tex.el’.
Its value is
(("Preview.app" "open -a Preview.app %o" "open")
 ("Skim" "open -a Skim.app %o" "open")
 ("PDF Tools" TeX-pdf-tools-sync-view)
 ("displayline" "displayline %n %o %b" "displayline")
 ("open" "open %o" "open"))

I have red How to use pdf-tools (pdf-view-mode) in emacs? and it is not helping here.
Note that opening a pdf file directly opens it with DocView.


texts:
If I drag and drop an image file (say myfile) to emacs when running in auctex mode, emacs just shows the file.

How can I make emacs to insert \includegraphics{myfile} instead of showing the picture?

Is it also possible to make emacs ask me for options such as (TeX-insert-macro "includegraphics") does?


texts:
Is it possible to activate a blocking 'scroll' mode that uses the vertical position of the cursor and a timer?

This is handy because you can move the cursor to a certain Y-delta to maintain a fixed scroll speed (In Firefox it's enabled by the "Use autoscrolling" preference).

Since emacs uses this terminology in a different way, it's hard tell if this feature exists for emacs.


texts: Reveal entry's parents recursively, but not siblings

texts:
I use sparse trees a lot.

A problem I have is that they show entries without context. For instance, with a tree like:

* A
** AA
*** AAA    :tag2:
*** BBB    :tag1:

if I run a sparse tree that matches BBB, it would show:

* A
*** BBB    :tag1:

(with BBB highlighted).

I know I can go to an entry and C-c C-r to reveal the context. That, however, shows siblings as well as parents, which can get really noisy.

I'd like to reveal the parents only, all the way to the top. For the previous example, what I mean is getting:

* A
** AA
*** BBB    :tag1:

Can that be done?


texts: How to define absolute directory paths and use them as file prefixes in org files

texts:
I need to represent absolute paths to several directories by some constant names to use them as prefixes in org mode for a number of files contained in each of these directories.
For instance they could be declared somewhere (in .emacs ?) as :
DIR1 : /path/to/directory_name1
DIR2 : /path/to/directory_name2

etc, and then use these abbreviations in org files as :
file:DIR1/some_file.pdf
file:DIR2/another_file.tex

and so on. I have try to declare these paths in some org file as :
#+LINK: DIR1 /path/to/directory_name1

and try to use it as :
file:DIR1/some_file.pdf

but this does not work. If the org file currently used is located in, for instance, /path/to/directory9, emacs tries to open the file /path/to/directory9/DIR1/some_file.pdf which is not what I wanted (i.e., /path/to/directory_name1/some_file.pdf) !
Maybe the preceding was not sufficient clear. I give below another example in another context, using 'bibtex' syntax, where it is possible to define a global path to some directory using, in a file some.bib :
@STRING{PDFS = "/some/path/to/pdfs/"}

Then, it is easy to use 'PDFS' in the file some.bib as a prefix for a large number of file.pdf (thousands). For instance :
user = PDFS # "some_author/2011.00910.pdf"

But, if, for some reason, the directory pdfs is moved somewhere else or if the file some.bib is used in another machine where the pdfs directory must be different, it is simple to adjust the new path by editing the global definition, in only one place :
@STRING{PDFS = "/another/path/to/pdfs/"}

This will be very useful if a similar coding scheme can be used in org files. Thus, I will be very astonished if a similar syntax does not exist in emacs !
Hope somebody knows a solution.


texts: Suppose I want to jump x amount of lines up or down. Is there a convenient command for it?


texts: How do I edit text in Cyrillic / Russian on OpenBSD?

texts:
I'm trying to make it possible to easily edit text in Cyrillic / Russian on a remote OpenBSD 5.2 amd64.

I'm using emacs-21.4p18-no_x11, which doesn't show any Cyrillic characters whatsoever when I try opening up a file with a windows-1251 encoding (instead showing question marks and sometimes even randomly mangling the file when a save is attempted), unless I start it as env LANG=bg_BG.CP1251 emacs (for some reason, there's no ru_RU.CP1251 in /usr/share/locale/) and PuTTY to Win1251 (Cyrillic); however, this only works in displaying the characters, not for typing any characters — switching the local keyboard to Russian and typing into emacs causes various random internal commands to be executed, even though quitting emacs and using cat(1) works without any issues for Russian input (which could then be opened up in emacs and copy-pasted from the temp file to the real one, which is very cumbersome and unproductive).

(FWIIW, I've also tried mg(1), but it shows up Russian characters as \315 etc, and doesn't let you type in Russian, either.)

If the files I'm editing are nginx.conf, is there a way to automatically specify the encoding for emacs?  All the File Variables examples appear to start with a mode, but there's no mode for nginx.conf.
How do I make emacs / mg load files in either windows-1251 or koi8-r, and show them in UTF-8?
How do I make emacs / mg accept Cyrillic input?


texts: Fix Catalina crash when clicking on File > Open or the Open button on the Toolbar

texts:
I'm on macOS Catalina, and I'm using Emacs for Mac OS X. When I click File > Open, or the Open button on the toolbar, or "Open a File" on the splash screen, I get a crash.

I have tried some other Emacs distributions, namely:

emacs --with-cocoa installed via Homebrew
emacs-plus installed via Homebrew

I have granted file system access to the various executables for each distribution, and all three options give the same errors.

Here's the part of the crash report that I think is most helpful:

Application Specific Information:
*** Terminating app due to uncaught exception 'NSObjectNotAvailableException',
reason: 'EmacsSavePanel is not a supported subclass for sandboxing'
abort() called
terminating with uncaught exception of type NSException

From the crash report, I thought the problem was with file system access. I followed the steps in this question, but giving /usr/bin/ruby full disk access did not fix the problem. I've also tried giving the following full disk access, but so far no success:

The Emacs app
the Emacs executable inside the Emacs app
The Homebrew install of Ruby (both /usr/local/bin/ruby and /usr/local/Cellar/ruby/2.6.5/bin/ruby

Is there something else I should be looking for?


texts: org-mode render latex fragments without using cache

texts:
How do I disable caching behavior when using C-c C-x C-l and C-u C-u C-c C-x C-l? I want the ability to force org-mode -> pdfTex to rerender everything in the current file from scratch.

Here's some more context about what exactly I'm doing and what the motivation is.

I have a setupfile for notes that consists of a whole bunch of LaTeX header lines.

#+SETUPFILE: ./setupfile.org

Here's a few lines of the setupfile that give a sense of what's in it.

#+LATEX_HEADER: \usepackage{alphabeta}
#+LATEX_HEADER: \usepackage{amssymb}
...
#+LATEX_HEADER: \newunicodechar{⊢}{\vdash}
#+LATEX_HEADER: \newunicodechar{→}{\rightarrow}
#+LATEX_HEADER: \newunicodechar{←}{\leftarrow}
...

Whenever I make a new definition or define a new abbreviation, I put it in the shared file. Unfortunately, when I rerender everything (C-c C-c and then C-u C-u C-c C-x C-l), there's some caching going on and I can't actually see the effects of my change.


texts: Is it possible to suppress `LSP :: Connected to [pyls:N].` message on minibuffer?

texts:
When I open a Python file I keep seeing LSP :: Connected to [pyls:N]. message on the minibuffer. Is it possible to suppress it? Since I know I have enabled lsp, I don't want to see that message always whenever I open a new file. I have looked into  https://emacs-lsp.github.io/lsp-mode/tutorials/how-to-turn-off/ but I couldn't find an option to disable it.
my setup:
(require 'lsp-mode)
(add-hook 'python-mode-hook 'lsp)
(add-hook 'python-mode-hook #'lsp-deferred)

(setq lsp-enable-symbol-highlighting nil)
(setq lsp-ui-doc-enable nil)
(setq lsp-lens-enable nil)
(setq lsp-headerline-breadcrumb-enable nil)
(setq lsp-ui-sideline-enable nil)
(setq lsp-diagnostics-provider :none)


texts: How to use a org-capture template expansion several times in a captured note

texts:
I am trying to create a org-capture template that re-uses some text given with the ‘%^{PROMPT}’ expansion along several points of the created note.

I have looked in this link and in stack overflow for such an option without success.

("J" "Jobs" entry (file+headline "~/org/NOTES.org" "Jobs") ; jobs
"* TODO %^{Name of Job}\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n
- [[%x][Advert]] \n
- Coverletter pdf \n
- [[file:~/Documents/Personal/CV/CV.tex][CV]] [[file:~/Documents/Personal/CV/CV.pdf][pdf]] \n
- [[shell:mkdir -p ~/Documents/Personal/$(date +%Y%M_%^{Name of Job})][makedir]]")

The above example prompts me for "Name of Job" in two separate instances. I would like to re-use the information that I have given to fill the template automatically.


texts: Determine graphical display on startup for emacs server/client

texts:
I am trying to have specific settings when I start a new emacs frame in X as opposed to in the terminal while using emacs-server. My initial attempt was using this solution, but it appears it isn't working for me (using Emacs 24.4.1).

Basically, my minimimal non-working example is this:

(defun new-frame-setup (&optional frame)
  (if (display-graphic-p)
      (message "window system")
    (message "not a window system")
    ))

;; run when regular emacs is started
(new-frame-setup)
;; run when a new frame is created using server
(add-hook 'after-make-frame-functions 'new-frame-setup)

When I start regular emacs and go to my Messages buffer it says:

window system

So this works just as I expected. However, if I run the command emacsclient -c, the Messages buffer says

not a window system
Starting Emacs daemon
not a window system

The first "not a window system" makes sense, as it's starting the emacs server in the terminal.  However, the second one doesn't make sense, as that frame is already a graphical window. Furthermore, after the fact, if I evaluate (display-graphic-p) in my scratch buffer, it evaluates as t. Any ideas as to what I'm doing wrong?

EDIT

So the big problem here is not that (display-graphic-p) doesn't work, it's that it doesn't know what frame to check.  This was a problem for me since the daemon didn't have a window-system, but it's an even bigger problem if I have a terminal version and an X version of emacsclient running at the same time. For example, if I create a frame with emacsclient -c and have it change some settings, and then I create a frame with emacsclient -nw and have it change some other settings - all of those settings are getting changed at the global level.

So I guess the real question is: how can I get emacs to check the display of the most recently created frame, and then run some elisp code only on that frame? I have absolutely no idea if this is possible.


texts:
I am using emacs-nox and as some of you know there are always some problems if you want to display you line numbers while also using git-gutter.

(Stuff like some extra margin jumping numbers etc.)

Now here is the thing I allways have a space between my line numbers an my code.
(I using the format "%4d ") so I would like to know:

Is there a way to show git gutter after the line numbers? Just right in that empty column. Between my Numbers and my code.

Example:

 7 Code
 8+Code
 9 Code
10 Code
11-Code
12 Code

Stefan talked about using nlinum-mode and diff-hl instead but with those two I have similar problems:


texts: Set scroll-amount for mouse wheel in .emacs

texts:
What I've tried in .emacs (note: I don't know elisp, and just tried cobbling this stuff together from googling and from other people's stuff) is

(mouse-wheel-mode 't) ;;; mouse-wheel enabled
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;;; 1 line at a time
;;; (setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
;;; (setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-follow-mouse 't) ;;; scroll window under mouse
(global-set-key (kbd "<mouse-4>") 'scroll-down-command)
(global-set-key (kbd "<mouse-5>") 'scroll-up-command)

The desired behavior is that every small mouse wheel movement should scroll up or down one line at a time. But it scrolls one screenful at a time. That is, the smallest mouse wheel motion scrolls the buffer up or down an entire screenful. How can I get one line at a time? I'm using emacs 24.5.1, and sometimes 24.3.1, under linux (slackware versions 14.2x64, and sometimes 14.1x32).

Edit @lawlist's suggestion in comments below worked when I tried an .emacs file with the one single line

(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))

But my entire .emacs file must be doing something that defeats it, or that does some other bad thing. So below is my entire 50-line .emacs. What's wrong with it?...

(setq major-mode 'text-mode)
(setq auto-mode-alist '(("." . text-mode)))
(setq make-backup-files  nil) ;;; no backup files
(setq auto-save-default  nil) ;;; no auto saving

(setq scroll-step 1)
(setq scroll-margin 0)
(setq scroll-preserve-screen-position 't) ;;; scroll without moving cursor
(setq scroll-conservatively 10000) ;;; (0 or 10000 seems same)
(setq auto-window-vscroll nil)
(setq scroll-up nil)
(setq scroll-down nil)
(setq scroll-up-aggressively nil) ;;; used to be .01
(setq scroll-down-aggressively nil) ;;; used to be .01
;;; (setq track-eol nil) ;;; cursor doesn't track end-of-line
(setq next-screen-context-lines 0)
(mouse-wheel-mode 't) ;;; mouse-wheel enabled
;;; (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;;; 1 line at a time
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
;;; (setq mouse-wheel-progressive-speed nil)
(setq mouse-wheel-follow-mouse 't) ;;; scroll window under mouse
(global-set-key (kbd "<mouse-4>") 'scroll-down-command)
(global-set-key (kbd "<mouse-5>") 'scroll-up-command)
;;; (scroll-bar-mode -1) ;;; no scroll bar displayed at all
(setq indent-tabs-mode nil)
;;; see http://emacs.stackexchange.com/questions/
;;;     14297/completely-disable-all-auto-indentation
(global-set-key "\C-j" 'newline)   ;;; disable auto-indent? emacs <=24.3
(electric-indent-mode 0)           ;;; disable auto-indent? emacs >=24.4
(setq blink-matching-paren nil)
(setq column-number-mode 't)
(setq size-indication-mode 't)

;;; open with single window
(setq inhibit-startup-screen 't)
(add-hook 'emacs-startup-hook 'delete-other-windows)

;;; initial frame width,height,position
(set-frame-width (selected-frame) 80)        ; #chars wide
(set-frame-height (selected-frame) 52)       ; #lines ling
(set-frame-position (selected-frame) 10 10 ) ; x y from upper-left

;;; insert tab character
(defun insert-tab ()
  (interactive)
  (insert "\t"))
;;;  (insert "        "))
(global-unset-key [tab])
(global-set-key (kbd "TAB") 'insert-tab)
;;; --- end-of-file ---


texts:
I am trying to disable a minor mode (flycheck) for the latex major mode. This is what I have so far.

(defun disable-flycheck-in-tex-src-block ()
  (flycheck-mode -1))

(add-hook 'latex-mode-hook 'disable-flycheck-in-tex-src-block)

However, after I put this into my init.el, flycheck is still enabled when I open a .tex file.

I am using Steve Purcell's emacs configuration here:

https://github.com/purcell/emacs.d

I have added the disable code into lisp/init-local.el, which I thought runs after all the default configuration.

As far as I can tell,

in the init.el, there is a

(require 'init-flycheck)

Then there is a file called lisp/init-flycheck.el, that looks like this:

(when (maybe-require-package 'flycheck)
  (add-hook 'after-init-hook 'global-flycheck-mode)

  ;; Override default flycheck triggers
  (setq flycheck-check-syntax-automatically '(save idle-change mode-enabled)
        flycheck-idle-change-delay 0.8)

  (setq flycheck-display-errors-function #'flycheck-display-error-messages-unless-error-list))

(provide 'init-flycheck)


texts: How to use org-link-search as true or false?

texts:
I want to test whether an internal org-mode link exists. org-link-search seems like it could work... is there some way to configure this like:

(if (org-link-search "my link") 1 0)


texts: What determines key bindings in the Magit commit window?

texts:
I'm a happy Magit user, and at commit time, I am accustomed to editing a commit message and then finishing the edit with C-c C-c.  But sometimes that key sequence winds up bound to the compile function, as indeed my emacs init file contains the line

(global-set-key "\C-c\C-c" 'compile)

My init file also sets that key locally in a number of modes including c-mode, sml-mode, lua-mode, and so on.  However, none of those modes is displayed on the mode line in the commit-edit window.  And when emacs is working correctly, C-c C-c finishes the edit and returns to git as expected.  However, every so often it gets wacky and insists on being bound to compile.

Following a trail of emacs lisp leads a very short distance to where Magit invokes git with $EMACSCLIENT set appropriately.  Beyond that point I have been unable to diagnose how that buffer is created or where its keybindings are determined.

The problem I'm trying to solve is to set the keybindings in the commit-message edit buffer so that C-c C-c terminates the edit and returns control to git.   At the moment, the only way I can do this is to exit emacs and start over.  That workaround doesn't last long, and it grows tiresome.

I would welcome answers to any or all of the following questions:

Where are the keybindings set for that window?
What function is C-c C-c bound to by default?
Is there a mode or other hook where I can just reach in with a hammer and bind C-c C-c to the right function?

Addendum: the buffer's major mode is text-mode. Here is the response to C-h v major-mode RET:

Its value is text-mode
Original value was fundamental-mode
Local in buffer COMMIT_EDITMSG; global value is fundamental-mode


texts:
I'm writing a programming tutorial. In between the prose I have diff code blocks that show exactly what changes are done to the code on each step. To make sure the diffs are correct I'd like to be able to evaluate them using patch command. Here is an example:
* Setup tests

Bla bla bla...

#+begin_src diff
--- a/elm.json
+++ b/elm.json
@@ -18,7 +18,11 @@
         }
     },
     "test-dependencies": {
-        "direct": {},
-        "indirect": {}
+        "direct": {
+            "elm-explorations/test": "1.2.2"
+        },
+        "indirect": {
+            "elm/random": "1.0.0"
+        }
     }
 }

Is it possible to do this from Emacs? When I try to evaluate this code block (pressing Enter inside it) I get:
No org-babel-execute function for diff!

I'm using Doom Emacs on Linux.


texts: Background color of matching parentheses overlays the region background color

texts:
I have set lime as a background color for my region, and I also have enabled to highlight matching parens using (show-paren-mode 1).

The issue I have is that when I exactly select the contents between two parens, the light grey background color of the parens ( and ) overlays the region background color, which can look quite confusing:

In the above screenshot I selected everything from the first ( to the last ), including these characters.

I would prefer if everything has the lime region background, including the parens. But when no region is active, then I want the matching parens to be highlighted in light grey.

Is there a way to do this?


texts: Problem with org-element-property and math formulas in Org 9.0.9

texts:
With Org 9.0.9, I'm experiencing a strange behaviour of (org-element-property :contents-end (org-element-context)) in items that end with a math formula (^ being the position of the cursor):

- $bla$ ^

yields non-nil, as expected, but

- $bla$^

yields nil, as if the item was empty. This doesn't change even when I move the cursor inside the formula. Just the whitespace after the formula seems to make a difference.

Bug or feature?


texts: How to disable skeleton-pair-insert-maybe?

texts:
I recently got a new Chromebook and installed Ubuntu via crouton.  I then installed Emacs 23 and transferred my .emacs file to the new machine.  However, a few of my key rebindings have been overridden by definitions in the LaTeX major mode of the new installation.  This did not happen on my previous computer (emacs 24.something).  The three changes I would like to make are:

When I press [, I want } to display.
When I press (, I want { to display.
When I press $, I want ^ to display.

I have the following lines in my .emacs file (along with other similar lines that work as intended):

(global-set-key (kbd "[") '(lambda () (interactive) (princ "{" (get-buffer (current-buffer)))))

(global-set-key (kbd "(") '(lambda () (interactive) (princ "[" (get-buffer (current-buffer)))))

(global-set-key (kbd "$") '(lambda () (interactive) (princ "^" (get-buffer (current-buffer)))))

I only use Emacs for LaTeX, so I am not concerned with the fact that I am defining everything globally.  Currently, if I use C-h k [, I see that [ calls skeleton-pair-insert-maybe instead of self-insert-command, as expected (and similarly for the other two).  All of my attempts to search on how to disable this returned only results talking about the usage of skeleton pairs and why one would want to use them, nothing about getting rid of them.  Similarly, I have been unable to find a way to edit the LaTeX major mode to remove the lines that bind this function in the first place.

Any method which allows me to redefine these keys over the LaTeX major mode, or to change the LaTeX major mode, would be appreciated.


texts: Mandatory capturing data before every org file is modified

texts:
I have to create a list of documents I modified or created in a day. I use org-capture to create it. I use following org capture template to capture the data when I start working on the file

    ("c" "List" checkitem (file+olp+datetree"C:/Users/Administrator/AppData/Roaming/.emacs.d/personal/journal.org")
   " [ ]%T %?\n\n" :prepend t :kill-buffer t   )

While it does a fair job, I at times forget to capture the name of the file.
Is it possible to pop up a capture template every time I open an org file, so that I don't forget to enlist the file I modify!

Your help is highly appreciated.

Regards


texts:
I've switched from helm to Ivy and mostly everything works, but today I noticed that connecting to databases with sql-connect doesn't work anymore. I have the following in the variable sql-connection-alist

(setq sql-connection-alist
  '(("dev" (sql-product 'postgres)
     (sql-database "testdb")
     (sql-user "testuser")
     (sql-server "localhost")
     (sql-password ""))))

which was sufficient under helm and vanilla emacs for running M-x sql-connect and connecting to a database. When I run it under Ivy though, I get a prompt that looks similar to this:

0    Connection:

When I type dev and press <enter> or try to tab complete, the prompt changes to

0    Connection (match required): dev

and I can't get any further. The match required part is red, indicating an error, but I don't know how to get past this point. If it were a tab-completion, I'd at least expect typing "dev" and pressing <enter> to be sufficient, but I get the same error.

What do I need to do to connect to a database using Ivy in emacs?


texts: How to scroll back through the command line history in the Emacs interactive subshell?

texts:
Let us say in the interactive subshell I run these commands:

command_a
command-b
command_c
...
command_z

I type M-p to go back to command_z.
But how can I scroll back the history of commands until I land on  command_j, for example?


texts:
I receive a couple of invitations to meetings from Microsoft Exchange users a week in my mailbox.  Is there a package with some mode I can install to make these attachments human readable or enhance mu4e-view to display at least the event start/end and location?

I don't need to import these things into some calendar like icalendar.el does.  I just want to view them.


texts: How to edit the list of named/defined colors?

texts:
How can I change (insert,delete,rename,…) the list of named colors?

I tried to edit /usr/share/emacs/25.3/lisp/term/tty-colors.el.gz and byte-compile after change, but it had no effect.

Note: I do not want to have another color picker, but change the builtin picker wich shows on list-colors-display or in Customization-context. I could live with an other color picker though, if it'd be very simmilar and also would replace the builtin color picker in every case…

Also I tried to get help on the variable defined-colors with C-h v defined-colors RET, but got no match - does that mean, there is just no help on this variable?
Edit: Ok, this is bec. it's a function – but C-h f defined-colors RET also doesn't contain info on where the defined colors are stored and how they might be adjusted.

EDIT1 (after comment by jue): Tried to insert ("testcolor" 35980 65535 0) to tty-colors.el.gz and added "testcolor" at the end of the list x-colors in common-win.el.gz, byte-compiled both and restarted emacs - but still no "Testcolor" entry in *Colors*.

EDIT2 (after 2nd comment by jue): Only file named rgb.txt on my (arch linux) system is /usr/share/emacs/25.3/etc/rgb.txt I inserted 140 255 0 testcolor there (+ EDIT1) - still no entry.

EDIT3 …well maybe my desire to use the builtin color picker isn't very smart – I'll rather look for a color picker, that presents colors in a similar way and isn't bound to some X11 system file. I'll update, when I find something sufficient.

Still feel free to answer this exact question (as I'd love to gather insight to emacs), or suggest a color picker, that presents just a user defined list of colored color value entries.


texts: What are possible real use cases of the Emacs "psychotherapist" mode?

texts:
It is well known that when you type M-x doctor, a kind of AI program prompt you to write about your problems, as a psychotherapist does. Some said it's an easter egg, but it seems it goes beyond the fun.

The manual says (33.2.8 in a 2007 paper edition):

  If using Emacs (or something else) becomes terribly frustrating and none of the techniques described above solve the problem, Emacs can still help you. First, if the Emacs you are using is not responding to commands, type C-g C-g to get out of it and then start a new one. Second, type M-x doctor RET. The Emacs psychotherapist will help you feel better.

Do you have real examples of people using the help of the psychotherapist? Is there use cases where it can really be used as a tool to solve problems? Do you have some stories about it here?


texts: How to see the next few occurences of a repeated task in emacs org mode?

texts:
I have recently started using the timestamp feature of the org-mode and I have few tasks that repeat. For example:
* Match

  <2020-09-09 Wed 07:00 +2w>

I am looking for a way to see the next few occurrences of this task. E.g. Sep 23,  Oct 7th etc. I know of the command C-c C-o (org-open-at-point) that shows entire agenda for the date but I only want to see this single task (and future occurrences).


texts: How to copy text from a buffer to an ansi-term

texts:
If I create a second window with a terminal in it like:

C-x 2; C-x o; M-x ansi-term

How can I copy text from a buffer into this terminal? I seems like the ansi-terminal has its own kill-ring (maybe the killring from readline?)

Context: I use a REPL quite often for development, sometimes it's on a remote machine.


texts: Python shell warning about readline and completion?

texts:
*Warning*:

  Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t and "python3" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally.

I only get it in specific cases and I am not sure what is causing it. I am reading some data like this,

# !/usr/bin/env python3

import pickle
from variables import objects_address
photos = pickle.load(open(objects_address + '2019-10-19 21:18:23.dat', 'rb'))

There is more in this file but in order to narrow the problem I commented all of it. But, the warning persists. After this I do some manipulations to the array of photo objects which photos is and ask for a Y/n to save the photos with manipulations using input(). The program does not halt at this point if I get the warning and it just continues execution. I made this test file,

# !/usr/bin/env python3

import pickle
# from geocoder import ip

n = [1,2,3]
pickle.dump(n, open('TEST.TEST', 'wb'))
x = pickle.load(open('TEST.TEST', 'rb'))
print(x)

name = input('What is your name? ')
print('That\'s a nice name, ' + name + '!')

This file runs and acts perfectly fine; takes input and all that. Although, I tried putting from geocoder import ip in this file and that reproduced the warning. If you add this import to my test file (or even a file with just this one line), we get the same warning.

Here is the output of the test file (with the import that causes the warning):

Python 3.6.8 (default, Oct  7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [1, 2, 3]
What is your name? That's a nice name, import codecs, os;__pyfile = codecs.open('''/tmp/py8974PaE''', encoding='''utf-8''');__code = __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/tmp/py8974PaE''');exec(compile(__code, '''/tmp/py8974PaE''', 'exec'));!

Here is output without the import that causes the warning (I omitted the version info),

What is your name? Tom
That's a nice name, Tom!
>>> python.el: native completion setup loaded

Note that in my original file where I read data, I am not importing this geocoder. It was in a neighbouring file where I made the test file and I ran it randomly and realised that it also causes the warning.

I have tried different solutions which people suggested about this warning but non of them worked. I am running GNU Emacs 25.2.2 on Ubuntu 18.04.3 LTS

This is my use-package configurations for elpy in my .emacs:

;; elpy
(use-package elpy
  :ensure t
  :defer t
  :init
  (elpy-enable)
  (setq elpy-rpc-python-command "python3")
  (defun my-python-shell-run ()
    "Run python and pop-up its shell.
     Kill process to solve the reload modules problem."
    (interactive)
    (when (get-buffer-process "*Python*")
      (set-process-query-on-exit-flag (get-buffer-process "*Python*") nil)
      (kill-process (get-buffer-process "*Python*"))
      ;; If you want to clean the buffer too.
      (kill-buffer "*Python*")
      ;; Not so fast!
      (sleep-for 0.5))
    (run-python (python-shell-parse-command) nil nil)
    (python-shell-send-buffer)
    ;; Pop new window only if shell isnt visible in any frame.
    (unless (get-buffer-window "*Python*" t)
      (python-shell-switch-to-shell)))
  :hook (elpy-mode . (lambda ()
               (highlight-indentation-mode -1)
               (linum-mode t)))
  :bind (:map elpy-mode-map
          ("C-e" . 'elpy-format-code)
          ("C-w" . 'elpy-pdb-debug-buffer)
          ("M-w" . 'elpy-pdb-toggle-breakpoint-at-point)
          ("C-l C-p" . 'elpy-pdb-break-at-point)
          ("C-c C-c" . 'my-python-shell-run)
          ("C-h f" .'python-eldoc-at-point)
          ("M-<backspace>"
           . (lambda ()
               (interactive)
               (with-current-buffer
                   (process-buffer (elpy-shell-get-or-create-process))
                 (comint-clear-buffer))))))


texts: Which variable modifies the switch statement indentation on php-mode?

texts:
I am currently using php-mode with spacemacs to write in php and recently I noticed this auto-indent behavior, namely pressing TAB.

switch ($cond) {
    case "something":
    break;
}

Auto indenting this region becomes

switch ($cond) {
case "something":
break;
}

I know that in js2-mode for javascript a variable called js-switch-indent-offset do the trick, but couldn't find the one related to php so far.


texts: Configuring Flycheck to use a local ESLint

texts:
I was trying to get emacs to point to a version of eslint that isn't installed globally (but located in the node_modules of the directory one level up), so I followed this: Flycheck with file relative eslint executable, but flycheck is still only finding the global version (at "/usr/local/bin/eslint"). Below are the lines I added to my init.el related to flycheck.

;; configure flycheck for linting, make sure it starts globally
(add-hook 'after-init-hook #'global-flycheck-mode)

;; the following didn't work
;; I had to install eslint globally to get it to work and it wasnt ideal :(
(defun my/use-eslint-from-node-modules ()
  (let* ((root (locate-dominating-file
                (or (buffer-file-name) default-directory)
                "node_modules"))
         (eslint (and root
                      (expand-file-name "node_modules/eslint/bin/eslint.js"
                                        root))))
    (when (and eslint (file-executable-p eslint))
      (setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)

I am using Mac OSX Mojave with Emacs 26.1.1


texts:
I have a todo list in a text file that I maintain with TaskAgent and emacs. TaskAgent adds trailing text to a line to indicate priority (#!!! represents highest, #! represents low, and no mark is lowest). I would like to sort the lines by priority in emacs from highest to lowest, for example:

groceries
haircut #!!
water plants #!!!
clean gutters #!

would be sorted as

water plants #!!!
haircut #!!
clean gutters #!
groceries

(sort-regexp-fields t "^.*$" "#!+" (point-min) (point-max))

almost works but ignores the lowest priority (non-marked) items


texts: Previous/next occur result, independently from compilation errors

texts:
After running M-x occur, the commands next-error and previous-error let me navigate between hits.

I would like to be able to M-x compile my program and then keep browsing through the same *Occur* results. But if I compile then next-error and previous-error navigate the compilation errors, which makes perfect sense.

I don't want to run M-x occur again because I'd lose my place. What I want is to navigate occur results independently of compilation results.

How can I define next-occur and previous-occur commands that do this? (Note that this is not occur-next and occur-prev, which operate in the *Occur* buffer. I want to bind these to keys in the buffer that's being searched.)

Bonus: I'd prefer grep to be classified like occur, so I can also navigate grep results independently from compilation errors.


texts: Terminal: get 16-colors default color scheme in 256color mode

texts:
I really really like the default (dark) color scheme in 16 colors terminal/tty emacs (TERM=xterm), but with some plugins like powerline, 16 colors doesn't cut it.

Hence I need to switch to 256colors (TERM=xterm-256color).

The thing is, all the default colors get really ugly in 256 colors, not only when editing c/c++ source files but also in the minibuffer, when selecting regions etc...

Does anybody have a link to a theme or a piece of code to get the good old 8 colors scheme back in 256 colors ?


texts: Specify a block of text that should not be filled (leave it "verbatim")?

texts:
Consider the following piece of text (in whatever general major mode it may be):
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.

```
function foo()
    println("Hello World")
    println("Don't fill me please!")
end
```

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.

The idea is that I want triple backticks to serve as delimiters for regions of the text that I would like to not fill. I am using the filladapt mode and right now executing fill-paragraph with the cursor in the "code block" region causes a fill:
```
function foo()
    println("Hello World") println("Don't fill me please!")
end
```

I would like to specify that all blocks of text inside triple backticks should be left verbatim - not filled, not touched in any way at all by the fill algorithm. Is this possible? Preferrably in filladapt since I am using it already.


texts:
How do I move the 'cursor' to the left/right in helm when typing a filepath? Currently my left arrow seems to be mapped to a backspace / clear word.

I'm using Spacemacs in evil mode.


texts: List commands / keywords in a directory sorted by frequency of use

texts:
I want to do some refactoring. For that purpose I want to list all keywords grouped and sorted by their frequency of appearance.

That could help me get ideas, which repetitive code I could start abstracting-away.

Is there a way to do this nicely with emacs / elisp?


texts: SMTP auth credentials in emacs 24.x without an .authinfo file?

texts:
I know that the `smtpmail-auth-credentials' variable has been removed in emacs 24.x, and that we are now expected to use an .authinfo file.

However, I have a specialized need for passing in SMTP credentials via elisp code, without any .authinfo file. I want to use "plain" user-ID/password authentication via port 587 with no SSL nor TLS.

Does anyone know how to accomplish this in 24.x with the credentials encoded in elisp and without the use of an .authinfo file?

Thank you very much in advance.


texts: How to view and edit large delimiter separated value files?

texts:
I have been using csv-mode to modify small to medium sized CSV files, but recently I have been working with large files containing more than 40,812 entries. csv-mode struggles to align and navigate the tables, and is too slow to be usable as is.  In comparison, LibreOffice Calc can zip through the file.

Is there a simple way to make csv-mode handle large tables, or is there a better approach available?

I am aware of a related Stack Overflow question. Its solution was to only align the portion of buffer in the visible window, but this did not solve the sluggishness in my case.

Here is an example file.  I tried to make it large, but not so large it will freeze Emacs on older computers.


texts: Is it worthwhile to write a wrapper for calling Julia or Python functions from emacs?

texts:
For writing efficient emacs functions, would it be worthwhile/not too difficult to write a C wrapper for calling Julia functions or for calling Python functions via Numba/pycc?

For reference: Julia is a higher-level language designed for scientific computing that contains cfunction, a routine for efficiently passing Julia functions to C functions that accept function pointers. From what I gather, these functions are called more or less as efficiently as a native C function is called. Julia also happens to be able to call functions in many other languages very efficiently. Numba is a just-in-time compiler for Python that can also create C libraries using the command pycc. Both Julia and Python/Numba approach C-level performance for many tasks.


texts: Org-Agenda Daily View Duplicates Time Stamped Tasks

texts:
First, let me say that I tried to search around for an answer to this (and I will clarify where those failed).

So my problem is that when I enter the daily for for agenda, M-x Org-Agenda a, I see duplicated tasks for what I believe is anything with a deadline or scheduled timestamp.

I have tested this, and it seems normal TODOs get neglected where as anything with a timestamp, with a TODO or without, get presented twice in my daily agenda.

I have tried using M-x customize variable org-agenda-todo-ignore-timestamp, which successfully eliminates duplicates at the cost of not showing any items with a scheduled/deadline time stamp, which I would still like to see in my agenda view. Though it doesn't apply here, I also checked to see if M-x customize variable org-agenda-todo-list-sublevels was responsible.

Any ideas? I'm fairly new to org-mode and its various related functions/minor modes, so I very well could just be misusing the agenda function. I am currently using emacs24.5 but experienced it also while using emacs24.3. I'm also attaching the only code in my init.el file that involves org-mode directly besides some capture templates and use-package declarations.

I really appreciate the help!

init.el code:

;---------key bindings---------------------------

(define-key global-map "\C-cc" 'org-capture)

;--------------org mode----------------------------
(desktop-save-mode 1)
(setq org-agenda-files '(""))
(setq org-agenda-files
  (mapcar 'abbreviate-file-name
      (split-string
    (shell-command-to-string "find ~/Tresors/Personal/org-mode -name \"*.org\"") "\n")))
(setq line-spacing '0.25)
(setq org-log-done 'time)
(setq org-default-notes-file (concat "~/Tresors/Personal/org-mode/notes.org"))
(setq org-journal-dir "~/Tresors/Personal/journal/"); note, org mode takes CcCj, CcCf,CcCb (i think as mode specific only, but fyi incase universal)
(setq org-startup-indented t)
(setq org-hide-leading-stars t)


texts:
I am having a problem in cperl-mode described in this question. Basically inserting a newline at the start of a line in here doc in cperl-mode is breaking the syntax highlighting. One of the answers suggested using font-lock-extend-region-functions to extend the font lock region to include all of the here doc. I have done that with the code below and verified it with highlight-refontification. However even though the region is extended, when I insert a newline, the region splits and the syntax highlighting still breaks. My function is shown below

(defun my/cperl-font-lock-extend-region-here ()
  (save-excursion
    (goto-char font-lock-beg)
    (if (re-search-backward "=<<\s*['\"]?[0-9a-zA-Z_]+['\"]?\s*;" nil t)
        (if (string-match "=<<\s*['\"]?\\([0-9a-zA-Z_]+\\)['\"]?\s*;" (thing-at-point 'line t))
            (let ((here-tag (concat "^" (match-string 1 (thing-at-point 'line t)) "$")))
              (beginning-of-line)
              (let ((here-start (point)))
                (goto-char font-lock-end)
                (if (re-search-forward here-tag nil t)
                    (progn
                      (end-of-line)
                      (if (< font-lock-end (point))
                          (setq font-lock-end (point)))))
                (if (> font-lock-beg here-start)
                    (setq font-lock-beg here-start))))))))

My question is, does any smart person know an approach to prevent syntax highlighting from breaking in cperl-mode here docs?


texts: async-shell-command: run COMMAND without displaying the output

texts:
I want to use async-shell-command to run a .bat file on Windows.
Reading the function documentation it says:

(defun async-shell-command (command &optional output-buffer error-buffer)
  "Execute string COMMAND asynchronously in background.
...
To run COMMAND without displaying the output
in a window you can configure `display-buffer-alist' to use the action
`display-buffer-no-window' for the buffer `*Async Shell Command*'.

Where I mark in bold what I want to achieve: run COMMAND without displaying the output.

So, I guess I need to configure display-buffer-alist variable to use
display-buffer-no-window action for *Async Shell Command* buffer. It seems simple...

Checking the display-buffer-alist documentation:

(defcustom display-buffer-alist nil
  "Alist of conditional actions for `display-buffer'.
This is a list of elements (CONDITION . ACTION), where:

 CONDITION is either a regexp matching buffer names, or a
  function that takes two arguments - a buffer name and the
  ACTION argument of `display-buffer' - and returns a boolean.

 ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a
  function or a list of functions.  Each such function should
  accept two arguments: a buffer to display and an alist of the
  same form as ALIST.  See `display-buffer' for details.

Well... this is where my head starts to get lost on Emacs/Elisp ecosystem.
Should I do something like this (where I do not know what to put on ???):

(add-to-list 'display-buffer-alist '("*Async Shell Command*" . (display-buffer-no-window . ???)) )

Any help/hints will be appreciated.


texts: Which is a faster argument to pass: kbd, string, or vector?

texts: When specifying a key sequence you have the option of using a kbd, string, or vector. Which one of these is faster? More efficient? Optimal in particular situations? Any trade-offs? Please list your reasoning and why.


texts: Customizing indentation style for continuation lines?

texts:
I would like to customize the "k&r" indentation style, so that continuation lines are indented 8 spaces, like this:

if (first
        && second) { // <- 8 spaces.
    third();
}

--

CLARIFICATION: Basically, I would like to distinguish easily between a block header and nested statements, to avoid confusion; for example:

if (first
    && second) { // <- Block header (4 spaces).
    third();     // <- Nested statement (same 4 spaces).
}

I have seen some code indented like the following, to address the above issue:

if (first
    && second) {  // <- Block header (4 spaces).
        third();  // <- Nested statement (8 spaces).
}

But, to me, the above indentation looks confusing. I would rather have the opposite indentation:

if (first
        && second) { // <- Block header (8 spaces).
    third();         // <- Nested statement (4 spaces).
}

Such a differentiation would suffice. Function arguments inside a block header should be distinguishable, too, but - in that case - the actual amount of indentation would not matter:

if (first
        && second        // <- Block header (8 spaces).
        && third(        // <- Block header (8 spaces).
              fourth)) { // <- Function argument (any indentation).
    fifth();             // <- Nested statement (4 spaces).
}


texts: extract numbers from org mode table and multiply and divide numbers while ignoring units

texts:
I would like to extract the numbers from a table like

| 21.57 Mg  | 10^3 g | 1 m^3  |
|-----------+--------+--------|
| 1.4^3 m^3 | 1 Mg   | 10^3 L |

and multiply / divide the numbers while ignoring the units and table characters. Is this possible to implement in an automated way?

Thanks in advance,

georg


texts: Using the count of coincidence from a regexp as replacement text?

texts:
I have an org-mode file with more than 12000 footnotes (maybe less), I was cleaning it and found that after the conversion some footnotes weren't converted to org-mode footnotes, so I had to manually make them footnotes.

The thing is, since that addition the reference number inside the square brackets must be re-done otherwise I will end with repeated numbers, like: [12] ... [12] or [10678] ... [10678]. Is there a way to build a regexp that look for all numbers inside square brackets and replace the text inside them with their respective coincidence number (?) for instance: [12] is the coincidence number 10 and this other [12] is coincidence number 11 so [12] ... [12] becomes [10] ... [11]?

especial petition: if you are going to post an elisp snippet that solves this problem, please, please, please, comment it on detail because I want to learn elisp too!


texts: What kind of destructuring does cl-loop support?

texts:
1. Summary

Is it possible to destructure an unordered plist in cl-loop's for-clauses?

2. Details

From the documentation I would have expected destructuring to be universal, e.g. I would have expected

for (a . b) = data

and

for (a &rest b) = data

to do the same thing, and

for (&key a b) = '(:a 1 :b 2 :c 3)

to effectively allow destructuring plists. This doesn't seem to be the case.

3. Example

Consider the snippet

(cl-loop for plist in '((:a 1 :b 2 :c 3) nil)
         for (&key a b) = plist
         collect (vector a b))

I would have expected the result to be

([1 2] [nil nil])

and instead I get

([1 :b] [nil nil])

i.e. &key is treated as a variable name, not as an argument list keyword.


texts: How to customize files pattern while using rgrep?

texts:
elpy-mode internally uses this command to search for a regexp in *.py files.

(setq elpy-rgrep-file-pattern "*.py")

(rgrep regexp
       elpy-rgrep-file-pattern
       default-directory))

However elpy-rgrep-file-pattern is customisable. I want to include html files also while searching.

I have tried the following patterns

(setq elpy-rgrep-file-pattern "*.py|*.html")
(setq elpy-rgrep-file-pattern "*.py\|*.html")
(setq elpy-rgrep-file-pattern "*.(py\|html)")
(setq elpy-rgrep-file-pattern "py\|html")
(setq elpy-rgrep-file-pattern '(("html" . "*.html") ("py" . "*.py")))

but nothing seems to work. How do I correctly specify file pattern to search *.py & *.html files?


texts: org-mode Beamer export: can't change format of title page and TOC

texts:
I have an org file that I use to create a pdf with org-beamer-export-to-pdf. The file has things like this at the top:

#+TITLE: Training
#+OPTIONS: H:2 toc:1 num:t
#+LATEX_CLASS: beamer
#+LATEX_CLASS_OPTIONS: [presentation]
#+BEAMER_THEME: Montpellier

# No Navigation Symbols
#+LaTeX:\setbeamercovered{transparent}
#+LaTeX:\setbeamertemplate{navigation symbols}{} %remove navigation symbols
#+LaTeX:\setbeamercovered{invisible} %No transparent layers

Along with some color configurations, too. These changes (for exmaple, getting rid of the navigation symobls) work on all the body slides. However nothing I do affects the appearance of the Title Page or the Table of Contents.

Even explicitly setting something like

#+LaTeX:\setbeamercolor*{title page}{fg=mycolor, bg=myothercolor}

has no effect on the title page. This holds true for titlelike title subtitle author or section in toc or subsection in toc and so forth.

Why can't I configure the 1st two slides of my presentation?


texts: problem with starting emacs via emacsclient

texts:
I have no problems starting Emacs from a terminal, while if I start it from the desktop (I have a desktop file containing emacsclient -ca '') Emacs starts with a putt-ugly font (see below a screenshot).

To debug the issue I started emacsclient from the command line and, again see below for the transcript, I've got

Warning (initialization): An error occurred while loading ‘/home/boffi/.emacs’:

Wrong type argument: font, unspecified

BUT when I start Emacs directly I have no problems at all, emacsclient does not recognize --debug-init and the error message is not meaningful to me...

Moreover, if I visit the "broken" Emacs and I type M-x load-file RET ~/.emacs RET my init file is executed w/o problems!

What can be done to fix this issue?

The Emacs version is apparent from the 1st screenshot, I'm on Debian Sid, fairly current.

17:46 boffi@debian:~ $ emacs --debug-init
17:46 boffi@debian:~ $ # see screenshot

17:47 boffi@debian:~ $ emacsclient -ca ''
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

Warning: due to a long standing Gtk+ bug
http://bugzilla.gnome.org/show_bug.cgi?id=85715
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Loading /etc/emacs/site-start.d/00debian.el (source)...
Loading /etc/emacs/site-start.d/00debian.el (source)...done
Loading /etc/emacs/site-start.d/50asymptote.el (source)...
Loading /etc/emacs/site-start.d/50asymptote.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50figlet.el (source)...
Loading /etc/emacs/site-start.d/50figlet.el (source)...done
Loading /etc/emacs/site-start.d/50latexmk.el (source)...
Loading /etc/emacs/site-start.d/50latexmk.el (source)...done
Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...
Loading /etc/emacs/site-start.d/50texlive-lang-english.el (source)...done
Loading /home/boffi/.emacs.d/synctex.el (source)...
Loading /home/boffi/.emacs.d/synctex.el (source)...done
Warning (initialization): An error occurred while loading ‘/home/boffi/.emacs’:

Wrong type argument: font, unspecified

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.
Starting Emacs daemon.
Emacs daemon should have started, trying to connect again
Waiting for Emacs...
17:48 boffi@debian:~ $ # see screenshot


texts: Syntax highlighting in org mode #+BEGIN_LATEX block

texts: Is this possible?  (I know it's possible for #+BEGIN_SRC latex blocks.)


texts: On using Elisp macros for partial application

texts:
I want to improve my Elisp, but despite reading about the differences between functions and macros (including discussions here in Emacs SE and on Reddit), I still find examples where the distinction confuses me.

For example, in the "starter-pack" Radian, a macro can be found which wraps use-package ensuring some sort of partial application:

(defmacro use-feature (name &rest args)
  "Like `use-package', but with `straight-use-package-by-default' disabled."
  (declare (indent defun))
  `(use-package ,name
     :straight nil
     ,@args))

As a case study, would it not be possible to achieve the same with a defun? After all, this seems like a simple case of partial application, or am I missing something? Do we need a macro here just because use-package itself is a macro which we don't want a defun body to evaluate?

And would there be a safe way to improve this macro to take care of a possibly unwanted case (use-feature foo :straight t)?


texts:
Currently if I try to complete a work, the case of the prefix is ignored with company-lsp.

From looking into the code, company-lsp is hard-coded to use ignore-case.

As at the time of writing company--begin-new calls: (company-call-backend 'ignore-case))

Is there a way to make company-lsp case sensitive?


texts: The list-buffers command. How to make the 'Buffer' column sort case-insensitively, when click on it?

texts:
C-x C-b is normally bound to the list-buffers command.
The resulting buffer has various columns, which are CRM, Buffer, Size, Mode, and File.
When I can click on the Buffer column-header, it will toggle sorting the contents of the window, switching between ascending and descending sorting according to the buffer name. Which is fine. However, the sorting according to the buffer name is case-sensitive.
What I would prefer is for the contents of the window to sort with the buffer name being considered case-insensitively. As it is now, for ascending order, names that begin with (A-Z) are shown first, then names (a-z) are shown after them. I would prefer if the case of the letters was ignored, when sorting by buffer name.