texts: Replacing columns in a delimited region of a file

texts:
Suppose I have a section in a file which is in csv form, e.g.

     a1, bbb1,  cc1, ddd1,  ee1
    aa2,   b2, ccc2,  dd2,   e2
   aaa3,  bb3,   c3,   d3,  ee3
    aa4,   b4,  cc4, ddd4, eee4

Then, suppose I want to replace an entire column, say one of the a's, b's, c's, d's, e's with the same value. To make this a little more general, assume I want to do this for any delimiter, not just comma. So, it might be a space or some other character as delimiter.

Furthermore, I want to do this interactively, treating that section of the file as a region using emacs point and mark. I'd also prefer to do this without the assistance of a package. Are there any good approaches using just the standard tools in Emacs? I'm using Emacs 24.3, but I don't want a method that is very version-sensitive.

OPTIONAL EXTRA: To make this even more general, if one could use the same method to replace an entire row with the same value, that would be even better.


texts: In web-mode PHP block in HTML file doesn't syntax highlight

texts:
I'm a emacs beginner, hope this not a stupid question.

Here is the issue: when I open a html file that contains php block, every html thing got correct syntax highlight, but the php block. The web-mode version is 12.2.10, and emacs is 24.5.1. And when I open a php file contains html codes, everything works fine.

The following is my web-mode configuration:

(require 'web-mode)

(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.html$" . web-mode))

(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))

(add-to-list 'auto-mode-alist '("\\.php$" . web-mode))

(setq web-mode-engines-alist
      '(("php"    . "\\.phtml\\'")
        ("blade"  . "\\.blade\\.")))

What else should I do to make this right?

Thanks in advance.


texts: Copy formatted citation from helm-bibtex menu

texts:
I'm hoping to add a function "Copy formatted citation" to the helm-bibtex menu. i.e. When I open helm-bibtex, press tab on an entry and have the option there to copy a full formatted reference. Currently, there are options like "Copy entry to clipboard" and "Insert formatted citation(s)", but not copy a formatted citation to paste somewhere else.

I could do this myself but I'm time crunched and wonder if anyone has already written this function?


texts:
I was completing the python koans in emacs, and I was using a kdb macro to test my changes in a shell buffer and jump back into the python code. I wanted to take the line number of the next error from the shell buffer so that I could leap to it directly, but because the execution took a moment, it killed the previous output instead.

How can I insert a pause into a macro while I'm recording it?


texts: Moving cursor to the middle of the line where it currently is

texts:
Is there a way to define a function that, when called, would move the cursor to the middle (or close to the middle) of the current line, similarly to how we can move it to the beginning and end of the line?

I frequently find myself having to do C-left or C-right multiple times to reach a word that is more to the middle of the line.  I guess that if it were possible to have a function, bounded to a shortcut combination, to allow me to quickly jump close to the middle of the line, then navigation would become quite more efficient to me.


texts:
I have own minor-mode with 2 (for now) user specific variables (string and int). For now they are dropping to default values each emacs restart. Which is not convenient.
How  and where it is better to save them?
For now I found 2 options:

Using savehist-additional-variables function.
Binding hook to kill-emacs-hook and writing it into own file.

Any other option?

To be more precise. My minor mode is running build based on custom build script and one of the variables is a target-name which user does not change while he is working on one target and changing from time to time while switching between modules.

I think savehist-additional-variables will be the best choice in my case.


texts: How do I set latex face attributes in init.el?

