texts: How to have a buffer interpret C-m as an actual carriage return

texts:
I'm using the following elisp snippet in a dedicated buffer to track progress of a wget download.

(with-current-buffer buf
  (setq proc
    (apply 'start-process "my-download" buf
      (list "wget" (if resume "-c" "") "-O" save-path url)))
  ....
  )

This is great in that it gives me wget's progress, but the problem is that the buffer isn't interpreting a control character the way I want. wget sends a C-m after every progress update, about once a second, because it is expecting to be connected to a vt100 and wants the cursor to return to the beginning of the current line, this so the next progress message will over-write the former one. The emacs buffer just inserts a literal C-m and accumulates lines.

When I run wget directly from an emacs ansi-term buffer, the progress messages appear fine, so I tried looking in the code, but couldn't figure out what specifically was being done for C-m interpretation. I did consider using an ansi-term buffer for my program, but it wouldn't be appropriate because I'll be inserting other information and text there that aren't terminal commands. What I would like is a fundamental-mode buffer modified to react to C-m by performing a (forward-line 0).


texts: Passing a string translation to quail-defrule

texts:
I don't understand how this is to be used:

(quail-defrule ",q" "abcd")

After evaluating this, and typing ,q, I get an underscored a: but
how am I supposed to select one of the other characters?  Doing
(quail-next-translation) does start going through them, but only
after inserting an a.


texts:
I've configured prettify-symbols-mode as below. However, only in the scratch buffer is any drawing performed. Further, lambda (λ) is the only multi-character token drawn as a unicode glyph. Is something missing or incorrectly set in the prettify configuration?

;; Globally prettify symbols
(global-prettify-symbols-mode 1)
(setq prettify-symbols-alist '(("lambda" . 955)
                               ("->" . 8594)
                               ("->>" . 21A0)
                               ("=>" . 8658)
                               ("map" . 8614)
                               ("/=" . 2260)
                               ("==" . 2261)
                               ("<=" . 2264)
                               (">=" . 2265)
                               ("=<<" . 226A)
                               (">>=" . 226B)
                               ("<=<" . 21A2)
                               (">=>" . 21A3)
                               ("&&" . 2227)
                               ("||" . 2228)
                               ("not" . 00AC)))

Update

(defun configure-prettify-symbols-alist ()
  "Set prettify symbols alist."
  (setq prettify-symbols-alist '(("lambda" . ?λ)
                                 ("->" . ?→)
                                 ("->>" . ?↠)
                                 ("=>" . ?⇒)
                                 ("map" . ?↦)
                                 ("/=" . ?≠)
                                 ("!=" . ?≠)
                                 ("==" . ?≡)
                                 ("<=" . ?≤)
                                 (">=" . ?≥)
                                 ("=<<" . ?=≪)
                                 (">>=" . ?≫=)
                                 ("<=<" . ?↢)
                                 (">=>" . ?↣)
                                 ("&&" . ?∧)
                                 ("||" . ?∨)
                                 ("not" . ?¬))))


texts: trace-redisplay: How to see stderr from within Emacs?

texts:
When building Emacs, I use ./configure --enable-checking='glyphs' so that I can take advantage of some of the built-in tools such as M-x trace-redisplay.

The redisplay debugging messages can be seen if the GUI version of Emacs was launched from the terminal.

Instead of watching a separate terminal application while using Emacs, I would like to see the stderr output — in real time (if possible¹) — from within Emacs.  For example, I would like to do some stuff in one Emacs window and be able to see stderr output in another visible Emacs window.  How can I achieve that goal?

¹  Due to the nature of redisplay, the buffer that displays stderr (when this question is answered) may not be able to update until the next command loop?


texts: How can you make conf-mode indent with tabs?

texts:
When I open a config file that has been indented with tabs, the mode shows as (Conf[Space] WS) and pressing Tab indents with spaces, even though the rest of the file is using tabs.

How can I change this mode to indent with tab characters instead?

I thought [Space] might have meant it was a minor mode, so I looked into changing the minor mode but the list of minor modes in the manual doesn't mention anything about a tab mode.

The EmacsWiki mentions an indent-tabs-mode however this does not appear to be in version 25.1.1 that I am using.

I looked into customize-mode however I can't find anything in there about indenting.

Is there a setting to change conf-mode to indent with tabs instead?

Update with suggestions from @Basil:

(setq indent-tabs-mode t) has no effect.  After running it with M-:, pressing the tab key is the same as pressing the spacebar multiple times (enough to match the first non-leading space character on the previous line.)

Putting the add-hook code suggested by @Basil in my init.el, closing the buffer, reloading Emacs, then reopening the file, also has no effect.  Pressing the tab key is the same as pressing the spacebar multiple times.

(setq tab-width N) immediately changes the width of the existing tabs in the file.  On a line with no spaces on the line above it, setting tab-width to 2 makes the tab key insert two spaces, setting it to 8 makes the tab key equivalent to pressing the spacebar eight times.


texts: How create custom function access only from ONE el file?

texts:
Emacs 26.1
In my file custom_functions.el

(defun increment-number-by-one-at-point()
  (interactive)
  (increment-number-at-point-private 1))

;; Increment number at point
(defun increment-number-at-point(number)
  (interactive (list (read-number "Input increment number: " 1)))
  (increment-number-at-point-private number))

(defun increment-number-at-point-private(number)
  (skip-chars-backward "0-9")
  (or (looking-at "[0-9]+")
      (error "No number at point"))
  (replace-match (number-to-string (+ number (string-to-number (match-string 0))))))

The problem is that increment-number-at-point-private is has access in the any place in Emacs List files. But I need that function increment-number-at-point-private must have access only in file custom_functions.el


texts: Debugging "Warning: Reference to free variable"

texts:
I have something like below (from the answer) in my init file:

(add-hook 'LaTeX-mode-hook 'my-latex-hook)

