texts: detect if inside a LaTeX footnote and get its bounds?

texts:
Q: how do I get the bounds of a LaTeX footnote?

I'd like to be able to detect, programmatically, if point is inside a LaTeX footnote environment.  Ideally, I'd like to be able to extract the beginning and end points of the footnote.  How would one do so?

I'm aware of the TeX-current-macro function, but it's not quite what I need.  If, for example, point is inside a citation inside a footnote, it will stop at detecting the citation.  It also does not provide the bounds.


texts: Verilog mode to navigate from begin to end

texts: I am using verilog mode for Emacs. I am trying to find which begin is paired with which end.  Is there any way to do this in Emacs?


texts: Can I make the latex extension .tex rather than .latex?

texts: When tangling latex source from pie.org, the resulting file is by default pie.latex.  Is it possible to change the extension for latex code to .tex?


texts:
How is it possible to sort todos by completion?
* Bar [0%]
** TODO Bar1
** TODO Bar2
* Foo [100%]
** DONE Foo1
   CLOSED: [2017-06-18 So 17:51]
** DONE Foo2
   CLOSED: [2017-06-18 So 17:51]
* Foo1 [0%]
** TODO Foo1
** TODO Foo2

For example I might constantly add new todos and finish other todos. How is it possible to sort the todos so that the todos with 100% will stay at the bottom?


texts: Does using a 122-key keyboard make it easier to use Emacs, in relation to having more keys to bind commands to? I am thinking of the various models on offer from Unicomp specifically.


texts:
When sorting the lines by sort-lines the lines beginning with ä comes after the lines starting with z. It would be nice if the lines could be sorted ignoring the accents, Umlauts, etc, like in a dictionary. Ideally a line starting with ändern should be come after a line starting with anderen.

There is simple solution for searching accented characters mentioned in https://superuser.com/a/675172/ but can not be used here. I am wondering if that solution can be adapted in this situation.


texts: Emacs Company-Jedi Python3 auto completion

texts:
I am trying to setup company-jedi to autocomplete for python3. The autocomplete is working for standard python3 modules; however, it is not working for packages I installed using pip3, in this case numpy.

The virtualenv package required by company-jedi has been installed using:

sudo pip3 install virtualenv

Python3 has been installed using:

brew install python3

Numpy was installed using the following command:

sudo pip3 install numpy

I have followed the instruction from this link but to no avail. If I install numpy using pip instead of pip3 auto-complete works; therefore, I think that jedi is still using python2 instead of python3. The command M-x jedi:install-server does not return any errors.

The path of python3 was determined using the command which python3.
The exec-path-from-shell package is used to make sure the environment variables on emacs match those in the shell. Without this package the function M-x jedi:install-server returns an error that virtualenv does not exist.

My question is, how can I setup jedi to use python3 for auto-completion instead of python2?

Init.el

;; To get path from shell
(use-package exec-path-from-shell
  :ensure t
  :config
  (when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize)))

;; Installing company mode
(use-package company
  :ensure t
  :config
  (add-hook 'after-init-hook 'global-company-mode))

;; Disable the delay
(setq company-idle-delay 0)

