texts: How to interpolate current path in eshell

texts:
In eshell when I do

$ echo "$(pwd)credentials.json"
Directory /Users/gmauer/../credentials.json

I get that Directory prefix. I'm assuming that it is because eshell reimplements pwd to return some sort of object, and Directory .... is how that is being coerced into  a string.

So how do I interpolate this correctly so that I can use export it to an environment variable?


texts: Org agenda suddenly broken after installing org-mac-link

texts:
Org agenda is suddenly broken Symbol’s value as variable is void: org-tag-group-re. How to fix it?

Diagnosis:

The problematic code seems to be this:

;; org-mac-link

(push (expand-file-name "~/.emacs.d/lisp") load-path)
(require 'org-mac-link)
(add-hook 'org-mode-hook (lambda ()
  (define-key org-mode-map (kbd "C-c g") 'org-mac-grab-link)))

Variables in org-tempo and org-agenda stopped functioning after getting this code to work.

Anyone know why this happens?


texts: Hi-lighting common grammar mistakes in all prose across modes with English text

texts: I already make extensive use of flyspell-mode to keep my errant spelling in check. However I'm currently trying to break the bad habit of using "it's" for possessive statements. I've had a brief look around and haven't found any grammar checkers but really all I need is to visually hi-light common errors in any buffer which can accept textual prose. Any suggestions of the easiest way to achieve this?


texts:
I am using "emacs 24.4.1; htmlfontify 0.21" and try to htmlfontify a ansi-term buffer. But the style in the generated HTML file does not contain colors. This is how it looks:

span.term-bold-0004   { font-size: 105%;  text-decoration: none; }
span.term-bold-0004 a { font-size: 105%;  text-decoration: underline; }
span.term-bold-0006   { font-size: 105%;  text-decoration: none; }
span.term-bold-0006 a { font-size: 105%;  text-decoration: underline; }
span.term-bold-0003   { font-size: 105%;  text-decoration: none; }
span.term-bold-0003 a { font-size: 105%;  text-decoration: underline; }
span.term-bold-0007   { font-size: 105%;  text-decoration: none; }
span.term-bold-0007 a { font-size: 105%;  text-decoration: underline; }

When I htmlfontify a source file the CSS contains the colors:

span.function-name   { color: #0000ff;  font-family: Lucida Console;  font-stretch: semi-condensed;  font-weight: 500;  font-style: normal;  background: #ffffff;  font-size: 14pt;  text-decoration: none; }

What do I have to do to get the colors from the ansi-term right?


texts: Strange behaviour of match-string/string-match

texts:
I have this code

(defun string-match-test ()
  (interactive)
  (string-match "12345" (buffer-string))
  (setq STRING (match-string 0))
  (read-string STRING)
  (goto-char (point-max))
  (insert STRING)
  )

(string-match-test)

I expected it to print 12345 but I get, instead "1234. What's my mistake? May I have misunderstood the buffer-string function behaviour?

Note. I kwow I can use serch-forward-regexp combined with with-temp-buffer... but I'd like to understand the reason of this weird behaviur.


texts: Emacs wsl grep fails on special characters

texts:
I'm using GNU Emacs 26.3 on a Windows 10 system (Virtualbox guest on Mac).

The following grep command inside emacs fails:

grep -i -n -d skip -e temp_ *

with this error:

grep -i -n -d skip -e temp_ * NUL
agrep: NUL: No such file or directory

Grep exited abnormally with code 2 at Mon Mar 23 12:27:03

If I run the command in the wsl shell it works.
The following grep command inside emacs also works fine:

grep -i -n -d skip -e temp *

Note: the missing _ at the end.

I tried escaping the underscore with \ and \\, nothing helped.

Any ideas?  Thanks a lot.

Edit: FYI: I'm using the following shell command, which works fine for other grep, make, etc. commands:

(setq explicit-shell-file-name "C:/Windows/System32/bash.exe")
(setq shell-file-name explicit-shell-file-name)

as for Tobias request:
I run the 'grep command via my shortcut F5:

(global-set-key [f5] 'grep)

then:

Run grep (like this): grep -i -n -d skip -e temp_ *


texts:
I was listening to this song today - https://www.youtube.com/watch?v=ajy71xw351E
Don't Wanna Leave You Now
and I realized how much I don't want to leave emacs.
I often do this after backgrounding (C-z) emacs,
psql datababase_name

select id from table1;
update table set foo="baa" where id=n;

I also often open up a gui sql browser (such as Navicat) and
order tables by a column. I might also do LIMIT to speed up query time.
Sometimes, I delete rows in a table by pressing x in the gui browser.
With Navicat, I like double clicking on a cell to edit a Postgres row
in-place.
I know I will never fully replace Navicat, but how can I use emacs
to do basic (Postgres) database work?


texts: Interpret where error is from --debug-init when trying to require go-mode

texts:
I'm trying to install go-mode in emacs (http://dominik.honnef.co/posts/2013/03/writing_go_in_emacs/) but am having trouble and I'm not sure if the problem is with my .emacs file or with the go-mode el.  I've auto-generated go-mode-load.el as in http://www.pastebucket.com/58212.

I then configured my .emacs file as

(add-to-list 'load-path "/Users/<username>/Misc/emacs/go-mode.el/")
(require 'go-mode-load)

But when I start emacs I get the following error

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  expand-file-name(nil "/SourceCache/emacs/emacs-92/emacs/lisp")
  update-file-autoloads("go-mode.el")
  (let ((generated-autoload-file buffer-file-name)) (update-file-autoloads "go-mode.el"))
  eval-buffer(#<buffer  *load*<2>> nil "/Users/ygreif/Misc/emacs/go-mode.el/go-mode-load.el" nil t)  ; Reading at buffer position 143
load-with-code-conversion("/Users/ygreif/Misc/emacs/go-mode.el/go-mode-load.el"     "/Users/ygreif/Misc/emacs/go-mode.el/go-mode-load.el" nil t)
require(go-mode-load)
eval-buffer(#<buffer  *load*> nil "/Users/ygreif/.emacs" nil t)  ; Reading at buffer position 88
load-with-code-conversion("/Users/ygreif/.emacs" "/Users/ygreif/.emacs" t t)
load("~/.emacs" t t)
[globbily-bluck]
command-line()
normal-top-level()

How do I interpet the --debug-init.  Is the problem in my .emacs file?


texts: (How) can I emulate {eshell,comint}-output-filter-functions in term?

texts:
What I want to do from inside a term shell is have a function called when there is new output or a certain regexp (e.g. a prompt) appears in in a term's output. The callback function should then be able to access text from the either the last time it was called, or from the last time that pattern was seen.

In comint this would be a function stored in
comint-output-filter-functions, and for eshell: eshell-output-filter-functions

Can this be done in term.el? If so, how?


texts: How to configure Auctex to automatically use pdflatex for all Latex files?

texts: I mean by adding an entry to the .emacs file.


texts: First function not working: Device 1 is not termcap

texts:
(defun next-upper-heading ()
       (interactive)
       (outline-up-heading)
       (org-forward-heading-same-level)
    )

When calling, I get the error: how can i research, what is going on here?
Device 1 is not a termcap terminal device


texts: Basic AUCTeX Setup Issue in macOS and Linux

texts:
I'm trying to get AUCTeX up and running in macOS and linux and have followed the steps here.

(The site has a separate guide for GNU/Linux.) My problem remains invariant between OSes, so I'm asking for help.

In each instance, loading a .tex file, I note that Emacs shows my mode as LaTeX/PS -- should this not say AUCTeX?

In any case, C-c C-c brings up Command (default latexmk), and another C-c C-c is undefined.

Any suggestions where something might be amiss?


texts: How to stash individual files with magit

texts:
git is capable of stashing of individual hunks.

  With --patch, you can interactively select hunks from the diff between HEAD and the working tree to be stashed. The stash entry is constructed such that its index state is the same as the index state of your repository, and its worktree contains only the changes you selected interactively. The selected changes are then rolled back from your worktree. See the “Interactive Mode” section of git-add[1] to learn how to operate the --patch mode.

Is it possible to use it with magit frontend? Magit simplifies patch mode usage for staging spectacular. Could it do the same work for stashes?


texts:
I found this function in this site:

(defun search-selection (beg end)
  "search for selected text"
  (interactive "r")
  (let ((selection  (buffer-substring-no-properties beg end)))
    (deactivate-mark)
    (isearch-mode t nil nil nil)
    (isearch-yank-string selection)))

(define-key global-map (kbd "<C-f3>") 'search-selection)

With this, I just need to select the text and hit C-f3, and Isearch finds the string from the current cursor point to the rest of the buffer. But when it reaches the bottom the function doesn't wrap around to search from the beginning of the buffer.

How can I make this function wrap around?


texts: exporting .svg images to .pdf in org-mode

texts:
I have a set of .svg images that I need to export to pdf by using org-mode. Even though I can see the images inside emacs, I cannot export them to .pdf. On the other hand, if I export my .org file to html I can see all the .svg files.

I installed librsvg2 packages for ubuntu 18.04. What could problem be?

B.R.


texts: Don't kill helm search result buffer, navigate with M-g n

texts:
I was previously using ag-project to search string in my project. I had it setup so that it opened the relevant buffer on Enter, while keeping the result window open. I could then edit in that window, then M-g n (with compile minor mode) later to jump to the next result.

Now that I am evaluating helm, I try using helm-ag-project-root instead. What breaks my workflow is that I cannot go to the buffer where the match is, without killing the helm result buffer. The least I want to do is to browse the results of my helm search, and be able to scroll the buffers that open.

The best I would like to do is do a search, go to a match, do loads of other stuff, then go back to the result window without searching again, or even directly go to the next match.

I've found this, but don't find it satisfactory.


texts: I would like to put some notes on org document which should not be printed/ exported to pdf . Is it possible?


texts: How can I insert a link from one org file into another?

texts:
This is probably simple and I've been trying to develop some lisp skills but I'm completely stumped.

What I'm trying to do is insert a link in one file every time a TODO state change occurs (probably not necessary, but you can see more details in my older Stackoverflow post).  The goal is to create an index of my activities throughout the day that all link back to my agenda file.  E.g.:

[2014-09-03 Wed 09:05] - STARTED this is my heading
[2014-09-03 Wed 09:34] - DONE this is my heading
[2014-09-03 Wed 09:50] - STARTED this is another task in my agenda

I tried this:

(defun andy/journal-state-change (plist-chg)
  "When the state changes, link it into the journal"
    (org-journal-add-entry (plist-get plist-chg :position))
    )

(add-hook 'org-trigger-hook
          'andy/journal-state-change)

Which, according to the org-trigger-hook documentation will be give a property list which includes a :position property.

I modified the org-journal library to integrate this function into its journaling (snipped down for brevity):

(defun org-journal-add-entry (apoint)
  "APJ 5/4/15 add call for inserting from todo state change"
  (interactive)
  ;; code snipped here which prepares this buffer to get the new
  ;; journal entry
  ;; my additions here:
      (org-insert-link (org-entry-get apoint "LOCATION") (org-entry-get apoint "DESCRIPTION") (org-entry-get apoint "DESCRIPTION") )
      (set-buffer-modified-p unsaved)
      )))

I'm pretty sure that's not the way to do it because I'm dealing with a point and trying to insert a link.  It would be nice to just pass the TODO entry from the original but I'm not sure either how to get the link or to insert it in the other file.

Any suggestions greatly welcomed!


texts: If I have marked a couple files in different directories using Dired+ is there a way to see the diff?  I was looking at dired-diff and diredp-diff, but they both take the file at point.  Granted that isn't a whole lot harder, but I was wondering if there is a way to mark the files first and diff them?


texts:
How do I switch between windows quickly?

I often have multiple windows open and need to switch between them.  Right now, I use C-x o to get to the one I want. Is there a more efficient workflow available for this?


texts:
In the previous version of Magit, I learned
from oremacs that you can
view and checkout Github pull-requests in Magit by adding the
following line to a remote's definition in .git/config.

fetch = +refs/pull/*/head:refs/pull/origin/*

With this, I could type b b and the PRs would be available with TAB-completion.

This seems to no longer be the case in version 2.1.0. Is there a similar alternative?


texts: Installing evil-mode: ad-handle-definition 'evil-mode' got redefined

texts:
I just installed evil-mode from melpa and when the installation finishes I get the message ad-handle-definition: 'evil-mode' got redefined.

I can then enable evil-mode but get the same warning. But the next time I open emacs and try to enable evil-mode I get this error: Autoloading failed to define function evil-mode

Searching around leads me to understand basically that somewhere along the line evil-mode gets redefined or lost, but I don't know where to start in debugging this.

I've tested:

Removing evil through the package manager and reinstalling
Removing the evil-<date> folder from the elpa packages and reinstalling
Installing the package from marmalade. I don't get the ad-handle-definition error then, but I still get Autoloading failed to define function evil-mode

I'm using emacs version 24.4.1 on OSX.

It kinda feels as if emacs is trying to tell me something behaving like this. ^^


texts: How to create a new repository on Github from Magit

texts:
I am unable to add a remote repo to github if it does not already exist on github.

E.g.
  magit-init
  Add some files, stage and commit.

Then magit-remote-add --> Remote name:github --> Remote url: https://github.com/username/repoName.git

This fails with:

Updating github
remote: Repository not found.
fatal: repository 'https://github.com/userName/repoName.git/' not found
error: Could not fetch github

It all works fine if go to github.com and create the new repo there first, but this is an extra step. I'm wondering how can I create a new repo on github directly from magit.


texts: how to make auto-capitalize-mode downcase next word upon auto-capitalization?

texts:
Suppose I have a sentence:

Two three four.

Suppose I put the point on the "T" in "Two" and enter the text oneSPC. Auto-capitalize-mode will recognize that the point is at the beginning of a line or sentence, and will automatically capitalize the "O" in "One."

Current output:

One Two three four.

But since "Two" is no longer the beginning of the sentence, can I get auto-capitalize-mode to automatically downcase the next word in the sentence if there is one?

Desired output:

One two three four.

In other words, how can I instruct auto-capitalize-mode to downcase the next word whenever it auto-capitalizes a word if there is another word after the point before a line break or period?


texts: Testing Emacs Lisp Code Involving Org Mode

texts:
I'm trying to figure out how I can use ERT and libraries like el-mock to test simple functions that manipulate my org-document.

Consider a function like this:

(defun promote-next-heading ()
  (org-next-visible-heading 1)
  (org-metaright))

How would I write a test for this? Should I have a .org file dedicated for tests like these? And then when the headline gets promoted, how do I confirm this? And then revert it for the next test?

While the example above is contrived, I'm writing quite a few functions that manipulate or query my org document, and I really would feel better if I could test for it.


texts: this-command-key-vector and representation of Return key?

texts:
Q: how do I get this-command-key-vector to return a character vector when called with the return key?

Consider the following simple command, which will echo the vector of keys that invoked it:

(defun test-echo ()
  (interactive)
  (message "%s" (this-command-keys-vector)))

Now let's bind it to two keys:

(local-set-key "i" #'test-echo)
(local-set-key [return] #'test-echo)

When typing i, the function correctly messages me with the vector [105], which corresponds to i's character representation (eq ?i 105).  However, when typing return, it echoes [return], when I would have expected [10], i.e., ?\n.

First of all, is this a problem with my understanding of this-command-key-vector, my understanding of return, or both?  Second of all, how do I get this-command-key-vector to return a character (ie, the integer value) rather than the symbol return (or, alternately, how do I translate return to a character)?


texts: Focus/highlight selected text among other

texts:
I want to focus/highlight part of text(marked or selected in some other way) as shown in the picture(selected texts stays as it was but other text is dimmed)

Maybe there is some way or some package to get such effect:


texts:
I am using Emacs to run Macaulay2 (I'm a newbie at both). I have a long input written in an m2 file, which I then press f11 to input to Macaulay2. I would like to make my input more aesthetically pleasing than one long line by, e.g. breaking it up into different lines. However, when I do this using RET, and then press f11, Macaulay2 only inputs whatever line my cursor is on (which is a fraction of my desired input).

So I'm looking for a way to create line breaks in the m2 file without Macaulay2 interpreting them as different inputs.

edit: Here are some more details per Stefan's request: The mode is Macaulay2 and f11 is running the command M2-send-to-program (found in M2-mode-map), which is an interactive lisp function in ‘M2.el’


texts:
I've noticed that placing (setq org-return-follows-link t) in your init.el has no effect on links created by org-wikinodes.el. When you hit  (or RET), it just cuts the link in half...

One point to clarify though, I made a slight modification in order to org-wikinodes.el to fix a bug that was preventing links from fontifying (see my answer to this question). So it's entirely possible that I missed something...

Ideas?


texts: How do I pre-process capture buffer before saving to target?

texts:
There are times I am given a list of names of people that I need to schedule appointments for in our organization.  The names are typically given first, and then details come later.

I would like to create a capture buffer where I can quickly capture the names line by line, and then process the list of names with the types of appointments that need to be created.  Is there a way to do this in org-mode?

Example workflow:

Create a capture buffer for capturing a vector of appointments:

C-c c a v

Enter the following list into the capture buffer:

John Deere
Adam Smith
Jane Doe

Execute function to pre-process buffer into the following format before saving to target:

* John Deere
** NEXT Schedule appointment for John Deere to meet with board of directors
  SCHEDULED: <2000-01-01>
** TODO Add John Deere to Board of Directors agenda

* Adam Smith
** NEXT Schedule appointment for Adam Smith to meet with Mr. Robins
   SCHEDULED: <2000-01-01>
** TODO Add Adam Smith to Mr. Robins' calendar
** TODO Verify meeting with Adam Smith and Mr. Robins occurred

* Jane Doe
** NEXT Schedule appointment for Jane Doe to meet with board of directors
   SCHEDULED: <2000-01-01>
** TODO Add Jane Doe to Board of Directors agenda


texts: Error when trying to save a file as root using Tramp and sudo

texts:
I am following the directions laid out in this answer to edit my sshd_config file.

However when I try to save I get:

byte-code: Wrong type argument: listp, 126

Does anybody know why this would be and how I could fix it? (this prevents me from saving my file)

EDIT

Thanks to the comments I was able to narrow down the issue to the following lines in my init file:

(setq tramp-default-method "ssh")
(setq tramp-auto-save-directory auto-save-location)
(setq tramp-backup-directory-alist auto-save-location)

Commenting them out fixed my issue


texts: elisp function to insert signature at point or at end, according to the prefix parameter

texts:
Under GNU Emacs 24.4.1, in Message Mode, C-c C-w runs message-insert-signature, which inserts the file message-signature-file at the end of the buffer, if such a signature is not already present.

How can I extend the function message-insert-signature so that to maintain its current functionalities but add one such that, when prefixing the command with C-u (which gives C-u C-c C-w), the signature is rather inserted at point (e.g. for mails where there are attachments which I wish to be AFTER the signature)?

It would be easy to define a function to insert "\n-- \n" and perform (insert-file-contents signature-file) at point, and to bind it to a new key combination, but my muscle memory is set to C-u C-c C-w from my previous use of VM, and I thought it could be the same for other users.

EDIT:

The code of the function message-insert-signature  bound by default to C-c C-w is interactive with parameters (&optional force), which suggests that one could "force" the signature to be inserted, but I don't understand how the (interactive (list 0)) works:

(defun message-insert-signature (&optional force)
  "Insert a signature.  See documentation for variable `message-signature'."
  (interactive (list 0))
  (let* ((signature
      (cond
       ((and (null message-signature)
         (eq force 0))
        (save-excursion
          (goto-char (point-max))
          (not (re-search-backward message-signature-separator nil t))))
       ((and (null message-signature)
         force)
        t)
       ((functionp message-signature)
        (funcall message-signature))
       ((listp message-signature)
        (eval message-signature))
       (t message-signature)))
     signature-file)
    (setq signature
      (cond ((stringp signature)
         signature)
        ((and (eq t signature) message-signature-file)
         (setq signature-file
               (if (and message-signature-directory
                ;; don't actually use the signature directory
                ;; if message-signature-file contains a path.
                (not (file-name-directory
                      message-signature-file)))
               (expand-file-name message-signature-file
                         message-signature-directory)
             message-signature-file))
         (file-exists-p signature-file))))
    (when signature
      (goto-char (point-max))
      ;; Insert the signature.
      (unless (bolp)
    (insert "\n"))
      (when message-signature-insert-empty-line
    (insert "\n"))
      (insert "-- \n")
      (if (eq signature t)
      (insert-file-contents signature-file)
    (insert signature))
      (goto-char (point-max))
      (or (bolp) (insert "\n")))))


texts: Changing the compilation mode current directory automatically?

texts:
Currently, my compilation command is as follow:

cd ~/somedir && ./somescript.sh

This prevents emacs from finding the file in which an error happens (and opening it).

Of course I can run M-x cd manually but is there a way to tell the buffer to change its current directory programmatically?


texts:
Does Emacs or any packages provide a transpose-page command?

I know the C-x [ and C-x ] and forward or backward page, but many times I just want to transpose two adjacent pages, especially when in some Major Modes where pages are defined to be some group of special things.


texts: Emacs is hanging on almost every word I type. How to identify the problem?

texts:
So, that's it. I am writing a lot of LaTeX, and lately emacs is hanging (becoming unresponsive) on almost every word I type, and I have to press C-g to regain control. It started happening around 4 weeks ago. At first it happened less frequently (once or twice a day) and it got worst and worst.

I am using Emacs 25.1 (compiled from source with default options), on Ubuntu Gnome 16.04 LTS. I use Prelude configuration.

I have been using Emacs without a problem for more than 5 years. Never had this kind of problem.

My questions is: how can I identify what is the source of the problem. What keeps making my Emacs hang?


texts: My emacs doesn't contain a function in the online emacs manual

texts:
Command comment-line is not recognized by my version of emacs. How can I install this function?

UPDATE: It may be relevant that my system shows at least two emacs, at /usr/local/bin/emacs; and at /usr/bin/emacs24. The second one is what I use; the first one cannot be launched. I have periodically removed and reinstalled emacs for reasons I cannot now recall.


texts:
I am trying to setup mew to use a gmail account provided by my college. I am on Ubuntu 18.04 and using emacs 25. This is my (anonymized) .mew:

(setq mew-config-alist
      '((default
          (mailbox-type          imap)
          (proto                 "%")
          (prog-ssl              "/usr/local/bin/stunnel")
          (imap-server           "imap.gmail.com")
          (imap-ssl-port         "993")
          (imap-user             "uname@student.college.tld")
          (name                  "Full Name")
          (user                  "uname")
          (mail-domain           "student.college.tld")
          (imap-ssl              t)
          (imap-size             0)
          (imap-delete           t)
          (imap-queue-folder     "%queue")
          (imap-trash-folder     "%Trash")
          (smtp-ssl              t)
      (smtp-auth             t)
          (smtp-auth-list        ("PLAIN" "LOGIN" "CRAM-MD5"))
          (smtp-user             "uname@student.college.tld")
          (smtp-server           "smtp.gmail.com")
          (smtp-ssl-port         "465")
      (use-cached-password   t)
      (ssl-verify-level      0)
      (prog-ssl-arg "fips=no\n"))))

The following is in my .emacs related to mew:

(autoload 'mew "mew" nil t)
(autoload 'mew-send "mew" nil t)
(setq read-mail-command 'mew)
(autoload 'mew-user-agent-compose "mew" nil t)
(if (boundp 'mail-user-agent)
    (setq mail-user-agent 'mew-user-agent))
(if (fboundp 'define-mail-user-agent)
    (define-mail-user-agent
      'mew-user-agent
      'mew-user-agent-compose
      'mew-draft-send-message
      'mew-draft-kill
      'mew-send-hook))

and the following in my /ect/stunnel/stunnel.conf:

[imaps]
accept = 993
connect = 143
[ssmtp]
accept = 465
connect = 25

However, mew hangs on Creating an SSL/TLS connection and I don't know why.

Edit: I am on mew 6.8, stunnel 5.44 and stunnel /ect/stunnel/stunnel.conf yields the following:

[ ] Clients allowed=500
[.] stunnel 5.44 on x86_64-pc-linux-gnu platform
[.] Compiled/running with OpenSSL 1.1.0g  2 Nov 2017
[.] Threading:PTHREAD Sockets:POLL,IPv6,SYSTEMD TLS:ENGINE,FIPS,OCSP,PSK,SNI Auth:LIBWRAP
[ ] errno: (*__errno_location ())
[.] Reading configuration from file /etc/stunnel/stunnel.conf
[.] UTF-8 byte order mark not detected
[.] FIPS mode disabled
[ ] Compression disabled
[ ] PRNG seeded successfully
[ ] Initializing service [imaps]
[!] Service [imaps]: TLS server needs a certificate`

edit2: Problem was resolved by adding client=yes under ssmtp in stunnel conf


texts: How can I create a window that can't be closed?

texts:
I create a window with the following

  (setq ook-window (display-buffer-in-side-window buffer '((side . bottom))))
  (set-window-dedicated-p ook-window t)

But then when I go to the main window and press C-X 1, it closes my ook-window. What can I do to prevent this from happening so the window will only close when I choose?

From the documentation I would have thought setting it as dedicated should have done the trick, but it seems I am still missing something. I can see neo-tree does something similar, it only closes when I run neotree-toggle.

EDIT, to clarify

  I want to bind a key (f9), so when I press f9 it will make the window appear and then the only way to make it dissappear is by pressing f9 again.


texts: How to copy paste in OSX terminal in emacs?

texts: According to the cheat sheet of Emacs, M-w to copy a highlighted text and C-y  to paste it.  M-w means command w which ultimately tries to kill the terminal?


texts: Use hippie-expand to complete ruby symbols without prefix

texts:
I am an avid hippie-expand user but I find it annoying that it natively doesn't complete ruby symbols without the prefix. For example (cursor is |):

class ApplicationController < ActionController::Base
  before_action :some_action

  protected

  def some_a|

  end
end

If I trigger hippie-expand here, it doesn't know that :some_action is also a completion option without the : prefix.

What is the cleanest way to extend hippie-expand (or perhaps dabbrev-expand) to do this?


texts: How to set a "#+SETUPFILE: .xxx.setup" as dir local?

texts: I need this line in every my org files. It's tedious to include it in everyone of them.


texts: Maximum total length for commit message with Magit

texts: I know that it's possible to limit the length of the commit message's first line with git-commit-summary-max-length, but is there a way to limit the total number of characters in a commit message?


texts: How to compare an item against others, that's compatible with string-equal?

texts:
When comparing the last-command against multiple possible strings, it doesn't seem possible to use the member function.

Is there a way to simplify this using something like member?

(when
  (or
    (string-equal last-command 'foo)
    (string-equal last-command 'bar)
    (string-equal last-command 'bob)
    (string-equal last-command 'baz))
  (do-something))

I tried doing this but it didn't work:

(when (member last-command (list 'foo 'bar 'bob 'baz))
  (do-something))


texts: What methods are there for posting the current buffer to website

texts:
Curious if there is anything to do this currently, basically i want to specify the parameters and post the current buffer as one of the parameters to an external website so i can skip the copy and past step.

Are there any packages or what kind of lisp would i need to achieve this ?


texts:
I have this tester code:

(defvar dbg-vec nil)
(defun foobar ()
  (interactive)
  (message "%S" (setq dbg-vec (this-command-keys-vector))))
(set-transient-map '(keymap (left . foobar)
                     (t . foobar)
                     (97 . foobar)))

It works as expected in the GUI. But for emacs -nw it gives strange behavior.
If I press left after evaling the last statement, I get:

error "No previous locations for find-tag invocation"
dbg-vec becomes [27], although the key code for left is 113.

Note that it still works as expected if I press a.
What could be the source of this error and how can I fix it?


texts: Could you let me know where the default colors in f90-mode are defined and how to change them?


texts: Handle stale desktop lock files after emacs/system crash

texts:
If Emacs or the system crashes when desktop-save-mode is active, Emacs leaves a stale desktop lock file. The next time the desktop is loaded (from another Emacs process ID), loading is interrupted with a question:

  Warning: desktop file appears to be in use by PID xxx.
  Using it may cause conflicts. Use it anyway? (y or n)

even if if the process with PID xxx (substitute a process ID for xxx) is no longer alive.

Here is minimal example: First run emacs -Q -l init.el with the following init file (init.el):

(require 'desktop)
(let ((dir "/home/hakon/my-emacs-desktop-test"))
  (setq desktop-path (list dir))
  (desktop-save-mode 1))

Then open some new buffers, and exit emacs. This will generate a new desktop file. Now, create a fake lock file (with process ID 999 or substitute any integer that does not represent a running process ID)

echo "999" > /home/hakon/my-emacs-desktop-test/.emacs.desktop.lock

and rerun Emacs with a new init file emacs -Q -l init2.el, where init2.el is:

(require 'desktop)
(let ((dir "/home/hakon/my-emacs-desktop-test"))
  (setq desktop-path (list dir))
  (desktop-save-mode 1))
(desktop-read)

This should bring up the warning ("desktop file appears to be in use").

How can we get rid of this message?


texts: pasting from websites results in 1 long line..anyway to keep the paragraph format?

texts: when copy and pasting from any web site a paragraph and pasting into emacs with S-insert, the paragraph is always a very long line. is there anyway to keep the paragraph structure?


texts: Is there a way to automatically install the relevant package when opening an unknown file type?

texts:
Is there an automated way to discover “well-known” packages related to a given file type, e.g. scala-mode2 for Scala files, rust-mode for Rust files, etc., and install them automatically when opening a file of that type for the first time?

If several packages apply, the user could be prompted with a list of choices that she can then choose from if she so desires.


texts:
I am new to emacs. I'm trying to use cask to manage emacs packages.

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

(require 'cask "~/etsi/cask/cask.el")
(cask-initialize "~/etsi")

(require 'evil)
(evil-mode 1)

~/etsi/Cask file:

(source "melpa" "http://melpa.milkbox.net/packages/")
(source "gnu" "http://elpa.gnu.org/packages/")

(depends-on "evil")

However, it does not seem to work. For example, whenever I open a file, there seems to be no evil mode. (Yes I add cask binary to $PATH and ran cask install.)

Looking at other people's publicly available dotfiles, I see they use Cask too and do the same or similar things, so I'm not sure what I did wrong.

I also tried the following for ~/.emacs.d/init.el:

(require 'package)
(require 'cask "~/etsi/cask/cask.el")
(package-initialize)
(cask-initialize "~/etsi")

(require 'evil)
(evil-mode 1)

which also does not work.

Why?

Because I am new to emacs, perhaps I'm doing it wrong, and explaining what exactly I'm trying to achieve might bring forward a more straightforward solution.

Instead of manually M-x package-install RET <package-name> RET for each and every package, I want to simply put a list of them somewhere (in a text file), and have something automatically install them all (and take care of initalization). This is because I want to replicate my emacs setup across multiple machines, and obviously doing M-x package-install RET <package-name> RET for each package on each machine is not desirable.

I thought cask was the correct tool for this, since you can have a Cask file to list your packages. And just use the cask install command to install them. When I ran cask install, it did download and "install" (to .cask directory) evil and its dependencies. But emacs does not seem to load it?

I also tried (add-to-list 'load-path (cask-load-path ((cask-initialize "~/etsi")))) instead of (cask-initialize "~/etsi"), but that did not work either.

Is el-get the right tool for the job instead? Reading the introductory documentation, it wasn't clear that it was, hence why I chose clask, because their documentation specifically said "If you are using Cask for your Emacs configuration [...]".

Edit: Maybe I'm checking for evil mode wrong? Is there a reliable way to check for the existence of a package, i.e. whether or not it has been loaded? I'm checking for evil by just pressing j, or searching for evil mode help with C-h evil.


texts:
As described here,
by C-x z, I can repeat my last keystroke. How can I repeat my last n keystrokes?


texts: Remove the left font lock of flyspell after uncomment

texts:
I use flyspell-prog-mode, and quite often I comment a region, the source code was checked, and the font lock of dirty words will left after I uncomment the source code.

How can I fixes this? Thanks in advance!


texts:
For a given command, lets say C-c C-k, how to list the bindings of this key for all modes ?
C-h k KEY show bindings only for the current mode. It's the same for invert commands like C-h f and C-h b.
Purpose of this is I wrote a new function, usable in different modes. I want to bind it to a key, but I first want to know if it is already bound.


texts: Custom indentation for clojure macros in *.clj files

texts:
I'd like to know if there is a way to define the indentation for a custom macro within the clojure source file.  It is possible to define the indentation using clojure-mode, but as far as I can tell, it has to be done using elisp as described here.

Is there a way to do this from within a clojure source file?  For example, in an elisp source file, one can do something like

(defmacro mac (arg)
  (declare (indent 1))
  ...)

Does the combination of clojure and clojure-mode support something like this?


texts: org mode: Can't add deadline to headline (wrong number or arguments)

texts:
I have been having the following issue for a whilst now. I try to add a deadline to a headline and I receive the following error:
Wrong number of arguments: (1 . 2), 0.
Here is the corresponding backtrace:

Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 2) 0)
  #f(compiled-function (arg &optional time) "Insert the \"DEADLINE:\" string with a timestamp to make a deadline.\nWith one universal prefix argument, remove any deadline from the item.\nWith two universal prefix arguments, prompt for a warning delay.\nWith argument TIME, set the deadline at the corresponding date.  TIME\ncan either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") #<bytecode 0x1e5d005>)()
  apply(#f(compiled-function (arg &optional time) "Insert the \"DEADLINE:\" string with a timestamp to make a deadline.\nWith one universal prefix argument, remove any deadline from the item.\nWith two universal prefix arguments, prompt for a warning delay.\nWith argument TIME, set the deadline at the corresponding date.  TIME\ncan either be an Org date like \"2011-07-24\" or a delta like \"+2d\"." (interactive "P") #<bytecode 0x1e5d005>) nil)
  org-deadline()
  funcall-interactively(org-deadline)
  call-interactively(org-deadline record nil)
  command-execute(org-deadline record)
  helm-M-x(nil #("org-deadline" 0 12 (match-part "org-deadline")))
  funcall-interactively(helm-M-x nil #("org-deadline" 0 12 (match-part "org-deadline")))
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

I receive this error before I am given the option to select a date from the calendar for the deadline.
I also receive a similar error (Wrong number of arguments (0 . 0), 2) when trying to set a deadline in the agenda view, however I am able to select a date from the calendar and weirdly the deadline actually gets created. toggle-debug-on-error doesn't present a backtrace upon doing this, yet the error message above is displayed nonetheless. I provide this agenda issue in case it contains useful information, but the issue at hand is that I cannot add deadlines to headlines.

I have tried updating org-mode and the problem persists.
I am using Emacs 26.2, Spacemacs v.0.200.13 and Org Mode 9.2.6.
Please let me know if I am missing any other key information and thank you for your help.

Additional information:
Result of calling C-h f org-deadline:

org-deadline is an interactive compiled Lisp function in ‘org.el’.

It is bound to M-RET d, M-m m d, C-c C-d, and many ordinary text characters.

(org-deadline ARG &optional TIME)

:after advice: ‘org-save-all-org-buffers’

Insert the "DEADLINE:" string with a timestamp to make a deadline.
With one universal prefix argument, remove any deadline from the item.
With two universal prefix arguments, prompt for a warning delay.
With argument TIME, set the deadline at the corresponding date.  TIME
can either be an Org date like "2011-07-24" or a delta like "+2d".

[back]


texts: How to place Author and Date under title?

texts:
When exporting to html I get the following in the footer:

  Date: 10/6/18

  Author: Alan U. Kennington

  Created: 2018-10-06 Sat 14:58

  Validate

But when when I export it to LaTex the author and date are under the title as they should be. How do I fix this for html? Also, is it possible to remove the "Created" and "Validate"?


texts: Writing a complex dired function to open xterm and execute a command on all current marked files in dired

texts:
I'm trying to write a complex (to me) dired function, where I want to open a xterm window which will launch an application (fbot) with many arguments and input all marked dired files into that statement. This is based on that if I run in dired & followed by this

xterm -e filebot -script fn:amc  /home/zeltak/mounts/lraid/raid/ztmp/amc  --output "/home/zeltak/mounts/lraid/raid/ztmp/" --def @/home/zeltak/.config/filebot/Q.txt --action move --conflict skip -non-strict  --mode interactive *

It works exactly as expected. So I tried fiddling with a function based on that and this is where I am in now which doesn't seem to work:

(defun z/dired-media-filebot-xterm ()
"filebot amc interactive"
(interactive)
(start-process "xterm -e filebot -script fn:amc  /home/zeltak/mounts/lraid/raid/ztmp/amc  --output "/home/zeltak/mounts/lraid/raid/ztmp/" --def @/home/zeltak/.config/filebot/Q.txt --action move --conflict skip -non-strict  --mode interactive * &" nil "filebot" file)
)


texts: How to prompt user for a proper writable file in Emacs Lisp?

texts:
I need to prompt the user for a file which is 1) not a directory 2) if already exists, is writable.

I know I can use read-file-name, but I'm not sure how to filter out the improper files. Specifically, I need to filter out those are either 1) a directory or 2) read-only (not writable).


texts:
Using elisp, I call this function (dired "~"), for example, to get to my Home directory in dired mode. When I press RET on one of the files, I want to capture the file path and store it in a variable instead of opening the file.

In other words, if the function dired did actually return the file name of the selected file using RET, I want to do something like this:

(setq file-name (dired "~"))

Where file-name would be the full path of the file that the user selected and pressed RET on.

Any ideas?

Update:

Just a little clarification of what I wanted to achieve:

Find the function that will get me the file name from point in a Dired buffer (The answer to that is what @phils said).
Bind RET to store the file name in a variable (The answer to that was provided by @Drew in the comments of @phils answer).

Cheers!


texts: Keystroke for moving cursor to beginning/end of document

texts:
From many Emacs documentation sources, it's clear that when I have a document open, I should be able to press M-< and M-> to go to the start and end of that document respectively. Alternatively, I could press Esc, then < or > for the same effect. < and > of course stand for the left and right arrows.

I have tried these keyboard shortcuts in multiple Emacs configurations (mostly emacs24 on Ubuntu 14.04) and they do not have this effect. These keystrokes cause the cursor to move between words (from the boundaries of one word to another), rather than to the beginning/end of the document. I have tried in both the terminal and GUI versions of Emacs.

Does anyone know what the correct keystrokes are for moving the cursor to the start and end of the document?


texts: Tell Flycheck about my global variables across multiple files?

texts:
I've just started to use Flycheck to improve the quality of my code, and I am grateful that it is helping me to do that by pointing out assignments to free variables, and by identifying possibly undefined functions on the last line of the error display. (Actually, these two are Warnings, not errors.)

I would like to see no warnings in my error display, of course.

So is there a way for me to tell Flycheck about the global variables that I use on my project, and that I reference in multiple files?  I have the appropriate defvar statements in one file, but not in all files. And I don't want to put defvar statements in every file that references them (I think, unless that's really the proper Emacs Lisp way...)

And is there a way for me to tell Flycheck about all the functions (which are defined in other files) that I reference in many files? That way only the truly undefined functions will show up in the last line of the Flycheck output. (I have so many that I don't usually want to flog through the long list of functions that I already know are defined, just to find ones that are possibly not defined.

I looked at the Flycheck manual on the home website, but it said nothing about this sort of thing. Neither could I see any sort of config variables for Lisp "include" or "prefix" files where I could point Flycheck to the file containing all my defvar statements...


texts:
I use the version control system fossil. I'd like to view fossil diff's output side-by-side in Emacs. The output looks like this:

$ fossil diff
Index: test1.txt
==================================================================
--- test1.txt
+++ test1.txt
@@ -1,1 +1,1 @@
-Old text
+New text

Index: test2.txt
==================================================================
--- test2.txt
+++ test2.txt
@@ -1,1 +1,1 @@
-Old text 2
+New text 2

Is there a way to display this output side-by-side, perhaps with ediff?


texts: Downloaded 1996 Emacs (19.34), consulted INSTALL, no `configure` file

texts:
I'm trying to build Emacs 19.34 (which dates from 1996) because I'm interested in its historical behaviour.  I've unpacked the archive and read the INSTALL file.  That file seems to say that I should run the configure script in the same directory, but there is no such script.

What (probably obvious) thing am I missing?


texts: How do I open a frame at start-up when using emacs --daemon? I don't run emacs --daemon directly. Instead, I use emacsclient -c -a '' which starts an emacs-server if there isn't one running already. However, if I simply add something like (make-frame '((name . "SomeName")) to .emacs, I get an error saying Unknown terminal type. How do I fix this?


texts: How to move point to the end of another buffer, using `with-current-buffer` and `goto-char`?

texts:
I'm trying to implement «effective append» for log buffer, e.g. if a point is at point-max position then insert text and move point to new point-max, otherwise append text and preserve point position.
I though this will be very trivial code:

(with-current-buffer
  (get-buffer-create "*scratch*")
  (if (eq (point) (point-max))
      (insert "\n;; ===\n")
    (save-excursion
      (goto-char (point-max))
      (insert "\n;; ===\n"))))

However, this works as expected only if invoked in *scratch* buffer:

having point somewhere in the middle => text appended, point not moved
having point at the end of buffer => text appended, point at the end

Now if I change buffer and invoke this command again, point never goes to new point-max and always stays where it was.

Simple tests showed that if statement gives correct results always, thus it is correct branch selected. I also tried explicitly move point or do scroll in true-branch, but nothing helped:

(if (eq (point) (point-max))
    (progn
      (insert "\n;; ===\n")
      (View-scroll-to-buffer-end)  ;; not works
      (goto-char (point-max)))     ;; so does it too
  (…))

Am I missing something?


texts:
When I type C-h r I get error:

  Debugger entered--Lisp error: (error "Info file emacs does not exist")
  signal(error ("Info file emacs does not exist"))   error("Info file %s
  does not exist" "emacs")   Info-find-file("emacs")
  Info-find-node("emacs" "Top")   Info-goto-node("(emacs)")
  info-setup("emacs" #)   info("emacs")
  info-emacs-manual()   call-interactively(info-emacs-manual nil nil)

I am using Emacs 24.3 on Ubuntu 14.04. (I have installed package emacs24-common-non-dfsg.. )


texts:
emacs' GUD (GrandUnifiedDebugger) provides way to change get pdb command name by using.

 (setq gud-pdb-command-name "python -m pdb")

is there the way to do same with realgud


texts: Accessing Windows environment variables in elisp

texts:
I am looking for a way to access the value of %HOMEPATH% under Windows (or more generally, any environment variable of the form %name%).

The use case is to have a consistent init.el across multiple operating systems. In Linux and OS X, (expand-file-name "~") always gives the home folder, but the same command under Windows it returns %HOMEPATH%/AppData/Roaming.


texts: How to pass arguments to a shell script using `make-process` function?

texts:
Consider a script file: ~/project/script.sh

echo "arg 1 $1"
echo "arg 2 $2"
echo "arg 3 $3"

And elisp file that invokes it using make-process: ~/project/special-mode/special-mode.el

(let* ((script-file  (shell-quote-argument (expand-file-name "~/project/script.sh")))
       (argA          (shell-quote-argument "A"))
       (argB          (shell-quote-argument "B")))
       (make-process
             :name            "special-mode"
             :buffer          "*SPECIAL-MODE*"
             :command         `( "sh" "-c" ,script-file ,argA  ,argB )
             :connection-type 'pipe
             :sentinel   nil)))

Question

The function evaluates but the arguments to the shell script (argA and argB) are never passed.
  Any idea how to fix this?

Emacs Version

GNU Emacs 28.0.50


texts:
I'm looking for solutions/suggestions on how to delete a line not under cursor but by relative line number. For example, how to delete the line which is 5 lines after the cursor without going to it in a first place.

Emacs/Spacemacs/Evil solutions are welcomed.


texts: For posting code to stackexchange I repeatedly have to do indentation in emacs. I mark a piece of text and then do M-X indent-rigidly four times. Is there an elegant way to do this indentation of text by four blanks in one go?


texts: Spacemacs+magit+helm checkout hide branches

texts: Due to my workflow I have a lot of branches that I don't want to see in the magit helm checkout window. Is there a way to hide some branches here, preferably with a regexp?


texts: Colored completion buffer when opening files

texts:
As you all know when you hit C-x C-f and then TAB to auto-complete, an auto-completion window pops-up. But does anyone know how to get the list of files colored by type (eg. folder in blue, files in white or whatever) ? Like in the normal shell ?

Apparently it is possible to do it with Helm but I am not using helm myself (maybe I should try it though).

Thanks !


texts: What is the correct way of passing a function with a default argument to a function?

texts:
Here is the code with two things I tried as the ":filter" in ": my-pass-it-on-filter":

(defun my-pass-it-on-sentinel (proc _msg)
  "Process entire output of PROC line-wise."
  (when (and (eq (process-status proc) 'exit)
             (zerop (process-exit-status proc))
             (buffer-live-p (process-buffer proc)))
    (with-current-buffer (process-buffer proc)
      (mapc #'(lambda (x) x) (split-string (buffer-string) "\n" t))
      (kill-buffer))))

(defun my-pass-it-on-filter (filePath proc str)
  "Process each line produced by PROC in STR."
  (when (buffer-live-p (process-buffer proc))
    (with-current-buffer (process-buffer proc)
      (insert str)
      (goto-char (point-min))
      (while (progn (skip-chars-forward "^\n")
                    (not (eobp)))
        ((lambda (line) (progn ((message ">>> %s" line)) (ignore-errors line))) (delete-and-extract-region (point-min) (point)))
        (delete-char 1)))))
(make-process :name "my-proc2"
              :buffer " *my-proc2*"
              :command '("sh" "-c" "echo 1 && sleep 5 && echo 2")
              :connection-type 'pipe
              ;; :filter #'(funcall 'my-pass-it-on-filter "/tmp/mytmp")
              :filter #'(apply-partially 'my-pass-it-on-filter "/tmp/mytmp")
              :sentinel #'my-pass-it-on-sentinel)


texts: How to apply `call-interactively` to an interactive command that accepts the universal argument?

texts:
I've read the documentation on how to make interactive calls from within Elisp, but I still can't figure out how to pass the universal argument when using call-interactively on a command that recognizes the universal argument.

More specifically, I want to implement a function that, under certain conditions, should call the shell command interactively with the universal argument, so that, as a result, the prompt

Shell buffer (default *shell*):

will be visible in the minibuffer, and, once this prompt gets a response, the specified buffer will be created (if it doesn't exist already), and made the current buffer.

FWIW, I tried the following:

(universal-argument)
(call-interactively 'shell)

and

(setq prefix-arg (list 4))
(call-interactively 'shell)

...but I never saw the prompt Shell buffer (default *shell*):; instead, in all cases, the shell command ran exactly as if it had been called without the universal argument.  (I really don't know what I'm doing here, so my blind attempts above were made with conscious disregard of the documentation's prescient advice.)


texts: Create a command or key binding for closing code blocks

texts:
In AUXtex there is the key binding macro C-c ] which closes the lowest current TeX environment. For example

\begin{equation}
...

would be closed (by putting an \end{equation} on a new line after where the cursor is located) when using this macro.

I'm now trying to cobble together a major mode for editing the input files to the EPOCH plasma physics PIC code. (Unfortunately the code is only accessible to members of the group, but there is an older version of the instruction manual available.) The types of files I want to build my plug-in for are like the example inputs in section 5 of the instruction manual.

My question is should I go about to get a similar functionality as the AUCtex macro in this major mode that I'm writing. More specifically, the EPOCH input files consist of several blocks of the form

begin:xyz
...
end:xyz

which I would like to be able to close through some cunning command or key binding in my mode definition.


texts: Structures are defined using a macro, flycheck gives errors

texts:
In our source code we surround structures with a macro (MKDIFF) that serves as a flag for the Makefile system. It does not expand into anything, just a flag. Flycheck (understandably) flags these structures as errors.

Here is an example:

typedef struct {
  int x;
} MKDIFF(node_t);

So, in source code when referring to node_t, flycheck flags it as an error (a parameter list without types is only allowed in a function definition).

Is there a way to have it strip out these macros before parsing structures?

I am using irony server for C/C++ and LLVM/clang syntax checking.


texts: How to use a custom export font for a section of text in org-mode?

texts:
I am writing in org-mode and exporting to pdf via LaTeX. I am quite new to Emacs and org-mode, and not familiar with LaTeX, so I am flailing about on the following:

I would like for a small section of my text to be exported in a custom font which resides in my ~/.font directory (.ttf and .otf versions available).

Can it be done?
What tags/statements/syntax are used within the document?
Do I need to alter the Emacs setup? (My Emacs version is 24.5.1.)

There is a related LaTeX question here, but it does not involve Emacs/org-mode. The answer mentioning XeLaTeX would seem to offer the simplest route, but I don't know how to integrate this with org-mode. I had a look at org-mode's documentation about embedded LaTeX - it seems to focus on math expressions, and I remain unclear as to whether something like font changing is supported, and then how.

Thanks for any insights.


texts: Is it possible to control DTR and/or RTS for a serial process (serial-term)?

texts:
I create a serial port process with (serial-term), or the underlying (make-serial-process ...). Is it possible to control the DTR and/or RTS pins for the port from within Emacs?

Looking at the source code (version 26.2, May 2020), it looks like the answer is "no", but I'm wondering if I'm missing a general ioctl() mechanism or something else.

Context:  embedded development.  Many target devices (e.g. Arduino) use DTR or RTS for a hard reset.


texts: How can I get a custom agenda habits only view with history chart?

texts:
I have included in my org-agenda-custom-commands the following:

(setq org-agenda-custom-commands '(
    ...
    ("h" "Habits" tags-todo "STYLE=\"habit\""
     ((org-agenda-overriding-header "Habits")
      (org-agenda-sorting-stragety
       '(todo-state-down effort-up category-keep))))
    ...))

This properly displays all habit type todos I have in my agenda files regardless of their completion and due statuses. It doesn't show the history chart I see in agenda views since setting org-habit-graph-column.  How can I see that graph in this habit-only view?


texts: cc-styles c-offsets-alist setting for C++11 lambda brace indentation

texts:
I am trying to configure my cc-styles to use a single basic offset for the braces of an inline defined lambda.

I have a function template which takes a functor as an argument

template<typename Func>
void some_function(Func f)
{
    // ...
}

I am calling this function with a lambda, defined inline at the call site:

some_function([](int foo)
              {
                  // ...
              });

Notice how the opening and closing braces of the body of the lambda are aligned with the capture statement.

Our coding standards require that the braces are indented by one indent. As such, I am required to have the code look like the following:

some_function([](int foo)
    {
        // ...
    });

Question:

What do I need to specify in c-offsets-alist to get the indent I'm looking for?

Notes:

Here is the c-add-style call I'm making, in case that's of some use:

  (c-add-style "work"
               '((indent-tabs-mode . nil)
                 (c-basic-offset . 4)
                 (c-offsets-alist
                  (substatement-open . 0)
                  (case-label . +)
                  (inline-open . 0)
                  (block-open . 0)
                  (statement-cont . +)
                  (inextern-lang . 0)
                  (innamespace . 0))))


texts: A Tramp file is stuck in my buffer cache

texts:
I'm using Emacs 25.3.1 with Spacemacs 0.200.9. I have Ivy installed.

At some point in the past, I opened a Tramp session to a local machine over SSH.

Now, when I'm not on that network and I try to switch buffers (C-xb), I get a spinner

  Waiting for prompts from remote shell...

and (after I C-g or it times out) I get booted back with my ivy-switch-buffer command aborted.

Tramp prompts me to tramp-cleanup-this-connection. I can see the connection listed in tramp-cleanup-connection but I can't figure out how to actually remove it from history. I assume Ivy or ido or someone is keeping additional history, but I haven't been able to find it.

How can I actually remove this Tramp connection from history? Moreover, what's a good way to figure out who's responsible for asking Tramp to connect here?


texts:
I have some customization in my .dir-locals.el. Some of variables set there are unsafe and when I set them and visit some file in dir for the first time Emacs nicely asks me to save their name-value pairs for future use in the current session.
There is a bit different story when variable is also considered as risky, then Emacs do not offer the choice to safe them for the future use and asks for the permission every time I visit any file in dir.
I've read that it is actually desirable Emacs behavior but it's a bit impractical to me.
I want to set up some variables for my project, put .dir-locals.el on git and let others in my team use my customizatins.

Mentioned documentation claims:

  Emacs always queries before setting a risky variable, unless the user explicitly allows a value by customizing safe-local-variable-values directly.

What I've tried is:

((clojure-mode
  . ((eval . (add-to-list 'safe-local-variable-values
                          '(projectile-test-suffix-function (lambda (_) ""))))
     (projectile-test-suffix-function
      . (lambda (_) "")))))

And it has no effect - it still asks for permission every time I visiting a file in dir.

What I'm doing wrong?


texts: Installation Warning: Cannot convert string

texts:
I am installing emacs from source on Ubuntu machine. make install successfully installed it.

Now when I start emacs it is showing this warning

Warning: Cannot convert string "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" to type FontStruct

and emacs fonts looks like this

which is not as good as previous fonts

Any suggestions on how to fix this?


texts: After change to org-mode 9.1.13, TAB not work when put after `<s`

texts:
Usually, TAB after <s expand to #+BEGIN_SRC in org-mode, but today I updated my org to version 9.1.13, and TAB not work this way any more.

I don't know where to start to figure this out, but I C-h k TAB after <s and the help message is like this:

   runs the command org-cycle, which is an interactive autoloaded
  compiled Lisp function in `org.el'.

  It is bound to tab, TAB, menu-bar Tbl Next Field, menu-bar
  Org Show/Hide Cycle Visibility.

  (org-cycle &optional ARG)

  For more information check the manuals.

  TAB-action and visibility cycling for Org mode.

  This is the command invoked in Org mode by the ‘TAB’ key.  Its main
  purpose is outline visibility cycling, but it also invokes other
  actions in special contexts.

  When this function is called with a ‘C-u’ prefix, rotate the entire
  buffer through 3 states (global cycling)
    1. OVERVIEW: Show only top-level headlines.
    2. CONTENTS: Show all headlines of all levels, but no body text.
    3. SHOW ALL: Show everything.

  With a ‘C-u C-u’ prefix argument, switch to the startup visibility,
  determined by the variable ‘org-startup-folded’, and by any VISIBILITY
  properties in the buffer.

  With a ‘C-u C-u C-u’ prefix argument, show the entire buffer,
  including any drawers.

  When inside a table, re-align the table and move to the next field.

  When point is at the beginning of a headline, rotate the subtree
  started by this line through 3 different states (local cycling)
    1. FOLDED:   Only the main headline is shown.
    2. CHILDREN: The main headline and the direct children are shown.
                 From this state, you can move to one of the children
                 and zoom in further.
    3. SUBTREE:  Show the entire subtree, including body text. If there is no subtree, switch directly from CHILDREN to FOLDED.

  When point is at the beginning of an empty headline and the variable
  ‘org-cycle-level-after-item/entry-creation’ is set, cycle the level of
  the headline by demoting and promoting it to likely levels.  This
  speeds up creation document structure by pressing ‘TAB’ once or
  several times right after creating a new headline.

  When there is a numeric prefix, go up to a heading with level ARG, do
  a ‘show-subtree’ and return to the previous cursor position.  If ARG
  is negative, go up that many levels.

  When point is not at the beginning of a headline, execute the global
  binding for ‘TAB’, which is re-indenting the line.  See the option
  ‘org-cycle-emulate-tab’ for details.

  As a special case, if point is at the beginning of the buffer and
  there is no headline in line 1, this function will act as if called
  with prefix arg (‘C-u TAB’, same as ‘S-TAB’) also when called without
  prefix arg, but only if the variable ‘org-cycle-global-at-bob’ is t.

  [back]

Can you help me with where should I start to figure the problem out?


texts: How to prevent undo steps being freed while undoing?

texts:
As I understand it, undo operations (namely undo and undo-only) are regular Emacs operations which add to the undo history.

An issue with this is undoing adds to the size of the undo data, which could cause some undo data to be freed.

Is there a way to reliably pause this while the user runs undo & undo-only, restoring the normal freeing behavior once a regular editing operation runs?

Recipe that exemplifies the issue

Run the following command:

emacs -Q --eval "(setq undo-limit 1 undo-outer-limit 10 undo-strong-limit 10)" newfile.txt

Type in 8 characters over 6 lines, so the document reads.

AAAAAAAA
BBBBBBBB
CCCCCCCC
DDDDDDDD
EEEEEEEE
FFFFFFFF

Undo using C-_ until only the first line is present.

AAAAAAAA

Now try redo by pressing C-g, C-_ (keep pressing C-_).

The redo does not complete, it reaches 4 lines, then gives an error.

AAAAAAAA
BBBBBBBB
CCCCCCCC
DDDDDDDD

With the warning

Warning (undo): Buffer ‘newfile.txt’ undo info was 32 bytes long.
The undo info was discarded because it exceeded `undo-outer-limit'.

This is just to show that the undo history is freed while undoing.


texts: How to improve the performance of eshell buffer truncation?

texts:
I currently truncate buffers at 20,000 lines by adding the following to my
configuration:

(setq eshell-buffer-maximum-lines 20000)
;; automatically truncate buffer after output
(add-to-list 'eshell-output-filter-functions 'eshell-truncate-buffer)

This works great for < 20,000 lines, and once the buffer reaches 20,000 lines it
gets truncated on every line (so it sits at 20,001 lines forever). However, when
the buffer reaches 20,000 lines, each subsequent line takes much longer to be
printed and causes the CPU of emacs to sit at 100% for quite a while.

Is there a way to improve the performance of the buffer truncation? Perhaps only
truncating every 100 added lines? It's not like I really need it to be exactly
20,000 lines, I just don't want the buffer to grow infinitely.


texts:
In coq mode I have ligatures being used: instead of "fun", it shows λ in the programming code. But in the comments lambda transformed into a character I can't even copy, so I'll attach a screenshot:

Something is wrong with the glyph. What font should I set to get lambda everywhere?


texts: How to reconcile ede-minor-mode and org mode C-c . keybindings?

texts:
I have been able to setup CEDET and ede for use as a development environment, but I also am trying to use org mode.
In my cedet configuration, I have (global-ede-mode t).  When I open a .org file and try to timestamp something,Ctrl-c . is overridden by ede-minor-mode Ctrl-c . letter functions.
I can't figure out a way to disable ede mode in org-mode buffers, so to timestamp anything, I have to M-x org-time-stamp, instead of Ctrl-c ..
All my searches have not shown me a concrete way to do this.  Anyone have an answer?  Thanks!


texts: match-data fails to consider only last search with string-match and persists across sessions

texts:
Using emacs 25.3.1, I am trying to access the match data after I search a string with string-match. But the match data is wrong. To find out why I tried out the manual's simple example.

    (string-match "\\(qu\\)\\(ick\\)"
                       "The quick fox jumped quickly.")
                       ;0123456789
    (match-string 0 "The quick fox jumped quickly.")

When running this example I get the following results:

4

Debugger entered--Lisp error: (args out of range "The quick fox jumped quickly." 1513 1515)

I think this is because I used string-match on a string before executing this example. However, I expected match-data to only consider my last string-match search and return "quick".

Surprisingly, this behavior persists across sessions. If, after getting this error, I startup emacs with emacs -Q (no init file), and I paste the "quick fox" example and execute it I get the same error (with updated numbers).

I tried to reset match data myself using set-match-data, however that hasn't been working.

(match-data) ; => (1520 1520)
(set-match-data (list 0 0)) ; => nil
(match-data) ; => (1547 1547)

How can I reset the match data myself to produce expected values from string-match search?


texts: Org-mode schedule 1 event for multiple days?

texts:
I cannot find anything on being able to set TODO tasks with SCHEDULE to occur on multiple days of the week.

For example I have STAT class on Mon Wed and Fri that I would like the event to repeat every week with a +1w argument.

Is this possible or do I need to have 3 separate STAT events, each with a 1w argument in SCHEDULE?


texts: How to group digits in minibuffer when sending input to calc?

texts:
Is it possible to send something like 200*100,000 as an input to calc?

Documentation says Long numbers can be hard to read if they have too many digits. Press d g (calc-group-digits) to enable Grouping mode, in which digits are displayed in clumps of 3 or 4 (depending on the current radix) separated by commas.

When using (calc-group-digits) the digits are grouped in clumps of 3, for example the value of 200*100000 is shown as 20,000,000.
It would be great if it would be possible to also give the input in clumps of 3 separated by comma in the minibuffer. I tried 200*100,000 but it didn't work.


texts: magnifier box appears in middle of Emacs frame

texts:
This box appears in the center of my Emacs frame with certain actions.

The most reliable way to trigger it is attempting to move the cursor past the boundaries of the buffer.

It disappears after switching to a different buffer, or scrolling enough to replace all the text in view.  Marking the area also solves it.

I don't think it's an accessibility feature because of the unusual way in which it disappears.  Anyone else recognize this?

Thank you!

My version:
GNU Emacs 24.5.1 (x86_64-apple-darwin15.0.0, NS apple-appkit-1404.13) of 2015-11-30

Installed with Macports on El Capitan


texts:
I've been using Elfeed for some time, and I like it very much. However, there is one small thing I'd like to adjust. When leaving the search window (with elfeed-search-quit-window bound to q in the mode map), Elfeed leaves a trail of open buffers: *elfeed-search*, *elfeed-log* and myfeeds.org (I use elfeed-org).

I like the behavior of org-agenda-exit which checks if any files visited by the agenda have been modified, if so offers to save them, and otherwise kills them. As it turns out, this is performed by the function org-release-buffers in org.el, so I tried to adapt it for my purposes.

As I don't have a list of buffers, as Org Agenda does, I tried to use rmh-elfeed-org-files which is rather a list of files, so I employ file-name-nondirectory to get the corresponding buffer name.

My unsuccessful attempt is the following:

(defun my/elfeed-search-quit-and-kill-buffers ()
  "Save the database, then kill elfeed buffers, asking the user
for confirmation when needed."
  (interactive)
  (elfeed-db-save)
  (let (buf)
    (dolist (file rmh-elfeed-org-files)
      (setq buf (file-name-nondirectory file))
      (when (and (buffer-modified-p buf)
         file
         (y-or-n-p (format "Save file %s? " file)))
    (with-current-buffer buf (save-buffer)))
      (kill-buffer buf)))
  (kill-buffer "*elfeed-log*")
  (kill-buffer (current-buffer)))

As this is intended to be bound to the elfeed-search-mode-map the last (kill-buffer (current-buffer)) kills *elfeed-search*.

But this fails with a Wrong type argument: bufferp, "myfeeds.org" error.

What am I doing wrong?


texts: How can I redefine evil normal state Y to be equivalent to y$ instead of yy?


texts: Pass function symbol as argument via function or single quote?

texts:
Are 'function-name and (function function-name) completely equivalent, or are there conditions under which I must use the more verbose (function function-name)?

(apply 'message ( list "call func via quote"))
(apply (function message) (list "call func via function keyword"))

Both of them yield the same effect. But in many elisp libraries, i am seeing people using (function func) to pass function symbols like in this example.

(defun dired-add-file (filename &optional marker-char)
  (dired-fun-in-all-buffers
   (file-name-directory filename) (file-name-nondirectory filename)
   (function dired-add-entry) filename marker-char))

Why do people use more verbose way, when they can use just a quote?


texts: How to specify a command that should be called by #'repeat?

texts:
I want to create a command that, when you call it for the first time, it's executed normally, but when you repeat it with C-x z, some other command is executed and the original command is never called.

I tried defining it like that (I want forward-line to be called when repeating foo):

(defun foo ()
  (interactive)
  (message "foo")
  (setq this-command 'forward-line))

but M-x foo and then C-x z just displays "foo" twice and never calls 'forward-line


texts: emacs minimal install for Ubuntu server use

texts:
Is there a minimal version of emacs?

When using apt get install emacs24 on a 16.04 LTS machine the packet manager propose me to install 200 MB worth of stuff...

The following NEW packages will be installed:
  adwaita-icon-theme at-spi2-core colord colord-data dconf-gsettings-backend dconf-service emacs emacs24 emacs24-bin-common
  emacs24-common emacs24-common-non-dfsg emacs24-el emacsen-common gconf-service gconf-service-backend gconf2-common
  glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas humanity-icon-theme imagemagick-common
  libatk-bridge2.0-0 libatspi2.0-0 libboost-filesystem1.58.0 libboost-system1.58.0 libcairo-gobject2 libcolord2 libcolorhug2
  libcroco3 libdconf1 libegl1-mesa libepoxy0 libfftw3-double3 libgbm1 libgconf-2-4 libgphoto2-6 libgphoto2-l10n libgphoto2-port12
  libgtk-3-0 libgtk-3-bin libgtk-3-common libgudev-1.0-0 libgusb2 libieee1284-3 libjson-glib-1.0-0 libjson-glib-1.0-common
  liblockfile-bin liblockfile1 liblqr-1-0 libm17n-0 libmagickcore-6.q16-2 libmagickwand-6.q16-2 libmirclient9 libmircommon5
  libmirprotobuf3 libotf0 libprotobuf-lite9v5 libproxy1v5 librest-0.7-0 librsvg2-2 librsvg2-common libsane libsane-common
  libsoup-gnome2.4-1 libsoup2.4-1 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libxcb-xfixes0
  libxft2 libxkbcommon0 libxt6 m17n-db ubuntu-mono

Is there a way to get "just" the terminal based emacs?

I need to keep the footprint of the program as small as possible to avoid unnecessary maintenance to a streamlined server.


texts: Why advice won't work if the function is called from another compiled function?

texts:
Let's consider a minimal example, I take org-narrow-to-subtree as a compiled function, under the hood it calls narrow-to-region, I add simple advice to it:
(defun bark (START END) (message "Bark!"))
(advice-add 'narrow-to-region :before #'bark)

If I call narrow-to-region interactively, the advice obviously works, but if I call org-narrow-to-subtree which in its turn calls (narrow-to-region), it behaves as if there was no advice.
If re-eval the function definition (the same source as the original, only defining it again instead of using the compiled version):
(defun org-narrow-to-subtree ()
  "Narrow buffer to the current subtree."
  (interactive)
  (save-excursion
    (save-match-data
      (org-with-limited-levels
       (narrow-to-region
    (progn (org-back-to-heading t) (point))
    (progn (org-end-of-subtree t t)
           (when (and (org-at-heading-p) (not (eobp))) (backward-char 1))
           (point)))))))

and call org-narrow-to-subtree again, the advice gets called normally.

Why is that?
How do I solve my problem then? How do I add an advice?


texts: Byte-compilation of a multi-file package: "the function is not known to be defined"

texts:
Imagine that I have the following files in my (ridiculous) package:

File test1.el:

;;; test1.el ---

;;; Code:

(defvar test-var1)

(defun test-fun1 (test)
  nil)

(require 'test2 "./test2.el)

(provide 'test1)
;;; test1.el ends here

File test2.el:

;;; test2.el ---

;;; Code:

(defun test-fun2 ()
  (let ((test test-var1))
    (test-fun1 test)))

(provide 'test2)
;;; test2.el ends here

If then I run:

emacs -batch -f batch-byte-compile *.el

I get the following result:

Compiling .../test1.el...
Wrote .../test1.elc
Compiling .../test2.el...

In test-fun2:
test2.el:9:15:Warning: reference to free variable `test-var1'

In end of data:
test2.el:14:1:Warning: the function `test-fun1' is not known to be defined.
Wrote .../test2.elc

I understand why these warnings appear, and I understand that they are only warnings. However, it would be easy to miss a typo in a function name by dismissing all warnings of this kind.

I somehow thought that adding a (require 'test2) line in test2.el should fix it. However, in this case I get:

Compiling .../test1.el...

In toplevel form:
test1.el:10:1:Error: Recursive `require' for feature `test2'
Compiling .../test2.el...

In toplevel form:
test2.el:5:1:Error: Recursive `require' for feature `test1'

This is cryptic, because I thought that the point of require was precisely to avoid recursive loading. I assume that require is behaving like load during compilation time.

What is a good (and safe) way to get rid of these warnings?

The manual gives a work-around (I post it as a better-than-nothing answer below), but ultimately, I'd like the solution to be rather automatic (not requiring me to list all functions and variables that I will need in every file).

The ideal solution would be built-in in emacs or provided with Cask. If it doesn't exist, I will take what is available of course.


texts: "S" key throws error in Evil mode normal state

texts:
I really like typing in vim, but vimscript makes zero sense. Since I'm getting interested in Lisp/Clojure, and I've heard nice things about evil mode for emacs, I thought I'd give it a try.

Unfortunately I got weird behavior within moments of my first test file. I expected S to delete a line and drop me into insert mode; instead I got a "Wrong number of arguments" error and a lot of noise in the minibuffer.

I discovered that using c-h k while in insert mode will tell you what command is run by the following keystroke. Emacs tells me that S runs the self-insert-command, but googling around suggests this might be a red herring, as this command is evidently run frequently by processes and not so much by users.

How can I get the key behavior that I want?

ETA: I'm using someone else's .emacs.d. They did define a keybinding for "s-s", but the behavior persists after it's commented out. I don't know how to find if the key is defined elsewhere other than grepping for "s-s" and eyeballing the large number of results.


texts: How to have wrapped text when exporting from org to Latex?

texts:
I have an org file which I export to LaTeX and then to a PDF document. The problem is I have some long text that exceeds the length of the page. How to wrap it so that it falls into the next line?

First example:

#+BEGIN_SRC c++
<code goes here> // very long comment that doesn't wrap ........
#+END_SRC

The comment is very long and exceeds the length of the page, how to make it wrap?

Second example:

|------+------+------------------------+------|
| text | text | text                   | text |
|------+------+------------------------+------|
| text | text | very long texttt...... | text |
|------+------+------------------------+------|

Some cells contain long text which also doesn't wrap, how to make it wrap?


texts:
The answer below was taken from https://stackoverflow.com/a/44913296.
This is the most upvoted answer there.
Unfortunately, after running the code (for example by replacing q with \theta) one encounters the following error:
match-substitute-replacement: Invalid use of ‘\’ in replacement text
Moreover, if I use \\theta instead of \theta, query-replace does not work properly, it looks outside LaTeX formula as well.
Is there a way to correct the code?
  (defun latex-replace-in-math ()
    "Call `query-replace-regexp' with `isearch-filter-predicate' set to filter out matches outside LaTeX math environments."
    (interactive)
    (let ((isearch-filter-predicate
     (lambda (BEG END)
       (save-excursion (save-match-data (goto-char BEG) (texmathp)))))
    (case-fold-search nil))
    (call-interactively 'query-replace-regexp)))


texts: Choose where org-agenda-tree-to-indirect-buffer window opens


texts: is there a facility people use to export plain text to emacs orgmode as part of their research workflow to organise their links and annotations? I heard zotxt is useful, does anyone have opinions on it or of something better?


texts:
I am new to Emacs but I'm working hard to catch up :)
I try to get Emacs splits a window (with C-x 3 for example) not on the same buffer (default behaviour) but on a specific *dashboard* buffer. I've read that I have to add to my configuration file this line
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))

from the dashboard package documentation or even this line
(setq initial-buffer-choice #'(lambda () (get-buffer-create "*dashboard*")))

form this page.
I have a myinit.org file which I include from my init.el file with this piece of code to load the dashboard package :
#+BEGIN_SRC emacs-lisp
    (use-package dashboard
      :ensure t
      :init
      (progn
        (setq dashboard-items '((recents . 4)
                    (projects . 3)
                    (bookmarks . 3)))
        (setq dashboard-show-shortcuts nil)
        (setq dashboard-set-heading-icons t)
        (setq dashboard-set-file-icons t)
        (setq dashboard-startup-banner "~/.emacs.d/emacs_logo.png")
        (setq initial-buffer-choice #'(lambda () (get-buffer-create "*dashboard*"))))
        ;(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))))
      :config
      (dashboard-setup-startup-hook))
    ;(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*"))))

  #+END_SRC

None of the different options I used to place this line (as you can see with the commented lines) is working. I have even try to add this line directly to my init.el file without success. I have always the *dashboard* buffer when I open Emacs but when I type C-x 3 for example, it still opens a window with the same buffer...
Any idea about what I'm doing wrong here ?
Thanks in advance,
Sylvain


texts: How to calculate a point N lines from another point in elisp?

texts:
Given a point, how can I get the point N lines before/after it?

Will post own answer, but I'm not sure it's optimal.


texts: How can I make emacs respect "completion-ignored-extensions" when I hit TAB in the "Find File" buffer?

texts:
When I hit C-x C-f to open the "Find file" thing, I can hit TAB to open up a buffer called *Completions* that lists the possible filenames with the given prefix.

Sometimes I have a bunch of backup and intermediate files I want Emacs to ignore, but unfortunately, as explained in the documentation,:

  Emacs disregards completion-ignored-extensions when showing completion alternatives in the completion list.

So in a directory containing two files, foo and foo~, with completion-ignored-extensions set to ("~"), tapping TAB lists both in the *Completions* buffer. Is there any way to change this behavior and list only foo?


texts: Debugging with dap-mode for python and taking user input

texts:
I am trying to make dap-mode for python working on spacemacs.

For the most part I was able to get it working, but I am having issues taking in input on the CLI

def main():
  a = input(">")

The debug pane

-*- mode: dap-server-log; default-directory: "~/test2/" -*-
Debug Adapter started at Sun Jan 12 15:32:25

/Users/user/.pyenv/versions/3.7.0/bin/python -m ptvsd --wait --host localhost --port 32000  /Users/user/test2/main.py
>

Problem: can't type user input in the debug pane

I found a potential solution here, but couldn't quite get it working.

https://github.com/emacs-lsp/dap-mode/issues/169
https://github.com/emacs-lsp/dap-mode/issues/97

I tried using the configurations below on osx but get an error:

(setq dap-python-terminal "iterm ")
but I get zsh:1: command not found: iterm
and

(setq dap-python-executable "iterm")
but I get wrong type argument: arrayp, nil

also tried (setq dap-python-terminal "open -a Terminal ")

Env
osx, iterm, spacemacs/emacs, zsh, python

Note:
I know how to use pdb, but really like the dap-ui on spacemacs so I'd prefer to use that layer if I can get this one small issue sorted out.

Edit:
It has something to do with the executable of iterm on my machine

Since iterm doesn't have a default executable on osx, after some searching it looks like I had to write an osascript. I wrote one and put it on my path

osascript <<EOD
  tell application "iTerm"
    create window with default profile
  end tell
EOD

-*- mode: dap-server-log; default-directory: "~/test2/" -*-
Debug Adapter started at Mon Jan 13 22:39:29

iterm /Users/user/.pyenv/versions/3.7.0/bin/python -m ptvsd --wait --host localhost --port 32000  /Users/user/test2/main.py
window id 11705

Debug Adapter finished at Mon Jan 13 22:39:29

It starts up a new window, but doesn't go into debugging mode.


texts: org-mode: wrapping sentence with '+' symbol to strike-through easily seems not working

texts:
I've known there's similar question How to strike-through or un-strike-through a region or line in org-mode?

but no proper answer they've got yet.

I just wonder how to make wrapped word or sentence with strike-through easily in my org-mode

'*' '=' '_' symbols are working correctly with wrapped word or sentence but '+' not working which I want to use.

is there anyone who knows how to solve this problem?

Thank you!


texts: How to migrate Markdown files to Emacs org mode format

texts:
I've got hundreds of personal notes stored as files in Markdown format, after several years using the VoodooPad personal wiki software for OS X.

There's plenty of information available for exporting from org mode to Markdown, but is there an easy way to convert Markdown to org mode format?

Update

Thanks to user2619203's answer and this answer to a question on batch processing of files with Pandoc I was able to convert four hundred Markdown  files into org mode format in just a few minutes.

The solution was to export the VoodooPad document to a folder as text (File > Export Document > Export as Text...). Then call pandoc via the find command to convert them all in one go:

$ find . -name \*.txt -type f -exec pandoc  -f markdown -t org -o {}.org {} \;

The converted .org files I've looked at are formatted beautifully -- even the codeblocks and format styling. Thank-you, user2619203.

To simply convert one file from Markdown to Org the following command can be used:

pandoc -f markdown -t org -o newfile.org original-file.markdown

Here is a link to the Pandoc documentation


texts: Strategy for using Emacs as an event log?

texts:
I'd like to be able to use Emacs to track various events in my day-to-day life, such as paying a bill, going to an appointment, replacing oil, etc. The goal would be to be able to view this event in two ways: one in which I see a timeline of all events (ie, I would be able to see that on Tuesday I had my dentist appointment and changed my oil); and another which would allow me to see all events of a category (changed my oil last Tuesday, 3 months ago ,...).

My first thought was to have an "events" org file dedicated to these entries, but it would be better to have them nested under the appropriate outline header, closer to relevant information. So ideally my outline would look like:

Health

Dental

Address: 12123 asdfasdf

[2018-02-03] Cavity filling

[2018-10-03] Dental appt

Car

License: a4fg920

[2018-02-03] Purchased

[2018-10-03] oil change

..and from that be able to generate a timeline for a certain heading or for all headings.

Is this within the scope of the agenda mode, or is there some "timeline" feature that I can use?


texts: I'm trying to print the path of $HISTFILE in emacs, but it doesn't work with (getenv "HISTFILE") or (shell-command-to-string "echo $HISTFILE"). It is working with $PATH and every other variable I've tried.


texts: Can't open image inside org file: openwith-file-handler

texts:
Linux Mint 19.3
Emacs 26.1
In my org file:
* TODO Test insert image
  Test this
  #+CAPTION: This is the caption for the next figure link (or table)
  #+NAME:   Deepspace
  [[./KLOCKA6.JPG]]

* TODO Hello from this
  Hello

Org file and  KLOCKA6.JPG are in the same folder.
I want to show image inside org file. So I use command:
org-toggle-inline-images

But I get message:
openwith-file-handler: Opened KLOCKA6.JPG in external program

In my init.el file:
(when (require 'openwith nil 'noerror)
  (setq openwith-associations
        (list
     (list (openwith-make-extension-regexp '("doc" "docx" "rtf")) "word" '(file))
     (list (openwith-make-extension-regexp '("mpg" "mpeg" "mp3" "mp4" "avi" "wmv" "wav" "mov" "mkv")) "vlc" '(file))
     (list (openwith-make-extension-regexp '("pdf")) "FoxitReader" '(file))
     (list (openwith-make-extension-regexp '("bmp" "gif" "jpeg" "jpg" "png" "tif")) "xnview" '(file))
     (list (openwith-make-extension-regexp '("rdp")) "Remote Desctop Connection" '(file))
     (list (openwith-make-extension-regexp '("xls" "xlsx")) "excel" '(file))
         ))
  (openwith-mode 1))


texts: How do I turn-off smartparens when using prelude?

texts:
I find smartparens awkward. It's easier for me to type the matching paren/quote than to arrow over or C-f over. I want to turn off smartparens everywhere. I'm using prelude though and I can see that prelude turns on smartparens for a variety of the language specific packages that it uses.

Is there a way to globally turn off smartparens? I'm assuming that it goes somewhere in my personal/ directory in one of my custom init files.


texts: Manage same init file for Linux and Windows

texts:
I have an init file on a USB drive. I use this USB drive at home and at work for my init file.

Until recently, my home and work computers were both Windows machines. I am now adding a Linux machine at home and am looking for a way for Emacs to play nicely with all of the machines: Windows and Linux.

Here is an example of the major problem I see:

(find-file "E:/emacs/org/gtd.org")

Linux doesn't use letter drives? What do I do?


texts: Automatically show diff before saving file

texts:
I have a file that contains important information and I often have to make small changes in this file.  Every once in a while I accidentally change something in this file and then save it without noticing that something is missing.  What I'd like to have is that Emacs automatically shows me a diff between the buffer content and the content of the file on disk and asks me if I really want to save it.  Is there an existing solution for this?

I found highlight-changes-mode but that's not what I want.  I shows changes compared to when the mode was enabled not compared to the file on disk.  In large files, it is also difficult to spot the changes even when they are marked red with highlight-changes-mode.


texts: Can I override global-hl-line-mode in a buffer/window?

texts:
I have the following line turning hl-line-mode on globally in my init file:

(global-hl-line-mode)

Most of the time, that's how I like it. But sometimes I want to turn it off. I'd hoped that I could somehow override the global setting with a buffer-local one, by running hl-line-mode with a negative prefix argument. This does turn off the highlight for about a second, then it just comes back. I can, of course, disable global-hl-line-mode instead, but is there a way to do a buffer or window local override of this setting?

Update Kudos to @lawlist for the necessary mechanics. I bound this up in a little function and am quite happy with it.

(defun ivan/local-toggle-hl-line ()
  "Toggle line highlighting in current buffer"
  (interactive)
  (setq-local global-hl-line-mode
              (null global-hl-line-mode)))

Dedicating it to the same keybinding that iTerm2 uses for the same sort of thing ⌥⌘;


texts: I am trying to change my emacs theme to spacegray because my current one is not the most appealing but when i to M-x load-theme spacegray the theme only loads on the line numbers, and when i reload emacs with c-x c-c the previous theme comes back again.


texts: Replacing autoref command format specification in auctex's font-latex-match-reference-keywords-local

texts:
With some help I have redefined the autoref command to take an optional argument, see https://tex.stackexchange.com/questions/428229/autoref-with-optional-argument-text-in-generated-link

Now I am trying to convince Emacs/auctex to properly syntax highlight the new command. AFAICT setting it through font-latex-match-reference-keywords does not work as it is already defined by auctex itself, but actually only once auctex has recognized the LaTeX document loads hyperref.

When I M-: (setcar (cdr (TeX-assoc-string "autoref" font-latex-match-reference-keywords-local)) "*[{") in an open LaTeX source file I seem to get what I want. However, I cannot seem to get this working automatically...

I've placed the above line in a defun jk/tex-mode-hook and then added that to TeX-mode-hook

(defun jk/tex-mode-hook ()
    "Set up TeX mode (auctex)"
    (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)
    (setq reftex-plug-into-AUCTeX t
          reftex-refstyle "\\autoref")
    (setcar (cdr (TeX-assoc-string "autoref" font-latex-match-reference-keywords-local)) "*[{")
)
(add-hook 'TeX-mode-hook 'jk/tex-mode-hook)

but to no avail...

How do I evaluate the (correct) replacement command late enough to become effective in my LaTeX sources?


texts: What is the reverse command to paredit-wrap-around?

texts:
I am using paredit. Sometimes I accidentely wrap something in curly braces or I have a situation where I want unwrap something for some other reason? What ist the right command to use when undo does not work?

I am looking for a command which turns something like this:

(hello) world

into this:

hello world

while the cursor is at the front.


texts:
I'm having an annoying problem with the indentation of lists when editing documents in rst-mode. This happens in Emacs 24 (even when starting with -q), but not in Emacs 23.

For example, if my document is (where | indicates the cursor position)

* List Item|

and I then enter RET + "* Bla" + RET, I am getting this:

* List Item
  * Bla
  |

and after another "* Foo" + RET, I am getting this:

* List Item
  * Bla
* Foo
|

Surprisingly enough, I could not find any bug reports related to this. Is there anything wrong with my system? What is happening here?

In Emacs 23 the final output is as expected:

* List Item
* Bla
* Foo


texts:
I am essentially trying to build a list of strings, where each of those strings in turn are built by their own functions.

However, I get the following error when the code is evaluated:

  Wrong type argument: stringp, nil

Here is the code:

(defun mode-line-segment-git-status ()
  "Build the git status mode-line segment."
  (let (branch-name '(substring-no-properties vc-mode 5)))
  (list "Branch: " 'branch-name))

(defvar mode-line-segments nil)
(defun add-mode-line-segment (segment)
  "Add a modeline segment to the modeline."
  (setq mode-line-segments (append mode-line-segments (funcall segment))))

(add-mode-line-segment 'mode-line-segment-git-status)

(setq-default mode-line-format mode-line-segments)

What am I doing wrong?


texts: Properly exporting latex to HTML from org-mode using dvisvgm / dvipng

texts:
I need to export my org notes containing latex to HTML format. Example document :
#+latex_class: article
#+latex_header: \usepackage{chemfig}
#+latex_header: \usepackage[version=3]{mhchem}
#+latex_compiler: pdflatex
#+options: tex:t
#+date: \today
#+title: something
#+author: me

 $$U_l=\frac{-A}{6}\Bigg[\frac{2}{\alpha^2-4}+\frac{2}{\alpha^2}+\ln{\Big(\frac{\alpha^2-4}{\alpha^2}\Big)}\Bigg]$$

 $$\ce{Zn^2+ <=>[+ 2OH-][+ 2H+] $\underset{\text{amphoteres Hydroxid}}{\ce{Zn(OH)2
 v}}$ <=>[+ 2OH-][+ 2H+] $\underset{\text{Hydroxozikat}}{\ce{[Zn(OH)4]^2-}}$}$$

 $$\chemfig{C*3(---)}$$

As I am using chemfig and other packages, using mathjax #+options: tex:t (default), won't render them in the HTML page:

Now I have two methods to solve this, either to use dvipng or dvisvgm.
Using dvipng
To use dvipng, I changed mathjax to #+options: tex:dvipng, however as it can be seen, it does not render chemfig (and few other like tikz) properly (instead of 'C', there should have been a cyclopropane molecule) :

Imagemagick also shows the same behaviour. So my first question is : how can I get dvipng to render the correct output?
Using dvisvgm
Next I tried to use dvisvgm using #+options: tex:dvisvgm, and while it renders everything correctly, It also scales the images to almost the full width of the page :

However I can fix this by modifying .org-svg { width: 90%; } to .org-svg { width: auto; } in the HTML source code as mentioned here. So my second question would be : How can I implement this setting for all org files whenever I export to HTML automatically? (as doing it manually each time I export would be tedious).
My third question would be that is it possible to use mathjax for normal math and dvipng/dvisvgm for other packages like packages like chemfig in the HTML output?
Please also suggest if there is another method to achieve this..


texts: Can I turn org-mode on for a part of a buffer in another mode?

texts:
I have a python code file with a large multiline string comment that I'm using as a sort of checklist for tests that I'm implementing.

Is it possible to have just that portion of the buffer be in org mode so I can have checkboxes and heading and stuff?

python code

"""
large text block
that I would like to be
in org mode
"""

more python code implementing tests

Note that this is org that I want to embed in a python file. Not vice versa.


texts: M-x sometimes doesn't show me the right options (smex?)

texts:
This is most likely a problem with a plugin (caching options, using LRU, etc?), but I'm not good enough to really troubleshoot it. My complete dotfiles (not very extensive) can be found here

I use the following related plugins (and maybe others, but I'm not sure):

flx-ido
smex
ido-ubiquitous
ido-vertical-mode

What seems to be happening is the following:

I press C-x C-m (globally bound to 'smex)
I type lt which finds load-theme
I choose a theme
Everything works
I press C-x C-m
I type ruby
I see absolutely nothing in the list
I type C-g to get out of it
I type C-x C-m
I type ruby
I see a lot of ruby options

I should see a host of ruby-related things, including for instance ruby-mode.


texts: How to customize the sequence of commands executed by the C-c C-a shortcut (`TeX-command-run-all`)?

texts:
How do I need to set up Emacs/AucTeX, so that when I type C-c, C-a, the following sequence of commands will be run? (Note: the LaTeX file name is test.tex.)

lualatex test
makeglossaries test
makeindex test
biber test
lualatex test
lualatex test

Ideally, if one of the generated auxiliary files is already up-to-date, the corresponding line will be automatically skipped.