(defun my-latex-hook ()
  (require 'tex-site)
  (define-key LaTeX-mode-map "-" (lambda () (interactive) (insert "_")))
  (define-key LaTeX-mode-map "_" (lambda () (interactive) (insert "-")))
  (define-key LaTeX-mode-map "6" (lambda () (interactive) (insert "^")))
  (define-key LaTeX-mode-map "^" (lambda () (interactive) (insert "6"))))

When I byte-compile the init file, there is a message: Warning: reference to free variable LaTeX-mode-map.  The function works without problem in LaTeX-mode. Should one take this message serious? Is there a better way to write the above function in order to prevent this warning?


texts: output emacs buffer to another terminal window

texts:
I'm wondering if it's possible to have a terminal windows running emacs talk to each other (running in a server environment)

For example:

Open an instance of emacs in one terminal window.
Open up a second terminal window to connect to the first one and display an output buffer (eg, *Messages*)
Any action on the first terminal will be outputted on the second terminal


texts: I am using emacs on window OS, possible to use multiple monitor?

texts: I got 2 monitors, but emacs can only use one, can I use both of them, so that I could split windows cross both monitors? so If I want to create 2 windows, then each monitor could show me one windows.


texts:
I found out that magit-ediff-dwim cannot "read my mind" in a diff buffer when the point is on a hunk.

Intuitively, I would expect this command to need only two things to guess what I mean: a file (e.g. the file of the hunk at point) and either a revision or a range. In a revision buffer, magit-ediff-dwim correctly guesses which revision ediff should use.

When visiting arbitrary diffs however, the function does not guess that "what I mean" is starting an ediff session using the same range as the one which defines the diff buffer.

Some scenarios to reproduce:

d r foo..bar will spawn a diff buffer showing changes between revisions foo and bar;
d d when point is on branch baz in the refs buffer will spawn a diff buffer showing changes from the current branch to baz;
d d in the log buffer when the region spans commits foo to bar will spawn a diff buffer showing changes between revisions foo and bar.

In each of these situations, if I set the point on a hunk and call magit-ediff-dwim, the function fails to read my mind.

I poked around magit-diff.el and magit-ediff.el and found that I could help magit read my mind by adding the following to magit-diff--dwim:

@@ -616,6 +616,8 @@ If no DWIM context is found, nil is retu
     (cons 'commit magit-buffer-refname))
    ((derived-mode-p 'magit-revision-mode)
     (cons 'commit (car magit-refresh-args)))
+   ((derived-mode-p 'magit-diff-mode)
+    (nth 0 magit-refresh-args))
    (t
     (magit-section-case
       ([* unstaged] 'unstaged)

Disclaimer: I am not an E?Lisp developer by any means. I just threw the above together after looking up a few symbols' documentation or messageing their value when trying to wrap my head around what was happening.

Onto questions.

Am I missing something that would explain why magit-ediff-dwim should not read my mind in diff buffers, although it can in rev buffers?
Is this worth creating an issue on the Github tracker?
Is the patch above sound? I figure maybe it is not appropriate to poke around magit-refresh-args, or maybe another case could be added to the magit-section-case switch below.

Version: 20151118.241 from MELPA.

Additional disclaimer: sorry if I sound like I am complaining - magit is a wonderful piece of software that makes version control a very pleasant experience.


texts:
I have a warning when I start Emacs.

No problem, just start it with --debug-init.

What!! No warning anymore, and it actually opens scratch instead of Emacs standard spash screen.

--debug-init removes the warning and gives me the correct behavior, but without it I get a warning and ... Well, not the desired behavior.

I am running emacs 25.1.RC1, same problem with 25.1.50. I have not tested with 24.X.X but I am about to do that now.
Emacs is homebuild on a mac osx 10.11.5 El Capitan with --with-cocoa --with-gnutls --with-rsvg --with-imagemagick --with-ns. Any recommendations?


texts: When writing a new major mode, should it add itself to auto-mode-alist?

texts: I am defining a new major mode, foo-mode, which is closely and only associated with .foo files. Should foo-mode.el fiddle with auto-mode-alist to add this association, or is that the user's responsibility?


texts:
In GNU Emacs 25.2.2 on Ubuntu 17.10, emacs -Q:

(info "(gnus) The Gnus Registry") finds the right page.

M-x info-apropos RET gnus registry RET finds nothing.

Is there a command I can use to search all of my info files?


texts: Delete single window frame after app quits

texts:
Some of the apps (w3m, elfeed, mu4e, to name a few) when quit leave unused frame so the other buffer shows up in their place. Over time these redundant frames pile up, so we have to delete them.
I look for a way to automate it, by deleting these frames if there is only one window inside with an app that just quit. I want to use it for buffers used by w3m, mu4e, elfeed, erc.
If we just close the frame, the app will still be lurking around. The next time I will need it and call the command it may create another instance instead of reusing existing one. That's why it would be better to delete the frame on app quit rather than keeping it alive without active window.
It would be perfect to configure it selectively using display-buffer-alist if that's possible.


texts:
I'm trying to get emacs to understand ♥ as punctuation.
(modify-syntax-entry ?♥ "." text-mode-syntax-table)
I'm not sure what the issue is. (That is a unicode heart.)
(modify-syntax-entry ?\u2665 "." text-mode-syntax-table)
For purposes of recognizing that a new sentence starts after "Hi!♥"
How can I troubleshoot this?
Examples:
Lorem impsum dolor.♥ Sit amet.|

(where the pipe indicates the starting cursor position.)
Hitting M-a moves the cursor to the left of "Lorem".
Lorem impsum dolor♥. Sit amet.|

Hitting M-a moves the cursor to the left of "Sit".
I want both cases for it to move to the left of "Sit". In some modes.


texts: Absolute value of complex numbers in Calc?

texts:
If I do this in Calc mode:

' 7i-2

It will enter the symbolic algebraic term 7i - 2, which is displayed like so:

--- Emacs Calculator Mode ---
1:  7 i - 2
    .

However, if I run A (calc-abs), I only see this:

--- Emacs Calculator Mode ---
1:  abs(7 i - 2)
    .

In reality, the absolute value of 7i - 2 is sqrt(53). How can I get such a result to show up in Calc mode?


texts: Evil-emacs: how to make search/replace (:s/) global by default?

texts:
Vim has the following setting:

:help gdefault

When on, the ":substitute" flag 'g' is default on.  This means that
all matches in a line are substituted instead of one.  When a 'g' flag
is given to a ":substitute" command, this will toggle the substitution
of all or one match.

How do I get this behavior in evil-emacs?


texts: Make spaces show as spaces in minibuffer instead of completion

texts: The default mapping of SPC in minibuffer is (self-insert-command N). However, I prefer SPC to simply type a single space (for instance, in passing arguments to environments and commands within AuCTeX). Is there a way of unmapping SPC in the minibuffer, and remapping it to ?


texts: Is there toggle-syntax package for parens, brackets, brokets, braces?

texts: I rely on toggle-quotes (to switch between single and double quotes), but I'm not finding any available packages that can do the same for switching between pairs of ( [ { <. I'd expect it to cycle between the four (and maybe /). Does it exist (yet)?


texts: WoMan italic `\,VARIABLE\/ representation

texts:
When I do M-x woman => ln , as you can see italic variables are represened as in between following pattern \,  - \/. How could I revmoe or fix it?

Setup:
(setenv "MANWIDTH" "72")

(defadvice man (before my-woman-prompt activate)
      (interactive (progn
                     (require 'woman)
                     (list (woman-file-name nil)))))

(require 'woman)
(set-face-attribute 'woman-bold nil :inherit font-lock-type-face :bold t)
(set-face-attribute 'woman-italic :inherit font-lock-keyword-face :underline t)

Bug track link: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42219


texts:
I am using aquamacs and latex mode, 'Symbol’s value as variable is void: last-command-char when trying to insert bracket' occurs when I am trying to insert a bracket.

How could I do, thank you


texts: Running process interactively (like compilation) but without parsing

texts:
Is there any command which let me observe output of async-called process (just like M-x compile), but does not try to parse output buffer?

Background: for quite a lot of non-compilation tasks (hg push, python some_sample_script, unzip big_file.zip and much more...) I tend to prefer

M-x compile  «command»

to both

M-! «command»

and

M-! «command» &

The reason is simple: M-x compile does not block Emacs, let me observe command progress in a buffer (including PgUp/PgDn and search), always leaves output in solid non-disappearing buffer even if output happens to be short and can be safely C-x k in case of problems.

There is one problem, though: compilation parses command output, what brings unneeded coloring, sometimes causes confusing navigation, and - what is worst - introduces performance penalty on long outputs.

So, is there anything what would spawn process exactly as M-x compile, but leave output buffer as plain text?


texts: Tell emacsclient/server to stop whatever it's doing (from another terminal window perhaps)

texts:
I opened an .xml file inside emacsclient -nw not realizing it's large (55MB)

Now I'm staring at my terminal/emacs for several minutes. It seems frozen but I know from experience it will eventually wake up after (I'm guessing) xml mode parses the file.

(I did try C-g multiple times)

In a situation like this, what are my options..

Is there a SIGNAL I can send the pid of emacs/emacsclient to tell it to "stop whatever thing you're doing"

Suppose I knew the file was large, how can I tell emacs to open it, but don't try any fancy xml parsing modes, just go fundamental.


texts: How to prevent attributed nested list from splitting the parent?

texts:
When having a nested list which is preceded by a #+ATTR_LATEX, the parent list is split into two, contrary to the expected result.

In this example the nested list is attributed to make it inline:

#+LATEX_HEADER: \usepackage{enumitem}

1. 111
2. 222
#+ATTR_LATEX: :environment enumerate*
  1. 333
  2. 444
3. 555

The desired result in latex-export would be:

\begin{enumerate}
\item 111
\item 222
\begin{enumerate*}
\item 333
\item 444
\end{enumerate*}
\item 555
\end{enumerate}

White the actual result is:

\begin{enumerate}
\item 111
\item 222
\end{enumerate}     %undesired%
\begin{enumerate*}
\item 333
\item 444
\end{enumerate*}
\begin{enumerate}   %undesired%
\item 555
\end{enumerate}


texts: org-mode - How to export basic list as outline, not TOC

texts:
I have the Latex commands in my org mode file:

#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \setmonofont[Scale=0.9]{Latin Modern Mono}
#+LATEX_HEADER: \setromanfont{Accanthis ADF Std No3}
#+LATEX_HEADER: \linespread{1.5}
#+LATEX_HEADER: \usepackage[margin=1.25in]{geometry}

#+LATEX_HEADER \usepackage[inline]{enumitem}
#+ATTR_LATEX: :environment itemize*
#+ATTR_LATEX: :options [label={}, itemjoin={,}, itemjoin*={, and}]

followed by a simple org list that doesn't go deeper than four levels.  When I export as latex and open as a PDF, it keeps giving me a table of contents and then my list.  I just want to write an outline.  Anyone know hoe to do this?  My google searches aren't turning up anything useful and the above is form the org-mode manual.

Thanks for any help.


texts:
I want to use Emacs to quickly convert hex to decimal.

If I type M-: #x1234 (i.e. 0x12 0x34), I get 4460 which (I think) means Emacs is interpreting it as big endian.

How might I convert hex to decimal as little endian, so that #1234 is interpreted as 13330?


texts:
This is how I move master to branchX in git:

$ git checkout master            #move HEAD to master
$ git branch -f branchX HEAD     #move by force, HEAD to branchX

Is there a way to do that in Magit?

In this example, I want to move master to wstudent-topic2:


texts: Sort minor-mode-alist alphabetically (in the mode-line) using :lighter

texts:
Q:  How to sort the minor-mode-alist alphabetically (in the mode-line) using the :lighter as the criteria for alphabetization.

Rough draft that does not work:

  (setq mode-line-format '(
  (:eval
    (let* (
        (copy-of-list (copy-list minor-mode-alist))
        (sorted-list
          (sort copy-of-list #'(lambda (x y)
            (when
                (and
                  (stringp (car (cdr x)))
                  (stringp (car (cdr y))))
              (when (eq ?\s (aref (car (cdr x)) 0))
                (setq x (replace-regexp-in-string "^\s" "" (car (cdr x)))))
              (when (eq ?\s (aref (car (cdr y)) 0))
                (setq y (replace-regexp-in-string "^\s" "" (car (cdr y)))))
              (when (and (stringp x) (stringp y))
                (string< x y )))))) )
      (list
        `(:propertize ("" sorted-list)
          face bold
          mouse-face highlight
          help-echo "This is a mouseover help message."
          local-map ,mode-line-minor-mode-keymap))))))

EDIT:  The following is a revised working draft based upon the guidance of @Drew in his answer below -- it appears to be working correctly for :lighter in the form of either strings or symbols, and I'll be testing it out over the next day or so.  The draft will need to be revised to include the situations mentioned by @Drew -- e.g., (text-scale-mode (" " text-scale-mode-lighter)) and other possibilities described in the Elisp manual at node Mode Line Data

  (require 'cl)

(defmacro non-empty-name-p (name)       ; Error if NAME is neither nil nor a string.
  "NAME if non-nil and not \"\", else nil."
  `(and ,name (stringp ,name) (not (string= "" ,name)) ,name))

(setq mode-line-format '(
  (:eval
    (let* (
        (copied-list
          (delq nil
            (mapcar
              (lambda (x)
                (when
                    (or
                      (and
                        (symbolp (cadr x))
                        (non-empty-name-p (symbol-value (cadr x))))
                      (stringp (cadr x)))
                  x))
              (copy-list minor-mode-alist))))
        (sorted-list
          (sort
            copied-list
            (lambda (x y)
              (let* (
                  (xname (cadr x))
                  (yname (cadr y)) )
                (when (symbolp xname) (setq xname (symbol-value xname)))
                (when (symbolp yname) (setq yname (symbol-value yname)))
                (when (and (stringp xname) (non-empty-name-p xname)
                           (stringp yname) (non-empty-name-p yname))
                  (when (eq ?\s (aref xname 0))
                    (setq xname (replace-regexp-in-string "^\s" "" xname)))
                  (when (eq ?\s (aref yname 0))
                    (setq yname (replace-regexp-in-string "^\s" "" yname)))
                  (string< xname yname)))))) )
      (list
    `(:propertize ("" mode-name)
      help-echo "Major mode help message."
      face '(:foreground "red")
      mouse-face '(:foreground "blue")
      local-map ,mode-line-major-mode-keymap)
    `(:propertize ("" ,sorted-list)
      face '(:foreground "purple")
      mouse-face '(:foreground "blue")
      help-echo "Minor mode help message."
      local-map ,mode-line-minor-mode-keymap))))))


texts: Embed a font definition in an emacs theme?

texts: As far as I can tell, emacs can only use fonts installed on the operating system.  Is it possible to define a font directly in emacs lisp?  This would allow one to directly embed a font definition in an emacs theme, making the theme more portable.


texts: How to hide the extra period in linum mode when you have whitespace mode enabled?

texts:
I have linum mode and whitespace mode enabled.  This works great except that I want padding in linum mode (which uses a space) and so, instead of there being a space (or a different colored space as I would really like), there is a kind of annoying little dot.

Is there a way to fix this (see photo):

My linum lines from init.el are attached.  Thanks!

61·(defun·linum-format-func·(line)
162···(concat
163····(propertize·(format·linum-format-fmt·line)·'face·'linum)
164····(propertize·"·"·'face·'mode-line)))
165·
166·(unless·window-system
167···(setq·linum-format·'linum-format-func))
168·
169·(add-hook·'linum-before-numbering-hook·'my-linum-get-format-string)
170·
171·(defun·my-linum-get-format-string·()
172···(let*·((width·(length·(number-to-string
173··························(count-lines·(point-min)·(point-max)))))
174··········(format·(concat·"%"·(number-to-string·width)·"d")))
175·····(setq·my-linum-format-string·format)))
176·
177·(setq·linum-format·"%d·")


texts: Which site-lisp file was loaded, default.el or default.elc?

texts:
I'm setting up some site-wide default configuration in the site-lisp directory, and trying to figure out whether emacs is loading the byte-compiled default.elc or default.el. I haven't applied any other configuration, such as load-prefer-newer.

With the following default.el

(defvar foo nil)

and having compiled it so both the .el and .elc files are present, if I run describe-symbol on foo I'm shown:

  foo is a variable defined in 'default.el'

and the *Messages* buffer shows the path to default.el (as if it loaded it to look up the symbol, though I don't know if that's actually what it means).

If I remove the .el file leaving only the .elc file, then start emacs and again describe foo it shows:

  foo is a variable defined in 'default.elc'

and in the *Messages* buffer I see the path to default.elc.

I had expected it to load the byte-compiled .elc file when both were present, but can't tell if that's what's happening. How can I check?


texts: Is there an easy way to use thing-at-point to initialize interactive read string (interactive "sfoo:")

texts:
Is there an easy way to use thing-at-point to initialize the contents of an interactive string reading?
I have a function the looks something like this:
(defun foo (string)
   (interactive "sString:")
   ;; does something with string
   )

But I'd really like it if when I did M-x foo, that it filled the minibuffer with the thing-at-point.  In this case (thing-at-point 'word).
Is the only way to get that to use an explicit list argument to interactive, something like:
(defun foo (string)
   (interactive (list (read-from-minibuffer
                        "String:" ;; prompt
                        (thing-at-point 'word) ;; initial value
                       ) ) ) ; interactive
   ;; does something with string
   )

And if I do so, do my own history list etc?


texts: Problem with emacs and input() using iPython 3.6.4

texts:
I am using emacs 25.2.1

Look at the following simple code:

import sys

def yes_no_barrier(message):
    print(message + ' (yes/no): ')
    while 1:
        s=str(input(message + ' (yes/no): '))
        if s == 'yes':
            return 'yes'
        if s == 'no':
            return 'no'
        print('please enter yes or no')

yes_no_barrier('Are you tall?')

I tried to run the code in a real terminal (Python 3.6.4) and it was worked.
Then I tried to run it inside emacs, first using C-c C-p for opening a Python console, and then, from the .py buffer, pressing C-c C-c.

I tried no and the code worked, I then tried yes and other strings and the Python buffer froze, forcing me to press C-g. I have no clue what there is special with no except for being shorter than the word yes.

Since I was always getting the same strange behaviour I dug the web and I tried random stuff, finally solving the issue.

Here there is the full Python configuration which fixed the issue, not sure which part did it.

;I also installed from list-packages python-mode
(require 'python)
(add-hook 'python-mode-hook
      (lambda ()
        (setq indent-tabs-mode t)
        (setq tab-width 4)
        (setq python-indent 4)))

(setq scroll-down-aggressively 1)

(defun python-shell-parse-command ()
   "Return the string used to execute the inferior Python process."
   "/usr/bin/python3 -i")

(setq py-python-command "python3")
(setq py-shell-name "python3")
(setq python-shell-interpreter "python3")

I was happy with this magic code, but I had to switch to IPython (6.2.1, still using Python 3.6.4) since I wanted to solve this other problem, described here.

That problem was solved but now I have back the same problem with input() which I described before: no works but yes makes the console freeze.

I tried the obvious modifications to my configuration, which are listed here:

(setenv "IPY_TEST_SIMPLE_PROMPT" "1") ;for fixing a problem with IPython not showing correctly

(setq python-shell-interpreter "/usr/local/bin/ipython"
   python-shell-interpreter-args "--profile=dev -i")

(defun python-shell-parse-command () "/usr/local/bin/ipython
--profile=dev -i")

(setq py-python-command "ipython")
(setq py-shell-name "ipython")
(setq python-shell-interpreter "ipython")

But the error this time is not disappearing.

Can you help me, please? Does the code work in your emacs?

EDIT1:
I just realised that the problem does not arise when I press return but when I type the third letter of a word, so if I type yes, then I will not be able to use the console anymore. For instance I will not be able to type backspace and I will be forced to press C-g to send a keyboard interrupt and make the console usable again.

EDIT2:
I removed the line (require 'python) and now I type M-x ipython. The console that will appear works and I can send commands to it with C-c C-c. The console that I open with C-c C-p does not work. So I can consider solved my problem.


texts: Long tables in emacs org do not export correctly through latex-pdf

texts: I want to export two long tables (each 6X179). I tried to export with latex-->PDF using #+ATTR_LATEX: :float sidewaystable attribute. But what I get is this result, I get just three pages pdf file (tables are cut at the first page).


texts:
What is the practice of mutation testing in Emacs Lisp?

Source file in question is haskell-indentation.el  with test suite in haskell-indentation-tests.el

There are quite some strings in haskell-indentation.el and I'd like to have an overview how many of those are actually tested properly.

Note that we have line coverage already in place in coveralls.io.


texts: viewing Parents only, no Children, in agenda

texts:
I would like to use agenda to generate a list of currently active projects. An active project (for me) is an entry tagged with wip and is not a TODO entry. I would like the list to have only the top-most entry, ignoring all children. Thus, once the search has hit a match, it can skip searching all children.

I am having difficulty because because tags are inherited by children, and therefore, children show up in my search --- how do I prevent this? For example, doing a match in agenda using wip+TODO="" strips out the TODO items (that's good) but parents and all children inheriting the wip tag show up.

Note: the top-most entry is not necessarily at LEVEL 1 or 2. The top-most entry with a wip tag could be deeper in the outline structure. I am using agenda because I need to search across several org files; otherwise, within a single org file, I would just create a sparse-tree.


texts: Strange cursor behavior with text property invisible

texts:
I am trying to hide some text in my buffer using text property invisible. This works fine, except that the cursor is not moving correctly when the text is hidden. To reproduce this clearly I think I need a large text file, so to generate a dummy text file t.txt :

$ awk 'BEGIN { for (i=1; i<1400; i++) { printf "%4d ", i ; print "abcdedfghijklmnopqrstuvwxyz"; }}' > t.txt

Then consider the lisp code:

(defvar *my-hide* nil)
(defun my-hide ()
  (interactive)
  (setq *my-hide* (not *my-hide*))
  (put-text-property 1 32968 'invisible *my-hide*))

When I open open the file t.txt and position the cursor at the beginning of the buffer and run (my-hide) it correctly hides the first 1000 lines. But if I now try to move the cursor with, for example, the page down key, it is moving one character position to the right on the first line but the right scroll bar is still moving. If I hit it again, it jumps to line 1026, the next time it jumps to line 1013 (the right scroll bar is moving down each time)..

I am using Emacs version 24.3.1 on Ubuntu 14.04.


texts: eshell: Is there a built-in mechanism to permit an alias to process the ARGS?

texts:
I would like to set up a few straight alias (without fixed ARGS) for some external executables in Eshell that need access to the command-line ARGS (that will vary).  The function eshell-maybe-replace-by-alias is expressly designed to omit the ARGS.

EXAMPLE:  The alias file within the Eshell folder [eshell-aliases-file] contains the following entries below.  When I call git diff SHA1234567890 > patch.diff, eshell-maybe-replace-by-alias excludes diff SHA1234567890 and the patch file that gets created is a printout from git telling me what types of command line options are possible -- this is because git was called by Eshell without any arguments.

alias git /Users/HOME/.0.data/.0.emacs/.0.macports/bin/git
alias curl /Users/HOME/.0.data/.0.emacs/.0.macports/bin/curl

I hacked the last line of eshell-maybe-replace-by-alias to include the ARGS [i.e., ,(eshell-parse-command (nth 1 alias) args)], but have a feeling that there may be an existing method to better handle this dilemma.

I played around with creating a custom function named eshell/COMMAND, but ran into several problems with with pre/post command hooks needing to be suppressed the first loop; an extra \n that needed to be suppressed the second loop; escaping double-quotes (of strings greater than one word) in order to survive the first loop; and, an unresolved issue when dealing with redirection >.  Therefore, the hack of eshell-maybe-replace-by-alias seems the easiest approach so far.

[I feel as though a bug report is not the right avenue at this point because Emacs 26 expressly has the ARGS labeled as _args; i.e., disregard the ARGS.]


texts: your emacs does not come with xwidget support... (Windows 10)

texts:
Just unzipped and started using Emacs 25.1, hoping to get a browser running in emacs.  The instructions I found had me enter

"M-x xwidget-webkit-browse-url"

And then I'm asked to complete a command like this:

http://editing.

Which I do with some random URL -- then I'm told that:

Your emacs did not compile with xwidget support.

Can anyone give me some simple instructions to follow to fix this?  (hopefully this isn't too involved...)


texts:
initially, i'am new to emacs. So I have little expierience with emacs.

In past I used Visual Basic or VBA to work with the Output from some .dll.

Now I'am working a little with emacs/elisp.

My question is, is it possible to use emacs to call a function from a .dll und work with the Output (string Array) within emacs?

If it possible, how can I call the function from the .dll.

In past I searched already to an answer to this topic, but i can't find any exampel to do this.


texts: In vim :let @"=@* will copy the content of* register to the " register. How can it be done with evil?


texts: How to convert a BibTeX entry into formatted string?

texts:
I'd like to be able to export BibTeX entries as (flexibly formatted) strings.
For example, a BibTeX entry like this one:
@Article{Chomsky:59,
  author    = {Noam Chomsky},
  title     = {On Certain Formal Properties of Grammars},
  year      = {1959},
  volume    = {2},
  pages     = {137--167},
  journal   = {Information and Control}
}

Should be converted into the following string:
Chomsky, Noam. 1959. On Certain Formal Properties of Grammars. Information and Control 2. 137--167.

I used to manage my BibTeX database with JabRef which lets you customize exports. But I haven't seen something similar in Emacs/bibtex.el.


texts: Python interpreter buffer stops working after a while

texts: I am writing some python code and even when I run my code and the interpreter shows that the code is being run (by putting the code in there in blue), it doesn't show a result. It isn't even showing errors or outputs of print functions. Any clues? I have elpy set up and the interpreter works for a while then stops until I close and reopen emacs. Attached is a photo of what I mean where you can see that it is running the print function but isn't actually printing. For what it is worth val = lambda x,y : (x*y)*52 which is just a test function to show that this isn't working.


texts: Finder of MacOS Catalina cannot open a file with Emacs

texts:
After upgrading to macOS Catalina, Emacs (v26.3 from GNU Emacs for Mac OS X) works very strange. Without Emacs already running, Finder can open a file with Emacs as usual. But once Emacs.app is running, it cannot any longer. For example, double clicking the file on Finder window does nothing; no error message, either.

Opening a file from Emacs GUI causes no problem. Drag-ang-drop'ing a file onto Emacs also works fine.


texts:
I use company-mode for auto-completion and sometimes I have a strange problem with Emacs-Lisp. Variables are not shown among the completion candidates. Sometimes, if shown, pressing <f1> doesn't open any documentation. I have to shut down Emacs and reboot. This behavior seems to be completely random. Any hint?

(By the way: this used to happen also when I was using auto-complete-mode)


texts: Prevent fill-paragraph from breaking LaTeX citations in Org Mode

texts:
Stumbled upon the following problem.

Whenever fill-paragraph finds a LaTeX citation such as \citep[][p. 10]{darwin1859} (which appears as (Darwin, 1859, p. 10)), the paragraph gets broken like this:

Text text text text \citep[][p.
10]{darwin1859} text text text.

How can I keep the citation intact, including the whitespace in [p. 10]?

Now for what I've found so far.

There's a fill-nobreak-predicate hook that may contain functions that check whether fill-paragraph should skip certain regexps from being split (if I'm not mistaken).

I tried with this code but failed:

(defun my-nobreak-p ()
  (looking-at-p "\\\\citep.*\\}"))
(add-hook 'fill-nobreak-predicate #'my-nobreak-p)


texts: Why cannot thumbnails be created by image-dired?

texts:
when I view png images in Dired-mode there is no problem but when I try to view the thumbnail of it (C-t d), it fails and throws this error: could not create thumb of <filename>.

M-: of dynamic-library-alist returns these lists:

((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll") (png "libpng16.dll" "libpng16-16.dll") (tiff "libtiff-5.dll" "libtiff3.dll" "libtiff.dll") (jpeg "libjpeg-9.dll") (gif "libgif-7.dll") (svg "librsvg-2-2.dll") (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") (glib "libglib-2.0-0.dll") (gobject "libgobject-2.0-0.dll") (gnutls "libgnutls-28.dll" "libgnutls-26.dll") (libxml2 "libxml2-2.dll" "libxml2.dll") (zlib "zlib1.dll" "libz-1.dll"))

What fundamental point am I missing?

Notes:

Windows 7 32 bit
Emacs 24.4


texts: Complete minibuffer using completion-at-point

texts:
I'm trying to do more or less the same thing as M-x eval that can autocomplete with tab each word. So here is the code I came up with, using partly this site. However, I don't know why but it works in major mode but not in minibuffer... Any idea why?

Thank you.

(setq xyz-keywords
      '("touch"
       "touch_start"
       "touch_end"
       "for"
       "foreach"
       "forall"
       ))

(defun xyz-completion-at-point ()
  "This is the function to be used for the hook `completion-at-point-functions'."
  (interactive)
  (let* (
         (bds (bounds-of-thing-at-point 'symbol))
         (start (car bds))
         (end (cdr bds)))
    (list start end xyz-keywords . nil )))

(define-derived-mode xyz-mode c-mode "xyz"
  "Major mode for editing xyz lang code …"
  (add-hook 'completion-at-point-functions 'xyz-completion-at-point nil 'local)) ;; Works in mode

(setq my-mode-map (copy-keymap minibuffer-local-map))
(define-key my-mode-map (kbd "TAB") 'completion-at-point)
(let (
      (minibuffer-setup-hook (copy-sequence minibuffer-setup-hook))
      (completion-at-point-functions '(xyz-completion-at-point)))
  (read-from-minibuffer "Prompt: " nil my-mode-map))

-- EDIT --

I found this solution, but I've no idea if using this is a good idea:

(let (
      (completion-at-point-functions '(xyz-completion-at-point))
      (minibuffer-setup-hook (lambda () (add-hook 'completion-at-point-functions 'xyz-completion-at-point nil 'local))))
  (read-from-minibuffer "Prompt: " nil my-mode-map))


texts: How to avoid own address in Cc with `gnus-summary-followup`

texts: I receive an email sent also to other people in Cc.  If I reply to it with gnus-summary-followup, Gnus includes me in the Cc list. How can I avoid that?


texts: I'd like to know if it is possible the buffer is saved at the exact moment of modification; at the instant of the key up event.


texts: GUI Emacs sets the exec-path only from Windows environment variable but not from .emacs file

texts:
I use Emacs 25.1 on my Windows XP laptop both as a command-line app (on ConEmu terminal emulator with MSYS bash as the shell) and as the GUI Emacs. I mainly use Emacs to test and compile programs, so I frequently use Mono C# compiler (gmcs) and GCC. The path of gmcs is defined inside the Windows environment variable Path, so when I use gmcs in GUI Emacs, it works.

But the path of GCC (/c/MinGW/bin) is defined inside ~/.bashrc   and if I try to use GCC in GUI Emacs, it doesn't work.

If I start emacs -nw from within ConEmu terminal and try to compile a C code using M-x compile & gcc my-c-code.c -o my-c-code.exe there's no problem: Emacs recognizes the gcc command and does the compilation.

When I try to do the same thing in GUI Emacs it says:

gcc my-c-code.c -o my-c-code.exe
/usr/bin/bash: gcc: command not found

To introduce the GCC's path into Emacs's exec-path I've added these into .emacs file:

(setq exec-path (append exec-path '("C:/MinGW/bin")))
(setenv "PATH" (concat "C:/MinGW/bin"  (getenv "PATH")))
(setq shell-file-name "C:/msys32/usr/bin/bash.exe")

but none of them helped. The last line helped only if I open a shell within GUI Emacs, but not at the M-x compile stage.

How can I define the path of GCC inside the .emacs file? Note that I might add the path of GCC in the Windows env variable Path, but I don't want to solve it that way, I'd like to solve it the Emacs way. Thank you!


texts: How to set PATH variable to latex, so that I can use latex layer?

texts: I installed the latest version of MacTex, and I am sure the latex is in the Libray/TeX/texbin/, I just don't know how to set the PATH variable, also I cannot install the AUCtex, I assume these two are the same PATH problem. I have no idea how to solve these.


texts: How to use double keyboard macro, or keyboard macro of keyboard macro?

texts:
First of all, I made a new keyboard macro called 'mac'.

[F3] abcd [F4]
M-x name-last-kbd-macro mac

Then, I can get 'abcd' by typing [F4] or M-x mac. I tried to get 'abcd' five times. So I made a new keyboard macro of keyboard macro.

[F3] C-u 5 M-x mac [F4]

I expected to see 'abcdabcdabcdabcdabcd' when I typed [F4]. However, keyboard macro of keyboard macro made 'abcdabcdabcdabcdabcdabcdabcdabcdabcdabcd' which is 10 times of 'abcd', rather than 5. What's wrong with it?


texts: Recognize LaTeX partial files (with no preamble) as LaTeX

texts:
I installed auto-complete and also auto-complete-latex so to be able to use it with LaTeX files. Because in a document I use an external file with the preamble commands in it, Emacs recognises only the external one as a LaTeX file and the other is recognised as a plain TeX file, preventing the auto-completion. What can I do so fix this?

I don't use AUCTeX.


texts:
Info-apropos "grovels indices of all known Info files on your system for STRING" and builds a menu of the possible matches.  However, with numerous manuals on my system, the process takes a while.
Is there a way to search within the current Info file for STRING and build a menu of the possible matches?
Many of my manuals are built from source and I'm confident there's no Org mode related matches in, say, the Python documentation.  Presently I use C-s (isearch-forward) to look through the current manual sequentially for matches.


texts: org-mode captions not supported for EXAMPLE blocks?

texts:
Please consider the following, self-contained .org file MVE, which I hope is self-explanatory:

#+OPTIONS: toc:nil

Figure [[captions-work-for-src-blocks]] shows that captions are correctly exported
for SRC blocks. The second figure, in an EXAMPLE block, does not receive an
exported caption. Furthermore, cross references to figure
[[captions-dont-work-for-example-blocks]] incorrectly resolve to figure
[[captions-work-for-src-blocks]].

-----
#+NAME: captions-work-for-src-blocks
#+CAPTION: Captions work for SRC blocks
#+BEGIN_SRC
  foo(bar) == baz(qux);
#+END_SRC
-----

-----
#+NAME: captions-dont-work-for-example-blocks
#+CAPTION: Captions don't work for EXAMPLE blocks
#+BEGIN_EXAMPLE
  foo(bar) == baz(qux);
#+END_EXAMPLE
-----

On org-latex-export-to-pdf, it produces the following output:

I'm using the following versions of the software:

: Emacs version: GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
:  of 2016-09-17
: org version: 9.0.7

I looked at the official org-mode documentation, but I could not find information relating to this issue.


texts: Remote shell path - env: No such file or directory

texts:
In Emacs, when I open the file /ssh:USER@HOST:/PATH, Tramp mode kicks in and everything is great. While editing the file, I want to open a remote shell as well using M-x shell, but its behaviour is just baffling. It seems to recognize I'm in Tramp mode (based on default-directory, I think), and it presents this prompt in the minibuffer:

Remote shell path: /ssh:USER@HOST:PATH//usr/local/bin/bash
                                      ^
                                      \-- Cursor here

The cursor is in the middle there, with the left part in grey and the right part in black. The right part is my local login shell. Now, if I press enter, it doesn't work. The buffer just has:

env: ‘/usr/local/bin/bash’: No such file or directory

The *Messages* seem to indicate nothing went wrong with the Tramp connection:

Tramp: Opening connection for USER@HOST using ssh...
Tramp: Sending command ‘exec ssh -q -l USER  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none HOST’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘HOST’
Tramp: Opening connection for USER@HOST using ssh...done

I think I know what's happening. It's trying to run /usr/local/bin/bash on the remote server as the shell (which doesn't exist). If I manually change it to /ssh:USER@HOST:PATH/bin/bash, it works and I get a remote shell as I expect. Note that I have to remove the double slash, and I have to keep the ssh part; /ssh:USER@HOST:PATH//bin/bash doesn't work, nor does /bin/bash.

My question is, WHY does Emacs assume the remote machine has the same shell at the same path? Why can't it just use the login shell of my user on that machine, which is what I'd assume people want 99% of the time? Is there any configuration to fix this?

Some details about my environment:

macOS 10.12.6
emacs build (Homebrew): d12frosted/emacs-plus/emacs-plus: stable 25.3 (bottled), HEAD
using emacs -q, so no config
my login shell on the local machine is /usr/local/bin/bash


texts: How to use "american" language for babel in latex export

texts:
I have a question about the babel latex package (not org-babel, which allows source code in documents).

I need to load the babel package with the american language set so I added:

#+LATEX_HEADER: \usepackage[american]{babel}

to my org file. However, in the tex export it adds english to this so that the tex output has:

\usepackage[american, english]{babel}

which I don't want. How can I fix this?

Thanks in advance!


texts: Hook to run on completion of exporting org to html

texts:
I've defined a custom command with shell-interpreter to rsync files to my VPS...
(defun rsync_html ()
  (interactive)
  (with-shell-interpreter
   :path "~/org"
   :interpreter "bash"
   :form
   (message "rsync org html output to OVH")
   (message (shell-command-to-string "rsync -av ~/org/*.html ovh:~/www/. --exclude='*.org'"))))

It works, I can run M-x rsync_html and the files are get copied over.  What I'd now like to do though is have a hook that runs after compiling .org files to HTML that runs this command.
I've looked through Documentation for Org hooks, commands and options and found the org-html-export-as-html which I am guessing is the command run on export.  So I've written...
(add-hook 'org-html-export-as-html 'rsync_html)

...but it doesn't seem to work.  Before reaching this point I had already tried (add-hook 'org-babel-after-execute-hook 'rsync_html) but this tried syncing after processing every chunk which whilst it achieved the desired result because it ran after the last chunk had processed is wasteful/inefficient (particularly if the SSH key isn't loaded into the keyring).
I'm unsure how to go about investigating why the hook isn't picked up, perhaps I've chosen the wrong command to hang my hook on but I think its right (if not I'm stumped as to how to see what it should be).
Advice and pointers welcome.
Thanks.


texts:
I want the elfeed-show-mode to be displayed with the olivetti minor mode olivetti-mode, so I do:
(add-hook 'elfeed-show-mode-hook 'olivetti-mode)

The problem is that the lines are not truncated correctly (see image). I have to invoke elfeed-show-refresh every time to obtain the desired effect. Thank you very much in advance for any hint.


texts:
When I attach files using M-x mml-attach-file,

C-x m does attachments as expected but

M-x mail just sends the text

<#part type="text/plain" filename="~/Downloads/coding_style.c" disposition=attachment description="modified coding_style.c"> <#/part>

Why are these different when sending mail works with both?


texts: How can I copy an email message in mu4e?

texts:
I'm using mu4e for my e-mail, and am very happy with it.  However, now I need to copy e-mail messages from one Maildir to another, instead of moving them.  However, in the mu4e documentation, I could not find anything about copying (i.e., duplicating and then moving one instance) of a message.

Did I overlook something, or is this indeed not possible?


texts:
In orgmode you can move subtrees up and down using org-metaup and org-metadown. I use it all the time to move paragraphs around.

Is it possible to do the same with sentences inside a paragraph?


texts: Replace all literal substrings from a list in a string

texts:
My goal is to replace all literal sub-strings in a given string.

  (defun translate (str)
    (concat (mapcar (lambda(cons)
              (replace-in-string (car cons) (cdr cons) str))
            '(("ä" "ae")
              ("ö" "oe")
              ("ü" "ue")
              ("ß" "ss")))))
  )

  (defun replace-in-string (what with in)
    (replace-regexp-in-string (regexp-quote what) with in nil 'literal))

translate should replace all ä's by ae's etc. but it doesn't. Can you please tell me what is wrong?

See this discussion for replace-in-string.


texts: Slow markdown-mode as Emacs spends lots of time fontifying

texts:
Emacs on my Mac got upgraded when I upgraded some other package in Homebrew and now working with Markdown files is very slow. I'm now running the railwaycat/emacsmacport/emacs-mac package version with Emacs version 27.1. My markdown-mode is 20201211.329. Disabling markdown-mode makes the problem go away. I have run the profiler (in cpu mode) and gotten the following report:
+ redisplay_internal (C function)                                7782  75%
+ command-execute                                                1850  18%
+ ...                                                             443   4%
+ jit-lock--antiblink-post-command                                162   1%
+ timer-event-handler                                              21   0%
+ #<compiled 0x421b5d07>                                            9   0%
+ gui-set-selection                                                 4   0%
+ clear-transient-map                                               1   0%

Digging into redisplay_internal reveals the following:
- redisplay_internal (C function)                                7782  75%
 - jit-lock-function                                             7687  74%
  - jit-lock-fontify-now                                         7687  74%
   - jit-lock--run-functions                                     7681  74%
    - run-hook-wrapped                                           7681  74%
     - #<compiled 0x1feee74d43f1>                                7681  74%
      - font-lock-fontify-region                                 7671  74%
       - font-lock-default-fontify-region                        7671  74%
        - font-lock-fontify-keywords-region                      7663  74%
         - markdown-match-italic                                 7418  72%
          - markdown-match-italic                                7295  71%
           - markdown-match-italic                               7282  70%
            - markdown-match-italic                              7267  70%
             - markdown-match-italic                             7132  69%
              - markdown-match-italic                            6999  68%
               - markdown-match-italic                           6884  67%
                - markdown-match-italic                          6764  65%
                 - markdown-match-italic                         6656  64%
                  - markdown-match-italic                        6556  63%
                   - markdown-match-italic                       6454  62%
                    - markdown-match-italic                      6446  62%
                     - markdown-inline-code-at-pos-p               5758  56%
                      - markdown-inline-code-at-pos               5757  56%
                       - markdown-match-code                     5753  56%
                        - markdown-search-until-condition               5753  56%
                           apply                                 5752  55%
                         markdown-beginning-of-text-block                  3   0%
                         markdown-end-of-text-block                  1   0%

In short, Emacs appears to be spending looking for the following regular expression in order to identify inline code blocks:
"\\(?:\\`\\|[^\\]\\)\\(?1:\\(?2:`+\\)\\(?3:\\(?:.\\|\n[^\n]\\)*?[^`]\\)\\(?4:\\2\\)\\)\\(?:[^`]\\|\\'\\)"

I know much more than when I posted v1 of this question but I'm still not sure--how do I fix this?


texts: Quickly get the full path+name of the file being edited

texts:
When editing a a files in a deeply nested folder structure,

how can I quickly copy/yank the full name of the file (including folder path(s) )


texts: Is it possible for a code-block in one org file to include a noweb reference to a code-block in another org file?


texts: Change the behaviour of RET (with electric indent) to only indent the new line, not the previous one

texts:
https://stackoverflow.com/questions/27077770/how-do-i-disable-electric-indent-on-ret-but-still-keep-other-electric-characters asks and answers how to disable electric indent when pressing RET. All similar questions also seem to stop at "disable electric-indent-mode".

Out-of-the-box, RET indents the previous line and the new line. For the new line this means that it simply adds enough whitespace to make the cursor appear at the correct position.

I like the second part of the behaviour but not the first, i.e. I never want it to indent the previous line. Is there a way to change it so it gives me enough whitespace on the new line but keeping the previous line untouched?

I actually don't need/want most of the electricity. A solution which involves turning off electric-indent-mode but somehow activating the "add whitespace for new lines" feature would be fine with me.


texts: move-beginning-of-line broken in comint mode

texts:
After a while running emacs (typically days) all comint buffers start to behave strangely (shell, python, SQL).  The ones I have already opened and the new ones that I open.

When I am after prompt, C-a moves tho the beginning of the line, as opposed to right after the prompt.  More irritating is the fact that in this state C-up (comint-previous-input) moves to the beggining of the line before inserting the previous input, leaving the line broken (the text is before the prompt).

A workaround for the second problem is to do (setq comint-use-prompt-regexp t), but the first problem remains.

That was happening with emacs 24.3 in GNU Linux (cassou ppa for Ubuntu 12.04) and happens also now with emacs 24.4 (compiled by myself).

I debugged the shipped comint.el and tracked the issue to the built-in function line-beginning-position; in freshly started emacs sessions that function works fine in comint mode.  After a while this function just returns the point at the beggining of line (just like comint-mode were not enabled).

I suspect it has something to do with my setup, since google did not came up with any help.  However, binary search is not an option since I would need to spend days with a half functional emacs while waiting for the problem to happen.

Any ideas about how to narrow the suspects or further debug the problem?


texts:
If I recall correctly I was able to view the C indentation rules applied for indenting the line at point.

After searching the manual for a while I still can not find the command  for it. Obviously I'm missing the proper key words for my search.

Can you tell me how what the name of this command is?


texts: In elisp, search and replace only on lines containing a specific string

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

I need to search and replace only on lines containing a specific string.

Interactively, I use occur, move to the occur buffer, and do all search and replacement there.

I would, now, like to do the same in Elisp code. So, I wrote the following code:

(defun xx-things ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (search-forward "A" nil t)
      (while (search-forward "B" nil t)
        (replace-match "C" 1)))))

And used it on a buffer with:

AB
BB
CB

But it replaces all Bs with Cs whereas it should only replace AB with AC.

What is wrong here? How do I set it right?


texts:
How to navigate in same level list, with sub list in between?
- one (cursor at the beginning)
  - two
    - three
- four (move to this list)

Tried C-up and M-a, but they go through each sub level, instead of jumping directly to next same level list.


texts:
I am trying to define new keywords for org-mode in order to highlight text in buffer.
I followed this tutorial and this one which leads me to the following code :
(defface ex-face
  '((t (:foreground "red")))
  "Face for !")

(defface caret-face
  '((t (:foreground "orange")))
  "Face for ^")

(defface at-face
  '((t (:foreground "green")))
  "Face for %%")

(defvar my-org-custom-keywords
  '(("!!" . ex-face)
    ("^^" . caret-face)
    ("%%" . at-face)))

(defun my-org-add-custom-keywords ()
  "Add custom keywords."
  (loop for (delimiter . face) in my-org-custom-keywords
        do (add-to-list 'org-font-lock-extra-keywords
                        `(,(concat "\\(" (regexp-quote delimiter)
                                   "\\)\\([^\n\r\t]+\\)\\("
                                   (regexp-quote delimiter) "\\)")
                          (1 '(face ,face invisible t))
                          (2 ',face)
                          (3 '(face ,face invisible t))))))

(add-hook 'org-font-lock-set-keywords-hook #'my-org-add-custom-keywords)

I restarted emacs.
Unfortunately, when I ask for the value of org-font-lock-set-keywords-hook I always get :

: GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.14)
:  of 2020-03-26, modified by Debian
: Spacemacs v.0.200.13


texts: How do you do a clean install of emacs+auctex?

texts:
It was established here there is a problem with my installation of emacs. So I did

$ sudo apt-get --purge autoremove emacs

and remove all in

$ locate emacs | grep conf

I reinstalled emacs from source (configure, make, make install). In the process, I had to do:

$sudo apt-get install emacs24-common
$sudo apt-get install libotf-bin
$sudo apt-get install libm17n-0

As this point I can get emacs to start. Then:

$ sudo apt-get install auctex

But the list of problems never ends. A suggestion?

$ sudo apt-get install auctex
Reading package lists... Done
Building dependency tree
Reading state information... Done
auctex is already the newest version (11.88-1.1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up emacs24 (24.5+1-6ubuntu1.1) ...
Install cmake-data for emacs24
install/cmake-data: Byte-compiling for emacs24
>>Error occurred processing cmake-mode.el: File error (("Opening input file" "no such file or directory" "/usr/share/emacs24/site-lisp/cmake-data/cmake-mode.el"))
Install emacsen-common for emacs24
emacsen-common: Handling install of emacsen flavor emacs24
>>Error occurred processing /etc/emacs24/site-start.d/00debian-vars.el: File error (("Opening input file" "no such file or directory" "/etc/emacs24/site-start.d/00debian-vars.el"))
>>Error occurred processing /usr/share/emacs24/site-lisp/debian-startup.el: File error (("Opening input file" "no such file or directory" "/usr/share/emacs24/site-lisp/debian-startup.el"))
ERROR: install script from emacsen-common package failed
dpkg: error processing package emacs24 (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of auctex:
 auctex depends on emacs24 | emacs-snapshot; however:
  Package emacs24 is not configured yet.
  Package emacs-snapshot is not installed.

dpkg: error processing package auctex (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
         Errors were encountered while processing:
 emacs24
 auctex
E: Sub-process /usr/bin/dpkg returned an error code (1)

Other info:

$locate emacs

output


texts: How do I export org files with emojis to pdf (or html)?

texts:
I managed to teach my Spacemacs to render emojis, but couldn't figure out how to make it export emojis to PDf (I can live with HTML too) as an actual emoji  character and not as :smile:
I saw someone suggesting overriding emojis using org-export-html-protect-char-alist but it feels like overkill.


texts: How to append some behavior to a command?

texts:
How do I string together functions and actions in a key binding.
Say I want to make a binding that does comment-dwim and then appends "TODO: " to achieve /* TODO: */ in C.
(global-set-key (kbd "C-c T") 'comment-dwim "TODO: ")

This doesn't work because comment-dwim interprets the following as an argument.
Same for
(defun insert-todo () "TODO: ")

(global-set-key (kbd "C-c T") 'comment-dwim 'insert-todo)


texts: How can I type simple underline "_" in Auctex

texts: I am using Auctex in Aquamacs. Everytime I type underline "_", it will show as $_{}$ automatically which is very annoying. I am wondering how could I turn off this function. Thanks.


texts: Emacs on Windows. Dired - no sorting. Unrecognized symbols

texts: Set up Doom Emacs on windows. Works fine but in Dired i have unrecognized symbols and also in org-capture. Sorting in dired does not work either. Any ideas? Latest Emacs.


texts: How to insert a formatted string into a specific buffer?

texts:
I am looking for a way to insert a formatted text into a specific buffer (not the active buffer).

As it seems to me, the only way to do so is to use a snippet as shown below:

(insert (propertize (format-time-string "%H:%M:%S")
                    'face
                    '(:height 4.0 :inverse-video t)))

The above inserts it into the active/current buffer.

There are ways to insert strings to a specific buffer but then they do not support formatting.

I am starting to wonder if what I intend to do is even possible...


texts: Prevent Emacs from asking "kill anyway" when only text properties have changed

texts:
I have a read-only file that I open in Emacs. I have created a keyboard shortcut to hide some regions of the file. For example:

(defun hide-beginning ()
  (interactive)
  (setq buffer-read-only nil)
  (put-text-property 1 10 'invisible t)
  (setq buffer-read-only t)
  )

However, when I exit the buffer with kill-buffer or rather ido-kill-buffer, I get the question

Buffer myfile.txt modified; kill anyway? (yes or no)

How can this question be avoided?


texts: Org: Add front cover for LaTeX/PDF export?

texts:
I want to add a front cover for my Org document which will export as a PDF (#+LaTeX_CLASS: article). I don't want to modify my org-latex-classes and apply globally.

I tried to add the following block before first outline of the Org document, but it will insert the cover under the contents.

Is there any way to insert a LaTeX block to generate front cover for an individual Org article?

#+BEGIN_LaTeX latex
\newcommand*{\titleGP}{\begingroup % Create the command for including the title page in the document
\centering % Center all text
\vspace*{\baselineskip} % White space at the top of the page

\rule{\textwidth}{1.6pt}\vspace*{-\baselineskip}\vspace*{2pt} % Thick horizontal line
\rule{\textwidth}{0.4pt}\\[\baselineskip] % Thin horizontal line

{\LARGE THE BIG BOOK\\ OF \\[0.3\baselineskip] \LaTeX ~TEMPLATES}\\[0.2\baselineskip] % Title

\rule{\textwidth}{0.4pt}\vspace*{-\baselineskip}\vspace{3.2pt} % Thin horizontal line
\rule{\textwidth}{1.6pt}\\[\baselineskip] % Thick horizontal line

\scshape % Small caps
A number of fascinating and life-changing templates \\ % Tagline(s) or further description
presented  in a clear and useable way \\[\baselineskip] % Tagline(s) or further description
New Zealand,  2011--2012\par % Location and year

\vspace*{2\baselineskip} % Whitespace between location/year and editors

Edited by \\[\baselineskip]
{\Large JOHN SMITH \\ JANE SMITH \\ JAMES SMITH\par} % Editor list
{\itshape The University of California \\ Berkeley\par} % Editor affiliation

\vfill % Whitespace between editor names and publisher logo

{\scshape 2012} \\[0.3\baselineskip] % Year published
{\large THE PUBLISHER}\par % Publisher

\endgroup}
\titleGP % This command includes the title page
#+END_LaTeX


texts:
I have this function that sets the isearch-filter-predicate variable to a predicate (function) from a list of predicates:

(defun set-isearch-filter-predicate ()
  (interactive)

  (unless (boundp 'IFP-default)
    (setq IFP-default isearch-filter-predicate))

  (let* ((INIT (symbol-name IFP-default))
     (PREDICATES '(
               "predicate1"
               "predicate2"
               "predicate3"
               ))
     (IFP_STRING (read-string "Choose predicate: " INIT nil PREDICATES))
     (IFP (intern-soft IFP_STRING)))

    (setq isearch-filter-predicate IFP)))

I'd like to view the "name" (e.g. "predicate1") of the predicate I've setted in the mode-line. Is it possible without define specific minor-modes?

I'd like also to know how to use symbols instead of strings (e.g. predicate1 instead of "predicate1" in my code, but it's not vital (I tried read-command instead of read-string but it doesn't work).


texts: Emacs Orgmode: hiding other items in the tree

texts:
I have an org file, that looks like:

* Item 1
** Subitem 1.1
* Item 2
** Subitem 2.1
This text from Subitem 2.1
** Subitem 2.2

I am editing text under Subitem 2.1. Is there a way to hide everything from the screen, except Subitem 2.1, so ideally while editing the text I just want to have a view like:

** Subitem 2.1
This text from Subitem 2.1


texts:
If I have multiple windows open, I can maximize one using M-x maximize-window.

How should I restore the windows to their original size?


texts: A elisp function to jump between matched pair

texts:
Here is the function spec: (defun jump-to-matched (open-char closed-char)  )

say the content of current buffer is "a([b]c()d)".

If I move the cursor over the first "(" and run (jump-to-matched "(" ")"), I expect the function return 9 which is the position of ")" at the end of the buffer.

If I move the cursor over the "[" at the position 2 and run (jump-to-matched "[" "]"), I expect the function return 4 which is the position of "]".

My question is how to implement such function?


texts: View a whole file name or path in helm buffer

texts:
I have long paths and filenames showing in my helm session and I want to quickly look at one and then go back to the normal view.  You can see my long paths and filenames below:

There are several related things that helm will do.  One of them is C-] Toggle Details, which gives toggles the view (starting with the above) shown below:

This only shows the full filenames though, and I also want to view the paths.

Another option in GUI emacs is to mouseover a result, but the path is so long that the hover text goes off the screen ('fml', nothing worse than thinking you've been saved by contextual hover menu/text, which then jumps off the screen anyway :D)

Finally, you can both widen columns and toggle truncated lines.

That last one is important, because what I want to do, ideally, is toggle truncation for a selection of lines (or just the current line) with a key command.


texts: How to disable commented date in org mode html export

texts:
When you export an org file to html, a date will appear in the html source though commented.

Example, line 5 of https://imgur.com/a/BY4QSdt .


texts: How can backup-directory-alist be set to save in the files directory?

texts:
I want the backup files to be created in sub-directories of the files being edited, and I have created a function returns that directory.

(defun tempfilepath ()
  (interactive)
  (concat (file-name-directory buffer-file-name) "./editorbackups")
)

So I need backup-directory-alist to be something like

(setq backup-directory-alist `("." . tempfilepath))

where tempfilepath will be evaluated when the file at runtime so all the backup files are saved under the files folders.

I am not sure how to get the syntax right and the role make-backup-file-name-function if it is necessary in this case.


texts: Something not right with this Flycheck checker - unclear why

texts:
I just wrote the following checker for syntax-checking Vala code using valac:

(flycheck-def-option-var flycheck-vala-packages nil vala-valac
  "A list of additional pakages for valac.

The value of this variable is a list of strings, where each string is what would get passed to valac's --pkg option."
  :type '(repeat (file :tag "Include package"))
  :safe #'flycheck-string-list-p
  :package-version '(flycheck . "0.20"))

(flycheck-def-option-var flycheck-vala-enable-experimental-non-null nil vala-valac
  "Whether to enable strict non-null checking for valac.

When non-nil, enable strict null checks as by --enable-experimental-non-null."
  :type 'boolean
  :safe #'booleanp
  :package-version '(flycheck . "0.20"))

(flycheck-define-checker vala-valac
  "A Vala syntax checker using valac."
  :command ("valac"
            "-c -o" null-device
            (option-flag "--enable-experimental-non-null" flycheck-vala-enable-experimental-non-null)
            (option-list "--pkg" flycheck-vala-packages)
            source)
  :error-patterns ((error line-start
                          (file-name)
                          ":" line "." column "-" line "." column ": error" (message) line-end)
                   (warning line-start
                        (file-name)
                        ":" line "." column "-" line "." column ": warning: " (message) line-end))
  :modes vala-mode)

(add-to-list 'flycheck-checkers 'vala-valac)

However, when I try to use it, I get the following two errors; the first on loading my init file:

Symbol's function definition is void: flycheck-checker-get

And this one when I try to use the checker on a Vala file:

Suspicious state from syntax checker vala-valac: Checker vala-valac returned non-zero exit code 1, but no errors from output: Unknown option -c -o
Run '/usr/bin/valac --help' to see a full list of available command line options.

Checker definition probably flawed.

I'm not sure about why this is happening, especially the first one. The second error is clearly due to argument order, but according to the valac manpage, both -c and -o are valid flags.


texts: Evil text object for innermost paired delimiter?

texts:
Q: how can I create a text object for innermost paired delimiters?

evil has text objects to allow us to operate on the standard
paired delimiters like parentheses, braces, brackets, quote marks,
and so on.

When I'm using the paired delimiters, though, I'm usually
looking to operate on the innermost pair:

Here's some text (and a parenthetical remark with "quotes*" in them).

If the * in "quotes" is point, I want to operate on "quotes"
rather than the full parenthetical expression.  In this case, I could just use the quotes text object, but I'd like to create a single, DWIM text object for the purposes of keybinding.

How can I define a text object that will simply select the
innermost paired delimiters (as defined in some variable)?


texts: emacs -nw & gnome-terminal or xterm: can't distinguish C-M-v and C-M-S-v

texts:
emacs (v.26.3) can distinguish, out of the box, C-M-v (scroll-other-window) and C-M-S-v (scroll-other-window-down).

On the other hand, emacs -nw, when run in either gnome-terminal, mate-terminal or xterm, translates C-M-S-v to C-M-v, even when I explicitly set the former.

(Also, as a side note, xterm demands I use ESC rather than the "Alt" key, which is actually "Meta".  Bonus question: why?)

Anyone know how I can deal with this?


texts:
I am used to manage my bibliography  with org-ref and I am very satisfy with it. Nevertheless, in the context of a grant proposal writing, space is limited. So I would to save the space allowed to bibliography refs by replacing the classical citation approach by direct links on DOI (through https:\\doi.org...) of the cited paper.
i.e. something like:

[[https://www.doi.org/10.1002/jbio.200900094][Sim2017]]

instead of :

cite:sim2017

Do you know if is there a way to do what I expect  with org-ref ?  Thx


texts:
So I've been trying to add custom syntax highlighting for digits using font-lock-add-keywords and regex.
I've been looking at all the Emacs resources to do this, and while I have been able to successfully define a face, font-lock-add-keywords has not been working for any apparent reason.
I have even copied the examples from different sources and directly tried to get them to work with no apparent success. I can't seem to figure out what's wrong with my code. I'm not receiving any errors, but when I try to eval the font-lock-add-keywords (with C-x C-e), it prints nil in the *Messages* buffer.
Update
I took Gilles advice and created a minor mode, set font-lock-add-keywords to that custom minor mode, and used a quote for the face. While I can see the minor mode in the mode line and know that it's working, font-lock-add-keywords still does not seem to work. Here is my updated code:
(defgroup gio-group nil
  "Group for customization"
  :prefix "gio-")

(defface gio-highlight-numbers-face
  '((t :inherit (default)
       :foreground "#ffff00"))
  "Face for numbers"
  :group 'gio-group )

(define-minor-mode gio-minor-mode
  "Minor mode for customizaion"
  :init-value t
  :lighter " GioMode"
  :global t
  :group 'gio-group)

(font-lock-add-keywords 'gio-minor-mode '(("[0-9]+" . 'gio-highlight-numbers-face)))

I'm running GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) on Windows 10. Any help is much appreciated! Thank you!


texts:
How can I automatically move selected to the other window? Trying to streamline my split-window workflow.

Here's what I have so far. Doesn't work yet.

(defun move-region-to-other-window (start end)
  "Move selected text to other window"
  (interactive "r")
  (if (use-region-p)
      (let ((count (count-words-region start end)))
        (save-excursion
          (kill-region start end)
          (other-window)
          (yank)
          (newline))
        (other-window)
        (message "Moved %s words" count))
    (message "No region selected")))

Attribution: Code above is based on danielsz's excellent package Palimpsest Mode.


texts:
So, I can send emails with Emacs now. But reading emails seems to be more difficult task. I want to do it with rmail. This article says that I need to add the following lines:

(setenv "MAILHOST" "pop.openmailbox.org")
(setq rmail-primary-inbox-list '("po:username@openmailbox.org")
      rmail-pop-password-required t)

into my .emacs file. As you can see I'm trying to use my Openmailbox account.

Now, if I execute M-x rmail, after entering my password I see the following message in the echo area:

  movemail: Error connecting to POP server: -ERR [AUTH] Plaintext authentication disallowed on non-secure (SSL/TLS) connections.
  (No new mail has arrived)
  0 new messages read

I'm wondering why I don't have to supply port number (for example I used 587 to send emails) and why do I get this error. How to read emails with Emacs?


texts: Make pdf-tools do pdf-sync-forward-search after compilation

texts:
Using pdf-tools for showing pdfs in emacs is great! But when I use it, I alway have to do a (C-c C-g) i.e., pdf-sync-forward-search after compilation. How can I make emacs do this automatically?

Furthermore, I also get the error message "error in process sentinel", when emacs reverts the buffer. Can I make this go away?


texts: web-mode mojolicious, indentation of elsif

texts:
I'm editing my mojolicious templates (.ep extention, perl+html) in webmode. Everything works fine, except the indentation when I use elsif. Say I have
  % if ( $type eq 'A' ) {
  % } elsif ( $type eq 'B' ) {
  % } else {
     %# default
  % }

then I end up get the following indentation if I hit TAB in each line
      % if ( $type eq 'A' ) {
      % } elsif ( $type eq 'B' ) {
  % } else {
    %# default
  % }

anyone know how to instruct web-mode to keep a proper indentation like in the first sniplet?


texts:
I'm using org-mode for writing and want to be able to highlight sentences or paragraphs which need to be re-written or fact-checked so that those bits are obvious looking through the document.  Is there a way to do this?  I thought about trying to do it using inline comments but I can't figure out a way to do it so that they show up in color and I couldn't get hi-lock to work with highlighting a long sentence as opposed to a reg-ex like you'd use for code.  Alternatively, if anyone has another way of making that kind of text easy to find other than coloring then I would be happy to try it.  Sorry if this has already been asked but I've had a look and can't find it anywhere.

Edited to add:
I'm currently using spacemacs - not sure if that makes a difference - but would be willing to try another flavour of emacs if necessary to get this functionality.


texts: Annoying error message about font-lock-support-mode

texts:
Been using Emacs 24 for more than an year, but not an expert. Following this answer I installed emacs25 from Kevin Kelly's repo. I haven't configured anything on this version yet and I still get an error message saying "Use font-lock-support-mode rather than calling lazy-lock-mode" every time I do M-x. Can someone explain this error and what to do about it?

I tried going to the customize menu and set value of font-lock-support-mode from "mode-specific" to "lazy-lock", but I couldn't save the changes beyond that session.


texts: How do I open an inferior Python process in a full window from the command line?

texts:
From the command line, I want to open an inferior Python process in a full window. I have tried: emacs --eval '(run-python)', but when Emacs opens, the *scratch* buffer is shown instead of the inferior Python process buffer. The Python process is started, but it is not the focused buffer. From the command line, how do I focus the inferior Python process in a full window when starting Emacs?
Assume that I am using GNU Emacs 26.3 with no custom configuration (i.e. emacs --no-site-file --no-init-file ...).


texts: lsp-rust: require + provide but still void-function

texts:
I am trying to use lsp-rust package.
I installed it from melpa.
After I run it I got message in *Messages*:

Error loading autoloads: (void-function lsp-define-stdio-client)

There are two packages: lsp-rust and lsp-mode (both of them I install from melpa),

lsp-define-stdio-client defined in lsp-mode,
and was used in lsp-rust, code from lsp-rust.el:

(require 'lsp-mode)
...
;;;###autoload
(lsp-define-stdio-client 'rust-mode "rust" 'stdio
           #'lsp-rust--get-root
            "Rust Language Server"
           (lsp-rust--rls-command))
...
(provide 'lsp-rust)

If run emacs --debug-init, then problem happens in the first line of .emacs:

(package-initialize)

I not get it, why autoload of lsp-rust happened before lsp-mode,
execution of autoload functions not depend on require and provide?

Update

I can fix this issue, if I edit ~/.emacs.d/elpa/lsp-rust-20170421.326/lsp-rust-autoloads.el, and change

(lsp-define-stdio-client 'rust-mode "rust" 'stdio #'lsp-rust--get-root "Rust Language Server" (lsp-rust--rls-command))

to

(require 'lsp-mode)
(require 'lsp-rust)
(lsp-define-stdio-client 'rust-mode "rust" 'stdio #'lsp-rust--get-root "Rust Language Server" (lsp-rust--rls-command))

In other words add (require 'lsp-mode) and (require 'lsp-rust) manually,
but this is temporary solution, untill M-x list-packages download new version of lsp-rust.


texts: I am configuring mode-line and currently the time is displayed in each window's mode-line, as shown by the image below. Is it possible to restrict the time display to the bottom right mode-line?


texts: Simplest way to add-text-properties without overriding existing ones

texts:
I need to add a text-property to the entire buffer. However, parts of
the buffer might already have that property with a different value.

Q: What's the easiest way to apply a text property only to regions
  that don't already have it?

So far, I've been adding the properties to the content of the buffer, but I'd be willing to switch to overlays if it's way easier with overlays.

For instance, take the following buffer contents, and imagine the text
in each line is saying the truth.

This text has no face.
This text has a blue-colored face.
This also has no face.

I would like to call a function like

(add-low-precedence-text-property
 (point-min) (point-max) 'face 'some-red-face)

and have everything but the second line become red. (the face is just
an example, I actually need this for other properties).


texts: Increasing the frequency of modeline redisplay

texts:
Q: Is there a way to (temporarily) increase the rate at which the mode line is redisplayed?

I was trying to write a package that adds a spinner to the mode line
(to indicate ongoing operations), but I hit a bit of a wall. If the
user is not interacting (not typing, or moving, or something), then
the mode-line might stop updating for up to a minute. If that's the
case then the spinner won't spin.

I started writing a solution with timers (that would periodically
call redisplay), but that seems like a lot of work for something so
simple.


texts: always prompt for default directory when opening interactive subshell

texts:
When I invoke C-u M-x shell while visiting a local file or scratch buffer, emacs does not prompt me to enter the default directory for the shell.

But if I'm visiting a remote file or directory through tramp, then when invoking C-u M-x shell, emacs will ask me for the default directory.

How can I make C-u M-x shell ask for the default directory even when I'm visiting a local file or buffer?


texts: Face color attribute incorrectly applied

texts:
I want to modify the region's foreground regardless of syntax highlighting.

(set-face-attribute 'region nil :foreground "#656555")

But this is what I get (see sample):

C-u C-x = gives:

             position: 483 of 1807 (27%), column: 0
            character: ( (displayed as () (codepoint 40, #o50, #x28)
    preferred charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x28
               script: latin
               syntax: ()   which means: open, matches )
             category: .:Base, a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET HEX-CODEPOINT" or "C-x 8 RET NAME"
          buffer code: #x28
            file code: #x28 (encoded by coding system prefer-utf-8-unix)
              display: by this font (glyph code)
    mac-ct:-*-Monaco-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1 (#x0B)

Character code properties: customize what to show
  name: LEFT PARENTHESIS
  old-name: OPENING PARENTHESIS
  general-category: Ps (Punctuation, Open)
  decomposition: (40) ('(')

There is an overlay here:
 From 483 to 623
  face                 region
  priority             (nil . 100)
  window               #<window 3 on init-theme.el>

There are text properties here:
  fontified            t


texts:
Of course I already know about https://github.com/politza/pdf-tools.

I am on Emacs 24.5.1.

I am not convinced that doc-view is using mudraw/mupdf for pdf files.

(require 'doc-view)
(print doc-view-pdfdraw-program)

outputs

"mudraw"
"mudraw"

However, the following screenshot says otherwise:

Emacs using doc-view on the left, zathura with mupdf backend on the right. Same pdf file, zoomed by hand to approximately the same level. The pdf is here.

As you can see, in the sentence starting with "For instance" for example, the superscript p, and the subscript n are much clearer in zathura. In doc-view, the n in particular is barely readable, if at all, even at this level of zoom.

I am obviously missing something, but not sure what.

(setq doc-view-pdf->png-converter-invocation
      'doc-view-pdf->png-converter-invocation-mupdf)

from http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13164 does not seem to work.

The official documentation does not say much. Searching for answers comes up with that mupdf should be automatically used if it exists. I am on archlinux and have the official ghostscript and mupdf packages installed. The strange thing is (print doc-view-pdfdraw-program) still outputs "mudraw" even after I uninstall the official mupdf package (and after restarting emacs), although this is likely irrelevant.

If you the reader is successfully using mudraw/mupdf with doc-view, then perhaps you might want to download that pdf (and install zathura temporarily) and test out the quality you see in each program. If you see the same or similar thing as my screenshot, perhaps there is no problem here.

Perhaps the mupdf being used by zathura is actually different than the original one/the one doc-view uses. If I recall correctly, zathura uses its own slightly patched version of mupdf. However, my understanding was that zathura slightly patches it so that it works better with zathura itself, not necessarily patching the rendering parts themselves. This comment also seems to suggest that there should be very little, if any, differences between the rendering qualities (and speeds) between doc-view using mudraw/mupdf and zathura with mupdf backend.


texts: Emacs dot files & packages List for user switching from sublime and not founding a starter kit tailored for them

texts:
I'm trying to be able to answer to "sublime users" using a curated list of package, if not a working emacs config (like prelude or starter-kit does), but couldn't find any list or dotfiles for that on the web.
So looking around and from my packages and my very limited knowledge of sublime (from user questions), I gathered

emacs built-ins: show-paren, save-desktop, frame-restore, package, theme
projectile (projects...)
sr-speedbar (for inside window project tree)
project-persist (save the project, switch project, save windows)
ido-flx ( C-M-o to projectile-find-file with ido-flx for "anything")
anything-project
smex
recentf
company (auto-complete)
flycheck and its linters
multi-occur (search in open buffers)
iedit ("mutiple cursor")

As I guess many other emacs user had that question, and answered, I'm looking for what I missed and can use/suggest to sublime user looking for switching ?

The question is: If I'm to build a "sublime-starter-kit" emacs distribution like "prelude" , what packages and features would I need other than those listed ?


texts: Auctex change default comment style for latex-mode

texts:
I want a double %% to start my comments in latex documents. I'have found two solutions suggested
;; solution 1
(add-hook 'latex-mode-hook  '(lambda() (setq comment-start "%% ")))

;; solution 2
(add-hook 'latex-mode-hook (lambda () (setq-local comment-add 0)))

but both don't work.


texts: How to put inline quotes in an org file for html export

texts:
I am exporting an org file with org-reveal. I would like to have the following html markup when exporting:

<q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">“The nice thing about standards is that there are so many to choose from”</q>

What is the markup to use in org-mode for that? For blockquote, it would be:

#+BEGIN_QUOTE
"Everything should be made as simple as possible,
but not any simpler" -- Albert Einstein
#+END_QUOTE

How can I generate the <q></q> markup?


texts: How to create a function with a computed name?

texts:
Let's suppose I have a string "foo" and want to create a function that would be an equivalent of (defun foo (...) ...).

Is there a nice way to do it?

I played with make-symbol and fset, but could not get a working snippet: I fail to produce a new cell to attach both a name and code to.

(Why am I doing this: to better understand how it works.)


texts: Using Emacs as a full-featured C/C++ IDE

texts:
I have been trying off and on for over a year now to use Emacs as a C/C++ IDE.  I have only been marginally successful thus far, but have run into a few brick walls along the way.  Currently I am trying to use CEDET, but I am having a rough time understanding how to use it effectively.

The features that I am looking for in an IDE are as follows:

Management of software "projects."  I want my IDE to have a sense of all of the files that make up my current project so that I can perform functions like search-and-replace within my project. (It would be nice if I could also achieve this without littering my source tree with lots of support files. Why do I need more than one centralized project file per project?)
The ability to build the current project from within the IDE, regardless of which buffer I am currently visiting.  I need to be able to bind a key which will build the current project.
Error reporting.  I don't want to have to read through 500+ lines of output to find the errors that were reported by the build tools.  Preferably, the errors show up in their very own buffer with one line per error.
An awareness of symbols within the project, and where they are defined.  I want to jump to a symbol definition whether it lives in my project files or in the system include files.
Visual debugging.  I want to have a watch list of local variables that update automatically as I step through the code.  I want to be able to set breakpoints in the code see which line of code will be executed next.

I know that each of these features exists because I have had each of them working at one time or another using EDE, Semantic, GDB, etc.  The problem is that I have never been able to have all of these features working at the same time,  because each piece usually has to be configured by itself, and it is usually too much work to figure out how to configure all of them at once and make them work together.

What solutions exist for turning Emacs into a full-featured C/C++ IDE?  Do you always have to configure everything piecemeal, or is there a way to set all of the features up at a time?

EDIT: A good answer to this question does not have to exactly meet all five of the given criteria.  I simply provided the list to give a more concrete idea of the type of features I want to see before I would consider an IDE to be "full-featured."  It is quite possible that CEDET could fit the bill, but I have yet to find a working step-by-step tutorial on how to set it up from scratch.


texts: Put the current file name in the minibuffer

texts:
How can I insert the file name of the active file buffer into a command?

When I invoke a command that needs a file name, I am often doing so from a file buffer and want the name of that file while typing the command into the minibuffer.

I'm looking for a hypothetical C-x… that I can type during forming a command line in the minibuffer.

So if, while the current buffer is a file named Lorem Ipsum.txt, I type this:

M-x grep RET 'foo' SPC C-x … RET

the M-xgrepRET presents a minibuffer prompting for the grep command. In response, I've typed the regex pattern argument ('foo') and inserted the filename argument (C-x…). That minibuffer will end up as:

grep -nH -e 'foo' 'Lorem Ipsum.txt'

What existing command gets the current file buffer's file name like this? What is its default key binding?


texts:
When I want to switch between programs in Windows, I ordinarily use the windows key plus a number key to run a program from my taskbar. Most programs will either start running or, if there's already an instance, bring it to the foreground and focus on it. But Emacs (started with runemacs.exe) will create a new entry on the taskbar, and using the shortcut again will just create a new instance. As far as I can tell, I can't even switch between the different frames using Emacs commands (I tried C-x 5 o).

Is there a way to make it so subsequent uses of the windows hotkeys will just use the existing instance of Emacs and, if not, can I at least make it so I can easily navigate between the different frames? I tried this snippet:

(require 'server)
(unless (server-running-p)
  (start-server))

from the answer to this question, but it didn't make a difference.


texts:
My problem is Emacs with elpy, specifically with (elpy-use-ipython) in my init file.
When I try to open a python file, emacs freezes.

I desactivate ipython and emacs runs well. But I wanna use ipython because it is a great tool.

My OS is Arch Linux, recently (21/07/2016), ipython upgrades from version 4.2.0 to 5.0.0. The emacs version is 24.5.1.

Now, how I can fix this issue? How I can use ipython again?


texts: \subsubsubsection instead of \paragraph in LaTeX export with header levels and section numbering > 3

texts:
How should I get a proper numbered header \subsubsubsection{The Header} instead of a numbered paragraph \paragraph{The Header} when exporting to LaTeX with header levels of more than 3?

Having this in my preamble:

% Set default Counter Depth
\\setcounter{tocdepth}{5}
\\setcounter{secnumdepth}{4}

And this in my Org file:

#+OPTIONS: H:5 num:t

Produces numbered paragraphs instead of proper headings at the fourth level and above.

The answer given over here did not solve the problem.

Sample Data:

#+OPTIONS: H:5

* Section
some text
** Subsection
some text
*** Subsubsection
some text
**** Subsubsubsection
some text


texts: Disable confirmation when erasing & saving buffer

texts:
In the Emacs sources I found the following trick:

(let (buffer-file-name)
  (erase-buffer))

which inhibits ask-user-about-supersession-threat, but I need to save the buffer too, so I can't hide buffer-file-name. So I decided to use function advice.

basic-save-buffer also asks:

(yes-or-no-p
  (format
    "%s has changed since visited or saved.  Save anyway? "
    (file-name-nondirectory buffer-file-name)))

which I want to avoid, so I ended up using the internal function basic-save-buffer-1:

(defun my--erase-buffer ()
  (interactive)
  (advice-add #'ask-user-about-supersession-threat :override #'identity)
  (erase-buffer)
  (when (buffer-file-name)
    (basic-save-buffer-1)
    (revert-buffer))
  (advice-remove #'ask-user-about-supersession-threat #'identity))

My motivation for this is that I need a key binding to clean up constantly updated log files during development.

This approach seems unnecessarily hackish. Is there place for improvement?


texts: Using user prompted file name for org-capture in template

texts:
With the help of these questions, I managed to prompt the user for a file name in org-capture and combine it with a timestamp.

(defun my/generate-org-note-name ()
  (let ((name (read-string "Name: "))
        (time (format-time-string "%Y%m%d%H%M%S")))
    (expand-file-name (format "%s-%s.org" time name) "~/org-wiki")))

(setq org-capture-templates
  '(("n" "note" plain
     (file (my/generate-org-note-name))
     "#+TITLE: ")))

Now I would like to reuse this name and timestamp in the actual template.

File name: 2018010101230456-myfile.org
Template:

#+TITLE: my file
#+STAMP: 2018010101230456

I am trying to return a list with file path and template from my/generate-org-note-name and then append it to the first 3 elements. But it looks like something (maybe my quoting) is wrong:

(defun my/generate-org-note-name ()
  (interactive)
  (let ((name (read-string "Name: "))
        (time (format-time-string "%Y%m%d%H%M%S")))
    (list (file (expand-file-name (format "%s-%s.org" time name) "~/org-wiki")))
          (format "#+TITLE: %s\n#+STAMP: %s\n" name time))

(setq org-capture-templates
  '((apply #'append (list (list "n" "note" 'plain) (call-interactively
      #'my/generate-org-note-name)))))

The call to apply fails every time.


texts:
I know that I can use save-excursion to avoid changes to (point), is there a similar function to revert excursion based on the value of BODY. For example:
(revert-excursion BODY)

would revert the excursion if BODY evaluates to nil otherwise the new value of (point) is maintained. I could of course do this by saving the previous (point) and using (goto-char) conditionally, or by executing BODY twice (one to evaluate its value and the second to actually move (point). But I am wondering if there are better ways.


texts: Installing quelpa-use-package from use-package

texts:
Currently I have the following init file to install and use use-package:
;; Package.el
(require 'package)
(package-initialize)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives  '("melpa" . "https://melpa.org/packages/"))

;; use-package
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

;; use use-package
;; (use-package some-pack :ensure another-pack)

Not all packages work with use-package, so I am extending it with quelpa. I need to install both the extension and quelpa itself. It seeems it could work like this:
(use-package quelpa-use-package
  :ensure t
  :init
  (setq quelpa-update-melpa-p nil)
  (setq quelpa-self-upgrade-p nil))

If I start my init file in this way, I do not get any error. However, when I try to add a git package, such as
matrix-client:
(use-package matrix-client
  :quelpa (matrix-client :fetcher github :repo "alphapapa/matrix-client.el"
                         :files (:defaults "logo.png" "matrix-client-standalone.el.sh")))

I get at startup:
Error (use-package): Failed to parse package matrix-client: use-package: Unrecognized keyword: :quelpa

How can I install quelpa-use-package from use-package? (If I can)