texts: CSS to export org to printable(A4papers) HTML with headers

texts:
I export org buffers to A4paper size pdf with header and footer customized as my letterhead using xelatex. It requires latex to be installed on each machine.
Is it possible to achieve the same using css ? I do not know HTML. Will anybody provide the template of css customised to produce a4 size output with proper margins and header containing a logo ?
Regards


texts: How to modify a buffer without undo noticing?

texts:
Q: How do I insert/modify text in a buffer without undo noticing?

Here's the use case.  I have a comment block at the start of every file that, among other things, updates a timestamp for the most recent change to a file.  I'd like to be able to modify that timestamp without the undo facilities noticing it.

The reason I want to short-circuit undo here is due to the following edge case, which comes up when editing/compiling LaTeX documents (and probably others, but this is the one that drives me nuts most frequently):

Make a small change to the file to see how it will affect the compiled doc
Save the file (which updates the timestamp)
Run latex on the file
Decide that the change is a bad one
undo the changes

The problem at step (5) (undo) is that it does not undo the change made in step (1), but rather undoes the timestamp updating in step (2).  That wouldn't bother me (I could just undo again) except that it also moves point all the way to the timestamp at the top of the file, which is almost always many, many lines away from the actual substantive change.  It's very jarring and completely breaks my concentration.

I'm pitching the question with respect to a file I'm visiting, but it's more generally about modifying buffers.

So: how can I prevent undo from noticing a specific modification to a buffer?


texts: Links inside org-mode tables are not typeset in monospaced font

texts:
While the default is a proportional font, I told org-mode to use a monospaced font in tables:

