texts: How to remove the projectile project name after the file name

texts:
I am attempting to clean up my modeline due to overcrowding. In my quest I have come across a problem I cannot figure out, namely projectile.

By this I mean the project name after the file name, it appends [project-name] after the file name.

example (if I was too vague):

  -U:---/path/to/file[project-name] (modes) etc...

I have checked the customize projectile group and the readme on the github repo, but to no avail. Is there any other way I can remove this?


texts: org-mode warning when scheduling task on top of another task?

texts:
Q: how can I make org-mode warn me when I'm about to schedule a task on top of another task?

I frequently schedule tasks or meetings (with org-deadline or org-schedule) at a specific hour on some day in the distant future.  However, I rarely remember what I already have scheduled on that day, and often discover later that I have double-booked a time slot.

Example: I use org-deadline to schedule a meeting for next Thursday from 9am-10am, but already have a preexisting meeting next Thursday from 8:30am-10:30am.

Is there any way, when entering a timestamp/scheduled event/deadline, to have org-mode warn me when I'm about to double-book a timeslot?


texts: RefTex searching for multiple articles with Helm

texts:
I recently started using Helm and am really enjoying it. However, I use emacs to write a lot of LaTeX. When I cite articles, I often need to cite several in the same cite macro - I could search my bibliography file for two separate entries very easily, using RefTex:

citekey1\|citekey2

However when helm mode is on, this no longer works. I can still search for single articles but not multiple articles. How can I do the above in helm?


texts: Autocomplete parentheses when editing lisp

texts:
I am learning Lisp and find out that autocomplete parentheses is counter intuitive. I don't like it because I don't know how many parenthesis will go into another at the first hand. For example,

(defun last-elt (list)
  (let* ((len (length list))
         (last (nth len list)))
    (break)
    last))

that code is hard to type for me using auto-complete parentheses. How do experienced lisp programmers use auto-complete property?


texts:
I want to install ESS. I initialised the package manager with

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)

and try installing ESS with M-x package-install RET ess RET. I get the error

Package `julia-mode-0.3` is unavailable.

I only found this thread, where the same error is a side-effect and has no solution to the problem.

How can I install ESS from MELPA?


texts: How remove text before "," (include) in every lines?

texts:
suppose I has the next text:

-1,0x0 Fireplace HD
1160,0x0 Music HD
719,1 HD
-1,1 MUSIC CHANNEL
154,1+1
-1,100% News
-1,100AutoMoto TV

I need to remove text before "," (include ,)

So the result must be like this:

0x0 Fireplace HD
0x0 Music HD
1 HD
1 MUSIC CHANNEL
1+1
100% News
100AutoMoto TV


texts: xref gets confused by similar class names

texts:
If I use evil-jump-to-tag or xref-find-defintions on an inherited class module whose name is the same as a class in my current project, I am taken to the definition in the current project.  I would expect to go to the definition given in the module.

Aside from renaming the class in my current project, how I can I navigate to the module?

For example

Suppose my_module.py defines a custom MainWindow that I use in  my_project.py:

# my_module.py

class MainWindow(QtWidgets.QMainWindow):

    def __init__(self):
        super().__init__()
        print("My module!")

# my_project

class MainWindow(my_module.MainWindow):

    def __init__(self):
        super().__init__()
        print("My project calling my module!")

If my cursor is |, then a call to evil-jump-to-tag or xref-find-defintions at

# my_project.py
class MainWindow(my_module.MainWind|ow):

moves my cursor to

# my_project.py
class |MainWindow(my_module.MainWindow):

I would expect it to take me to

# my_module.py
class |MainWindow(QtWidgets.QMainWindow):

What can I do, aside from renaming the class in my_project.py, to help xref understand that my_module.MainWindow lives in my_module.py?

Configuration details

I am using Gnu Emacs 26.1 on Windows 10 with Python 3.  I edit Python files with elpy and evil.  The elpy-config reads:

Elpy Configuration

Virtualenv........: venv (c:/projects/my_project/venv)
RPC Python........: 3.6.8 (c:/projects/my_project/venv/Scripts/python.exe)
Interactive Python: ipython (c:/projects/my_project/venv/Scripts/ipython.exe)
Emacs.............: 26.1
Elpy..............: 1.28.0
Jedi..............: 0.13.2
Rope..............: 0.11.0
Autopep8..........: 1.4.3
Yapf..............: 0.25.0
Black.............: 18.9b0
Syntax checker....: flake8.exe (c:/projects/my_project/venv/Scripts/flake8.exe)

I have not done any configuration for xref.  Until now, it has Just Worked™.


texts: Can I view within Emacs the properties of a file which I already opened?

texts: I've opened a file in Emacs. I'd like to view information about that file such as creation date, size, etc. within Emacs. Is there a key shortcut or any Emacs command for that? Thanks.


texts:
I have a custom face defined as

