texts: Automatic preview generation with AUCTeX

texts:
Right now, when using AUCTeX's preview feature, I have to manually refresh the previews after I change existing sources or  write new text. I have to run preview-document every time, which is both inconvenient and inefficient, and it may take a while to re-generate previews for the whole document. I'm looking for a way to

Automatically generate previews when I open a document.
Automatically update previews on save.
Only (re-)compile previews for new and updated pieces of text.

Is there a way to do this with AUCTeX?


texts: Appointments not working (not displaying at all)

texts:
Emacs 24.5.

Here is init:

;; appointments

(require 'appt)

(appt-activate t) ; I have also tried (appt-activate 1) here as the appt.el documentation says to

; (setq appt-message-warning-time 1) I have messed around with these variables quite a bit and cannot find anything that works, so they are commented out at the moment.

; (setq appt-display-interval 1)

I have tried many variants of the following formats in the diary file, which is working appropriately in all other regards:

  Oct 19, 2016

    3:00pm testing

    15:00 testing

I am aware that the appt-message-warning-time default is 12 minutes. I have tried changing that and everything else that I can find in the documentation. I am saving the diary file each time. I have tried forcing an appt check. Nothing works.

What am I doing wrong?

UPDATE

I thought Dieter's answer got it, but it didn't.

Evaluating (appt-activate 1) in my init file did prompt Emacs to display the appointment. Speaking of that, I changed (appt-activate t) to (appt-activate 1) per the documentation instructions.

However, unless I manually evaluate the expression, the appointment will not diplay.

I thought Dieter was correct about the white space around the diary file formatting, but documentation for appt-check actually says the following:

  Note: the time must be the first thing in the line in the diary
  for a warning to be issued.  The format of the time can be either
  24 hour or am/pm.  For example:

          02/23/89
            18:00 Dinner

          Thursday
            11:45am Lunch meeting.

Here is my current init for appointments:

;; appointments

(require 'appt)

(appt-activate 1)

(appt-check 1)

(setq appt-message-warning-time 15)

(setq appt-display-interval 1)

The above is not working. What am I doing wrong?


texts: How to get the package name of current using theme?

texts:
I'm using a solarized-light theme, it is great. As you may notice, there are several packages provide the solarized theme:

  color-theme        20080305.34   installed             install color themes
  color-theme-san... 20150704.1855 installed             A version of Ethan Schoonover's Solarized themes
  color-theme-sol... 20150619.1734 installed             Solarized themes for Emacs
  solarized-theme    20150706.1028 installed             The Solarized color theme, ported to Emacs.

As a result, I forgot which package I used. Here is the line that I activated it in the init file:

(load-theme 'solarized-light t)

I tried describe-theme, it just let me specify a theme name.

Question:

How to get the package name of the theme I'm using?
How to get the list of current installed package? (list-packages list all package both available and installed.)


texts: Make comint-mode behave more like term-mode

texts:
I am constantly getting frustrated with the GDB comint-mode buffer when using GUD.  Somehow my cursor always ends up straying from the bottom of the buffer, and then my input is not interpreted how I would expect.

Is there a way that I can make comint buffers behave more like term-mode so that my keys get sent to the underlying process?

I realize that I will have to manually allow my debugging keys, but that should be easy because I use the function keys almost exclusively when debugging.


texts: Avoid having a repeating task clutter the top of the agenda

texts:
Here is what I have:

My event is being repeated every week, however if I don't update the "original" date (2018-10-08) manually the event will stay on top of the agenda (12 d. ago: EVENT weekly event).

Is there a way to avoid having that on top of the agenda, by just repeating this event every monday (without specifying an original date) ? Something like <Mon +1w> (which doesn't work).


texts: Getting error "Failed to download 'gnu' archive" on Emacs 26.3

texts:
I'm currently using Ubuntu 18.04, and trying out Emacs for the first time. However, whenever I run the command package-refresh-contents, I get the the follow error:

  Failed to download 'gnu' archive

This is my ~/.emacs.d/init.el file:

(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
;(setq package-check-signature nil)

; Set up melpa package repository
(require 'package)
(setq package-enable-at-startup nil)

(add-to-list 'package-archives
         '("gnu", "https://elpa.gnu.org/packages/")
         '("melpa", "https://melpa.org/packages/"))

(package-initialize)

These are the steps I've tried so far:

Upgraded from Emacs 26.2 to 26.3. According to this Reddit thread, this was supposedly fixed in Emacs 26.3. Since I'm using Kelley PPA to download Emacs, I had to upgrade from Ubuntu 16.04 to 18.04 to get Emacs 26.3, and it still didn't fix the issue.
Set (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3") as suggested here.
Set (setq package-check-signature nil) as suggested here.
Changed the URLs from https to http.

I've found no other suggestions when I searched online. Any help would be appreciated.

Updating with error message printed in Messages buffer when running the command package-refresh-contents after starting emacs with the flag --debug-init:

  For information about GNU Emacs and the GNU system, type C-h C-a.
  Importing package-keyring.gpg...done
  Contacting host: elpa.gnu.org:443
  gnutls.el: (err=[-50] The request is invalid.) boot: (:priority NORMAL:-VERS-TLS1.3 :hostname elpa.gnu.org :loglevel 0 :min-prime-bits 256 :trustfiles (/etc/ssl/certs/ca-certificates.crt) :crlfiles nil :keylist nil :verify-flags nil :verify-error nil :callbacks nil)
  Failed to download ‘gnu’ archive. [2 times]
  You can run the command ‘package-refresh-contents’ with M-x pa-r- RET
  Failed to download ‘gnu’ archive.

Updating with error message after removing the gnutls-algorithm-priority setting:

  For information about GNU Emacs and the GNU system, type C-h C-a.
  delete-backward-char: Text is read-only [4 times]
  Importing package-keyring.gpg...done
  Contacting host: elpa.gnu.org:443 [2 times]
  Failed to download ‘gnu’ archive.
  You can run the command ‘package-refresh-contents’ with M-x pa-r- RET
  Failed to download ‘gnu’ archive.

Updated with debugger info after running command toggle-debug-on-error and then running package-refresh-contents:

  Debugger entered--Lisp error: (wrong-type-argument stringp ((\, "https://elpa.gnu.org/packages/")))
    string-match("\`https?:" ((\, "https://elpa.gnu.org/packages/")) nil)
    package--download-one-archive(("gnu" (\, "https://elpa.gnu.org/packages/")) "archive-contents" nil)
    package--download-and-read-archives(nil)
    package-refresh-contents()
    funcall-interactively(package-refresh-contents)
    call-interactively(package-refresh-contents record nil)
    command-execute(package-refresh-contents record)
    execute-extended-command(nil "package-refresh-contents" "package-refr")
    funcall-interactively(execute-extended-command nil "package-refresh-contents" "package-refr")
    call-interactively(execute-extended-command nil nil)
    command-execute(execute-extended-command)


texts: Set Export scope to Subtree on In-Buffer level

texts: I have a large org file and I often export only subtrees from it.  It's useful for me to redefine Export scope to Subtree when calling Export dispatcher inside this buffer.  How could I do this?


texts:
The official style of the project I'm working on is to indent after template control statements. We're using jinja2 templates with altered open/closing tags too...

    {% for category in categories %}

...

    {% endfor %}

Some with if statements, elses, etc.

Is there a way to configure webmode to do this?


texts: Treat initial numbers as argument to functions in minor mode

texts: Is it possible to treat typed numbers similar to universal argument C-u 10 C-n, but make it so that there is no need to type C-u in a minor mode? So only 10 C-n would be needed to move 10 lines down and C-n to move 1 line down.


texts: rewrite relative or absolute path from inherited tramp ssh property with org-babel

texts:
I define a global remote session for all my sh block code with properties

:PROPERTIES
:HEADER-ARGS:bash: :dir /ssh:xxx@myvm:/home/xxx/
:END:

In my other bash blocks, I inherit this property, but after working folder was created, my code are executed in sub folder of /home/xxx

Here an example with creation of two folders in /home/xxx : todolist1 and todolist2

I finally found that noweb is a good path to follow :

* Example
:PROPERTIES:
:HEADER-ARGS:bash: :dir /ssh:xxx@myvm:/home/xxx/
:END:

#+NAME: createdir
#+BEGIN_SRC bash :var folder="" :exports none
if [ -n "${folder}" ] ; then
    if [ -d "${folder}" ]; then
        rm -Rf "${folder}"
    fi
    mkdir "${folder}"
fi
#+END_SRC

#+NAME: gotodir
#+BEGIN_SRC bash :var folder="" :exports none
if [ -n "${folder}" ] ; then
    cd "${folder}"
fi
#+END_SRC

#+BEGIN_SRC bash :var folder="todolist1" :noweb yes :exports both
<<createdir>>
#+END_SRC

#+BEGIN_SRC bash :var folder="todolist2" :noweb yes :exports both
<<createdir>>
#+END_SRC

// First action on todolist 1
#+NAME: addmytodolist1
#+BEGIN_SRC bash :var folder="todolist1" :noweb yes :exports both :results verbatim
<<gotodir>>
cat > todolist1.org <<EOF
#mytodolist
- [ ] item 1
- [X] item 2
EOF
#+END_SRC

// Second action on todolist 1
#+NAME: addmytodolist12
#+BEGIN_SRC bash :var folder="todolist1" :noweb yes :exports both :results verbatim
<<gotodir>>
cat >> todolist1.org <<EOF
- [ ] item 3
EOF
#+END_SRC

// First action on todolist 2
#+NAME: addmytodolist2
#+BEGIN_SRC bash :var folder="todolist2" :noweb yes :exports both :results verbatim
<<gotodir>>
cat > todolist2.org <<EOF
- [X] item 1
- [X] item 2
- [ ] item 3
- [X] item 4
EOF
#+END_SRC

To write less verbose and better maintainable code, i try without success :

to hide the <<gotodir>> instruction from export using :prologue <<gotodir>> => failed
I also try to directly expand dir: into header args, but that doesn't take in account the remote TRAMP ssh connexion : #BEGIN_SRC sh :var folder="todolist1" :dir (expand-file-name (org-sbe "gotodir"))
I suppose it exist some elisp code to get TRAMP ssh folder, and rewrite it/overwrite it by using new url {trampfolder}/todolist1 or {trampfolder}/todolist2 ?

There are probably better and more robust way to do that, I'm interested to know what org-mode/org-babel guru :) !


texts: Ways to get ECB Directories buffer to udpate?

texts:
I see from a few posts that there's no mechanism for ECB to magically auto-update it's directories buffer, but I would have thought that when using the ecb-create-source and ecb-delete-source functions via the context menu, that the directories tree would get updated (it takes care to save the file right away).

Am I missing something?


texts: How to change scheduled date on multiple items?

texts:
I use Org mode and would like to change the scheduled date  of multiple items, either on the main buffer or from the agenda. I tried selecting multiple headings into a region and hit C-c C-s, which prompts for a date, but has no effect on the selected headings. The documentation does not mention multiple headings.

Does Org Mode support this, or would I need custom code?


texts: A BASH completes .. to ../ when pressing tab, that is, it just adds a forward slash. Tiny as it might seem, I'm so used to this behaviour that I desperately miss it in eshell. Is there a way to add it?


texts: Error replacing %n escapes with nth %^{...} string in emacs org capture

texts:
I am trying to write a custom org-capture template, but I get an error if I try to use the %\N functionality to insert the N-th prompt. The relevant excerpt of my org-capture-templates variable is
("ao" "Other meeting" entry
 (file+headline "~/org/meeting.org" "Meetings")
 "* %^{meeting date}u Meeting with %^{meeting with}
   :PROPERTIES:
   :MEETWITH: %\\2
   :DESCRIPTION: %\\3
   :END:

   Created on %U
   Description: %^{description}

   %?" :jump-to-captured t :empty-lines 1)

When I try to capture, everything goes fine until I C-c C-c the note. Then, the new note fails to save due to the following error:

org-capture: Capture abort: Wrong type argument: stringp, nil

This error only occurs when I try to use the %\N functionality, not otherwise. I assume the issue must be somehow related to the relevant section of org-capture-fill-template, but I am unable to discern what could be causing this errant behaviour. That section of code is as follows (from org-capture.el).
    ;; Replace %n escapes with nth %^{...} string.
    (setq strings (nreverse strings))
    (save-excursion
      (while (re-search-forward "%\\\\\\([1-9][0-9]*\\)" nil t)
        (unless (org-capture-escaped-%)
          (replace-match
           (nth (1- (string-to-number (match-string 1))) strings)
           nil t))))

Note: I have org-roam and org-roam-bibtex installed. Could this have anything to do with it?


texts: How do I find text across many open buffers?

texts: Lets say I have 10 buffers open, and I want to find all occurrences of blah in all 10 buffers. How would I do this?


texts: How to distinguish a scroll from a change of buffer in a function called from ‘window-scroll-functions’?

texts:
I've written a function that recenters the point each time it makes a long jump and I added it to the hook window-scroll-functions. The length of the jump is determined by comparing the return value of (line-number-at-pos (window-end)) to that of (line-number-at-pos (window-end nil 'update)), where the former holds the line number at the window-end position before the jump, and the latter after the jump.
The problem is that window-scroll-functions runs also when I change the buffer displayed by the current window. In that case (line-number-at-pos (window-end)) returns the line number at the window-end position of the previous buffer, and I can't figure out which one it was because (ref.):

At the time of the call, the display-start position of the argument window is already set to its new value, and the buffer to be displayed in the window is set as the current buffer.

If the window-end of the previous buffer and the new one differ enough, my recentering function gets called even though it shouldn't.
How can I find out whether it was a buffer change that triggered window-scroll-functions?


texts:
I am working on several projects right now. I want a single instance of Emacs to handle them all. What I want is a tmux-like behavior wherein every 'window' (in the Emacs sense) corresponds to a projects which contains buffers of the files related to that project. There are several windows, with each corresponding to a project and I should be able to switch between them (something similar to C-b w)

Is this functionality already present in some form? I guess it'll be cool to have as the other options are either:

Have several instances of Emacs open.
Have all files of all projects in a single instance which makes switching buffers a pain.


texts: How to change line COUNT for for evil-scroll-up

texts:
How to change line COUNT with C-u or C-d for evil-scroll-up or evil-scroll-down?

From Spacemacs help:

C-u  (evil-scroll-up COUNT)
C-d  (evil-scroll-down COUNT)
If COUNT is not specified the function scrolls down ‘evil-scroll-count’, which is the last used count.
If the scroll count is zero the command scrolls half the screen.

I am using Emacs 26.1 with Evil Spacemacs 0.200.13 and Ivy on Linux.


texts: How to determine which program is running inside an emacs shell buffer?

texts:
I have an emacs shell buffer which may or may not be running a certain interactive program such as ftp or python.  I wish to write a lisp function which will interact with this program, but I would first like to make sure that said program is indeed running. My question is therefore:

  Is there a Lisp function designed to inquire which program, if any, is running inside a given shell buffer?

Such programs often set their own prompt, so I thought of using

(buffer-substring (car comint-last-prompt) (cdr comint-last-prompt))

to determine the current prompt, but prompts often get garbled, so I found this not to be the ideal solution.  Another attempt involved using

(shell-command-to-string "pgrep -fa MYPROGRAM")

but this would risk a false positive in case MYPROGRAM is running somewhere else in the system, other than under my shell buffer.


texts: trouble with linking from one section to another section using ox-hugo

texts:
I am trying to create a link from content/file.md to content/section/_index.md. I've tried using CUSTOM_ID, ID and header title in my org file. In the org file, the links work fine. However, after export, hugo unable to generate site. It throws an error when trying to process the link in content/file.md. The link shows up as {{<relref "_index" >}}. This is a problem obviously because it should be section/_index.

I hope my problem statement is clear. Any suggestions on how to resolve this problem?


texts:
Is it possible (using only emacs-lisp) to find out if the current frame is maximized?

Not fullscreen, but maximized.


texts: Cannot run a file-local after-save-hook with arguments

texts:
I have been trying to make auto-save compilation rules for my org files.
I have tested the following functions in the interpreter:

(defun async-shell-command-no-window (command)
  (interactive)
  (let ((display-buffer-alist
         (list
          (cons
           "\\*Async Shell Command\\*.*"
           (cons #'display-buffer-no-window nil)))))
    (async-shell-command
     command)))

(defun haozeke/org-pandoc-markdown (dir &optional pargs)
  "A wrapper to generate yaml metadata markdown files. Takes the output
  directory followed by pandoc arguments"
  (if (not (file-exists-p dir)) (make-directory dir))
  (async-shell-command-no-window
   (concat "pandoc -f org -t markdown -s " pargs " " (buffer-name) " -o "
           dir "/" (file-name-sans-extension (buffer-name)) ".md")))

(haozeke/org-pandoc-markdown "./")

Where the first function has been adapted from this question.

The error I get is:

run-hooks: Wrong number of arguments: (lambda (dir &optional pargs) "A wrapper to generate yaml metadata markdown files. Takes the output
  directory followed by pandoc arguments" (if (not (file-exists-p dir)) (make-directory dir)) (async-shell-command-no-window (concat "pandoc -f org -t markdown -s " pargs " " (buffer-name) " -o " dir ".md"))), 0

The local variable setup I have is:

# Local Variables:
# after-save-hook: haozeke/org-pandoc-markdown "test"
# End:


texts: How can I override initial-buffer-choice if I specify a filename at command line?

texts:
In my .emacs file I have the following line in custom-set-variables:

 '(initial-buffer-choice "~/Programming/C++/<some project I'm working on>")

This works great. However, I use emacs to edit lots of other files too. Before I inserted the above line in custom-set-variables, I could specify the file I intended to edit from the command line. For example, when I intended to edit a file called text_file.txt, I could type this command:

emacs text_file.txt

And emacs would startup with text_file.txt as the selected buffer. Now that I've specified initial-buffer-choice, regardless of what I say after emacs, emacs will always open the file specified in custom-set-variables, and not the file specified at command line. For example, the command

emacs text_file.txt

now opens ~/Programming/C++/<some project I'm working on> instead of text_file.txt.

How can I over ride initial-buffer-choice so when I do specify which file to open, that file will open?


texts: What is the equivalent of /sudo:root@localhost:/ in windows?

texts:
What is the easiest way to access files that require admin privilege in windows?
I could see similar questions here and here.  But I think this would be the right forum to find the best solution for this problem.


texts: Delete works differently for different users on the same machine (macOS)

texts:
I'm totally dumbfounded. I have two users on the same machine running macOS. Both of them have the same .emacs, same iTerm profile. However the "delete" key works correctly as backspace for on one of them, but doesn't on the other. I know I can use M-x normal-erase-is-backspace-mode to work around the issue, but it's very annoying. I don't really care whether it behaves one way or the other, as long as it's consistent. Any good suggestions on what might cause the discrepancy?

P.S. this only happens when I run emacs with -nw. In the normal X window mode the delete/backspace works for both users


texts:
the latest version of emacs embedded with xwidget browser

you can run xwidget-webkit-browse-url to use it

I try the command many times
  and install the gtk from homebrew on my MacBook

finally the error message appeared,
   which I still can't remove until now

Your Emacs was not compiled with xwidgets support


texts: Set RPC Python when using elpy with virtualenv

texts:
I'm having trouble getting my elpy setup to work smoothly.

My current config is:

Elpy Configuration

Virtualenv........:  (/home/jeff/Documents/Proj/myenv/bin/)
RPC Python........: 3.7.3 (/usr/bin/python3)
Interactive Python: python (/usr/bin/python)
Emacs.............: 26.1
Elpy..............: 1.28.0
Jedi..............: 0.15.1
Rope..............: 0.14.0
Autopep8..........: 1.4.4
Yapf..............: 0.28.0
Black.............: 19.10b0
Syntax checker....: flake8 (/usr/bin/flake8)

The python interactive interpreter (python) is not installed on the
current virtualenv (/home/jeff/Documents/Proj/myenv/bin/). The
system binary (/usr/bin/python) will be used instead.

[run] python3 -m pip install python

How do I get RPC Python set to use the interpreter in my virtual environment?


texts:
I'm getting the "no more undo" message all too often, even I made changes that should be there in the history. This is seriously breaking my workflow.

This is my .emacs

https://github.com/skrat/dots/blob/master/emacs/.emacs


texts: Disabling strange emacs comment highlighting

texts:
I have started programming scheme, and I noticed the scheme minor mode highlights comments in the most obnoxious way possible when using solarized dark (color-theme-solarized). This also occurs on elisp files. Its a super bright grey, and makes the contrast too much to handle. I suppose its because the solarized theme overwrote some color that would normally be used for this kind of thing.

Is there a way I can disable highlighting of these comments or correct the color? It's making the code unreadable, and Google is not helping. This seems to only occur on lisp-likes, such as scheme and elisp on my Arch Linux machine. On my mac, this does not occur.

Thanks!


texts:
I have the following problem with recentf. If I open a file from commandline like emacs myfile the file myfile doesn't appear in the list of recently opened files (I also checked directly the file .recentf). It doesn't matter if I change and save it or not.

Same problem if I kill emacs (kill $(pgrep emacs)). Even if the file was opened via emacs find-files.

If I open a file via find-files and close emacs properly it works also if I just visit the file without changing or saving anything.

Any ideas how to fix both issues?

To make sure that the problem is not an interference effect with other packages I reduced my .emacs file for test purposes to the follwing:

;; -*-Emacs-Lisp-*-
;; -*- coding:utf-8 -*-

(require 'package)

(package-initialize)

(require 'recentf)
(recentf-mode 1)

;; Usually I use it via helm
;; From http://emacs.stackexchange.com/questions/14282/replace-splash-screen-with-list-of-recentf
;; (require 'helm)
;; (require 'helm-config)

;; (if (< (length command-line-args) 2)
;; (setq initial-buffer-choice (car (helm-recentf)))
;; )

My emacs version is 24.4.1. The OS is ubuntu vivid. As commandline I use zsh (with urxvt).


texts: use-package can't load package at startup

texts:
When I start Emacs I get the error message

  Error (use-package): Cannot load counsel

But when I open init.el in a buffer and run eval-buffer everything works fine. What I'm doing wrong?

My Emacs config: https://git.sr.ht/~inquisitive/emacs-adjustments/tree/package/ivy/.emacs.d/init.el

;; Bootstrap straight.el
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

(use-package magit
  :bind ("C-x g" . magit-status))

(use-package counsel
  :config
  (counsel-mode 1))

;; Display line numbers in programming major modes
(add-hook 'prog-mode-hook 'display-line-numbers-mode)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(inhibit-startup-screen t)
 '(menu-bar-mode nil)
 '(scroll-bar-mode nil)
 '(straight-use-package-by-default t)
 '(tool-bar-mode nil))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :background "#fcfcfc" :foreground "#232627" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 143 :width normal :foundry "FSD " :family "PragmataPro Mono Liga")))))


texts:
I have these settings for dired

(setq-default dired-omit-files-p t)
(setq dired-omit-files (concat dired-omit-files "\\|^\\..+$"))

I was wondering if it is possible to hide/disable the message Omitted N lines.

Whenever I have a Dired buffer opened, the message appears repeatedly. For example: it appears when I am trying to switch to another
buffer and when I use smex.

It is just annoying having the minibuffer cluttered with that message when I am
trying to do something not strictly related to Dired.


texts: How to access (remote) MS Windows shared directory or files in Emacs25 running on Ubuntu 18.04

texts:
My question has already been asked here. However, the solution provided there didn't work for me.

Through Ubuntu "Files" I am able to access the samba share with smb://DOMAIN;USER@IP_ADDRESS/SHARED_DIR syntax. The "Files" asks me for a password and I am able to list all the directories inside the share.

To make the same in Emacs, I first installed smbclient using sudo apt install smbclient.

Next I tried to open the shared directory through C-x C-f /smb:USER%DOMAIN@IP_ADDRESS:/SHARED_DIR/. I am using Swiper in Emacs. As soon as I enter the colon after the IP_ADDRESS Emacs asks me for a password. After I enter the password, it continues to show me text "[No match]" ahead of my text entry even if I enter /SHARED_DIR/ RET. Since nothing is matching, it asks me to confirm the entered file and instead creates an empty file in the local directory where earlier file was opened.

Through the command line, I tried to see whether smbclient is able to connect. I get something like below output for the list command. The output lists correct shares (including my SHARED_DIR) but I also see some errors towards the end which I didn't understand.

$ smbclient --list=IP_ADDRESS --user=amit_tendulkar --workgroup=IP_ADDRESS
WARNING: The "syslog" option is deprecated
Enter IP_ADDRESS\amit_tendulkar's password:

        Sharename       Type      Comment
        ---------       ----      -------
        ADMIN$          Disk      Remote Admin
        C$              Disk      Default share
        D$              Disk      Default share
        IPC$            IPC       Remote IPC
        SHARED_DIR      Disk
Reconnecting with SMB1 for workgroup listing.
Connection to IP_ADDRESS failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Failed to connect with SMB1 -- no workgroup available

I am giving domain name same as IP_ADDRESS as the user is local to the Windows machine (which works through Ubuntu "Files").

Any pointers?

EDIT: I found out that the issue was with the sequence of keystrokes. Since my user on the Windows host was local one, the IP_ADDRESS works as a domain name (it is better to use hostname though). The sequence of commands are as follows (this is assuming swiper),

C-x C-f //

The above will take you to root dir as per swiper.
Now putting all keystrokes ignoring auto-completion for the sake of clarity.

smb:USERNAME%IP_ADDRESS@IP_ADDRESS:

At this point I am prompted for a password. After entering the password, put in below text.
Swiper will display [No Match] till you press TAB.
Note that I am using the share D$ and have to escape $ by putting $$.

/D$$/ TAB

At this point you will start seeing directories and files in the proposed list.
Select/navigate to appropriate directory or file.
While selecting a file, you will be prompted for a password again.
After entering the password the file should get loaded in your buffer now.


texts: "Read error Is a directory /home/ngaroe/.emacs-mail-crash-box"

texts:
The version of emacs I'm using is 27.1-r4 (Gentoo description).
My .gnus file is
(setq
    gnus-select-method '(nnmaildir ".maildir" (directory "~/.nnmaildir"))
    mail-sources '((maildir :path "~/.nnmaildir/" :subdirs ("cur" "new")))
;;; mail-source-delete-incoming t
 )
(setq gnus-secondary-select-methods nil)
(setq gnus-message-archive-group "nnmaildir+.maildir:archive")

(setq gnus-inhibit-user-auto-expire t)

The .maildir directory is ~/.nnmaildir/.maildir/
On running emacs -f gnus I get
Reading incoming mail from maildir...
Processing mail from ~/.emacs-mail-crash-box...
Mail source (maildir :path ~/.nnmaildir/ :subdirs (cur new)) failed: (file-error Read error Is a directory /home/ngaroe/.emacs-mail-crash-box)

and .emacs-mail-crash-box is
ngaroe@lenovo ~ $ l .emacs-mail-crash-box/
total 24
4 drwx------  5 ngaroe ngaroe 4096 Dec  1  2019 ./
4 drwx------ 55 ngaroe ngaroe 4096 Apr 11 14:34 ../
4 drwx------  2 ngaroe ngaroe 4096 Dec  1  2019 cur/
4 -rw-------  1 ngaroe ngaroe   17 Dec  1  2019 .mu-prop
4 drwx------  2 ngaroe ngaroe 4096 Dec  1  2019 new/
4 drwx------  2 ngaroe ngaroe 4096 Dec  1  2019 tmp/

There was no .emacs-mail-crash-box before running emacs/gnus so it seems to have been an own goal...
What on earth is going on?


texts:
I use the linum-relative package to get line numbers relative to the cursor in the margin. The reason this is useful to me is I drive emacs with speech recognition, and the speech recognizer has a specialized more accurate mode for numbers than it does for general speech, so I try to navigate using commands based on numbers where possible. So with relative line numbers I can say "up 5" or "down 29" and know exactly where I will end up. Relative numbers are better than absolute because they are smaller and easier to say; if I'm in the middle of a big file and I want to go down 3 lines I don't want to say "goto line three thousand four hundred and twenty six." I just want to say, "down 3".

Now I'm trying to give helm a spin and I noticed that when I use helm-M-x the relative line numbers don't work. They appear, but always consider the first line of the buffer to be 0 regardless of where the cursor is. That is until you scroll down past the end of the window, then they move again but stay still after that until you go outside the window boundary again.

Is there anyway to get relative line numbers working with helm-M-x? I'm guessing that helm is listening directly to input events to drive the menu rather than really moving the cursor, but I haven't dug into the code.


texts: Those sounds all the way drive me crazy, but it is uncomfortable to switch off system sounds at all because I need them in other places same time. I didn't find any settings where I could manage the sounds.


texts: LaTeX preview with C-c C-x C-l looks very tiny on my HiDPI screen. What can I do to solve this?


texts:
Is there a way to define a custom in-buffer setting that I can use in my own elisp functions? For example, I want to be able to have this at the top of my script

#+HTML_OUTPUT_FILE: Some text

Then be able to get its value in my elisp code.


texts:
If I'm editing certain filetypes then sometimes when I hit return at the end of a line the cursor will move to the next line and the previous line will suddenly be heavily indented.

This behavior seems to happen in a few different filetypes under various conditions but I can reliably reproduce this in an .el file on a comment line.

For example, with the cursor indicated by _, if I'm on a line that reads

; word_

and then I press return I get the following.

                            ; word
_

What's going on? I commented out all tabbing related settings from my configuration files and I still get this behavior.


texts: How to skip some buffers when use prev-buffer/next-buffer?

texts:
windows 10, emacs 26.1

Suppose I open 10 buffers.
If I can use prev-buffer (C-x left) / next-buffer (C-x right) to go to prev/next buffers. It's very comfortable.

But I need when I do this to skip some buffers. E.g. buffers whose names start with helm-xxx.

Is it possible?


texts: How to refer to Emacs registers by name?

texts:
Emacs registers are useful but I find remembering the contents of them difficult. Figuring out which register I stored that particular macro in is a pain.

Is there a package that allows registers to be referred to by a meaningful name (rather than a single key)? If not, does anyone know of a different solution?


texts:
I switched from sublime text to emacs a while back, and while I feel emacs is much nicer, its autocompletion is really lacking in responsiveness.
I went and customized company so that it would try to complete after two characters had been typed and so the delay was only 0.1s, but it doesn't show up half the time and when it does, it's really not useful. Has anyone else had success in getting company to be as responsive as sublime/visual studio/eclipse? Any other IDE really.


texts: pipe result of elisp function to a shell command

texts:
I wanna pipe the output of an elisp function (emacs-version) to a shell command (xclip). How can I do this?
I accept vanilla emacs and evil solutions.


texts:
When I do merge preview m p I see a log of other branch changes for each affected file. Changes marked like this:

@@ -20,6 + 22,7 @@
-    <change>
+    <change>

To merge only  a particular file I can do from command line:

git checkout another_branch -- ./path/to/file

(btw, is there a way to do it in Magit?)

BUT, suppose, I want to merge only specific changes from the log, and not the entire file. Is there any way to do that in magit, or git cli? Ideally I'd love to check the changes that I want to merge manually.


texts: Elisp: Resize displayed images programmatically

texts:
I am writing a minor mode which involves fetching some pictures from url and displaying them, but some of them are way too big to fit an emacs window.

How could I manage to limit the visual size of the displayed picture ?

For now I am using something like

(insert-image (create-image pic nil t))

for display, where pic is a jpeg image raw data as a string.

I spent a lot of time browsing google and couldn't find a tutorial, docs or a code example that would help me rescaling my images.
The GNU Emacs Lisp reference is quite obscure and confusing and doesn't contain much examples.


texts: Using a predicate function in display-buffer-alist

texts:
I want to add a rule to display-buffer-alist, that splits the frame to the right when opening a .pdf file if and only if there is a corresponding .tex file in the same folder.
According to the documentation of display-buffer-alist, I can specify a predicate function which takes a buffer name and an action. I can't get it to work however, and I don't understand what the action argument of the predicate function is supposed to do.
My code looks like this:
    (setq display-buffer-alist
          `((#'cst/latex-pdf-p . ((display-buffer-reuse-window display-buffer-in-side-window)
                                  (side . right)
                                  (slot . 1)
                                  (window-width . 0.33)
                                  (reusable-frames . nil)))))

    (defun cst/latex-pdf-p (buffer-name action)
      "Determine if there is a corresponding .tex file in the current folder."
      (when (string= "pdf" (file-name-extension buffer-name))
        (file-exists-p (concat (file-name-base buffer-name) ".tex"))))

The predicate function seems to work as expected when I evaluate it from a buffer split.pdf with split.tex in the same folder it returns t, on other pdfs it returns nil. When using the regexp \\.pdf$ the split works, but on all pdfs. Using the rule with the predicate function it does not work on any pdf.
I feel like I  misunderstand how the predicate function should work.


texts: How to toggle multi-line comment blocks?

texts:
Is it possible to configure multi-line comments to comment/uncomment selected text?

For example C/C++'s preprocessor could be toggled like this.

eg:

Before:

    // a comment
    Some(code); /* some comment */

After:

#if 0
    // a comment
    Some(code); /* some comment */
#endif

Since C/C++ don't support nested comments, I find this preferable behavior to quickly disable chunks of code.


texts: How supress Dired confirmation of large file for specific extensions?

texts:
I started to use Dired. The movie files will be opened by another external application (VLC) with the help of the package openwith.
So I would like to supress the confirmation File foobar.avi is too large, really open? (y or n) for movie files.
When exploring this feature, I found the variable large-file-warning-thresold, the docstring is:
The variable is large-file-warning-threshold. Documentation:

large-file-warning-threshold is a variable defined in `files.el'.
Its value is 10000000

Documentation:
Maximum size of file above which a confirmation is requested.
When nil, never request confirmation.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 22.1 of Emacs.

So I would like to disable this thresold for only specific extensions like .mp4 or .mkv, but don't change it for another extensions.
By reading the source, look at the function to open files: C-h k C-x C-f (or C-h f find-file RET). Click on files.el to browse the source file (you must have the Lisp sources installed). Don't read the code — it's pretty big — but search for parts of the message in that file. You'll find
(defun abort-if-file-too-large (size op-type filename)
  "If file SIZE larger than `large-file-warning-threshold', allow user to abort.
OP-TYPE specifies the file operation being performed (for message to user)."
  (when (and large-file-warning-threshold size
             (> size large-file-warning-threshold)
             (not (y-or-n-p
                   (format "File %s is large (%dMB), really %s? "
                           (file-name-nondirectory filename)
                           (/ size 1048576) op-type))))
    (error "Aborted")))

The message is only displayed when some conditions are met. The first condition is large-file-warning-threshold (interpreted as a boolean), i.e. large-file-warning-threshold must be non-nil. So you can disable the message by setting that variable to nil. (You can confirm that it's a global variable by looking at its definition in the same file — it's a customizable item, and the documentation explains how it's used if you aren't familiar enough with Lisp and only figured out that the variable mattered in some way.)
So I would add the condition for .mp4 and .mkv4 files.
Any idea how I could achieve that, without fiddling with the source code for Dired? I could use defadvice, but it's currently unclear to me how I could apply extra conditional for confirmation messages.


texts: How to assign ",p" to org-agenda-priority?

texts:
I tried

(spacemacs/set-leader-keys-for-major-mode 'org-agenda ",p" 'org-agenda-priority)

I don't see this reflected in the key map.  What is the correct way?

This is on Spacemacs 0.300.0, rev. ccd6c48d4.

Thank you,


texts:
I make a lot of notes in org-mode including emacs and elisp notes.
If I put the following in an org file I would like the find-grep-dired to be highlighted similar to how it is in a Help buffer. It doesn't necessarily have to provide a link like Help does but that would be an added bonus.

`find-grep-dired'   find all files containing a grep match

Is there an easy way to do that?


texts: I want the color-theme to highlight the text in the buffers but not change the colors in the menu bar

texts:
I loaded a color-theme (manoj-dark) to highlight text in the buffers but it also changed the color of the menu bar. Now the menu bar icons are setting in a black background and the title bar of the window is also black. The slider bar did not change color nor did the mode line:  I want to colorize the text in the buffers without changing the colors of the menu bar.  How can I do that?

GNU Emacs 26.1
macOS 10.13.6


texts: How can I save files in Emacs on OSX and preserve the file creation date?

texts:
Let's say I create a file called foo.txt in emacs. The time is 12:00. It's currently empty.

At 12:10, I use emacs to add text to the file. I save it. The new timestamp given with getfileinfo is

created: 06/11/2020 12:10:00
modified: 06/11/2020 12:10:00

Obviously this isn't correct, and the created time should be 12:00 and the modified time should be 12:10. How can this problem be solved? As mentioned in the title I'm using a mac, specifically Mojave version 10.14, and emacs version 26.3.


texts: How to automate user-testing with elisp?

texts:
Is it possible to automate testing user input?

An example of this could be multiple editing operations, undo, saving, reverting the buffer etc. Then checking the buffer contents is what the test expects.

The user input could be keyboard shortcuts or (preferably) commands run as if they were bound to keys.

Hooks should run as would typically happen when running interactive commands, so the last-command, variable should be set, post-command-hook should run. etc.

To make this question concrete, is it possible to type 5 lines, undo 4, redo 2 times, then ensure 3 of the 5 lines were entered?


texts: How to act on rectangles beyond the end-of-line?

texts:
Here's what Vim's documentation has to say about it:

  Virtual editing means that the cursor can be positioned where there is
          no actual character.  This can be halfway into a tab or beyond the end
          of the line.  Useful for selecting a rectangle in Visual mode and
          editing a table.

I'd preferably like to see this implemented as a minor mode or a built in setting.


texts: Is there a fast way to get a docview link to a specific page in a PDF document?

texts:
When I press "w" in eww-mode i get the link to the opened Homepage. Now I can yank this link very fast in an Org Mode file.

How can I get such a link to a specific page in an open PDF document in the docview-mode?

I want to find a fast way to create a docview-link to a specific page in Org Mode.


texts:
I'd like to change the color of unchecked checkboxes in org-mode. To be exact, I want them to be displayed in the color of TODO keywords.

So I've tried to tackle this using custom-set-faces and :inherit, but this didn't have any effect:

(custom-set-faces '(org-checkbox ((t (:inherit org-todo)))))

Any idea how to do this properly?


texts: Running diff in Magit, filtered to only some specific files

texts:
I’m basically trying to run this command, but in Magit:

git diff master..17 -- "**/*.scala"

… i.e. to view changes in all *.scala files between ref/heads/master and ref/heads/17.

I’ve tried setting =f to this glob, but that doesn’t help.

(Same question applies to git log).

Thank you!


texts: Help with regex in re-builder : lines without "|" nor ";" at the beginning

texts:
I am starting regex with Emacs and cannot get the right regex.
I would like to match the line 1 and 4 in the image below, where variable-pitch is "active" and do not match 2 and 3 where is "inactive"
so I am basically trying to say :
line with 'variable-pitch' not containing with ";" or "|"

Following this post, I switched re-builder to string mode.
Edit : Following the different comments

here is the text if you want to try
i changed the the screenshot with re-builder actually set to string


texts:
For some reason, evaluating code blocks stopped working for me.

Example from the manual:

 #+BEGIN_SRC emacs-lisp
   (defun org-xor (a b)
      "Exclusive or."
      (if a (not b) b))
 #+END_SRC

Gives now Wrong type argument: integer-or-marker-p, "(ref:%s)". The same happens also for other languages.

Does somebody know what is going on?

I have Org mode version 9.0.1. I believe the problems started when I upgraded (but can't be sure).


texts: Magit - How to update a branch without using checkout?

texts:
While working on a project, it is necessary to pull some branches from remote and merge into current branch.

To update another branch, we have to

Stash local changes on current branch
Checkout to required branch (say foo)
Pull changes
Switch back to previous branch
Pop stash

All these steps can be done with single command on terminal using

git fetch origin foo:foo

How to do the same with magit in single step?


texts: How to detect modified buffer in the mode-line, skipping special buffers?

texts:
I'm trying to have my mode-line to display a "(modified)" string instead of the * mark. To do that, I make a test with buffer-modified-p but this seems to be always true for "special" buffers as well (such as for example completion list or org agenda). What would be the proper way to do the test (i.e. files that have been modified by me) ? Here is the relevant part of my code: '(:eval (if (buffer-modified-p) "%b (modified)" "%b"))

Solution:

'(:eval (if (and (or buffer-file-name
                    (string= (buffer-name) "*scracth*"))
                 (buffer-modified-p))
            "%b (modified)" "%b"))


texts:
Emacs 26.1,
Dired+

Open some folder in dired mode.

Split buffer by M-4 (split-window-vertically)

Now I want to open src folder but only in TOP WINDOW. The bottom window must not be change. I press Enter in top window. But folder src open in BOTH windows - top and bottom.


texts: GUI Emacs opens new session of firefox with strange border

texts:
I am using emacs27 on Elementary OS.
I had to tweak Exec=/usr/bin/env XLIB_SKIP_ARGB_VISUALS=1 emacs27 %F in .desktop file to be able to run it in GUI mode.
When I am in org mode and try to open a link in GUI Emacs,
it opens Firefox with very wide black borders around it and I am logged out of all services.
When I do the same in terminal emacs -nw, the link normally opens in my system firefox without strange borders and I am normally logged in to all services.
How can I make GUI Emacs open "regular" firefox instance?


texts: Emacs desktop-save-mode - only save desktop when previous desktop was fully restored

texts:
I have the following in my .emacs:

(desktop-save-mode 1)
(setq desktop-restore-eager 10)
(setq desktop-save t)

Often I have a lot of buffers open (100 or so), then this really helps - as emacs is loading buffers only when not beeing busy with something else.

Now, sometimes the following happens: I close emacs before I want to shut down my laptop. Then I realize - I need to edit one more file quickly - so I open emacs again, perform the editing, and then close it. If  this happens within a short amount of time, then desktop-save-mode was not able to restore all previously saved buffers. In this case, when I now close emacs again, only the buffers that were restored are saved and the state before the initial shutdown is lost.

Is there a way to make the desktop-save only happening, if the previously saved desktop has been completely restored?


texts: How to make local function binding for closure?

texts:
For example, when defining the natural number sequence stream, I can use

;; -*- lexical-binding: t; -*-

(defun nats (n)
  (cons n (lambda () (nats (1+ n)))))

(nats 0)
     => (0 closure ((n . 0) t) nil (nats (1+ n)))

But I want to call simply (nats) since the natural numbers begins with 0, and I don't want define a global helper function for nats since it is useless everywhere else. I tried the following, but it doesn't work.

;; -*- lexical-binding: t; -*-

(defalias 'nats
  (flet ((f (n) (cons n (lambda () (f (1+ n))))))
    (lambda () (f 0))))

(nats)
error--> nats: Symbol's function definition is void: f

It looks like f is not in the closure's environment. I also tried some other options. cl-letf produces the same result. cl-flet doesn't allow recursive local function definition.


texts: Why set-window-dedicated-p doesn't work with certain buffers?

texts:
I use emacs for latex,  with pdf-tools.  My layout is always  a window with PDFView buffer on the right, any other buffer on the left.

I always want the right window that cannot be touched by anything, so I have a command anchor-buffer

;; custom function 'anchor-buffer'
(defun anchor-buffer ()
   "Anchor the current buffer to the current window."
   (interactive)
   (set-window-dedicated-p (selected-window) t))

that doesn't allow to modify a window.  Consider the following case

I have two windows (vertical split):
Left window:   tex source file,
Right window:  pdf file, pdf-view-mode (using pdf-tools)
I select the pdf buffer (on the right), and I do M-x anchor-buffer. According to the function above this should "glue" the buffer in the right window. At least my anchor-buffer function works like this in all situations I tried.
Now suppose I want to search for a reference using RefTex on the tex source (left window), and I do C-c ). A selection buffer opens in the right window which replaces the pdf viewer.

The latter should not happen because I invoked set-window-dedicated-p on right window.

Any idea on how to solve this?


texts: What does z originate in C-x z (z no relation with repeat literally

texts:
In contract to vim's arbitrary behaviors in choosing keys,
emacs's key binding performs semantically,

C-x  (C for commands, x for execute)
M-x  (M for meta commands or named command, invoke a command by its original name)
C-c  (c for create)
C-p  (previous)
C-n (next)

Even the arcane bindings:
C-v (vertical)
M-v (m for meta(above beyond) so M-v is move vertically above and thus illustrate why C-v  moving down.

When it comes to C-x z which evaluate repeat,

What's z here and it relation with repeat?

P.S. Why dig it

  We now come to the decisive step of mathematical abstraction: we
  forget about what the symbols stand for. ...[The mathematician] need
  not be idle; there are many operations which he may carry out with
  these symbols, without ever having to look at the things they stand
  for.

  Hermann Weyl, The Mathematical Way of Thinking


texts: Do changes made inside a hook persist after the hook has finished evaluation?

texts: Let's say I am setting a variable to a value inside a hook. I'm hooking the hook to the minibuffer-setup-hook so that it runs whenever the minibuffer opens. Will the changes made by the hook persist after I close the minibuffer? Or will they revert back to their original state?


texts: What is the point of quote with single argument and comma? (quote ,arg)

texts:
(quote x) makes x not be evaluated, but adding a , in front of x within quote makes it evaluated. What is then the point of using quote with a single argument with a comma in front of it, like so: (quote ,x)?

Motivated by line 59 from annoying arrows:

(put (quote ,cmd) 'aa--alts ,alternatives)

Why isn't (put cmd 'aa-alts ,alternatives) equally good?


texts:
I try to debug my pytest-cases like this:

import pytest

def test_something()
    ...
    ...
    pytest.set_trace()

Then, i execute the tests by running elpy-test. The test starts to
run and stops at pytest.set_trace() - unfortunately the
compilation buffer is non-interactive and I'm stuck with a
debugger that I can't use...

What's the right way to run tests in the debugger, using emacs?


texts: How to use a separate window for compilation output?

texts:
When building, a split view is opened for the output.

It's possible to close this window, open a new window and set the buffer to the build output.

However when building again, the other window isn't used.
Instead a new split is created in the same window the source code is in.

Is there some way to use any existing compiler output windows instead of creating new splits?


texts: Strange behavior with .txt files in Doom Emacs

texts:
In Doom Emacs, I have (add-hook 'text-mode-hook 'visual-line-mode t) in my config.el file.

Files with a .txt extension act strangely, though. When the file is first opened, visual-line-mode is respected and the text is displayed correctly. But as soon as I add a word to a line, Emacs inserts a bunch of hard linebreaks at around the 80-column mark. I can rejoin the pieces of the line with J (Doom uses vim bindings) and visual-line-mode is once again followed. But as soon as I start typing again, the hard linebreaks are added again.

Mysteriously, this doesn't happen in org files, which display and behave correctly from the get-go.

My work-around has been to remove the .txt extension from text files and hit SPC t w to toggle visual-line-mode on when I open them. Everything goes swimmingly after that.

This is not optimal, though. visual-line-mode already works just fine with org files. I just need to get it to treat files with the .txt extension the same way.


texts:
I'm using doom emacs and magit, and when I open a buffer with git conflicts, smerge displays them nicely. However, in order to highlight differences on a per-word basis (really practical when reading a LaTeX document in which a single letter was changed), I need to manually run smerge-refine bound to C-c ^ R. Is there a way to automatically refine my buffer without manually running this command?
Thanks!


texts: Context-aware username (e.g., git username instead of login name) in time-stamp

texts:
I am a total emacs/elisp newbie and I can't figure out how to do this.

I have time-stamp-active t with a pretty standard format: time-stamp-format "Last modified %Y-%02m-%02d %02H:%02M:%02S MyUser").

I have different git repos where I use other nicknames.

How can I write a function which checks if the file-in-buffer belongs to a git repository, if yes, substitute 'MyUser' with the local git user name, and if not revert to the default?
I googled around and I did not find anything useful to me...


texts:
Although Emacs (24.3.93.1) runs fine if launched from the Finder, if the terminal version is launched:

/Applications/Emacs.app/Contents/MacOS/Emacs -nw

Emacs crashes with:

Fatal error 11: Segmentation fault[1]    51512 abort      /Applications/Emacs.app/Contents/MacOS/Emacs -nw.

It seems the issue is caused by a single line in init.el,

(set-face-attribute 'default nil :font  "Menlo-16")

If that line is commented out, the terminal version of Emacs will start fine too.

To pinpoint the cause of the crash took me several hours (diminishing my init.el half by half).

I am aware that in any case Emacs will inherit whatever font and font size is specified in the terminal app (basically, that line is not meaningful in the cli.)

Generally speaking, is there a better way to debug a crashing Emacs? Perhaps using some kind of cli debugger that would print a more descriptive message?
Why is that line crashing Emacs via cli, but not if launched from the Finder?


texts: midnight-mode add-to-list Format specifier doesn't match argument type

texts:
I've been trying to get midnight-mode to add to the following list. I have a feeling it has to do with an elisp error in my config I'm not seeing. It works fine with setq, but with add-to-list I get a type error:

clean-buffer-list: Format specifier doesn’t match argument type

(add-to-list 'clean-buffer-list-kill-regexps
             '("^magit"
               "\.log$"))

I tried many variants of this with single quotes around the inside like in the docs \'^magit\'" I no longer get the error, but I also don't get a match. If I use just one item not in a list, it also works, but I want to add several things here.

My Final Solution

(setq clean-buffer-list-kill-regexps (nconc clean-buffer-list-kill-regexps
       '(
         "\\`magit"
         "\\.log\\'"
         )))

Corrected the wiki error, for further information see:
https://www.emacswiki.org/emacs/CleanBufferList


texts:
I use the following code for including dired omit mode:

(require 'dired-x)
(setq dired-omit-files "^\\...+$")
(add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))
;(dired-omit-mode 1)

When I turn on dired, by (C-x d), text files ending with ~ are visible. I can hide them by hitting M-x dired-omit-mode. However I would like that dired opens directly into omit mode. I try to achieve this by uncommenting the fourth line, (dired-omit-mode 1), but I get the error message:

Wrong type argument: stringp, nil

What is wrong with my forth code line?

How to start dired in omit mode?


texts:
I use DropBox to share my .emacs and .emacs.d with the various machines I use.  I setup helm using emacs on my mac but now I'm having issues when opening emacs on my Linux box:

Warning (emacs): Unable to activate package `helm'.
Required package `emacs-24' is unavailable
Warning (emacs): Unable to activate package `helm'.
Required package `emacs-24' is unavailable
Warning (initialization): An error occurred while loading `/home/gibson/.emacs':

File error: Cannot open load file, helm

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs
with the `--debug-init' option to view a complete error backtrace.
Warning (emacs): Unable to activate package `helm'.
Required package `emacs-24' is unavailable

I also get "Package 'emacs-24' is unavailable" when I try to M-x package-install helm


texts: How to prevent flycheck from treating my init.el as a package file?

texts:
If flycheck-mode is enabled for my init.el, I got the following kinds of errors:

The first line should be of the form: ";;; package --- Summary" (emacs-lisp-checkdoc)
...
The footer should be: (provide 'init)\n;;; init.el ends here (emacs-lisp-checkdoc)

How can I stop flycheck from treating my init.el as a package?

EDIT

I tried to following minimal start up file:

;; flycheck-mode
(require 'flycheck)
(global-flycheck-mode)

(setq-default flycheck-disabled-checker '(emacs-lisp-checkdoc))

Only flycheck and its dependencies are enabled. emacs-lisp-checkdoc is in the disabled checker list but flycheck still lists errors:

0     warning         The first line should be of the form: ";;; package --- Summary" (emacs-lisp-checkdoc)
0     warning         You should have a section marked ";;; Commentary:" (emacs-lisp-checkdoc)
2   1 error           Cannot open load file: no such file or directory, flycheck (emacs-lisp)
3     warning         You should have a section marked ";;; Code:" (emacs-lisp-checkdoc)
5     warning         The footer should be: (provide 'test)\n;;; test.el ends here (emacs-lisp-checkdoc)

I'm using Emacs 24.5.1 and the latest flycheck in the git repository (26snapshot).


texts: How to track down where Emacs message " is undefined" comes from?

texts:
I am using Emacs 25.5 and now am getting the message: "<Scroll_Lock> is undefined" appearing regularly in the Messages buffer.  If I turn on debug-on-error, it doesn't stop on it and show me where it is coming from.  I suspect it is related to one of the issues preventing me from upgrading to Emacs 27.1 (which is scroll-lock mode keeps getting turned on, which is a feature I don't want).  But I don't know what is triggering it or how to even grep for it.  It's not in any of my personal .el files.
By the way this Lenovo Flex 5 doesn't even have a key labeled scroll lock.  Perhaps it is a feature of the touchpad.


texts:
I want to match a certain string (not even a regex!) at point. re-search-forward skips characters after the point.

With char-after it is possible to build a framework for matching a string at point. I hope there is an idiomatic way to match a string at point.

UPDATE alternatively I can search-forward and if:

old point - new point != string length

I miss match...

Or set bound to string length:

(search-forward str (+ (point) (length str)) nil)

Pity that search-forward moves pointer...


texts: How to use an ispell dictionary in company mode?

texts:
I am writing in LaTeX at the moment and I want to use company-mode for word completion. I found this solution: https://emacs.stackexchange.com/a/18522.

I was thinking about using the ispell dictionary instead, then I can also switch to another language for other documents.

I tried the code below, but when trying with company-complete I just get No completion found with almost any word.

(require 'ispell)
(setq ispell-dictionary "en_US")

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(add-to-list 'company-backends 'company-ispell)
(setq company-ispell-dictionary ispell-dictionary)

Does company-ispell only work with plain txt dictionaries?


texts: Org-mode source blocks are not fontified same as the corresponding language

texts:
i am using Zerodark theme and in my org files I noticed that source blocks (emacs-lisp) are not fontified same as when opening an actual lisp file.

I already have this setting:

  (setq  org-src-fontify-natively  t)

What could I be doing wrong?


texts: Is there a way to have a column of a table not export, specifically in latex? I want to have an extra column for personal notes but when I export I don't want the table there.


texts: Dired+ key binding issues in terminal emacs

texts:
Using the Dired+ library, and running Emacs in a terminal,
all arrow keys in dired buffers invoke M-O (which is bound to diredp-chown-this-file) instead of correct <left> <right> <up> <down> events.

Non-dired buffer types work as expected.

How to solve it?


texts:
My buffer has one line as,

i am sitting on an overlay

Now when i do, M-x some-function-to-hide, i like to hide the text from display, and show three dots as,

...

I am looking forward to have a "hello world" program to understand overlays.


texts: eval-after-load and define-key of raise-sexp results in an error of "Unbalanced parenthesis"

texts:
(eval-after-load 'lisp-mode
  (define-key emacs-lisp-mode-map (kbd "C-c r") 'raise-sexp))

When above lisp is evaluated, it shows following error message.

up-list: Scan error: "Unbalanced parentheses", 183, 1

What's strange to me is that following lisp is evaluated without any error:

(eval-after-load 'lisp-mode
  (define-key emacs-lisp-mode-map (kbd "C-c r") 'forward-sexp))

Could someone help me figure out what's going on here?


texts: why do I need to use ctrl-G twice to quit a minibuffer prompt?

texts:
Sometime recently emacs started making me hit C-g twice to quit a minibuffer prompt and I can't figure out how or why it's doing this.
What happens is I start a minibuffer command -- say, C-x C-f -- and then hit C-g to quit. Emacs then appends "[Quit] to the end of the minibuffer prompt, and doing C-g quits as expected.
It's the [Quit] that strikes me. I think that's related to some package I tried, but I don't see anything in my configuration.
I'm using emacs 27.1 on Windows.
There are several seemingly-related questions to this --

Why do some commands terminate when leaving the minibuffer (isearch) while others don't (find-file)?
C-g has stopped breaking out of commands like `C-x C-f` and `M-x` in graphical emacs-25
Need double c-g to quit from a minibuffer

...but they seem to be about Linux, or GTK, or something else.
What package or configuration might cause this behavior?


texts: Prevent hooks from parent mode in derived mode

texts:
I have:

(add-hook 'text-mode-hook 'turn-on-auto-fill)

but in lisp/nxml/nxml-mode.el:

(define-derived-mode nxml-mode text-mode "nXML"

All XML files is opened with auto-fill-mode. That is inconvenient because XML file under source control and shouldn't drastically change on edits.

How can I disable auto-fill for nxml? Should I remove:

(add-hook 'text-mode-hook 'turn-on-auto-fill)

or add some workaround for nxml?


texts:
I have found that the smart-quotes option of org-mode does not export properly the quotes when they are nested (single quotes inside double quotes), but only when they coincide at the start or the end of the quote.

Maybe the problem will be clearer with an example:

#+TITLE: Smart quotes example
#+OPTIONS: toc:nil ':t
#+LANGUAGE: en
#+LATEX_CLASS: book
She said to me: "Rick screamed, 'let's go together'"

This gets exported to TeX as:

She said to me: ``Rick screamed, `let's go together'''

Which gets rendered as PDF as:

The order of the closing quotes gets reversed, it first closes the outside double quotes and then the nested single quote.

I have tried leaving a space between them, but that is arguably worse

Org:

She said to me: "Rick screamed, 'let's go together' "

TeX:

She said to me: ``Rick screamed, `let's go together' "

PDF:

In this case, the internal single quotes are rendered correctly, but the closing quote is not converted into its "smart" version.

If the nested quotes are in such a way that there are other characters between the quotes, that is they are not together at the start or the end of the quote, they get rendered correctly.


texts: Force elpy to work only with .py extension files

texts:
Elpy works in every buffer automaticly, however I wan it to work only with python files. The related section of my init.el is:

(require 'elpy)
(elpy-use-ipython)
(setq-default indent-tabs-mode nil)

(add-to-list 'auto-mode-alist '("\\.py\\'" . elpy-mode))

I clarify my question: Elpy as a minor mode is activated in all of my buffers, and shadows important key-bindings such as C-c C-c for magit.


texts:
I want tags to auto-complete based on all my org files.
I've found (setq org-complete-tags-always-offer-all-agenda-tags t), but is there any similar line to always-offer-all-tags?;)


texts: Symbol's function definition is void: rx-let

texts:
Whenever I try to use elpy, or even just fontlock (with elpy disabled) in a python file, I get the error that rx-let is void.
This is what I got from --debug-init:
Debugger entered--Lisp error: (void-function rx-let)
  (rx-let ((block-start (seq symbol-start (or "def" "class" "if" "elif" "else" "try" "except" "finally" "for" "while" "with" (and "async" (+ space) (or "de$
  (python-rx line-start (* space) defun (+ space) (group symbol-name))
  (defvar python-nav-beginning-of-defun-regexp (python-rx line-start (* space) defun (+ space) (group symbol-name)) "Regexp matching class or function defi$
  eval-buffer(#<buffer  *load*-951749> nil "/home/ben/.emacs.d/elpa/python-0.27/python.el" nil t)  ; Reading at buffer position 60382

I am using the Ubuntu 26.3 Build. This is just driving me nuts. I tried searching for this error, but I didn't get any results. Requesting for help.


texts: When/how does font initialization occur? Changes at init time seem to only have partial effect

texts:
I have been experimenting with variable-pitch for some buffers. I have the following snippet in my emacs init:

(set-face-attribute 'variable-pitch nil
                    :family "Bookman Old Style"
                    :height 180)

If I start emacs and run the following in my *scratch* buffer:

(assoc :height (face-all-attributes 'variable-pitch))

I get:

(:height . 180)

So far, so good. But M-x describe-face variable-pitch shows:

           Height: (lambda (base) (truncate (* (face-attribute (quote fixed-pitch) :height nil (quote default)) 1.23)))

And, indeed, the size in buffers seems to be a bit "too large".

If I run set-face-attribute again, the 180 value "sticks". Where/how should I be doing this initialization so it works initially?


texts:
I'm trying to change the keybindings to all the smerge commands. I added :

(setq smerge-command-prefix "\C-c v")

to my Emacs config. M-x customize smerge confirms that the Smerge Command Prefix is ^C v but all my smerge commands still starts with C-c ^.

I also tried

(setq smerge-command-prefix (kbd "C-c v"))

but same result.

Any help would be appreciated.


texts: Unbind `M-o` in diff-mode with use-package

texts:
I'm trying to unbind M-o in diff-mode with use-package.  To do that I've written:

(use-package diff
  :defer t
  :config
  (unbind-key "M-o" diff-mode-map))

Restarted Emacs 25, open a diff file, but M-o still seems to be mapped to  diff-goto-source.

I checked diff-mode.el and found out that there is diff-mode-shared-map which seems to have M-o.  So I did changed the map in the previous code to:

(use-package diff
  :defer t
  :config
  (unbind-key "M-o" diff-mode-shared-map))

But, it still does not work.

I've used the same snippet for other modes and they seem to work as I expected. Is diff-mode special?


texts: How to set the Ispell language via a file variable in Org-Mode?

texts:
I put the following in the beginning of the Org file:

* :noexport:
Local Variables:
ispell-local-dictionary: "american"
End:
#+EXPORT_EXCLUDE_TAGS: noexport

And I start flyspell via a hook:

(add-hook 'org-mode-hook 'turn-on-flyspell)

But Ispell always uses the default dictionary instead of the american.

I also tried Org's language tag, but it does not seem to have any effect on Flyspell.

#+LANGUAGE:  en

How to define the Ispell language in the Org file?

Update

When I set the variable from within a :noexport: taged heading the variable will not be set:

* :noexport:
-*- ispell-local-dictionary: "american" -*-

But when I set the variable before the :noexport: tag the variable gets set:

-*- ispell-local-dictionary: "american" -*-
* :noexport:

Is this the intended behavior? And if so, how can I change it?


texts: How to show the three months calendar of non-Gregorian calendars?

texts:
Running M-x calendar shows three months calendar of Gregorian
calendar like below:

Emacs has also other calendars (Chinese, Hebrew, Julian, Mayan,
... ). How to show the three month calendar of these calendars like
Gregorian?

For example for the French year (just for example) I mean an output like below (which I created it by hand): Emacs know the names of Months of French year, I only written the abbreviation of the days of the week. Actually when the point is at today (e.g. 17 July 2015), running M-x calendar-french-print-date gives French Revolutionary date: 29 Messidor an 223 de la Révolution.

Edit: actually the month Messidor has only 30 days based on Emacs.


texts: How can I set up Emacs to use Flycheck and pylint django?

texts:
I use lsp-mode and flycheck.
My .pylintrc config:
[MASTER]
load-plugins=pylint_django

What other settings do I need?


texts: Print output from org code block immediately

texts:
I have an org mode file I use to run some moderately long analyses. Evaluating individual blocks may take 15 minutes to an hour or so. I usually wrap longer bits with calls to date, so I can later review how long those parts took. e.g:

#+BEGIN_SRC bash :results output
  echo Starting transfer ...
  date
  ## rsync 30 GB directory
  echo Finished transfer!
  date

  echo Starting analysis ...
  date
  ## long-running analysis
  echo Analysis finished!
  date
#+END_SRC

This works fine, but after it starts I can't see when each step started and stopped until the entire process is complete.

Is there a way to get org to print the results as they are generated, rather than all at once when the code block is done? i.e., as soon as my transfer is finished I see the "Finished transfer!" message with the output from date, while the script continues on to the next section.

What I'd like is a way to monitor the progress of these computations. I don't want to put each line in its own source code block, as I want the entire process to continue without my having to submit each command explicitly.


texts:
I simply need to take the output of org-element-parse-buffer and put it in a file -- maybe with some "if-does-not-exist" etc. bells and whistles. In CL I have with-open-file and write as tools. For example, here's CL to read a file containing lines like foo=bar and output to a new file like this (foo . bar)

(defun arabic_to_roman (filename)
  (cl-flet ((read-it ()
                  (with-open-file (in filename
                                      :direction :input
                                      :if-does-not-exist nil)
                                  (loop for line = (read-line in nil)
                                        for pos = (position \= line)
                                        while line collect (cons (subseq line 0 pos)
                                                                 (subseq line (1+ pos))))))
         (write-it (list)
                   (with-open-file (cl-stream #p"ar_out.txt"
                                           :direction :output
                                           :if-exists :overwrite
                                           :if-does-not-exist :create)
                                   (write list :stream stream :escape nil :readably nil :pretty nil))))
    (write-it (read-it))
    'done-read-write))

This is someone abstruse compared to other languages -- but then I don't find anything like this in elisp. How is read-write done in elisp. What I find seems only buffer-oriented. . . .


texts: How can I override a pre-defined face for light and dark backgrounds?

texts:
I would like to use set-face-attribute to pick one of two colors for the foreground depending on whether the background of the current theme is light or dark.

The expected behavior is that the foreground changes automatically if I switch from a light background theme to a dark background theme or vice-versa.

Here is a use case:

I customize the face of stripe-hl-line as follows:

 (set-face-attribute 'stripe-hl-line nil
                        :overline   "gray"
                        :underline  "gray"
                        :foreground "dodger blue")

But I would like to change the foreground based on just if the theme is light or dark. That way I don't have to worry about customizing that face in each theme.


texts: Any example of using SVG bultin library?

texts:
I heard that you could draw SVG in emacs using the svg.el library, but while i managed to get the right dependencies (I'm on ubuntu 19.10) and while compiling the latest version from the savannah.gnu repo work great, i couldn't see anything related to svg (svg.el) being used.(that is, i couldn't find it using M-x)

Though, from what i seen, it does work as i managed to install svg-clock but, nothing else show up in the M-x prompt about svg...

And yes, i also added imagemagick support to emacs, but no dice.

Additional details: I'm also using lucid instead of the gtk gui. Here the full configure flags i used ./configure --with-x-toolkit=lucid --with-xml2 --with-xft --with-libotf --with-imagemagick --with-rsvg

Basically i want either examples of how to use the svg.el (mostly so i can check if it's actually being used, or to check if it wasn't meant to be launched using M-x)

Lastly, i did used (image-type-available-p 'svg) to check whether it was available or not, and it was indeed...it just didn't appear in the prompt of M-x.


texts:
I want to write a mode for ledger. The first thing I want to do is to be able to insert date stamps. There is a very nice mode in Emacs called calendar. I want to be able to select a date within it.

How do I register a call-back or something that will be executed when the user has select a date (by pressing enter or any other way that calendar mode already uses).


texts: Completing from filesystem search in ido-find-file

texts:
By default, when a pattern that has been typed matches no results, after a short pause in typing ido-find-file goes on to try to locate a matching file in one of recently visited directories (I believe, in the recent-first order).

My question is, are there any ido features or extensions available to include a whole filesystem subtree, not only a list of visited directories, to the ido search? I understand this is tricky in general (what happens if I stop typing at /?), but I am all for spending some time configuring this extension to do what I want. I am working on a project with a zillion directories, shell scripts calling scripts calling scripts. Even setting explicit fixed expansion points would be fine by me, for example, a rule to the effect if you are at or below any directory in this configured list, expand all subdirectories of that directory for ido search).

I know about helm, but I am interested how far I can go with ido, before jumping into the learning of such a complex package.


texts: Having trouble getting eshell remote shell multi-hop to work

texts:
I can get single hop ssh to work just fine:

~ $ cd /ssh:cpatti@wak-prod-jump1:~
/ssh:cpatti@wak-prod-jump1:/home/jumpboxaccess_emergency $

But when I try multi-hop, I get command not found every time:

cd /ssh:cpatti@wak-prod-jump1|ssh:root@wak-prod-knife:~
ssh:root@wak-prod-knife:~: command not found

I'm running emacs 25.0.50.1 on OSX Yosemite in case that matters.


texts:
I'm using the Anaconda distribution for Numpy, Ipython etc. and during the installation the following was added to my .bashrc:

# added by Anaconda2 2.4.0 installer
export PATH="/home/matthias/anaconda2/bin:$PATH"

when I run M-x shell in emacs "ipython bla.py" works perfectly fine. However, when I run M-x compile and then enter "ipython bla.py" it will say:

ipython bla.py
/bin/bash: ipython: Kommando nicht gefunden.

Compilation exited abnormally with code 127 at Tue Dec  8 13:35:59

How do I tell emacs about my anaconda installation, like I did in .bashrc?


texts: How to limit mark/kill size of huge (org-mode) files?

texts:
I have org-mode files about 50K lines long, which I can edit and save file; but once in a while accidentally marked a large region by typing C-x C-x or C-x h, and copied too much data into clipboard, so Emacs hangs until killed by oom.
Is there a mode or customization helping to limit mark/kill size to avoid this pain?


texts:
I get this error message when trying to configure CEDET:

  Symbol's function definition is void: ´cedet-gnu-global-version-check´

This is my elisp code:

(require 'auto-complete)    ; start auto-complete with emacs
(require 'auto-complete-config) ; do default config for auto-complete
(require 'yasnippet)        ; start yasnippet with emacs
(require 'cc-mode)
(require 'semantic)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)

;; Enables global support for Semanticdb
(global-semanticdb-minor-mode 1)

;; Activates automatic parsing of source code in the idle time;
(global-semantic-idle-scheduler-mode 1)

;; Activates highlighting of first line for current tag (function, class, etc.);
(global-semantic-stickyfunc-mode 1)

;; Activates displaying of possible name completions in the idle
;; time. Requires that global-semantic-idle-scheduler-mode was enabled;
(global-semantic-idle-completions-mode 1)

(setq-mode-local c-mode semanticdb-find-default-throttle
             '(project unloaded system recursive))

(semantic-mode 1)

(when (cedet-gnu-global-version-check t)
  (semanticdb-enable-gnu-global-databases 'c-mode)
  (semanticdb-enable-gnu-global-databases 'c++-mode))

Did I forget something? How do I find the function in question?


texts: Hide modeline in all bottom windows while helm is active?

texts:
I'm trying to hide the modeline whenever helm pops up. I have configure helm to always show up at the bottom.  It should look like this (two windows above the helm completion window):

Opposed of the regular way, where modelines from *scratch* and test.el buffer are shown like this:

I want to hide the modeline only in the bottom windows so if there are other windows above, their modeline should still be visible like this (three windows above the helm completion window):

I have written the following code to achieve this:

(defun toggle-mode-line ()
  "toggles the visibility of modeline in bottom windows"
  (interactive)
  (dolist (current-window (window-list))
    (with-current-buffer (window-buffer current-window)
      (unless (window-in-direction 'below current-window)
        (setq mode-line-format
              (unless mode-line-format
                (default-value 'mode-line-format)))))))

Now this has to be called before helm is activated to make the modeline invisible and after helm was activated it has to be called again to make it visible again. So far the following code works for hiding it:

(add-hook 'helm-before-initialize-hook 'helm-toggle-mode-line)

But I couldn't find a way to make it visible again when the completion buffer is gone. This does not work:

(add-hook 'helm-exit-minibuffer-hook 'toggle-mode-line)

And this does not work, too:

(add-hook 'helm-cleanup-hook 'toggle-mode-line)

What's the proper way to achieve this?

EDIT:

The following works if I select a command in the helm completion buffer:

(add-hook 'helm-before-action-hook 'toggle-mode-line)

But I still don't know how to make it visible again when I quit with C-g or calling helm-keyboard-quit. I tried this but it dosen't work:

(define-key helm-map (kbd "C-q") 'my-helm-keyboard-quit)

(defun my-helm-keyboard-quit ()
  (interactive)
  (helm-keyboard-quit)
  (message "this and the line below is not called for some reason")
  (toggle-mode-line))


texts: Mark considered active after kill-ring-save even though it’s not

texts:
I’m having a small issue with a minor mode I’m writing. I’m using mark-active within pre-command-hook and post-command-hook in order to know whether a command just enabled/disabled the mark/region (I’m using transient mark mode). It’s mostly working, for instance C-SPC, or Shift+arrows or selecting with the mouse all do exactly as I expect, but not the kill-ring-save command (M-w). In the post-command-hook after kill-ring-save, the variable mark-active is still true even though M-w actually disables the mark (visually at least).
Any idea what is going on? I’m now working around it by explicitly checking whether this-command is kill-ring-save, but it feels like I shouldn’t have to do that.
Code to test:
(defun before-hook ()
  (message "(before) Mark active: %s, region: %d to %d" mark-active (region-beginning) (region-end)))

(defun after-hook ()
  (message "(after)  Mark active: %s, region: %d to %d" mark-active (region-beginning) (region-end)))

(add-hook 'pre-command-hook 'before-hook nil t)
(add-hook 'post-command-hook 'after-hook nil t)


texts: prelude-ivy: How to select and open multiple files

texts:
I have installed Ivy (along with Swiper and Counsel) as part of Prelude by doing a (require 'prelude-ivy) in my prelude-modules.el file.

It seems to work, but I am not able to figure out how to do some basic things. In particular, I would like to open multiple files "at once".

Suppose I do a C-xC-f and enter the path to a folder with a bunch of files (let's use ~/.emacs.d/core/ as an example).
I can easily open any one of the files by doing a C-n down the list and hitting enter. Emacs will then open whichever file is selected, or open Dired if I select a directory such as ./ or ../.

I can also start typing a substring of a filename and the matches to that substring are filtered as expected:

But how, exactly, do I select all or some of the files in the minibuffer for opening? Suppose I want to open BOTH prelude-core.el and prelude-custom.el. How do I do that?

There's some information in the Ivy User Manual about "key bindings for multiple selections" but I can't get it to work, or I don't understand the instructions. Can someone walk me through the explicit key bindings to:

Select/open all of the filtered files in the minibuffer.
Select/open some of the filtered files in the minibuffer.
If possible, do the same things in a Dired window (not sure if Ivy applies there?).


texts: How to pass the current scopes function symbol as an argument to an elisp function

texts:
I am trying to create an org-capture template which works with yankpad and yasnippets to such that if I am working with some c code like this:
example.c
static int somefunc(int a) {
   if (a ==5) {
       return 1;
   }
   else {

       return 0;
   }
}

I want to be able to, with a single org-capture, yank the entirety of the function and its signature into an org file like so:
example.org
#+NAME: example_proto
#+BEGIN_SRC C
int somefunc(int a);
#+END_SRC

#+NAME: example_func
#+BEGIN_SRC C
static int somefunc(int a) {
   if (a ==5) {
       return 1;
   }
   else {

       return 0;
   }
}
#+END_SRC

This requires the following:

Get the scope of the current function.
Get the prototype of the current function.
Pass these into an org-capture template.
Use yasnippets in the org-capture template.

The main piece I can't figure out is how to find out what function defines the current scope programmatically so that I can pass it as an argument to other elisp functions (to determine scope, callees, etc).
If someone can point me in the right direction that'd be much appreciated.


texts: Can I set up the org-mode #+OPTIONS: differently for different export targets?

texts:
I would like to set the #+OPTIONS: settings in an org-mode file to behave differently if the org-mode file is exported to HTML or to PDF.
More precisely, I would like to have control of

the table of contents,
the numbering of the sections and
the depth of the headers.

I would like to setup my org-mode document such that the behaviour is different if I export the same file to different format:

For PDF export C-c C-e l p, no table of contents, the sections numbered:

#+OPTIONS: toc:nil num:t H:7

For HMTL export C-c C-e h h, with table of contents, the sections not numbered:

#+OPTIONS: toc:2 num:nil H:4

How can I do this?


texts: quickly go to begin or end of the cell in org table

texts:
Given that the cell has already some string values filled in and the cursor is located somewhere at the middle of the cell.
How to quickly move cursor the the first/last char of the very same cell? I know C-a, C-e but it has scope of the whole line instead of one cell.


texts: Complex comment-start (and end) sequence

texts: As far as I understand there is syntax flags only for comment delimiters made up of two characters but if I have comment delimiters of length greater than two characters is it possible to change syntax table accordingly? And if not, how can I resolve this kind of situation? Just change colors and indentation of comment block and forget about syntax table?


texts: Can't connect to remote ssh host using tramp on Windows

texts:
I have 2 operating systems: Windows XP and Linux Slackware.

In both operating systems I have the following text in ~/.ssh/config:

Host beta
HostName <server IP>
User beta
Port 22

I can connect to ssh directly from shells, using the command: ssh beta. When I run C-x C-f and then /ssh:beta:/home/beta in Linux it works, the directory is opened in dired. On Windows it hangs. In *Messages* buffer I get the following:

Tramp: Opening connection for beta using ssh...
Tramp: Sending command `ssh   -o ControlMaster=auto -o ControlPath='tramp.%r@%h:%p' -o ControlPersist=no -e none beta && exit || exit'
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for beta using ssh...failed

How to fix?


texts: How to turn off R help document popup when using ESS?

texts: When I input a function, the R help document pops up automatically. It's very annoying. How to turn it off?


texts:
came across on windows 10 the following error message

Running `LaTeX' on `test_latex' with ``pdflatex  -file-line-error   -interaction=nonstopmode "test_latex.tex"''
**'pdflatex' is not recognized as an internal or external command,
operable program or batch file.**

however, i do add the executable to the exec-path in init.el , as below:

(when (system-is-windows)
  (setq exec-path '(
            "C:/Users/user/AppData/Local/Programs/MiKTeX 2.9/miktex/bin/x64")
   )
)

and the path "C:/Users/user/AppData/Local/Programs/MiKTeX 2.9/miktex/bin/x64" is also added to environment PATH variable.

Any help/hint is much appreciated!


texts: How to move just one value in a table to a different column

texts:
Is there a command for moving only the value 11 to the right column in the following column?

| Name |    |   |
|------+----+---|
| a    | 11 |   |
| b    | 10 |   |

Something like org-table-move-column but applying to a single cell only.


texts: Automatically indent ONLY logical lines in Org-mode

texts:
I want this:

** This is a heading
   This is a logical line. But, because I have visual-line-mode on, lines
will wrap at the edge, as is just and godly. But, such elegant formatting
as you see here is but a fleeting fantasy. Various indentation schemes in
my Emacs Org-mode installation compete for dominance, so even though my
org-mode text looks like this when I’m first typing a file, if I do any
kind of function on the subtree, like opening, closing, promoting, etc.,
or reload the buffer, I’m left with text formatted like the following
abomination:

No matter what I try, I get this:

** This is a heading
   This is Tina’s cruel Emacs installation, which, no matter what
   combination of settings and minor-modes she tries, will constantly
   attempt to indent visual lines as well as logical lines, which makes
   sense for programming but is an absolute eyesore when dealing with long
   stretches of text. She wants to have only logical lines indented in
   org-mode, preferably in the text itself but she will settle for having
   it happen at display-time. But, I steadfastly prevent her from doing
   this, because I enjoy taunting her with visions of what could be and
   never will. BWA HA HA HA HAAAA

Seriously, how do I do this? Ordinarily I’m using org-indent-mode, but I’ve tried turning that off and relying on the org-adapt-indentation, I’ve tried using adaptive-wrap-prefix-mode, I’ve tried using aggressive-indent-mode (which doesn’t even seem to work with org-mode)… nothing produces the desired behavior. I’ve looked into other StackExchange questions, even: this one specifically relates to org-export, not editing while in org-mode, while this person seems to want the opposite of what I want (I think? It’s not clear). I just want to know how to get the behavior above: logical lines are automatically indented (preferably by adding spaces in the file itself) to the heading level, while wrapped visual lines are not. (I can get close to this behavior if I have other indenting modes turned off and org-adapt-indentation set to t, but it’s not automatic, which is a dealbreaker.)

Thanks!


texts: Auto enable minor modes in fundamental-mode

texts:
By design, the fundamental-mode is bare bones as other major modes are supposed to derive from this one.

From the info page (elisp) Major Modes, we have:

  This is the major mode command for Fundamental mode.  Unlike other
       mode commands, it does not run any mode hooks (*note Major Mode
       Conventions::), since you are not supposed to customize this mode.

For that reason,

We do not have a fundamental-mode-hook.
Also my-minor-mode does not get enabled ONLY in this major mode buffers inspite of having (global-my-minor-mode 1) in my config.

Below would work but only if I manually typed M-x fundamental-mode:

(add-hook 'after-change-major-mode-hook #'my-minor-mode)

It does not help in the below case where a fundamental-mode buffer (*abcd*)  is created by default:

(with-current-buffer (get-buffer-create "*abcd*")
  (insert "Hello world"))

Why I want to enable a minor mode in fundamental-mode?

I like to keep my custom key bindings in my minor mode map. I have this minor mode enabled globally (but it does not get enabled only in fundamental-mode buffers).

Here's a use case that made this ask this question here. On doing M-x esup (esup package), it creates an *esup-log* buffer with fundamental-mode as its major mode. But each time I need to enable my minor mode manually in it to use my convenient bindings.

I'd like to enable my-minor-mode in a truly global fashion, fundamental-mode or not.

Update 1:

Here is my minor mode definition: modi-mode.

Update 2:

Based on @npostavs' comment, I reviewed what's different between my minor mode modi-mode and override-global-mode in use-package/bind-key.el. And it turns out that the init value of my mode is nil and that of override-global-mode is t.

If I change the init value of my mode to t, it too gets enabled in the fundamental-mode buffers! But the act of (global-modi-mode 1) does not end with the same result. Is that odd? Probably a bug?


texts: Org-mode to Latex matrix automatically escapes ampersand

texts:
I am trying to write LaTex matrizes in org-mode. It works fine with exporting tables via #+attr_latex :mode math :environment matrix.
However, when I try
\begin{pmatrix}
1 & 2\\
3 & 4\\
\end{pmatrix}

this exports to
\begin{pmatrix}
1 \& 2\\
3 \& 4
\end{pmatrix}

in the latex document. And that gives me a literal & in the final latex document.
Is this default behaviour? How can I fix this?


texts: switch to dedicated window instead of duplicating the buffer

texts:
I can make a buffer dedicated to a frame using the following snippet I got from other posts

(defun toggle-window-dedicated ()
  "Toggle whether the current active window is dedicated or not"
  (interactive)
  (message
   (if (let (window (get-buffer-window (current-buffer)))
     (set-window-dedicated-p window (not (window-dedicated-p window))))
       "Window '%s' is dedicated"
     "Window '%s' is normal")
   (current-buffer)))
(global-set-key (kbd "C-c d") 'toggle-window-dedicated)

Now from from another frame if I want to switch to the dedicated buffer then a copy of the buffer is opened. This is not the behavior I want. I want the focus to switch to the dedicated frame.
The solution posted here : switch-to-buffer does not work.


texts: debugging c++ code with dap-mode in Emacs does not display std::variables (e.g., vector, map, etc) correctly. Any idea to solve this problem?

texts:
When I debug c++ code in dap-mode with Emacs, the std::variables, such as vector and map, always have values, [0]: std, shown in the local variable area. Does anybody know what is going on?
I am on Mac 10.15.4 and Emacs 27.0.91. lldb-mi is used for debugging.
Thanks.


texts: Configure helm--completing-read-default to pick the top match

texts: I have the variable completing-read-function set to helm--completing-read-default. When an external package invokes completing-read, this gives helm-based completion. However, the default item picked by the helm completions buffer is the exact string that I have typed. In the helm window, this is the one at the top of all the selections and prefixed by a ?. This isn't the behaviour I see with helm-find-files - the default selection there is the top match. So, if I have entered abc and there is a file named xyzabc.txt it will be selected(assuming its the top match). How do I get this behaviour with helm--completing-read-default? Note that I don't want to change the code of the external package which simply invokes completing-read.


texts:
I follow this tutorial. The code after selecting the region and <Tab> or equivalently C-M-\ in an org file:

(setq trees '(pine fir oak maple)
herbivores '(gazelle antelope zebra))

I would have expected an indent before "herbivores".


texts: Number of line as you'd get moving down the buffer with C-n

texts:
In a buffer in Emacs, a line is the text you get from the first character after you press "Enter" to the last character before the next "Enter". And so, this is the line numbers one gets to the left of the buffer when you are in the display-line-numbers-mode.
Is there any way to get not these line numbers, but the "number of line" you get by counting the number of times you press C-n when moving down the buffer from the beginning? Namely, counting the numbers of lines (as I see in the screen) from the beginning of the buffer till the current position, and showing them in the screen as display-line-numbers-mode does.
I have tried using M-q on the line, but this is not what I am looking for as this command truncates the line into multiple lines.
[Edited in order to make the question clearer.]
I'd like to get the kind of thing you get when (in the windowed version of Emacs) you activate "Options → Show/Hide → Line Numbers for All Lines → Visual Line Numbers". But I don't quite understand this option, because it's not counting the lines from the first one in the buffer. Instead, the number in front of each line changes depending on the line in which the cursor is.
[Edit 2]
Example:

In this image I have two lines (I am using word wrapping). Well, the idea is that I'd like to show a number in each line I see, that is, from 1 (at the beginning) to 12 (at the end of the buffer). Of course, if I change the width of the window I'd get a different number of lines.


texts:
When I run Emacs in a text terminal instead of the normal GUI mode, I can copy in Emacs by activating the start of a region with C-SPC, and then select what I want, and then do M-w.

Is there any way to get a region copied this way be available in the OSX clipboard to paste it say in a web page (other than by running Emacs in its GUI mode, obviously)?

I'm not interested in creating a different shortcut to do that, and ideally it should not require installing any modules.

I've seen this post and tried the accepted answer but it does not work seem to work the way I expect above.

Any other ideas?