(add-hook 'org-mode-hook (lambda () (variable-pitch-mode t)))
(with-eval-after-load 'org
  (set-face-attribute 'org-table nil :inherit 'fixed-pitch))

Yet for some reason this does not affect links inside tables, which then screw up the alignment (Emacs 24.5, Org-mode  8.2.10):

What could be the reason for this and how can I fix it?


texts: print unquoted output to stdout from emacsclient

texts:
I want to use emacsclient to let my running instance of emacs evaluate a function and print the result to a terminal.

That is, I want to do something like this:

  $ emacsclient --eval "(frame-parameter (car (frame-list)) 'name)"
  *info*

However, instead, I get output like this:

  "*info*"

If I use message, the output is displayed in some frame's minibuffer and I still get quoted output ("*info*" instead of *info*).

How do I get princ-like output to be output to my emacsclient terminal?


texts:
What I tried:

Cloned a package with ert tests (https://github.com/dgutov/robe )
# sidenote this package was previously installed using use-package
emacs ~/robe/core-tests.el
M-x ert

  Selector: t Passed:  0 Failed:  0 Skipped: 0 Total:   0/0 Started at:
  2019-11-10 12:31:14-0800 Finished. Finished at:  2019-11-10
  12:31:14-0800

This feels wrong because obviously the package has more than 0 tests.

Also btw: how do I run tests in "emacs -batch" mode.


texts: Yasnippet stops compile error highlighting

texts:
I have been compiling my C++ project using M-x compile which I like because it provides highlighted links to my errors:

However after adding:

(add-to-list 'load-path
         "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)

to my .emacs file this no longer works:

I'd really like to use yasnippet and have my compile errors highlighted, anyone have any idea how to fix this? I'm using GNU Emacs 24.3.1


texts:
I have the following snippet

/* ----------------------------------------------------
* METHOD ${1:$$(upcase yas-text)}.
* ---------------------------------------------------- */
public function f$1($2) {
    $3
}

My problem is that the mirror starts on METHOD, instead on public
function. So the upcase characters inside the function name, that I type in
METHOD will not being mirrored to the line with public function.

How could I configure the snippet to type on the line with public function,
while being mirrored in the line with METHOD?


texts: Emacs 24.5.1 on Windows: How to use server mode?

texts:
I used to have Emacs 25.xx on my windows pc and was very happy with the daemon/server mode of emacs. Emacs started via batch-script on startup and everything worked fine -- on every subsequent call Emacs just started instantly. Just as it should. :-)

However, due to scrolling problems in AucTeX I went back to 24.5.1. Now Emacs doesn't start in server mode.

I found http://wikemacs.org/wiki/Emacs_server and it says at the bottom that on Microsoft Windows you need to have at least Emacs version 25 to use the server mode.

Is this just outdated information? Is there really no way to run Emacs 24 in server mode on Windows? Has anyone of you experience with running Emacs in server mode on Windows?

If that's important: I use Windows 10. Thanks in advance for any input on that topic.


texts: How to Visualize Transfer Rate In TRAMP Mode File Transfer

texts:
Any idea on how could be enabled a progress bar and/or speed rate metter on TRAMP mode file transfer?

Trying to manage TRAMP transfer mode via scp instead of ssh to seek avoidance base64 conversion, but due low internet speed don't know if it's stuck or just slow.


texts: How can I determine if a `git` branch is a remote-tracking branch using Magit?

texts:
Is there a function magit-magic such that

(magit-magic "master") => t
(magit-magic "origin/master") => nil

assuming origin/master is a fetched, but possibly unpulled branch on remote origin? (Sorry, I don't know the proper git terminology -- which is probably why I'm having trouble finding an answer on my own.)


texts: Use a variable to determine let bindings

texts:
Is there a way to use a variable to hold the set of let bindings for passing to a later call?

For example

(setq a '((org-export-with-toc nil)
          (blah 2)))

Then

(let-wrapper a
  ;; Perform the export here)

This is for the goal of allowing outorg-export to add an options alist specifying how to export the indicated element.

Editing to provide clarity (@sds's answer of using cl-progv is what I needed):

I want to be able to pass a variable/alist of values as part of an 'export definition' to the org-export engine.

If NIL, nothing will be exported.  Otherwise it must be a list of
entries for sections to be exported and exporter to use.  Each entry
is a list like this:

    (headline &optional exporter file level options)

headline     Outshine commented headline to export from.  If t,
             defaults to entire file.
exporter     Org exporter format to use when exporting.  If not
             specified (blank, t or nil), defaults to an Org
             file.  This is a symbol for the exporter to use.  If
             exporting to PDF, specify `PDF' rather than `LATEX'
             otherwise it will be exported as a `.tex' file.
file         If set, specifies the export file name.  If `T', defaults
             to the name of the exported buffer.  If `NIL', defaults
             to the name of the headline being exported if specified,
             or buffer file name if entire buffer is exported.
level        By default `SECTION' will search for top level headlines
             `* '.  Level allows for exporting specific sublevels
             instead.  This integer indicates how many stars to match.
options      List of export variables to be set prior to export.
             These values are provided as a let binding around the
             export process.

An example command would be ("Documentation" ascii t 1 ((org-export-with-toc nil)))

In the export command itself each value is let bound to the appropriate field, and then in the end org-ascii-export-to-ascii performs the export (replace ascii as specified).  I'd tried using :EXPORT_OPTIONS: properties but they were not being recognized when converting to outorg and exporting, and #+OPTIONS: were not either.  Instead (also allowing different options based on export format, or even multiple exports to the same format with different options) I want to use the options value as a set of let-bindings around the export process to allow it to be modified.


texts:
I have been using emacs for a long time in windows.
(windows 10 on an HP laptop PC)  My .emacs file is in c:.emacs.

Up until yesterday, the file was run whenever I started up emacs.
But yesterday it failed to run, so I have to manually run it.

The .emacs (and _emacs) file is visible within emacs when I do a directory listing of c:

-rw-rw-rw-  1 Ray Voith        None           6670 2014-06-14  .emacs

-rw-rw-rw-  1 Ray Voith        None           6605 2014-06-14  _emacs

but is not visible within cygwin in directory /cygdrive/c
I tried chmod 777 .emacs (also chmod 777 _emacs) within cygwin but it says

$ chmod 777 _emacs

chmod: changing permissions of ‘_emacs’: Permission denied

Ray Voith@laptop /cygdrive/c

$ chmod 777 .emacs

chmod: cannot access ‘.emacs’: No such file or directory

I have not intentionally done anything to the .emacs file.

Does anyone know why emacs would all of a sudden stop executing .emacs?


texts: Aquamacs for macOS Mojave and Catalina - error in process filter: ‘recenter’ing a window that does not display current-buffer. How can I fix this bug?

texts:
I'm a very new Mac user and not really an Emacs user. I just use emacs to run PVS Specification and Verification System, by typing the pvs command in the terminal to start the software.

Aquamacs was working properly but suddenly it started to get stuck when running some .pvs files (not all), including some that were working normally before. I'm receiving the following message:

"error in process filter: ‘recenter’ing a window that does not display current-buffer".

The Aquamacs windows freeze, and I just can force it to ends by using the Mac tool or closing the terminal. My Mac was running macOS Mojave when the error started, but after I updated to Catalina the bug continued.

As I'm a new Mac user a beginner in Emacs, I really appreciate any help to fix this.


texts:
I've found that using the highlight-symbol-mode provided by highlight-symbol works very nicely for highlighting all occurrences of the symbol at point, automatically (without my pressing anything). However, I would like to highlight all other occurrences of the symbol at point: that is, the actual symbol point is on should not be highlighted.

I can't find anything in customize-group highlight-symbol or in highlight-symbol.el for this. Through Google, I haven't found any reference to other packages that support the functionality I want.

How can I get automatic highlighting of all other occurrences of the symbol at point?


texts:
I am try spacemacs. It can correctly recognise a coffee script and start coffeescript mode. However when I try to run coffee REPL, it shows this error:

How can I fix it?


texts:
I use a pretty basic notes file that has headers like:

* Next Actions
** action 1
** action 2
* Deferred
** deferred 1
** deferred 2
etc.

I rarely use tags or todo states on the elements of my lists. So far I've only come across ways to create custom Agenda views by filtering the tags or todo states; I haven't found any info on filtering through headers instead.

Is this possible or is it not built-in into org-mode? I'm quite comfortable in lisp as I do all my coding (hobbyist) in Common Lisp but I'm not that familiar with eLisp.


texts: I've seen ;;; -*- lexical-binding: t; -*- at the top of a file and (setq lexical-binding t) as how to turn on lexical binding for elisp code, but is there a way to tell Emacs to simply always do lexical binding, i.e., in your init file? From what I've seen, my guess would be it's a buffer-only option. Also, how can lexical binding be turned on in an org file? Does each babel emacs lisp code block have to specify (setq lexical-binding t)? BTW, putting ;;; -*- lexical-binding: t; -*- is not dealt with well on an export to HTML, etc. Using version 26.1.


texts: Skeletons: Run-time conditional skeleton elements?

texts:
I want to use Emacs skeletons to conditionally insert dynamic context-dependent text.  As an example, if inserted after a Ruby class or module declaration, the skeleton would insert appropriate comments, &c., based on the object name.
The tricky part is the unquoted elisp expression in the skeleton that does a save-context (&c.) followed by a search-backward that looks for a regexp like
"^[[:space:]]*\\(class\\|module\\)[[:space:]{1,}\\([^[:space:]]{1,}\\)" ; P-code, not real

and setting str to the two matched strings, or to nil/"" if not found.  If there's no declaration found preceding the skeleton insertion point, it should be a no-op, but otherwise insert stuff tailored to class or module and including the object name.
Unfortunately, the skeleton document is a little sparse on the subject of embedding/wrapping elements of the skeleton language in EmacsLisp S-expressions.
The closest I've come is to invoke skeleton-insert inside the conditional S-expression, but that's becoming really hairy and messy (in part to its lack of documentation, only a few occurrences of usage).
Can anyone point to examples of skeleton-language lists conditionally inserted by Elisp S-expressions as part of if/else clauses?
Thanks!


texts:
After updating emacs to version 26.1 on a windows machine, I get the following error message from flyspell:

Error enabling Flyspell mode:
(c:/Program Files (x86)/Aspell/bin/aspell.exe release 0.60 or greater is required)

The problem is, even after installing a windows binary of aspell 0.6 from here, it still doesn't work because apparently

The Aspell 0.60 library is binary compatible with the Aspell 0.50 library.
For this reason I chose _not_ to increment the major version number (so-name) of the shared library by default [...]

Has anybody else had this problem already? Are emacs users relying on aspell on windows, or rather using alternatives like hunspell?


texts: Org mode export: exclude sections with todo keyword

texts:
I want to export an org mode document so that sections or subsections
with TODO keywords do not appear in the exported output. How can
this be achieved?

The export-settings
documentation does not explicitly mention anything related to this.


texts: yasnippet configuration does not persist across emacs runs

texts:
yasnippet does not complete snippets that I add to yas/root-directory (typing the key and hitting tab does not complete).

If I remove .yas-compiled-snippets.el from an affected directory, then run yas/recompile-all then yas/reload-all, I can temporarily use the snippets in that directory.  This works for one emacs session, but when I start emacs again, yasnippet again does not recognize the extra snippets.

How can I make the configuration "stick" across runs of emacs?

My yasnippet configuration is like this:

(require 'yasnippet)
(yas/initialize)
(add-hook 'python-mode-hook '(lambda ()
                               (yas-minor-mode)))
(add-to-list 'yas/root-directory "/path/to/elisp/yasnippet-snippets/")
(add-to-list 'yas/root-directory "/path/to/elisp/yasnippet-extra-snippets/")


texts: Generate different markup for not-tangled code blocks in org-mode

texts:
Is there a way in org-mode's HTML export to make it so that code blocks that have :tangle no will appear differently? Even adding a different HTML class will do, as one can then probably add some CSS to alter their appearance (e.g. grey background or whatever).

Longer version / context:

I'm using org-mode (and its org-babel) to keep code and documentation together in a single file. Specifically, as in this question, I have

(require 'org)
(org-babel-load-file (expand-file-name "~/emacs/config/init.org"))

so that init.org can generate both an init.el file (for consumption by Emacs), and an init.html file (for consumption by me, when I want to make sense of my config again). In this file, I have some sections that I don't want to be part of init.el (e.g. either I decided against them, or they're simplified versions given first for understanding, before the “real” code, etc). For them, instead of something like

#+BEGIN_SRC emacs-lisp
(require 'cc-mode)
#+END_SRC

I have:

#+BEGIN_SRC emacs-lisp :tangle no
(require 'cc-mode)
#END_SRC

and everything works fine: the code no longer runs on startup, as it's no longer part of the generated init.el. However, the code still shows up in init.html (as I want it to) when I export from the org file, but unfortunately there's no longer any indication that this section is not going be tangled.

I imagine that in the HTML file, instead of

    ...

if I could persuade org-mode / org-babel export to add another class, then I'd know how to solve the rest.


texts: PDF-TOOLS, black line in the middle of the window

texts:
I installed pdf-tools and tested few functions, it works great (the occur function is great).
But when i open a pdf file i have a black line in the middle of the window (1or 2 pixel width), when i jump in another window in emacs it desappear and reappear when i jump back in the pdf window buffer.
When i scroll pages the line stay in the middle.
Here is my init.el:
    #+BEGIN_SRC emacs-lisp
  (use-package pdf-tools
    :ensure t
    :init)
  (pdf-tools-install)

    #+END_SRC


texts: Prevent mouse click from changing cursor position while in insert mode

texts:
I work on a laptop most of the time and it happens somewhat often that while inserting some text (in evil mode) I will accidentally hit the touchpad with my thumb, changing the cursor position and causing the next few words to be inserted into some unrelated paragraph. The somewhat annoying thing is that undo is usually of no help here, because the last saved undo state is whenever I entered insert mode and I might have written several sentences since then that I don't want to lose. I'd rather not completely disable use of the mouse, so I'm hoping to implement one of the following acceptable fixes:

Don't allow mouse clicks to change position while in evil insert mode, only in normal mode (this sounds the simplest).
Update the undo state whenever I change cursor position with the mouse, if there is a callback for that.

Are either of these possible?


texts: Finding the source of a function after macro expansion?

texts:
(I'm a rookie and I use Spacemacs)

I'm trying to find the source of a certain function*.  I can find the .el file in which it's defined by using find-function, however the defun is created dynamically using a macro.

Is there some way to show the source of the function as it exists now, after the macro has created it?

(* Specifically though I don't think it matters: spacemacs/align-repeat-bar)


texts:
I would like to know how many seconds have passed since the last keystroke (or character that showed up in the screen, whatever is easier).

Is there a timer that is associated to self-insert-command?  Alternatively, what is a simple way to achieve my goal?


texts: Magit commit mode does not open anything to edit with

texts:
I recently installed Magit and began running it. It appears to load just find and all keybindings seem to work perfectly. However, when I intend to commit changes, magit doesn't seem to open my emacsclient and create a new buffer inside of emacs.

Initially, it opened a separate instance of emacs. I then tried changing the default git editor with:

git config --global core.editor emacsclient

Now when I try to commit with

C-x g c c

as I've done before, it no longer opens anything. I checked the process of magit-commit-mode from within emacs and I saw the following:

run git ... commit --
hint: Waiting for your editor to close the file...
libgpm: zero screen dimension, assuming 80x25

Running it again just now left me with something similar

run git ... commit --
-- More --^[[53;11H SPACE/d/j: screen/page/line down, b/u/k: up, q: quit

My current machine where this is happening is running Manjaro on emacs26 if that helps. I even tried reverting my git config back to its original settings (resetting the config as well) and nothing changed. If there is something else I did that would have caused this change in magit's behavior it's not coming to mind.

I then tried my exact same configuration (same .emacs and same emacs version) on my Chromebook running GalliumOS (a Xubuntu based distro), and magit commits work perfectly fine. I can write commit messages from within a new buffer in emacs, close it, and continue with my work.

Is there anyone with any idea of what the issue may be with my particular setup on my main Manjaro machine? Or a pointer in the right direction?

Thanks in advance.


texts: org-babel-tangle with function in header arguments

texts:
Following this suggestion, I have a function to automatically generate figure names:

#+begin_src emacs-lisp :exports none
(set (make-local-variable 'i) 0)
(fset (make-local-variable 'fig-file)
      #'(lambda () (concat "f" (number-to-string (incf i)) ".pdf")))
#+end_src

I apply it to R code as shown below.

#+begin_src R :file (fig-file) :results output graphics :exports results
(plot (rnorm(10))
#+end_src

This works well, except when I try org-babel-tangle on the org file, I get this error: eval: Symbol’s function definition is void: fig-file.

How can I get org-babel-tangle to work with functions in the header arguments?


texts:
How can I set a keybinding to something to C-c \? I tried with this but it does not work

(global-set-key (kbd "C-c \\") 'something)

Evaluating this gives me the error

Key sequence C-c \ starts with non-prefix key C-c.


texts: Don't italicize /.../ in this org buffer

texts: Is it possible to specify that, in a certain org buffer, /.../ should not be italicized?


texts: Getting Helm describe-function/describe-variable’s secondary to work like helm-M-x?

texts:
When you use Helm for M-x, you can quickly check the documentation for an interactive command before calling it, it using the secondary key (usually C-z or C-j; I use the latter below). It brings up a background help buffer so you can be sure this is the command you want and you know how any arguments are used. Helm’s help line shows this: C-j: Describe this command (keeping session).
It’s a fantastic quality-of-life feature. Unfortunately, it only works for interactive commands; not for non-interactive functions or variables.
When you use describe-function (C-h f) or describe-variable (C-h v), this functionality goes away, replaced by nothing. (Literally: the Helm help line reads C-j: DoNothing (keeping session).)
I think I understand the motivation for this design: since you’re in the middle of running the interactive command to describe a function or variable, the alternate function also describing the function or variable seems redundant.
But in reality, when I’m doing Elisp coding, I frequently have used Helm to narrow down my choices of functions or variables to a manageable, but still significant number (say, eight or ten) and I’m not sure which one I want.
I’d like to press my secondary key on each to “preview” its documentation¹ before picking the one I want. But instead, my only avenue seems to be using RET to complete the describe command, then repeating the search with C-h f M-p and navigating to the next one, and so on. (If the thing I’m looking for is a buffer-local variable whose value I’m interested in, that requires even a few more keystrokes.)
If you have a number of choices and you really have no idea which one is right, it’s easy to lose track of your place (particularly after you’ve looked at a few) and repeat one you’ve already looked at—or inadvertently skip one—since you have to start at the top of the list again each time.
In Helm’s GitHub issues, there was a query about this, but the solution proposed—of simply assigning the describe function to the secondary key—results in an (interruptible) hang from infinite recursion.
So how can I achieve this?

¹ A “preview” sounds like I may want something different from what you get from the description—a synopsis (as you can get from interactives’ doc strings). But I just want to see the description in another buffer while keeping the Helm session open.


texts:
I recently migrated from emacs VM to mu4e.  Using mb2md.pl I successfully (well, modulo a few tweaks) reformatted ~140,000 emails.  All good, really.
However, because of the single-file format of VM, and to keep that size manageable, I had several mail files all relating to a single aspect of my job.  These got transformed into separate maildir directories.  I would like to consolidate these directories into a single one, not just to be anal about it, but because when moving emails auto-completion can't resolve the destination smoothly with my naming conventions.
My question: can I get away with a single mv command to reposition all those related emails in a single maildir, followed by mu index, or do I need to manually move them all within mu4e?
Many thanks.


texts: Abbrevs with interstitial capital letters

texts:
Whenever I type YouTrack, abbrev erroneously corrects it to Youtrack. I noticed that in my abbrevs file it has ("youtrack" "youtrack" nil :count 7). Why is that there, and how can I get abbrev to correctly capitalize it YouTrack?

I'd actually prefer if it corrected Youtrack to YouTrack but editing the abbrevs file to that affect seems to change nothing about the behavior. The only flag that sounds remotely germane is abbrev-all-caps, but that doesn't change the behavior to what I want.


texts:
I use org-mode to write a huge research diary with thousands of entries. I'm trying to organize them by tags. I make only the relevant entries appear via org-sparse-tree and that works perfectly. Now, I would like to use the Emacs search only among them. Is this possible?

Alternatively, is it possible to export a org-sparse-tree to another buffer and search there?


texts: Turn on package-check-signature and install ELPA packages on Mac OS X Emacs

texts:
I had my GUI emacs installed by brew cask install emacs.

I wanted to strictly check the downloaded package, by its signature, so I put following (as for testing, solely) in ~/.emacs.d/init.el:

(require 'package)
(setq package-check-signature t)

When try to install any package (from elpa) by the package interface of M-x list-packages, it results in message of epg-context--make: GPG error: "no usable configuration", OpenPGP, and cannot install.

Question

How can I configure the init.el so that I can turn on package-check-signature and install packages?

Env

GNU Emacs 25.3.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
OS X El Capitan


texts: emacs --eval of multiple functions on command line

texts:
How do I evaluate multiple functions simultaneously using emacs --eval on command line? For example I want to combine the followings in a single command:

emacs --eval "(toggle-frame-maximized)"
emacs --eval "(sr-speedbar-toggle)"

I tried to wrap them together but all attempts failed. How do I do this?


texts: How to remove 'SCHEDULED' timestamp when changing TODO state to WAITING

texts:
I have some item in an org buffer marked as TODO and having a scheduled timestamp:

* TODO do something
  SCHEDULED: <2014-11-02 Sun>

How do I cause the SCHEDULED timestamp to be removed when I move this item to the 'waiting' state?


texts: How is the GNU Emacs source code organized?

texts: How is the source code of GNU Emacs organized? What are the main modules and their functionality?  Where can I find an official, up-to-date description of the architecture and its source code?


texts: Function of org-clock-save.el file and Git related question

texts:
I'm asking this question because I'm personally confused on how org-clock works in general.

My org-clock-save.el file only has one line,

;; org-persist.el - PCNAMEHERE at <2016-04-24 Sun 11:16>

From what I understand, the only thing the file is doing is telling emacs/org-mode to save my clock times across sessions. Furthermore, the only changes I see is that it updates the time stamp and the last computer that used it whenever it gets saved. Is this true?

That said, then where does org-mode save my clock times?

I use github to sync my .emacs.d file across two computers, so there are some files I put in my .gitignore files so that packages and other files get installed and set locally. Would it be safe to add my org-clock-save.el file to this now? For clarity, I've already pushed and pulled org-clock-save.el a few times between PCs, so there is a file on each pc saying this with the only difference being the time stamp between pulls/pushes.


texts: ace-window: How can I switch to a frame I can't see?

texts:
Windows 10, Emacs 25.1

When I want to switch between windows I user M-x ace-window and then select number. Nice.

But I also want to switch to a frame that isn't visible. I can guess what number to select, but that's difficult. Can I use ace-window to switch to a frame I can't see?


texts:
In the documentation, two ways are suggested for accessing arguments in an advice: by the name of the argument in the original function and by using special functions. I cannot get the second way to work. Here is my attempt:

(defun my-insert-for-yank(orig-fun &rest args)
  (insert (ad-get-arg 1)))

(advice-add 'insert-for-yank :around #'my-insert-for-yank)

When I run (insert-for-yank "aa bb"), I get a message about ad-get-arg being a void function.

What am I missing?


texts: How to build Emacs without byte-compiling Lisp files

texts:
Q:  Is there an option to build Emacs without byte-compiling the Lisp files?

BACKGROUND:  The length of time needed to build Emacs makes debugging / developing an extremely slow process.  For example, the latest bug that I am working on debugging came about on 11/19/2016.  Performing a git hard reset to try out a variety of commits over a long period of time requires a fresh start to avoid certain errors that I encountered.


texts:
Consider the following LaTeX file (named test.tex) demonstrating the use of the glossaries-extra package.

\documentclass{article}
\usepackage[automake]{glossaries-extra}
\newglossaryentry{potato}{name={potato},description={potato}}
\makeglossaries
\begin{document}
\glsadd{potato}potahto
\printglossaries
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-engine: luatex
%%% End:

When I compile the document with C-c, C-a, the following output results.

What do I need to do in order for the document to typeset properly?


texts:
When I try to use the function ff-find-other-file on a C file, and the header file does not exist, I expect emacs to create a header file at the current location.

Since I started using helm, something else happens:

$ mkdir /tmp/helm-other-file
$ cd /tmp/helm-other-file
$ emacs a.c

M-x ff-find-other-file opens a helm buffer with two entries:

/tmp/helm-other-file/.
/tmp/helm-other-file/..

I expected that selecting the first would mean to create the buffer at that location: /tmp/helm-other-file/a.h.

Instead, the following is created: /tmp/helm-other-file/a.h/a.h. That's one (new) directory too deep.

If I select the .. version, to compensate for "too deep", I get /tmp/a.h. That's not deep enough.

If I go up a level with C-l after ff-find-other-file, then select helm-other-file/, I go back to this: /tmp/helm-other-file/a.h/a.h.

How can I fix ff-find-other-file so that unfound header file is created at the same location as the C file, with helm? I'm aware that helm-projectile might fix this, but I don't want to bring in the whole package only for that function.


texts:
I want to use helm for org-refile completion when determining which heading to refile under.

Here are some excerpts from my initialization script.

(setq org-refile-targets '(("~/Documents/GTD/Gtd.org" :maxlevel . 3)
                           ("~/Documents/GTD/Someday.org" :level . 1)
                           ("~/Documents/GTD/Tickler.org" :maxlevel . 2)))

(setq org-outline-path-complete-in-steps nil)
(setq org-completion-use-ido nil)

I'm not sure what more I need to use helm in this manner. Do I need to rebind the refile key to a different command?


texts: Define key binding for a single mode (Fundamental)

texts:
In light that this may be a duplicate, but I did not find the answer to my question scouring this site.

The default behavior of GNU Emacs appears to have electric-indent-mode enabled, which is fine almost everywhere.  However, I would like to change the behavior for trimming whitespace at the end of the line and auto-indenting after pressing Return for only one mode: Fundamental.

In essence, I would like Enter to simply add a newline (electric-indent-just-newline) while pressing Alt+Enter to insert the default newline.

How would I go about it?  I found this, but I do not seem to get it converted to work with Fundamental.


texts: M-x shell from MSYS2: cannot set terminal process group

texts:
I'm using MSYS2-x86_64, and whenever I do M-x shell I see the following:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
]0;~/.emacs.d

There is a partial solution: Setting PS1:

export PS1="\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$"

However I have to A) source .bashrc after launching M-x shell (...which doesn't make sense), and it doesn't solve the ioctl message.

Is there an actual fix for this? Not just a PS1 patch? Should I just ignore it? It looks like I can spin off another copy of emacs (from within Emac's M-x shell, launching MSYS2's bash) and kill it with kill [PID], so what am I missing?


texts:
I am a newbie at emacs lisp and was looking for some assistance.

I am trying to use a capture template from a file.
Here is relevant code:

(setq base-capture-template (concat (file-name-as-directory capture-template-directory) "base_tpl.txt"))
(setq org-capture-templates
  (quote (("w" "work" entry (file+headline org-tasks-file "WORK") (file base-capture-template) :kill-buffer t)))

When I try the template, I get an error: Wrong type argument: stringp, base-capture-template.

Is there a way to convert the symbol base-capture-template such that it corresponds to the expected type?

Thanks.

-gyro


texts: Use of keyword symbols in property lists

texts:
According to the Emacs Lisp manual http://www.gnu.org/software/emacs/manual/html_node/elisp/Symbol-Type.html

  A symbol whose name starts with a colon (‘:’) is called a keyword
  symbol. These symbols automatically act as constants, and are normally
  used only by comparing an unknown symbol with a few specific
  alternatives.

and http://www.gnu.org/software/emacs/manual/html_node/elisp/Property-Lists.html#Property-Lists

  A property list (plist for short) is a list of paired elements. Each
  of the pairs associates a property name (usually a symbol) with a
  property or value.

What is the difference between:

(let ((my-plist '(bar t foo 4)))
  (plist-get my-plist 'foo))

and

(let ((my-plist '(bar t :foo 4)))
  (plist-get my-plist :foo))

and which one is preferred?


texts: M-S-up/down in org-mode suddenly does not 'move' whole items anymore

texts:
Consider a .org file containing

* Item 1
  - Item 1.1
  - Item 1.2
* Item 2
  - Item 2.1
  - Item 2.2

with the point being at Item 2. With GNU Emacs 25.2.1
(x86_64-apple-darwin13.4.0) of 2017-04-21 and Org-mode version 8.2.10 executing M-S-up leads to

* Item 2
  - Item 2.1
  - Item 2.2
* Item 1
  - Item 1.1
  - Item 1.2

With GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0) of 2018-05-30 and
Org-mode version 9.1.9, I suddenly see this (on M-S-up):

* Item 1
  - Item 1.1
* Item 2
  - Item 1.2
  - Item 2.1
  - Item 2.2

Has this (default) behaviour changed? And how do you get the 'old' behaviour?

This seems to be related but the answer does not seem helpful in this regard.

Is there any way to get the old behavior back? The new behavior is inconsistent with how meta-left/right and shift-meta-left/right works. Here shift-meta-left/right moves the subtree while meta-left/right moves a line. In contrast, with up and down shift-meta-up/down moves a line and meta-up/down the subtree. This new behavior of meta-shift-up/down moving only a line drives me completely bonkers when trying to move a subtree to its correct position in a hierarchy. I never remember when to press shift and when not.


texts: Regexps: 2 strings without a character in between; 2 chars w/o a string in between - Stack overflow in regexp mapper

texts:
I am trying to search through some babyl files for errors.  The files are email messages that appear between ^L and ^_ (Control-L and Control-_), with a special string "\*\*\* EOOH \*\*\*" in between, marking the end of the header.  I want to use regexps to find:

EOOH[^^L]*EOOH

ie two EOOH's with no Control-L in between, but when I use that syntax I get the stack overflow. (That’s with search-forward-regexp or isearch-forward-regexp. And by ^L in the brackets I do mean Control-q Control-l.)

I would also like to find two Control-L's with no EOOH in between, sort of like this, though it's wrong syntax:

^L[^"EOOH"]*^L

Can anyone help?


texts:
When using ECB, the lines for function names are often long and get cut-off in the sidebar:

Is there a way to show the full line that the cursor is at in the mini buffer when it is cut off due to its window not being wide enough?


texts:
I use the following alias:

alias e='emacsclient -a '\'''\'' -t
alias sudo='sudo '

That way I can execute both, commands and aliases, with sudo, including e, which launchs the emacs server if it is not launched yet.

The thing is that, if I have the emacs-daemon running, for example because I have edited a file before, and then I open the editor with sudo, every file which is written by the server, like .historian, changes its owner to root. So, when trying to launch the server again, the server is launched but the client doesn't show up (it frozes just after launching the server) and I have to open the client in another terminal, but emacs doesn't behave correctly anyway. For example, the minibuffer is incorrectly displayed for commands that requires input, like C-x C-f.

How can I solve that situation? How could I launch an emacs server per user basis? Or there's any other solution?e


texts: Direx not working, cl-call-next-method only inside primary and around methods

texts:
Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
of 2015-07-25 on KAEL

Compiled from EmacsW64.

Direx, using the latest version of Direx from MELPA

Windows 7 x64 bit.

Situation:

I would like to try the package Direx, but the documentation is not very clear.When I installed Direx, I try to start it wih M-x Direx:jump-to-directory but I get a unclear message:

cl-call-next-method: cl-call-next-method only allowed inside primary and around methods

When googling around, I found this thread but it's difficult to understand how this error occured in a package. It's more related with common Lisp than the package itself, it seems.

When I tried again with the empty Emacs configuration (emacs -q), I still  get the same message. It's unclear to me what I do need to solve this error, in order to get Direx working.

Direx is downloaded more than 10.000 times ,but I don't know how I could call Direx. The commands for Direx seems obfuscated to me. Seems I am the only one with this bug?

Any suggestion would be appreciated.


texts: Remembering history between sessions in Inferior Emacs Lisp Mode

texts:
I can't make Emacs remember the history for *ielm* buffers between sessions.  As far as I can tell, such history is recorded in the buffer-local variable comint-input-ring.  Therefore I have added the following expression to my init file:

(setq desktop-locals-to-save
    (append desktop-locals-to-save
            '((comint-input-ring . 50))))

It doesn't work.  I know that the desktop package is working because Emacs remembers the global variables that I have added to desktop-globals-to-save in my init file.

--

EDIT: savehist does not work either.  I suppose that is because comint-input-ring is a buffer-local variable.


texts: Sending application/x-www-form-urlencoded data with restclient

texts:
When I use restclient with Content-Type: application/x-www-form-urlencoded, restclient sends newlines with the data.

For example:

POST :domain/thing
Content-Type: application/x-www-form-urlencoded
data=foobar

The endpoint receives a form with the value 'data': 'foobar\n'.

I could modify require-final-newline such that the last query in the file would work properly, but since requests are separated by comment lines, I still get the extra newlines for all preceding requests.

How can I get restclient to pass the forms correctly?


texts:
I am trying to compare two log files, side by side in two emacs buffers. The logfiles are similar in context, but some have extra debug inserted. This makes simple use of pgup/pgdown painful as things get out of alignment between the two buffers.

What I'd like to do is scroll by context, and although I don't expect emacs to know the context, I'd like to find the relevant line in the left and right buffers and then scroll both buffers such that that line appears at the top of the window in both buffers.

Is this achievable?


texts: How do I interconvert Calc's HMS forms and seconds?

texts: Is there a built-in way to convert/toggle between GNU Emacs Calc's HMS forms and seconds?  I'd also like to easily be able to add numbers as seconds and/or minutes to an existing HMS form.


texts: Problem defining two python functions in org-mode

texts:
I am testing the possibility of including python code in org-mode files in emacs. As it is my first time with I ran into an error that probably it is easy to fix, but I cannot see the solution. I want to define some onstants and functions and use them later in the file. If I do this witho only one function there is no problem, as in this simple example:

* Initialization block containing constants and function definition
#+NAME: init_block
#+BEGIN_SRC python :session
  # Constants
  a_constant = 287.
  #
  #
  ##########################
  def m_T(E_val):
    import numpy as np
    A_val = 6.1094
    return A_val*np.log(E_val/A_val)
#+END_SRC

#+RESULTS: init_block

* Example

#+BEGIN_SRC python  :session   :results output
print "Hello, world! This is my zero trial ", a_constant
print m_T(10.)
#+end_src

#+RESULTS:
: Hello, world! This is my zero trial  287.0
: 3.01044670959

However, when I try to include the definition of two functions errors pop up:

* Initialization block containing constants and function definition
#+NAME: init_block
#+BEGIN_SRC python :session b
  # Constants
  a_constant = 287.
  #
  #
  ##########################
  def m_T(E_val):
    import numpy as np
    A_val = 6.1094
    return A_val*np.log(E_val/A_val)
  #################
  b_constant = 287.
  #################
  def m_E(T_val):
    import numpy as np
    A_val = 6.1094
    return A_val*np.exp(T_val/A_val)
  #################
  c_constant = 287.
  ##########################
#+END_SRC

#+RESULTS: init_block

* Example

#+BEGIN_SRC python  :session b  :results output
print "Hello, world! This is my zero trial ", a_constant, b_constant, c_constant
print m_T(10.)
print m_E(12.3)
#+end_src

#+RESULTS:
#+begin_example
Hello, world! This is my zero trial  287.0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'b_constant' is not defined
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'm_T' is not defined
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'm_E' is not defined
#+end_example

I would appreciate any help to understand what am I doing wrong in this case.


texts: AUCTeX: prevent indentation inside commands

texts:
I am not a fan of the way AUCTeX indent LaTeX code.  Some time ago I asked for help in disabling indentation.

The solution provided there handles the large majority of my needs, but fails to prevent indentation of text inside brackets, such as for \footnote{text} or \textbf{something bold}.  More specifically, if I have some text like this

Here is a paragraph which you should
pretend\footnote{some stuff} has much
longer lines.

and then fill the paragraph, I often get something like the following

Here is a paragraph which you
should pretend\footnote{some
  stuff} has much longer
lines.

I don't like the way the contents of the \footnote command are indented.  Is there a simple way to disable this?


texts:
When using company in shell-mode, a space is added after a match is made. This makes path completions behave badly, since I simply can't continue with the next directory but have to go back. I guess this behaviour is due to that when completing a command, you want the extra space.

I assume someone has already solved this, in order to get the usual path completion behaviour, but still use company in shell-mode.

(If my description was unclear, say I want to list /some_directory/another_direcory/file.txt. I type ls /some. I can now select /some_directory/ as completion. Now I have ls /some_directory/  (node trailing space). I have to press backspace in order continue with another_directory.)

I've tried with emacs -Q and then enabled global-company-mode. The shell I get from M-x shell gives the same behaviour.


texts: ibuffer - execute function on buffer at point

texts:
In the depth of the internet I found this function which I need foremost but you could see it as an example for any function that can be applied on a buffer.

(defun open-in-desktop ()
  "Open the containing directory of the current file in desktop. Works in Microsoft Windows and Mac OS X."
  (interactive)
  (cond
   ((string-equal system-type "windows-nt")
    (w32-shell-execute "explore" (replace-regexp-in-string "/" "\\" default-directory t t)))
   ((string-equal system-type "darwin") (shell-command "open ."))))

Now I use ibuffer and I would like to execute that function on the buffer where the cursor is currently located (using a keybinding).

Currently I mark the buffer (m),execute ibuffer-do-eval (E) and then type (open-in-desktop). This works but is quite tedious.

I have no coding skills therefore, I would appreciate any help on that.


texts: Regex search and edit text simultaneously with multiple cursors

texts:
I'd like to search for a pattern with regex and simultaneously cut or edit all instances of that pattern.

Is there a ready-made function for this?

Atom, for example, has one such package - by pressing Alt+Enter, all search results would be selected for simultaneous editing.


texts:
I would like to make a orgmode Clock report that groups tasks based on their category rather than file name alone. This would allow me to have fewer todo files to navigate around in.

I could not find anything in the clocktable report reference about this. Is it possible to have such reports? (or even make the agenda clock report group things by category?)

The closest I got so far is to set the :properties ("Effort" "CATEGORY") . This shows the category column, but doesn't group by it.


texts: how to extract options I saved with customize and insert it inside use-package lines?

texts:
Suppose I did some customization through M-x customize-mode or something similar
 '(org-agenda-custom-commands
   '(("n" "Agenda and all TODOs"
      ((agenda "" nil)
       (alltodo "" nil))
      nil)
     ("i" "Urgent things" tags "URGENT" nil)))

they are inserted inside (custom-set-variables
Can I just cut the lines and put them inside
 (use-package org ?
Actually do I need to?
I thought it would be aethetically pleasing to see well cleaned up init.el file..


texts:
Is there a way to make buffer-local overrides to exec-path (whose value is normally initialized with the PATH environment variable)?

I tried (make-variable-buffer-local 'exec-path) and local overrides seem to work fine after that, but are there any harmful side effects? In any case, this is non-standard, so is there an officially blessed way to do it?

One reason for a buffer-local path would be to use project-specific versions of tools in Node.js and other projects.


texts: AUCTeX highlight contents of comment environment as a comment

texts: I sometimes use comment environment in my LaTeX documents. Is there a way to make AUCTeX display contents of this environment as a comment?


texts: Emacs lines displaced/shifted for no reason

texts:
I tought, the problem would be solved, from not using a theme anymore.
But actually there are displaced lines, whenever I'm using emacs with files, which where edited on another system. So probably my emacs got a problem with CRLF, CR, LF?

Problem is shown below.

It looks correct, but if you gonna take a look at the second picture, you can see the error i meant earlier.
Actually it seems theres nothing wrong with the menu bar, but with the themes in the terminal. Whenever i use the default theme, it's fine, but right after switching to another theme the error is going to be there.

Tested with a minimal init.el

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   ;; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
   '("melpa" . "http://melpa.milkbox.net/packages/")
   t))


texts:
I am interested in extending pcase with patterns which:

Complement an existing pattern, e.g. (not (pred string-empty-p)). Such a pattern would match where the non-negated form does not match and vice versa.
Match when a predicate applied to the object being matched returns nil, e.g. (npred (string= "foo")).

The following is my first attempt at the former:

(pcase-defmacro not (pat)
  (let ((obj (make-symbol "obj")))
    `(and ,obj (guard (not (pcase ,obj (,pat)))))))