(defface my-underlined
  '((t (:underline "red")))
  :group 'my-group)

At some place I underline some words with something like

(add-text-properties (match-beginning 0) (match-end 0) '(font-lock-face my-underlined)))))

What would be a correct way to revert this text properties set on some words (or on all words on demand) as well as restore their syntax highlight that might have existed before? Nothing with font-lock- seems to work. What would be a correct way to underline and revert?

A function underline-region doesn't seem to work. It just inserts ^H_ into the text.


texts: Default shell path with Tramp from MacOS to Linux

texts:
I have a local environment which is MacOS Catalina and a remote environment which is standard Linux. I use tramp to connect to the remote linux machine to work on it.

Unfortunately, Catalina now defaults to zshell (/bin/zsh) and the linux is standard bash (/bin/bash)

Depending on how I configure my .emacs file, when I invoke M-x shell, it either will default to bash or zshell regardless of the environment. I've tried multiple fixes so that emacs defaults to bash on linux and zshell on macos. The current .emacs I have so far, based on the tramp manual, looks like this:

(defun connect-my-linux-host ()
  (interactive)
  (dired "/scp:myname@my-linux-host-url:~"))

(add-to-list 'tramp-connection-properties
             (list (regexp-quote "/scp:myname@my-linux-host-url:")
                   "remote-shell" "/bin/bash"))

(connection-local-set-profile-variables
 'remote-bash
 '((explicit-shell-file-name . "/bin/bash")))

(connection-local-set-profiles
 '(:application tramp :protocol "scp" :machine "myname@my-linux-host")
 'remote-bash)

The above configuration defaults to zshell in every environment.

What am I doing wrong?


texts: How comment out a variable line in a local variable list

texts:
In a python file I have

# Local Variables:
# python-shell-interpreter: "python3"
# python-shell-virtualenv-path: "~/.virtualenvs/datascience"
# leo-python-args-to-send: "-f fqanalysis.txt"
# End:

For a couple of days I want to use the python file without the specified virtualenv, so I would like to comment out the line setting python-shell-virtualenv-path, so that next time I open the python file in emacs python-shell-virtualenv-path keeps its global value.

I tried

# ;;python-shell-virtualenv-path: "~/.virtualenvs/datascience"

and

## python-shell-virtualenv-path: "~/.virtualenvs/datascience"

but on opening the python file I always get the error

File mode specification error: (error "Malformed local variable line: ...)

How do I comment out the local variable line correctly?


texts: How much faster is C than compiled elisp?

texts:
I'd like to write some lightning-fast functions for analyzing LaTeX code. Because they could involve a lot of complicated processing of large documents, I don't know whether it's a good idea to write them completely in Lisp or not. How fast is byte-compiled Lisp compared to C, and how intensive does the processing have to be for the user to notice a difference?

Specifically, I'm trying to implement better functions for finding certain types of errors -- for example, neither show-paren-mode nor smartparens-latex are smart enough to notice that \left and \right are brackets that must match with another \left or \right. These programs also don't know that there are features brackets can't match across (so if it encounters one of these features, which will have to be defined a complicated way since it's environment-dependent), it should report a paren mismatch.

Because of the potential complexity of the code (parsing LaTeX can depend on the environment in complicated ways) and the fact that it has to be fast enough that the user won't notice a delay when, for example, they move the cursor over a parenthesis, I'm concerned about optimizing the code, and I want to know whether I can get away with writing careful Lisp or if it would be smarter to implement one or more primitives to help with the grunt-work.


texts: How to conditionally abort a minor-mode invocation?

texts:
I have a minor mode definition like this, and I want to prevent it from being enabled when the config variable example-mode-config has not been defined.

;;; ....

;;;###autoload
(define-minor-mode example-mode
  "Enables the example mode"
  (if example-mode
      (example-mode-enable)
    (example-mode-disable)))

(defun example-mode-enable ()
  (cond ((not example-mode-config)
         (message "please define example-mode-config before using example-mode")
         ;;; seem to need to do something here to disable the mode
         ;;; otherwise the mode gets enabled, but does not work
         )
        (t  ;;;; go ahead and set up .....
         )))

The problem is that if example-mode-config is undefined, the function example-mode-config returns doing nothing, but the calling framework still goes ahead and enables the mode.


texts: truncate-string-to-width doesn't pad/print the string, as documented

texts:
I am referring the documentation for truncate-string-to-width from here.

It says,

(truncate-string-to-width "\tab\t" 12 4)

will output,

ab

But what i get in my machine (emacs versioned 25.1.50.1) is one tab character with no alphabets printed. And similarly, when i do

(message "%s"
                 (truncate-string-to-width "\tab\t" 12 4 ?\s))

my mac shows, one tab character plus six space chars. But the documentation quotes,

⇒ "    ab  "

Why does truncate-string-to-width truncate the alphabets in my machine?


texts:
With an tree like

* Parent
** Sub-Parent1
** Sub-Parent2

...how can one get a list of all of the sub-parents? Perhaps printing them as follows:

Sub-Parent1; Sub-Parent2


texts:
I have many documents with glossaries which I used to build using this script:

pdflatex "$documentname.tex"
makeglossaries "$documentname"
pdflatex "$documentname.tex"
pdflatex "$documentname.tex"
makeindex -s "$documentname.ist" -o "$documentname.gls" "$documentname.glo"
pdflatex "$documentname.tex"

The line pdflatex "$documentname.tex" could probably appear less often but I thought that safe is safe.

I use AUCTeX, so I can build (and view) documents via C-c C-c. It builds a document and tells me when to press the combination again to run LaTeX, again. It even works when BibTeX is involved and runs that. But in the case of the documents with a glossary, it doesn't build the glossaries. How can this be achieved?

Can you make it so C-c C-c calls itself until (inclusive) the PDF is opened? For one document, I have to press it 8 times (8 times C-c C-c, not 8 times C-c) which gets quite tiresome.


texts: How to run commands locally even when on tramp?

texts:
I have some commands that do "utility" stuff that have nothing to do with the current buffer. I need these to always run locally, and not remotely when visiting a tramp buffer. How can I do this?
Here is the function in question:
(if load-file-name
    (setq night/fzf-cmd (concat (file-name-directory load-file-name) "/fzf_in2.dash")))

(defun night/helper-counsel-fzf-entries (str)
  (let ((entries night/counsel--fzf-entries))
    (setq ivy--old-re (ivy--regex-fuzzy str))
    (let ((night/counsel--stdin (mapconcat (lambda (x) x) entries "\n")))
      (f-write-text night/counsel--stdin 'utf-8 "/tmp/nightFzf.txt")
      (counsel--async-command
       (list night/fzf-cmd "-f" str)
       )))
  nil)


texts: Where to find missing dependencies (imagemagick and m17n)

texts:
I am compiling Emacs from source and can't figure out what libraries I need to enable imagemagick and m17n. I have imagemagick and libm17n-dev installed (I am on Debian).

My ./configure script says:

  Does Emacs use imagemagick?                             no
  [...]
  Does Emacs use -lm17n-flt?                              no


texts: Is there a natural language date parser in Elisp/Emacs?

texts:
I use Emacs (Spacemacs) for email, and one of the most common tasks I have is converting an email containing a date and time to an item in my schedule. I noticed that calendar mode can convert certain expressions to timestamps, like "+7" for "seven days from now,"

But is there something that handles fuzzier text, like "Thursday, 4 February, at 6pm"?

If there isn't, does anyone know of something that can do this in any other language (that would be usable through Emacs)?


texts:
I use the package ryo-modal-mode and for the key assignment I have long code blocks in an org-file.
If I execute the code block I get a very long table under #+RESULTS. Is it possible to execute a block without result, or disable output?
Before I used M-x eval-region. Hitting C-c C-c would be easier, if there wasn't the long results table.


texts: Is it normal for a package to request [sudo] in order to install a package? (this case pdf-tools) concerned about password integrity

texts:
I installed pdf-tools through MELPA, and then labels it as installed on a restart but kept viewing pdfs through doc-view. So using M-x pdf-tools-install it requested the sudo password in order to install :

    -*- mode: compilation; default-directory: "~/.emacs.d/elpa/pdf-tools-20190413.2018/build/server/" -*-
Comint started at Wed Apr 24 22:14:06

/home/xel/.emacs.d/elpa/pdf-tools-20190413.2018/build/server/autobuild -i /home/xel/.emacs.d/elpa/pdf-tools-20190413.2018/
---------------------------
    Installing packages
---------------------------
apt-get install autoconf
              automake
              g++
              gcc
              libpng-dev
              libpoppler-dev
              libpoppler-glib-dev
              libpoppler-private-dev
              libz-dev
              make
              pkg-config
[sudo] password for usr1:
Reading package lists... Done
Building dependency tree

and then finalizes with the message:

===========================
   Build succeeded. :O)
===========================

Comint finished at Wed Apr 24 22:16:38

1) Is this typical?

2)It was not expected that Emacs would ask for that level of access. Would this have been protected as a direct communication to the terminal?

3) regardless of this, DocView is still the default when opening a pdf file


texts: ispell-phaf no matching entry for en_Gb after update to macOS Sierra

texts:
I have update to macOS Sierra after witch spelling in Emacs is broken.
The error I get is (ispell-phaf: No matching entry for en_GB in ´ispell-hunspell-dict-paths-alist´)

I have both install aspell and hunspell via homebrew, I have the following content in my ~/Library/Spelling folder:

.
├── dynamic-counts.dat
├── dynamic-text.dat
├── en_AU.aff
├── en_AU.dic
├── en_CA.aff
├── en_CA.dic
├── en_GB.aff
├── en_GB.dic
├── en_US.aff
├── en_US.dic
├── en_ZA.aff
├── en_ZA.dic
├── hyph_en_GB.dic
└── hyph_en_US.dic

And I have the following in my .emacs file:

;;; Set dictonary
(setenv "DICTIONARY" "en_GB")
;;; For loading hunspell insteand of ispell
(setq ispell-local-dictionary "en_GB")
(when (executable-find "hunspell")
 (setq-default ispell-program-name "hunspell")
 (setq ispell-really-hunspell t))

Does someone have an idea as to what is wrong. This worked under MacOS El Capitan and therefore I find it strange that it suddenly does not.

EDIT:
Result of hunspell -D

hunspell -D
SEARCH PATH:
.:::/Users/larsnielsen/Library/Spelling:/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/Users/larsnielsen/.openoffice.org/3/user/wordbook:.openoffice.org2/user/wordbook:.openoffice.org2.0/user/wordbook:Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/Users/larsnielsen/Library/Spelling/default
/Users/larsnielsen/Library/Spelling/en_AU
/Users/larsnielsen/Library/Spelling/en_CA
/Users/larsnielsen/Library/Spelling/en_GB
/Users/larsnielsen/Library/Spelling/en_US
/Users/larsnielsen/Library/Spelling/en_ZA
/Users/larsnielsen/Library/Spelling/hyph_en_GB
/Users/larsnielsen/Library/Spelling/hyph_en_US
Library/Spelling/default
Library/Spelling/en_AU
Library/Spelling/en_CA
Library/Spelling/en_GB
Library/Spelling/en_US
Library/Spelling/en_ZA
Library/Spelling/hyph_en_GB
Library/Spelling/hyph_en_US
LOADED DICTIONARY:
/Users/larsnielsen/Library/Spelling/default.aff
/Users/larsnielsen/Library/Spelling/default.dic
Hunspell 1.5.4


texts:
I saw a python code block example to output an array as an org-table. An example would be,

#+BEGIN_SRC python :results value
  r = 3389.5 # km average radius
  re = 3396.2 # equatorial radius in km
  rp =  3376.2 # polar radius in km
  m = 6.4171 * 10**(23) # kg

  return[["Parameter", "Value"],
   None,
   ["Mass Mars (kg)", "{:.5g}".format(m)],
   ["Mean Radius (km)", "{:.5g}".format(r)],
   ["Polar Radius (km)", "{:.5g}".format(rp)],
   ["Equatorial Radius (km)", "{:.5g}".format(re)]]

#+END_SRC

#+RESULTS:
| Parameter              |      Value |
|------------------------+------------|
| Mass Mars (kg)         | 6.4171e+23 |
| Mean Radius (km)       |     3389.5 |
| Polar Radius (km)      |     3376.2 |
| Equatorial Radius (km) |     3396.2 |

This is almost perfect for me. I would like to be able to use ipython in session mode in order to pull results from various other code blocks without naming them individually with :var headers.

However, with ipython I get the error:

  SyntaxError: 'return' outside function

I'm not sure why there is this difference in behavior between python and ipython code blocks. If I remove "return" from the ipython code block, I get the following output (no table):

#+BEGIN_SRC ipython :session mars :results value
   [["Parameter", "Value"],
   ["Mass Mars (kg)", "{:.5g}".format(m)],
   ["Mean Radius (km)", "{:.5g}".format(r)],
   ["Polar Radius (km)", "{:.5g}".format(rp)],
   ["Equatorial Radius (km)", "{:.5g}".format(re)]]

#+END_SRC

#+RESULTS:
:RESULTS:
# Out[109]:
# text/plain
: [['Parameter', 'Value'],
:  ['Mass Mars (kg)', '6.4171e+23'],
:  ['Mean Radius (km)', '3389.5'],
:  ['Polar Radius (km)', '3376.2'],
:  ['Equatorial Radius (km)', '3396.2']]
:END:

Using the header argument ":results value table" doesn't work either:

 #+BEGIN_SRC ipython :session mars :results value table
       [["Parameter", "Value"],
       ["Mass Mars (kg)", "{:.5g}".format(m)],
       ["Mean Radius (km)", "{:.5g}".format(r)],
       ["Polar Radius (km)", "{:.5g}".format(rp)],
       ["Equatorial Radius (km)", "{:.5g}".format(re)]]

    #+END_SRC

    #+RESULTS:
    :RESULTS:
    | # Out[1]: |
    :END:

In this case, is the best option just to do something like following? Am I missing a better solution? My end use scenario is exporting the org-file to pdf with a mixture of latex formulas as well as ipython code blocks and text.

#+BEGIN_SRC ipython :session mars

print("|-")
print("| Parameter | Value |")
print("|-")
print(f"|Mass Mars (kg) | {m}|")
print(f"|Mean Radius (km) | {r}|")
print(f"|Polar Radius (km) | {rp}|")
print(f"|Equatorial Radius (km) | {re}|")
print(f"|-")
print("#+TBLFM: $2=$0;%0.5g")
#+END_SRC

#+RESULTS:
:RESULTS:
# Out[116]:
# output
|------------------------+------------|
| Parameter              |      Value |
|------------------------+------------|
| Mass Mars (kg)         | 6.4171e+23 |
| Mean Radius (km)       |     3389.5 |
| Polar Radius (km)      |     3376.2 |
| Equatorial Radius (km) |     3396.2 |
|------------------------+------------|
#+TBLFM: $2=$0;%0.5g


texts: How to get a string under quotes surrounding the cursor in elisp?

texts:
I am trying to write a function that opens a file under the cursor. I need to get the string between quotes that is surrounding the cursor in my elisp function so that I can use that string to call find file, how can I achieve this?

Example

"~/git/lis<cursor>p.el" should return ~/git/lisp.el


texts: Elisp backquote comma eval puts a space in between

texts:
Here's an example:

(defmacro test (arg)
  `(message foo-,arg))

(defmacro test-with-space (arg)
  `(message foo- ,arg))

(macroexpand-1 '(test-with-space bar))
(macroexpand-1 '(test bar))

Both eval to (message foo -bar). Intuitively to me it should eval to (message foo-bar) and (message foo -bar) respectively. Am I using backquotes incorrectly or is this a feature? If not, is there a way to do what I'm trying to do without polluting code with  intern and format?


texts: Getting Latex preview to work with org mode (.dvi not found)

texts:
In my .org file I embedded a simple Latex segment:

$f(x) = x^2$

Then I use the following command to generate a preview for that segment:

org-toggle-latex-fragment

But I get an error:

org-compile-file: File "/var/folders/x2/zp6vz8z97xv48g97pht5_mrc0000gn/T/orgtexu9KnIy.dvi" wasn’t produced.
Please adjust ‘dvipng’ part of ‘org-preview-latex-process-alist’.

I tried to debug the issue:

The file /var/folders/x2/zp6vz8z97xv48g97pht5_mrc0000gn/T/orgtexu9KnIy.tex exists
I can use pdflatex to create a file from the above .tex without any issue.
I can also create a dvi from the above by just running latex orgtexu9KnIy.tex. No error happens.
When I run dvipng orgtexu9KnIy I get the following output:

This is /usr/local/texlive/2017/bin/x86_64-darwin/dvipng (dvipng (TeX Live))
1.15 Copyright 2002-2015 Jan-Ake Larsson
[1]

And I have a file orgtexu9KnIy1.png in the current folder. I'm suspicious bit wondering about the additional 1 in the file name.

Org expects the file name to be orgtexu9KnIy.png and not orgtexu9KnIy1.png.

The value of the variable org-preview-latex-process-alist:

((dvipng :programs
      ("latex" "dvipng")
      :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
      (1.0 . 1.0)
      :latex-compiler
      ("latex -interaction nonstopmode -output-directory %o %f")
      :image-converter
      ("dvipng -fg %F -bg %B -D %D -T tight -o %O %f"))
 (dvisvgm :programs
       ("latex" "dvisvgm")
       :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :use-xcolor t :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
       (1.7 . 1.5)
       :latex-compiler
       ("latex -interaction nonstopmode -output-directory %o %f")
       :image-converter
       ("dvisvgm %f -n -b min -c %S -o %O"))
(imagemagick :programs
           ("latex" "convert")
           :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :use-xcolor t :image-input-type "pdf" :image-output-type "png" :image-size-adjust
           (1.0 . 1.0)
           :latex-compiler
           ("pdflatex -interaction nonstopmode -output-directory %o %f")
           :image-converter
           ("convert -density %D -trim -antialias %f -quality 100 %O")))


texts:
After evaluating the expressions in this code, I evaluated (activate-input-method "TeX"). When I type in the buffer \`a, the translation happens as expected and I get à. However, I cannot achieve the same effect by insert:

(insert "\\`a")

The result is: \`a

I tried a sequence of inserts without success:

(progn (insert "\\") (insert "`") (insert "a") (insert " "))

The result is: \`a

So, how can I insert a string in a way that it gets translated?


texts: Can `eshell-command` direct its output like `shell-command` into minibuffer?

texts:
=> When I do M-x shell-command and python run.py (which only print Hello World\nHello World string), I get the result on the minibuffer and when cursor moves up/down minibuffer is closed.

=> When I do M-x eshell-command and pwd I get the result on another window instead of the mini-buffer I had to do C-x-1 to close it. Please note that, if the output is single line it is printed in the minibuffer.

=> Can eshell-command direct its output like shell-command into minibuffer if the output is more than a single line?


texts: Best way to make orgmode source code blocks aware of my $PATH and other environment variables?

texts:
By default my source code block can't find most executables:

#+BEGIN_SRC bash
which aws
#+END_SRC

#+RESULTS:

This fixes the problem:

#+BEGIN_SRC bash
source $HOME/.bash_profile
which aws
#+END_SRC

#+RESULTS:
| ];                                    | PHP | 7.1.25 |  |
| /Users/bwood/Library/Python/3.7/bin/aws |     |        |    |

My question: Is there a way to make code blocks of language type bash (or shell) always source my .bash_profile, without having to add that line at the beginning of every source block?

Base on https://orgmode.org/manual/prologue.html I tried adding the following to my init file, but this didn't fix the problem so maybe I'm not understanding what prologue does:

(add-to-list 'org-babel-default-header-args:shell
             '((:prologue . "source /Users/bwood/.bash_profile")))

EDIT: I should have mentioned that I'm running graphical UI Emacs under MacOS.


texts: Image and text side by side in Org-mode – how to flow text around an inline image?

texts:
Images can be easily displayed inline in an Org-mode file.

#+STARTUP: inlineimages

* headline 1

** headline 2

[[./dog-o.jpg]]

This text should be displayed to the
right of the image above.

Ideally, this would work for multiple lines,
but if it's just one long wrapped line, that
would be find too.

After the image, text should again take the
full width of the line...

produces

Instead of how it is displayed above, I would like the text to be shown to the right of the image, effectively wrapping the text around the image. (This does not concern HTML or LaTeX exports, I'm specifically asking for a way to display text and image side by side in Org-mode).

Here an example of the desired result:

Is it possible? How could this be achieved?


texts: Evaluate allows for combinations whose operators are compound expressions

texts:
I find the amazing power of scheme in sicp

  Exercise 1.4.  Observe that our model of evaluation allows for
  combinations whose operators are compound expressions. Use this
  observation to describe the behavior of the following procedure:

 #+BEGIN_SRC scheme
(define (a-plus-abs-b a b)
  ((if (> b 0) + -) a b))
(a-plus-abs-b 9 4)
 #+END_SRC

 #+RESULTS:
 : 13

Try to rewrite it as

#+begin_src emacs-lisp :session sicp :lexical t
(defun a-plus-abs-b(a b)
  ((if (> b 0) + -) a b))
(a-plus-abs-b 9 4)
#+end_src

report error "invalid function"

Alternatively with

#+begin_src emacs-lisp :session sicp :lexical t
(defun a-plus-abs-b(a b)
  (funcall (if (> b 0) + -) a b))
(a-plus-abs-b 9 4)
#+end_src

Error reported as

funcall: Symbol’s value as variable is void: +

How could write it correctly in elisp?


texts: How to place asterisks in beginning and end of lines in a marked region?

texts:
I use org-mode a a lot and take notes in Org files. I like to sometimes highlight some important text. I colored bold to be red but it doesn't span multiple lines. And I couldn't get that to work using multiple stackexchange solutions. So I opted to mark the lines I want to boldify with asterisks. But that is taking time. How would I implement a function in Elisp that does that for me automatically.

Basically in this snippet of text:

This is a test to make sure I can []highlight some text in org-mode
And hopefully someone would be able to help me.[]

Now if I highlighted the region between [] [] and then use the function, the text will change to:

This is a test to make sure I can *highlight some text in org-mode*
*And hopefully someone would be able to help me.*


texts: Move to goal-column inserting spaces if necessary

texts:
I have a bunch of lines of text and I'm trying to insert text starting at a certain column on each line. For example:

'Some text'            This is ok
'Another longer text'  ask Ram
'weird stuff'          see other file
'more lines'
'even more lines'

I'd like to continue typing text on the further lines, at the same column as the previous lines. The part that's cumbersome is moving to the right place on each line.

Emacs has a way of moving to the same place on each line: set-goal-column. This would work if that column already existed on each line, but that's not the case here.

One way I can work around this (which I'm actually using) is to insert a lot of spaces on each line (replace-regexp $ with a few dozen spaces), then C-x C-n (set-goal-column), and use regular C-n to move between lines. But I'd like to know whether there's a clean way of achieving something better: of setting things up so that after set-goal-column, I can just use C-n to move to the next line, and Emacs will automatically insert the appropriate number of spaces if there weren't enough columns to start with.


texts: Can quail accept keybinding as an input?

texts:
With a global keybinding it is possible to insert a text by running a keybinding as below
(global-set-key (kbd "S-SPC") "blablabla")

Is it possible to do the same thing with quail? I mean running Shift+Space results in inserting a text.
Obviously the following does not work:
(quail-defrule "S-SPC" ["blablabla"])

quai-defrule docstring says says:
Add one translation rule, KEY to TRANSLATION, in the current Quail package.
KEY is a string meaning a sequence of keystrokes to be translated.
TRANSLATION is a character, a string, a vector, a Quail map,
 a function, or a cons.


texts: Setting mode-line font size and Magit diff colours

texts:
I'd like to adjust the background colour of the part of the diffs displayed by Magit. In particular, the background colour of the text 1st, 2nd, and 3rd in the image. I'd like to increase the contrast between the background of the unchanged section and the changed section.

What is the correct setting to customize?

Also, when I recently restarted emacs, it started showing the mode-line and section headers in a very small font (as shown).  How do I change these font sizes to be the same as the regular text?

Emacs version:
GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.10) of 2017-09-12 on x86-017.build.eng.bos.redhat.com

Magit version: Some version from five years ago.


texts: "cl-flet" macro not allowing for recursive functions

texts:
I am used to the deprecated elisp macro flet and I was told to change to cl-flet.  However upon making this change some of my elisp programs stopped working and I realized the reason is that, unlike flet, cl-flet does not allow for recursive functions.  For example, defining the function below

(defun show-problem-in-action (x)
  (cl-flet (
    (factorial (n)
      (if (= n 0)
        1
        (* n (factorial (- n 1))) )))
  (factorial x) ))

one gets no error by calling

(show-problem-in-action 0)

Output: 1

because the "cl-flet-defined" function factorial does not call itself when "x=0".  However

(show-problem-in-action 5)

produces the error void-function factorial.

On the other hand, replacing cl-flet by its deprecated macro flet, such as below

(defun no-problem-with-deprecated-macro (x)
  (flet (
    (factorial (n)
      (if (= n 0)
        1
        (* n (factorial (- n 1))) )))
  (factorial x) ))

allows for recursive invocation:

(no-problem-with-deprecated-macro 5)

Output: 120

If cl-flet is not working, what would be my best alternative to replace flet with, still being able to call functions recursively?


texts: Org-mode `org-move-subtree-down` function strange behavior

texts:
The function org-move-subtree-down exhibits an unwanted behavior IMO: when moving the subtree it considers the whitespace above the subtree that will be moved as "part" of it. I think it's better explained visually:

When we try to move down this subtree, see what happens:

If we try to move the 3rd subtree up starting from the same initial configuration (figure 1), something strange will happen as well:

Looking at the code of the function, one can see that this behavior has been intentionally programmed. I wonder why, and if I'm the only one who dislikes this behavior.

I am currently working on hacking this function to correct this behavior, and will propose changes to developers, but wanted to see if it's not the case that I'm crazy here. Thanks, any thoughts will be helpful.

Here is the file I used for you to try the same commands.


texts:
I have a question regarding the search term and how it's saved in Emacs, actually I want to know how to clear it.
You know how you can clear the search results highlighting with (evil-search-clear-highlight) and such?
This only disables the display of the search terms, internally the search term is still "in memory", i.e. you can still try and go to the next/previous occurance and the highlighting would resume normally.
How do you actually "clear" the current search term?
In Vim you would actually do this to clear the current search term: :let @/ ""
@/is the name of the "register" which holds the most recent search term.
By clearing the search register, the effect isn't only visual (no highlighting), but also it means that searching for next/prev occurance (n/N) would not work after clearing, because there is nothing to search for (empty string).
I'm looking for an Emacs equivalent to this and I don't know the terminology (is it a special killring or special kind of buffer? IDK).
Note also that you cannot simply enter an "empty" search term to overwrite the previous one via normal UI interactions a la /[ nothing / enter ] (using evil-mode), or C-s / M-s o and then just press enter instead of a string (using holy-mode).
I'm using Spacemacs with evil/vim-like-bindings, but I guess the question can be answered independently from the Emacs distribution.
Thanks for your help & suggestions in advance.


texts: How to make sure currently selected text gets deleted when typing new text?

texts:
When editing text, editors' usual behaviour is to replace selected text with the next text.  In Emacs, when text is selected and you enter new characters, the new text gets inserted at point, leaving the current selection intact.

How to get Emacs to delete selected text when typing new characters?


texts: wanderlust: hook for modifying buffer *WL:Message* as it is being accessed

texts:
I want to optionally perform some functions on the data in buffer *WL:Message* right after I access and view it.

For example, when first viewing a new message in the *WL:Message* buffer via wl-summary-read or wl-summary-enter-handler, I'd like to perform the following logic (pseudo-code) ...

Enter the *WL:Message* buffer
IF *WL:Message* buffer contains images
THEN
   Scroll down to the first image
   Do a (recenter 1) to position this image at the top of the window
ENDIF

I know how to write the elisp code to do all of this. The problem is knowing when to issue this code. I haven't been able to find a hook that runs right as the *WL:Message* buffer is being displayed.

I tried to use advice around various existing wanderlust wl-summary and wl-message functions, but I haven't found a reliable way to do what I want. Sometimes (seemingly at random), the wl-message-buffer variable is not set, or that buffer's window is not live (it needs to be a live window in order for (recenter 1) to work).

Does anyone know of the proper place I can insert my code so that it always reliably runs whenever I first view a new message in the *WL:Message* buffer?


texts:
RStudio provides a one-button way for produce PDF file from LaTeX+R source with Knitr. It looks great for doing reproducible research. And I am trying to configure my Emacs for:

at left buffer LaTeX+R code in Knitr way;
at right buffer PDF output preview;
one key combination for compiling.

If it is possible: how should I setup this, please?

(ESS works fine, but I don't know how to set up Knitr-way and one-button-for-compiling.)


texts: Company mode suggestions end up all over the screen

texts:
When I am programming I utilize company-mode heavily to save me time typing. There's a problem however. Let's say I have a bunch of stuff with a similar prefix:

createThingX
createThingY
createThingZ
createThing1
createThing2
createThing3

company-mode will suggest these things properly. However, after the fifth or sixth suggestion in the list it appears to create a second column of suggestions. This wouldn't be a problem except the second column of suggestions is usually nearly off the screen.

Is there a way to tell company how many suggestions to give per column?


texts: Debug an elisp error - show call stack when an error occurs

texts:
I am relatively new to emacs / elisp, and am trying to build some custom functionality.

I have added a number of functions which are added to a major-mode.

Occasionally (and seemingly only after a long while of running), the following warning message appears in the *Warnings* buffer:

Warning (emacs): recentf mode: Wrong type argument: stringp, nil

I am unsure as to what is causing it.

Is it possible to "catch" this error, and print a call stack so I can see where it's coming from?


texts: How to use mysql client (sql-mysql-program) from a docker container?

texts:
I am running MySQL inside a docker container. When I try to connect to it  using M-x sql-mysql I see the following error:

  Unable to locate SQL program ‘mysql’

Yeah, I don't have mysql-client installed and would like to use it from a docker container. So I changed sql-mysql-program to be /usr/local/bin/docker exec -it fb34d517502c mysql, but again received an error:

  Unable to locate SQL program ‘/usr/local/bin/docker exec -it fb34d517502c mysql’

Is there a way to use mysql-client from the docker container?


texts: Highlight yanked region during sequence of yank-pop's until mark is moved away

texts:
I sometimes find myself yanking a large chunk C-y and then cycling M-y through some previous kills. This can feel visually noisy to me, i.e. during the sequence of replaces it's easy to lose track of the boundary between what was just yanked and text that was previously in the buffer.

I think what I want to do is highlight the yanked region somehow for the duration of the yank-pops until point moves away. Is that implemented somewhere as a standard feature already?

Expanded description:
Let me try to phrase what I'm after another way. The region of text just inserted into a buffer by C-y should be highlighted so it's clear where its boundary is. The highlight should remain for any M-y's that follow and adjust itself to surround whatever the newly popped text is. When point moves and M-y is no longer possible, the highlight should disappear.


texts:
I don't know if there's a package to show the colors according to their value. I know it's xah-css-mode and rainbow-mode.

rainbow-mode only shows hex values and by name.
xah-css-mode shows the above, hsl and supposedly rgb (it seems to have an error with this).

Is there a way to see hsla and rgba? Transparency is not necessary, but it would be enough to show the color hsl or rgb without removing the suffix "a".

And I'm also looking for a package that is a color picker, with the function to change the format between hex, hsl, rgb.

Something like color-picker in atom.
Thanks :).


texts: Is there a template to create a project of directories and files?

texts:
Is there a template to create a group of directories and files for a new project?

Example:

List of predefined directories:  (.c .c_b .o .o_b .docs .invoices)
List of predefined blank files:  (1add.txt .../invoices/costs.txt)

M-x template-setup

(read-string "Please select your project root directory:  " default-directory)

If file or directory already exists, then skip and keep on going creating the remainder.


texts: font-lock-add-keywords lets users highlight keywords. Can you also specify an alternative text? For example, in C source code, besides using a special face, we may wish to visualize ! as not, && as and, etc.


texts: Goto line by number in folded org buffer

texts: I looking for a way to go to the specific line by number in an org file, when the structure is folded. An ideal solution would be to unfold only necessary headings to put the cursor in the line. I was looking for a while for some solution for this, but I didn't find any silver bullet so far.


texts: Spacemacs visual line navigation not working

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

In ~/.spacemacs, there is:

(global-visual-line-mode t)
(add-hook 'text-mode-hook #'visual-line-mode)

So, when I open a text file, I see long lines as multiple screen lines.

But when I press j or k, it moves according to actual line, not screen line. That is, j or k moves multiple screen lines.

SPC h d k j shows j bound to evil-next-line

What is happening here? How do I get j and k to move as per screen line even in normal mode?


texts: Relationship between frame, buffer, and file

texts:
I am trying to check how frame, buffer, and file work.
It seems to me that frame commands(C-x 5 ...) create a frame,
whether a buffer or file exists or not.
Here is what I am thinking:

C-x 5 2
1. Create a new frame.
2. Copy the current buffer into the new frame.

C-x 5 b bufname <RET>
1. Create a new frame.
2-1. Check if the bufname buffer exists.
2-2. Create a new buffer if 'bufname' does not exist.
3. Copy the buffer into the new frame.

C-x 5 f filename <RET>
1. Creates a new frame.
2-1. Open the file specified.
2-2. Create a new file if not exists.
3. Create a new buffer using the file above.
4. Assign the opened filename to the buffer name.
5. Copy the buffer into the new frame.

Am I right? It seems to me that we can have multiple frames for a single buffer.
Is emacs buffer a mapping between a buffer name and character sequence in memory?
When you open a file, does emacs assign a buffer name with its name(without extension) and add to the buffer list?


texts:
I like to use the markdown-mode for READMEs.

And I would like to use the markdown-mode as a minor-mode for comments in other major-modes like sh-mode. Is this possible somehow?


texts:
I'm getting started using spacemacs with vim bindings for editing and one thing I would like to do sometimes is replace some text with some other text.  For example I might have
k x = (1 + 1) * x

and I want to select replace (1 + 1) with 2.  Normally in vim I would just type f(v%s2<Esc>.
However in spacemacs s doesn't work on selections like it does in vim, this instead puts 2 around the selection
k x = 2(1 + 1)2 * x

Which is not what I wanted.  (Strangely s seems to work perfectly in normal mode)
Now obviously in this case I can just do di to delete and enter insert mode separately but in general di has some important drawbacks:

It cannot be repeated across several lines using visual selection mode (a very common use case)
It cannot be repeated with . since it is two actions.

Is there another option that I could use to achieve the functionality of my old s?  Or do I have to modify my configs somehow?


texts: How to find file name a few levels down in directory?

texts:
I am new to emacs (using Spacemacs with Evil and Ivy).
This is how I open a file: SPC f f (counsel-find-file)

Find file:

I entered path of file.  Ivy matches words one directory at a time.  But drilling down is getting tiresome.

Is there a way Ivy can look into a directory to match file names a few levels down?


texts: How to export an underscore in org-mode, using markdown or gfm, without producing a backslash escaped underscore `\_`?

texts:
Given a file:

#+OPTIONS: ^:nil
* heading
  this is some text_to_export

C-c C-e m m or M-x org-md-export-as-markdown yields:

# heading

this is some text\_to\_export

HTML export does not add the backslashes and produces the intended text_to_export.

How do I avoid turning _ into \_ in markdown export?


texts: Emacs on Windows with a GameCube controller for note taking

texts:
I'm running out of desk space and can't fit both my textbook and my keyboard on my desk when I need to take notes. It doesn't hurt my wrists to keep a controller in my lap and I have a fair amount of GameCube controllers.

I know about Versor and joystick.el, but I don't think they support Windows, I'm not sure if they support behavior based on the joystick being analog, and they're definitely not meant for note taking.

Is there an existing way to nicely control Emacs with a GameCube controller, especially in a way that lets me customize it for note taking with Org?

If not, where should I start? What kind of examples of powerful editing with a controller can I look to so it doesn't just end up like an on-screen keyboard?


texts: How can I (automatically) check for new mail in Wanderlust?

texts:
Wanderlust doesn't update the number of new/unread/total mails in the "Folder" view. I have configured it to use my dovecot imap server and I didn't find any way to configure an update interval or even a keybinding or a function to update this information. Currently, the only way is to press "RET" on a folder to update it. With some 30 folders, this is of course not the way to go.

Surely, there has to be some most simple way to do it, but I'm too dumb to find it :(


texts:
I am trying to send email via SMTP in gnus. I can receive email via IMAP just fine, but whenever I try to compose a message send, I get this error:

  smtpmail-send-it: Sending failed: 530 5.7.0 Must issue a STARTTLS
  command first. e5sm37529pdc.94 - gsmtp

This is my smtpmail-send-it configuration:

(setq message-send-mail-function 'smtpmail-send-it
      smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil))
      smtpmail-auth-credentials '(("smtp.gmail.com" 587 "email@example.com" nil))
      smtpmail-default-smtp-server "smtp.gmail.com"
      smtpmail-smtp-server "smtp.gmail.com"
      smtpmail-smtp-service 587
      starttls-use-gnutls t)

I'm not sure what I'm doing wrong here. Any help would be appreciated.


texts:
I'm looking for a script for an orgmode report that reports on what I've done as a kind of "diary format" instead of by task as is usual by default.

A summary of what I've done would also be good. I rarely clock out before the end of the day so the clock out time of the previous task is the clock in time of the next task (this happens automatically when I clock something in). This is an example of what I'm looking for:

|       Date | Time Start | Time End | Task                             | Current Task Status |
|------------+------------+----------+----------------------------------+---------------------|
| 2018-01-01 |      09:03 |    10:27 | Meeting                          | No Status           |
| 2018-01-01 |      10:27 |    11:34 | Write SQL for London Data Return | Done                |
| 2018-01-01 |      11:34 |    12:02 | Admin                            | No Status           |
| 2018-01-01 |      12:02 |    12:30 | Lunch                            | No Status           |
| 2018-01-01 |      12:30 |    14:55 | Complete Performance Report      | Todo                |
| 2018-01-01 |      14:55 |    15:03 | ~No Task has been Clocked~       |                     |
| 2018-01-01 |      15:03 |    17:08 | Complete Performance Report      | Done                |

Summary of 2018-01-01
Hours worked: 07:37
Time Ahead: +00:07
Time not Clocked: 00:08

Do you know if something similar exists? This is basically something I'm looking at to "justify" my time to those higher powers that assume we spend the day browsing Reddit and secretly vaping at our desks.


texts: How to revert a buffer using the "g" shortcut

texts:
I can refresh my dired buffer using M-x revert-buffer

and I've seen multiple places that I can do this more easily using g but don't understand how that would be run. Does it mean M-x g or running g <RET> somehow?

Searched around but haven't figured out what basic trick I'm missing so thanks for the help.


texts: shell script: emacs does not align case if pattern involves $

texts:
Let us start with an unaligned piece of code

case $word in
pattern1)
command1
;;
*)
command_defaultcase
;;
esac

I can align this code by selecting the lines and pressing TAB. The result is:

case $word in
    pattern1)
        command1
        ;;
    *)
        command_defaultcase
        ;;
esac

However, the result is different if the pattern involves $:

case $word in
    $pattern1)
    command1
    ;;
    *)
        command_defaultcase
        ;;
esac

The emacs version I use is GNU Emacs 23.1.1 (x86_64-redhat-linux-gnu, GTK+ Version 2.24.23) of 2015-02-20 on lxdist01.

What is wrong?


texts: How to get magit to ignore branches associated with closed pull requests?

texts:
I'm struggling to find a good workflow for managing pull requests from magit.  (I am approving pull requests, not generating them.)  At the moment I am using m p to preview a pull request and m m to merge it, but my autocompletion is cluttered with obsolete pull-request branches like github/pull/112.  How can I get magit to ignore these closed requests?

I would be happy enough to switch to some other workflow, but I have had no luck finding anything.  (I did find magit-gh-pulls, which is on MELPA if marked "obsolete," but I cannot get it to configure properly with our Github Enterprise instance, and all I learned from its messages is that it is trying to contact api.github.com.)


texts: How to evaluate a defun with square brackets in column 0 of its docstring?

texts:
I have problems running eval-defun for a defun when there is a square bracket [ in column 0 of its doc string. For example:

(defun test ()
  "Test function.
[Some text]"
  (message "Hello"))

When I position the cursor inside the function above and type M-x eval-defun RET it displays "[Some text]" in the echo area, but the defun is not being evaluated. If I remove the square bracket [ in the doc string, and then reevaluate, it works fine and displays "test" in the echo area.

I am using GNU Emacs 25.2.1 on Ubuntu 17.04.


texts: Opening with default application (e.g. Skim) from helm-locate on OS X

texts: I'm trying to find a way to open files in helm-locate buffers using external software in OS X. Specifically, I'd like to be able to open PDFs in Skim. I know I can hit C-u C-c C-x to choose a program to open a file with, but I can't find a way to get Skim to show up on the list that helm produces.


texts: convert fraction to decimal in org spreadsheet


texts: How do I require a package installed via .cask in a project

texts: I'm trying to contrib to a project and installed cask and did cask install and now I have a .cask folder with the deps.  Now in emacs how do I evaluate a .require of one of those deps?  Is there a linking step that must be done to point the resolution to the .cask folder?


texts:
I use Emacs 26.1 and would like to compare two files word-by-word. Clicking "Tools -> Compare (Ediff) -> Windows Word-by-word..." allows only to compare the visible parts of two buffers, not the whole buffers. This seems to be intended behavior as per my other question. The response there contains a working solution for comparing two complete buffers. There seem to be no issues with performance.

How can this be used to compare two files? It would be nice if a menu option could be added as well: "Tools -> Compare (Ediff) -> Files Word-by-word...".


texts: How do I cut and paste effectively between applications while using EXWM?

texts:
For example, I am trying to copy the URL line from Firefox into an org mode buffer. The usual cut and paste keys for Firefox (C-c C-v) do not work, and neither does (M-w C-y).

To copy from Firefox (in this example), I have to use the right mouse button context menu and select "Copy" which is suboptimal to say the least.

I've googled and gone through the documentation but can't seem to find any reference to the kill buffer.

Any help would be appreciated.


texts:
My goal Write code in my init.el file so that from now on, M-v will just print the BELL character (character number 27 in hexadecimal) instead of scrolling down as it does by default.

My failed attempts :

Attempt 1: (global-set-key (kbd "M-v") (quote ("'")))

This gives no error message but M-v just says command undefined and does not print the character.

Attempt 2 : (global-set-key (kbd "M-v") (insert-char("BELL")))

Produces the following error message :

Warning (initialization): An error occurred while loading ‘.emacs.d/init.el’:
Invalid function: BELL

Attempt 3 : (global-set-key (kbd "M-v") (insert-char(#x27)))

Produces the following error message:

Warning (initialization): An error occurred while loading ‘.emacs.d/init.el’:
Invalid function: 39


texts: yasnippets and org-mode: yas-next-field-or-maybe-expand does not expand

texts:
In org mode, the TAB key maps to yas-next-field-or-maybe-expand. But it is not working.

But if I run yas-expand (by hand) it works as expected.

TAB does expand in other modes.

Any ideas what might be wrong with my configuration? where to start debugging my (long) startup configuration?

thanks a lot!


texts: Does Emacs have a standard function to insert or overwrite text depending of the state of overwrite-mode?

texts:
Context: using Emacs 26.2

I would like to write Emacs Lisp code that inserts or over-types text depending of the state of the overwrite-mode.  I would call this function to insert text instead of the standard insert function.  When code uses the standard insert function while overwrite-mode is t, text is inserted and not overwritten.
I could write and use the following function, but I would have thought that such functionality would already be built-in Emacs.  I can't find it.  Does Emacs already provide a similar function?
(defun insert-or-overwrite (text)
  "Insert or overwrite text depending of overwrite-mode status."
  (when overwrite-mode
    (delete-char (length text)))
  (insert text))


texts: Can I set a timer to run at 7am tomorrow?

texts:
It seems to me I can either set a time for today or some relative time in the future.

But can I combine the two somehow to set a timer for 7am tomorrow, for example?


texts:
I use a custom LaTeX environment that creates a quotation box on export. A sample code looks like this:

* Org-mode heading

Here is a witty quote from a witty chap:

\begin{fancyquote}

Witty quote!

\end{fancyquote}

To maintain readability of the org-file itself, I would rather use something like this:

* Org-mode heading

Here is a witty quote from a witty chap:

** Witty quote :ignore:
:LATEXENVIRONMENT:
:PREFIX: \begin{fancyquote}
:POSTFIX: \end{fancyquote}
:END:

    Witty quote!

On export the LaTeX code in PREFIX and POSTFIX is then wrapped around the content of the heading, the heading itself not being exported.

Any ideas?


texts: How to set value vc-git-grep-template within function

texts:
I have a working sexp for configuration vc-git-grep:

(setq vc-git-grep-template "git --no-pager grep -n -i -e <R> -- <F>")

Then in dired-mode I evaluate M-x vc-git-grep and everething works as expected.

And then I want to create defun:

(defun Pfedj/vc-git-grep-noncase()
  (interactive)
  (setq vc-git-grep-template "git --no-pager grep -n -i -e <R> -- <F>")
  (vc-git-grep))

When in dired-mode I evaluate

M-x Pfedj/vc-git-grep-template

==> Wrong number of arguments: (1 . 3), 0

How can I fix my function?


texts: Emacs ESS R - Message Content Encoding and Display Issue

texts:
I use Emacs ESS for doing some work in R. But somehow the help messages or content which is output of R process, is not printed correctly, most likely because of some encoding issue. (Screenshot included below)

But if I do the same using the R console, it works fine as seen below:

Any advise how to fix the encoding issue in Emacs ESS.


texts:
I am writing this mode where I only want to show one paragraph at a time. Ideally I'd like to show the paragraph in the center of the screen. Getting it horizontally centered is trivial, but I have not found out how to enter text vertically. What do you think would be the best way to achieve vertical alignment of a few lines of text in an otherwise empty buffer?

Currently thinking of:

Pasting paragraph into new buffer
Adding a bunch of new-lines
Going to the top of the buffer
Select the visible buffer
Count the number of empty lines in visible buffer with (how-many "^$")
Ensure that there are empty-lines-in-visible-buffer/2 empty lines before the paragraph.

I'm sure there is a better way to do this though.


texts: Configure header line only if buffer major-mode does not display a header line

texts:
I've been using code taken mostly from the header line Emacs wiki to display the file path and current function of the current buffer.

(defmacro with-face
    (str &rest properties)
  `(propertize ,str 'face (list ,@properties)))

(defun sl/make-header ()
  "."
  (let* ((sl/full-header (abbreviate-file-name buffer-file-name))
         (sl/header (file-name-directory sl/full-header))
         (sl/drop-str "[...]")
         )
    (if (> (length sl/full-header)
           (window-body-width))
        (if (> (length sl/header)
               (window-body-width))
            (progn
              (concat (with-face sl/drop-str
                                 :background "blue"
                                 :weight 'bold
                                 )
                      (with-face (substring sl/header
                                            (+ (- (length sl/header)
                                                  (window-body-width))
                                               (length sl/drop-str))
                                            (length sl/header))
                                 ;; :background "red"
                                 :weight 'bold
                                 )))
          (concat
           (with-face sl/header
                      ;; :background "red"
                      :foreground "red"
                      :weight 'bold)))
      (concat (if window-system ;; In the terminal the green is hard to read
                  (with-face sl/header
                             ;; :background "green"
                             ;; :foreground "black"
                             :weight 'bold
                             :foreground "#8fb28f"
                             )
                (with-face sl/header
                           ;; :background "green"
                           ;; :foreground "black"
                           :weight 'bold
                           :foreground "blue"
                           ))
              (with-face (file-name-nondirectory buffer-file-name)
                         :weight 'bold
                         ;; :background "red"
                         )))))

(defun sl/display-header ()
  "Create the header string and display it."
  ;; The dark blue in the header for which-func is terrible to read.
  ;; However, in the terminal it's quite nice
  (if window-system
      (custom-set-faces
       '(which-func ((t (:foreground "#8fb28f")))))
    (custom-set-faces
     '(which-func ((t (:foreground "blue"))))))
  ;; Set the header line
  (setq header-line-format

        (list "-"
              '(which-func-mode ("" which-func-format))
              '("" ;; invocation-name
                (:eval (if (buffer-file-name)
                           (concat "[" (sl/make-header) "]")
                         "[%b]")))
              )
        )
  )
;; Call the header line update
(add-hook 'buffer-list-update-hook
          'sl/display-header)

However, this prevents major modes from setting their own header lines. For instance, when I use GDB with many-windows set to true, this prevents me from toggling between locals/registers and threads/breakpoints.

I tried changing the code block to

(if header-line-format
    nil
  (add-hook 'buffer-list-update-hook 'sl/display-header))

but this does not give the expected result (it seems to check for the first buffer and then not after that).

Is there a way to display my own custom header line only if the current buffer wouldn't display its own?


texts: how do I get Flymake to recognize files in my load-path?

texts:
when running Flymake against ~/.emacs, I see errors complaining about missing files like "powerline" and "company" - i.e. stuff contained in load-path.  How can I configure Flymake's elisp backend to be aware of load-path?  Nothing in the Flymake customize-group looked applicable.

This is with Emacs 27.0.50 .


texts: How to configure emacs to show the file I was working on when I open emacs?

texts:
I have save-place and save-visited-files installed however whenever I start emacs first a directory list shows (result of another setting in .emacs), I close it and then a few message buffers show up and it's after closing all of them that I get to the file I was working on last time.
How can I configure emacs to show the file from last session when started?


texts: How to make helm list all options when hitting M-x

texts:
I unfortunately lost my init_helm.el file, and had to reconstruct it from scratch, so far only with these commands:

(require 'helm)
(helm-mode 1)

The functionality I miss the most is the ability to list all alternatives when hitting M-x. Which code must I add to get this functionality back?


texts: multiple-cursors + isearch (or phi-search) with Emacs 24+?

texts:
For several years, I've been happily using multiple-cursors with phi-search to run interactive searches with several cursors at once with Emacs 23. I would create my multiple cursors, then run phi-search as needed to navigate, and edit when I arrived at the point I wanted.

My configuration looked like this:

(require 'multiple-cursors)
(require 'phi-search)
(define-key mc/keymap (kbd "C-s") 'phi-search)
(define-key mc/keymap (kbd "C-r") 'phi-search-backward)

But in Emacs 24, phi-search with multiple-cursors active will only search for a single cursor, and leave the others unchanged. Is there any way to get isearch like navigation when there are multiple cursors on the screen, assuming I'm using a recent Emacs?


texts: Quick way to close all but one window, and then revert to previous window setup?

texts: I want to close all my windows but the current one and maximize the frame so I can quickly see everything in the buffer in that one window, and then revert to my previous window setup. How would I go about doing this?


texts: Exit emacs client that runs inside emacs terminal buffer

texts:
Recently, I'd wanted to commit to my git repository from within emacs. Instead of running some git mode commands, I opened up a terminal buffer and run git commit inside. This works fine, except that the commit message editor is, of course, emacs. Out of habit, I tried to save-close the editor after inserting the commit message, but that closed my parent emacs...

Since I run emacs in client/server mode, I can simply reconnect and have all the buffers still open. But how do I close the child emacs (apart from killing it from within another terminal)?

In general, how do I send ctrl/meta to a program running in the terminal buffer?


texts: How to control image size when exporting to HTML via dvisvgm?

texts:
The org-mode source

#+OPTIONS: toc:nil creator:nil author:nil timestamp:nil num:t validate:nil
#+OPTIONS: tex:dvisvgm
#+LaTeX_HEADER: \usepackage{tikz}

\begin{tikzpicture}
   \draw (0,0) circle (3cm);
\end{tikzpicture}

exports cleanly to HTML.

The tex option can be changed from dvisvgm to dvipng or imagemagick and it continues to work, but with a difference: When using dvipng or imagemagick the image size is constant; when using dvisvgm the image size is automatically adjusted to occupy the maximum space available. This means that the image size changes as the browser window is resized.

Is there a way to keep the image size constant when exporting images created by LaTeX snippets to HTML via SVG?


texts:
Linux Mint 20.1
Emacs 26.1
Install dired+ package. Also install DiredSort from here
https://www.emacswiki.org/emacs/DiredSort
I try to sort by size.
dired-sort-size

But I get error on empty screen:

Error:
insert-directory: Listing directory failed but ‘access-file’ worked


texts:
When I start up emacs, I see

Warning (initialization): Your `load-path' seems to contain
your `.emacs.d' directory: ~/.emacs.d/
This is likely to cause problems...
Consider using a subdirectory instead, e.g.: /home/faheem/.emacs.d/lisp

I think I started seeing this message relatively recently, but in any case, here are the relevant lines in my .emacs.

(add-to-list 'load-path "~/.emacs.d/")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/slime/contrib")

Here is what my emacs.d directory looks like:

faheem@orwell:~/.emacs.d$ ls
abbrev_defs     edit-server.el  session.10dbde7765000140938718700000055430258  session.10dbde7765000142073356500000315430010
auto-save-list  elpa            session.10dbde7765000141759448100000009970011  tramp

What am I doing wrong, if anything?


texts: Predicates in ibuffer saved filter groups

texts:
How do I add a new ibuffer saved filter group which matches all files in org-agenda-files?

Something like:

(setq-default ibuffer-saved-filter-groups
              `(("Default"
                 ("Agenda" (or (mode . org-agenda-mode)
                               (mode . diary-mode)
                               (predicate . '(lambda ()
                                              (member (buffer-file-name)
                                                      (mapcar 'expand-file-name org-agenda-files))))))))

I'm guessing at the predicate bit as I can't find any examples or documentation. What should it really look like?


texts: How to re-evaluate cl-defstruct during same Emacs session

texts:
I am putting together a modification of a library that contains an existing cl-defstruct definition, and I am having problems redefining it after its initial evaluation.

Q:  How can I replace the old definition with the new one?  [It would be nice if I could wrap it in something so that eval-buffer, eval-region, and/or require will be sufficient to force its re-definition.]

BEFORE:

  (cl-defstruct
  (undo-tree-node
   (:type vector)   ; create unnamed struct
   (:constructor nil)
   (:constructor undo-tree-make-node
                 (previous undo
      &optional redo
                  &aux
                  (timestamp (current-time))
                  (branch 0)))
   (:constructor undo-tree-make-node-backwards
                 (next-node undo
      &optional redo
                  &aux
                  (next (list next-node))
                  (timestamp (current-time))
                  (branch 0)))
   (:copier nil))
  previous next undo redo timestamp branch meta-data)

AFTER:  Adding the word count at the very end.

  (cl-defstruct
  (undo-tree-node
   (:type vector)   ; create unnamed struct
   (:constructor nil)
   (:constructor undo-tree-make-node
                 (previous undo
      &optional redo
                  &aux
                  (timestamp (current-time))
                  (branch 0)))
   (:constructor undo-tree-make-node-backwards
                 (next-node undo
      &optional redo
                  &aux
                  (next (list next-node))
                  (timestamp (current-time))
                  (branch 0)))
   (:copier nil))
  previous next undo redo timestamp branch meta-data count)


texts: Is there any way to use just year and month as timestamp in org-mode?

texts: Specifically, I'd like to sort a column in a table in org-mode. However, the column only has year and month information, like 2016-02 or May 2016. It can't sort for now as it's not recognised as timestamp. How can I make it to work properly?


texts: Error when opening multi-term: error in process filter: Invalid face: unspecified

texts:
When I try to start multi-term, I these two errors which prevent the buffer from taking input:

error in process filter: face-attribute: Invalid face: unspecified
error in process filter: Invalid face: unspecified

I'm using Spacemacs, if that helps.


texts: How to match an expression under the cursor?

texts:
I'm trying to match an expression under the cursor.

In this case it happens to be reStructuredText, however I don't think that's such an important detail.

:role:`Some Content`

While this works, it depends on the cursor being at the beginning of the expression.

(search-forward-regexp "\\(\\:[a-zA-Z0-9_]+\\:`.+?`\\)" nil t 1)

Since there could be multiple matching expressions on a single line, what's a reliable way to find an expression under the cursor, where the cursor can be anywhere between the start/end of the expression.


texts: how to show only time-grid without TODO items in Org-Agenda?

texts:
I'd like to show only the time-grid and not show any tasks/todos below the time-grid.

I noticed a question similar to this here, but the answer seemed to be about formatting the prefix of each item in the agenda view. That doesn't quite get at what I want to do.

One way I see to do this is to use custom-agenda and skip-entry-if to eliminate items where 'todo matches my todo-keywords. Something like: (org-agenda-skip-entry-if 'todo ("TODO","WAIT","DONE","CNCL"). This seems like overkill, but probably will work.

Is there a simpler approach?


texts:
So currently diff-mode outputs standard git patches, something like

@@ -8,6 +8,8 @@
-foo bar
+baz

I.e. the + and - are part of the buffer text. Sometimes I would find it convenient if the +/- was displayed in the left FRINGE instead of as part of the output. So something like a diff-mode-toggle-fringe-annotation function. I haven't found one however. Does it exist?


texts: Lispy: recommended way to exit a string?

texts:
I'm trying to get a hang of lispy for editing and navigating Lisp code.

My assumption is that most of the keymap choices are made to offer convenience in practice. Some practical tasks involve more than one keystroke to accomplish and there are examples in the docs.

I am wondering if there is a recommended way to get out of the following situation. Consider the following code:

(format "%s|")

| indicates the current location of the point.

What I want to do is to add another argument after the string I'm in.

From inside parentheses, braces, or brackets - I can exit the list by pressing either ] or ). I can move point before the surrounding list by pressing [.

It appears that from inside a string I can't get out of using modifier keys - either by moving over words and characetrs, or by moving up the list with C-M-u (lisp.el considers strings as lists in this regard).

I would assume this to be a common situation and I'm wondering if there is a recommended way to get out of it.


texts: How to define custom compile commands in auctex?

texts:
I'm using TeXLive 2014 on MacOS X 10.6 and I'm currently working with Aquamacs 2.5.

I'm currently using two different shell scripts for compiling my LaTeX document (thesis), which are located in ~/bin/script1.sh and ~/bin/script2.sh

At the moment I always switch to the terminal application for compiling and launch one of those commands there.
I'd like to define a custom keybinding in Emacs which lets me run those scripts directly without leaving Emacs.

How can I do that?


texts: I have a few Emacs servers running on my computer, and a few clients are attached to these servers. Is there a way to get which server a client is attached to from the window?


texts:
I think that this is a newbie question, but here it goes:
I have installed Flycheck just as in the official page. Therefore, in my .emacs file I added the following lines (after installing):
(package-install 'flycheck)
(global-flycheck-mode)
(package-install 'exec-path-from-shell)
(exec-path-from-shell-initialize)

However, when I open a .py file, I get this error message:

Warning [flymake seila.py]: Disabling backend python-flymake because (error Cannot find a suitable checker)
Warning [flymake seila.py]: Disabling backend flymake-proc-legacy-flymake because (error Can’t find a suitable init function)

How would I fix these errors? Seems to me that some file/configuration is missing. I've found this (partial) solution that makes the second error disappear, but It does not seem to be an effective solution.
Thanks in advance.


texts: Emacs multi-term support for version 25 - Ubuntu 18.04

texts:
The requirement is to enable multi-te m support for emacs package. Bydefault in Ubuntu 18.04 default emacs coming with v25, but in this version, I'm unable to enable the multi-term support ( for more info - https://www.emacswiki.org/emacs/MultiTerm ) .

However I tried to compile the source file for emacs v24 and failed to make during the configure session and got stuck at this point.

Env: Ubuntu 18.04 4.15.0-29-generic

/usr/lib/x86_64-linux-gnu/libpthread_nonshared.a(pthread_atfork.oS): In function `__pthread_atfork':
/build/glibc-OTsEL5/glibc-2.27/nptl/pthread_atfork.c:51: undefined reference to `__dso_handle'
/usr/bin/ld: temacs: hidden symbol `__dso_handle' isn't defined
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
Makefile:632: recipe for target 'temacs' failed
make[1]: *** [temacs] Error 1
make[1]: Leaving directory '/home/test/Downloads/emacs-24.3/src'
Makefile:334: recipe for target 'src' failed
make: *** [src] Error 2

Even I tested the same in Centos 7 for emacs bydefault coming with v24, in that i can see the multiterm enabled without any issues. But in Ubuntu 18.04 it failed to enable.

Is there any way can I pull the emacs v24 from any third party repository? I even tried so many but no luck.

Please shed me some views, how to proceed further the same in Ubuntu 18.04 or do I need to go back to Ubuntu 16.04 ?

I tried with the default version of emacs  v25.2 in 18.04 and followed this one https://www.emacswiki.org/emacs/MultiTerm and got error as follows

$cat /home/test/.emacs
(require 'multi-term)
(setq multi-term-program "/bin/bash")

$ls -l /home/test/.emacs.d/multi-term.el

while retrieving emacs editor, getting error as follows

Warning (initialisation) An error occured while loading '/home/test/.emacs': File error: Cannot open load file, No such a file or directory, multiterm'

Please shed some views how to get rid of this?


texts: Can I format cells in an org-mode table differently depending on a formula?

texts:
I have a column in an org-mode table with numbers in each cell. I'd like to change the background color of the cell to red if the number is below 1 or above 2.

How can I do that?


texts: how to deal with mixed line endings in diff-mode

texts:
Say I have several files with different line endings (i.e. some have LF and others have CR+LF).  If I somehow run diff on them and load the diff into Emacs (e.g. with C-x v D, or just dumping the diff to a file and visiting it), I get mixed line endings in the diff buffer.  This is more than just annoying ^Ms at the end of some lines, it breaks diff-apply-hunk.  If I delete the CRs, diff-apply-hunk works, but at the expense of editing the buffer, which is undesirable when editing patch files.

How do others deal with this?  Is there a way to make the line endings in the diff buffer consistent without changing the buffer contents?


texts: Auto-resize window widths to accomodate line length

texts:
What is an easy way to automatically resize a window (height and or width) according to the length / line length of the buffer?

Possible behavior: A frame split horizontally with two windows with the right-hand buffer set to automatically resize to a minimum width that minimizes wrapped lines.  A maximum width might be specified and occasionally force some lines to be wrapped.


texts: Org: linking to heading which contains a link

texts:
Like the title says.  I like to organize papers/books/etc that I've read, usually with a heading that has the name and a link to a pdf file.  Unfortunately, once a link is inserted in a heading it becomes impossible to create a working link to that heading.

Example (created with org-store-link and org-insert-link):

Broken link: [[*heading%20with%20%5B%5Bfile:alink.stuff%5D%5Blinks%5D%5D][heading with links]]
* heading with [[file:alink.stuff][links]]
   - some notes here

The best solution would be a way to link only to the visible text.  That way, it would be possible to move the linked file around without breaking things.  However, any insight at all would be appreciated.


texts:
I am starting a Python virtualenv through init.el (or so I would like):

(require 'virtualenvwrapper)
(venv-workon "my-python-project")

However, flycheck does not find flake8 or pylint, which are installed there. Starting emacs in a terminal with the virtualenv loaded works fine.

Is it possible to configure init.el to start a virtualenv for flycheck to use?

EDIT

Seems that this is related to an open bug in python-mode.el


texts: Emacs 24.4 in OS X 10.10 is not restoring windows configuration (desktop)

texts: I read that Emacs 24.4 should restore the desktop by default. It works perfectly except that the window configuration is not retained. It is saved because I can clearly read it in the desktop file, but when it starts up there is only one window in full screen. The others are loaded in their buffers but they are not displayed.


texts:
I am exporting a block of code

#+begin_lstlisting
cut -d \' | grep http://
#+end_lstlisting

But the org export to latex replaces the backslash with $\backslash$ and the http:// string with \url{http://}.

I have tried the export options

#+OPTIONS: ^:nil -:nil tex:verbatim

But they haven't done the trick. Any suggestions would be helpful.

I am using orgmode 8.2.10 on Emacs 25.1.50.2


texts:
First time emacs user trying to install "evil mode". I'm attempting to follow the instructions at https://blog.aaronbieber.com/2015/05/24/from-vim-to-emacs-in-fourteen-days.html.

I installed emacs on Ubuntu 18.04 with sudo apt install emacs. In ~/.emacs.d/.emacs I have:

(require 'package)
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
(setq package-enable-at-startup nil)
(package-initialize)
(require 'evil)
(evil-mode t)

After running M-x package-list-packages I see Package refresh done but neither evil nor evil-mode are in the list and M-x package-install RET evil returns [No match]

What am I missing?


texts: after previous `counsel-yank-pop`, `yank` the last yanked entry

texts:
short: after a counsel-yank-pop, yank does not yank the same entry. How can I achieve that behavior?

long: Having a kill-ring like:

foo
bar
baz

When doing a C-y (yank) and M-y (yank-pop) 'bar' will be inserted. And for every repeated C-y, 'bar' will be inserted again.
This is the behavior (repeated insertion of 'bar') I'd like to have with counsel-yank-pop instead of yank-pop.
But counsel-yank-pop does not seem to modify the kill-ring pointer for yank.
How can I achieve the wanted behavior?

Note: I'd like to keep using ivy and counsel, instead of switching to helm or something else.


texts: How to make Tramp execute only if address is reachable?

texts:
So I have a couple of VM I'm using (mainly for experiment) I use Tramp a lot on a particular file in the VM, so I started to use this:

(find-file "/ssh:vm@192.168.122.141:/home/vm/test.org" t)

I put that in my init file, so it always connects when I launch emacs... except that most of the time, I didn't plan on using the vm, so it cannot connect to it (since the vm isn't opened before emacs is launched) emacs stop halfway in loading the init file.

So how could i make it so the aforementioned line of elisp would only open the file if the address is reachable?


texts: outline mode: Fold everything when loading file (specifically LaTeX mode)

texts: I am using outline minor mode for LaTeX mode and would like emacs to automatically hide all section environments when opening a .tex file. How could I do that?


texts: wanderlust: size and position of displayed images?

texts:
Using wanderlust in emacs-25.1.x, how can I specify the display size and position in the message buffer of attached images that are shown inline?

I want to display smaller versions of the images, and I'd like to arrange them in a grid at the bottom of the message.

I can't find anything in the wanderlust docs about this.

Thank you in advance.

More info added ...

OK. Here's what I have been able to determine so far. Images are displayed using the code in semi/mime-image.el. Near the top of that file is a static-cond which is used to select different methods for displaying images. The one that is selected by default makes use of the standard emacs 'insert-image' function. Here is its doc string:

  (insert-image IMAGE &optional STRING AREA SLICE)

  Insert IMAGE into current buffer at point. IMAGE is displayed by
  inserting STRING into the current buffer with a ‘display’ property
  whose value is the image.  STRING defaults to a single space if you
  omit it. AREA is where to display the image.  AREA nil or omitted
  means display it in the text area, a value of ‘left-margin’ means
  display it in the left marginal area, a value of ‘right-margin’ means
  display it in the right marginal area. SLICE specifies slice of IMAGE
  to insert.  SLICE nil or omitted means insert whole image.  SLICE is a
  list (X Y WIDTH HEIGHT) specifying the X and Y positions and WIDTH and
  HEIGHT of image area to insert.  A float value 0.0 - 1.0 means
  relative to the width or height of the image; integer values are taken
  as pixel values.

So, even if I change how 'insert-image' is called, it can't be used to resize the image ... only to reposition it and display slices (subsets) of it.

In order to resize these images, I am going to have to add code to redefine new versions the 'mime-image-create' and 'mime-image-insert' functions that normally get defined in semi/mime-image.el.

I'm still not sure how to best do this. Perhaps I can use imagemagick's 'display' program to rescale the image text.

I'm investigating this, and I will continue to report my findings.


texts: C-x C-f TAB TAB: Find file completion list: how to highlight subdirectories?

texts:
Often I'd like to open a file in a subdirectory. But poor me, I can't remember the name. So when typing C-x C-f and then TAB TAB for the completion list, the list of all files in this directory is listed, including the subdirectories, which are only marked by a / at the end.
Any idea how to highlight the subdirectories in this buffer *Completions* or to sort the completion list directories first?


texts:
I use scratchpads in XMonad (my WM) extensively for quickly capturing (notes, TODOs etc) from anyhwere. I have an instance of Emacs running permanently in a workspace, and launch emacsclient as my scratchpad.
XMonad relies on WM_CLASS property of the frame(?) to identify if it should start new emacsclient instance, or if it should reuse it started previously. Before Emacs 27, this is how I used to start emacsclient from XMonad:
emacsclient -c --frame-parameters='(quote (name . "scratchmacs"))'

Before Emacs 27, doing a xprops | grep WM_CLASS would return "scrathmacs", but Emacs 27 keep giving "Emacs" instead. As a result, everytime I call my scratch-pad, a new window for emacsclient opens up :-(
I have done a bunch of googling and read through the documentation (albeit quite non-methodically), but got nowhere.
Evaluating (assoc 'name (frame-parameters)) in new emacsclient frame gives correct answer, i.e
scratchmacs (but xprop for this frame still says emacs).
How can I set WM_CLASS of my choice for new emacsclient frames?


texts: Include linked headings when exporting to PDF

texts:
Given a test.org file like

* A level one heading
** [[file:other.org*some_heading][Some good stuffs]]

If I export it to HTML, Some good stuffs can get a nice link to another HTML. But this is not the case when exporting to PDF.

So when exporting to PDF, I want to include the actual content of some_heading. I know I can use something like

#+INCLUDE: "other.org*some_heading"

But that's a comment, and it's not easy for me to see the origin structure of test.org. I want it at least look like a heading in the org file.

Is there a way to keep Some good stuffs a link when exporting to HTML while include its actual content when exporting to PDF? Thanks.


texts: How to use Dired marked files as arguments to arbitrary Emacs Lisp functions?

texts: Dired lets me mark files and pass their names as arguments to arbitrary shell commands. I would like a way to supply the marked names as arguments to Emacs Lisp functions, either built-in or those I write myself.


texts: How do I limit org-sparse-tree to a subtree?

texts:
I want to see only the TODOs in a subtree, but calling org-sparse-tree then t shows TODOs in the whole buffer.

How do I limit the sparse filtering behavior to the subtree under the item at point?


texts: New line in cursor-intangible area and line-beginning position

texts:
I want to make the beginning of a line uneditable, which I can achieve by applying the read-only and cursor-intangible properties. But I have the problem, that line-beginning-position moves point not to the first reachable position of the current line, as I expect, but to the end of the previous line. This may be a bug in Emacs. Is there some workaround for this issue?
Example:
Let's say buffer contains "blablabla\nINTANGIBLEfooooo" INTANGIBLE has properties cursor-intangible t rear-nonsticky t front-sticky t. Then it is not possible to put point before any symbol of "INTANGIBLE", that is exactly wanted behavior, however if point is somewhere in fooooo, move-beginning-of-line puts point to the end of blablabla, which is strange.
Reconstruction:

Copy and paste the following form into the *scratch* buffer. There the black rectangle ▮ indicates the point position. (You should not copy that character.)

(insert "\nblablabla\n"
        (propertize "INTANGIBLE" 'cursor-intangible t 'rear-nonsticky t 'front-sticky t)
        "fooooo")▮

Eval the form with C-x C-e. You get

(insert "\nblablabla\n"
        (propertize "INTANGIBLE" 'cursor-intangible t 'rear-nonsticky t 'front-sticky t)
        "fooooo")
blablabla
INTANGIBLEfooooo▮

Hit the home key.
You end up with:

(insert "\nblablabla\n" (propertize "INTANGIBLE" 'cursor-intangible t 'rear-nonsticky t 'front-sticky t) "fooooo")
blablabla▮
INTANGIBLEfooooo

It becomes really interesting if one tries to get this behavior completely with the evaluation of a lisp expression:
(progn
  (insert "\nblablabla\n"
          (propertize "INTANGIBLE" 'cursor-intangible t 'rear-nonsticky t 'front-sticky t)
          "fooooo")
  (call-interactively #'move-beginning-of-line))▮

After evaluation with C-x C-e one gets:

I.e., point is between the last intangentiable character and the f of foooooo.


texts: How to start slime automatically and layout as I want

texts:
I'm now using this config:
(use-package slime
  ...
  ...
  :hook
  (slime-mode . (lambda ()
          (unless (slime-connected-p)
            (let ((bak-buffer (current-buffer)))
              ;; (delete-other-windows)
              ;; (split-window-horizontally)
              (save-excursion (slime))
              ))
          )))

And that is what I get when open a .lisp first time(previous window is only a scratch window)

But what I want is something like this:

Notice that I want slime to be on the left, and .lisp to be right, due to some environmental factor.


texts: How to prevent js2-mode from shortening keywords

texts:
I'm a longtime vimmer switched to Emacs with Doom this year when I got a job writing Clojure. Writing JS this week I came across a maddening configuration that I can't figure out how to turn off. Various keywords are being shortened to ligature-like characters. I say ligature-like b/c I've used a non-ligature font and it's still doing it.
Affected keywords are import, return, function, and the empty arg list for an arrow function () => {}. When my cursor is on the keyword it reverts to the keyword. I've tried over and over to find the configuration setting to prevent these character swaps.
I'm not entirely sure it's js2-mode that's making the change, but when I switch modes to js-jsx-mode the keyword swapping goes away. Help me Obi-wan Kenobi, you're my only hope.
js2-mode changing keywords

js2-mode with cursor over keyword

js-jsx-mode showing original keywords


texts: Elisp equivalent of FUNCTION-LAMBDA-EXPRESSION?

texts:
In Common Lisp, there is a function called function-lambda-expression, which returns the LAMBDA form that defines a function (or NIL on implementations that compile everything to native code).

Is there a function in ELisp that does something similar?


texts: Flycheck c/c++-gcc doesn't understand C++

texts:
I get the following when trying to check a header file;

-*- mode: compilation; default-directory: "~/devel/projects/SHARED/" -*-
Compilation started at Wed Feb 15 16:06:41

gcc -fshow-column -fno-diagnostics-show-caret -fno-diagnostics-show-    option -iquote /home/micke/devel/projects/SHARED/ -Wall -Wextra -I ../SHARED -I ../Shared_Memory -I ../IDL -I /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers -I /usr/local/cppenv/CppEnv/linux/ace/5.4/ACE_wrappers/TAO -I /usr/local/cppenv/CppEnv/linux/roguewave -I /usr/local/cppenv/CppEnv/linux/boost/1.38.0/include/boost-1_38 -x c -S -o /dev/null - < /home/micke/devel/projects/SHARED/globtypes.h
<stdin>:39:1: error: unknown type name ‘namespace’
<stdin>:40:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
<stdin>:71:1: error: unknown type name ‘namespace’
<stdin>:72:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
<stdin>:91:1: error: unknown type name ‘namespace’
<stdin>:92:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
<stdin>:127:45: error: unknown type name ‘e_ivr_app_state’
<stdin>:156:1: error: unknown type name ‘namespace’
<stdin>:157:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
<stdin>:485:19: warning: ‘CAUSE_OVERFLOW’ initialized and declared ‘extern’

Compilation exited abnormally with code 1 at Wed Feb 15 16:06:41

The code is C++ and not C but the fact that gcc doesn't recognize the keyword 'namespace' leads me to belive gcc is compiling for C and not C++. I also had a warning earlier that cc1 thinks the parameter -std=c++98 is invalid for C but not for C++, I removed the parameter from the configuration of Flycheck in my .emacs. But it also leads me to the same conclusion that gcc is compiling C and not C++. How do I configure Flycheck so that gcc compiles C++ and not C?


texts: org-mode weekly summary with one entry per DONE task and total time to complete

texts:
I want my weekly summary to list all the tasks I completed in a given week, ideally with an inline report of the total time each of those tasks took to complete.

Furthermore, it would be even more ideal if these tasks could be shown in a hierarchical / TODO view rather than an agenda view, so you could see them in context with their parents.

Finally, if possible, I'd also like to include any tasks that I worked on (clocked in/out) but didn't complete.

I'm currently using the code from this answer, which does give me a chronological list of tasks that are marked "DONE". The problem with this approach is that it lists the task multiple times for each clock-in/out. I just want one line per task.


texts: Compile and run single file c++ programs in Emacs[SOLVED]

texts:
I want to bind to a key a compile-and-run function to be able to compile my C++ single file programs and run them into a term/shell so I could give my variables values whenever  I use cin in my programs.

For example, in my Neovim config, I had this line:

autocmd FileType cpp  nnoremap <F8> :w <CR> :vsp <CR> <C-w>l :term g++ % -o %< && ./%< <CR> i

I want to have something similar in Emacs.
In Emacs, this line will be looking like so:

(define-key c++-mode-map (kbd "<f8>") #'compileandrun)

But I have no clue how the compileandrun function will look.

edit  1:
Here is a function I have tried

(defun compileandrun()
  (interactive)
  (compile (concat "g++ "  (file-name-nondirectory (buffer-file-name)) " -o " (file-name-sans-extension   (file-name-nondirectory
           (buffer-file-name)))))
   (term  (concat "./" (file-name-sans-extension
           (file-name-nondirectory (buffer-file-name))))))

it only compiles the program but it dosen't run it .


texts: How to make buffer file names unique when mutiple instance of emacs are running

texts:
The package uniquify has an interesting feature that when visiting two files with the same name, it shows in the mode-line a uniquified version of their name.
For example if we have two files with the paths .../directory1/file.txt and .../directory2/file.txt it shows in the mode-line something like directory1/file.txt and /directory2/file.txt not just file.txt.
It suffices to put this in the intit file:

(require 'uniquify)

Unfortunately this only works in a single instance of emacs.
Is there any way to have this feature when several instance of emacs are running? I mean how to uniquify the names in all frames and buffers opened in these instances.


texts: Is it possible to read user input from STDIN while tangling a source block?

texts:
Is it possible to read user input from STDIN while tangling a source block with org-babel-tangle?

I am aware of this: Org Mode Babel - Interactive code block evaluation.

That doesn't help solve this particular use-case, as it still doesn't allow proper STDIN input from shell, but only simulates a limited input internally to Emacs.

Background

I would like to use Org's Babel to learn new programming languages (Perl and Bash) by executing some tutorials from one org file.

The problem is that many tutorials rely on STDIN. For example, if one runs the following perl tidbit:

#+BEGIN_SRC perl :tangle hello-name.pl  :results output :export code
use 5.010;
use strict;
use warnings;

say "What is your name?";
my $name=<STDIN>;
say "Hello $name, how are you?";

#+END_SRC

Emacs will not wait for the user's interaction to properly type a name on STDIN, and it will immediately output:

#+RESULTS:
: What is your name?
: Hello , how are you?

Same thing using a bash example. This:

#+BEGIN_SRC sh  :results output :export code :tangle dir-input.sh
#!/bin/bash

if [ -z "$TEST_DIR" ]
then
    echo "TEST_DIR was not set, please enter the path: "
    read input_variable
    export TEST_DIR=$input_variable
fi
#+END_SRC

Will not wait for user input, and Emacs will immediately return this:

#+RESULTS:
: TEST_DIR was not set, please enter the path:

Is there a native way for Emacs to wait for input on an executing tangled block?

If not, would you please give some pointers on how to write something like a tangle-and-run-via-shell-buffer function that would:

Tangle the code block at point, saving with given filename,
execute the corresponding file in a visible shell buffer,
possibly accepting input from the user,
and finally reporting STDOUT, if any, to #+RESULTS:?

If such feature is not implemented (yet) in Org, how could one implement it with elisp?

Update: After searching and studying more the Emacs and elisp manuals, it seems the way to do it would be leveraging Comint, like perhaps make-comint-in-buffer.

(make-comint-in-buffer "*cmd-buffer*" nil "perl" nil "hello-name.pl")

Unfortunately, that is over my head right now


texts: Can I load a single package from a different archive?

texts:
For my main package loading, I want to use melpa-stable. There's at least one package (dash) that I know breaks my config if I use the melpa version. That's fine - I've no problem using melpa-stable as my default archive.

But there are some packages I need to get from melpa - specifically sublime-themes. Obviously I could download that package manually and install it somewhere in my load-path, but I'd prefer to use the package manager (and I'd also like to do so from elisp, so I can have my init.el install it if it's not present, for when I go to a new machine).

Is it possible to say "use this archive for this package, but don't use it for other packages"?


texts: mu4e: Refiling email while making an org-todo

texts:
Background:
I read my email through mu4e in (Doom) emacs. I set up an org-capture template that stores a TODO with a link to the current email I'm viewing, all working great.
Typically I do this from the inbox email folder, and I like to keep that clean, so I refile emails to my "All email" folder when I'm done with it.
If I refile after I added the org-todo, then the contained link no longer works (points to where the email used to be).
I'd like to keep my email inbox empty when I already track the todo elsewhere.
My question:
Is there a way to refile a message in mu4e, and at the same time add an org-todo with a valid link to the email?
I imagine I could write a custom elisp function to do it, but I'm not too comfortable with elisp in particular. I don't expect a copy-paste complete solution, but any help or pointers would be much appreciated!
Config:
I'm using Doom emacs with very little additional config, with
(doom!
   ;; ...
   ;; lots of unrelated modules
   ;; ...

   :email
   (mu4e +gmail))

The capture template I have looks as follows:
(setq org-capture-templates
  '(("m" "Mail" entry (file+headline "~/org/gtd.org" "Tasks")
     "* TODO Mail: (%:fromname) %:subject\nSCHEDULED:%t\n:PROPERTIES:\n:CREATED: %U\n:END:\n %a" :immediate-finish t :prepend t))