(eval-after-load 'company
  '(progn
     (define-key company-active-map (kbd "TAB") 'company-complete-common-or-cycle)
     (define-key company-active-map (kbd "<tab>") 'company-complete-common-or-cycle)
     (define-key company-active-map (kbd "S-TAB") 'company-select-previous)
     (define-key company-active-map (kbd "<backtab>") 'company-select-previous)))

(use-package company-jedi
  :ensure t)

(defun my/python-mode-hook ()
  (add-to-list 'company-backends 'company-jedi))
(add-hook 'python-mode-hook 'my/python-mode-hook)

;; Python
(setq python-shell-interpreter "python3")

(setq jedi:environment-root "jedi")  ; or any other name you like
(setq jedi:environment-virtualenv
      (append python-environment-virtualenv
              '("--python" "/usr/local/bin/python3")))

I am currently on MacOs version: 10.13.6


texts: How to show invisible/problematic characters such as TAB and Narrow No-Break Space in an org-mode table?

texts:
Is there a way to indicate where you have an "invisible" character that's causing problems in an org-mode table?
The character's likely a TAB, but for the general case I'd like to assume it could also be other characters, e.g. a "narrow no-break space" (U+202F).
Background
I just pasted multiple lines into an org-mode table, as per Is it possible to copy /paste multiple lines of text into cells of org-mode table?.
First I created an empty table:
|   |   |
|   |   |

Then I created some lines in the org-mode buffer. Originally I'd copied text from some web page, but I've found I can reproduce the behaviour with the text below.
abcdef
abcdef7890

Then I used C-x r k and C-x r y to insert this into the table. Below is the result, after pressing C-c C-c to align the table:
|   | abcdef     |
|   | abcdef7890     |

Note that the rightmost '|' aren't correctly aligned. It seems a TAB character was added in the process at the end of the first row.
If I do e.g. ESC SPACE at the end of the first row and then C-c C-c, that row is fixed. In this case it also fixes the entire table:
|   | abcdef     |
|   | abcdef7890 |

However, in my original case I had to go and fiddle with all rows.
PS.
The focus of this question is how to show the invisible/problematic characters, assuming that's the cause. Why I'm getting the problematic characters should probably go in another question.
Update: Created Why is a TAB character added when using kill-rectangle and yank-rectangle to insert multiple rows into an org-mode table?


texts: How to use unicode character for truncation and wrap slots in the standard display table

texts:
I'm trying to set unicode characters for the truncation and wrap slots in the standard display table (see code below) that are used in terminal mode or GUI when there is no fringe. It is working for truncated lines, but not for wrapped lines: the ↩ is not displayed and is replaced by an hollow box. I suspect I may have to use make-glyph-code but I'm not sure of the syntax.

(set-display-table-slot standard-display-table 'truncation ?…)
(set-display-table-slot standard-display-table 'wrap       ?↩)

Solution:

The problem was the "↩" glyph being substituted by the glyph from a fallback font (Fira Code in my case). I'm not sure this is a bug but here is the solution:

(defface fallback '((t :family "Fira Code"))  "Display")
(set-display-table-slot standard-display-table 'wrap
                        (make-glyph-code ?↩ 'fallback))


texts:
I'm not from a vim background so I remap a lot of the evil commands and keys to fit my needs. I know you can use evil-repeat but I like the following better to quickly kill a few lines:

(defun evil-delete-or-repeat-delete-line ()
  (interactive)
  (if (or (eq last-command this-command)
          (eq last-command 'evil-line))
      (progn
        (setq this-command 'evil-line)
        (call-interactively 'evil-repeat)
        (kill-new (concat (cadr kill-ring) (car kill-ring))))
    (call-interactively 'evil-delete)))

This function repeats deleting lines if I press the evil-delete key multiple times and also preserves the evil-delete functionality. It appends every subsequent kills to the kill ring, too. This works with the following binding:

(define-key evil-normal-state-map (kbd "x") 'evil-delete-or-repeat-delete-line)

I would like to have something similar for evil-yank. For this the cursor should move to the next line after every call. I tried but couldn't get it to work. Can anyone help me?


texts: Are there any disadvantages to moving init.el to org-mode?

texts:
I've noticed some people have their init files in org-mode, using org-babel-load-file.

Are there significant performance penalties or other disadvantages to doing this?


texts: Easy completion for internal links to figures/images?

texts:
I am writing a manuscript and I want to be able to reference my figures in the manuscript which I have included like the manual suggests:

#+CAPTION: Figure caption
#+NAME:   fig:my-figure
     [[./figures/my_figure.pdf]]

I basically want to pop up a helm search and autocomplete elsewhere in the document to find the figure I want and reference it. Can this be achieved using C-c C-l org-insert-link or is something new needed? This only brings up a canned list of tags.

I have seen this but the question is asking only for headers.


texts: What are the requirements to stage a hunk from any Magit diff buffer?

texts:
I cannot stage a hunk with magit-stage in any *magit-diff buffer except the *magit-diff buffer created via status buffer.  Magit says "user-error: Cannot stage committed changes".

I mean, I cannot stage a hunk in a *magit-diff buffer created from

M-x magit-diff-dwim in a source file
M-x magit-diff-popup then d in a source file
M-x magit-diff neither in a source file nor in a *magit buffer

However, I can stage a hunk in a *magit-diff buffer created from

M-x magit-diff-dwim in a *magit buffer
d then d in a *magit buffer

I found this because I often want to diff my editing file and I felt that magit-status and d d is a bit tedious and wanted to by-pass magit-status.  What am I missing?

I'm using magit 2.11.0-236-g1c69e9e9.


texts: How can I prevent a setting in init.el from being overridden during startup?

texts:
Using emacs-mac-port, and I'm trying to configure horizontal scrolling with the trackpad. The following expressions work if I execute them manually via eval-last-sexp,

(global-set-key [wheel-right] (lambda ()
                                 (interactive)
                                 (scroll-left 1)))
(global-set-key [wheel-left] (lambda ()
                                (interactive)
                                (scroll-right 1)))

but having added them to my init file seems to have no effect. I start up emacs, type a line long enough to be truncated, try to scroll sideways and I have no horizontal scroll. If I open up my init file (~/.emacs.d/init.el) and execute the relevant expressions manually, I DO get horizontal scrolling.

Some investigation shows that at initial startup, wheel-right and wheel-left are both bound to mac-mwheel-scroll, an interactive compiled Lisp function in Emacs.app/Contents/Resources/lisp/term/mac-win.el which "parses switches controlling interface with Mac window system".

Interestingly, the mac-mwheel-scroll definition includes a comment: TODO: horizontal scrolling

How can I give the settings in my init file a higher precedence than what's being set in mac-win.el? I'm guessing mac-win.el is being read later in startup process and thus overriding my settings, but I'm not really sure about that.


texts:
I recently upgraded to yasnippet 0.10.0, on emacs 24.5.1/OS X and noticed that some of my yasnippets are not loaded anymore, but this only affects some. I can see that these are still in the compiled list of snippet, but entering the snippet key and TAB doesn't do anything anymore.

I tried reloading and recompiling the list of yasnippets, but didn't have any luck.

One of the snippets that doesn't work anymore looks like this:

# -*- mode: snippet; require-final-newline: nil -*-
# name: function
# key: lerj
# --
error_log(json_encode($0));

My yasnippet setup:

(setq yas-snippet-dirs '("~/Documents/playground/emacs/my-emacs-config/yasnippet-snippets"))

In the compiled file .yas-compiled-snippets.el I can also see that the snippet is registered:

("lerj" "lerj\n$0" "function" nil nil nil "/Users/max/Documents/playground/emacs/my-emacs-config/yasnippet-snippets/php-mode/log-error-json_encode" nil nil)

But also when executing yas-describe-tables only 2 snippets are liseted, but not the lerj one.

I only noticed that behaviour since I upgraded yasnippet to a more recent version, but I couldn't find any similar bug report.


texts: org-mode links to gnus articles with imap

texts:
When using gnus with nnimap (IMAP access to a remote mail server) and linking gnus articles (e-mail messages) in org-mode files.

What are the pros and cons of gnus storage methods (for articles) in regard  of having reliable access to articles, when there is no network connection (aka: offline mode)?

As I see there are multiple possibilities to store a gnus article on local hard disk and I can't see the implications or drawbacks of those methods.

article caching
persistent article
article archiving
article saving
using a separate directory or separate backend (like nnml) and copy articles to this

Note: I do not care about storage or inodes usage on my local hard disk.
I do not want to use important mark for all articles.
I speak about e-mails only (no news involved, yet)


texts: How to tweak `org-emphasis-alist' to put, e.g., neon-yellow over bold (or italic, underscole...) text?

texts:
I read here that I could colorize the markup in my org-mode configuration, so I searched, and here I found an example.

The problem is when I append this code, as the answer suggests, to my .emacs:

(add-to-list 'org-emphasis-alist '("*" (:foreground "red")))

When I restart Emacs, I get this error:

  Warning (initialization): An error occurred while loading
  ‘c:/Users/username/.emacs’:

  Symbol's value as variable is void: org-emphasis-alist

  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.


texts:
I can't seem to get the non-greedy regex to work.

Sample String:

ABCD，E《F》、《GH》、《XYIJ》、《KL》、《MN》。

Regex Code:

《.+?IJ》

Search Result:

Because .+? is a non-greedy input, I was expecting the search to confine to the nearest 《》 pair, as shown below.

The present output is no different from searching this:

《.+IJ》

Which essentially makes the non-greedy code redundant.

Expected Result:

How should we get the non-greedy function to work as expected?


texts: How to revert evil insert state binding of the escape key?

texts:
I have remapped the evil-normal-state command bound to ESC in Evil Insert mode to C-o since the escape key is more difficult to reach on my keyboard than typing C-o. Now I want to use the original meaning of the ESC key as a prefix key instead.

I tried:

(define-key evil-insert-state-map (kbd "ESC") 'ESC-prefix)

but it does not work.


texts: Is there a key-binding to move the cursor to the last character in the buffer

texts: Is there a key binding that moves the cursor to the last character in a buffer? I'm asking because I often find myself at a point other than the last character, where I want to be, in the interactive-shell.


texts: How can I export particular org files/headings with export settings to specified filenames?

texts:
I'd like to export headings with particular names/tags, with a particular set of export options, to particular file locations.

I'd like to do this all via elisp, so that I can have it part of a larger script which then pushes the changes to server. Also there will be multiple sets of overlapping documents/headings exported in different ways, so having all the settings in separate elisp scripts using project-alists allows more flexibility then adding annotations to the files or headings themselves.

As a concrete example, I might want to output a.org::*h to foo.html and b.org to bar.html, with a set of publish settings. foo.html in this case should only contain the contents of the h heading, with child headings of h exported as top level headings in foo.html.

The only way I can see how to do this is to hackily pre-process with a script that copies over parts I want into a new directory (into files with those specific names) and then publishing from there. I'm not sure how to do that in a way that doesn't have unexpected side effects, and am curious if there is a better way?

An ideal solution would enable me to:

Specify headings to export, and corresponding output file names.
Use project-alist so that I can describe other export settings and combine these export "projects" as needed.
Ensure links worked, even as headings are transformed into separate files.


texts: after org-capture, how to go to the content that I saved?

texts:
I just wondering if there is a way to go to the content which saved by doing org-capture

I couldn't find any customizable variable so far :-/

Thanks in advance!


texts: How to persist a transient to make a command repeatable?

texts:
I am converting some of my Hydras to Transient. One of them includes a command with shrinks or enlarges one of my split windows, so I hit it repeatedly until I like my size. How to do this in Transient? The documentation makes it clear that it's possible, but I can't find a place where it explains how. It appears to be related to the :transient-suffix 'transient--do-stay, but I can't figure out where to place this to make some of my commands repeatable. Further, it would be nice to set this per-command or per-group, not just on the whole transient. Here is what I'm working with:
(transient-define-prefix tsa/transient-window ()
  ;; the following :transient-suffix causes the whole thing to fail at command invocation:
  ;;; command-execute: Wrong type argument: commandp, tsa/transient-window
  ;;     :transient-suffix 'transient--do-stay
  "Window navigation transient"
  [["Resize"
    ("q" "X←" tsa/move-splitter-left)
    ("w" "X↓" tsa/move-splitter-down)
    ("e" "X↑" tsa/move-splitter-up)
    ("r" "X→" tsa/move-splitter-right)]])


texts:
windows 10, emacs 26.1, dired+

here myfolder in dired mode sort by name (by default):

Now I want to sort by date (inverse mode). I press s and here result:

why file new.txt is above two dots?

The result must be like this (Total Commander):

Is it possible in Emacs to get same result?


texts: How to align the source code block when export to PDF in Org-mode?

texts:
While using org-mode to export source code to PDF files, the source code is not aligned with the indentation of the text.

The .org file are as follow:

And the output result looks like this:

Would there be a way to align the indentation of the code block, or to center it?


texts: Wrong type argument: undo-tree, [cl-struct-undo-tree [nil ([nil ([nil nil ]]]

texts:
The way I installed undo-tree:

M-x package-install undo-tree

My setup:

GNU Emacs 26.3
undo-tree          0.7.4         installed  Treat undo history as a tree

(global-undo-tree-mode 1)
(setq undo-tree-auto-save-history t)
(setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))

Error I am getting:
Warning (initialization): An error occurred while loading ‘/home/netlab/.emacs’:

Wrong type argument: undo-tree, [cl-struct-undo-tree [nil ([nil ([nil nil ((q . -1) (undo-tree-id0 . -1) 2) nil (24247 15636 187465 670000) 0
nil]) ((1 . 2) (t 24232 5976 416148 754000)) nil (24247 15636 187476 578000) 0 nil]) nil nil (24247 15636 187481 124000) 0 nil] [nil nil ((q .
-1) (undo-tree-id0 . -1) 2) nil (24247 15636 187465 670000) 0 nil] 41 2 nil]

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.

I am not sure how can I fix this error or what causing it.

Update:
Output of the debug output:
Debugger entered--Lisp error: (wrong-type-argument undo-tree [cl-struct-undo-tree [nil ([nil ([nil nil (... ...
2) nil (24247 15636 187465 670000) 0 nil]) ((1 . 2) (t 24232 5976 416148 754000)) nil (24247 15636 187476 578000)
0 nil]) nil nil (24247 15636 187481 124000) 0 nil] [nil nil ((#("q" 0 1 (fontified t)) . -1) (undo-tree-id0 . -1)
2) nil (24247 15636 187465 670000) 0 nil] 41 2 nil])
  signal(wrong-type-argument (undo-tree [cl-struct-undo-tree [nil ([nil ([nil nil ... nil ... 0 nil]) ((1 . 2) (t
24232 5976 416148 754000)) nil (24247 15636 187476 578000) 0 nil]) nil nil (24247 15636 187481 124000) 0 nil]
[nil nil ((#("q" 0 1 (fontified t)) . -1) (undo-tree-id0 . -1) 2) nil (24247 15636 187465 670000) 0 nil] 41 2
nil]))
  undo-tree-load-history(nil noerror)
  undo-tree-load-history-from-hook()
  run-hooks(find-file-hook)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer __init__.py> "~/folder/__init__.py" nil nil "~/folder/__init__.py"
(29887794 2050))
  find-file-noselect("/home/alper/folder/__init__.py")
  mapcar(find-file-noselect ("/home/alper/folder/Driver.py" "/home/alper/folder/__init__.py"
"/home/alper/folder/config.py" "/home/alper/folder/end_code.py"
"/home/alper/folder/garbageCollector.py" "/home/alper/folder/imports.py"
"/home/alper/folder/ipfs_daemon.py" "/home/alper/folder/lib.py" "/home/alper/folder/link.py"
"/home/alper/folder/setup.py" "/home/alper/folder/start_code.py"
"/home/alper/folder/thread_log.py" "/home/alper/folder/utils.py"
"/home/alper/folder/whisper_state_receiver.py"))
  find-file-noselect("*.py" nil nil t)
  find-file("*.py" t)
  eval-buffer(#<buffer  *load*> nil "/home/alper/.emacs" nil t)  ; Reading at buffer position 25178
  load-with-code-conversion("/home/alper/.emacs" "/home/alper/.emacs" t t)
  load("~/.emacs" t t)
  #f(compiled-function () #<bytecode 0x2967a1>)()
  command-line()
  normal-top-level()

desktop output:

https://gist.github.com/avatar-lavventura/8f310c9d8eda99815ad7153d89b6d108


texts: Spacemacs: How can I customize the highlight style of a matching parenthesis?

texts: How do I change, in my .spacemacs, the style used to highlight the matching parenthesis?


texts: Certain symbols resulting in really tall line (and cursor)

texts:
This one is honestly a bit of a mystery for me.  The strange behavior is caused by the lambda symbol: the line goes to normal height if I remove the lambda.

How can I get Emacs to display such symbols correctly?

(oops, typo in the image)


texts: magit blame: is there an equivalent for "show me the file before this commit" from VC?

texts:
VC blame mode has a nifty a hotkey "show me blame of the file before the commit I'm pointing at".

Is there an equivalent in magit?


texts: Change foreground color of a region (temporarily)

texts:
I need to change the "OBJECT" string foreground color (let's say "red") in all the occurrences of the string "\command{OBJECT}" in my buffer and I need to restore the original foreground color at the end of the job.

I figured out to do something like (it's a simplified MWE):

(defun propertize-command-arg ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (search-forward-regexp "\\\\command{\\([a-z]+\\)}" nil t)
      (save-excursion
        (let ((b (match-beginning 1))
              (e (match-end 1)))
          (put-text-property b e SOMETHING))))))

SOMETHING is what I've not be able to understand/find. I tried also add-text-properties and add-face-text-property.

Please keep in mind I need to do it temporarily. I'll restore the original appearance of the text at the end of my job (script).


texts: How to treat prettified symbols as the text they represent for filling paragraphs?

texts: I have configured prettify-symbols-mode to display a bunch of LaTeX commands as unicode symbols, for example showing the Greek letter commands as the actual letters. The issue I'm having now is that M-q considers these displayed characters as a single letter, so the raw text often exceeds the line break point. How can I elegantly make fill-paragraph take prettified symbols into account?


texts: What is the "preferred" way to use Emacs' packages facility?

texts:
Emacs has list-packages and related functions to manage packages. That's great. However, packages installed via this command changes my .emacs and does a custom-set-variables.

So is the preferred method to use this packages capability to use it via customize, or still write elisp for everything else, or something else?

The problem with customize is that not everything can be done there.

The problem with writing elisp for everything else is that custom-set-variables goes to the end of .emacs and is in the "wrong order" if I need to configure the packages.

What's the best way to do this?


texts: How to execute a org-babel source block within the working directory?

texts:
Say you have the following org-babel source block:

#+BEGIN_SRC latex :results raw :file test.pdf
\LaTeX
#+END_SRC

When executing it, org-babel will do the actual compilation in a temporary directory and move the resulting PDF back to your working directory afterwards. The problem with this is that I cannot include my local LaTeX commands and configuration with \input{myMacros}, since it won't be found in the temporary directory.

How can I tell org-babel to execute a source block in the folder of the org-mode file (hence in the default-directory)?


texts: How can I draw pixel- or vector-based UI elements in Emacs?

texts: With that I mean UI elements (for example text fields and animated buttons) that are not restricted to the monospaced character grid of terminal emulators, but can be arbitrary shapes at arbitrary pixel positions on the screen.  I’m simply curious whether and how that is possible, and if it’s not possible, whether it’s planned for the future.


texts: How to make  work in org mode when combined with evil mode?

texts:
In evil mode, I would like C-i not to work as a tab key, which is the default behavior in Emacs. Also, I would not have the default vi behavior simulated in Emacs evil by evil-jump-forward, but instead I would like to have C-i work as the scroll-down-command.

Then, since C-i is mapped to <tab> by default, and I would like <tab> work as the usual indent-for-tab-command, I need to bind <tab> also. Here is a minimal setup:

(setq package-load-list
      '((evil t)
        (undo-tree t)
        (goto-chg t)))

(package-initialize)
(require 'evil)
(evil-mode 1)
(define-key evil-normal-state-map (kbd "C-i") 'scroll-down-command)
(define-key evil-normal-state-map (kbd "<tab>") 'indent-for-tab-command)

The problem now is that this seems to confuse org-mode. I think <tab> in org-mode only works correctly if <tab> is not bound, in that case org-mode will rebind it locally to org-cycle.

So now I am not able to expand subtrees in org-mode. In fact, in org-mode the <tab> key is bound to indent-for-tab-command instead of the desired org-cycle command. How to solve this problem?

Note that the solution provided in Emacs, org-mode, evil-mode - TAB key not working does not work, since I rebind the <tab> key.


texts:
This question has been asked at superuser is-there-a-way-to-reload-environment-variables-in-emacs, but no good solution was given.

I am using EmacsClient with often more than 30 buffers open, if I change an environment variable in the shell, I need to exit EmacsClient ( and reopen all the buffers) or I have to manually set the environment variable also in Emacs. I find it annoying that I cannot update the environment variables easily in Emacs. Any suggestions?


texts: Is there a way to show the tasks in the agenda list grouped by category? I mean in the task list view (when pressing C-c a t) rather than the week-agenda.


texts: Supporting images/diagrams in exported org-mode presentations

texts: I'm currently preparing a presentation which I've outlined in org-mode and I'm having difficulty in including diagrams in the exported HTML. I'm currently using org-reveal but I'm happy to use another HTML presentation exporter if needed. org-reveal does offer the option to include HTML directly in the presentation but that seems a little hacky. Surely there is a better way to specify that an image should be in-line in the final exported output?


texts: How to know that cursor is surrounded by specific text

texts:
Can we know, that we are in the following position:

text1 ... <cursor> ... text2

But this doesn't count:

text1 ... text2 ... <cursor> ... text2

text1 ... <cursor> ... text1 ... text2


texts:
I am not quite sure what the best way to describe what I'm looking for is, so let me start with a picture. This is the result of doing a search for all TODO items in my agenda-files with a certain tag.

Whenever a TODO item is too long, the overflow text appears on the following line, as one would expect. But rather than being indented with the rest of the TODO items, it is aligned fully to the left of the window. Is there away around this? Either showing only what fits on the column containing all TODO  (and just cutting off the rest) or indenting accordingly would do.


texts: smartparens with strict mode in javascript

texts:
I am trying to configure smartparens to work with javascript, my config looks like this:

(use-package smartparens
  :ensure t
  :diminish smartparens-mode
  :commands (smartparens-mode
             smartparens-strict-mode)
  :config
  (progn
    (require 'smartparens-config)
    (smartparens-global-mode 1)))

If I am writing an if statement, I cannot add certain filters like <, > and others:

If I try and type these symbols, I get this error message:

  We can not insert unbalanced closing delimiter in strict mode.

Is there a way round this?


texts: Where is this cruft coming from in shell-mode and term-mode?

texts:
tcsh$ cd ~
^[]0;sallred@calamity:/home/sallred^G
tcsh$ cd bin
^[]0;sallred@calamity:/home/sallred/bin^G
tcsh$

What is this cruft that is appearing before my prompt (or perhaps more appropriately, after my command) and how can I remove it?


texts: How to call (line-end-position) that returns a value excluding trailing whitespace?

texts: What is a good way to replace (line-end-position) with a function that doesn't include trailing whitespace?


texts: Automate delete content of remote org mode file!

texts:
Linux Mint 19.3

Emacs 26.3

Dired+

I use Google drive. To connect I use rclone. As result I success connect to my google drive.

In dired mode I open to.do.org file in Google's drive

Edit file and save by C-x-s

The press C-x d. And as you can see the size of to.do.org is 0 bytes!!!

Press enter and as result open to.do.org file.

After file was open the AUTOMATE start REVERT BUFFER!!!

and as result the content of to.do.org file IS EMPTY!!!

How I can fix this?

P.S. If I work with any LOCAL org file then no problem. But with remote Google's drive file (org files) then has problems.


texts:
I tried to export an org source block containing a heading.

My first attempt,

#+NAME: rekotor
#+BEGIN_SRC org :exports none
* KOTOR and KOTOR 2 are the only worthwhile products of the Star Wars franchise
#+END_SRC

* List of heresies
  #+CALL: rekotor[:results silent :exports results]

resulted in an error.

It turns out that to call the rekotor source block under a heading, I had to ident the heading within the rekotor block. Like this,

#+NAME: rekotor
#+BEGIN_SRC org :exports none
  ** KOTOR and KOTOR 2 are the only worthwhile products of the Star Wars franchise
#+END_SRC.

I also had to start the #+CALL at column index 0,

* List of heresies
#+CALL: rekotor[:results silent :exports results].

Only then the export (to LaTeX) worked.

While this question/answer is primarily aimed as a reminder to myself in case I forget about this, I am wondering is there a more elegant fashion of embedding headings defined in org source blocks in the main org document body?


texts: When I enable line numbers in Emacs the cursor starts in a line with no number in it. If you press enter then the numbers increment but always there is a line with no number. Why is that happening?


texts: Duplicate headllines in org mode in CentOS

texts:
CentOS 7
Emacs 27.1
Magit
Here my folder with org mode files:

I open current.to.do.org and it success open.

As you can see the first headline is ANDROID and last headline is TESTING.
Nice.
Now I restart Emacs and open again current.to.do.org.
But now all headlines ARE DUPLICATE.

I exit from Emacs and start like this:
emacs -Q

But result is a same.

Another test:
Create new org file (test.current.org). It has only one headline (First headline)

Save file. Size of file is 49 Bytes

Exit from Emacs. And go to folder again.

As you can see the size of file (test.current.org) not change.
Nice. And now open file again.

As you can see the whole data ARE DUPLICATE!
It's happen every time!!!


texts: Trying to install auctex via package-install

texts:
I am trying to install auctex via M-x package-install RET auctex.

Unfortunately after a brief splash of
Contacting host: elpa.gnu.org:443,

I end up with the message
https://elpa.gnu.org/packages/auctex-12.1.2.tar:Bad Request

On a different machine, this seems to work fine - I don't know where this is going wrong.

The top part of my init.el file currently reads:

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl
    (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))

  (add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
   ;;  For important compatibility libraries like cl-lib
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))

(package-initialize)

Any ideas as to what I should try? This is Emacs 26.2 btw.


texts: Trying to use `pdfgrep` program from within my command

texts:
I want to be asked what string %s I want [0] pdfgrep to search for? While M-x pdfgrep mysearchString works, I'm somehow missing something on wrapping it up as sole function?

(require 'pdfgrep)
(pdfgrep-mode)
(defun myPdfSearch ()
  (interactive)
  (pdfgrep -H -n -i -r %s /home/pdf/))

Symbol’s value as variable is void: -H

[0] https://github.com/jeremy-compostella/pdfgrep


texts:
'(1 2 3) gives me a list of three elements,

but

(setq A "apple")

'(A) gives me (A).

My question is how can I get the list '("apple") by referring variable A?


texts:
I want to write my emacs-lisp-mode modification which respects
some of my preferences. In particular, I want to override indentation for vector literals.

Emacs treats vector literal as quoted list while applying indentation.

[if "emacs"
    "why do you"
  "indent things this way"]

[1 2
   3 4]

[(foo 1) ;; this one is OK without modifications
 (bar 2)
 "this"
 "is good"]

I want this result:

[if "emacs"
 "why do you"
 "indent things this way"]

[1 2
 3 4]

[(foo 1)
 (bar 2)
 "this"
 "is good"]

How can I achieve this?


texts: ISearch - Paste - text in mini buffer is not same

texts:
Windows 10, Emacs 25

Select text

second word is upper case.
Press C-s
Paste text

Why whole text is lower case in mini buffer?


texts:
The configuration that I have for python mode implies loading both elpy.el and python.el. The things is that I found the python.el keybindings more natural than the elpy.el ones. And most of the python.el keybindings are shadowed by elpy.el.

I have tried adding a redefinition of the key map to the .emacs file, but it is not working.

This is my "raw" configuration for python

;; PYTHON CONFIGURATION
;; --------------------------------------

(elpy-enable)
(setq python-shell-interpreter "/home/anaconda3/bin/ipython"
      python-shell-interpreter-args "-i --simple-prompt")

;; use flycheck not flymake with elpy
(when (require 'flycheck nil t)
  (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
  (add-hook 'elpy-mode-hook 'flycheck-mode))

;; enable autopep8 formatting on save
(require 'py-autopep8)
(add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)

;; jedi config
;;----------------------------

(autoload 'jedi:setup "jedi" nil t)
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
(add-hook 'after-init-hook 'global-company-mode)
(ac-config-default)

And this is the redefinition I have added:

(I have added an "e" after every "C-c")

(defvar elpy-mode-map
  (let ((map (make-sparse-keymap)))
(define-key map (kbd "C-c e C-r") elpy-refactor-map)
(define-key map (kbd "C-c e C-c") 'elpy-shell-send-region-or-buffer)
(define-key map (kbd "C-c e C-p") 'elpy-flymake-previous-error)
.
.
.

    map)
  "Key map for the Emacs Lisp Python Environment.")

It did not work.

How can I change the definition of those bindings without actually modifying the elpy.el file


texts: Display two vertical rules, at columns 79 and 87

texts:
Python code now often is limited either to 80 columns, or to 88 columns.

fci-mode allows drawing a vertical rule at a single column, but not two.

I'd like to do something very similar in appearance to fci-mode, but draw two vertical lines instead of one.  The line positions don't need to depend on the value of fill-column: they should just always be columns 79 and 87.  I want to show two lines only for python mode.  How can I do that?


texts: Reading a list of string from a .txt file

texts:
I have a file, myfile.txt, whose content is:

(query-replace "foo" "Hello" nil (point-min) (poin-max))

and this function:

(defun comment-string-from-file ()
  (interactive)
  (let ((STRING (with-temp-buffer
           (insert-file-contents "myfile.txt")
           (buffer-string))))

    (when (string-match (regexp-quote STRING) (buffer-string))
      (let ((b (copy-marker (match-beginning 0)))
        (e (copy-marker (match-end 0))))

    (comment-region b e)))))

This function works and, if present, comments, in the current buffer, the string:

"(query-replace \"foo\" \"Hello\" nil (point-min) (poin-max))"

Now I'd like to do the same thing looping over a file that contains a list of strings, separated by 2 newlines, e.g.

(query-replace "foo" "Hello" nil (point-min) (poin-max))

(query-replace "bar" "World" nil (point-min) (poin-max))

(insert "foo\n")

(insert "bar\n")

Alternatively, and this should be my first choice, I could use an arbitrary string boundary to allow newlines in my strings, e.g..

♦(query-replace "foo"
           "Hello" nil (point-min) (poin-max))♦

♦(query-replace "bar"
           "World" nil (point-min) (poin-max))♦

♦(insert "foo\n")♦

♦(insert "bar\n")♦

The idea is that I don't want to use any kind of escaping in the source file.

How can I do it?


texts: How to configure org-roam-bibtex properly?

texts:
I'm using org-roam with doom-emacs and I want to know how to properly configure org-roam-bibtex?
I copied the org-roam-bibtex config from https://github.com/jethrokuan/dots/blob/master/.doom.d/config.el to get started but I don't know how to extract or create references into my roam directory.
(use-package! org-roam-bibtex
  :after (org-roam)
  :hook (org-roam-mode . org-roam-bibtex-mode)
  :config
  (setq org-roam-bibtex-preformat-keywords
   '("=key=" "title" "url" "file" "author-or-editor" "keywords"))
  (setq orb-templates
        `(("w" "ref" plain (function org-roam-capture--get-point)
           ""
           :file-name "papers/${slug}"
           :head ,(concat
                   "#+title: ${=key=}: ${title}\n"
                   "#+roam_key: ${ref}\n\n"
                   "* ${title}\n"
                   "  :PROPERTIES:\n"
                   "  :Custom_ID: ${=key=}\n"
                   "  :URL: ${url}\n"
                   "  :AUTHOR: ${author-or-editor}\n"
                   "  :NOTER_DOCUMENT: %(orb-process-file-field \"${=key=}\")\n"
                   "  :NOTER_PAGE: \n"
                   "  :end:\n")
           :unnarrowed t))))

I watched this video https://www.youtube.com/watch?v=Wy9WvF5gWYg explained how to use it but  I got lost in how he did it work.


texts: Create many buffers, name properly, silently

texts:
I am trying to avoid using the desktop save mode 1 option in my .emacs file.

We sudo a shared service account, so my buffers may differ from my colleagues buffers.

I launch Emacs from GNU/Linux with emacs -nw (as the sudo'd user) and then I start creating my buffers.
We have a monthly machine restart.  I do not mind losing my history, but it would be cool if I could save everything and just re-launch that.

If I cannot simply save / relaunch the save, then I'd like to know how to create ~20 buffers by executing a file (if possible).

Also, once I launch a buffer - is it possible to also run commands automatically after the launch?


texts: How to use a theme installed with melpa?

texts:
I want to use this theme: https://github.com/jonnay/emagicians-starter-kit/blob/master/themes/org-beautify-theme.org

I installed it via list-package successfully.

I tried loading it via load-theme RET org-beautify RET but it says Unable to find theme file for org-beautify. So I add ~\.emacs.d\elpa\org-beautify-theme-20150106.956 to my 'custom-theme-load-path and do the load-theme thing again, this time it says Undefined custom theme.

How can I activate the theme?

Seeing as someone marked my thread as a duplicate: my custom-theme-load-path does not reset after calling load-theme. You can see that after setting custom-theme-load-path to the location of the file, calling load-theme RET org-beautify RET does not give the response Unable to find theme file... anymore. Instead, I get an error of a different sort ("Undefined custom theme"), which makes me think that I'm not installing it properly. Why can't I choose the theme from Options->Customize Emacs->Custom Themes in the first place after installing it with melpa?


texts: Is it possible to fill Emacs' window background using CSS rules?

texts:
Is there some way to fill background of Emacs' windows (not frames) using some CSS rules rather than one solid color?

Solid color fill is very unnatural for eyes (at least of mine).  There is an amazing cicada principle1 in the wild, and it will be very great to fill background using several low opacity gradient layers to make some slightly visible noise.  I believe this also helps to follow scrolling.


texts: How to disable `git-rebase-mode` after magit is installed?

texts:
I'd rather use regular text editing functions when rebasing instead of learning magit's bindings.

Is there a way to use magit but disable git-rebase-mode?


texts: How to get HideShow to indicate Flycheck Errors/Warnings inside a folded region?

texts:
When a portion of code is folded, error and warning indicators from Flycheck relative to this portion are not shown.

How can I get Flycheck or HideShow to indicate that a folded portion of code contains errors/warnings ?


texts:
(message "abc\ndef") displays a two line message, while
(message-box "%s" "abc\ndef") does not.  Can the controlled two line
display be replicated in message-box?

Also, M-x customize didn't seem to have a section for customizing
the message-box appearance (e.g. different background colors for the OK vs
the message).  Can message-box's appearance be customized?

Can either of these issues be remedied by going to a pop-up
(of some sort, e.g. x-popup-dialog), or some other emacs package?


texts:
I wish to alter a package, test it and hopefully submit a pull request afterwards. How do I do it in a safe and efficient way? The question might feel too broad, I will accept the answer that covers the following issues:

I'd expect to install a separate branch of a package and be able to switch between it and stable branch on a whim, with recompilation performed automatically when it's necessary, but package.el doesn't seem to offer a straightforward way to do that. This answer on emacs-SE informs us that “If multiple copies of a package are installed, then the first one will be loaded” so I guess one could manually mess with load-path but this doesn't feel robust. What is the standard way to select a specific version of package among those installed?
Even if I manage to expose several branches to Emacs, for significant tweaks I need to make sure the unpatched branch is “unloaded” and its side-effects isolated. Does unload-feature handle this properly or maybe it has idiosyncrasies that every tester of multi-versioned packages should know about?
How do I install and test the local version? The answer appears to be dependent on whether the package is simple (= one file) or multifile. EmacsWiki says about multifile packages: “MELPA builds packages for you”. I doubt that I have to (or should) talk to MELPA every time I change a defun form in a multifile package but the question remains. At least I need to tell package manager about local version, and if so, how do I do it?
What names should I assign to local versions of packages? Suppose I want to work on multiple features or bugs simultaneously, which means having several branches. Emacs won't allow to name versions in a descriptive manner (along the lines of 20170117.666-somebugorfeature). I guess I could rename the package itself, a suffix per branch, but again, like manually messing with load-path in Q1, this is an ugly hack, so I won't try it with something I intend to send upstream unless it's a widely accepted practice.

The questions probably are naive, since I never wrote a patch neither applied one with git or a similar vcs. However, for plenty of Emacs users, patching an Emacs package might be their first ever (or maybe the only one) social programming endeavour, which is why, I believe, answers to this question would still be valuable.


texts: Is there an eval-defun alternative for Clojure mode?

texts:
When I define a function in Emacs Lisp mode, you can evaluate it with moving the pointer to the
last parenthese of a function, and do C-xC-e. Aka calling eval-last-sexp.

I thought this is somewhat a cumbersome. So I bound the key C-e to
eval-defun. So every time you define a new setq definition or a function,
you can evaluate it with eval-defun without the need to move your pointer to
the latest parenthese first.

Now I'm trying Clojure in pair with CIDER. I noticed you need to move to the
latest parenthese and then call cider-eval-last-sexp. I would like to eval the
current function/whatever where my cursor is, where the pointer is.

But I couldn't find any Clojure/Cider alternative for ELisp's eval-defun. Any suggestion for a function would be appreciated.


texts: Vim-LaTeX-Suite Macros in AucTeX / Emacs

texts:
I am a long term Vim user but I consider switching to Emacs + EVil-mode.
However, there is one major obstacle.
I most frequently use Vim to edit LaTeX files and I have grown quite accustomed to the LaTeX macros of Vim-LaTeX-Suite.

E.g. typing EIT automatically turns into

\begin{itemize}
   \item <++>
\end{itemize}

typing ``8  or `/ turns into

\infty  or  \frac{<++>}{<++>}

This actually depicts 2 issues.

1) Automatic replacement of strings (EIT; ``8) with the corresponding environment; LaTeX macro. It would be great if someone could point me to some tutorial. I think it should be fairly easy to solve with some kind of a replacement dictionary.

2) The <++> tags are jump marks. Hitting CTRL+J in Vim makes the cursor jump to the next jump mark in the text. This makes navigating automatically inserted environments and formulae very quick and easy. Is there any way to emulate this behavior?

3) When writing braces {} these braces become substituted by {}<++> and the cursor jumps back in between the braces. I type my formula and CTRL+J jump behind the braces. Therefore I am now used to closing my braces first and typing the respective content afterwards. Anyway to get this behavior?


texts: Detect whether a new file has been visited by user or by lisp code

texts:
I would like to check whether a new file has been visited by an interactive command (e.g. visited using C-x C-f) or if it has been visited programmatically by some Lisp code.

Use case:
I cooked my own template/auto-insert/skeleton functionality using yasnippet, and I mainly use it for LaTeX files. I would like the template functionality to apply only if I create the file by hand, and not whenever some Lisp code does that. In particular, my template function interactively asks for some input, and this should not happen when executing Lisp code.

Example:
AUCTeX creates LaTeX buffers (with the corresponding files) from time to time, for example the region.tex file if you use TeX-pin-region functionality. I don't want the template function to apply here.


texts: What is the mode for org's LOGBOOK editing window and how can one be created if it doesn't already exist?

texts:
I want to wrap the LOGBOOK editing window at column width I'm yet to decide.
From another answer here I see need to set something along the lines of (add-hook 'some-logbook-mode-hook #'auto-fill-mode) and (setq fill-column wrap-point)
Does the LOGBOOK window have its own mode, or will I have to create a new mode for it if want to use a hook to set the mode?


texts:
Here is a common beamer slide:

\begin{frame}
  \frametitle{Test}
  \begin{itemize}
  \item \textbf<1>{Item one}
  \item \textbf<2>{Item two}
  \end{itemize}
\end{frame}

This is what it looks like in Emacs when folded using the AUCTeX TeX-fold-mode:

\begin{frame}
  \frametitle{Test}
  \begin{itemize}
  * [Error: No content found]<1>{Item one}
  * [Error: No content found]<2>{Item two}
  \end{itemize}
\end{frame}

There are other situations too where valid LaTeX is folded with errors, which are very annoying to look at.

Is there any way of telling AUCTeX to just not fold stuff that it can't fold, so I don't see these errors anymore? Or is there a better way of dealing with this?


texts:
Suppose I have hundreds lines of items:

**** aa
**** bb
......
**** cc

I try to multiply set tags. I tried to mark them, and use C-c C-q, but it didn't works


texts: How to write functions that only operate on characters within a rectangular-region?

texts:
I've found emacs has support for rectangular selection, however I didn't see references to API's for only operating on contents within the rectangle mark.
How would this be acomplished?
Take this simple interactive function as an example.
How could this function properly take rectangular regions into account?
(defun reverse-line-or-region ()
  "Example function that reverses the line or region."
  (interactive)
  (let ((beg nil)
        (end nil))
    (cond
     ((region-active-p)
      (setq beg (region-beginning))
      (setq end (region-end)))
     (t
      (setq beg (line-beginning-position))
      (setq end (line-end-position))))

    ;; Shrink the selection (avoids issues with newlines at end of the region).
    (save-excursion
      (goto-char end)
      (skip-chars-backward "[:space:]")
      (setq end (point))

      (goto-char beg)
      (skip-chars-forward "[:space:]")
      (setq beg (point)))

    (let* ((str-prev (buffer-substring-no-properties beg end))
           ;; Just an example, could be some other operation.
           (str-next (reverse str-prev)))
      (delete-region beg end)
      (goto-char beg)
      (insert str-next))))


texts: Execute shell command and then some text into document

texts:
I have a python script ss.py that gets a screenshot from a connected device and puts into particular dir. From terminal I run it with the target path as an arg:

$ python ss.py {document-name}/{image-name}

Then I have to insert some text into my document to reference it.

.. image:: /img/{document-name}/{image-name}.*
  :alt: {Some alt text here}

I want to write a command that will accept the image name as an argument, take the doc name from the current buffer (minus file extension) and then put the image directive into the current buffer, leaving me and my cursor at the alt text, so I can keep writing there. And I want to bind it to some key (I don't what is commonly unused/available.)

(I am very new to emacs. So I don't even know where to start with this.)

NB: In case it matters, I need to run the Python command using python3, which normally means I use a virtualenv in a bash shell. Also, in case it matters I am using emacs 25 on Mac OS X.


texts: Why does end-of-line behave differently in --batch?

texts:
I have an elisp script that behaves differently between an interactive Emacs session and running Emacs with --batch.

(defun call-fn-in-let (unused)
  (let (xx)
    (let (yy)
      (split-string "foo" "bar" nil))))

(with-temp-buffer
  (insert "foofoofoo\nbarbarbar")
  (let ((dd (let (aa)
              (let (bb)
                (let (cc)
                  (progn (call-fn-in-let nil)))))))
    (let (ee)
      (save-excursion
        (goto-char (point-min))
        (if t
            (progn
              (move-end-of-line nil)
              (message "point is: %s" (point))))))))

If I run M-x eval-buffer, then *Messages* shows:

point is: 10

However, if I run Emacs from the CLI, end-of-line behaves differently, jumping straight to end the of the file.

$ emacs -batch -l test/pyimport-test.el
point is: 20
$ emacs --version
GNU Emacs 24.5.1

I'm mystified why this is the case.

This is the most minimal example I can find. Even removing things like if t or an unused let binding, changes the -batch behaviour!


texts: How do I revert to the English keyboard after switching to Devanagari?

texts:
I do this to switch to a Hindi keyboard:-

C-x RET C-\ [TAB]

and then I choose :

devanagari-inscript

My query is : How do I switch back to an English keyboard? I can see options for english-dvorak and various latin-* keyboards, but which is the default English keyboard ? Can someone please clarify? Is there a way to display the current keyboard ? I tried

C-h I

but it says

No input method is activated now.


texts: Why do the latest versions of use-package and CIDER break each other?

texts:
Here is an example config to demonstrate the problem I am facing:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(package-refresh-contents)
(package-install 'use-package)
(setq use-package-always-ensure t)
(use-package cider)

Previously, this would cause use-package to install CIDER just fine; however, since I removed my ~/.emacs.d/elpa directory today to update my packages, I now get this error when I run emacs --debug-init:

Debugger entered--Lisp error: (void-function if-let)
  (if-let ((cons (assoc car alist))) (setcdr cons (list cadr)) (set symbol (cons (list car cadr) alist)))
  (let ((alist (symbol-value symbol))) (if-let ((cons (assoc car alist))) (setcdr cons (list cadr)) (set symbol (cons (list car cadr) alist))))
  cider-add-to-alist(cider-jack-in-dependencies "org.clojure/tools.nrepl" "0.2.12")
  byte-code("\300\301\302\303#\210\304\301\305\306#\207" [put cider-jack-in-dependencies risky-local-variable t cider-add-to-alist "org.clojure/tools.nrepl" "0.2.12"] 4)
  require(cider nil t)
  (not (require (quote cider) nil (quote t)))
  (if (not (require (quote cider) nil (quote t))) (ignore (message (format "Cannot load %s" (quote cider)))))
  (progn (progn (require (quote package)) (use-package-ensure-elpa (quote cider))) (if (not (require (quote cider) nil (quote t))) (ignore (message (format "Cannot load %s" (quote cider))))))
  eval-buffer(#<buffer  *load*> nil "/home/sam/.emacs" nil t)  ; Reading at buffer position 228
  load-with-code-conversion("/home/sam/.emacs" "/home/sam/.emacs" t t)
  load("~/.emacs" t t)
  #[0 "\205\262

If I close Emacs and run emacs --debug-init again, I get a slightly different error:

Debugger entered--Lisp error: (invalid-function (cons (assoc car alist)))
  (cons (assoc car alist))()
  cider-add-to-alist(cider-jack-in-dependencies "org.clojure/tools.nrepl" "0.2.12")
  byte-code("\300\301\302\303#\210\304\301\305\306#\207" [put cider-jack-in-dependencies risky-local-variable t cider-add-to-alist "org.clojure/tools.nrepl" "0.2.12"] 4)
  require(cider nil t)
  (not (require (quote cider) nil (quote t)))
  (if (not (require (quote cider) nil (quote t))) (ignore (message (format "Cannot load %s" (quote cider)))))
  (progn (progn (require (quote package)) (use-package-ensure-elpa (quote cider))) (if (not (require (quote cider) nil (quote t))) (ignore (message (format "Cannot load %s" (quote cider))))))
  eval-buffer(#<buffer  *load*> nil "/home/sam/.emacs" nil t)  ; Reading at buffer position 228
  load-with-code-conversion("/home/sam/.emacs" "/home/sam/.emacs" t t)
  load("~/.emacs" t t)
  #[0 "\205\262

What exactly is causing this regression? Is it an error in the definition of cider-add-to-alist, or in one of that function's usages (with cider-jack-in-dependencies, cider-jack-in-dependencies-exclusions, or cider-jack-in-lein-plugins)? Or is it an error in use-package? Is there any workaround for this error that will allow me to continue using all my packages until it gets fixed?


texts: C++ mode: smartly use /*...*/ for comment-dwim

texts:
I want to adjust the behavior of comment-dwim when editing c++ files:
When a region is selected that either starts or ends in the middle of a line I would prefer /* ... */ comments. For the other cases // per line is fine.

Example:

int foo(int arg) {
    // int a = 0;
    int b = 3;
    return arg /*+ a*/ + b;
}

Can this be done?

As another reference point, QtCreator behaves the way I'm trying to describe.


texts:
At home, I use Emacs on a large monitor, and I often switch between it and the browser. Sometimes, when I come back to Emacs, I lose between 1 and 5 seconds finding where current point (the cursor) is. Here's a screenshot of what happens (can you guess where point is?):

(Note how the active windows is not that easy to find)

Is there a macro that I could launch with a key combination, that would show me very visibly and instantaneously where point is? I imagine like a big red circle appearing for half of a second over the point, or something like that.


texts: Different behavior of same function defined at two places: symbol's value as variable is void

texts:
I implemented a couple of extra functions that work with projectile and have been keeping them in my dotfiles as they are not yet a part of the original package. When the functions are defined in the file packages.el after line number 130, all lexical bindings work well.

However, when I tried extracting the two functions into a separate file here and require them somewhere down the line, it throws an error saying "Symbol’s value as variable is void: text-to-search". Apparently the closures are not getting created correctly.

(defun projectile-find-all-occurrences (&optional arg)
  "List all occurrences of the text being searched using completion.
With a prefix argument ARG prompts you for a directory on which to run search in."
  (interactive "P")
  (let* ((text-to-search (read-string
                          (projectile-prepend-project-name "Find all: ")
                          (projectile-symbol-or-selection-at-point)))
         (directory (if arg
                        (file-name-as-directory
                         (read-directory-name "Find in directory: "))
                      (projectile-project-root)))
         (file-to-search (projectile-files-with-string text-to-search directory)))
    (projectile-completing-read
     "All occurrences: "
     (reduce #'append
             (mapcar (lambda (file)
                       (with-temp-buffer
                         (insert-file-contents file)
                         (let ((lines (split-string (buffer-string) "\n")))
                           (cl-remove-if nil
                                         (mapcar (lambda (line)
                                                   (let ((present-in-linep (search text-to-search line)))
                                                     (cond (present-in-linep (concat (cadr (split-string file (projectile-project-root)))
                                                                                " => line "
                                                                                (number-to-string (1+ (cl-position line lines)))))
                                                           (t nil))))
                                                 lines)))))
                     file-to-search))
     :action `(lambda (item)
                (let ((file (car (split-string item " => line ")))
                      (line-number (string-to-number (cadr (split-string item " => line ")))))
                  (find-file (expand-file-name file ,(projectile-project-root)))
                  (beginning-of-buffer)
                  (forward-line (1- line-number))
                  (search-forward text-to-search)
                  (set-mark-command nil)
                  (search-backward text-to-search)
                  (run-hooks 'projectile-find-file-hook))))))

I have tried too many things to finally give up and cannot think of any way to make it work myself now. Seems to be that I am missing something too obvious to notice or is it...?


texts: help with regexp for compilation-mode (IAR EWARM )

texts:
I was wondering if anyone could help me figure out why the compilation-error-regexp for IAR ( compilation-error-regexp-alist-alist, in compile.el ) does not work?

The regexp is:

(iar
 "^\"\\(.*\\)\",\\([0-9]+\\)\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[0-9]+\\]:"
 1 2 nil (3))

An IAR EWARM (7.80.4) error/warning message has the following format:

c:\someFolder\someFile.cpp(18) : Error[Pe018]: expected a ")"
c:\someFolder\someFile.cpp(26) : Warning[Pe012]: parsing restarts here after previous syntax error

I have no experience with Emacs regular expressions, so any help would be greatly appreciated.

Note that the error/warning features of compile.el work for python, so it does not seem to be a configuration issue.

Emacs version: emacs-25.1.1 (x86_64-w64-mingw32)

Edit:
Thanks! That was very helpful. Using M-x re-builder I was able to use the pattern you provided to make the following expression :

"\\(^..*\\.cpp\\|^..*\\.c\\|^..*\\.hpp\\|^..*\\.h\\)(\\([0-9]+\\))\\s-+:\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[Pe0-9]+\\]:.*"

It detects the filename and line number. I am however still not able to make it work in compilation mode, as I don't quite understand the remaining arguments of compilation-error-regexp-alist-alist. The documentation states:

"Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK
HIGHLIGHT...]).  If REGEXP matches, the FILE'th subexpression
gives the file name, and the LINE'th subexpression gives the line
number.  The COLUMN'th subexpression gives the column number on
that line."

As far as I can tell the complete expression should be something like:
(iarbuild
     "\\(^..*\\.cpp\\|^..*\\.c\\|^..*\\.hpp\\|^..*\\.h\\)(\\([0-9]+\\))\\s-+:\\s-+\\(?:Error\\|Warnin\\(g\\)\\)\\[[Pe0-9]+\\]:.*" 1 2 nil)

But I can't get it to work. Any tips?


texts: What methods are available for formatting text pragmatically for an info style display?

texts:
I want to create a temporary buffer and output some formatted text into the buffer, so indentation perhaps column type layouts.

I have written some lisp code that returns a load of lists so I want to loop over the lists outputting into a temporary buffer but displayed nicely ?

Something like this perhaps, the format is not that important its more a general question asking whats available are there any useful packages etc ?

List header 1           List header 2
list 1 Item 1           list 2 Item 1
    list 1 item2        list 2 Item 2
    list 1 item3        list 2 Item 3
    list 1 item4

I know I can use (insert) and perhaps thats what you do then work out the spacing yourself in a loop ?


texts:
It is annoying to see the compilation window appear when it is successful. How to remove that automatically?

I want to see it though if it is not successful.


texts: org-publish: publish exactly files in a given list

texts:
I have hundreds Org files under a directory hierarchy and would want to export only those recently modified in HTML to speed up the process. I have the following project alist that I feed up to org-publish:
`("html"
       :base-directory        "~/Org/wiki"
       :base-extension        "org"
       :include               ,(my/org-files-to-publish)
       :with-broken-links     t
       :publishing-directory  "~/Org/wiki"
       :publishing-function   org-html-publish-to-html)

where (my/org-files-to-publish) returns recent Org files to export.
It seems that org-publish considers not only files of :include but also unconditionally those immediately under the root directory (e.g. ~/Org/wiki here).
Question: How to export exactly a list of Org files to HTML ?
As :exclude accepts only regex and not a files list, I can't find a reliable way to do what I want beside looping on (my/org-files-to-publish) using org-publish-file plus some extra stuff org-publish-projects does.
P.S. This theory is confirmed by checking the output of set-difference :test 'equal between org-publish-get-base-files PROJECT and (my/org-files-to-publish).


texts: I have my emacs in 2 by 2 configuration. When debugging, certain actions triggered the opening of another file. The newly opened file could be in a specific window pane and covers originally opened file in that pane. Is it possible to anchor or fix a buffer in a specific window pane. So whenever a new file is opened, the file in that window pane remains on top of the buf


texts: How can I make encrypted messages readable in my sent folder

texts: I'm using Mu4e to send emails.  When I encrypt a message, it is encrypted with the receiver's public key and since I don't have the corresponding private key I can't read the message.  Naturally, I want to be able to see the content of messages that I have sent to other people.  However, I don't want these messages to be stored in cleartext.  Some other MUAs encrypt the message two times: once for the receiver with his public key and once for storage in the sent folder with the senders public key.  How can I configure Emacs to replicate this behavior?


texts: How to show a list of TODO entries without timestamps?

texts:
I would like to have an agenda view that would contain all TODO entries that do not have timestamps associated with them.

From Org info i found that variables org-agenda-todo-ignore-with-date and org-agenda-todo-ignore-timestamp are provided for that purpose. However, i would like to keep original "all TODO entries in org-agenda-files" view intact.

How can i achieve that?


texts: Override org-insert-link for those that match a pattern

texts:
I often need to keep track of conversations that happen in Slack, so I wrote a small elisp package that retrieves all message info (channel, timestamps, message(s)) for a given Slack permalink.

Then I convert the data to org-element using org-element-interpret-data.

Now, I need to find a way to either override org-insert-link so whenever I want to insert a link and it happens to match a pattern, it would not insert link as is, but extracts Slack data using my method and inserts that instead.

What's the best way of doing something like this?


texts: How to let line numbers count from 1 in org subtree?

texts: When I narrow an org mode header into a subtree(using command org-narrow-to-subtree) in vanilla Emacs, the line number counts from 1 in the subtree, but when I create a subtree in Doom Emacs, the line number counts from the original line number(e.g. if the header is on the 8000th line in the original file, the header in the subtree still starts from 8000, instead of 1). How can I make it count from 1 in the subtree?


texts:
I want to list all TODO entries which have specific property value.
For example:

I have many TODO entries which are listed beneath Collage heading.
Collage heading have property CATEGORY set to school.
There are multiple headers with corresponding value of CATEGORY property in single org file.

I currently know of two useful org-mode functionalities which could help here.

I can make a sparse tree of all collage headings using M-x org-sparse-tree p CATEGORY collage.
Also know how to make list of all TODO entries using M-x org-agenda t.

How to combine those two?
Or how to do it more elegant way?


texts: How to activate AUCTeX support for beamer without preamble?

texts:
Usually, AUCTeX activates beamer-specific settings (e.g. syntax highlighting)   depending on \documentclass. In my LaTeX templates, however, I have separated the preamble from the rest of the document using \input{beamer-preamble}.

Here's an MWE:

\input{beamer-preamble}  % `beamer-preamble.tex` only contains `\documentclass{beamer}`
\begin{document}

\title{Some title}

\begin{frame}
\frametitle{Some frame title}
\end{frame}

\end{document}

In this example, the argument of \frametitle should be highlighted similarly to the argument of \title.

How can I tell AUCTeX to still apply the beamer-specific settings?


texts:
This is pretty simple but it's thwarting me:

this is how a switch statement indents in js2-mode

  switch(letterGrade){
  case "A+":
    value = 100  ; break;
  case "A":
    value = 97 ; break;

this is how I want it to indent:

  switch(letterGrade){
    case "A+":
      value = 100  ; break;
    case "A":
      value = 97 ; break;

How can I make that happen? And, as a side question, why doesn't js2-mode use the same indenting stuff as other C-like languages?


texts: Advantages of setting variables with setq instead of custom.el?

texts:
I see a lot of people (extension authors and others) give configuration examples with setq:

(setq foo 'bar)

These parameters are often defined with defcustom, making them available for customization through custom.el.

I typically use custom.el to set them. Would there be any advantage to using setq instead or are the two methods roughly equivalent?


texts:
I want to install the php-mode on my windows 7 machine. I went through documentation of the cited website and there is no mention of what should be extra required to run this mode. Obviously, the PHP interpreter and some server, I would like to use MySQL as well. So what is the best setup to have them all (please cite the download websites where necessary). I know there are all-in-one installers for Windows like XAMPP, but what other workflows and alternatives are there other than that? What is recommended with regards to an effective Emacs ecosystem? I am just unaware of the possibilities.

What is special about installation of this mode in Windows apart from:

require ('php-mode)

in the dot emacs file?

I want also to indent an HTML content inside a PHP construct. I mean indentation of something similar to the MWE below:

MWE -- page.php inside templates folder

<?php
return "<!DOCTYPE html>
<html>
<head>
    <title>$pageData->title</title>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8'/>
  </head>
  <body>
    $pageData->content
  </body>
</html>";
?>

It might be helpful to share part of the dot emacs file code related only to php-mode. Thanks.

Notes

I added the c:\xampp\php\php.exe to PATH variables but when I press C-c C-r of php code it throws this error: php-send-region: Searching for program: no such file or directory, php

Update
There was a bug and thankfully fixed by the developer: https://github.com/ejmr/php-mode/issues/228#issuecomment-77057035. Now, after applying the fix in the source and setting the PATH variable correctly in Windows to c:\xampp\php instead of c:\xampp\php\php.exe, C-c C-r is generating the *PHP* buffer.

Question
How to show the output of PHP code from the *PHP* buffer? What is the workflow to show the output in whatever browser available?


texts: How to add branch label next to projectile string with smart-mode-line

texts:
This is something I asked on the official repository.

By default, smart-mode-line displays the current projectile project-name before the buffer-name, and the vc-mode string after it:

... [P/myproject]BUFFER-NAME :master ...

I would like to combine the project name and the branch together, and
display them both before the buffer-name.
Here is what I want to achieve:

... [myproject:master]BUFFER-NAME ...


texts: gud: highlight breakpoints with custom debugger

texts:
I use go-dlv to debug Go programs. This package is very simple and relies on standard gud functionality (https://github.com/benma/go-dlv.el/blob/master/go-dlv.el)

One thing that I found missing is highlighting of breakpoints.

Is there any easy way to customize GUD to enable this feature? If not I would appreciate any advice how to implement it. I am fairly new to customizing emacs and do not know where to start. Thanks in advance.


texts: How to get human language-specific numerals?

texts:
TL;DR: how can I use Hindi digits (١٢٣...) when writing in Arabic?

Emacs is arguably hailed as the best editor, but when it comes to using numerals in the context of writing there are no satisfactory solutions to this problem for multilingual users compared to that afforded by Microsoft Word, namely the contextual numeral writing.

In Microsoft Word 2010 go to drop down menu --> More Commands --> Advanced --> under show document content you can select context for Numeral out of (Arabic or Hindi or Context or System). The context option allows you write numerals according to the context of your writing if it were English numerals would be Arabic 1,2,3,4,5,6,7,8,9,0 -- sounds strange! but it is so named (a misnomer maybe), and if you write in Arabic then numerals will be Hindi numerals, written like this:

For Windows, I found that changing the input-method while writing is the way to go if I am to write a multilingual document in Emacs say English and Arabic or any other language with a totally different alphabet. Changing language or keyboard layout from the language bar in Windows IMHO won't give you the same effect since that will destroy all of your key bindings of your Emacs editor (especially in case of two different languages like English and Arabic). The solution is posted here.

In Microsoft Word, after setting numerals to context you can seamlessly write English with Arabic numerals, and when you shift to write in Arabic by cycling through (ALT+R SHFT) you will write Arabic text with Hindi numerals in no time as shown in the image below. In Emacs after shifting the input-method to Arabic language, numerals will still be Arabic (1,2,3,etc) and not the desired Hindi numerals.

I don't think solution to this problems is related to Microsoft Windows as changing the language of regional settings will change the numerals of the Windows interface as well and will be system-wide undesired effect.

I do believe that the extension potential of Emacs holds the key to this problem. To be more specific; I suggest Emacs should detect the input-method and if it is in Arabic it should automatically remap all Arabic digits into Hindi ones.  OR somehow customizing the Arabic keyboard layout to have Hindi instead of Arabic numerals.

Listed blow are some related posts to this problem but I couldn't translate these bits of info into an actual solution suitable to the specifics of this post:

https://tex.stackexchange.com/q/191040/26295

Below is an approach to extend the input-method in Emacs.
https://emacs.stackexchange.com/a/3404/2443

Typing Hindi numerals can be a tedious task in Emacs if you want to enter the Hindi digits one at a time C-x 8 RET these are mapped in Unicode to the following codes: 0661 for number 1, 0662 for number 2, 0663 for number 3, 0664 for number 4, 0665 for number 5 and so on.

Question
What is the best customization to Emacs 24 and shortest keystrokes in order to replicate the seamless contextual writing experience provided by Microsoft Word?


texts: Cannot edit a file as root if ~/.authinfo.gpg file exists

texts:
I got ~/.authinfo.gpg to store my multiple email accounts for gnus, but if ~/.authinfo.gpg exists, the tramp won't work. It will always say:

Decrypting /home/chz/.authinfo.gpg...done

Emacs won't even load the file into Emacs. If I remove that file, the tramp will work fine and gnus will not work as I want.

The tramp configuration is like this page or this page(I've tried several versions, defun, defadvice, etc.), and the ~/.authinfo.gpg file contains lines of my emails accounts and machine localhost port sudo login root password my-password suggested by this page to edit file as root.

Even I don't use the tramp configuration mentioned above, just use C-x C-f /sudo::/etc/hosts, after I finished typing the second :, Decrypting /home/chz/.authinfo.gpg...done will automatically exist in minibuffer and stuck  Emacs, then I have to C-g...

So how can I use edit-as-root and gnus at the same time?

Can I use other ways other than ~/.authinfo.gpg to store account info for my multiple emails accounts so edit-as-root will work too?

===============================================

Update:

After testing my init.el piece by piece, it turned out that the which-function-mode and projectile don't work with tramp very well, I have to disable them when using tramp.


texts: Display emacs shortcuts inside emacs, like conky

texts:
Have you ever used conky? More precisely Crunchbang Linux? Crunchbang comes with conky installed by default on desktop and inside conky you'll see  useful shortcuts that you can use, and it's visible all the time. See shortcut keys section.

I'm an emacs newbie, not new to emacs, I use it all the time when doing lisp but I  don't do lisp that much, I spend most of the time using sublime.

So still emacs newbie and would be helpful if I can have such menu displayed all the time in a little corner inside the text editor. It should take no more than 10% of the screen or so.

Is there such  plugin or option allowing me to display the shortcuts?


texts: How to copy killed rectangle to the kill ring

texts:
I frequently extract a rectangle of text from a buffer, but then find I want to yank the text as if it was not a rectangle.  Is there a way to add the current killed rectangle to the kill ring?

The GNU Emacs Manual has this to say:

  “Killing” a rectangle is not killing in the usual sense; the rectangle
  is not stored in the kill ring, but in a special place that only
  records the most recent rectangle killed. This is because yanking a
  rectangle is so different from yanking linear text that different yank
  commands have to be used. Yank-popping is not defined for rectangles.

However, I can basically get the behavior I want with

M->     go to end of buffer
C-x r y yank rectangle
C-x C-x exchange point and mark (selects newly-yanked lines)
C-w     kill the selection to the kill ring

Is there a better way to turn a killed rectangle into a kill-ring entry?


texts: in org capture the clipboard expansion (%x) does not work with daemon?

texts:
I have this org capture template saved in a tpl-quote.txt file:

* a title
  :PROPERTIES:
  :TIME: %U
  :END:

%x  ;; contents in clipboard

And the org-capture-templates is

  (setq org-capture-templates
  (quote (("p" "Private Templates")
          ("pc" "Clipboard"
           entry
           (file+olp+datetree "~/Notebooks/org/default.org" "Capture")
           (file "~/Notebooks/org/tpl-quote.txt")
           :immediate-finish t))))

This worked alright in GUI Emacs.

If I start a GUI Emacs, run M-x server-start, then in a terminal run

emacsclient -ne '(org-capture nil "pc")'

it also worked Ok.

But if I start Emacs daemon emacs --daemon, then run the above emacsclient command I got the following error at my terminal:

*ERROR*: Capture abort: (wrong-type-argument char-or-string-p nil)

So it seems that the clipboard expansion %x is only working with GUI Emacs, deleting the %x it works again.

Is this the expected behavior?

My setup:

OS: Manjaro Linux
Emacs: 26.3
Org-mode: 9.1.9


texts:
I can not figure out why does when I factored out function it started to work wrong.
Here's the my function to kill all dired buffers, its bound to dired-mode-map that work as expected and successfully kill all dired buffers when I invoke it in dired buffer:

(defun sandric/dired-kill-buffers ()
  (interactive)
  (mapc (lambda (buffer)
          (when (eq 'dired-mode (buffer-local-value 'major-mode buffer))
            (kill-buffer buffer)))
        (buffer-list)))

I decided to factor out a function to kill all buffers by major mode name:

(defun sandric/kill-buffers-by-major-mode (mode-name)
  "Kill open buffers by major mode name"
  (interactive)
  (mapc (lambda (buffer)
          (when (eq mode-name (buffer-local-value 'major-mode buffer))
            (kill-buffer buffer)))
        (buffer-list)))

(defun sandric/dired-kill-buffers ()
  (interactive)
  (sandric/kill-buffers-by-major-mode 'dired-mode))

And now it works wrongly - it kills only current dired buffer and not killing parent ones. I can not understand why - it looks like nested function get bounded to current buffer and stops executing after it gets killed. Can anyone explain me why is it so and how to fix it?


texts:
Below's a SSCCE

I have a dead simple org-mode document and I hit C-c C-e to access the export dispatcher. Sure enough I can see the options and am prompted with the message Export buffer:

After hitting h (for "export as HTML") I see the below message in my Emacs:

Symbol's value as variable is void: f

.. as shown below:

The debug trace is:

Same debug trace as plain text:

Debugger entered--Lisp error: (void-variable f)
(setq org-hide-emphasis-markers f)
my-org-mode-hook()
run-hooks(change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook)
apply(run-hooks (change-major-mode-after-body-hook text-mode-hook outline-mode-hook org-mode-hook))
run-mode-hooks(org-mode-hook)
org-mode()
org-export-preprocess-string(#("* heading 1\n  blah blah blah ...\n*   heading 2\n  blah blah blah ...\n" 0 2 (fontified t face org-level-1) 2 11 (fontified t face org-level-1) 11 33 (fontified t) 33 35 (fontified t face org-level-1) 35 44 (fontified t face org-level-1) 4$
org-export-as-html(nil)
call-interactively(org-export-as-html)
org-export(nil)
call-interactively(org-export nil nil)

My org-version is:

Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @ /usr/share/emacs/24.3/lisp/org/)

And my emacs-version:

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7) of 2014-03-07 on lamiak, modified by Debian


texts: Revert-without-query, regex pattern error

texts:
(setq revert-without-query '("\*"))

I have set this to avoid emacs' yes/no prompt when i revert a buffer and discard its changes. But, still the prompt keeps coming.

Other regex patterns, i tried with no success,

(setq revert-without-query '("*"))
(setq revert-without-query '("\\*"))

The doc, heresays, set the variable revert-without-query to a list of regular expressions.


texts: Debugging Tab command in emacs, js2-mode

texts:
Tab press in js2-mode goes to

indent-for-tab-command

in indent.el.
This command takes a prefix argument as arg. Since no prefix arguments are set by C-u, what gets passed here?
And internally, indent-for-tab-command calls insert-tab, this calculates the variable count as,

(prefix-numeric-value arg)

and then does,

(insert-char ?\t count)

So, where is the js2-mode group variable, js2-indent-level taken into consideration for calculating the number of space chars?


texts: Gnus - Save several articles in a single file

texts:
I want to be able to select a number of articles and save them all in a single text file. I know about o (gnus-summary-save-article) and variants of this command, however as I understand it saves the current article.

What are my options?


texts: Configure.ac options when building from source

texts:
Disclaimer: newbie to emacs, vaguely competent on MacOS and git.

I'm building emacs on OSX Yosemite from the git master repo.  I've done this several times, primarily by using

./configure --with-ns --with-imagemagick --with-rsvg --with gnutls

with greater or lesser degrees of success, depending on current state of master.

However, I derived this config from lunaryorn's excellent discussion of emacs on MacOS without really understanding what I'm doing.

I decide to take a look today at the configure.ac file to find out what compile options are actually available.  The relevant bits seem to be these:

OPTION_DEFAULT_ON([xpm],[don't compile with XPM image support])
   OPTION_DEFAULT_ON([jpeg],[don't compile with JPEG image support])
   OPTION_DEFAULT_ON([tiff],[don't compile with TIFF image support])
   OPTION_DEFAULT_ON([gif],[don't compile with GIF image support])
   OPTION_DEFAULT_ON([png],[don't compile with PNG image support])
   OPTION_DEFAULT_ON([rsvg],[don't compile with SVG image support])
   OPTION_DEFAULT_ON([xml2],[don't compile with XML parsing support])
   OPTION_DEFAULT_ON([imagemagick],[don't compile with ImageMagick image support])

OPTION_DEFAULT_ON([xft],[don't use XFT for anti aliased fonts])
   OPTION_DEFAULT_ON([libotf],[don't use libotf for OpenType font support])
   OPTION_DEFAULT_ON([m17n-flt],[don't use m17n-flt for text shaping])

OPTION_DEFAULT_ON([toolkit-scroll-bars],[don't use Motif or Xaw3d scroll bars])
   OPTION_DEFAULT_ON([xaw3d],[don't use Xaw3d])
   OPTION_DEFAULT_ON([xim],[don't use X11 XIM])
   OPTION_DEFAULT_OFF([ns],[use NeXTstep (Cocoa or GNUstep) windowing system])
   OPTION_DEFAULT_OFF([w32], [use native MS Windows GUI in a Cygwin build])

OPTION_DEFAULT_ON([gpm],[don't use -lgpm for mouse support on a GNU/Linux console])
   OPTION_DEFAULT_ON([dbus],[don't compile with D-Bus support])
   OPTION_DEFAULT_ON([gconf],[don't compile with GConf support])
   OPTION_DEFAULT_ON([gsettings],[don't compile with GSettings support])
   OPTION_DEFAULT_ON([selinux],[don't compile with SELinux support])
   OPTION_DEFAULT_ON([gnutls],[don't use -lgnutls for SSL/TLS support])
   OPTION_DEFAULT_ON([zlib],[don't compile with zlib decompression support])

From what I can tell, it seems that imagemagick et al are already being built by default, so I only really need to use the --with-ns flag.

Is that correct?
If so, are there any of these default_ON settings that I can turn off as not relevant (such as the X-related ones?)?
In regards to lunaryorn's config mentioned above, would I need to use those options for a brew install version of emacs?
Finally, any other tips on building from source?


texts: Electric indent not indenting closing brace in perl-mode

texts:
Starting with emacs -Q, I open a C file a.c and a Perl file a.pl.  I turn on electric-pair-mode and electric-indent-mode in each.

In a.c, I enter the following, where the | shows the cursor position:

int foo() {
    if (bar) {|}
}

I press Enter and get:

int foo() {
    if (bar) {
        |
    }
}

Well and good.  But in the Perl file, I start with:

sub foo {
    if (bar) {|}
}

Then I press Enter and get:

sub foo {
    if (bar) {
        |
}
}

No matter the level of indentation, the closing brace is placed at the beginning of the line it's on.

I could hack my way around this irritation, but is there a simple way to get the same indenting behavior in perl-mode that I see in c-mode?


texts: How can I add a custom action to helm-for-files? The helm wiki mentions that executing eshell commands is an available action for helm-find-files. So, if you are using helm-find-files, one way of creating custom actions is to create an eshell command. However, helm-for-files doesn't have it in the list of supported actions.


texts: Format links or dates context sensitive in org-mode headings?

texts:
In org-mode I use headings with different font sizes decreasing with the # in  org-level-#.
In the following Examples, the font size is in brackets and size 5 > size 4 etc.
Example:
* Heading lvl 1 (size 5)
** Heading lvl 2 (size 4)

Links or a timestamps are both size 1 in default text. Now when I add one to those headings it looks like this:
* Heading lvl 1 (size 5)

* Heading lvl 1 (size 5) [[with link]] (size 1)
** Heading lvl 2 (size 4) [[with link]] (size 1)

* Heading lvl 1 (size 5) <with timestamp> (size 1)
** Heading lvl 1 (size 4) <with timestamp> (size 1)

I would like the keywords to change colors or font, but keep the size of the current heading-faces:
* Heading lvl 1 (size 5) [[with link]] (size 5)
** Heading lvl 2 (size 4) [[with link]] (size 4)


texts: Unable to send email through my second account

texts:
I have set up email in emacs using mu4e for both my personal and university account (both use gmail).

However I am unable to send email from my university account. Personal account works totally fine. When I try to send a mail from my uni account I get a wrong type argument error. Here's the backtrace:

Debugger entered--Lisp error: (wrong-type-argument characterp lambda)
  smtpmail-try-auth-method(#<process smtpmail> plain "university@uni.edu" (lambda (&rest --cl-rest--) (apply (quote #[(G4 G5) "J\203    \211J   J!L\210)    J\207" [G4 G5 v] 4]) (quote --token-decoder--) (quote --lexv--) --cl-rest--)))
  smtpmail-try-auth-methods(#<process smtpmail> (enhancedstatuscodes (auth login plain xoauth2 plain-clienttoken oauthbearer xoauth) 8bitmime (size \35882577)) "smtp.gmail.com" 587 nil)
  smtpmail-via-smtp(("personal@gmail.com") #<buffer  smtpmail temp>)
  smtpmail-send-it()
  message-multi-smtp-send-mail()
  message-send-mail(nil)
  message-send-via-mail(nil)
  message-send(nil)
  message-send-and-exit(nil)
  funcall-interactively(message-send-and-exit nil)
  call-interactively(message-send-and-exit nil nil)
  command-execute(message-send-and-exit)

Relevant configs:

...
(setq mu4e-contexts
        `(,(make-mu4e-context
            :name "me"
            :match-func
            (lambda (msg) (when msg
                            (string-prefix-p "/Gmail" (mu4e-message-field msg :maildir))))
            :vars `((user-mail-address . "personal@gmail.com")
                    (smtpmail-smtp-user . "personal@gmail.com")
                    (user-full-name . "Atharva Raykar")
                    (mu4e-trash-folder . "/gmail/[Gmail]/Trash")
                    (mu4e-drafts-folder . "/gmail/[Gmail]/Drafts")
                    (mu4e-sent-folder . "/gmail/[Gmail].Sent Mail")
                    (mu4e-refile-folder . "/gmail/[Gmail]/Archive")))

          ,(make-mu4e-context
            :name "uni"
            :match-func
            (lambda (msg) (when msg
                            (string-prefix-p "/uni" (mu4e-message-field msg :maildir))))
            :vars `((user-mail-address . "university@uni.edu")
                    (smtpmail-smtp-user . "university@uni.edu")
                    (user-full-name . "University")
                    (mu4e-trash-folder . "/uni/[uni]/Trash")
                    (mu4e-drafts-folder . "/uni/[uni]/Drafts")
                    (mu4e-sent-folder . "/uni/[uni].Sent Mail")
                    (mu4e-refile-folder . "/uni/[uni]/Archive")))))

(use-package smtpmail
  :ensure t
  :config
  (setq message-send-mail-function 'smtpmail-send-it
        starttls-use-gnutls t
        smtpmail-debug-info t
        smtpmail-default-smtp-server "smtp.gmail.com"
        smtpmail-smtp-server "smtp.gmail.com"
        smtpmail-smtp-service 587)
  ;; don't keep message buffers around
  (setq message-kill-buffer-on-exit t))

My ~/.authinfo:

machine smtp.gmail.com login personal@gmail.com port 587 password <personalpassword>
machine smtp.gmail.com login university@uni.edu port 587 password <unipassword>

From what I can tell smtp is taking a lambda instead of a character, but I have not found anything in my config that could possibly lead to that.

Any help would be appreciated.


texts:
I use diff-hl to highlight changed lines. However it doesn't play well in terminal mode. I know that terminal Emacs doesn't support fringes, and it is better to use diff-hl-margin-mode instead, it works in terminal but margins are awful with linum.

GUI diff-hl-margin-mode:

...and the same situation in terminal. I tried nlinum instead, but with no luck. And also, i tried git-gutter, but couldn't get live update to work, btw it uses margins to mark changed lines and it looks like on screenshot.

How do you handle this? Any advice?


texts:
When I press C-x C-b I get ibuffer (installed as part of prelude I think)

I like to press backtick and get the Filename/Process displayed.
Another SE answer helped me with that. (ibuffer hide columns)

I have about a dozen files open, but my work happens in a deeply nested directory. So my ibuffer display is overflowing with all the parent folders information

~/Work/Project/subjproject/submodule/foo/baa/etc/something/the_file_im_editing.pl

Nowadays I'm exclusively working inside the ~/Work/Project/subjproject/submodule/ folder. So I buffer don't need to tell me that. It's wasted space to display that.

What can I do about this?


texts: How can I visualize trailing whitespace like this?

texts: I've tried to configure whitespace-mode to do what I want but with no luck. I'm trying to achieve the following (see image).


texts: Pretty print s expressions from the command line

texts:
I've got a file containing an emacs s-expression and I want to pretty print it from the command line: Is there an easy way of doing this? Paranoia suggests I want to do as little parsing of this data as possible

Context (stack exchange loves context...): I'm doing some processing or org file data externally in a python process. I'm pushing out s-expressions and parsing them in python (with sexpdata) because this is easier than munging stuff into json in emacs.

I'm considering coding up my own parser, or using sexpdata to parse it, or trying to use emacsclient -exec or similar.


texts:
There is the hook variable window-scroll-functions for functions to be called before redisplay after vertical scrolling.

Is there a similar variable for horizontal scrolling?


texts: Why does `next-error` change my buffer as keyboard macro, but not in lisp code?

texts:
My goal is to use grep to find other Org files, use next-error to switch to those files, copy the link to the grep match, then go back and paste that link.
It worked for a long time as a macro, but when it finally broke I decided to write it as a proper function. But the buffer-switches that worked as macro don't seem to be working as a function. Why?
;; Can't use `with-current-buffer' because it's used in `next-error'
(let ((thisbuf  (current-buffer)))
  ;; Unless interactive, this doesn't change `current-buffer', at least not in time for `org-store-link'
  (next-error)
  ;; Message says thisbuf, not the one `next-error' takes me to
  (message (concat "Current buffer: " (current-buffer)))
  ;; Why does it store my link in `thisbuf' instead of the buffer `next-error' goes to?
  (org-store-link nil 1)
  (switch-to-buffer thisbuf))


texts: Behaviour of frame-pixel-width function during Emacs loading

texts:
My goal is to resize Emacs frame on start to make its width 120 chars and center the frame. To compute offset i'm using this:

(let* ((width-left (- (x-display-pixel-width)
                      (frame-pixel-width)))
       (frame-left-offest (/ width-left 2)))
 (add-to-list 'default-frame-alist (cons 'left frame-left-offest)))

The problem is that (frame-pixel-width) during the app launch gives me one width and when the app has started it gives me another width (the proper one, which i need). So the result is wrong. I'm not sure why that happens and what's the proper way to do it.


texts: How to setup tramp mode through a linux gateway and hardware authentication?

texts:
I don't have direct access to my remote machine at work.
Normally I login with the following commands

(local)$ ssh id@gateway
Yubikey prompt (physically push a button on the yubikey)
PW prompt:
(gateway)$ (custom login command)
PW prompt:
(gateway)$ rlogin id@remote
(remote)$ access!

I've gone through the tramp examples for multi-hop ssh connections. however

There were no mention of how to setup tramp with a physical
authentication device
No mention of how to issue a command on the
gateway

Is there a way to tunnel through this in tramp-mode?


texts: Font spacing is very wide with Triplicate

texts:
I'm trying to test out a new font called Triplicate. When I try to use it each character is vary wide, like within a square, shown in 1. Setting variable-pitch-mode doesn't change anything. I've not seen this problem with other fonts, and it does not have such wide spacing outside of Emacs, like in Abiword. It also looks good in OS X with the same Emacs configuration. Changing the width setting to condensed/compressed/normal/supercondensed/etc doesn't change the width at all.

I'm on Arch Linux, Emacs 25.4.1.


texts:
Is there an easy way to search for other occurences of a selected rectangle, regardless of the column at which the pattern starts?

As an example, when searching for the 4x2 text block in lines 1+2 in the sample below, it would result in two matches: one for lines 4+5, one for lines 7+8

1 qwer
2 asdf
3
4   qwer
5   asdf
6
7     qwer
8     asdf


texts: Painfully simple org spreadsheet question

texts:
I am an English teacher who is profoundly not good at math, but I want to make some simple calculations with an org-mode table. I've tried reading online, but am afraid the explanations are just not simple enough.

With the following table, what formula would I put in the final boxes to calculate the average grade for "draft" and the average grade for "final"? (That is, to calculate the mean of column 2 and the mean of column 3.)

| item    | draft | final|
|---------+-------+------|
| plot    |   2   |   3  |
| grammar |   3   |   4  |
|---------+-------+------|
| grade   |   ?   |   ?  |

Will the table recalculate with C-c * if I change one of the grades?

Thank you,
steven arntson


texts: where to find a list of all the builtin functions that have been implemented in C?

texts: Is there a list somewhere or a command that can be run to output all the functions that have been implemented in C?


texts: Enable whitespace-mode with Prelude in C++-mode

texts:
With a vanilla install of Prelude and with C++-mode as my major mode, M-x whitespace-mode no longer shows whitespace characters. I get a message indicating that I am toggling whitespace-mode on and off but no whitespace is shown.

Has:

M-x whitespace-mode

Want:

M-x whitespace-mode

The prelude documentation actually says that it enables whitespace-mode.

https://github.com/bbatsov/prelude#disabling-whitespace-mode

How can I fix this or how can I debug this?

Prelude sets a bunch of minor modes. I turned off the ones that I could guess the "...-mode" function for but that didn't help. I don't know how to toggle most of these or even how to figure out how to toggle them.