I would appreciate any suggestions for improvement of (1) (e.g. how to avoid a nested pcase) and implementation approaches for (2). Are there any conditions under which such patterns would be a bad idea (other than there being a better, non-pcase alternative)? Is there an idiomatic/elegant way of achieving the same effect which does not involve defining new pcase patterns?

Update

I think the pred pattern is constrained enough to allow for the following implementation for (2):

(eval-when-compile (require 'subr-x))

(pcase-defmacro npred (pat)
  (let ((obj (make-symbol "obj")))
    `(and ,obj (guard (not (thread-last ,obj ,pat))))))


texts: How to do margin notes in org-html-export?

texts:
Is there an elegant way to have margin notes for org-html-export-to-html?

For example, as they appear in this page: https://www.cs.virginia.edu/~lat7h/blog/posts/124.html


texts: How to debug C++ (dap-mode + LLDB or GDB)

texts:
I want to use dap-mode to debug a C++ code. Until now I followed instructions dap-mode (LLDB) and lldb-vscode. I further enabled the mode and UI via

(dap-mode 1)
(dap-ui-mode 1)

When I execute dap-debug I can select the LLDB template, but when executing I get the following message:

  No messages handler for process

I tried to tweak the template file via dap-debug-edit-template. The current template has the following form:

(dap-register-debug-template "LLDB::Run"
  (list :type "lldb"
        :cwd "/Users/knowledge/Developer/Tutorials/Cpp"
        :request "launch"
        :program "/Users/knowledge/Developer/Tutorials/Cpp/Debug/main"
        :name "LLDB::Run"))

How can I get this running?


texts: How can I execute a python script on a given region of my buffer?

texts:
I have a .tex source and a python script called comments.py. This script reads my .tex source as input, does some operations on it and write a .com file as output. Then I have to reneame .com as .tex and go on with my work.

I want to automate these procedure and so I have written a script in elisp to do this.

My problem

I want that comments.py acts on a given region of my .tex source and not on all buffer. So, how can I contain its actions from (point-min) to a point defined as \begin{thebibliography}?

Here there is my code:

;; clean comments on .tex sources

;; define .tex file name with extension
(setq source-tex-ext (format "%s" (buffer-name)))

;; call comments.py
(defun call-comments ()
  (interactive)
  (setq python-script-path "~/scripts/comments.py")
  (insert
   (shell-command-to-string
    (concat
     (format "python %s" python-script-path) (format " %s" buffer-file-name)))))

(call-comments)

(save-buffer)

;; close buffer
(kill-buffer (current-buffer))

;;
;;
;; Now I call a bash script in order to rename .tex as .bkp and then .com as .tex
;; because I am not able to do this in elisp directly
;;
;;

;; call rename-com-to-tex.sh
(defun call-bash-script ()
 (interactive)
 (setq bash-script-path "~/myscripts/rename-com-to-tex.sh")
 (call-process "/bin/bash" nil t nil bash-script-path))

(call-bash-script)

;; open .tex (this is .com renamed as .tex)
(find-file (format "%s" source-tex-ext))

(save-buffer)

;; do other things
...

Hope my question is clear.

Hint

This is an attempt with shell-command-on-region as suggested (I have tried to construct the following code looking for examples):

(setq m1 (make-marker))
(goto-char (point-min))
(set-marker m1 (point-min))

(setq m2 (make-marker))
(set-marker m2 (search-forward "\\begin{thebibliography}"))
(setq python-script-path "~/scripts/comments.py")

;; call comments.py
(defun call-comments (start-position end-position)
  (interactive "r")
  (shell-command-on-region
   start-position end-position (concat
    (format "python %s" python-script-path) (format " %s" (buffer-file-name))) (buffer-file-name) nil))

 (call-comments m1 m2)

In this way the code creates a .com file as output, but restrictions are ignored. In the new .com file, comments.py has acted until the end and not until \begin{thebibliography}.


texts: Add a custom section to AUCTeX's section commands?

texts:
The KOMA-script bundle contains a package called scrjura and I'm using it to draft contracts.

The command for the standard section in contracts is \Clause{title=<title heading>}. Basically, I'd like to get an extra kind of section:

If the package scrjura is loaded in the preamble, I'd like to call this command the same way than other section commands: C-c C-s, the prompt of Emacs asks "Level: (default section)" and then select which one I'd like to use (section, Clause, subsection, ...) and then get the question "Title:", I type the title of the clause, the prompt of Emacs changes to "Label:", and if I choose "Clause" as level, the whole label prompt should be "Label: CLA:title-heading".

The desired output in my *.tex-file is:

\Clause{title=title heading}
\label{CLA:title-heading}

How do I set this up?

Even better: if the text "title heading" contains a comma (","), the whole of title heading needs extra brackets: \Clause{title={title, and foo}}. But this would be the cherry upon the chocolate, if you can say that in English.

MWE for a contract with a fairly recent scrjura:

\documentclass[pagesize, english, fontsize=12pt, parskip=half]{scrartcl}
\usepackage[T1]{fontenc}\usepackage[utf8]{inputenc}
\usepackage{babel, scrjura, xspace}

\title{Sicherheitsbestellung}
\subtitle{gag}
\date{}

\begin{document}
\maketitle

\begin{contract}
\Clause{title=first title heading}

Some text.

\Clause{title={second title, heading}}

And so on.

We get numbers here after two runs.

\end{contract}

\end{document}


texts: Can the byte-compiler warn me about unused variables?

texts:
I've just finished a pretty significant refactoring; byte-compiler warnings were a great way to quickly find errors, without even running tests.

Still, there's one kind of code smell that the byte-compiler doesn't seem to catch: unused variables. And unfortunately, tests are powerless against that one.

For example, my recent refactoring caused a number of internal defconsts to become useless; but I didn't get warnings. Same for defvars and even a few defuns. All of these were private my-package--blah, so I really don't expect them to be used outside of the package. Even then, "unused definition" warnings would be useful (I'd mark the definitions obsolete, for example).

Is there a way to get warnings about unused definitions? I don't mind false positives too much (using intern and eval could hide uses of a definition from the byte-compiler, for example).


texts: How to save part of a regular expression during search and replace?

texts:
I think the best way to explain what I'm trying to do is using an example. Suppose one would want to replace all underlined words with italic ones in org-mode using a regular expression:

_example_ --> /example/

Using Perl regex, one could easily accomplish such a task with the grouping variables $1, $2, etc... using the expression s/_([^_]+)_/\/$1\//g for this case.

Are there similar "grouping variables" in Emacs? If not, then what is the most efficient way to perform such a replacement operation?


texts: Using emacs for ruby development with asdf version manager

texts:
I have installed a (doom) emacs to start developing with Ruby. So far I have mainly used Sublime Text but because of reasons I want to give emacs a chance.
I tried Spacemacs too but uninstalled this because it was really slow)

A problem I have now is that the minibuffer is constantly showing some errors because it can't access the ruby gem reek which some emacs package uses for code analyzing. I am using the asdf version manager but I have not found a way to tell emacs to use it as well. How can I do this?


texts: Why is "*\\Completions\\*" formatting used when specifying buffer names for display-buffer-alist?

texts:
From GNU Emacs Manual: 20.6.2:

  If you prefer Emacs to display a temporary buffer in a different
  fashion, we recommend to customize the variable display-buffer-alist
  (see Choosing a Window for Display in The Emacs Lisp Reference
  Manual). For example, to display *Completions* by splitting a window
  as described in the previous section, use the following form in your
  initialization file (see Init File):

(customize-set-variable
'display-buffer-alist
'(("\\*Completions\\* display-buffer-pop-up-window)))

I've used the code above in my init file, and it works, but I have a question. What are the \\s doing in the Completions buffer name? Does it make any difference if you just write "*Completions*" instead? I've tried this, and I can't see any difference, but I'm worried I might be missing something.


texts: What does the prompt mean for `has changed since visited or saved. Save anyway?`

texts:
When I try to save a buffer back to a file:

  install-packages.sh has changed since visited or saved.  Save anyway?
  (yes or no)

I don't know why it happens, but I also see #install-packages.sh# exists in the same directory.

What do yes and no mean? Do they perform three way merge?

I would like to keep changes from different sources.


texts: bookmark-alist-from-buffer: Cannot read definitions in bookmark file: Invalid read syntax: "#"

texts:
The above error occurs when I try to set a bookmark on a help buffer.
The bookmark looks like this:

#1=(#("Some bookmark" 0 3
(bmkp-full-record #1#))
(buffer-name . "*Help*")
(visits . 0)
(time . #2=(23804 60161 687807 800000))
(created . #2#)
(position . 1)
(help-fn . describe-variable)
(help-args dotspacemacs-distribution #<buffer bookmarks>)
(position . 1)
(handler . help-bookmark-jump))

Acording to @npostavs, the expression causing this is:

(help-args dotspacemacs-distribution #<buffer bookmarks>)

When I quote the last expression like this: "#<buffer bookmarks>", it works as expected.


texts: I want to know how to add \vdots and \ddots to org-entities-user variable. This will display the values when I call org-entities-help


texts:
It is possible to jump to the function that a keybinding is mapped to (via describe-key).
Is it possible to jump to where the keybinding itself is defined?

Example

(define-key my-mode-map "a" 'my-func) # line 1000 in a file.el

I want an interactive function jump-to-binding, which will read a binding ("a") and then open file.el and go to line 1000.


texts: View for version control (git) status with full file names

texts:
Tools > Version control > Git > Status produces nice interactive output to browse the repository.

Is there any way however to have full path names of the modified files, which can be textually copy-pasted somewhere else, or is the only option to run git status from the command line and copy paste from there?

The use case is that I want to store the paths for later in a text file, visit them (I have file at point automation, making go to file hypertext experience) possibly while in another branch, etc.

That is, something analogous to C-x C-b list for the currently open buffers.


texts: How can I search all/single mu4e contexts?

texts:
I have set up a couple of contexts in mu4e for the different email accounts I use. I would like to have a single command to search through all of them. Is there a simple way to do this?

EDIT: Ok, I might have been mistaken - looks like it searches all contexts by default? If so, how can I restrict to a single context when searching?


texts: Automatically insert a space in some C expressions

texts:
The corporate rules about indention forces us to surround our if conditions with spaces like this (in a C and C++ codebase) :

 if (<space>foo == bar<space>)
 {
 }

Is there any emacs tool to insert them automatically?


texts: Function to Replace org-links with Abbreviations

texts:
As suggested by the Org-mode Manual, I've customized org-link-abbrev-alist as follows:

(setq org-link-abbrev-alist
       '(;; Abbreviations for websites
         ("google"         . "https://www.google.com/#q=")
         ("github"         . "https://www.github.com/")))

This is convenient because I can easily insert a link with:

[[google:cat pictures][Google Search for cat pictures]]

This is useful because if the URL changes, I can just updated org-link-abbrev-alist. However, there are instances in the past where I've used the entire non-abbreviated link or decided, after visiting a website enough times, to create an abbreviation.

How would I write a function to use org-link-abbrev-alist to turn long form links in all org-mode files (say, all files in org-agenda-files to abbreviated links? For example,

[[https://www.google.com/#q=cat pictures][Google search for cat pictures]]

to:

[[google:cat pictures][Google search for cat pictures]]

I'd also like to integrate this function with org-mode-hook so that it happens automatically on either save or startup.

Lastly, I'd also like a function that does the reverse and replaces the abbreviation with the long form link.


texts: Are zero-based column numbers an Emacs idiosyncrasy?

texts:
The first line of a text file is line number 1 in probably every application I have ever come across, including Emacs.

Every application I have at hand also uses column number 1 for the first column of each line. Except for Emacs, which says it is column number 0.

My questions:

Is column number 1 the near-universal convention (as it would seem)?
What is the history/rationale for Emacs using column number 0 by default? (It's used both in the return value of current-column and on the mode line when column-number-mode is enabled.) Is this a historical convention on some old operating system or community, or did it debut in Emacs?

I just found out that Emacs 26.1 introduced a new customizable variable column-number-indicator-zero-based to control this. From the release notes:

  Traditionally, in Column Number mode, the displayed column number
  counts from zero starting at the left margin of the window.  This
  behavior is now controlled by 'column-number-indicator-zero-based'.
  If you would prefer for the displayed column number to count from one,
  you may set this variable to nil.  (Behind the scenes, there is now a
  new mode line construct, '%C', which operates exactly as '%c' does
  except that it counts from one.)

This is neat, but still doesn't shed light on the history or rationale.


texts: Make backspace(+?) remove a level of indentation in ReST mode

texts:
I often find myself in the situation where ReST-mode has correctly identified that my last line can be followed by an idented line, but I want to continue on the next higher level of indentation.

How do I make backspace (or C-backspace or whatever) delete a single level of indentation when on a line with only whitespace before the cursor?

For example, from (█ is the cursor)

.. toctree::
   :maxdepth: 2
              █

I want to get to

.. toctree::
   :maxdepth: 2
   █

by pressing backspace once. The 11 spaces should be deleted. What do I need to do? I know python-mode has functionality like this.


texts:
I have noticed that opening a tramp connection on remote hosts sometimes created a .tramp_history file in the user's directory. Is there any way to disable such a behavior? I have to log in to many boxes and that's a lot of cleanup to do. No such options seem to be available in the tramp customization group.

The solution might certainly involve some lisp, but my skills are so far very limited... Thanks for your help!

PS: the same question was asked in 2011, see http://lists.gnu.org/archive/html/help-gnu-emacs/2011-01/msg00875.html...


texts: How to copy latex equations as word equations from emacs?

texts: How can I copy LaTeX-equations from an emacs editor to an MS-Word equation, like the following does for Browsers instead of emacs: https://github.com/idf/LaTex2Word-Equation


texts: How to create an annotated tag with an empty message in Magit?

texts:
Objective
Create an annotated tag with an empty message, as would be created with the following command.
$ git tag --annotate epic-tag --message=""

Attempts

Create it with M-x magit-tag<RET> -a t tag-name<RET> <RET> C-c C-c. This does not work, because git interprets no message specified interactively as don't create tag, resulting in the following in the magit-process buffer.

...
git … tag --annotate tag-name master
hint: Waiting for your editor to close the file...
Waiting for Emacs...
fatal: no tag message?

Add argument --message= to magit-tag. I added a --message= argument to magit-tag(see branch or patch), but when I try using my argument with an empty value it interprets it as cancelling the argument. Using '' or "" as a value literally uses '' or "" for the tag message.

Add a "virtual argument" -e that adds --message='' to the command. That also used '' as a literal tag message. See branch or patch.

Anti-solutions

Use lightweight tags. The tags must be annotated because they are meant for release*.

* Annotated tags are meant for release while lightweight tags are meant for private or temporary object labels. - GIT-TAG(1)


texts:
I have an org document I'd like to export to PDF - with several wide tables columns in it - so much so that it makes sense to export the whole document in A4 landscape to keep the orientation consistent, and wrap the wide table cells where needed.

I'm sure this should be simple - but so far I've only managed to find a way of displaying the tables in landscape:

#+LATEX_HEADER: \usepackage{tabularx}

And then for each table:

#+ATTR_LATEX: :float sideways :environment tabularx :width \textwidth :align XllX

This works fine but there are 2 problems:

1) Only the tables are landscape - how can I set the whole document rather than just the tables?  I've taken a look at using:

\usepackage{pdflscape}

And wrapping the whole document in:

\begin{landscape}

\end{landscape}

but results are unusable due to incorrect typesetting.  Is there some global org setting I can apply to the whole document?

2) Similarly, the ATTR_LATEX align setting to wrap the wide columns has to be set for each and every table.  As my tables are all of the same column order is there a way to globally set the table alignment for every table in the document?  My best guess so far is to write a macro to apply the align to each and every table - but I'm hoping there is an easier way I've missed?

I'm using emacs 25.2.1, org package 20171106, and pdflatex - pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017)

Thanks

Update

I've taken a look a beamer mode - which nicely typesets stuff in landscape, but requires each bullet to be a single slide.  This isn't ideal because I want to produce a document where tables will flow over multiple pages if they are larger than one page.  In beamer mode it seems to truncate items larger than the slide.


texts: Permanent window with list of opened buffers

texts:
Is there some mode where emacs fixes a small window with a list of opened buffers? This is what simpler editors have (kate,gedit,etc).

Here's an example from Kate:

In the left window there is a list of opened files. This is rather independent from the main editing window, while being connected. Some examples: I can maximize the whole set, it doesn't disappear if I split/unsplit the main editing windows.

(Edited for clarity)


texts: Setting up company for shell autocompletion

texts: When I use company-mode in shell-mode, by default company seems to pull candidates from tokens in open buffers. How can I set up the backend to get candidates from shell commands, directory names, and file names? Googling "company-shell" returns somewhat oily results.


texts:
In this question, the OP is asking how to insert an inactive org-mode timestamp which is (almost) what I want.  One of the responders (@xji) noted that the function org-time-stamp-inactive would insert the inactive timestamp.  What I'm trying to do is to use an inactive timestamp in a property like this:
(defun add-property-with-date-captured ()
  "Add DATE_CAPTURED property to the current item."
  (interactive)
  (org-set-property "CREATED" (org-time-stamp-inactive))
)

However, that function is interactive, I just want it to insert the current date/time.  I tried passing with two universal prefix arguments:
(org-set-property "CREATED" (org-time-stamp-inactive '(16)))

It's not interactive but it inserts it twice.
In response to that, to "capture" the results of the function I tried using the approach suggested by @erikstokes in this answer:
(defun add-property-with-date-captured ()
  "Add DATE_CAPTURED property to the current item."
  (interactive)
  (let ((inactivets (org-insert-time-stamp nil t t ))
    (org-set-property "CREATED" inactivets)
  )
)

but I still get an extra entry as described the OP of that question.
Currently I am using this as @kgo suggested in the same question:
(defun add-property-with-date-captured ()
  "Add DATE_CAPTURED property to the current item."
  (interactive)
  (org-set-property "CREATED" (format-time-string "[%Y-%m-%d %a %H:%M]"))
)

It works fine but now I'm just wondering why the method described by @erikstokes didn't work for me.
Can someone suggest how I can do this using the built-in org-time-stamp-inactive function?


texts: Navigating the C-source code for names with underscores

texts:
Is there a built-in option or a package that can help me navigate the C-source code to jump to functions, variables and other items with underscores in the name?

Example # 1:  I would like to place my cursor on optional_new_start in window.c -- hit an M-x find-... -- and be automatically transported to window.h at the location that tells me:

/* True means we have explicitly changed the value of start,
   but that the next redisplay is not obliged to use the new value.
   This is used in Fdelete_other_windows to force a call to
   Vwindow_scroll_functions; also by Frecenter with argument.  */
bool_bf optional_new_start : 1;

Example # 2:  I would like to place my cursor on redisplay_window -- hit an M-x find-... -- and be automatically transported to xdisp.c -- where I can read about:

static void
redisplay_window (Lisp_Object window, bool just_this_one_p)
{
  struct window *w = XWINDOW (window);
  struct frame *f = XFRAME (w->frame);
***


texts: web-mode disable auto pairing mode does not work

texts:
I am having little issues with web-mode.

I am trying to disable the pairing which is done automatically when I try to insert double curly braces like this:

{{<CURSOR>}} , and hit space to start typing my code , it becomes {{ }}}}

here is what I did to try to disable it , but none of this works which is little frustrating.

(electric-pair-mode 1) ;; this is doing all the pairing for me.

(use-package web-mode
  :ensure t
  :defer t
  :init
  ;; none of these disabled it
  (setq web-mode-enable-auto-expanding -1)
  (setq web-mode-enable-auto-closing -1)
  (setq web-mode-enable-auto-pairing -1)
  (setq web-mode-enable-auto-closing -1)
  (setq web-mode-enable-auto-quoting -1)

  (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
  (add-to-list 'auto-mode-alist '("\\.html\\.erb\\'" . web-mode))
  (setq web-mode-engines-alist '(("django" . "/templates/.*\\.html\\'"))))

I am electric-pair-mode for pairing and use-package for configuration.


texts: Is it possible to enable `emacs-lisp-mode` when org-table-edit-formulas?

texts: The default mode is fundamental, which is not really comfortable to edit elisp code did I miss something ?


texts: Running elpy-test on a file opened over ssh via tramp

texts:
I'm trying to run elpy's C-c C-t to do elpy-test on a python test_x.py file I have opened on a remote machine with TRAMP.
Some parameters:

There is a python virtual env in the (remote machine's) directory, ~/myproject/env/default/
I want to run the tests relative to the (remote machine's) project root ~/myproject/
The PYTHONPATH is set to the root directory, which is  ~/myproject/

Locally, I run C-c C-t and this works like so:
-*- mode: compilation; default-directory: "~/myproject/test/integration/data/mymod/" -*-
Compilation started at Thu May 13 13:56:38

py.test --log-level\=DEBUG /home/user/myproject/test/integration/data/mymod/mod2/test_x.py\:\:test_y
================================================================================ test session starts =================================================================================
platform linux -- Python 3.7.3, pytest-5.4.3, py-1.10.0, pluggy-0.13.1 -- /env/default/bin/python
cachedir: .pytest_cache
rootdir: /home/user/myproject, inifile: pytest.ini
plugins: asyncio-0.14.0, flask-1.1.0, forked-1.2.0, xdist-1.33.0, requests-mock-1.8.0, typeguard-2.7.0
collected 1 item

mod2/test_x.py::test_y SKIPPED                                                                                [100%]

============================================================================= slowest 10 test durations ==============================================================================
0.00s setup    test/integration/data/mymod/mod2/test_x.py::test_y
0.00s teardown test/integration/data/mymod/mod2/test_x.py::test_y
================================================================================= 1 skipped in 2.05s =================================================================================

Compilation finished at Thu May 13 13:56:41

This looks good.  This is exactly what I want to see.
However, when I remotely open the same file, and expect it to run on the remote machine via TRAMP, picking up the remote environment:
-*- mode: compilation; default-directory: #("/ssh:remote:/home/user/myproject/test/integration/data/mymod/" 1 4 (helm-ff-file t) 5 13 (helm-ff-file t)) -*-
Compilation started at Thu May 13 14:00:37

py.test --log-level\=DEBUG /ssh\:remote\:/home/user/myproject/test/integration/data/mymod/mod2/test_x.py\:\:test_y
/bin/sh: 2: py.test: not found

Compilation exited abnormally with code 127 at Thu May 13 14:00:37

Some things I notice:

The default directory looks mostly correct AFAICT, but I'm not sure what the #() is doing.
It's not clear to me why py.test is not found.
I don't see elpy listing any of that other stuff, like cachedir or platform---is it not configured at all?
Is there a variable I need to set either within emacs, orperhaps an environment variable, etc., so that when executed remotely, I can pick up the local environments?

Additionally, I have a .dir-locals.el in the root where I can set these as needed, if they are location-specific.
What can I change so I can run my tests with elpy over a tramp ssh session successfully?


texts: how can I view the history on remote hosts with helm-eshell-history?

texts: I'd really like to use eshell on remote hosts, however I have to use !N in order to call history items. I haven't found any other way to select history items and this is really inconvenient compared to helm-eshell-history. How can I make eshell recognize remote history ?


texts: Save all attachments to the same directory in mu4e

texts: Using the mu4e email package, I can save attachments via A S (save multi). However, this requires that I specify the location for each attachment separately. How can I configure this so that I only have to specify the location once, and all attachments will then be saved there without my needing to pick the same location for each file?


texts: emacs gdb *gud* "window" undisplayed/deleted after command

texts:
(Manually moved by copy/pasting from this Unix SE deleted question)

I'm debugging my MELT monitor, in relation with MELT (a domain specific language & meta-plugin to extend & customize the GCC compiler).

I'm using emacs24 (24.4.1) on Debian/Sid/x86-64 with its gdb-mode; most often, I am typing gdb commands in the *gud-monimelt* emacs "window" (inside an emacs frame which is a toplevel window for my LXDE window manager).

I can't get rid of an annoying behavior; after every successfully typed gdb command (e.g. bt, or print ...) , the *gud-monimelt* emacs "window" is undisplayed or deleted (as if I typed Ctrl-X 0) and I have to type again Ctrl-X b *gud Tab to get it back.

FWIW, gdb is version 7.7.1 (but with a GDB 7.8 from Debian/Experimental the same is happenning).

I'm getting the same annoyance on every computer I'm using (and also on emacs-trunk 25.0.50.6 compiled daily from the latest emacs .git). My .emacs is quite small and has no occurrence of gud or of gdb

Do you know any setting to remove this automatic undisplay? I have several emacs frames and several emacs "windows" within my emacs session, and I don't want GUD to close automagically any emacs windows.


texts:
I have a variable say some-var, its value is a string. I want to use its value in a quote expression.

'(some-var "some string")

The function who is using the above expression reports error because it gets some-var literally...not the value.

Any trick to eval some-var inside a quote expression?


texts: How to disable query to turn on disabled command?

texts:
I have this in my .emacs file to disable mouse right clicks:

(put 'mouse-save-then-kill 'disabled "mouse-save-then-kill disabled\n")

How can I now disable the query generated by emacs to turn this command back on ("Do you want to use this command anyway? You can now type [y/n/SPC/!]") ?


texts: How can emacs detect when a file has been modified by another program?

texts:
Does emacs have a way of detecting when a file it is editing has been changed by another program?

Can it warn and generate a message when that happens, rather than warn you when you are about to edit or save it?


texts:
When i ran the following code in just started emacs

(with-temp-buffer
  (insert "@article{aaaa,
    author =     {AAA},
    title =  {BBBB}
    }")
  (bibtex-mode)
  (bibtex-autokey-get-field "title"))

I get the following error:

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    looking-at(nil)
    bibtex-valid-entry(t)
    bibtex-end-of-entry()
    bibtex-text-in-field("title" t)
    bibtex-autokey-get-field("title")
    (progn (insert "@article{aaaa,\n    author =     {AAA},\n    title =  {BBBB}\n    }") (bibtex-mode) (bibtex-autokey-get-field "title"))
    (unwind-protect (progn (insert "@article{aaaa,\n    author =     {AAA},\n    title =  {BBBB}\n    }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
    (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "@article{aaaa,\n    author =     {AAA},\n    title =  {BBBB}\n    }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
    (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "@article{aaaa,\n    author =     {AAA},\n    title =  {BBBB}\n    }")       (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
    eval((let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert "@article{aaaa,\n    author =     {AAA},\n    title =  {BBBB}\n    }") (bibtex-mode) (bibtex-autokey-get-field "title")) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) nil)
    elisp--eval-last-sexp(t)
    eval-last-sexp(t)
    eval-print-last-sexp(nil)
    funcall-interactively(eval-print-last-sexp nil)
    call-interactively(eval-print-last-sexp nil nil)
    command-execute(eval-print-last-sexp)

After i open any bibtex file the above code works as expected. (I get "BBBB")

If it is important i initialize the bibtex with the following:

  (use-package bibtex
    :mode ("\\.bib" . bibtex-mode)
    )

Could you help me to find the problem


texts: Swiper go to next matching line instead of next match?

texts:
When I use swiper to search and I press the down arrow key, it always goes to the next match even if that match is on the same line. Is there an easy way to go to the next line that has a match instead? Sometimes going to the next match is useful, but oftentimes I am looking for a particular use of a variable name, and I end up taking longer to go through variable declarations because they often contain the search term twice like ObjectType object_instance;.

Possibly relevant: I am using visual line mode.


texts:
Using this code
(defcustom org-agenda-deadline-faces
   '((1.0 . org-warning)
    (0.5 . org-upcoming-deadline)
    (0.0 . org-upcoming-distant-deadline))

How do you replace "org-warning" with a specific color code? What would be the syntax?
I tried to copy paste that into my init, but it gives me a parsing error.


texts: AucTeX: Disable electric-pair-mode in minibuffer during Macro definition?

texts:
I use Emacs 24.3.1 and AUCTeX. I switched on the electric-pair-mode in LaTeX-buffers. The only time I would really like to disable it in the minibuffer while inserting math-mode parentheses via the \left and \right commands. For these commands in Emacs, I use  \ as TeX-electric macro.

My question would be if there is an easy way to disable the electric-pair-mode inside the minibuffer? Or do I maybe use an inconvenient setup for putting parentheses into equations?


texts: Problem with company-anaconda and company-yasnippet

texts:
I have tried several setups and I just can't seem to be able to get anaconda and yasnippet working at the same time (dabbrev would be nice as well). First I tried reorganizing the order, it was a suggestion somewhere. If one puts anaconda higher(first) than yasnippet, then anaconda will show in the dropdown and yasnippet won't be listed in the dropdown (yas-expand works though).

This is my current order:

(company-anaconda company-bbdb company-nxml company-css company-eclim
  company-semantic company-clang company-xcode company-cmake company-capf
  company-files (company-dabbrev-code company-gtags company-etags company-keywords
                 company-web-html company-yasnippet) company-oddmuse)

If I place company-anaconda below(after) company-oddmuse, then yasnippet works, but anaconda does not.

Also tried something like this, to have it specifically working under python-mode, also does not work:

(add-hook 'python-mode-hook (lambda ()
              (set (make-local-variable 'company-backends) '(company-anaconda :with company-yasnippet))
                      (company-mode t)))

Or

(add-hook 'python-mode-hook (lambda ()
              (set (make-local-variable 'company-backends) '(company-anaconda company-yasnippet))
                      (company-mode t)))

In the above cases changing the order also does not make a difference. Anyone having problems with this as well?


texts: How do you reload  directory-local variables?  I would like to modify a .dir-locals.el and have such changes applied to the current Emacs session.


texts:
When i do C-c C-c on a python module, it leads to *Python* buffer with Inferior Python : run Shell-Compile mode.
Suppose the correct cwd is /x/y/z/
The problem is when I print os.getcwd(), i get wrong cwd = /x/y/
Due to this, modules from the same directory can not be imported.

But when i run M-x run-python from the same module, os.getcwd() is fine and modules can be imported.

Anyone knows what is happening here ?


texts: magit-stage-modified doesn't stage untracked files

texts:
When I want to stage one file I use the command magit-stage. It works.

But now I want to stage many files at once, using the command magit-stage-modified.

Here's a  sceenshot:

But after I press y nothing happens. All files stay in the Untracked files section.


texts: Change the default visibility of a Magit section

texts:
I have a fork of popular repo, I want to be able to keep track of commits being push to that repo while also having my own personal commits to my fork. I don't really want my changes to be merged upstream so I'm fine with merging/rebasing every time someone commits to the upstream repo.

I read about triangle workflow and Magit's support for it and thought it great. It does exactly what I need, except that it insists my local commits should be finally merged into the main repo thus displaying a list of my local commits under the section Unmerged into upstream/master:

Head:     <local commit>
Merge:    upstream/master <upstream commit>
Push:     origin/master <local commit>

Unpulled from upstream/master (1)
987ac90 upstream/master <upstream commit>

Unmerged into upstream/master (1)
123baf8 master origin/master <local commit>

This is fine if there are a couple of commits, but later my personal modifications will pile on and the list will grow.
Is there any way to set the section Unmerged into upstream/master to be always hidden?


texts: Org Mode Agenda: Trees whose sub-trees don't contain a specific tag

texts:
I want to make an org-agenda-custom-command that searches for all top-level trees that don't have a sub-tree with a "NEXT" tag. I'm trying to set up a search that I can do at the beginning of the week to make sure that all projects have their next step defined.

I looked into Special Agenda Views which seems close to what I need, but I couldn't figure out a way to use it to search an entry's sub-tree to determine if an entry should be skipped or not.

Any pointers or suggestions that could get me closer to a solution?

Thanks,
Matt


texts: I've got a "shell account" on a distant server and I've done a successful local user setup of Emacs 25. Now I'd like to have a bash alias that will start an Emacs daemon and give me (a) client(s) to work with. I've seen different advice on this. Can't seem to find the definite answer.


texts:
I want to ignore a subtree temporarily.
I can do this by setting the property :header-args: to :tangle
no, but this is not usually visible.  Could I have this property
set automatically by all subtrees tagged with :notangle:, and
removed when the tag is removed; or something to a similar effect?


texts: string-join list with function as list member

texts:
I want to string-join a list of strings, one of which is returned by a function call.
Like this:
(defun foobar () "foobar")
(string-join '("foo" (foobar) "bar") "|")

That results in Wrong type argument: characterp, foobar and not in "foo|foobar|bar" as expected.
What's the elegant way to do that?


texts:
As I use a different language from English often I would like to create some keymaps to avoid changing languages all the time.

I don't know the name of the commands that I have to place in the section interactive-command-here of the keymap:

(define-key KEYMAP (kbd "key-bind-here") 'interactive-command-here)

For instance how can I say that I want C-σ to mean Save? How you denote the Save in the keymap?


texts: On occasion, mode-line git information gets stuck and doesn't update

texts:
On occasion, the git information on mode-line, gets stuck and will not update. For example if I checkout to a different branch, the old branch will still be shown. Or the "mod" indicator will remain when it should not.

Anyone know how to fix this?


texts: Why does ido, when used with recentf, show candidates in the order it does?

texts:
Wanting to stay simple as possible I refrain from using Helm or Ivy etc. and use IDO. Ido-switch-buffer is supposed to allow me to access recently opened buffers quite efficiently with the help of recentf. which I enabled as well. My config thus reads

(recentf-mode t)
(setq recentf-max-menu-items 25)
(setq recentf-max-saved-items 25)

(ido-mode t)
(setq ido-everywhere t)
(global-set-key (kbd "C-x C-b") 'ido-switch-buffer)

but when I invoke ido-switch-buffer, listed first are log files, scratch buffe,etc. only later followed by files I care about.

Am I forgetting something in the config? A recentf file is created and written to, so I suppose its working.


texts:
How can I get ffap to offer a non-existent file?

I'm in a buffer with point inside something that looks like some/directory/structure/a_long_file_name.ext, where a directory some/directory/structure exists but there is no file called a_long_file_name.ext. I want to create that file. Obviously I can select the path, copy it, and yank it at the find-file prompt, but the point of ffap is to not have to do that. If I run M-x ffap, it highlights the whole path but only offers the existing prefix in the minibuffer.

Steps to reproduce: emacs -Q, type /etc/foo then M-x ffap RET. Observed behavior: /etc/foo is highlighted, but the minibuffer offers /etc/. Desired behavior: the minibuffer offers /etc/foo.

I'm using Emacs 24.5 or 25.2 with no higher-level package, just plain ffap.el.


texts: org-agenda-files not getting set in .emacs

texts:
I have multiple org files in my Dropbox directory. I wanted to add all of them into my org-agenda. So as normally prescribed I used org-agenda-files. Infact I'm adding the the part of my .emacs that corresponds to org-mode setup below

;; ############  ORG-MODE  ####################
;; ## To enable shift - arrow mode for navigation (does not work in CUA mode)
(require 'org)
(setq org-support-shift-select t)
(setq org-todo-keywords
      '((sequence "TODO(t)" "STARTED(s)" "ISSUE(p)" "INPUTNEEDED(i)" "VERIFY(v)" "|" "SCOPECHANGE(c)" "DONE(d)" "DELEGATED(o)")))
;; To hightlight code blocks ** SO Link: https://stackoverflow.com/questions/10642888/syntax-highlighting-within-begin-src-block-in-emacs-orgmode-not-working **
(setq org-src-fontify-natively t)
(setq org-directory "~/orgFiles")
(setq org-mobile-inbox-for-pull  "~/orgFiles/from-mobile.org")
(setq org-mobile-directory "~/Apps/mobileorg")
;; ## Make RefTeX work in org-mode
;; ## https://emacs.stackexchange.com/questions/3375/loading-bibtex-file-in-org-mode-file
(setq org-latex-pdf-process '("texi2dvi -p -b -V %f"))
(define-key org-mode-map (kbd "C-c [") 'org-reftex-citation)

(setq org-agenda-files '("~/Professional"))

I also verified that the variable is getting set by Performing M-x customize-variable org-agenda-files. Now when I perform M-x org-agenda t. I get the following output

Global list of TODO items of type: ALL
Available with `N r': (0)[ALL]

I have numerous TODO in the org-files in the folder and I dont know why they dont get reported in the org-agenda


texts: in org-mode, how to move point to next TODO heading upon DONE state change?

texts:
I work with org-mode TODO lists not in org-agenda mode, but within the actual .org files, marking TODO headings DONE as I go.

* DONE buy milk
* TODO fix car
* STARTED call mom

I want org to move point to the next TODO heading once I mark it as DONE. But not before, i.e. when I mark a TODO heading as STARTED, I want point to stay on that heading:

(setq org-todo-keywords
  '(
(sequence "TODO" "STARTED" "|" "DONE")

How do I get org to move point to next TODO heading upon state change to DONE?

I tried this...

(add-hook 'org-after-todo-state-change-hook
(lambda () (org-next-visible-heading 1)) )

...but it doesn't work because the hook is executed within a save-excursion block.

I tried this...

(defun bb/next-heading (&rest args)
(org-next-visible-heading 1))
(advice-add 'org-todo :after 'bb/next-heading)

...which works, but triggers upon ANY state change. How do I make it so org-next-visible-heading gets triggered ONLY when a TODO heading is marked DONE?


texts:
Running Doom Emacs v2.0.9 on Emacs 27.1.
I can mark several entries in the agenda buffer and work on all of them together.
Is there a way to keep marked entries highlighted? This would give more comfort while we operate on them.


texts: File tags prevent autocomplete of global tags

texts:
I amended .emacs as shown below. Then M-x load-file ~/.emacs. What I want to do in test.org is add MEntal tags to each of the two entries, for example Read and Reminder, respectively. Using the column view I type 'e' in the tags column of the first entry, then 'R'. I expect 'Read' to autocomplete, instead I get '[No match]'. Is there something wrong with the global tag hierarchy defined in .emacs?

~/.emacs:

(setq org-tag-alist '(
              (:startgrouptag)
                      ("ACTivities")
                      (:grouptags)
                      ("MEntal")
                      ("PHysical")
                      ("TRansact")
                      (:endgrouptag)
                      (:startgrouptag)
                      ("MEntal")
                      (:grouptags)
                      ("Read")
                      ("Write")
                      ("Reminder")
                      (:endgrouptag)
              )
      )

test.org:

#+TAGS: [ editor : emacs ]

* 2019
** 2019-12 December
*** 2019-12-01 Sunday
**** TODO [#C] [[http://tuhdo.github.io/helm-intro.html][Helm-intro]]                                                                  :emacs:
     - State "TODO"       from              [2019-12-01 Sun 17:31]
**** `C-u C-c C-q` to realign tags                                                                  :emacs:
   Entered on [2019-12-01 Sun 20:29]


texts: How to hilight without one rule breaking another (font-lock-add-keywords)

texts:
I have 2 rules and the second one highlighting text disables the first...
(font-lock-add-keywords 'org-mode '(("^rtfm .*$" 0 '(:foreground "red"))))
(font-lock-add-keywords 'org-mode '(("'.*'"      0 '(:background "OrangeRed"))))

rtfm ... works
and 'this' works
but when I use them together only the second works.
rtfm whatever but then 'xx' and now only 'xx' is highlighted
This maybe sloppy, any tips are appreciated. (quote matching simplified here)


texts: In mu4e, how do you open a message in a web browser?

texts:
I'm using the mu4e layer in spacemacs on develop. When I press a (for action) and then V, it opens an email in Firefox. But I want it to open in a browser of my choosing (qutebrowser). The manual says, somewhat cryptically: Now, when viewing such a difficult message, type aV, and the message opens inside a webbrowser. You can influence the browser with browse-url-generic-program

I don't know what it means by "influence," but I tried this:

(setq browse-url-generic-program "qutebrowser")

But it doesn't seem to have any effect. Ideas?


texts: Getting Emacs lsp-mode to work with this matlab-langserver

texts:
I am trying to get this Matlab language server to work with lsp-mode. Following the instructions in lsp-mode's github page, I inserted the following in my init.el:

(use-package lsp-mode
  :ensure t
  :commands (lsp lsp-deferred)
  :config
  (setq lsp-auto-configure t)
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-stdio-connection "~/.local/share/git/matlab-langserver/matlab-langserver.sh")
                    :major-modes '(matlab-mode)
                    :server-id 'matlab-langserver)))

Where matlab-langserver.sh is

#!/usr/bin/env bash

cd ~/.local/share/git/matlab-langserver/
MATLABROOT="/opt/MATLAB/R2018b"
java -Djava.library.path=$MATLABROOT/bin/glnxa64 -cp $MATLABROOT/extern/engines/java/jar/engine.jar:$MATLABROOT/java/jar/jmi.jar:./build/libs/lsp-matlab-0.1.jar org.tokor.lspmatlab.Application

That last java command being the way to start the server. Here's what happens if I just run this script:

➜  matlab-langserver git:(master) ✗ ./matlab-langserver.sh
2019-11-27 12:50:27.252 [main] INFO  org.tokor.lspmatlab.Application {} - Starting server
2019-11-27 12:50:27.542 [main] INFO  org.tokor.lspmatlab.MATLABEngineSingleton {} - Could not find existing sessions. Starting MATLAB Engine...

When I load up a Matlab m file and start lsp, it connects successfully to the server, but then doesn't do anything. No autocomplete, no hover, nothing.

Here is some sample output from *lsp-log*

[Trace - 12:41:59 PM] Sending request 'textDocument/signatureHelp - (14)'.
Params: {
  "textDocument": {
    "uri": "file:///home/user/Documents/freq_resp_with_damping.m"
  },
  "position": {
    "line": 33,
    "character": 16
  }
}

[Trace - 12:41:59 PM] Received response 'textDocument/signatureHelp - (14)' in 10ms.
Result: null

[Trace - 12:42:07 PM] Sending request 'textDocument/signatureHelp - (15)'.
Params: {
  "textDocument": {
    "uri": "file:///home/user/Documents/freq_resp_with_damping.m"
  },
  "position": {
    "line": 60,
    "character": 27
  }
}

[Trace - 12:42:07 PM] Received response 'textDocument/signatureHelp - (15)' in 10ms.
Result: null

Any ideas how I can get it to work?