texts:
When I try to put

 (set-face-attribute 'font-latex-italic-face nil :foreground green)
 (set-face-attribute 'font-latex-math-face nil :foreground orange)
 (set-face-attribute 'font-latex-script-char-face nil :foreground red)
 (set-face-attribute 'font-latex-string-face nil :foreground red)

into my init.el (green & are variables I have given values), I am told that
'font-latex-... are 'invalid faces'.  this also happens if i try to evaluate
the expressions before having opened a latex buffer.  how am i suppsed to
customize these faces in my init.el?  (i don't want to use custom-set-faces.)


texts: Disable company in eshell when using TRAMP

texts:
company-mode is awesome. It even works in Eshell. However, when I'm cdd into another host, company mode makes Eshell unusable because it's always hanigng waiting for TRAMP.

Is there any way I can enable company-mode in Eshell, but only when the current directory is local?


texts: Why mark by "D" installed packages. I want only update it

texts:
Windows 10 (64 bit), Emacs 25.1

M-x package-list-packges

I want to update all my installed packages. So I press "U". But Emacs mark many of installed package by "D".

What does it mean? Is mean that Emacs will delete this packages. But wan't to delete it.
How update all installed packages?


texts: Default font selection behaves strangely

texts:
After upgrading to Emacs 27.1, my default font changed to adobe courier. I would like to use Anonymous Pro or Inconsolata, but attempts to change it using M-x customize-face RET default fail. I am at a loss to describe the behavior as it seems to me irregular and I am not sure where to begin. Setting it to Anonymous Pro or Inconsolata, which so far as I can tell are in fact installed on my system and go by those names, causes the font to fall back to a serif font that looks like times. I am using the KDE Font Management utility to see what fonts are installed. Running xfontsel to look at which fonts are installed gives a different list, but entering information from it produces indeterminate effects---the font does change, but I can't tell if it's falling back to courier or a default serif font. So far as I can tell, it usually does make the right change, which I can test for instance if I use etl for the foundry and fixed for the family. The emacs font matches what that font looks like in the xfontsel menu.
So---as should be clear---not sure where to begin troubleshooting.
I'm using Emacs 27.1, on OpenSuse Leap 15.2, KDE.


texts: "outline-regexp" doesn't match headings that matches ";;;###autoload"

texts:
The context
Consider this file main.el
;;; Heading no. 1

; This is not a heading
;; This is not a heading
;;;This is not a heading because there is no space after the the ";;;"

;;; Heading no. 2

; This is not a heading

;;;###autoload

; This is not a heading

In an fresh instance of Emacs (emacs -Q), the value of outline-regexp within buffers whose major mode is emacs-lisp is ";;;\\(;* [^  ]\\|###autoload\\)\\|(". Therefore, the following lines are considered headings

;;; Heading no. 1
;;; Heading no. 2
;;;###autoload

After executing (outline-hide-sublevels 4), the content of the buffer is (yes, nothing is shown)

After executing (outline-hide-sublevels 5), the content of the buffer is
;;; Heading no. 1
;;; Heading no. 2

Executing outline-hide-sublevels with an argument equal to 1, 2, 3, ..., 10 doesn't show the ;;;### autoload heading.
The question
Why is outline-hide-sublevels showing all the other headings except the ;;;### autoload heading? Why isn't Emacs recognizing that line as a heading even though it matches the regular expression in outline-regexp?


texts: Custom theme only loads changes every second start-up

texts:
Using Emacs 26.3.
I made a theme file. If I change the theme, then restart Emacs the change is not applied. I have to close Emacs a second time, and then only on the second start up does the change take effect.

init.el:

(load-theme 'foo t)
(package-install-file (expand-file-name "foo-theme.el" user-emacs-directory))

Within the theme:

  ... other stuff ...
  (custom-theme-set-faces
   'foo
        ;; DEFAULT
        `(default ((,class (:foreground "#FFFFFF" :background "#000000" :distant-foreground "#000000"))))

If I perform the following:

Comment out the default face in foo-theme.el
Save foo-theme.el
Close Emacs.
Open Emacs, open foo-theme.el, I see the change is still there but the face change was not applied to the default face (Emacs looks the same).
Close Emacs.
Open Emacs, and now I see that foo-theme has been applied correctly (default face looks as it should), and the my-theme.el file remains the same.

Why does it not apply correctly on the next start up of Emacs? How to fix it to load the theme correctly (maybe it is caching it somewhere)?


texts: How can I get an org-mode outline in a 2nd buffer as a dynamic table of contents?

texts:
When I edit large documents, I would like to see where I'm at by seeing the outline (with no-content) in a separate buffer. Like when you read a PDF file there is a TOC on the left. (see below)

In org-mode it's possible to expand/collapse outline. But is it possible to have a static outline in the left(or right) in a separate buffer so that when you click on the headings, the other buffer moves to that position?

Kinda like this but for org-mode?

[Edit]
The clone-indirect-buffer is very close to what I want. The missing piece of the puzzle is to jump to the same location when clicking a heading/(or any point really).

For this I have tried to write some code: Move to other cloned buffer to same point? (sync position of indirect buffers) (org-mode)

But it doesn't function if content is collapsed. If that can be made to work, then the clone-inderect-buffer is a complete solution to this.

[Edit2 Solution]
The code in the link above and in the answer below combine niceley to solve the jumping back and forth.

;first call 'clone-indirect-buffer'. Then...

;This function works between buffer and it's clone.
(defun my/goto-same-spot-in-other-buffer ()
  "Go to the same location in the other buffer. Useful for when you have cloned indirect buffers"
  (interactive)
  (let ((my/goto-current-point (point)))
       (other-window 1)
       (goto-char my/goto-current-point)
       (when (invisible-p (point))
        (org-reveal)))
)

;This function is a clone-to-buffer jump only:
; It does find the other buffer first thou instead of just jumping to the other
; window as does the function above.
(defun my/jump-to-point-and-show ()
  "Switch to a cloned buffer's base buffer and move point to the
cursor position in the clone."
  (interactive)
  (let ((buf (buffer-base-buffer)))
    (unless buf
      (error "You need to be in a cloned buffer!"))
    (let ((pos (point))
          (win (car (get-buffer-window-list buf))))
      (if win
          (select-window win)
        (other-window 1)
        (switch-to-buffer buf))
      (goto-char pos)
      (when (invisible-p (point))
        (show-branches)))))

(global-set-key (kbd "<s-mouse-1>") 'my/goto-same-spot-in-other-buffer)
(global-set-key (kbd "s-m") 'my/goto-same-spot-in-other-buffer)
(global-set-key (kbd "<C-s-mouse-1>") 'my/jump-to-point-and-show)
(global-set-key (kbd "C-s-m") 'my/jump-to-point-and-show)


texts:
We all use multi-windows in Emacs, and for some projects, I developed a habit of using four windows, one each for a different buffer.

I wonder if I can define a function and when I start to work in a project, it will take the project name as input and set up the working environment like this (using an R project as an example):

Window 1 will always shows the main.R file in the project folder;
Window 2 will always shows the *R-main* process buffer;
Window 3 will shows the project_log.org file in the project folder;
Window 4 is a reference window, shows the dired buffer in the
project folder.

Each window has equal size.


texts: What does 'State xxx cannot be set as an initial Evil state' mean?

texts:
When I try to enter a command such as set number in Spacemacs, I get the error State number cannot be set as initial Evil state.

What is an initial evil state and what does the error message actually mean, ie the implication?


texts:
So apparently org-babel is evaluating python code inside its own function, perhaps when calling the interpreter or to be able to return the #+RESULTS: I guess. How to instruct it to evaluate the same way that the python mode does (say C-c ' and C-c C-c) ?

Example :

#+Begin_src python
from math import *
#+end_src

Evaluating to python3 directly from org spits in Org-Babel Error Output :

  File "<stdin>", line 2
SyntaxError: import * only allowed at module level

Python 2.7 being more permissive, illustrating the situation called for a different example

#+Begin_src python
from Tkinter import *

class MainWindow():
   def __init__(self,parent):
        # the following line stumbles on the problem
        Frame(self , parent)
        pass

Tk()
#+end_src

I'm pretty sure there's an option to bypass the case. What could it be ?


texts: evil & org-time-stamp-inactive at end of line in normal mode

texts:
I use evil (via spacemacs) and I want to insert a time stamp at the end of the current line in org-mode. Alas the end-of-line in evil normal mode is not the same as in vanilla emacs, so that pressing $ and then calling org-time-stamp-inactive inserts the timestamp before the last character in that line.

I can work around this by switching into emacs mode first, but this is unsatisfactory, because in emacs mode I have entirely different key bindings, whereas I try to fully embrace the spacemacs evil defaults.

Any suggestions how to handle this? Perhaps a way to move the cursor one character further in normal mode? A command prefix that forces the execution of the following command at the "true" end of line while not moving the point at all?


texts: Show only major mode in the modeline but keep it clickable

texts: If I use "%m" in the modeline, it shows only major-mode, but it isn't clickable anymore. What other ways are there?


texts:
I took the following from this site.

(progn
 ;; Make whitespace-mode with very basic background coloring for whitespaces.
  ;; http://ergoemacs.org/emacs/whitespace-mode.html
  (setq whitespace-style (quote (face spaces tabs newline space-mark tab-mark newline-mark )))
  ;; Make whitespace-mode and whitespace-newline-mode use “¶” for end of line char and “▷” for tab.
  (setq whitespace-display-mappings
        ;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1)
        '(
          (space-mark 32 [183] [46]) ; SPACE 32 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
          (newline-mark 10 [182 10]) ; LINE FEED,
          (tab-mark 9 [9655 9] [92 9]) ; tab
          )))

The problem is whitespace-mode highlights every position where a space was. How can I disable the highlighting ?


texts: how enable emacs bookmark plus autocompletion

texts:
How do I make the C-x j j prompt dynamically autocomplete?
So when I try "qu" emacs autosuggest "query.rb" from my bookmarks
, without me having to press tab.

Dynamic autocompletion works when I do C-c p f (projectile find file),
so I'm thinking Bookmark+ can be made to behave like that.

sidenote
I don't mind installing new packages - just hope they don't conflict with my current set (ivy projectile magit bookmark+ yasnippet robe expand-region counsel).


texts: Don't reposition Org Agenda buffer when starting TODO

texts:
When I change the state of a TODO item in Org-Agenda (i.e., by hitting t), it repositions the buffer so that that item is at the top of the screen.

I don't want it to do that — I'd rather just keep the buffer where it is (so I can see the entire day view, for example).

Is this configurable?


texts:
I have a multi monitor setup and I typically have two Emacs frames, each filling a monitor.

I use display-buffer-reuse-window (reusable-frames . T) as my only customisation.

One thing bugs me in my workflow, I call next-error a lot and it will move the point to the next error in the compile buffer, and open the bad code in the window that I started in, but the focus remains in the compile buffer!

Is there a way to make the focus change frame when calling next-error? (when it needs to)

Right now I need to type C-x 5 o after every next-error when I'm using two monitors.

I've tried adding advice to go to the other frame after, but it doesn't seem to have any effect.


texts: Accessing HTTPS sites with mac emacs 26.3

texts:
I'm working on a mac (Catalina 10.15.1) and I've recently switched from Aquamacs to GNU Emacs (updated to 26.3 build 1). In Aquamacs, I had no issues accessing https sites, though I'm unable to do this in my current GNU Emacs set up. Whenever I try to open an https website through eww, I'm sent to yahoo.com, which I'm guessing is a default is something goes wrong. I'm able to open all other http websites without a problem.

I've gone through the discussions here on emacs.stackexchange but to little avail. I see that I might need to install GnuTLS for TLS/SSL support for newer versions of Emacs. I installed it through homebrew. Now, when I run M-: (gnutls-available-p), Emacs returns the following:

(ClientHello\ Padding Key\ Share Post\ Handshake\ Auth PSK\ Key\ Exchange\ Modes Cookie Supported\ Versions Early\ Data Pre\ Shared\ Key Session\ Ticket Record\ Size\ Limit Extended\ Master\ Secret Encrypt-then-MAC ...)

Which suggests it's up and running. Per suggestions below, I added the following to my custom file:

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")

Checked with C-h v to make sure the variable was changed, but still getting the same results - all https sites go to yahoo.com.

I'm not terribly agile with programing in general and my question is whether there is some work around or a simple guide to help me figure out how to adjust things to access https sites. Any help would be much appreciated!


texts: how add vertical column to vertical column

texts:
I have column of text like this:

Abba
Foo
Boo
M

and I want to transform it to:

Abba = Abba
Foo = Foo
Boo = Boo
M = M

I can add " = " to end column of text via C-x space and M-x string-insert-rectangle, also
I can copy column via vertical selection C-x space,
but how I paste column to the right of another column?


texts:
When trying to use the LaTeX document class beamer with AucTeX it does not load the template. Emacs reports Symbol’s value as variable is void: LaTeX-hyperref-package-options-list  after loading beamer.elc. How can this be fixed?

If I type \documentclass{beamer} by hand and press C-c C-n, then AucTeX loads beamer (works for the whole Emacs session).


texts: Gnus C-c C-c opens a blank browser window

texts:
I am not able to send any mail from gnus. Upon hitting C-c C-c after writing the mail a blank window opens up in my webbrowser and nothing more happens (in the echo-buffer emacs says Starting Firefox...).
Also the mails showing in the INBOX group is not complete and up to date.

How should i get gnus to send and get mails?


texts: Extra mode line for started todo of org-mode

texts:
I have defined an extra todo keyword started in my org-mode config for tasks that I'm currently working on. I only ever have one task that is in the state started.

Can I display this task in a seperate line above (or bellow) the the mode line?


texts: Emacs without GUI adding extra text to opened files

texts:
Whenever I open a file using emacs without gui (emacs --no-window-system) it modifies the file with the following text:

12;rgb:0000/0000/0000

This text is inserted at the beginning of the file. How can I debug what is happening? How to prevent this from happening?

UPDATES:

This problems appears only when using SSH.

DETAILS:

The error appears in two cases CentOS 5 and CentOS 6.

emacs version 24.5.2

The command I'm using to open the files is: emacs --no-window-system file.txt

The problems happens even when disabling all customizations (How do I troubleshoot Emacs problems?), e.g.: it persists when using (emacs --no-window-system -Q file.txt).


texts: Adapt a function to work when windows are split only vertically

texts:
As @drew asked me to do here I'm asking one question per problem
I'm trying to enable/disable visual-fill-column when there is one window/multiple windows.
(defun my-visual-fill-one-window ()
  (global-visual-fill-column-mode -1)
  (if (one-window-p)
    (global-visual-fill-column-mode 1)
    (global-visual-fill-column-mode -1)))

(add-hook 'window-state-change-hook 'my-visual-fill-one-window)

Could it be possible to adapt this function to work not when there's only one window but when they are just split vertically


texts: How do I turn off electric "double-dollar" insert under auctex?

texts: Inserting a $ symbol in a latex document (in AucTex mode) automatically inserts 2 $s in a row (and then hitting "delete" immediately deletes both). I can confirm that the variable TeX-electric-math is nil. What other variables can be causing this behavior? I'd like to disable it.


texts:
I have a variety of org easy templates. I have a new file template which includes a #+DATE header that I'd like to populate with the current date [at the time the template is called].

The concatenated string I'd like to insert could be printed in the minibuffer using:

(concat "#+DATE: " (format-time-string "%m/%d/%Y"))

I try to implement this in my easy template, however, when I include the following in my config file, emacs will not compile the code:

  (eval-after-load 'org
    '(progn
       (add-to-list 'org-structure-template-alist '("n" (concat "#+DATE: " (format-time-string "%m/%d/%Y"))))))

I'm trying to get an error message (running emacs with --debut-init), but I'm not seeing anything. I ran across this SX thread where the OP describes a problem using concat in org-capture-templates. The only reply is to add a backquote (,) before the concat, so I try this:

  (eval-after-load 'org
    '(progn
       (add-to-list 'org-structure-template-alist '("n" ,(concat "#+DATE: " (format-time-string "%m/%d/%Y"))))))

This is still being ignored, and I'm not seeing feedback from the debugger. Any ideas?

1) How should I fix this?

2) What's the best way to go about tracing this type of problem myself in the future?


texts: Is it a bug that isearch goes into text replaced with a display property?

texts:
The manual says:

  Some kinds of display specifications specify something to display
  instead of the text that has the property. These are called replacing
  display specifications. Emacs does not allow the user to interactively
  move point into the middle of buffer text that is replaced in this
  way.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Replacing-Specs.html

Yet, if I replace part of a buffer with a string:

(put-text-property start end 'display string)

then cursor movement does not go into the replaced part, but isearch does, though isearch is also an interactive command. Is it a bug in isearch?


texts: Wrapper objects / types for Emacs Lisp primitives?

texts:
I'm curious if there's any precedent for wrapper objects or types in Emacs Lisp.  Javascript notably has built-in types that wrap built-in literal types and those objects can largely be used in the fashion of their literal counterpars via the .valueOf() method.  For example:

new String("foo") + ", " + new String("bar")
=> "foo, bar"

Naturally, since they are objects the behavior is not identical to literals and the result may be more or less surprising given the experience of the programmer:

new Boolean(false) || new Boolean(true)
=> Boolean {[[PrimitiveValue]]: false}

Another example, Java has java.lang.Number and similar types, but IIRC doesn't offer any overloading/syntactic sugar.

Edit:
Programmers use these because it affords them something worth the cost of dereferencing the value.  I suggest there's no quality of object-oriented languages that makes them uniquely capable of expressing or employing boxed values and neither Elisp that otherwise makes it incapable of using boxed values.  It's simply a programming pattern and I am asking about prior art in the context of Emacs Lisp.

A wrapped value in Elisp may be as simple as:

(list 3)
=> (3)

Rather than simply being a literal, it is also a generalized variable; it is setf'able, there is a place (cdr) to attach data to your heart's content, separate, but equal values are distinct with respect to #'eq, and even the greenest lisper can unbox the value.  Certainly this implementation is not without its drawbacks and therein lies the crux.  Elisp is quite powerful; many things are arguably Bad™, but I think it's still worthwhile to think creatively about what's possible.


texts: How to show process in another already opened frame?

texts:
I have two frames opened in emacs (one in each monitor, but this is irrelevant). I would like to have a lisp function to switch the buffer in the other frame (in the other monitor), whose focus is in an arbitrary buffer. The buffer I want to switch to in the other frame has a process (say Python) that is already running. When doing this, I want to keep the final focus in the current frame and buffer I ran the lisp function. Only now the other frame will show the buffer with the process. How could I have a lisp function to do that?

Edited: I ended up doing this, but maybe there is a better way

(defun go-to-python-buffer ()
  "Create or visit a Python buffer."
  (interactive)
  (if (null (process-live-p (get-process "Python"))) ; (note that this line is different for python b/c get-process return different types in that case)
      (progn
        (split-window-sensibly (selected-window))
        (other-window 1)
        (run-python))
    (progn
      (split-window-sensibly (selected-window))
      (switch-to-buffer (process-buffer (get-process "Python")))
      (other-window -1)) ) )

(defun go-to-python-frame ()
  "Create or visit a Python buffer in another frame."
  (interactive)
  ;; check if there is a python process already open, if not, start one
  (if (not (stringp (get-process "Python"))) ; (note that this line is different for R b/c get-process return different types in that case)
      (run-python))
  (if (= (list-length (frame-list)) 1)
      ;; if there is just one frame, create another, put the focus, and show the buffer with the python process
      (progn
        (switch-to-buffer-other-frame (process-buffer (get-process "Python")))
        (other-window-or-frame -1))
    (progn
      ;; if there is another frame already open, show the python buffer, and keep the focus
      (select-frame (next-frame))
      (switch-to-buffer (process-buffer (get-process "Python")) )
      (other-window-or-frame -1))))


texts: How to make terminal/shell spawned inside Emacs running on a Mac inherit the environment variables of the native terminal?

texts:
The terminal natively on Mac i.e. spawned through Spotlight or Launchpad, adopts the desired environment variables including the customization in ~/.bash_profile. But when I run Emacs (Emacs.app taken from Emacs For Mac OS X) and spawn shell inside it (using either shell, eshell or term), the shells doesn't adopt the same environment variables as mentioned earlier.
I realize that the shell adopts its environment from the process that launches it and it is because of this that the values of shell's environment variable the same as those of Emac (e.g. (getenv "PATH"))
Venturing inside the content of Terminal.app and Emacs.app did not get me lucky.
How can I automatically get the same environment variable I get in Terminal.app in the shell spawned inside Emacs? And I do not prefer launching Emacs from the terminal.
(I realize that this is too MacOSX-ish and the answers could propose solutions/tweaks that are totally outside of Emacs. But the question concerns Emacs therefore I chose this site)


texts: How to show *terminal* buffers in C-x C-b menu

texts:
Currently, buffers with *names like this* do not bloat my C-x C-b menu, but now that I'm using multi-term it's important to be able to see these buffers and be able to select them (only the ones with terminal emulators preferably, but it is ok if others like *scratch* or *messages* show up).

I'm using this to invoke the buffer menu:

(global-set-key (kbd "C-x C-b") 'bs-show)

Really I don'n know how to engage this issue.


texts:
I want to use minted package in my tex file. It needs the command-line option --shell-escape to allow external pygmentize program execution. How can I add that option to the tex engine?

My related code snippets are

(add-hook 'LaTeX-mode-hook
        (lambda ()
          (setq TeX-auto-untabify t     ; remove all tabs before saving
                TeX-engine 'xetex       ; use xelatex default
                TeX-show-compilation t) ; display compilation windows
          (TeX-global-PDF-mode t)       ; PDF mode enable, not plain
          (setq TeX-save-query nil)
          (imenu-add-menubar-index)
          (define-key LaTeX-mode-map (kbd "TAB") 'TeX-complete-symbol)))

I tried to add (add-to-list 'tex-compile-commands '("xelatex --shell-escape -interaction nonstopmode -output-directory %o %f" t "%r.pdf")), but that doesn't help.


texts: How to display absolute line numbers of a full, widened buffer when narrowing to just part of it?

texts:
This question applies in the context of all line numbering implementations I've tried, including line-number, nlinum, and linum, so I have a feeling that the answer will have something to do with Emacs internals, especially with the abstraction of buffers.

Getting on with it... Let's say I have a buffer with the following content (leading digits represent line numbers, not buffer content):

1 foo
2 bar
3 baz
4 quux

If I were to do a narrow-to-region on the last two lines, I'd end up with a narrowed buffer like this:

1 baz
2 quux

But what I really want is this:

3 baz
4 quux

Is there any way to accomplish that last case?  I'm willing to redefine or advise internal Emacs constructs to get this to work and deal with the consequences as they arise.

EDIT: As pointed out in the comments, this question seems to invalidate my own as a duplicate. Let me add a couple of points that will hopefully add some distinction:

I am most interested in a solution that is agnostic to line numbering package.  Something that will work for line-number, nlinum, and linum without needing to customize each one.
I would also settle for a fix that only works with line-number, as that is the package that I use (given that it ships with Emacs 26.1 and is more performant than the other two options).

If you feel like further edits are necessary, or if voting to close is most appropriate, no hard feelings from me.

EDIT: Thanks for the answers! This is now my line numbering setup:

(defun with-absolute-line-numbers (fun &rest args)
  "Let `line-number-at-pos' always output absolute line numbers."
  (cl-letf*
      ((old-line-number-at-pos (symbol-function 'line-number-at-pos))
       ((symbol-function 'line-number-at-pos)
        (lambda (&optional pos absolute)
          (funcall old-line-number-at-pos pos t))))
    (apply fun args)))

;;; Line numbering config
(if (>= emacs-major-version 26)

    ;; Disregard narrowing when displaying line numbers
    (setq-default display-line-numbers-widen t)

  ;; Same, but for [n]linum
  (advice-add 'linum-update-window :around #'with-absolute-line-numbers)
  (advice-add 'nlinum--line-number-at-pos :around #'with-absolute-line-numbers)

  ;; Use nice formatting for [n]linum
  (setq linum-format "%3d ")
  (setq nlinum-format " %d "))


texts:
I found a weird behaviour with rgrep. The following is tested under emacs 26.3 with emacs -Q.

Evaluate (rgrep "test" "*.org" "~/Org/wiki") gives me a string-match("<C>" nil) error:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("<C>" nil)
  grep-expand-template(nil "test" "\\( -name \\*.org \\)" nil "-type d \\( -path \\*/SCCS -o -path \\*/RCS -o -path \\*/CVS -o -path \\*/MCVS -o -path \\*/.src -o -path \\*/.svn -o -path \\*/.git -o -path \\*/.hg -o -path \\*/.bzr -o -path \\*/_MTN -o -path \\*/_darcs -o -path \\*/\\{arch\\} \\) -prune -o \\! -type d \\( -name .\\#\\* -o -name \\*.pho -o -name \\*.phi -o -name \\*.glob -o -name \\*.vo -o -name \\*.o -o -name \\*\\~ -o -name \\*.bin -o -name \\*.lbin -o -name \\*.so -o -name \\*.a -o -name \\*.ln -o -name \\*.blg -o -name \\*.bbl -o -name \\*.elc -o -name \\*.lof -o -name \\*.glo -o -name \\*.idx -o -name \\*.lot -o -name \\*.fmt -o -name \\*.tfm -o -name \\*.class -o -name \\*.fas -o -name \\*.lib -o -name \\*.mem -o -name \\*.x86f -o -name \\*.sparcf -o -name \\*.dfsl -o -name \\*.pfsl -o -name \\*.d64fsl -o -name \\*.p64fsl -o -name \\*.lx64fsl -o -name \\*.lx32fsl -o -name \\*.dx64fsl -o -name \\*.dx32fsl -o -name \\*.fx64fsl -o -name \\*.fx32fsl -o -name \\*.sx64fsl -o -name \\*.sx32fsl -o -name \\*.wx64fsl -o -name \\*.wx32fsl -o -name \\*.fasl -o -name \\*.ufsl -o -name \\*.fsl -o -name \\*.dxl -o -name \\*.lo -o -name \\*.la -o -name \\*.gmo -o -name \\*.mo -o -name \\*.toc -o -name \\*.aux -o -name \\*.cp -o -name \\*.fn -o -name \\*.ky -o -name \\*.pg -o -name \\*.tp -o -name \\*.vr -o -name \\*.cps -o -name \\*.fns -o -name \\*.kys -o -name \\*.pgs -o -name \\*.tps -o -name \\*.vrs -o -name \\*.pyc -o -name \\*.pyo \\) -prune -o ")
  rgrep-default-command("test" "*.org" nil)
  rgrep("test" "*.org" "~/Org/wiki")
  eval((rgrep "test" "*.org" "~/Org/wiki") nil)
  eval-expression((rgrep "test" "*.org" "~/Org/wiki") nil nil 127)
  funcall-interactively(eval-expression (rgrep "test" "*.org" "~/Org/wiki") nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)
  read-from-minibuffer("Eval: " nil (keymap (9 . completion-at-point) (27 keymap (9 . completion-at-point)) keymap (18 . counsel-minibuffer-history) (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\015" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . minibuffer-keyboard-quit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) t read-expression-history)
  read--expression("Eval: ")
  byte-code("\301\302!\303\010!B\207" [current-prefix-arg read--expression "Eval: " eval-expression-get-print-arguments] 3)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

Then evaluate (rgrep "test" "*.org") gives the same error.
BUT evaluate (rgrep "test") works without any error.
The most weird comes: (rgrep "test" "*.org" "~/Org/wiki") now works correctly.

This is the problematic line in lisp/progmodes/grep.el.


texts: How to understand paragraph-start variable regex

texts:
Problem

When i evaluate the paragraph-start variable in the major mode lisp-mode, it has the following value

"^L\\|[    ]*$"

In emacs the ^L is displayed in red color so I'm not sure if there is some character in between that I could not be displayed properly.

According to the elisp manual paragraph-start is a buffer local variable and is set "to specify that only blank lines separate paragrap" in Lisp mode. However, I don't see how the regex above matches blank line. I would parse the regex above in the following way:

^L\\: This matches lines that begin with L\, since the anchor ^ indicates start of string or line and \\ indicates an escaped \.
| indicates an or joining the regex before (1) and after (3).
[    ]*$: The first part [    ] is a character class containing just the space character (why are there multiple space characters in it?). The quantifier * indicates that the preceding character class, which is only space, shall be matched zero or more times at the End which is indicated by the anchor $.

Furthermore, the emacs (25.2.1) documentation C-hv paragraph-start states that:

  This regexp should match lines that separate paragraphs and should also match lines that start a paragraph

Question

The regular expression (3) should either match the end of a any line, if no white spaces were found, or a string of spaces at the end of each line.

Does (3) match "lines that separate paragraphs"? If yes, why? If not, what does it mean?

Regular expression (1) should only match a line beginning with L\ as far as I can see.

Does (1) match "lines that start a paragraph" If yes, why? If not, what does it mean?

I probably messed up somewhere by misunderstanding either the documentation or the regex. However, a small explanation where I went wrong would be greatly appreciated.

As a reference for the regex matching i used the online emacs documentation.


texts: Problem in writing regular expression for imenu-generic-expression

texts:
I want to use imenu in matlab-mode in emacs. So I add something like

(setq imenu-generic-expression
      '(("Function"
         "\\(function\\)[\n\t ]*\\[?[ ,_A-Za-z0-9]+\\]?[\n\t ]*=[\n\t ]*\\([_A-Za-z0-9]+\\)" 2)
        ("Anonymous Function"
         "\\([_A-Za-z0-9]+\\)[\n\t ]*=[\n\t ]*@[\n\t ]*([, _A-Za-z0-9]+)" 1)))

in a function for matlab-mode-hook.

The matlab function definitions are something like

function y = func1 (x)
end

function [y, z] = func2 (a, b, c)
end

func3 = @(x) sin(x) + cos(x);

The above config results in something like

Function / func1
Function / func2
Anonymous Funtion / 3

after the helm-semantic-or-imenu or ido-imenu commands are launched.

My question is why the regular expression for anonymous function did not capture the function name fun3 as expected but 3?

Any help will be appreciated.


texts:
Is there a function like org-fill-paragraph but can be run for the entire document excluding the SRC and EXAMPLE blocks (for some reason, running org-fill-paragraph in blocks makes emacs quit)?
I would like a basic linter that automatically realigns the document on save.
mark-page then fill-region almost works but then the code blocks are not formatted correctly.


texts:
I have a variable that holds a GIF image

my-image's value is
(image :type gif :data "GIF89a+
[...]

I add it to a buffer and it is being displayed

(insert-image my-image)

But the animation is not being shown. I try to do

(image-animate my-image 0 t)

but the animation does not start either. If I ask the current frame

(image-current-frame my-image)

It always return zero.

How can I start the animation?


texts: how to insert selected candidate in helm buffer into previously selected buffer?

texts:
I'm often in the situation, that I am looking for variables and functions with helm. However when I find whatever I was looking for and I want to use it in my code I close the helm buffer, start typing and try to complete the name with company.

It's really annoying to type again after I already found the candidate I was looking for. So the question is, how can I insert the currently selected helm candidate into the previous buffer ?


texts: Pass variable from src block to org-edit-src-code

texts:
I have a table in org-mode that I want to pass into an R source block and then plot from it. When I write everything in org-mode and execute it, I get the results that I expect.

However, when I enter the ESS editing mode/org-edit-src-code by toggling C-c ' inside the source block, the variable is not used. This is important for complicated scripts where I have to test multiple things and feed multiple variables/tables into the source block.

Here is an example:

#+name: test-table
| Cell | Value |
|------+-------|
|    1 |    10 |
|    2 |    20 |
|    3 |    60 |
|    4 |    80 |
|    5 |   100 |

#+name: test-table-plot
#+BEGIN_SRC R :var test=test-table :results output graphics :exports results :file-ext png
plot(test)
#+END_SRC

If I run this source block, I get the plot I expect. If I go into the org-edit-src-code with C-c ' the table "test" does not exist.

Is this meant to be like this? Is there a way to pass the variable to org-edit-src-code?


texts: How to configure emacs to show documentation alongside completions while using gocode?

texts: I have been using gocode with emacs and it gives completions of functions. Is there any way to get emacs to show the documentation of those functions in a pop up too. I am using auto-complete with go-mode.


texts: Show change log of other branch with vc-git

texts:
When using VC for a Git repository on Emacs 24.3, I want to view commits in a different branch from the one I've checked out.

It seems like C-u C-x v l should be command for that, as it asks Log from revision (default: last revision):, but if I enter origin/master, the *vc-change-log* buffer still shows the revision history of the currently checked out branch, just as if I had used plain C-x v l.

Is there a way to get VC to show the change log for a different branch, or do I need to stick with M-! git log HEAD..origin/master?


texts: Show counsel-ag results in separate buffer?

texts:
I use counsel-projectile for Ivy + Projectile interoperability.

But, when I run something like C-c p s s / M-x counsel-projectile-ag, the results are shown in the minibuffer, and I can't see any obvious way to move them to a buffer.

Is there a way to show these output in a buffer, rather than the Ivy minibuffer? Is it possible to return to a previous Ivy session? Is there a best-practices way to rebind the key to the original projectile-ag behavior?

Thank you!


texts:
I'm not happy with the font used for Japanese characters and would like to change it. I'm using Emacs 27.1 on Ubuntu 20.04.1. I did not have that problem with the last version(maybe the default font changed?).
M-x describe-char I found out that the font used for ASCII chars is:
-DAMA-Ubuntu Mono-normal-normal-normal-*-24-*-*-*-m-0-iso10646-1 (#x44)

the font used for japanese characters is:
-GOOG-Noto Sans CJK KR-normal-normal-normal-*-17-*-*-*-*-0-iso10646-1 (#xA9BD)

With M-x menu-set-font I fount my desired font for Japanese characters:
-GOOG-Noto Serif CJK SC-light-normal-normal-*-24-*-*-*-*-0-iso10646-1 (#xAD03)

But selecting it there sets the font for all characters.
How can I set the font for Japanese characters only (in my init.el)?


texts: org - hyperlink to external image: Function to download it and adjust link to local location?

texts:
I have an org file and buffer named test.org that contains this line:

[[https://en.wikipedia.org/wiki/Emacs#/media/File:Emacs_Dired_buffers.png][myimg]]

I want to put my cursor/point somewhere on this link and then run a function that downloads this png file and adjusts the link to something like this

[[file:img/Emacs_Dired_buffers.png][myimg]]

I use img/ because I prefer relative paths. So I'd like to download the picture to a subfolder which is in the same folder as my org file.

At the moment I can't find a solution.


texts: modify default org babel default headers

texts:
I would like to have more control on the R session in org-mode so that I only have to chage the session name in one place for the modification to affect the whole buffer.
The only way I could think this through was to modify the org-babel-default-header-args.

I want to define a function so that I can modify the default arguments easily. But I don't know how to pass the name of the session as a string. see the code below.

(defun set-session-name (&optional r-session-name r-session-directory)
  (interactive (list
                (read-from-minibuffer "r-session-name: " "*R*" )
        (read-from-minibuffer "r-session-directory: " "/home/test/")))
  (setq org-babel-default-header-args:R
    (cons '(:dir . "%s" r-session-directory))
    (cons '(:session . r-session-name)
          (assq-delete-all :session org-babel-default-header-args:R))
          ))

(:dir . "%s" ression directory "/home/test/") is obviously wrong. Can you help please?

** Some details **
 Let's say that we are in an .org  buffer and I have a buffer wide header like the following. With the session name being remote-R-remote* and the ouput being silenced :output silent

 #+PROPERTY: header-args:R :session *remote-R-remote*  :exports results :colnames yes :results output silent :output-dir images/ :dir "/ssh:gnu:/home/livelygnu/Documents/R/" :eval yes :cache yes

* Some First steps

    #+Name:
    #+BEGIN_SRC R
    do some stuffs
    #+END_SRC

Now if in a subtree we want to produce a certain number of graphs but don't want to write :results output graphics all the time along with the file extension we have to redefine the whole header argument for this subtree.

** output some graphs
:PROPERTIES:
:header-args:R: :session *remote-R-remote* :results output graphics :output-dir: images/ :eval yes :file-ext pdf
:END:

    #+Name: name_of_graphs
    #+BEGIN_SRC R
    plot(a)
    #+END_SRC

    many more graphs possibly

We can do the same for latex output for example

** output some results
:PROPERTIES:
:header-args:R: :session *remote-R-remote* :results output latex :output-dir:
:END:

#+Name: name_of_graphs
#+BEGIN_SRC R
output latex block
#+END_SRC

Now let's say while our estimation is working on the session remote-R-remote (possibly a long computation), we want to continue to work on some graphs in another session. for that we would have to change the :session names for all the code block that we need. But If instead we  modify the default arguments  in org-babel-default-header-args. Then changing the key :session there would change the session everywhere. Of course this mean that we would not have to write :session *remote-R-remote* all the time as well since we can put it as default.


texts:
I want to write a function that starts a timer if timer does not exists or stop it if that one exists. I mean something like:

(defun toggle-mytimer ()
  (interactive)

  (if (timerp TIMER_NAME)
      (cancel TIMER_NAME)
    ;; else
    (run-with-timer 5 5 'princ "Ciao"))
  )

The run-with-timer docstring says:

This function returns a timer object which you can use in ‘cancel-timer’

but I'm not able to find the object name that would be TIMER_NAME in my function. Where am I doing wrong?


texts: Cannot use concat within org-capture template

texts:
I am trying to use concat from within an org-capture template. But I keep getting an "Invalid template" error, so something's not right. Here is my code:

(setq org-capture-templates
    '(("j" "Journal" entry (file+datetree "~/org/journal.org")
      (concat "* " (format-time-string "%H:%M") " %^{Title}\n\n%?"))))

Any ideas?


texts: How to transpose two arguments of a function in Python?

texts:
How I can I swap two arguments in a call to a Python function?

If I put point on the space between these two arguments:

self.assertEqual(json.loads(some.data), json_data)

and then M-t (transpose-words), I get:

self.assertEqual(json.loads(some.json), data_data)

On the other hand with C-M-t (transpose-sexps) I get:

self.assertEqual(json.loadsjson_data, (some.data))

What I want is:

self.assertEqual(json_data, json.loads(some.data))

Is there a command that will do that?


texts:
I have seen progn being used quite a lot as I browse the configuration files of experienced Emacs users. I found this nice explanation of progn, but what I am really curious about is, what is the benefit of using this function? Take for example this snippet (taken from Sacha Chua's configuration):
(use-package undo-tree
  :defer t
  :ensure t
  :diminish undo-tree-mode
  :config
  (progn
    (global-undo-tree-mode)
    (setq undo-tree-visualizer-timestamps t)
    (setq undo-tree-visualizer-diff t)))

Is there any major difference between the above configuration and this?
(use-package undo-tree
  :defer t
  :ensure t
  :diminish undo-tree-mode
  :config
  (global-undo-tree-mode)
  (setq undo-tree-visualizer-timestamps t)
  (setq undo-tree-visualizer-diff t))

I feel like the first example is somehow cleaner, even though it has more syntax, and my intuition is that there might be some kind of performance boost from using progn, but I am not sure. Thank you for any insights!


texts: macos: binding command-plus and command-minus to text-scale-increase and text-scale-decrease

texts: Emacs 26.1: C-h v tells me that command-"+" is "s-+".  how do I then define a properly working (global-set-key "s-+" 'text-scale-increase) ?


texts: how to disable trailing spaces in emacs calender buffer

texts: how to remove the red area that i think related to trailing spaces


texts:
I'd like to remove the following two comments line,

## comments 1
f <- function() {
  ## comments 2
}

I use (search-forward-regexp "^[[:space:]]+##") to search for  "  ##" (the line start with 2 indentation whitespaces followed by ##) and (search-forward-regexp "^##") to search for the line that starts with ##.

How can I combine them into one line of script like below?

(search-forward-regexp "[[:space:]+\|^]##")

This is obvious wrong, according to http://www.emacswiki.org/emacs/RegularExpression; ^ inside of [ ] means negate.


texts:
I want to have a log.org file, in my .../Study/ directory, which lists all the folders, files in the subdirs and hyperlink to them. In that way I can add notes about the files I read and, if I click on a link it opens the file for me outside emacs (pdf, video, etc.).

As I might delete or add files in the subdirs, I want dynamic symbolic links to the updated subdirs structure inside the org file (without compromising the notes taken).

How to get something like that done?


texts: How to suppress LSP message from flickering the minibuffer height?

texts:
I am facing an annoying problem which makes working very unpleasant:
I am using Go LSP (backed by gopls) on Emacs 26.3 (9.0) on Mac.
While working on Go code often a message of the form

LSP :: computing fix edits: /Users/<really-long-filesystem-path>file.go:123:45: missing ',' in composite literal (and 7 more errors)

is displayed in the minibuffer. (The actual error "missing ',' in composite literal" is of no importance, it is just an example.) The problem is the very long file system path: It is so long that the message doesn't fit into one line and the minibuffer is made larger to allow for two lines.

As this message is displayed and removed regularly on very short intervals this lead to some kind of "flickering" of the minibuffer which constantly jumps from 1 to 2 lines height. This is very distracting.

Unfortunately I did not find any configuration option to suppress this message from LSP altogether or to somehow force the message to be 1-line only?

I think I could truncate-lines in the minibuffer but I'm fine with multiline messages in general, it is just the annoying flickering between 1- and 2-line heigh that I want to turn of.


texts: Evil-leader stops working when I eval-buffer

texts:
If I load up emacs and go to my .emacs file (a fragment of which is given below), and I press SPC f or C-c C-f then it does find-file, which is the expected behaviour. However, if I type M-x eval-buffer, or load-file, suddenly SPC f doesn't work, but C-c C-f still does. If I press SPC, it just goes to the next character as it would without evil-leader. What gives?

(require 'evil)
(evil-mode 1)

(require 'evil-leader)
(global-evil-leader-mode)

(evil-leader/set-leader "<SPC>")

(evil-leader/set-key "f" 'find-file)

(x-posted from superuser.com)


texts: Align columns in Org mode table with Japanese fonts

texts:
How can I mix Japanese and English in the same org-mode table (that uses fixed-width fonts)? Something like:

| m m m   m m m |      |
| はどう  デシウ |       |
| ﾊｰﾌ           | ﾊｰﾌ   |

won't align. Emacs simply counts the Japanese characters as one, when indeed they are more like 10% bigger.

Could the width of a column be set in pixels? I know that <10> would set the width, but that does not help, since it counts in terms of fixed-width letters.

The problem is basically how emacs aligns columns (using the font width).


texts: How can I change background and font color in `counsel-M-x`?

texts:
I have following theme configuration for the counsel-M-x, where due to background color some are unreadable.

I couldn't find a way to change their colors, such as on [l]ist- , l is unreadable due to white font color. How could I change the color setup for counsel-M-x?

my setup:
(ivy-mode)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key (kbd "M-x") 'counsel-M-x)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)


texts: Archive TODO by completion date, not archive date

texts: Just spinning up on emacs and org-mode.  Apologies if this is a trivial question, but haven't come across an answer yet after a fair amount of searching.  I have my #+SEQ_TODO set up to record completion dates, and my archive file set as "file"_archive.org::datetree/. When I archive a task in the DONE state, I would like to have it archived to the datetree under a completion date heading, not under the date that I get around to archiving it.  Any help would be appreciated.


texts:
Q: is there a way to center the minibuffer/echo area horizontally?

I use Emacs in a single, very wide frame split into three windows
side by side.  I'm usually working in the center window, with
the other windows showing notes, a REPL, etc.:

+-----------+-----------+-----------+
|           |           |           |
|   notes   | EYES HERE |   notes   |
|           |           |           |
+-----------+-----------+-----------+
| echo                              |
+-----------------------------------+

When I use the minibuffer or get a message in the echo area, the
text is flush with the left side of the frame.  On super wide
frames like the one I'm using, this placement is really
inconvenient.

Is there a way to make minibuffer/echo area text show up in the
center of the frame (i.e., in the middle along the x-axis)?

+-----------+-----------+-----------+
|           |           |           |
|   notes   | EYES HERE |   notes   |
|           |           |           |
+-----------+-----------+-----------+
|            echo here?             |
+-----------------------------------+

In a perfect world, the minibuffer/echo area would start flush
with the left margin of the active window, but I'd be
glad if I could just get the text moved to the middle of the frame.


texts: How to use spell checking in PO mode for gettext translations files?

texts:
I've tried function I use my my Markdown and Polymode when editing my Jekyll blog with po-mode but it don't work at all:

I have code like this:

(defun lang (lang)
  (interactive "sLanguage: ")
  (ispell-change-dictionary lang)
  (flyspell-buffer))

when I run lang polish it process the file but nothing happen even if do error in one the translation.

I was looking at https://www.emacswiki.org/emacs/PoMode

but this don't work.

How can I get error checking inside PO file so I know that I need to edit the entry and fix the error.

It would also be nice to have error checking while editing.


texts: How to use a menu to jump between sections of a document?

texts:
I would like to define my own rules for what a section of a document is, then use this so I can popup a list of sections I can auto-complete or use arrow keys to jump between them.

Take a simple example where sections match against ^SECTION\s(.*), how would this be possible?

eg:

Some Text

SECTION Section One

Some More text

SECTION Section Two

Other text.

How could I make a menu that pops up all sections, and activating the item navigates the cursor to the selected section?

Note that I'm not sure if this question is spesific to ivy.


texts: is it possible to configure my major mode to ensure the presence of whitespace at the start of each line?

texts:
I have a Javascript file which uses the styled-components library to define CSS inside string literals:
var MyComponent = styled.div`
  height: 32px;
  background-color: tomato;
`;

I'd like to use mmm-mode to apply a home-grown css mode to these string literals, in order to get fancy syntax highlighting and better code completion.  I've been able to configure mmm-mode to accomplish this, but the indentation originally present in my string literals is getting clobbered when I add/edit/remove CSS rules (which makes sense; the css major-mode views these lines as having extraneous whitespace at the beginning).
var MyComponent = styled.div`
height: 32px;
background-color: tomato;
overflow: auto;
`;

is there a way to configure my custom css-ish major-mode to ensure the presence of whitespace at the beginning of each line of text it sees?


texts: hebrew fonts have squares around them..how does one fix this?

texts:
After a recent updates hebrew fonts have started to appear with squares around them

Anyone know how to fix this? i tried changing to various fonts with no sucsess

this is my current font setup:

    ; fonts in linux
(if (string= system-name "zlap")
;(add-to-list 'default-frame-alist '(font . "Inconsolata-16"))
;(add-to-list 'default-frame-alist '(font . "Source Code Pro-18"))
;(add-to-list 'default-frame-alist '(font . "Pragmata Pro-19"))
;(add-to-list 'default-frame-alist '(font . "Fantasque Sans Mono 14"))
;(add-to-list 'default-frame-alist '(font . "monaco 19"))
;(add-to-list 'default-frame-alist '(font . "Office Code Pro-18"))
;(add-to-list 'default-frame-alist '(font . "Hack 19"))
;(add-to-list 'default-frame-alist '(font . " mononoki 19"))
(add-to-list 'default-frame-alist '(font . "fira mono 17"))
)

;; fontso in Win
;(if (system-type-is-win)
;(add-to-list 'default-frame-alist '(font . "Consolas-14"))
;)
(if (string= system-name "zbeast")
(add-to-list 'default-frame-alist '(font . "fira mono 23"))

)


texts: I have a kinesis keyboard and would like to have the home key act as super in emacs without requiring me to remap my keyboard as well as edit my key bindings. Is there a simple way of doing this?


texts: How can i tell ibuffer to show me only the useful columns?


texts: Algorithm on deciding splitting vertically or horizontally

texts:
When I do M-x compile, emacs will split my window to launch compilation and show its logs in a new window. As I understand, it has some algorithm to decide how to split the window.

So, when I have just one window with code opened on my big monitor, for some reason, instead of more-convenient horizontal split (showing compile-log side-by-side on the right and code on left), it splits window vertically. How could that be tweaked? Thank you.


texts: why does cdr return a list of one element?

texts:
I have the following code:

(progn 3 4)                ;; => 4
(list 1 (progn 3 4))       ;; => (1 4)
(car (list 1 (progn 3 4))) ;; => 1

I understand these return values.  But why does the following:

(cdr (list 1 (progn 3 4))  ;; => (4)

Return (4) rather than 4?  I would have thought 4, so what am I misunderstanding here?


texts: In helm-bibtex, add folder to file open options

texts: Is it possible to add a folder with the bibtex key to the list of "file open" options? I've tried adding a folder to the File field, this opens a folder in a dired-mode, but if I add a PDF file as well it just opens the PDF file without giving the option to open the folder. I know I can add other files with the same bibtex key wtih additional suffixes, which is great, but sometimes there are too many files and I would rather keep them in a separate folder with the same bibtex key name.


texts: How do you update a minor mode definition as you develop it?

texts:
I started coding a minor mode to provide some keybindings. My initial attempt had a typo:

(define-minor-mode borked-mode
  "A mode defined with a broken key binding"
  nil nil
  '(([b] . 'previous-line)))

I had intended to use the b key, and immediately realized that I should have used "b" instead of [b]. So I redefined the minor mode:

(define-minor-mode borked-mode
  "A mode defined with a broken key binding"
  nil nil
  '(("b" . 'previous-line)))

However, this didn't work. This set me off on a wild goose chase through all the various ways of binding keys (i.e., (kbd ...), [ ... ], etc). Finally I realized that simply re-evaluating the (define-minor-mode ...) form was not changing anything, I was stuck with the original, broken key map. I then tried changing the keymap directly via (define-key borked-mode-map ...) and still couldn't get the corrected keymap loaded. Finally I restarted Emacs, and my minor mode was correctly loaded.

My question is: how do you update a minor mode definition as you develop it? Is there any way to flush a broken definition, or do you have to restart emacs to clear away broken bits?


texts: How to put whitespace into Yasnippet Templates?

texts:
When I create a new yasnippet template using the 'yas-new-snippet' command, I'm unable to get the leading whitespace to show when the template is expanded in a new document or even tested using 'yas-tryout-snippet'.

For example:

interface t1
    description
    no shutdown

Becomes:

interface t1
description
no shutdown

How can I get the leading whitespace to show when I expand?

The snippet is saved as text-mode.

I'm using GNU Emacs24 with a new installation of Yasnippet from MELPA.


texts: annotate jump-to-register location with function name

texts:
I like to use jump-to-register to jump between areas in my src code. IDK if this is built-into emacs but from a spacemacs when I am about to type the register key to jump, a helpful popup comes up which tells me the file and line number to which I am about to jump. (see figure)
However, it would really be more useful if I could get the function name with which I am about to jump inside rather than a line number. Is this possible? I was thinking it might be possible to fill in this info using the functionality in which-function-mode but I am not really sure how to proceed. Any thoughts?


texts: Remove the auto-generated marks from dired buffer

texts:
Upon invoking dired with C-x d, it display

Five of the files have already been marked automatically ,

Consult with the manual of operation on files

Strik U and * u to remove the mark but failed.

How could remove the auto-generated marks

BTW, what's ?? mean?


texts: Automatically quit emacs after git-commit-commit in git-commit mode

texts:
I am using emacs -nw as in-place commit message editor for my git. When pressing C-c C-c in git-commit mode, I want emacs to quit automatically. Currently, .git/COMMIT_EDITMSG is saved, and the buffer is killed. Then I am left with the scratch buffer, so I have to quit emacs manually as an extra step.

My guess would be to either create some macro and bind it to some key, or add some kind of hook to git-commit-commit.


texts:
I would like to export my org file to a different directory than the one containing the base org file. I've tried setting the property EXPORT_FILE_NAME:

:PROPERTIES:
:EXPORT_FILE_NAME: ./export/test
:END:

When I export the subtree that has this property drawer attached with C-c C-e l p, I'm seeing the following (surprising) behavior.

The .tex file is produced in ./export, as desired.
The `.pdf' file is produced in the original directory.

How can I get both the .tex and the .pdf to show up in the other directory?

Here's a MWE of my org file:

#+TITLE: latex org-mode testing

* Exporting to different directory
:PROPERTIES:
:EXPORT_FILE_NAME: ./export/test
:END:

This is the material in the test file.


texts: ps-print-buffer-with-faces with color-theme'ed dark background

texts:
Similar to Change syntax highlighting when doing ps-print-buffer-with-faces

I typically use emacs with a dark background, but I'd like to print my buffer onto a white background (i.e. white paper). I use a color-theme, usually wombat, via M-x customize-theme.

When I call ps-print-buffer-with-faces, I end up with font faces suitable for a dark background, so a lot of the text is unreadable.

Honestly the solution posted in Change syntax highlighting when doing ps-print-buffer-with-faces is unintelligible to me; I only have a rudimentary understanding of elisp. Are there easier fixes? When I alter the color-theme to a light background temporarily, the output ps is unchanged.

Shouldn't there be an easier way for the printer output to preserve syntax highlighting while having colors suitable for a white background?

EDIT: it's all my fault. I had first used C-u M-x ps-print-buffer-with-faces to generate one file. Then as I switched themes and whatnot, I kept on using M-x ps-print-buffer-with-faces, which I thought was just overwriting the .ps file I had initially generated. I now realize you need C-u to prefix the print argument in order to generate a file instead of sending to the printer.


texts: Writing a Question-Answer type book in org-mode

texts:
I am preparing a question bank type book which contains problems as well as answer keys to all the problems. I'm doing this using org-mode. This will be exported to LaTeX PDF for my final book.

However, there is a problem I'm running into. To put it very simply, here is the problem:

Problem

My book will have 2 sections: one containing problems, and the other containing answers to those problems. In org-mode, I have one major heading for Problems, under which I create sub-headings for each new problem. Inside each problem sub-heading, I have another sub-heading which contains the answer to that problem. In my final book, I wish the answers to be in a separate chapter and not directly after the problem. However, in org-mode, I am adding the answers as a new sub-heading inside each problem itself for my own convenience of writing.

Now, I  want to somehow to segregate out the answers' subheadings and push them into new section during my LaTeX export. Can this be done?

Could you suggest some other methodology for writing a question-answer type book, where we have answers in a separate section of the book?


texts:
If I am in no-window-mode (emacs -nw) and type e.g. the word “für” quickly, the “ü” is replaced by other characters. This does not happen in window mode, and it does not happen for any other character preceding the umlaut, only an f.

Quickly: fÃ\274r
Slowly: für

When I try to save, emacs tells me that

  utf-8 cannot encode these: \274

For för I get a \266, and fär creates a \244. The first two characters, fü, write fÃ, and the next character then adds the \274 plus the typed character, like r.

I am using a Swiss German keyboard where äöü are separate keys. Ctrl-h l shows the following output:

How can I fix that?


texts:
I'd like to have linebreaks within fields of a BibTeX entry that are preserved even after I format the entry with C-q. Currently, what happens in my BibTeX buffer is this. I produce an entry with a long annotation that includes a linebreak, like so:

@InCollection{Godfrey-Smith:induction,
  author =   {Peter Godfrey-Smith},
  title =    {Induction, Samples, and Kinds},
  booktitle =    {Carving Nature at Its Joints},
  publisher =    {MIT Press},
  year =     {2011},
  pages =    {33--52},
  address =  {Cambridge, MA},
  editors =  {Joseph K. Campbell and Michael O'Rourke and Matthew
                  H. Slater},
  Annote =   {Distinguishes two kinds of induction, one where all
                  that matters is an appropriately random sample
                  without any need for naturalness or causal
                  connection, and another that only requires a causal
                  connection, but where numbers don't matter.

                  He argues
                  (more controversially) that the picture we get from
                  Goodman in {\em Fact, Fiction, Forecast} is a bad
                  one because Goodman mixes the two up: naturalness is
                  required just in order to rule out the bad
                  predicates, but the induction still relies on having
                  suitably large numbers.}
}

Then I hit C-q to make the entry look nice, and I get this:

@InCollection{Godfrey-Smith:induction,
  author =   {Peter Godfrey-Smith},
  title =    {Induction, Samples, and Kinds},
  booktitle =    {Carving Nature at Its Joints},
  publisher =    {MIT Press},
  year =     {2011},
  pages =    {33--52},
  address =  {Cambridge, MA},
  editors =  {Joseph K. Campbell and Michael O'Rourke and Matthew
                  H. Slater},
  Annote =   {Distinguishes two kinds of induction, one where all
                  that matters is an appropriately random sample
                  without any need for naturalness or causal
                  connection, and another that only requires a causal
                  connection, but where numbers don't matter.  He
                  argues (more controversially) that the picture we
                  get from Goodman in {\em Fact, Fiction, Forecast} is
                  a bad one because Goodman mixes the two up:
                  naturalness is required just in order to rule out
                  the bad predicates, but the induction still relies
                  on having suitably large numbers.}
}

I'd like to figure out how I can force line-breaks that will be retained even after hitting C-q.

I've tried adding a percentage mark at the end of the line, which keeps the line break, but for purposes of readability, it'd be great to have a blank line between paragraphs in a bibTeX field, and I can't do that with the % commenting symbol.


texts:
I would like to install the emacs speaks statistics package from melpa.
I found the following snipped

  (use-package ess
  :init (require 'ess-site))

on this side https://emacs.stackexchange.com/a/29740/14419 .

but get the following error:

Error (use-package): ess :init: Cannot open load file: Datei oder Verzeichnis nicht gefunden, ess-site

I have used 'use-package successfully to install other packages and have the following path in my config

;;; Standard package repositories
(add-to-list 'package-archives '("org-plus-contrib" . "http://orgmode.org/elpa/") t)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("elpy" . "https://jorgenschaefer.github.io/packages/"))

I'm using emacs 25.1.1.


texts: Fixing "reference/assignment to free variable" warning during compilation if variable is dynamically bounded

texts:
For:

(defun my-ag/font-lock-extend-region ()
  (save-excursion
    (goto-char font-lock-beg)
    (forward-line 2)
    (setq font-lock-beg (point))))

I've got:

Warning: reference to free variable 'font-lock-beg'
Warning: assignment to free variable 'font-lock-beg'

Documentation says:

font-lock-extend-region-functions is a variable defined in ‘font-lock.el’.

Each function is called with no argument; it is expected to adjust the
dynamically bound variables ‘font-lock-beg’ and ‘font-lock-end’; and return
non-nil if it did make such an adjustment.

Usual solution (defvar ...) make this variables globally visible and may hide bugs.

How should I mask "reference/assignment to free variable" warning during compilation if variable is dynamically bounded?


texts: How to make Emacs check my email and report new mail

texts:
I'm using GNUS to read my emails. Is there some way to make it automatically
check my mail box and report new mails somehow? Maybe some package exists to
do this sort of thing?


texts: Set the same font for different input languages in Windows

texts:
For example, if I set a default frame font to Terminus:

ELISP> (version)
"GNU Emacs 24.5.1 (i686-pc-mingw32)\n of 2015-04-11 on LEG570"

ELISP> (add-to-list 'default-frame-alist '(font . "Terminus-10"))
((font . "Terminus-10")
 (height . 45)
 (vertical-scroll-bars . left))

then open a new frame, switch to *scratch* buffer & type something in Ukrainian, Emacs suddenly uses Consolas font for the typed text:

How do I force Emacs to use Terminus font for Cyrillic characters too? (Terminus supports Cyrillic for sure, because I use it in the Cygwin terminal & it works fine there.)


texts: Selectively Highlight lines in source code block

texts:
I use emacs org-mode and find feature of source code blocks extremely useful. However, If I want to say highlight a couple of lines in my source code block, is it possible to achieve?
e.g.

#+BEGIN_SRC java
int i = 0;
m() //this is new call
#+END_SRC

Here when I export my org-mode to HTML or some other format, I want

m() //this is new call

to stand out. The intention is convey your message as clearly as possible.


texts: Convert internal org-mode links to org-id links

texts:
I have a document with a large number of internal text links. Some are formatted like this [[Link to Heading]] while others have descriptive text: [[Link to Heading][description]].

I would like to change all such links in the current buffer to use org-id instead, i.e.,

[[#org-id-string][description]]


texts: How to use backspace to erase last character in search string?

texts:
When I am using incremental search, a backspace erases the character from the matched string in the buffer, instead of erasing the character from the search string I am typing. I saw that this is not the case with another emacs user... is there something I have messed up that is causing this issue?

I did rebind my backspace and delete keys, just to be consistent across terminals/keyboards:

;; Lock DEL and backspace key behavior
(global-set-key (kbd "<delete>") 'delete-char)
(global-set-key (kbd "<backspace>") 'delete-backward-char)

Any suggestions?

FYI, I generally correct my search string using
    M-e <


texts: How reliable is it to OR multiple user defined regular expressions?

texts:
Given multiple regular expressions, how reliable is it to group these into a single regex, without knowing their contents ahead of time.
e.g.
(re-search-forward
  (concat
    "\\("
    "\\(" user-regex-1 "\\)"
    "\\|"
    "\\(" user-regex-2 "\\)"
    "\\|"
    "\\(" user-regex-3 "\\)"
    "\\)"),
    nil t 1)

Can this reliable enough to be used as an alternative to doing multiple searches?
Or are there common regular expression features that won't work when grouped in this way.
Said differently, if I write a package that uses this as a way to avoid many searches, will users fine some of their regular expressions fail because they are grouped with other expressions.
From a simple test, this should work, including nested grouping.
(string-match "\\(\\(A\\)\\|\\(B\\|C\\)\\)" "C")  ;; --> 0 (#o0, #x0, ?\C-@)

Edit to account for invalid regex causing unexpected behavior, each regex can first be tested before use, see How to check a regular expression is valid without using it for a search?


texts: Alternatives to Git on Windows due to its slowness

texts:
I am forced to use Windows 10 on my job, so I use native Win32 Emacs.
Also use Emacs on WSL (compiled from emacs mirror though tried the default Ubuntu 18.04 too).
I tend to use more the one on WSL, as I prefer Linux-style way of working.
But both seem to be slow when working with git.

I love magit and doing git stuff with just single key presses.
Though magit relays on a git.exe in Windows or default git under WSL.
I already read the article about magit slowness on Windows and tried its recommendations.
But it is still slow, and takes seconds to respond in operations that should take  milliseconds.

As a comparison, try SublimeMerge and feel your jaw dropping...
It is amazingly fast. You get instant diffs on files and branches.
I wish Emacs would be that fast.

I suspect there is no alternative to make Emacs on Windows become fast when working with git.
But I really needed to post this question.


texts:
I have a daemonized emacs, and I'm able to close any emacs frame, even the last one, using the window manager or old good C-x C-c, just to be able to retrieve all my buffers when i ask the daemon for a new frame.

Instead if I try to close the last displayed frame using C-x 0 I'm told

  Attempt to delete minibuffer or sole ordinary window

I understand that a window is not a frame, I know that the command bound to C-x 0 is delete-window, nevertheless I would like to have the window/frame closed rather than the error message.

Binding C-x 0 to delete-frame is not what I want, I want to kill windows with C-x 0 but the last one, in which case only I want to have Emacs close the frame.


texts: How can I disable the use of minibuffer in lsp-ui?

texts:
When lsp-ui-doc offers me information about the symbol at point, it does that in a hover window (good) and in the minibuffer (bad).

I've found no mention of the minibuffer in the customisations of lsp-*

Can you please tell me where/how to disable the use of the minibuffer in lsp-ui?


texts: matlab-shell, changed files' location (changed files' directory)

texts:
I've been used mablab-mode & shell in GNU emacs, and changed some of files' location, then these warnings came out every time. There's no sort of setting location. Does anyone know this problem?

Warning :
There does not exists or it's not directory.


texts: Python-mode: Eval-Buffer [C-c C-c] doesn't run my script

texts:
Here are my steps:

1- Switch to Shell C-c C-z

2- Click enter to accept

3- Eval-Buffer C-c C-c to run the script

I just got the following message:

sent: #!/usr/bin/env python...

Running Eval-File works fine. It's just Eval-Buffer what doesn't work.

Have I miss anything?

UPDATE:

I've just noticed that before running the script I get the following line printed in my messages buffer:

Can't guess python-indent-offset, using defaults: 4

Which is very strange because C-h-v python-indent-offset shows me that it's already set to 4 spaces...


texts: How to give background color to hl-todo-keywords?

texts:
I am using following setup in my .emacs file:

(setq hl-todo-keyword-faces
      '(("TODO"   . "#FF0000")
        ("FIXME"  . "#FF0000")
        ("DEBUG"  . "#A020F0")
        ("GOTCHA" . "#FF4500")
        ("STUB"   . "#1E90FF")))

Here all those keywords shown as bold and as their defined color.

In addition to that, I want to provide yellow background highlight color to all. Is it possible?


texts: How to find out what command I just accidentally ran with a keyboard shortcut?

texts:
Is there a place where emacs stores commands the user has recently executed, in particular via keyboard shortcuts, and if not, would it be possible to tell it to store them somewhere? I sometimes type the wrong keyboard shortcut by accident and I don't know what it is that I did. I undo it, but I tend to repeat these accidental shortcuts every once in a while, and I have no idea how to find out what exactly I pressed or what command I ran.

I know how to determine what command is bound to a key. My issue is that I know neither the command nor the keys I pressed, only what effect they had and the fact that I recently did it.


texts: I am learning Emacs by doing built-in tutorial (C-h t). However, when I decide to take a break and exit the editor (C-x C-c) and then later rerun the tutorial the position when I finished before is not saved. The tutorial starts over from the beginning. Is there a way to save this position so that I do not have to remember where I finished? (Well, maybe the tutorial covers the problem in some place, but I have not yet got to it).


texts: How to break the undo chain from a function call? (not Ctrl-G)

texts:
When undoing you can press Ctrl-G to redo.

This runs keyboard-quit which signals quit.

However this isn't convenient because as far as I know you can't run commands after keyboard-quit.

Is there a more direct way to break the undo chain, or a way to run keyboard-quit so you can keep calling functions after it?

I tried this for an undo/redo that doesn't require explicit Ctrl-G.

(defvar-local my-undo-is-redo nil)

(defun my-redo ()
  (interactive)
  (let ((inhibit-quit t))
    (unless my-undo-is-redo (with-local-quit (keyboard-quit)))
    ;; redo continued...
    (undo)
    (setq my-undo-is-redo t)))

(defun my-undo-only ()
  (interactive)
  (undo-only)
  (setq my-undo-is-redo nil))

(define-key evil-normal-state-map (kbd "u") 'my-undo-only)
(define-key evil-normal-state-map (kbd "C-r") 'my-redo)


texts: Why are agenda and tag shortcuts for org-mode not working?

texts:
I am relatively new to Emacs and was going through this document to learn more about org-mode: https://orgmode.org/worg/org-tutorials/org4beginners.html
I couldn't help but notice that the following shortcuts were not working:

C-c / t – show TODOs in current document

My emacs frame says C-c t is undefined

Imagine that you have a large document, with scattered all over the document TODO entries, C-c C-v will show only your current TODOs, and folding the rest away.

My emacs frame says C-c C-v- is displayed in echo area, as if it is awaiting another keystoke (? Control sequence?)

Unfortunately, both will show just empty lists (you can try if you want). So just press C-g (the Emacs version of escape). Next we will add 1.org as agenda file, using C-c [. Now if you go to the agenda menu (C-c a), and press t you get a list off all your TODO items.

In my emacs frame, although C-c [ does add the file to the list of agendas, the C-c a shortcut says C-c a is undefined in the echo area. Obviously the t keystroke does nothing as well in this case.

What can I do to solve my problems? I installed Emacs using these instructions and I am using WSL2 on Windows with the Ubuntu-20.04 distro. I followed the instructions exactly in the tutorial.
Here is my ~/.emacs file if it is necessary:
;; -*- mode: elisp -*-

;; Disable the splash screen (to enable it agin, replace the t with 0)
(setq inhibit-splash-screen t)

;; Enable transient mark mode
(transient-mark-mode 1)

;;;;Org mode configuration
;; Enable Org mode
(require 'org)
;; Make Org mode work with files ending in .org
;; (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
;; The above is the default in recent emacsen
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(org-agenda-files '("~/test/emacs/1.org" "~/test/emacs/2.org")))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )


texts:
I'm trying to understand minor modes with the goal of adding a minor mode for Jinja2 syntax highlighting (from jinja2-mode) to stuff like YAML. I'm running into problems though. When following a tutorial on adding new syntax highlighting, I translate the "simple" example to a minor mode:

(setq kwds
      '(("Sin\\|Cos\\|Sum" . font-lock-function-name-face)
        ("Pi\\|Infinity" . font-lock-constant-face)))

(define-minor-mode blah-mode
  :lighter "blah"
  (setq font-lock-defaults '(kwds)))

and that doesn't work. Neither does the approach taken by the major mode in jinja2-mode. I'm at a bit of a loss here... is adding highlighting in a minor mode possible? It seems to be, but I can't find any examples online, and I don't see anything in the conventions for the minor modes about how to define this correctly.

Edit

(setq kwds
      '(("Sin\\|Cos\\|Sum" . font-lock-function-name-face)
        ("Pi\\|Infinity" . font-lock-constant-face)))

(define-minor-mode blah-mode
  :lighter "blah"

  (font-lock-add-keywords nil kwds)

  (if (fboundp 'font-lock-flush)
      (font-lock-flush)
    (when font-lock-mode
      (with-no-warnings (font-lock-fontify-buffer)))))


texts: Spacemacs error when loading `.spacemacs` which uses package `flycheck`

texts:
I added the following at the end of my ~/.spacemacs file:

(use-package flycheck
  :defer t
  :init (global-flycheck-mode))

When I do this, I get Spacemacs encountered an error while loading your '/home/brandon/.spacemacs' file.

How can I debug this error?

Also, is there a way to get more descriptive errors?

Answer to error sub-question in comments: use emacs --debug-init.

Update

The output I get when using --debug-init is:

Debugger entered--Lisp error: (void-function use-package)
  (use-package flycheck :defer t :init (global-flycheck-mode))
  eval-buffer(#<buffer  *load*-76993> nil "/home/brandon/.spacemacs" nil t)  ; Reading at buffer position 18437
  load-with-code-conversion("/home/brandon/.spacemacs" "/home/brandon/.spacemacs" nil nil)
  load("/home/brandon/.spacemacs")
  (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil))
  (if (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil)) nil (dotspacemacs/safe-load))
  (if (file-exists-p dotspacemacs) (if (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil)) nil (dotspacemacs/safe-load)))
  (let ((dotspacemacs (dotspacemacs/location))) (if (file-exists-p dotspacemacs) (if (condition-case err (load dotspacemacs) ((debug error) (message "Error loading .spacemacs: %S" err) nil)) nil (dotspacemacs/safe-load))))
  dotspacemacs/load-file()
  spacemacs/init()
  (if (not (version<= spacemacs-emacs-min-version emacs-version)) (error (concat "Your version of Emacs (%s) is too old. " "Spacemacs requires Emacs version %s or above.") emacs-version spacemacs-emacs-min-version) (load-file (concat (file-name-directory load-file-name) "core/core-load-paths.el")) (require 'core-spacemacs) (spacemacs/init) (configuration-layer/sync) (spacemacs-buffer/display-startup-note) (spacemacs/setup-startup-hook) (require 'server) (if (server-running-p) nil (server-start)))
  eval-buffer(#<buffer  *load*> nil "/home/brandon/.emacs.d/init.el" nil t)  ; Reading at buffer position 1264
  load-with-code-conversion("/home/brandon/.emacs.d/init.el" "/home/brandon/.emacs.d/init.el" t t)
  load("/home/brandon/.emacs.d/init" t t)
  #f(compiled-function () #<bytecode 0x25d5e9>)()
  command-line()
  normal-top-level()

Tentative Solution

After looking around a bit more, I realized my config was in the wrong part of the ~/.spacemacs file. This is probably not the best place for it, but I ended up adding the following in my (defun dotspacemacs/user-config () ... ).

(use-package flycheck
  :ensure t
  :init (global-flycheck-mode))

Also, I now note that flycheck complains that the line with (use-package flycheck has a reference to free variableflycheck' (emacs-lisp)` ... hmm. But, a step in the right direciton.


texts: Elpy starts Python processes at the root of my git tree, not the module's actual location

texts:
(I now submitted this as an issue in GitHub: https://github.com/jorgenschaefer/elpy/issues/1249)

I'm using Emacs 25.3.1, Elpy v20171212.850, and Python 3.6.3 on MacOS 10.13.2 .

I have a project tracked with Git in ~/MyProject, with the usual git data in ~/MyProject/.git and ~/MyProject/.gitignore. I have some Python modules in ~/MyProject/Python. If, for example, I open one of these modules and, from that buffer, call elpy-shell-switch-to-shell, or elpy-shell-send-region-or-buffer, then Elpy starts a new Python process in ~/MyProject instead of ~/MyProject/Python. This odd behaviour has only started occurring recently (might be since the last Elpy upgrade, but not sure - I upgrade fairly frequently).

Interestingly, if I delete the Git data and kill/reopen the Python module (simply killing the Python REPL buffer is insufficient), then Elpy behaves properly, starting the Python process in ~/MyProject/Python.

Any idea how I can debug this?


texts: Rebind a key in insert mode for a major mode?

texts:
I'm trying to rebind a key in insert mode for a major mode and I just can't seem to get it - I have in my .spacemacs

  (evil-define-key '(normal insert) rjsx-mode-map
    (kbd "C-d") 'rjsx-delete-creates-full-tag
    )
  (evil-define-key 'normal rjsx-mode-map
    (kbd "x") 'rjsx-delete-creates-full-tag
    )

and then when I do C-h k C-d to inspect the key inside of rjsx mode while in normal mode I get:

C-d runs the command rjsx-delete-creates-full-tag, which is an interactive
compiled Lisp function in ‘rjsx-mode.el’.

It is bound to x, C-d, <insert-state> C-d, <normal-state> x, <normal-state> C-d.

which is exactly what I expect and it works great, and I can see  C-d, but then I switch into insert state and inspect the key and I get:

C-d runs the command delete-char (found in global-map), which is an interactive
built-in function in ‘C source code’.

It is bound to C-d.

What am I not doing right to get this bound in insert mode?


texts:
In ~/.emacs.d/layers/.../any-given-layer there is almost always a README documenting this layer's functionality. Is there a key binding, or function that opens the README associated with a given layer?

I find this necessary because layers bundle functionality from various packages, e.g. a repl package, package for the major mode of the language, snippets, etc., and I often need to reference the README to see what's in the layer and how to use it.

Thanks,
chris


texts:
I'd like to add a rule to supersede a tex mode. I'd like to colour text between two strings over multiple lines in a similar way that the character % is used as a comment character and so colours (greys out) everything following it on the same line, For example

\begin{comment}
coloured (greyed out) text in here
\end{comment}

normally coloured text by tex mode here


texts: How to display list of previous copies/kills (`M-w` or `C-w`)?

texts: C-n C-y retrieves the n-last call to C-w, I think. Is there a way to show all that were saved?


texts: How can I see entries of more than one day in Emacs calendar?

texts:
I want to use the built in calender.
In the Manual i found many key bindings for moving around in the calendar.
But for showing the entries / dates in my calender i found only "d", which shows me the entry of one day.

So, how can i see the entries of one week, month, year or perhaps a list of all entries?


texts: How to pass compiler flag "-std=c++11' to ob-C?

texts:
Trying C++ in org-mode code block, but don't know howto pass the compiler flag like -std=c++11 to the code block?

My code block is like:

#+BEGIN_SRC C++ :includes "<memory>"
    std::unique_ptr<int> p1 = std::make_unique(42)
#+END_SRC

Got error as below:

error: no member named 'make_unique' in namespace 'std'
std::unique_ptr<int> p1 = std::make_unique(42);
                          ~~~~~^
1 error generated.

Thanks


texts: How can I map helm-projectile-grep to helm-projectile-ag?

texts:
I want to replace helm-projectile-grep with helm-projectile-ag without using default binding (C-c p s s).

For example if I use helm-projectile-switch-project (C-c p p), then in the helm window I press C-s, then it will invoke helm-projectile-grep, but I want to use helm-projectile-ag instead because it's faster. I don't know what other search action will invoke helm-projectile-grep, but whenever I call the function, I want it to call helm-projectile-ag instead. Is it possible, how can I map it in my .emacs?


texts: I am using filecache as a source to helm-for-files because it ends up being faster than using something like helm-ls-git(EDITED) or helm-projectile. This approach works fine till the cache has around 16000 files. On trying to append another list of around 2000 files, I see emacs memory usage spike until it gets terminated by the OS. At around a file-cache of 16000 file names, the mem usage is around 400mb(that's the gc-limit I have set). On adding these 2000 more files, it hits 10gb and gets killed, since thats the value of ulimit -v. This sounds very much like a bug. Has anyone run into this?


texts: Reference cells of other tables in org-mode table as plain text

texts:
I intent to copy the value of a cell and put the exact copy to the target cell and be able to update the value on referenced cell to be updated on the targeted one.

Calling remote to a cell evaluate its value and then return the result of the process which might be different then the original text.

In my case remoted cells have '.' and '/' symbols. So far I tried these:

#+TBLNAME: t1
|   | 01.02.2003 |
| ^ |        foo |

#+TBLNAME: t2
| #ERROR |
#+TBLFM: @1=remote(t1,@1$2)

#+TBLNAME: t3
| (01.02.2003) |
#+TBLFM: @1=string("remote(t1,@1$2)

#+TBLNAME: t4
| ((01.02.2003)) |
#+TBLFM: @1=string("remote(t1,$foo)

#+TBLNAME: t5
| "01.02.2003" |

#+TBLNAME: t6
| 01.02.2003 |
#+TBLFM: @1=string(remote(t5,@1$1)

Edit: To explain further. Basically I want to...

#+NAME: t1
| 01.02.2003 | --------> Edit this cell and expect to update the value of -->|
                                                                             |
#+NAME: t2                                                                   |
| 01.02.2003 | <--- this cell -------------------------------------------<


texts: Insert Current Date and Time with Custom Timestamp

texts:
I am trying to get org-mode to insert a custom timestamp with the current time.

Something along these lines:

20160824 34|3 163000 (UTC)

Which I believe should be the following:

("%Y%m%d %W|%u %H%M%S (%Z)")

However, after editing org-time-stamp-custom-formats using the Customize Browser, I get the following:

Y0824 34|3 000000 (UTC

Issues:

Year does not display.
Current time is not displayed.
End parenthesis does not display.

I have read through the org-mode manual and searched online, but am still very lost.


texts:
When I'm in the middle of a looooong string, like the following

(setq Emacs-beta "Which keyboard shortcut to use for navigating out of a string")

Can I skip out of it, just before the first " (after Emacs-beta) with a shortcut?


texts: mark text with keyboard in PDFView (pdf-tools) mode

texts:
I've replaced doc-view mode with pdf-tools.

While it's easy to set a mark on a page with the mouse, how do you do it with the keyboard?

The readme mentions the feature.
"* Mark a region and kill the text from the PDF."

The closest I've gotten is marking the whole page with M-x pdf-view-mark-whole-page.


texts: How can I show timestamp in natural date format in minibuffer?

texts:
I am working quite a lot with Unix timestamps. I installed the ts package, but I am not able to create a key-binding to show the conversion of a timestamp to natural date format.
I would like to be able to show the natural day of a marked timestamp. Is it possible to show in the minibuffer? Or at cursor point?. I don't want to replace or timestamp or insert in the current buffer.


texts: How to put theme modifications into a personal layer?

texts:
For example I want to put (setq spacemacs-theme-org-height nil) into a personal layer, but that doesn't work.  I can only put the setting into dotspacemacs/user-init.  The reason seems to be Spacemace has already initiated the theme before loading layers.

Is there a way to put the theme settings into a personal layer？


texts: Magit has trouble commiting - there is a problem with the editor

texts:
When I try to commit using magit I get the following error;

 1 git … commit --
Waiting for Emacs...
*ERROR*: Wrong type argument: stringp, nil
error: There was a problem with the editor '/opt/emacs/bin/emacsclient --socket-name=/tmp/emacs1000/server'.
Please supply the message using either -m or -F option.

Here are the versions of software I'm using

Magit 20160814.1615, Git 2.9.0, Emacs 25.0.50.2, gnu/linux (Debian wheezy 7)

I run emacs as a server.

If I type the following into a file within my git project and eval the buffer I get the following;

(with-editor
  (let ((magit-git-debug t)
        (process-environment
         (cons "GIT_EDITOR=printf '[%s]\n' \"$EDITOR\"" process-environment)))
    (magit-git-insert "commit")))[/opt/emacs/bin/emacsclient --socket-name=/tmp/emacs1000/server]
[/home/map7/code/testproject/.git/COMMIT_EDITMSG]

On the command line if I do the following

$ export GIT_TRACE=1
$ export GIT_EDITOR='printf "[%s]\n" "$EDITOR"'
$ git commit
10:48:43.558746 git.c:350               trace: built-in: git 'commit'
10:48:43.561811 run-command.c:336       trace: run_command: '.git/hooks/pre-commit'
10:48:43.563366 run-command.c:336       trace: run_command: 'status' '--porcelain'
10:48:43.563595 exec_cmd.c:120          trace: exec: 'git' 'status' '--porcelain'
10:48:43.564766 git.c:350               trace: built-in: git 'status' '--porcelain'
10:48:43.574334 run-command.c:336       trace: run_command: 'printf "[%s]\n" "$EDITOR"' '/home/map7/code/testproject/.git/COMM
IT_EDITMSG'
10:48:43.574637 run-command.c:195       trace: exec: '/bin/sh' '-c' 'printf "[%s]\n" "$EDITOR" "$@"' 'printf "[%s]\n" "
$EDITOR"' '/home/map7/code/testproject/.git/COMMIT_EDITMSG'
[emacs -nw -q]
[/home/map7/code/testproject/.git/COMMIT_EDITMSG]
Aborting commit due to empty commit message.
10:48:43.581313 git.c:350               trace: built-in: git 'config' '--get' 'oh-my-zsh.hide-dirty'

UPDATE

I just restarted emacs and now I can commit again, but I don't know for how long.

I can re-enact a similar problem if I do the following

Stage my changes in magit using 's' on a file
Go to commit hitting 'c c'
Cancel the commit 'C-c C-k'

Now I get the same error as I was getting before, when trying to commit.

UPDATE: error in Backtrace

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  isearch-done(t)
  isearch-cancel()
  server-goto-toplevel(#<process server <24>>)
  server-process-filter(#<process server <24>> "-dir /home/map7/code/angularjs_nested_routes/ -current-frame -tty /dev/pts/31 dumb -file /home/map7/code/angularjs_nested_routes/.git/COMMIT_EDITMSG \n")

UPDATE

I've been busy testing my configuration by remarking parts out as suggested. I recently had the same error, but manage to fix the error by killing off some of my buffers. I didn't take note of which buffers, but I will next time. This may suggest that it's a certain state instead of configuration?