texts: Making a context selection drop down menu in emacs

texts: What I want to do with emacs is add a context key shortcut like F or i to select a menu in emacs. Example picture is Midnight Commander and how it does it for what I want to do with emacs.


texts:
Some context:

I'm doing some linux kernel development on a Debian VM so naturally I'm using tramp. I want to use semantic-symref, but the trouble is that:

Semantic will eventually call cedet-gnu-global-call
Which will use the value of cedet-global-command
Which will crap out because it uses 'call-process.

So from what I understand, I need it to be using tramp-call-process.

My question is, can I monkey patch a function, namely cedet-gnu-global-call? I have seen stuff like defadvice, is this a use case for my problem?

By monkey patching, I mean that I want to replace cedet-gnu-global-call with mine, but at runtime.

Or is there some way to get cedet-global to be smart when used over tramp?


texts: Highlighting the changed line in the source file in the resulting pdf using auctex and pdf-tools?

texts:
Is it possible to highlight the changed line in the resulting pdf using auctex and pdf-tools. I have this feature enabled in Skim with the following lines in my setup.

    (add-hook 'LaTeX-mode-hook (lambda ()
                             (push
                              '("pdflatex" "pdflatex -synctex=1 %s" TeX-run-TeX nil t
                                :help "Run pdflatex with SyncTex on file")
                              TeX-command-list)))
(add-hook 'TeX-mode-hook '(lambda () (setq TeX-command-default "pdflatex")))
(setq TeX-view-program-list
      '(("PDF Viewer" "/Applications/Skim.app/Contents/SharedSupport/displayline -b -g %n %o %b"))))


texts: How to make image display follow the focus in image-dired thumbnail buffer

texts:
There are two buffers in image-dired, one is the thumbnail buffer *image-dired*, the other is the displayed image buffer *image-dired-display-image*.

When I type return on an image thumbnail, the focus is switched to the displayed image buffer.

Is there a setting that will make the focus stay in the thumbnail buffer?  What about making the displayed image buffer follow the focus in the thumbnail buffer without hitting return?

Edit: Turns out the culprit is shackle. If you use it, the default behaviour is restored with:

(setq shackle-rules
'(("\\`\\*image-dired.*?\\*\\'" :regexp t :select nil)
  (image-dired-thumbnail-mode :select nil)
  (image-dired-image-display-mode :select nil))
  shackle-default-rule '(:select t))


texts:
I often use ps-print-buffer to print out files, but I don't want the first few lines of the buffer to be printed.  Here's the beginning of the buffer:

# -*- mode: org; -*-
# Last updated: <2017/12/12 18:37>

* First header

Say I want to cut everything up to the line * First header.  I set

 (setq ps-begin-cut-regexp "^# -\\*- mode: org; -\\*-$")

and the first line does not appear on the printout.  But how to set ps-end-cut-regexp?  I tried

  (setq ps-end-cut-regexp "^\\* .*")
  (setq ps-end-cut-regexp "^# Last updated: <.*>$")

But neither works: the second line (# Last updated: <2017/12/12 18:37>) appears on the printout.  What regex should I use to cut the first three lines?


texts: What could be causing some characters to be displayed so tiny?

texts:
I'm using Spacemacs, and it uses a few special unicode characters in the modeline. Some of them look fine, but others are microscopically tiny:

In this screenshot, notice that the a, y, and p circles look fine, but the K and S indicators are super tiny, to the point where I can't even see them. What could be going on here, and how can I fix it?

Edit: Here's another screenshot, showing a circled lowercase letter K next to a circled uppercase letter K. The lowercase letter displays fine, but the uppercase letter is really tiny.


texts:
When working in org-mode, I usually emphasize some key words.  For example, I usually write Python, and when I do, I want org-mode to use boldface automatically:

python => *python*

How do I set it up to make these changes automatic?


texts:
When I run Emacs on macOS, it runs a new instance of the app. Is there a way that I can only ever run one instance?

If I double-click on the Emacs app icon (for example), and it's already running, it would just bring the existing instance to the front.

I'm on macOS 10.13.1 and Emacs 25.2 (9.0).


texts:
A while ago, I installed Emacs from the Ubuntu repositories, and have been using it occasionally. Recently, just for fun, I installed vrms, a tool designed to detect non-free software according to the Debian definitions. My system was relatively clean, with only a few packages flagged.

However, the package emacs24-common-non-dfsg was among them. This seems a bit odd. As far as I know, Emacs was written by RMS himself, so this confuses me.

Are there indeed ethical issues connected to this package? If so, what are the recommended free replacements?

In the case there is no reason for this package to be flagged, what are possible causes for the flag?


texts: DOOM Emacs - Automatic company-mode suggestions don't show up

texts:
I recently installed DOOM Emacs. I see that company-mode and company-files are installed, but I'm having trouble making them work. Regular auto-completion works on Elisp files (So for example, if I type set, I get suggested setq and setf, among other things). I see that the "alist" for company-backend-alist contains several backends that are loaded on prog and text modes, so I'm thinking of adding company-files to this variable.

This alist variable is in a file generated by doom sync, which suggests I shouldn't modify it.

If I manually change the alist variable, add the company-files symbol to the prog-mode part of this alist, then reload the file, I get file completion. My question is, what is the suggested way of adding a backend to the company-backend-alist?


texts: Use picinpar instead of wrapfigure for LaTeX-export

texts:
Org-mode exports to wrapfigure with ATTR_LATEX: :float wrap.

https://tex.stackexchange.com/questions/47674/wrapfig-positioning-footer-is-overlapping-figure?noredirect=1&lq=1 recommends to use picins instead. How can the environment be changed?


texts:
In Rstudio one can use library manipulate to interactively change the plot over some parameters(mu). When you use this in emacs ESS it gives error:

function(mu){
plot(mu)
}
manipulate(myfunc(mu),mu = slider(1,100,step=0.5))

Error

Error in manipulate(myfunc(mu), mu = slider(1, 100, step = 0.5)) :
The manipulate package must be run from within RStudio

Is there a way around to get this library to work in ESS EMACS? Please help! Thanks! I searched on google but there is not one article related to this!

P.S
I have Emacs 24 on ubuntu 16, I have some basic experience with init.el files where I customize by taking code from around the internet.


texts: Preferring org-cycle to yas-expand when hitting tab

texts:
If both org-mode and yasnippet are active, tab will expand a snippet if possible and otherwise execute org-cycle.  Is it possible to reverse this priority?

org mode version: 9.0.9.
yasnippet version: qb-85-ge99b283-dirty.


texts:
Recently I was looking at utilities for handling ssh-agent at an even higher level, so that entering SSH keys passphrases becomes even more seamless than with the standard ssh-agent utility.

One such utility is ssh-ident, the one I chose as the best solution for my workflow. I have configured my system paths so that Git uses ssh-ident instead of regular ssh, which is what the utility requires in order to work.

However, whenever I have to enter an SSH key passphrase through Magit, I get stuck because Magit does not parse the prompt that this tool issues. I would like to know if it is possible to fix this issue (or, in general, of any solution to have ssh-ident work w/ Magit).

Thank you for your help!


texts: How to run an executable from within emacs on windows

texts:
I have a program, say myprogram.exe, and I want to run it from within Emacs by using a key binding. I can run the program in the shell, but don't know how to write a function that calls this function and can be assigned a key binding.

Thanks

Renger


texts:
I am looking for an elisp function that will toggle scheduling for the current headline either to  or not at all. Something like this:

If (SCHEDULED == Nil | SCHEDULED > <today>)
   Set SCHEDULED to <today>
Else if (SCHEDULED <= <today>)
   Set SCHEDULED to Nil
End If

The idea is to assign this function to a key combination (something like C-c C-t) so that I can quickly send (or remove) items from a Custom agenda view (the "Today" list). I would then font lock scheduled items in my projects.org file, to add a visual queue.

Thanks!


texts: Cua-mode commands broken at launch, until the mode is manually toggled

texts:
I'm very new to emacs, and can't seem to get cua-mode to work by default. I'm using emacs 26.3 with spacemacs 0.300 on Kubuntu 20.04.1
I have set (cua-mode t) in my .spacemacs, and cua-mode shows up as active when I check the M-x menu, but the cua commands won't work until I toggle cua-mode in the M-x menu (i.e. turn it off, and then on again), then they work perfectly.
This gets old, and I would really like to have those commands working by default.
I've tried adjusting a few settings to no avail, here are the related lines in my .spacemacs now:
    (cua-mode t)
    (setq cua-auto-tabify-rectangles nil) ;; Don't tabify after rectangle commands
    (transient-mark-mode 1) ;; No region when it is not highlighted
    (setq cua-keep-region-after-copy t) ;; Standard behaviour
    (setq org-CUA-compatible t)

Thanks for reading, any help you can offer would be greatly appreciated!


texts: How to change headline fonts in org-html-export?

texts:
This question concerns org-mode and its org-html-export feature.

When exporting from .org to .html, the highest headlines (those with the fewest *s) export to a gigantic font.

Is there any way to reduce the size of this font?

Thanks for any help.


texts: How do I display current cell address of an org-mode table?

texts:
I am trying to write some formulas in my tables and having a bit of a hard time figuring out the current cell's address (@row:$col).

It would be awesome if I could display the cell location in the mode-line but I am okay with some function that prints out the locations in *messages*.


texts: How to highlight current line only in selected window?

texts:
Q: is there a way to have hl-line-mode highlight the current line
  only in the selected window?

When I have multiple windows showing buffers with hl-line-mode
on, it is difficult to tell, at a glance, which window is
current.

I have the variable cursor-in-non-selected-windows set
to nil to show the cursor only in the current window, but that
visual cue is swamped by the highlighted lines in the windows.

Is there a similar setting to allow me to have hl-line-mode show
the highlighted line only in the current window?  Even better, is
there a way to give the highlighted lines a different face when
they're in inactive windows (analogous to mode-line-inactive)?

PS: yes, I can look at the mode line to tell which window is
active, but doing so takes my eyes away from what I'm doing and
breaks my concentration.


texts: Key Binding to reschedule agenda item after 2 hours

texts:
below is my function for reschedule agenda item to "today + 3 days

(defun my/org-agenda-reschedule-week ()
    (interactive)
    (org-agenda-schedule nil "+3d"))

similarly i want function for rescheduling agenda item after current time + 3 hours, these code doesn't work

(defun my/org-agenda-reschedule-hour ()
    (interactive)
    (org-agenda-schedule nil "+3h"))


texts: How to configure specific Java indentation?

texts:
I have the following code from Intellij's indentation:

public static String[] defaultMethodBlacklist = new String[]{
        "getClass",
        "wait",
        "notify",
        "notifyAll",
        "finalize"
};

And:

public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService,
                                  TransportNodesStatsAction transportNodesStatsAction,
                                  TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService,
                                  ThreadPool threadPool) {

However, when I attempt to adjust/fix the indentation in Emacs, I get:

public static String[] defaultMethodBlacklist = new String[]{
    "getClass",
    "wait",
    "notify",
    "notifyAll",
    "finalize"
};

public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService,
        TransportNodesStatsAction transportNodesStatsAction,
        TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService,
        ThreadPool threadPool) {

My current indentation configuration looks like:

  (c-offsets-alist . ((inline-open . 0)
                      (topmost-intro-cont    . +)
                      (statement-block-intro . +)
                      (knr-argdecl-intro     . 5)
                      (substatement-open     . +)
                      (substatement-label    . +)
                      (label                 . +)
                      (statement-case-open   . +)
                      (statement-cont        . ++)
                      (arglist-intro  . ++)
                      (arglist-close  . ++)
                      (arglist-cont-nonempty . ++)
                      (access-label   . 0)
                      (inher-cont     . ++)
                      (func-decl-cont . ++))))

How can I configure the indentation in emacs to match Intellij's for code like this?

Also, how can I diagnose and fix issues like this in the future myself? Is there a way to get which "type" of indentation is being used at a particular point?


texts: I would like to know if there is a way to get the standard side by side diff view in magit. That is, instead of seeing the old code chunk and the new one one after the other, I'd like to see them on the same horizontal alignment.


texts:
With GNU Emacs 26.1 installing either smooth scroll while adding

(require 'smooth-scroll)
(smooth-scroll-mode t)

to my .emacs, or smooth scrolling with

(require 'smooth-scrolling)
(smooth-scrolling-mode 1)

does turn on the smooth scrolling mode just fine, but two-finger vertical swipes on the trackpad do not deliver the purported smooth scrolling.

Switching to Yamamoto Mitsuharu's Emacs is a bit too much for just this one nice feature. I'd rather stick to a package.

Did you manage to get either of these two packages to smooth scroll with 26.1 or a recent version of Emacs?

By "smooth scroll" here I mean that one would get the scrolling obtained with, say, Safari (with files whose length exceeds that of the window/frame).

Update

The discussions online

Set scroll-amount for mouse wheel in .emacs
Can scrolling be smoother than single line in emacs/org-mode?
How do we achieve real smooth scrolling?
pixel-scroll-mode is slow
SmoothScrolling
emacs OS X smooth scroll

are inherently confused. Missing in the middle of the questions/conversations is a definition of "line" in the expression "smooth scrolling by line". One solution is to qualify that term by replacing it with either "character-line" or "pixel-line". The present question is about the latter.


texts:
Recently on startup I started getting an OpenSSH dialog warning me of an unknown host key.  I then allowed it to store the key, and now I get a a password window at startup.

So then I went and cleared every known cache I could find, including recentf, .ido.last, and everything in my .emacs.d/savefile directory and it keeps bringing up of that OpenSSH password pop-up.  What's even weirder is that the host it originally complained about not knowing the key for doesn't exist in my .ssh/known_hosts file, nor is there a system wide /etc/ssh/known_hosts file.

I can solve the problem of the pop-up from coming up every time by following the instructions here but I'm still quite miffed that I can't find the source of what file tramp is trying stat.  It seems as if there is some other file I don't know about that's 1) caching some file on that host, and 2) some other unusual place that's caching the host's key.

Some other details: I'm running a prelude based emacs installation.  Recently updated from Ubuntu 15.10 to 16.04 and wondering if that has anything to do with it.


texts:
I have a task with multiple subitems in different states, and I would like to have a binding to switch the task and all its subtasks to the same state (DONE). I know that I can ignore state blocking, but that isn't what I want.
Do I have to iterate over all the subtasks for that, and if so how?


texts:
Windows 10, Emacs 25.1

In my init.el

(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action)

But on start Emacs I get error:

Symbol's value as variable is void: helm-map


texts:
So, I'm pretty much a noob with regards to Emacs and Org-Mode but I'm wondering if a particular feature exists...

A lot of old outliners (I'm talking MS-DOS era) had a feature called "Mark and Gather," where you were able to mark several items and move them all at once.

I'm wondering if this functionality exists anywhere in Org-Mode.

To be clear, I'm wondering if there's a way to mark several headings then run Org-Refile to move them all at once.

Everything I find about marking seems to refer either to selecting text or turning something into a Todo item.


texts: How can I escape the * in org-mode to prevent bold fontification

texts:
If I write something like *shrug* in org mode, it will be automatically fontified as bold text.  How can I prevent that, i.e. actually having *shrug* appear verbatim when exported?

Edit:

I still want to be able to use bold fontification (without having to change the default star-syntax for bold text), and it should not matter to what file format my org file is exported, e.g. it should work for Markdown as well as HTML export.

  This is some important stuff, that is why it is written in bold.  But for something else, I have no Idea *shrug*.


texts:
I'm using emacs 26.1 and spacemacs (emacs-plus from homebrew and spacemacs is from the develop branch). I've configured my local shell to use ZSH from homebrew as well (installed to /usr/local/bin/zsh).

When I start emacs, (getenv SHELL) shows /bin/bash.

The first expression in dotspacemacs/user-init is:

(when (memq window-system '(mac ns x))
  (setenv "SHELL" "/usr/local/bin/zsh")
  (exec-path-from-shell-initialize))

What's the appropriate way to get emacs/spacemacs to pick up the local environment?


texts: How can I get winner-mode to not modify my keybindings?

texts:
I am trying to bind C-c u and C-c r to winner-mode's undo and redo in my ~/.emacs:

(global-set-key (kbd "C-c u") 'winner-undo)
(global-set-key (kbd "C-c r") 'winner-redo)

However, this doesn't work without (winner-mode 1), which sets up some keybindings. And I don't want any of winner-mode's default keybindings. How can I make my winner-undo and winner-redo work without binding any other keys, preferably without installing other packages?


texts: Using function keys as "sticky" modifier keys

texts:
Is there a way to use a function key (like <f8>) as a sort of super-key-down event and then have the next keystroke (f.ex. s) then be interpeted as s-s? In other words, this will be similar to sticky modifier keys, but just for emacs, not the os itself.

I know about key-chord mode and the fact that you can use key combinations like this (global-set-key (kbd "<f8> b t") 'undo) to save keyboard shortcuts. But I'd like something that works with my existing bindings to the super key and does not require me to bind everything twice in the future (ie. one binding for the super key and one for the function key).


texts: Is there a canonical way to convert a keyword to a symbol with no :?

texts:
I want to convert keywords, e.g. :some-key to a plain symbol like some-key. I currently do this with:

(intern-soft (substring (symbol-name :some-key) 1))

Is there a better way?


texts: How can we save all the grep searches (using `M-x grep`) into history?

texts: How can we save and retrieve all the grep searches that we do using M-x grep command into history ?


texts: How to get word statistics of RSS feeds via Elfeed?

texts:
I'm using Elfeed as an RSS client. Given an *elfeed-search* buffer, I would like to know the word frequencies in the current search. I've looked at this answer, and while the proposed function works great for a normal buffer with text, it breaks in the above scenario.

Ideally, I would like count only the frequencies of the words that appears in the titles, not in the publishers' names, tags, or dates.

Any suggestion on how to achieve this? Alternatively, any pointers to relevant elisp tutorials?


texts:
I can't figure out how to enable the gdb-gui.

Instead of this:

I only get this:

GNU gdb (GDB) Red Hat Enterprise Linux (7.2-83.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/beginner/test/build/unittests/alltest...done.
(gdb)

Question: how do I get the gdb GUI to work?


texts: Move to beginning of line when top arrow is pressed in beg-of-buffer line

texts:
Like in all modern editors, including the SE Q&A fields, I'd like my cursor to move to the beginning of the first line, when I press the Up arrow on the first line of a buffer. Currently, it stays in the middle of the line and messages "Beginning of buffer".

How can I get that behavior ?

(Bonus points for the same thing with Down arrow at end of buffer.)


texts: ESS freezes on startup with ess-tracebug mode enabled

texts:
I am currently running R 3.3.1 in emacs 25.1.1, ESS 16.10, and polymode 20160805.448 installed via MELPA on Mac OS Sierra.  Whenever I try to open an interactive R console using M-x R, it freezes immediately upon startup and I have to force quit emacs.

The bottom bar says "ess-tracebug mode enabled" and the R console initially runs if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))).

My .emacs file has the following code related to ESS:

;ESS mode configuration
(autoload 'R-mode "ess-site.el" "ESS" t)
(add-to-list 'auto-mode-alist '("\\.R$" . R-mode))
(setq inferior-R-program-name "/usr/local/bin/R")

;;R stuff
(setq ess-eval-visibly-p nil)
(setq ess-ask-for-ess-directory nil)
(require 'ess-eldoc)

;;compile the first target in the Makefile in the current directory using F9
(global-set-key [f9] 'compile)
(setq compilation-read-command nil)

(require 'poly-R) ;; Load polymode for Rmd and Rnw
(add-to-list 'auto-mode-alist '("\\.Snw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rnw" . poly-noweb+r-mode))
(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

;; The following four lines set C-; to automatically add " -> " in ESS,
;; and causes _ to insert a normal underscore.
(setq ess-S-assign-key (kbd "C-;"))
(ess-toggle-S-assign-key t) ; enable above key definition
;; leave my underscore key alone!
(ess-toggle-underscore nil)
;; Map C-' to the pipe operator %>%
(defun then_R_operator ()
  "R - %>% operator or 'then' pipe operator"
  (interactive)
  (just-one-space 1)
  (insert "%>%")
  (just-one-space 1))
(define-key ess-mode-map (kbd "C-'") 'then_R_operator)
(define-key inferior-ess-mode-map (kbd "C-'") 'then_R_operator)

EDIT:  Also I'm not sure if this helps, but I copied a .emacs file from a computer with a functioning R mode to try to fix this issue and it still failed.

**EDIT 2:  Completely copied over a .emacs and a .emacs.d from the same working computer.  Upon startup, the first line on the frozen computer is if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))), but on the original, working computer, it is:

 if(identical(getOption('pager'), file.path(R.home('bin'), 'pager'))) # rather take the ESS one
+       options(pager='cat')
> options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)


texts: How to search and replace in *open buffers*

texts:
I want to interactively search and replace in all (or, preferably, a regexp subset of) my buffers (not files).
Scenario

Being a pack-rat sort of guy, I never delete my buffers until I'm sure I don't need them anymore (e.g. new project), or until the system crashes and I lose them. So I know that all the files I've modified (the targets of the search and replace) are in a buffer somewhere.
The files are strewn all over creation so I can't use Dired.
There are 10k files in scope, so I'd prefer to avoid file-based operations (though I've already wasted so much time on this I've eclipsed the amount of time I would have saved not using the file-based approach).

What I'm doing now
Right now I'm using multi-occur-in-matching-buffers and repeating a query replace for each matching file.
I'm told Icicles will do this, but reading the manual, I can't make heads or tails of how to do it. (I used M-99 M-x icicle-search; I get prompted for a "context", which I can't find a definition for in the manual and furnishes as a completion a list of previous mini-buffer entries, which doesn't make sense to me.) Icicles is far more than I need, but if I have to use it, I will.
Things I've tried

I tried tags-query-replace but it doesn't work; I always get zero matches, even though it ends bringing up a buffer with a match in plain sight.
I've read the FAQ (see responses above).

I may end up having to use file-based operations (which are annoying because I have to find and reload each file manually)
Since Icicles supposedly does what I want I thought I'd throw the question out. The other option is to use the Refactor facility in our IDE but that wouldn't be Emacs!! ❤


texts: How to pick colors using Emacs to generate a 3-element vector

texts:
QUESTION:  Can Emacs help a user to pick colors in the form of a 3-element vector, and what does each element of that vector represent?

Background:  I borrowed certain sections of code from pong.el and gamegrid.el, which use a color format of a 3-element vector.  At the time this question was initially written, I had never seen colors specified in that format before -- I wanted to use the same system, but had no idea how a particular color could be selected.  The following example places four (4) overlays at the beginning of the buffer, but requires a version of Emacs that supports displaying XPM images:

(let* (
    (counter 0)
    xpm-list
    (color-list '(
      [0 0 0]
      [1 1 0]
      [1 0 0]
      [0.5 0.5 0.5]))
    (form-feed-xpm
      "/* XPM */
       static char * form_feed_xpm[] = {
       \"11 20 5 1\",
       \" s None\",
       \"+ s col1\",
       \". s col2\",
       \"% s col3\",
       \"@ s purple\",
       \"%%%%%%%%%%%\",
       \"%.........%\",
       \"%.........%\",
       \"%.........%\",
       \"%.........%\",
       \"%...++++++%\",
       \"%.++.++...%\",
       \"%+...+....%\",
       \"%+...+....%\",
       \"%+...+....%\",
       \"%+...++++.%\",
       \"%....+....%\",
       \"%...++....%\",
       \"%...+.....%\",
       \"%.++++....%\",
       \"%.........%\",
       \"%.........%\",
       \"%.........%\",
       \"%.........%\",
       \"%%%%%%%%%%%\"};")
    (set-color (lambda (color shade)
      (let* ((v (floor (* shade 255)))
       (r (* v (aref color 0)))
       (g (* v (aref color 1)))
       (b (* v (aref color 2))))
        (format "#%02x%02x%02x" r g b))))
    (make-image
      (lambda (color)
        (let* (
            (col1 (funcall set-color color 0.6))
            (col2 (funcall set-color color 0.8))
            (col3 (funcall set-color color 1.0))
            (data `((:type xpm :data ,form-feed-xpm :ascent center
               :color-symbols
                (("col1" . ,col1)("col2" . ,col2) ("col3" . ,col3)))))
            (image (find-image data)) )
          (push image xpm-list)))) )
    (mapcar
      (lambda (x)
        (funcall make-image x))
      color-list)
    (mapcar
      (lambda (x)
        (overlay-put
          (make-overlay
            (+ (point-min) counter) (+ (point-min) (1+ counter)))
          'display x)
        (setq counter (1+ counter)))
      (reverse xpm-list)))


texts: Is there a generalized setter for buffer-modified-p?

texts:
It is very simple to define a simple generalized setter for buffer-modified-p:

(gv-define-simple-setter buffer-modified-p set-buffer-modified-p)

That enables constructs like:

(with-current-buffer "test.cc"
  (cl-letf (((buffer-modified-p) t))
    (save-buffer)))

If test.cc is out-of-sync it is saved even if (buffer-modified-p) returns nil. The old status of (buffer-modified-p) is unconditionally restored afterwards.

I use that in a special case where there is a special save function which unsets buffer-modified-p but does not save the buffer in the file associated with buffer-file-name.

Question: Is that generalized setter already defined in some existing library?

Note, I know about with-buffer-modified-unmodified from bookmarks.el. But, that is not quite what I want.


texts: Loop through top-level headings in Emacs Org-mode

texts: I want to apply (org-id-get-create) to every top-level heading in the buffer. How can I loop through all top-level org-mode headings in the current buffer?


texts: Synchronizing the units in which horizontal scrolling is measured with buffer columns

texts:
The problem I am trying to solve is determining how many columns of the current buffer are hidden due to horizontal scrolling. The documentation states:

  The horizontal scroll position is measured in units of the normal
  character width, which is the width of space in the default font.
  Thus, if the value is 5, that means the window contents are scrolled
  left by 5 times the normal character width. How many characters
  actually disappear off to the left depends on their width, and could
  vary from line to line.

Thus, when the font in the buffer is the default font and the latter is mono-space, the number of hidden columns is given by (window-hscroll). In my case, the buffer's font, although mono-space, differs from the default font. So, how can I get something more relevant than (window-hscroll) in this case? Or, alternatively, can I trick window-hscroll or, even better, the functions that perform the actual scrolling into considering the buffer's font to be the default?

EDIT: SOME BACKGROUND

I use the buffer to display a large graph produced by Graph::Easy. I need to be able to scroll the window so as to make a given node visible and centered. The lines have been padded with spaces from both ends, so that all lines are of the same (and sufficient) length. Also, the font is mono-space, so it does not matter which line to pick for the calculation.


texts:
As I understand, company mode can help complete the word, but not a sentence. I would like to complete a fragment of sentence.
I would like to complete fragment e.g. "portal and hepatic doppler" but not like "portal-and-hepatic-dopler" as is usual with programming. I do not wish to use abbreviation expansion
I'm looking for a solution to be used with emacs-org.


texts: Passing variable into a org babel code on export

texts:
I can't seem to get the variable to expand into src block

#+BEGIN_SRC conf :tangle ~/.config/mine.conf :var argument=abcde
setting1 1234
setting2 argument
#+END_SRC

When I export the file for tangling (C-c C-v t), the "argument" keyword is not expanded into "abcde".

I realise this is because I am not evaluatiing the block but exporting it.

How do I achieve my desired output in the tangled file?


texts:
I saw someone on Twitter posing the question:

It struck me as a very interesting question and got me thinking about how large the community actually is!  I came up with two data points:

Based on the 2016 Stack Overflow Survey, 5.2% of 46,613 responses (of 56,033 respondents) used Emacs as a development environment.  Stack Overflow indicate that they estimated 46 million people visited SO in January alone.  If the survey respondents were representative of visitors, that would suggest ~2.0 million users of this sort visited SO in January 2016 (or at least 2,425 users ;-).

In 2015 they asked about preferred text editor.  4.1% of 16,778 resonses (of 26,086 respondents) indicated Emacs or XEmacs.  At the time they estimated 32 million people visited SO monthly.  These numbers suggest that ~840 thousand users of this sort were visiting SO in February 2015.

They acknowledge both surveys are:

  ...biased against devs who don't speak English, or who don't like
  taking English-language surveys.

(and they likely offer a high estimate for their amount of unique traffic)

What other data might shed some light on this question?  Maybe the Debian package popularity contest?


texts: Aggregate tag lists for completion in orgmode

texts:
I would like that the tag completion mini-window aggregates :

buffer tags defined in #+TAGS header (LOCAL_TAG_1, LOCAL_TAG_2)
tags set in the previous headings (ANOTHER_NEW_TAG)
tags coming from the variable org-tag-alist

In this simple example :
#+TAGS: LOCAL_TAG1 LOCAL_TAG2

* Heading 1 :ANOTHER_NEW_TAG:
* Heading 2

The completion window is actually showing only :


texts: Error in newly installed magit -head branch header wrong type argument

texts:
I just installed the magit package in emacs 26.3 (using CentOS 7 OS).  When I start it with M-x magit, I get the error below.  It works fine for me in an older installation, and the only difference I can see is that the one I just set up is using newer versions of some magit related packages.  I don't see any issues posted on GitHub related to this even though it renders magit nonfunctional, so I'm wondering if anyone has a tip on how to resolve the error.

Error:

Turning on magit-auto-revert-mode...done
magit-insert-head-branch-header: Wrong type argument: stringp, nil
Error in post-command-hook (magit-section-update-highlight): (wrong-type-argument number-or-marker-p nil)


texts: Argument to ivy-read action when collection is an alist

texts:
The documentation of ivy-read states that if the collection supplied is an alist, the selected candidate is passed as a cons cell to the function supplied in the :action argument.
So why does the code snippet below return "C1" or "C2", depending on the selection, and not (1 2 3) or (3 4 5), respectively?
(ivy-read "Choose: "
          (list (cons "C1" (list 1 2 3)) (cons "C2" (list 3 4 5)))
          :action (lambda (x) (cdr x)))

I can work around this by doing something like the following, but I don't understand why I have to.
(let (tmp)
  (ivy-read "Choose: "
            (list (cons "C1" (list 1 2 3)) (cons "C2" (list 3 4 5)))
            :action (lambda (x) (setq tmp (cdr x))))
  tmp)


texts: Insert TODOs and SCHEDULE items in calendar view

texts: We can do this with 'k' in agenda. How to insert / capture tasks at Calendar in Emacs? It would be very useful. Thanks!


texts: I know that I can align images in html export with the property #+ATTR_HTML: :align right upon each image link. But can I set a default for the org-document so that I do not have to add the property to each image?


texts:
I've tried to create a tags table for my assembler project using:

etags --language=none --regex="/[ \t]*\.\([^: \t]+\)/\1/i" *.asm

Which does work to a degree, and indeed when I load the TAGS file into Emacs, I see all the tags created just fine (from assembly labels).

My problem arises when I try and use M-. to search for a specific tag. It only shows me a very small subset of the tags in the *completions* buffer, despite all the tags seemingly present in the TAGS file.

Here's an example of what I'm trying to match:

.t0 DCB 0
.t1 DCB 0
.t2 DCB 0
.t4 DCB 0

Yet when I do M-., only the t0 tag will be listed in *completions*. If I manually enter t1 it can jump straight to it!


texts:
I have Helm installed and added this line to the end of the init file:

(define-key global-map [remap find-file] 'helm-find-files)

So, when I restart Emacs and try C-x C-f it executes helm-find-files. But all subsequent C-x C-f are executing plain find-file. Why?


texts: What is the difference between sh and shell for org-babel?

texts:
I'm experimenting with sourcing data from org-mode into my shell scripts and I've run across a weirdness:

#+tblname: simple-table
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |

#+name: work-with-simple-list-shell
#+begin_src shell :var tbl=simple-table
echo "$tbl"
#+end_src

#+RESULTS: work-with-simple-list-shell
: 1

#+name: work-with-simple-list-sh
#+begin_src sh :var tbl=simple-table
echo "$tbl"
#+end_src

#+RESULTS: work-with-simple-list-sh
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |

Any idea what is going on?


texts:
This is my first time trying to write my own elisp code, so bear with me. I have the following cl-loop:

data contains the following:

((refs . [((file . "api/user.js") (start . 266) (end . 269)) ((file . "api/user.js") (start . 292) (end . 295)) ((file . "api/user.js") (start . 304) (end . 307)) ((file . "api/user.js") (start . 320) (end . 323)) ((file . "api/user.js") (start . 554) (end . 557)) ((file . "api/user.js") (start . 575) (end . 578))]) (type . "local") (name . "req"))

  (cl-loop for ref across (cdr (assq 'refs data))
           for start = (1+ (cdr (assq 'start ref))) and
           file = (expand-file-name (cdr (assq 'file ref)) (tern-project-dir))
           if (string= buffer-file-name file)
           if (let ((a 1))
                (print ref)
                (print start)
                (< start (point)))
           collect start into prev-refs
           else collect start into next-refs
           finally return (list file (sort prev-refs '>) (sort next-refs '<)))

which currently outputs the following:

  ((file . "api/user.js") (start . 266) (end . 269))

  267

  ((file . "api/user.js") (start . 292) (end . 295))

  267

  ((file . "api/user.js") (start . 304) (end . 307))

  293

  ((file . "api/user.js") (start . 320) (end . 323))

  305

  ((file . "api/user.js") (start . 554) (end . 557))

  321

  ((file . "api/user.js") (start . 575) (end . 578))

  555

This seems to be close, but I don't understand why start stays the same for the first 2 iterations of the loop (causing it to miss the start value in the last iteration). What I'm hoping to do is to define the variables to be used within the loop.

I've tried using with instead of the second for, but that didn't work. I've gotten it to work by using the full code for start and file in the various places where they're used, but that produces some quite ugly code.

btw, I just added that let statement only so I could execute those print statements.

Any help on getting the desired outcome would be greatly appreciated!


texts: Changing mode-line face when evil state changes

texts: I'm trying to change the mode-line face box attribute to be the same color as the evil emacs state face, obviously updating it each time the mode changes. I've seen some things about using a post-command-hook, but frankly am not sure how to do so. I'm using spaceline, so hopefully there would be a way to get the current evil state face as well, or else it would get even messier. I'm not sure if such a thing is even possible.


texts: does advice :around always have to pass a list of args?

texts:
I'm new to elisp, and I'm struggling to figure out how to do advice.  I got my code working, but I'm not sure why.
This is from a real problem that I had digging into markdown mode to add an extra exclusion to spellchecking to its implementation of flyspell-generic-word-predicate---but the details don't matter, so I'll just reduce it to an abstract form to start with, and see if there's an easy explanation... but then I'll provide the full details later, in case my abstract theory of what's going on is wrong.
Consider a predicate function is-foo that takes zero arguments and runs a test against the word at point.
Suppose I decide that the implementation of some library function is-foo is deficient for my purposes, because there's a small, easily testable, class of words for which is-foo returns t but I'd prefer it returns nil.  So I write a predicate function of my own, which also takes no arguments---call it is-bar---which correctly handles the case that is-foo screws up.
And then I decide that the best way to handle matters is to just use advice to wrap is-bar around is-foo such that if is-bar returns nil, the whole function just returns nil; otherwise, it returns whatever is-foo would return.
So here's my first try:
(defun do-better-advice (orig)
 (if (is-bar)
  (orig)
   nil))
(advice-add 'is-foo :around #'do-better-advice)

When I try to actually run the underlying code, what I get is an error about (void-function orig)
However, with the following small change, my code runs correctly:
(defun do-better-advice (orig &rest args)
(if (is-bar)
(apply orig args)))

What I don't understand is why calling apply makes this work?  The documentation for apply says that "apply calls function with arguments" and that "apply returns the result of calling function." But if that's true, then when f takes no arguments, and is passed none (i.e. args above is an empty list), then (f) and (apply f args) ought to evaluate to exactly the same thing.
So why don't they?
nitty-gritty details
In real life, this was an attempt to get flyspell to stop marking pandoc citation references (which begin with an ampersand) as spelling errors in markdown-mode.  The source of the function I was advising, markdown-flyspell-check-word-p is here; as you can see, it is a predicate that takes no arguments. Ultimately, the markdown-mode library just takes markdown-flyspell-check-word-p and binds it to flyspell-generic-check-word-predicate.
My code that failed was:
(defun is-ampersand (s)
(string= "@" s))

(defun not-cite ()
 (save-excursion
  (forward-word -1)
  (let ((result (is-ampersand (string (preceding-char)))))
   (not result))))

(defun not-cite-advice (orig)
  (if (not-cite)
  (orig)
  nil))

(advice-add 'markdown-flyspell-check-word-p :around #'not-cite-advice)

And the specific error I got when I turned on flyspell was Error in post-command-hook (flyspell-post-command-hook): (void-function orig)
But when I simply rewrote to use apply and to pass it a presumably empty list of args, it worked exactly as intended:
(defun not-cite-advice (orig &rest args)
(if (not-cite)
(apply orig args)))

The only reason I actually knew to try apply was because I saw a couple examples of using :around in advice, and they all used apply.  The documentation for around just says "Call function instead of the old function, but provide the old function as an extra argument to function" --- it doesn't say anything like "and also pass around a list of the arguments" or anything like that. Although the quoted bit below I guess means that you can give it a list of args (?).


texts: Set specific TERM variable for only emacs terminals

texts:
I'm using multi-term right now in GUI cocoa emacs on OSX, and it works great in general. However, I'm running into a bit of an issue with my TERM variable. I generally set it to xterm-256color for iterm, but that causes odd behavior with terminal apps like htop in emacs multi-term. However, htop and other terminal apps work perfectly in multi-term when TERM is set to eterm-color.

As a result, I'm wondering if there is any way for me to have xterm-256color as the default coded in my .bash_profile, but have emacs automatically run TERM=eterm-color or a similar command when starting a new multi-term?


texts: Cannot paste text copied from Emacs to synchronous subprocess

texts:
TL;DR
When trying to paste text copied/killed in Emacs to another program while Emacs is waiting for a synchronous subprocess to finish, the target program hangs until Emacs becomes responsive again.
Reproducing the issue
This happens to me especially when running
M-x shell-command git commit.

Kill/copy some text to be used in the commit message inside Emacs.
Run M-x shell-command git commit --all
Try to paste the text.

If the editor registered with git has means for cancelling
the paste (e.g. C-g when using emacs -Q as editor), this
state can be recovered from, but generally the editor
effectively crashes.
Is it possible to fix this behavior? The current behavior
looks like Emacs is not actually putting the text into the
clipboard, but rather a reference to internal state.
This behavior occurs on both Linux and Windows.
Workarounds

Paste the text to a separate program, and cut it there,
before running M-x shell command. This places the text
in a buffer, that is separate from Emacs, which I want
Emacs to do in the first place.

Run the command asynchronously, e.g.
M-x shell-command git commit --all &.


texts: Kill a line deletes the line but leaves a blank newline character

texts:
On deleting a line in Emacs using C-k, Emacs removes the line contents but it leaves a blank newline character. To remove this, I again press C-k.

How can I delete the complete line with no traces left behind in one shot?


texts: auto-complete-mode turns off when I start typing

texts:
I do not remember changing any thing in my auto-complete package settings beside hooking it with html-mode. The mode starts as expected, when I run some C or C++ code but after typing any thing the mode turns off. I get no errors or warnings.

Here is the related code:

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)

;; initialize auto-complete-c-headers and gets called for c/c++ hooks
(defun my:ac-c-header-init ()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers)
  (add-to-list 'ac-sources `ac-source-c))
;; fuction call from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)
(add-hook 'html-mode 'auto-complete-mode)


texts: Org Mode Babel - Interactive code block evaluation in Python

texts:
Similarly to this question I would like to evaluate (in org mode) Python source code blocks containing "input" instructions but I can't find a way to have an interactive evaluation (with user input) during evaluation or to give it some input known in advance (stored in a file for instance).

My constraint is to use explicitly the input instruction since all this should be included in a textbook for students.

Example of code :

#+BEGIN_SRC python :results output
a= input("Value")
print(a)
#+END_SRC

Is it possible to have such an interactive evaluation or to simulate it (by giving to the source code a fake input) ?


texts: Does zetteldeft miss some org-roam functionality?

texts: Has somebody used both packages and could tell me whether zetteldeft misses some functionality of org-roam? Thanks!


texts:
Maybe quite a noob question, but I can't figure out how to display inline eps images in an org file. There is no problem with png (or jpeg, ...) images, but I can't preview eps images.

Here is a minimal example with an R code block that produces a .eps file:

#+TITLE: Images eps

#+begin_src R :results silent :exports none :session *R*
postscript("image.eps")
data(iris)
plot(iris[, 1:2])
dev.off()
#+end_src

#+CAPTION: Plot
[[file:image.eps]]

This MWE can be correctly exported as a PDF file, but image.eps cannot be displayed inside the org file.

I have ImageMagick installed, and I have the following instructions in my init file (edited after NickD's answer):

(setq imagemagick-enabled-types t)
(imagemagick-register-types)
(add-to-list 'image-file-name-extensions "eps")
(setq org-image-actual-width 400)

Here is what I get with those settings, although the file image.eps does exist, and is correctly inserted in the PDF/LaTeX export:

I guess the solution is some additional tweaking related to ImageMagick.

It seems that a similar (old!) question on StackExchange is also unanswered: Org-mode inline .eps images display error. (.eps created by AI ok, .eps created by matplotlib no)

Thanks!


texts: Change AUCTeX behavior inside an environment

texts:
I am using the LaTeX markdown package to insert quick notes in my document. I would like Emacs to switch to markdown mode inside the markdown environment so it for example won't automatically re-indent markdown nested lists.

Here is an excerpt of the latex file:

\chapter{Introduction}
\label{chap:intro}

\begin{markdown}

Here's what'll be in this chapter:
* thing 1
* thing 2
    - aspect A
    - aspect B

\end{markdown}

In this chapter, we describe ...

Is there a way to change Emacs behavior without the need to invoking markdown mode manually each time I want to edit the inside of the environment?


texts:
In ~/.emacs/init.el i have:

(setq org-agenda-files (list "~/org"))

Most of the .org files in that directory have associated .org_archive files with a long history of archived TODO tasks.

When I run org-agenda, it collects any TODO item in the .org_archive files.

Is there a regex type solution to exclude files ending in .org_archive? I've previously identified individual files to include in the agenda view but that's getting a little cumbersome.

The value of org-agenda-file-regexp is:

"\\`[^.].*\\.org\\'"


texts: How to set cider using boot middle ware?

texts:
In Emacs with cider and lein installed, I can M-x cider-jack-in to start clojure repl. I installed boot and would like to switch from lein to boot. How to set cider to use boot middle ware?

(I don't want to remove leiningen right now.)


texts: I want to use RefTex with newclude. In particular I want Reftex to recognize \include* as a legitimate include file command. I've already added include* in Reftex include file command but it doesn't seem to effect anything. In particular I still get empty reference select buffer. When I change \include* to \include, it finds the references. How can I make Reftex recognize \include* ?


texts: How can I configure company-mode to only display candidates after an explicit keypress?

texts:
I've configured the Java layer for my Spacemacs setup and am getting completion candidates using company-mode and the Eclim backend. However, everytime company-complete is triggered, I experience a short but noticable lag, which annoys me quite a bit.

Since I don't really need the autocompletion feature most of the time, I'd be glad if I can set up company mode in such a way that I have to trigger company-complete explicitly using a specific key binding (e.g. C-SPC, since that isn't really needed with evil-mode anyway).

I found no obvious candidate for this config option while browsing the company-* variables, and my Google fu hasn't turned up with any similar discussions so far. Just disabling company-mode using SPC : company-mode works, but triggering the completion using M-x company-complete during insert mode subsequently does nothing (except for printing a message that company was disabled). Same goes for toggling auto completion using SPC t a.


texts: How to start python shell in appropriate working directory?

texts:
If I am editing a python file, and start a python shell using elpy-shell-switch-to-shell the process appears to set the working directory as the containing directory of the file.

However, the file itself is in a subfolder of a git repo. So, I would expect the working directory to be that of the containing .git directory.

I set the project root directory using elpy-set-project-root but that didn't seem to change the behaviour of elpy-shell-switch-to-shell.

What am I doing wrong here?


texts: Bind a function-local variable to an asynchronous lambda

texts:
In wakatime-mode, there are a bunch of process calls that is done by the wakatime-call function. It calls a predefined shell command, so no real magic inside.

Now I’d like to make it a bit more error prone by adding a retry count. However, as this is done by a process sentinel, I have to create a lambda for this. A process sentinel takes two parameters, process and signal.

Question is, is it possible to somehow pass the value of a local (ie. function parameter) variable to a lambda for use, thus converting the lambda into a clojure? I’d prefer to go without moving to lexical binding.

Backquote is not an option (or is it?), as the variable I want to reference is not in the function’s argument list.

Here is the function:

(defun wakatime-call (savep &optional retrying)
  "Call WakaTime command."
  (let*
    ((command (wakatime-client-command savep t))
     (process-environment (if wakatime-python-path
                              (cons (format "PYTHONPATH=%s"
                                            wakatime-python-path)
                                    process-environment)
                            process-environment))
     (process (start-process
               "Shell"
               (generate-new-buffer " *WakaTime messages*")
               shell-file-name
               shell-command-switch
               command)))

    (set-process-sentinel process
                          `(lambda (process signal)
                             (when (memq (process-status process) '(exit signal))
                               (kill-buffer (process-buffer process))
                               (let ((exit-status (process-exit-status process)))
                                 (when (and (not (= 0 exit-status)) (not (= 102 exit-status)))
                                   (error "WakaTime Error (%s)" exit-status))
                                 (when (= 102 exit-status)
                                        ; If we are retrying already, error out
                                   (if retrying
                                       (error "WakaTime Error (%s)" exit-status)
                                        ; otherwise, ask for an API key and call ourselves
                                        ; recursively
                                     (wakatime-prompt-api-key)
                                     (wakatime-call savep t)))))))

    (set-process-query-on-exit-flag process nil)))

The goal is to access savep and retrying in the process sentinel’s lambda/closure.


texts:
If I try to open an larger imap group (a few thousand messages both read and unread) Gnus gives a warning:
Wrong number of arguments: #, 2
And the Summary window is empty or it contains only some of the messages.
Compile Log shows:
Warning: ‘not’ called with 2 args, but requires 1
If I limit the number of messages to fetch to e.g. 200 (C-u RET) it works fine. Limiting to 500 triggers the same warning.
The problem shows up with different imap servers, both for emacs 26 and 27.
The gnus config is fairly basic, just nnimap sources with gnus-secondary-select-methods and gnus-posting-styles.
imap log shows:
23:56:34 [poczta.agh.edu.pl] 122 UID FETCH 107408,107410,107415,107424:107425,107431,107448:107449,107453,107463,107469:107470,107472:107473,107489,107495,107511,107519,107522,107524,107526:107542,107545:107547,107549:107553,107559:107561,107564,107569:107573,107576,107580,107586,107592,107594:107595,107629,107635:107638,107652:107655,107661,107664,107689,107695,107698:107699,107702,107706,107711,107716:107717,107723,107732,107746,107752:107755,107757,107773,107775,107779....,111987,111999:112015,112017:112050 (UID RFC822.SIZE BODYSTRUCTURE BODY.PEEK[HEADER.FIELDS (Subject From Date Message-Id References In-Reply-To Xref To Newsgroups Cc)])
Any thoughts on how to fix it or what's wrong?


texts: smartparens NOT insert pair of LaTeX quotes?

texts:
Q: how do I get smartparens not to insert a pair of ``LaTeX'' quotes?

The goal

I set up smartparens to insert a pair of quotation marks
unless point is just before a word or just after it, where *
is point:

some text * some more text ==> some text "*" some more text
*some text                 ==> "*some text
some text*                 ==> some text"*

I have it set up for text-mode and org-mode like so:

(sp-local-pair '(text-mode org-mode) "\"" nil
               :unless '(sp-point-before-word-p
                         sp-point-after-word-p))

The problem

LaTeX is goofy with ``double quotes'' and `single quotes'.  That is: double quotes are done with two backticks on the front and two ticks at the end.  This
doesn't work:

(sp-local-pair '(latex-mode) "\"" nil
               :unless '(sp-point-before-word-p
                         sp-point-after-word-p))

The ugly "solution"

After much tinkering, the following works somewhat:

(with-eval-after-load "latex"
  (sp-local-pair '(latex-mode) "`" nil
                 :unless '(sp-point-before-word-p))
  (sp-local-pair '(latex-mode) "'" nil
                 :unless '(sp-point-after-word-p))
  (sp-local-pair '(latex-mode) "``" nil
                 :unless '(sp-point-before-word-p))
  (sp-local-pair '(latex-mode) "''" nil
                 :unless '(sp-point-after-word-p)))

But that seems a little ludicrous for such simple functionality.  It's also far from perfect, in that I get new and sometimes baffling errors from yasnippet, of all things.

The mournful appeal

Am I missing some simple, LaTeX-specific way of doing this?


texts:
When I comment out code with combination of /* and */ in JavaScript nothing happens with text  and it stays the same color. (You can see it in second part of code, one that is not grayed out but is commented.)

I have to use M-; it gets grayed out (this you can see in first part of code).

It gets grayed out if I restart Emacs after commenting it out manually.

Is there way to fix it?
EDIT: If I use // it grays out right away. Only problem is /* and */.


texts: Using company-ispell with large text dictionary?

texts:
I've managed to setup company-ispell which seems to work for small files, but fails for a dump of the aspell dictionary.

This works when pressing C-SPC without any existing text before the cursor.

But when there is some text e.g. wheel, there is no completion found.

However when there is no prefix, there are multiple words starting with wheel in the list.

(use-package company
  :commands (company-complete-common))

(global-set-key (kbd "C-SPC") 'company-complete-common)

(add-hook 'after-change-major-mode-hook
  (lambda ()
    (when (derived-mode-p 'text-mode)

      (company-mode)

      (make-local-variable 'company-backends)

      ;; company-ispell is the plugin to complete words
      (setq company-backends (list 'company-ispell))

      (setq ispell-complete-word-dict
        (expand-file-name (concat user-emacs-directory "aspell_words.txt")))

      (when (and ispell-complete-word-dict (not (file-exists-p ispell-complete-word-dict)))
        (shell-command (concat "aspell -d en_US dump master > " ispell-complete-word-dict))))))

In the *Message* buffer, there is output.

Starting "look" process...
No completion found

Checking the process monitor, there aren't any hanging background processes.

How can company-mode's company-complete-common be used to complete dictionary words?


texts: Disabling a minor mode in a specific buffer

texts:
Running spacemacs 0.200.13 on emacs 25.2.2 on Kubuntu 18.04.

I have globally enabled golden-ratio-mode (a minor mode). But I would like to disable it in a particular buffer, *Org Agenda* to be specific.

I do not want to disable it for ALL org-mode buffers but ONLY for this particular buffer.

How do I get this?


texts: Only edit visible lines in sparse tree view

texts:
Consider the following org-mode document
* Foo
** bar1                            :g1:
** bar2                            :g2:
** bar3                            :g1:
** bar4                            :g2:
** bar5                            :g2:
** bar6                            :g1:

Now I do C-c / m and search for g1. The view will then be
* Foo
** bar1                            :g1:
** bar3                            :g1:
** bar6                            :g1:

as desired.
I would wish to be able to edit those three lines, e.g. by creating a selection and doing C-x r t in order to add foo to all three headings. If I do that, foo will also be added to the hidden headings. Furthermore, for some strange reasons, automatic newlines are inserted, the lines will look like
** foo
bar1                            :g1:

My questions are:

How can I edit several headings at the same time?
Where does that line break come from?


texts: Have markdown-mode render checkboxes as in GFM

texts:
How can I make this:

- [ ] check
- [x] box

render checkboxes, like in GFM? I think the output is something like

<input type="checkbox" disabled> check
<input type="checkbox" disabled checked> box

.

I don't want to use org-mode. I know there is gfm-mode, and I saw this Gist, which shows how to use pandoc to also get GFM-style markdown. However, none of them seems to support checkboxes, unless I am doing something wrong.


texts:
I would like to exclude some headings from numbering in org-num-mode.
Is there a way to achieve this?


texts:
I recently installed emacs 25 on my Windows 7 machine. Things are doing okay in general, but when I want to reach the top of buffer (M-<) or bottom of buffer (M->) it simply inserts the "<" or ">" in the text, as if I didn't press the meta key. Other meta combinations seem to be working fine. On Linux (Debian) it is working just fine.

I tried to google the problem but I haven't found any meaningful results. I don't really know what kind of information should I provide for this, so please ask if you need to know anything more. I am using a non-English keyboard layout, but I also use the same keyboard layout on Linux, and even if I switch to English layout it still doesn't work.


texts: Enable highlighting symbols in prog-mode

texts:
I am trying to configure highlight-symbol mode with use-package for only programming modes. This is what I have:

(use-package highlight-symbol
  :ensure t
  :init
  (add-hook 'prog-mode-hook
            (lambda()
              (highlight-symbol-mode 1)))
  (add-hook 'prog-mode-hook
            (lambda()
              (highlight-symbol-nav-mode 1)))
  :config
  (setq highlight-symbol-idle-delay 1.0
        highlight-symbol-on-navigation-p t)
  :diminish highlight-symbol-mode)

However, when I open a .cpp file for example, I see that highlighting is not enabled (the minor mode is not enabled). I have also tried using lambda functions in the hooks to pass a non-nil argument, but that does not help. Invoking, M-x highlight-symbol-mode on the buffer works as expected.

Any suggestion is appreciated.


texts:
In C++ mode there is the following behavior of the indentation:

Why is this happening? How can I fix it?


texts: How catch the minibuffer message when saving, and colorize it? (Only for savings)

texts:
You could colorize the message in the minibuffer with

    (message (propertize "foo bar" 'face '(:foreground "green" :weight bold)))

I would apply this only to the confirmation message of writings. The green color will help me to clearly distinct errors and confirmations from the minibuffer.

However, the confirmation message is different every time. So the confirmation message in the minibuffer could be like :

Wrote C:/foo.el

or

Wrote C:/bar.el

When searching around on Emacs Stackexchange, there are various ways to surpress or display another message. But they assume it's a static string message. It's not. The message differs each time, it's depends from the path/filename where the buffer will be stored.

Is there perhaps any way to recognize it's a write confirmation message, catch it, colorize it, and pass it further to the minibuffer?


texts: Appt desktop notification system for org-mode?

texts:
I'm on Linux and I've been trying to set up a reliable notification system.

E.g I have a task like this:

* TODO submit weekly report
  SCHEDULED: <2014-03-04 WED 16:30>

I would like a reliable notification to appear at 16:30, preferably a lib-notify one.

Thus far, I have read and tried:
http://article.gmane.org/gmane.emacs.orgmode/5806
http://article.gmane.org/gmane.emacs.orgmode/5271
http://www.emacswiki.org/emacs/ToDoChiKu

I had a little bit of success with ToDoChiKu, in the sense that I had a notification pop up on a scheduled event, but it didn't seem to come up for every scheduled event. e.g when I rescheduled a task a new reminder didn't pop up.

Does anyone have a working notification system that they would be willing to share? (linux)

[EDIT]
I got something semi-functioning going. I had wrong configs in my warning and interval timings and my hooks weren't working well.

In all of the examples, the appt-time-msg-list was updated in different situations. For one guy when he saved his file, for another when he reloads (but not loads) the agenda etc..
By merging all hooks, I made it more reliable.

I'll test-drive my solution for a couple of days and if it works well I'll post in here.

But if you have a working solution, please feel free to post.


texts:
I'm using pdftools when displaying pdfs and it would be nice if emacs could bookmark the pdf with the default filename when I kill that buffer. I've got something like this, but it doesn't work.

;; Set a bookmark on kill
(add-hook 'kill-buffer-hook `bookmark-set)

UPDATE

I've remarked out all my configuration apart from the add-hook line above. When I open up a pdf file which I want to test with bookmarking on exit I get the following error;

bookmark-buffer-file-name: Buffer not visiting a file or directory
Making completion list... [2 times]
File Linux-Voice-Issue-027.pdf is large (73.0M), really open? (y or n) y
File mode specification error: (error "Buffer not visiting a file or directory")
bookmark-buffer-file-name: Buffer not visiting a file or directory

UPDATE

After putting the code 'chen bin' has suggested I'm getting a lot further. However now when I commit a change using Magit I get the following error and the commit buffer doesn't close, although the commit happens.

Type C-c C-c to finish, or C-c C-k to cancel
Saving file /home/map7/testgit/.git/COMMIT_EDITMSG...
Wrote /home/map7/testgit/.git/COMMIT_EDITMSG
string=: Wrong type argument: char-or-string-p, nil
Git finished
(No files need saving)

UPDATE

I now understand that I also need to test if my buffer file I'm closing has an extension.

(defun kill-buffer-hook-setup ()
  (if (and buffer-file-name
           (file-name-extension buffer-file-name)
           (string= (downcase (file-name-extension buffer-file-name)) "pdf")
           (yes-or-no-p "Set bookmark with current file name?"))
      (bookmark-set (file-name-nondirectory buffer-file-name) nil)))
(add-hook 'kill-buffer-hook 'kill-buffer-hook-setup)


texts: flymake python pep8 error messages disappeared

texts:
I setup flymake with pep8 to validate style of python files
with the following configuration:

(when (load "flymake" t)
 (defun flymake-pylint-init ()
   (let* ((temp-file (flymake-init-create-temp-buffer-copy
                      'flymake-create-temp-inplace))
          (local-file (file-relative-name
                       temp-file
                       (file-name-directory buffer-file-name))))
         (list "pep8" (list "--repeat" local-file))))

 (add-to-list 'flymake-allowed-file-name-masks
              '("\\.py\\'" flymake-pylint-init)))

(defun my-flymake-show-help ()
  (when (get-char-property (point) 'flymake-overlay)
    (let ((help (get-char-property (point) 'help-echo)))
      (if help (message "%s" help)))))

(add-hook 'python-mode-hook
      '(lambda() (flymake-mode)))

It worked fine from the start. I just evaluated it in a scratch buffer
and worked for several weeks, then I suddenly closed Emacs and
after that restart messages are not shown when you navigate to
a problem line, but these lines are still highlighted.

(message "DDD") - works

pep8 works fine too in a terminal

Any ideas? I think I forgot some step.


texts:
I want to use lintr to check R-files in emacs.
According to https://github.com/jimhester/lintr#emacs

  lintr is fully integrated into flycheck when using ESS. See the installalation documentation for those packages for more information.

So per http://ess.r-project.org/index.php?Section=download I installed ess(version 17.11-2) via sudo apt-get install ess (I'm on ubuntu), and for flycheck I installed flycheck via MELPA.

Upon restart ESS is loaded automatically when opening an *.R file, for flycheck I type M-x flycheck (for simplicity, I didn't put the usepackage line in init.el)

On M-x flycheck-buffer nothing happened and M-x flycheck-verify-checker said that the library wasn't present, so I installed lintr as install.packages("lintr") in an R shell.

Now M-x flycheck-verify-checker r-lintr is all green:

 r-lintr
   - major mode:    `ess-mode' supported
   - may enable:    yes
   - predicate:     t
   - executable:    Found at /usr/bin/R
   - lintr library: present

Flycheck can use this syntax checker for this buffer.

With M-x flycheck-buffer you can see that it is working (there"s an * next to FlyC in the status bar) but ulimately nothing is found, while in an R shell lintr::lint("myfile.R") finds a lot!

Versions:
GNU Emacs 25.2.2
Ubuntu 18.04.3 LTS

Progress:

Philopolis' answer:

1)
flycheck is now loaded automatically, but still errors are not found

2) the ess in Melpa is Incompatible because it depends on julia-mode-0.3 (not available) I'll look into that, Unable to install ESS package seems promising.
I've added Melpa stable and installed ess, but to no avail: While in other languages flycheck complains about trivial stuff like to many/view  spaces, in R superfluous parenthesis go unnoticed.


texts: importing old plain html posts in the new org-publish blog

texts: I am switching to orgmode based blogging using plain org-publish. some of my old posts contain, ipython notebooks, and some html posts, is there a way to keep them in the same blog using org-publish?


texts:
When I enter magit-blame it shows the following lines.
jihae                2020-04-07 14:51 불필요한 파일 삭제, yarn 빠진 부분 추가, public path

Eugene Kim           2020-06-04 17:50 config
process.env.__DEV__ = isEnvProduction
Eugene Kim           2020-03-14 21:43 web start

Although the process.env.__DEV__ = isEnvProduction line is added by jihae
If I do magit-blame-addition on the process.env.__DEV__ = isEnvProduction the lines change to the following
jihae                2020-04-07 14:51 불필요한 파일 삭제, yarn 빠진 부분 추가, public path
const isEnvDevelopment = process.env.NODE_ENV === 'development'
const isEnvProduction = process.env.NODE_ENV === 'production'

process.env.__DEV__ = isEnvProduction
Eugene Kim           2020-04-09 15:07 __DEV__

I'm trying to understand what magit is telling me,
on first invocation, the line in question is added by Eugene Kim and if i do magit-blame-addition (not sure what exactly it does) it shows the line is added by jihae.
What is going on?
Additionally, if I do magit-blame-quit multiple times after the magit-blame-addition, I end up with modified file content that I'm visiting..
(From file A, if I do magit-blame, magit-blame-addition, magit-blame-quit, mgit-blame-quit, file A is different from what I started with..)


texts: How can I always open a file with a certain coding system?

texts:
I'm trying to open the edict2.gz file from http://www.edrdg.org/jmdict/edict_doc.html which is a japanese->english dictionary so first I changed the extension to .txt. Currently there are many characters represented as \217\264\321 for example instead of the actually kanji character.

Next I try M-x revert-buffer-with-coding-system and different coding systems such as utf-8 (doesn't help at all), japanese-shift-jis-2004 (helps but there are still a few characters left as \362 etc, so I think this is out of date, and japanese-iso-8bit works! (is this the right one to use?)

How can I always open this file with the proper coding system so that I don't have to run the M-x revert-buffer-with-coding-system each time? Is there a special file ending (.jp or something) that will automatically invoke that coding system? I plan to parse it later similar to how Josh does it in his presentation here https://www.youtube.com/watch?v=uraPXeLfWcM


texts: How does process-environment get initialized and why would it be different from initial-environment?

texts:
I'm trying to troubleshoot an issue with my exec-path. It contains a couple of paths prepended to it that I don't want. initial-environment contains the paths that match what I see when I echo $PATH in xterm but process-environment contains a couple extra and I can't figure out how they are getting there.

I've tried setting a watcher withdebug-on-variable-change at the start of my init.el file, but by the time the watcher gets triggered, process-environment already has those 2 garbage entries. Can I set that watch before Emacs launches?


texts: Use shift-up/down keys to mark/unmark lines in dired?

texts:
The default in dired is to mark files and folders with m, and to unmark them with u. Instead of this, I'd rather like to use shift-up and shift-down for marking or unmarking lines (in a DWIM fashion). So shift-up would mark/unmark the current line and move the cursor one line up.

This is nothing particularly fancy, I guess, and I would preferably use something already built in into dired or provided by some extra package. But I haven't come across something like this so far.


texts:
I'm using PingFang SC for Chinese characters in spacemacs

   dotspacemacs-default-font '(("Fira Code"
                            :size 14
                            :weight normal
                            :width normal
                            :powerline-scale 1.1)
                           ("PingFang SC"
                            :size 14
                            :weight normal
                            :width normal
                            :powerline-scale 1.1))

in org-mode, the normal Chinese character is displayed with the right font

             position: 6042 of 9361 (65%), column: 3
        character: 文 (displayed as 文) (codepoint 25991, #o62607, #x6587)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x6587
           script: han
           syntax: w    which means: word
         category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
         to input: type "C-x 8 RET 6587"
      buffer code: #xE6 #x96 #x87
        file code: #xE6 #x96 #x87 (encoded by coding system utf-8-unix)
          display: by this font (glyph code)
mac-ct:-*-PingFang SC-normal-normal-normal-*-14-*-*-*-p-0-iso10646-1 (#xDC8)

but bolded one *文* fall to another font,

             position: 6046 of 9361 (65%), column: 3
        character: 文 (displayed as 文) (codepoint 25991, #o62607, #x6587)
preferred charset: unicode (Unicode (ISO10646))
code point in charset: 0x6587
           script: han
           syntax: w    which means: word
         category: .:Base, C:2-byte han, L:Left-to-right (strong), c:Chinese, h:Korean, j:Japanese, |:line breakable
         to input: type "C-x 8 RET 6587"
      buffer code: #xE6 #x96 #x87
        file code: #xE6 #x96 #x87 (encoded by coding system utf-8-unix)
          display: by this font (glyph code)
mac-ct:-*-Arial Unicode MS-bold-normal-normal-*-14-*-*-*-p-0-iso10646-1 (#x3816)

how to control this?


texts: Bindings for source code when debugging in gdb/gud

texts:
We can define a bunch of bindings for gud-mode through gud-mode-map. But it seems these bindings only hold when the active window is one of the dedicated gdb windows (or simply the comint window if you're not using many-windows).

I can't find any keymap that is active for the source code being debugged -- the only minor mode that seems to be active is gdb-many-windows-mode. That does not have a keymap however. So I tried redefining it:

(define-minor-mode gdb-many-windows
  "Redefine many windows to include a keymap"
  :global t
  :group 'gdb
  :version "22.1"
  :keymap my-customized-gdb-mode-map
  (if (and gud-comint-buffer
           (buffer-name gud-comint-buffer))
      (ignore-errors
        (gdb-restore-windows))))

But then I realized this is an always-active global mode. So how would I go about customizing keybindngs that are active for the source buffer??


texts: How do I force re-evaluation of a defvar?

texts:
Suppose I have an Emacs lisp buffer that contains:

(defvar foo 1)

If I call eval-last-sexp or eval-buffer, foo is bound to 1. If I then edit this buffer to:

(defvar foo 2)

eval-last-sexp and eval-buffer do not re-execute this line, so foo is still 1.

This is particularly challenging when there are multiple such statements and I have to track down which lines are not being re-evaluated.

I looked at just restarting Emacs and then (require 'foo), but then I have to be careful to avoid loading any older .elc files.

How can I be absolutely, positively sure that the variables and functions defined in the current file are in the same state as loading code afresh in a new Emacs instance?


texts: Is it possible to show a breakdown of actual clock intervals in a clock table?

texts:
The clock table is great for an overview of what I did over the day/week. But I would also like to see when in the day I performed the specific task.

It would be great if I can see the actual clock entries for the day/week in the clock table overview as well, similar to what I see in the agenda log view. Having them in two separate views is a bit inconvenient.

Using the :timestamp t option shows all sorts of other timestamps, just not the actual CLOCK timestamps...


texts: Evil - don't yank with only whitespace to register

texts: How can I configure Emacs in Evil mode to delete an empty line (d d)  without copying it but still copy it when deleting a non-empty line?


texts: EMMS is not displaying tag info with libtag

texts:
EMMS seems to be completely unaware of any tag / metadata in my music files.  I tried configuring it with mp3info (I no longer want this anyway), and now with libtag, checking that they work in command line, and I have deleted and recreated the cache at "~/.emacs.d/emms/cache" to no avail.  The emms-browser categorises everything as misc and seems to know nothing more than the file names.

I'll detail my configuration.

My init.el has

;;emms configuration
(require 'emms)
(require 'emms-setup)
(emms-all)
(emms-default-players)
(setq emms-source-file-default-directory "/Volumes/Seabeam HD/Music/")
(require 'emms-info-libtag)
(setq emms-info-functions '(emms-info-libtag))
(autoload 'emms-smart-browse "emms-browser.el" "Browse with EMMS" t)
(global-set-key [(f7)] 'emms-smart-browse)

and I installed emms from elpa.  I also cloned the emms git repo and did

make emms-print-metadata

and put the binary in my path and tested it  (I also did sudo make install from here, and hopefully did not mess things up now that I'm running off the elpa version).  It prints id3 tags and other metadata as expected.  In installed mp3info from macports and tested that too.  Reads id3v1 tags, as expected.

Now, I'm using GUI Emacs.app, so I have exec-path-from-shell to ensure that emacs finds commands it needs.

EMMS makes a directory, "~/.emacs.d/emms/" where it stores history, cache, etc.  I deleted this after setting things up for libtag and have also restarted emacs.

I've read the manual and this other emacs.SE on it...


texts: How to jump from "Emacs Command History" to "Emacs Commands" in helm

texts: I'm using Prelude. When I press M-x, I get helm-M-x. Recently I've used query-replace-regexp. Now when I type "replace-regexp", it automatically reaches for element in my history. There is separate section for commands below, where my beloved replace-regexp is, but I don't know how to reach it. How can I get in there and use the command I want to?


texts: osx - disable left option/command key, enable right option

texts:
I'm learning Emacs. On my Macbook, I have in keyboard settings:

Capslock and Ctrl key swapped
Option and Command key swapped

Emacs commands like ctrl-r, ctrl-s work fine for me (obviously I use them in the shell).

However my left hand is starting to hurt from too many M-x commands, so I want to:

disable left option and left command keys (to force me to stop using them)
enable right command or option for meta

I have put the following in my ~/.emacs.d/init.el. I started the tutorial, when I enter command-v or option-v to scroll backwards, text gets pasted into Emacs.

How do I fix my configuration?

(setq ns-option-modifier      'none
      ns-right-command-modifier 'meta
      ns-right-option-modifier 'super
)

; notes:
;
; ns-alternate-modifier
; ns-command-modifier
; ns-control-modifier
; ns-function-modifier
; ns-option-modifier (just a different name for ns-alternate-modifier)
; ns-right-alternate-modifier
; ns-right-command-modifier
; ns-right-control-modifier
; ns-right-option-modifier
;
; 'control, 'meta, 'alt, 'super, 'hyper or 'none


texts: Which hooks guarantee proper (re)displaying of windows after windows configuration is changed?

texts:
I'm writing a simple minor mode (for personal use) which dynamically sets fringes according to current window width. I added a dedicated function to those hooks:

window-configuration-change-hook
window-setup-hook
switch-window-finish-hook
kill-buffer-hook

as well as to pre-redisplay-function and it works quite fine.

But there are external packages or in-built Emacs functions which pop up a buffer in other window (e.g. *help* buffers or magit diffs buffer) with focus remaining in current buffer and those buffers are not displayed properly (meaning: according to my intention) unless I switch to them and they gain a "selected window" status.

Is there a hook which controls redisplaying those "automatic" guests in the frame or, even better, a hook which would loop over all active windows after any change of windows configuration?


texts:
I want to add Russian holidays to variable holiday-local-holidays formatted like:

((holiday-fixed 1 1 "New Year's Day")
 (holiday-float 1 1 3 "Martin Luther King Day"))

Is there any list I can use or do I need to start from scratch?


texts:
When using Org-mode 8.2.10, setting the header-args property does not seem to work as expected with  Common Lisp code blocks. The following does not tangle the code blocks in the file:

#+PROPERTY: header-args :tangle yes

Specifying the language explicitly, however, does work:

#+PROPERTY: header-args:lisp :tangle yes

According to the manual, header-args without a language specifier should work for all code blocks, not just those for Emacs Lisp (which is presumably the default, and what I have working in my init file).

Is this expected behavior, or a subtle bug?


texts:
I recently been having some troubles with Emacs Org mode, since I updated my system. I am a casual user and use Org for agendas and note-taking throughout the day.

The issue is that sometimes pressing Enter/Return key does not create new line (when the cursor at the bottom of an agenda). Also, the underlines from the date drag into the text. I am attaching an image to make sense of what is happening.

Below is a message from the Messages buffer

  org-element--cache-find: Wrong type argument: avl-tree-, [cl-struct-avl-tree- [nil nil nil 0] org-element--cache-compare]

What could/should I do to bring back the system as it was? What is happening here?

edit:
Tired C-u M-x org-reload as suggested in this post. One of the problems, the one with pressing Return key unable to create new lines - was solved. The issue with "underlines from date dragging into text" is still there. There was one observation - if I press space bar quickly after inserting date C-u C-c !, the underlines do not drag.


texts: Personalize indentation for new C++ language features

texts:
I'm starting to use C++-17, and one of the new features is if constexpr, which breaks completely the usual if identation:

int main()
{
    if constexpr(true) {
            return 1;
        } else {
        return 0
            };
}

and without the brackets:

int main()
{
    if constexpr(true)
                    return 1;
    else
        return 0;
}

Does anyone knows how to fix it? Even a dirty trick like telling emacs to treat the pattern if constexpr as equivalent to if is enough.

NOTE: I've discover the c-noise-macro-names variable, but I don't know even how to add an element to it (I've tried with add-to-list push, and setq, because it seems that it initially doesn't exist, without success).


texts: How can I match a tab not at the beginning of a line?

texts: In Emacs, when using M-x replace-regexp, how can one specify matching a tab which is not at the beginning of a line? I know how to match a tab which is at the beginning of a line by using ^, but don't know how to do the opposite.


texts:
I wish I could run code from one emacsclient session inside other. I'm working in terminal via ssh, terminal has two panes connected to machine with emacs via ssh, each pane has its own emacsclient connected to server on the same machine, and I wish I could call function from one pane with first emacsclient so it will be evaluated in other emacsclient from other pane.

Is there some mechanism available for that? As far as I know emacsclient communicates with server via socket, can I manually add commands to that socket?

If not, maybe I can write for some file so that each emacsclient watches that file and if emacsclient ID (is it frame ID?) maches with command - simply execute text in file as command? Is there some workaround for that?


texts:
I use elpy with:

(setq python-shell-interpreter "/usr/bin/python3")
(setq elpy-rpc-backend "jedi")

I need now to work on a virtuaelnv. If I start it in a terminal and then edit the source code with emacs, elpy does not pick up the virtualnev.

Looking at the documentation I'm confused: do I need pyenv (and pyenv-mode?) or anything else?


texts: Emacs-26 Big Sur (Intel) 11.2 - make fails error 137 macroexp.elc

texts:
Xcode: 12.4.0.0.1.1610135815
CommandLineTools: 12.4.0.0.1.1610135815
I've exported CC=clang, but I can't get the emacs-26 branch to compile on my Big Sur Intel machine.
See gist here
.autogen.sh and configure complete without errors.  The make is throwing the error.
FWIW, version 28 and version 27 compile and install without errors.


texts: Create term horizontal split that is 20% size keybinding

texts: I'd like a keybinding that can create a term buffer in a 25 percent split. What I mean by that is, with a specific keybinding like SPC t c, I'd like to open up a terminal in a split.


texts:
I very often create tasks that have no content but only consist of the TODO headline itself plus a SCHEDULED or DEADLINE so they will appear on my agenda. But for some tasks, I add some additional info (telefon numbers or whatever).

I'd like to have a small indicator similar to the ellipsis "…" in normal org buffers to remind me that I put additional notes below that heading. Perhaps an indicator like (5) for an entry that has five lines of text. This should not count the "SCHEDULED:" line, otherwise, each and every line will have that indicator, making it useless.

org-agenda-entry-text-mode shows the first few lines so obviously there is information about the content acessible.

So is there a simple setting for this or something similar I simply didn't find, or can anyone provide a general idea where to start if I wanted to set this up myself?

Thanks, Jan


texts: How can I prevent empty lines between lists from causing org-mode to insert blank lines before new items?

texts:
Here is an illustration of the problem:

 - First item. Pressing M-RET...
 - Another item at the correct position. Now a blank line:

 - Next item after blank line. Now press M-RET again...

 - .. but now I'm down here!


texts: How can I use the PROPERTIES drawer with a TAGS property and asign multiple values to it

texts:
In org-mode long header line and multiple tags sometimes makes the overview unreadable.

My question is: Can I use the TAGS property in the PROPERTIES drawer to list tags as values rather then having them in the header line. Alternatively but less desirable assign multiple custom_ids or equivalent, with a list of values.

The goal is to hide the tags from the overview but still have them searchable.

What I have tried:
I was naively thinking that the tags property could substitute the header line tags and to list tags here instead.
The result of using C-c C-x p and trying to input TAGS value pair results in an error
org-entry-put: The TAGS property cannot be set withorg-entry-put'`.

Manually trying to input a TAGS entry with a value works but the tag is not searchable by the two methods I tried, C-c / and C-c \ p.


texts: Change line number format with line-number-mode

texts:
With linum-mode, you could change how the line numbers appears by customizing linum-format.

line-number-mode appears to have replaced linum-mode, and indeed it is better (for one thing, it correctly right aligns the line numbers). However, I can't find any formatting options.

What I would like to do is

Remove the empty space before the line number
Replace the space after the line number with ⎢.

(Note that I use terminal emacs)

I used to do this by setting linum-format to %d⎢.

If there aren't any formatting options, can I at least remove the left vertical column and change the character used, or if that's not possible, set a face for the right one?


texts: Matching against variable keys in `cl-case`

texts:
In cl-case clauses (though naturally not the initial keyform), keys are apparently quoted:
(let ((mark ?.))
  (case mark
    (mark 'mark)
    (?. ?.))) ; 46 (?.)

(let ((mark ?.))
  (case 'mark
    (mark 'mark)
    (?. ?.))) ; mark

My reading of neither the cl-lib manual nor CLHS entry for case describe this behavior. Is this the intended behavior of cl-case? If so, is this behavior documented? Is there a succinct way to match the keyform against a variable in a cl-case (as opposed to using a cond)?


texts:
I am a newbie to Emacs Lisp. started Emacs and the *Compile-log* buffer shows the following logs which I don't have much clue of. I was trying to install Magit and Helm.

should anything in this log be concerning?
are the installations successful?
if possible, what does the log mean?

    Leaving directory ‘c:/Users/user/.emacs.d/elpa/with-editor-20200204.1828’

    Compiling file c:/Users/user/.emacs.d/elpa/with-editor-20200204.1828/with-editor.el at Fri Feb 14 09:11:47 2020
    Entering directory ‘c:/Users/user/.emacs.d/elpa/with-editor-20200204.1828/’

    In with-editor-finish:
    with-editor.el:347:51:Warning: assignment to free variable
        ‘git-commit-post-finish-hook’

    Compiling no file at Fri Feb 14 09:12:37 2020
    Leaving directory ‘c:/Users/user/.emacs.d/elpa/transient-20200125.1308’

    Compiling file c:/Users/user/.emacs.d/elpa/transient-20200125.1308/transient.el at Fri Feb 14 09:12:37 2020
    Entering directory ‘c:/Users/user/.emacs.d/elpa/transient-20200125.1308/’

    Compiling no file at Fri Feb 14 09:13:05 2020
    Leaving directory ‘c:/Users/user/.emacs.d/elpa/dash-20200119.2310’

    Compiling file c:/Users/user/.emacs.d/elpa/dash-20200119.2310/dash.el at Fri Feb 14 09:13:05 2020
    Entering directory ‘c:/Users/user/.emacs.d/elpa/dash-20200119.2310/’

    Compiling no file at Fri Feb 14 09:13:05 2020
    Leaving directory ‘c:/Users/user/.emacs.d/elpa/git-commit-20200207.1819’

    Compiling file c:/Users/user/.emacs.d/elpa/git-commit-20200207.1819/git-commit.el at Fri Feb 14 09:13:05 2020
    Entering directory ‘c:/Users/user/.emacs.d/elpa/git-commit-20200207.1819/’

    In helm-elisp--persistent-help:
    helm-lib.el:1054:40:Warning: reference to free variable
        `helm--buffer-in-new-frame-p'
    helm-lib.el:1056:38:Warning: reference to free variable
        `helm-persistent-action-window-buffer'

    In helm--prepare-completion-styles:
    helm-lib.el:1385:13:Warning: reference to free variable
        `helm-completion-style'
    helm-lib.el:1392:42:Warning: reference to free variable
        `helm-completion-styles-alist'
    helm-lib.el:1412:1:Warning: Unused lexical variable `helm-completion-style'

    In end of data:
    helm-lib.el:1581:1:Warning: the following functions are not known to be
        defined: ffap-url-p, ffap-file-remote-p, helm-log-run-hook, helm-update,
        helm-get-selection, helm-set-case-fold-search

    In helm-resume:
    helm.el:2760:34:Warning: reference to free variable `helm-marked-buffer-name'


texts:
This weekend I've upgrade from emacs 23 to emacs 24 (with apt-get install emacs24) and that broke some of the regular keybindings.

C-x C-o used to trigger tex-latex-block and C-x C-e used to trigger tex-close-latex-block. The Emacs 24 manual states that these keybindings still work (see section 22.10.2), but instead, C-x C-e triggers Environment type and C-x C-o isn't bound to anything. I've tried to get the old keybindings back through M-x global-set-key RET key cmd RET, but I can't get things to work, even when I restart emacs.
With Emacs 23, I would use C-c C-f to trigger latex, and then C-c C-c to choose between bibtex, pdflatex, dvips, and ps2pdf (this is useful because, depending on the document I am working on, I might want to run either pdflatex alone or a latex, dvips, ps2pdf sequence). Now, C-c C-f isn't tied to anything, and C-c C-c simply doesn't recognize dvips or ps2pdf at all. Again, trying to get the old keybindings back fails.

So, the question here is, how can I get Emacs behaving the way it used to?


texts: Setting up .emacs and user-init-file in Windows 10 GUI and cygwin

texts:
Got a lot to learn in lisp but so far with

  GNU Emacs 25.3.1 (x86_64-w64-mingw32)

  of 2017-09-12

I'm trying to set it all up in Windows 10 to pick up just one .emacs init file but I can't configure emacs properly to see my .emacs file in C:/Users/Adam.

According to How do I set a different location for the dot emacs .emacs file on Windows 7? I put

(setq user-init-file "C:/path/to/.emacs")

in my emacs c:\dev\tools\emacs\share\emacs\site-lisp\site-start.el but this doesn't appear to have any effect.

I guess a simple command that will definitely work would be good to have. Any suggestions?

The main problem though right now is that my attempt to maximize the frame at startup isn't being read or isn't working:

(custom-set-variables '(initial-frame-alist (quote ((fullscreen . maximized)))))
(add-to-list 'default-frame-alist '(fullscreen . maximized))

but it's having no effect and I'm not seeing any errors.

Part of the problem is no doubt the way I start emacs in Windows as opposed to cygwin. I can start it from the windows toolbar with an icon doing:

C:\dev\tools\emacs\bin\emacsclientw.exe -na "" -c

or I can right click files and choose emacs which becomes associated with the file type in Windows.

Just as a note, I'm not able to edit my registry on this corporate computer so I'm unable to do several of the optimisations suggested for launching and running emacs under Windows.


texts: Save place in files but don't move the cursor to the saved position automatically

texts:
I'd like to have a command that moves the cursor to the last position it was in when I left the buffer (either by killing it or by killing Emacs).

I know I can use saveplace.el to save the position for when I visit that file again, but then saveplace also takes the cursor to that position automatically, while I would like to leave the cursor at the beginning of the buffer, and move to the last position only when I want to do it, using a command. (Basically, like `" does in Vim.)


texts: I wrote this command, and it works, but the completions buffer takes a couple seconds to display. Why?

texts:
Using the helper command last-message from another StackExchange question, I wrote and bound an anonymous function to switch to the completion buffer if it exists, and if it doesn't exist but would be created by TAB TAB, create that buffer. The function works as intended, except for one problem... It's really slow at displaying the new buffer when it's created. I was first running it in a Python inferior shell for testing, but it has the same behavior in M-x shell.

The function appears to be as fast as you'd expect (basically instant). If I press C-TAB and hit the down arrow, I immediately see the buffer. However, if I press C-TAB and do nothing, it takes 2-3 seconds for the window to pop up.

(defun last-message (&optional num)
  (or num (setq num 1))
  (if (= num 0)
      (current-message)
    (save-excursion
      (set-buffer "*Messages*")
      (save-excursion
        (forward-line (- 1 num))
        (backward-char)
        (let ((end (point)))
          (forward-line 0)
          (buffer-substring-no-properties (point) end))))))

(global-set-key [C-tab]
                (lambda ()
                  (interactive)
                  (switch-to-completions)
                  (if (string= "No completions" (last-message))
                      (progn (completion-help-at-point)
                             (switch-to-completions)))))


texts:
Is it possible to handle a SLIME/Swank error in Emacs Lisp?

For example, suppose I have a Lisp buffer with a syntax error in it. How can I do something like:

(condition-case nil
        (slime-eval-buffer)
      (error (message "Slime error")))

To handle the SLIME error?


texts: What is the difference between refill-mode and auto-fill-mode?

texts: I tried to read the documentation, but in practice, I could not tell the difference. I feel they are doing the same thing. I can turn both modes on, but I am not sure in what circumstance I need to do so.


texts: Taking action depending on the presence of particular message in the echo area

texts:
I have my proper function to run latex, say my-tex.
Sometimes one should run latex two times to get references right. A message like below in the echo area appears to tell this. How to identify programmatically the presence of this message in order that I run my-tex two times?

You should run LaTeX again to get references right, {14} pages


texts: How to avoid "Unused lexical argument" for condition-case?

texts:
Here's a sample of the code that I have:

(define-error 'unsupported-mode-error "Unsupported mode")
(condition-case e
    (if (eq 'a 'a)
        (message "test")
      (signal 'unsupported-mode-error major-mode))
  (unsupported-mode-error
   (signal (car e) (cdr e)))
  (error
   (message "error")))

With lexical-binding in the current file, I get Warning: Unused lexical argument e warning,
although I'm clearly using e. Is this a bug or a misunderstanding on my part? And how could I
avoid this warning?