texts: On orgmode link- dired like open with or open in dired current link?

texts: I sometimes need to open links in org (mainly for image link) in an external editor (let's say gimp). Is there any way to do that? That is, instead of the default open link, add a open with option or if not maybe open the current link in dired? I'm using Arch Linux in case that matters.


texts: How to learn the stroke order of a kanji (or kana) character using Emacs

texts: As a devoted Emacs user and a Japanese beginner learner, I've been using the Emacs' Japanese input method quite a lot during recent months. However, I've been looking for a way to leverage Emacs' multilingual capabilities to augment the process of learning kanji signs with their rigid order of strokes.


texts: Inferior Lisp Mode vs Superior Lisp Mode

texts: Can someone explain all the differences in the various lisp modes (inferior, superior, slime, cider)?  Which came first?  Which are extra packages?  What should one use?


texts: How do I get the name of the file being executed in a perldb-mode-hook?

texts:
I've been adding some modifications to the perldb which goes through gud.  When started it calls its perldb-mode-hook so that and .perldb is where I'm working.
From within the hook I can get the buffer name which is in the form *gud-script.pl* and thus in the context of the gud comint buffer where there is no file being visited.  I could parse the file's name out of the buffer name, but it seems I should be able to get the path and name of the Perl file executed or the whole command line run.


texts:
I'm using contexts within mu4e, and I know how to add custom headers via the mu4e-header-info-custom list.
What I'd like to do, however, is to alter existing headers when replying or composing within certain contexts.
Here's one example: if I reply to a message that matches one of these special contexts, I'd like the To: header to be automatically changed to a different address, or to add additional addresses to the To: line.
Suppose the sender is sender@domain.com. If I reply to the message, I'd like the To: line to automatically be changed to:
To: newuser@domain.com

... or even perhaps to ...
To: sender@domain.com, newuser1@domain.com, newuser2@domain.com

I might want to automatically change other existing headers, as well, such as Subject:.
Is there any way to do this in mu4e?


texts: how to ignore current selection from ivy when my typed text matches one

texts:
I run into this issue from time to time when I want to create a new file but the new name matches a pattern already so my Ivy auto-complete setup will pick the matched option when I press Enter instead of just directly using the text I have entered and I am wondering if there is a solution for this that allows me to use what I have typed rather than the Ivy selected complete option.

See this example:

I have a directory with a file in it called file.txt.  Now I want to make a new file that is just called file.  So, C-f, then type file, but now Ivy has selected file.txt and I can't just create file this way by pressing enter.

Similarly, suppose I wanted to rename file.txt to file in Dired.  I have exactly the same problem:


texts: org-drill doesn't load with spacemacs configuration

texts:
I am trying to load org-drill in Emacs with spacemacs configuration.

I have added the module into .spacemacs file as:

(custom-set-variable
 ;; ...
 '(org-modules
   (quote
    (org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail org-w3m org-drill)))
  ;; ...
)

Now when I am opening spanish.org (as in instruction), I see an error in *Messages* buffer:

  Problems while trying to load feature org-drill

Does anyone know how can I fix this?

Thanks


texts: a function to org-mime-subtree then org-mime-HTMLize?

texts:
I'm trying to streamline my email-sending tasks into my org-mode workflow, and I’d like a way to quickly email a subtree to someone.

I'm trying to create a function that will:

org-mime-subtree
insert my signature (including a link)
org-mime-HTMLize

Here's what I have

(defun org-mime-subtree-and-HTMLize ()
  "org-mime-subtree and HTMLize"
  (interactive)
  (org-mime-subtree)
(insert "\nBest,\nS.\n---\n
[[http://www.newyorkwritersintensive.com/][newyorkwritersintensive.com]]")
  (org-mime-htmlize))

When I run it, I get the error "wrong number of arguments."


texts:
I can not get this package installed using package-install
solarized theme
http://melpa.org/#/solarized-theme

please throw me a bone


texts: In org-mode, what variable controls the placement of the calendar view when called from a capture template?

texts:
I have a question related to this one: when I am in a capture template (for writing a TODO task, for example) and I want to open the calendar with C-c C-s (bound to org-schedule, so that I can set a date for the TODO task), the calendar opens in a new Emacs's window that hides the original window from which I called the capture template. Often, this original window has the information I need for setting the date. Hence, the fact that the original window is hidden by the calendar is very unfortunate.

My question is: what is the variable that controls the behavior of calendar and that I can set so that the calendar opens at the bottom of the window that contains the capture template?

The answer to a similar question here works only if you start from an Org-agenda view. Then, indeed, the code in this answer opens the calendar at the bottom of the Org-agenda view. I'd rather like to open the calendar at the bottom of the window with the capture template, and I'd like this behavior to take place regardless of the location from which I am calling the capture template, which is often not the Org-calendar view.

PS: Note I am using Helm globally, and this might be altering the behavior of display-buffer-alist


texts: Emacs Consistently Crashes when Scrolling Remote Files using Tramp

texts:
Whenever I scroll using the trackpad in a remote file, Emacs consistently crashes. (Also, other things crash Emacs in remote files, but this is the most common one I've come across)

I have tried Emacs v27 and v26.3 and have seen no difference. I've cleaned up my entire init file and left only tramp in there. Here is what it looks like

;; Initialize Package Archives

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")))

(package-initialize)

;; Install Straight & Use-Package

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

(straight-use-package 'use-package)

;; Install & Configure tramp

(use-package tramp
  :straight t
  :config
  (setq
   tramp-default-host "ss_analytics"
   tramp-default-method "ssh"
   tramp-ssh-controlmaster-options ""))

Error report

https://pastebin.com/uy173Z2n

I love emacs but this is stopping me from being able to use is since 95% of my editing and compiling is remote.


texts: org-plus-contrib and org with `require` or `use-package`

texts: How can I ensure I'm downloading and using org-plus-contrib from the org-mode repository using require or use-package? Package.el downloads the package, compiles everything and then says it can't load org-plus-contrib. This thread on the mailing list discusses a similar, but inverted problem. However, if I place (use-package org ..., use-package returns t, but does so whether org-plus-contrib is installed or not.


texts: Org Mode - Reference Remote Table From a Different File

texts: I'm trying to figure out how to reference a cell from a table that is located in a different file. I know I can use remote(tablename, @1$1) to reference a remote table within the same file. Is there a similar way to reference a remote table from a different file?


texts: How to open url inside lsp-ui-doc popup childframe in browser

texts: I am using spacemacs go layer with lsp as backend with gopls. How to open the link in the childframe of lsp-ui-doc in browser?


texts:
I find a lot of questions similar to this, but not one with an answer that matches what I need.  I'm using spacemacs in evil mode, and I want "new lines" (done with RET in insert mode, or o or O etc) to either:

Just appear with no indentation at all, just like I'm used to in vim

or

Appear with exactly the whitespace prefix of the line that precedes them

How can I acheive one of these?


texts: How to check the current state in evil mode?

texts: When writing elisp for evil mode, how can you check the currently active evil state?(normal, visual, insert... etc)


texts: How to find out the name of a variable Customize is customizing

texts: I'd like to have a function that when run from within a Customize buffer will return the name of the variable that would be customized at point.


texts: Getting no-conversion (nil) encoding each time when opening a file (which should be in utf-8)

texts: I have a file which is encoded in utf-8. But for some reason, each time I open it in Emacs, I get no-conversion (nil) encoding, and all the non-ascii characters can't display correctly. If I run revert-buffer-with-coding-system and choose utf-8 then they are rendered correctly, but even if I edit and save the file this time, the next time I open it, the same problem occurs. I'm not sure what went wrong and what I should do to fix it.


texts: Paste into org-mode: utf-8-unix cannot encode \207 for á, \222 for í

texts:
I'm learning emacs (on spacemacs) and focusing on orgmode.
When I paste into an org-mode buffer from a non-english language that contains accents and other signs (in my case italian and spanish) I get:

These default coding systems were tried to encode text
In the buffer... :
utf-8-unix (2291 . 4194183) (2330 . 4194194) (2334 . 4194194) (2353 . 4194194) (2367 . 4194194) (2397 . 4194199) (2400 . 4194240) (2403 . 4194183)
(2449 . 4194204) (2463 . 4194199) (2519 . 4194198))
However, each of them encountered characters it couldn't‚be encode:
utf-8-unix cannot encode these: á í í í í ó ¿ á ú ó ...

Is there a way to convert the characters when pasting?
Thanks in advance.


texts: How can I debug my init file using information from --debug-init?

texts:
I have my emacs setup as an alias in the bashrc as

alias="emacsclient -t -s server alternate-editor="

in case this helps. The emacs version is 24.4.1 and AUCTeX is compiled from the git repo and was update just yesterday the version is 2015-04-02.

I am trying to trouble shoot an issue with emacs. When I run emacs --debug-init, I get the following message:

Debugger entered--Lisp error: (void-variable modes)
  eval-buffer(#<buffer  *load*> nil "/home/dustin/.emacs" nil t)  ; Reading at buffer position 1657
  load-with-code-conversion("/home/dustin/.emacs" "/home/dustin/.emacs" t t)
  load("~/.emacs" t t)
  #[0 "\205\262�    \306=\203�\307\310Q\202;�   \311=\204�\307\312Q\202;�\313\307\314\315#\203*�\316\202;�\313\307\314\317#\203:�\320\nB\321\202;�\316\322\323\322\211#\210\322=\203a�\324\325\326\307\327Q!\"\323\322\211#\210\322=\203`�\210\203\243�\330!\331\232\203\243�\332!\211\333P\334!\203}�\211\202\210�\334!\203\207�\202\210�\314\262\203\241�\335\"\203\237�\336\337#\210\340\341!\210\266\f?\205\260�\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
  command-line()
  normal-top-level()

When I M-x goto-char return 1657 return, it says "You can run the command got-char with M-g c" and that is it. How do I jump to position 1657 to see what the issue is?


texts: how to detect if inside a LaTeX math environment?

texts:
Q: is there a way to detect if point is inside a LaTeX math environment?

How would one detect whether point is or is not inside a LaTeX math environment, whether delineated inline by $...$ or by named environments (equation, displaymath, etc.)?


texts: Argspec or arity of a bytecode function in Emacs 24

texts:
I have code that tests the arity of a function. I use it to determine whether optional arguments added in recent versions of a package are present. It calls subr-arity for built-in functions and parses the arglist of bytecode objects and lambdas.

(defun function-argspec (func)
  (if (symbolp func) (setq func (indirect-function func)))
  (cond
   ((byte-code-function-p func)
    (aref func 0))
   ((and (consp func)
         (eq (car func) 'lambda)
         (consp (cdr func)))
    (car (cdr func)))
  ))

This has worked well up to Emacs 23. In Emacs 24.3 on Ubuntu 14.04, it's working well for some functions, but not for others.

(function-argspec 'revert-buffer)
(&optional ignore-auto noconfirm preserve-modes)
(require 'vc)
vc
(function-argspec 'vc-print-log-internal)
1283

Evidently the bytecode format has changed in a way that isn't reflected in the manual.

(symbol-function 'vc-print-log-internal)
#[1283 \301\211\302\301\211\203\211@\303!\203\304\262A\266\202\202\210\203'\305>\202*\306>??\262\2036\307\2027\310\262\311
\312\313\314\315\316
$\317"\320\321%\312\322\323\315\316#\324"\325\326%\312\327\330\315\316!\331"\332\333%\312\334\335\315\316%\336"\325\337%&\262\207 [vc-log-short-style nil *vc-change-log* file-directory-p t directory file short long vc-log-internal-common make-byte-code 1028 \304\305\303\301\205\300\302&\207 vconcat vector [vc-call-backend print-log] 12

(fn BK BUF TYPE-ARG FILES-ARG) 771 \303\300\301\302$\207 [vc-print-log-setup-buttons] 8

(fn BK FILES-ARG RET) 257 \301\302\300#\207 [vc-call-backend show-log-entry] 5

(fn BK) 514 \305\300\301\302\303\304%\207 [vc-print-log-internal]

(fn IGNORE-AUTO NOCONFIRM)] 28

(fn BACKEND FILES WORKING-REVISION &optional IS-START-REVISION LIMIT)]

How can I reliably access the argument list of a bytecode object? Just knowing the arity would do, I don't care about the argument names. More precisely, I want to know how many arguments are mandatory and how many arguments are optional, or in other terms, I want the same information that I get from subr-arity. Of course my code must cope with both old-style and new-style bytecode, so I need to know not just where to dig but also when to dig where.


texts: auto-complete twitter handles and hashtags in twittering mode

texts: Is it possible to use auto-complete with twittering-mode to complete twitter handle names and hashtags?


texts:
By default I want all indentation (when I hit the tab key) to be 2 spaces.

However, when I am editing certain Python files (where I can not mix tabs and spaces) I would like to use whatever the existing indentation is.

Every time I open a file I see Can’t guess python-indent-offset, using defaults: 4

That warning and answers like these make me think that Emacs can guess the offset.  However, when I just edited a file that uses all tabs, pressing the tab key resulted in 4 spaces.

In my init file I do have the following:

(setq-default indent-tabs-mode nil)

Can somebody tell me if I really need to install guess style mode in order to switch between tabs and spaces based on what exists in the file?

Is there another way to allow tabs (even though I have disabled them by default)?


texts: `M-f` doesn't move to next line in evil-mode

texts:
This happens on the Emacs splash page primarily. I can move back to the end of the previous line with M-b but cannot move onto the beginning of the next with M-f.

As an experiment, I'm going through and replacing some vim emulation commands in evil-mode with their vanilla emacs equivalents.

(setq package-archives
      '(("melpa" . "http://melpa.milkbox.net/packages/")
        ("gnu" . "http://elpa.gnu.org/packages/")))

(require 'package)
(package-initialize)

(require 'evil)
(evil-mode +1)

;; experiment with rebinding the normal state keys.
(define-key evil-normal-state-map (kbd "w") #'forward-word)
(define-key evil-normal-state-map (kbd "b") #'backward-word)
(define-key evil-normal-state-map (kbd "W") #'forward-sexp)
(define-key evil-normal-state-map (kbd "B") #'backward-sexp)

I noticed that M-f and M-b (and w and b) no longer move onto the next line and I'm wondering why that is. The help text for M-f seems to suggest that the value of inhibit-field-text-motion may play a role, but it's nil regardless of whether evil-mode is enabled.

M-f runs the command forward-word, which is an interactive built-in
function in `syntax.c'.

It is bound to w, M-f, ESC <right>.

(forward-word &optional ARG)

Move point forward ARG words (backward if ARG is negative).
If ARG is omitted or nil, move point forward one word.
Normally returns t.
If an edge of the buffer or a field boundary is reached, point is left there
and the function returns nil.  Field boundaries are not noticed if
`inhibit-field-text-motion' is non-nil.

Still confused, I checked the source code to see how forward-word is actually implemented and to see what variable or bit of emacs state might be changing to influence the behavior of forward-word. The source code is here https://github.com/emacs-mirror/emacs/blob/c8874e2113221a08252113b6d46ecc7066c62c8c/src/syntax.c (reproduced below for convenience).

DEFUN ("forward-word", Fforward_word, Sforward_word, 0, 1, "^p",
       doc: /* Move point forward ARG words (backward if ARG is negative).
If ARG is omitted or nil, move point forward one word.
Normally returns t.
If an edge of the buffer or a field boundary is reached, point is
left there and the function returns nil.  Field boundaries are not
noticed if `inhibit-field-text-motion' is non-nil.
The word boundaries are normally determined by the buffer's syntax
table, but `find-word-boundary-function-table', such as set up
by `subword-mode', can change that.  If a Lisp program needs to
move by words determined strictly by the syntax table, it should
use `forward-word-strictly' instead.  */)
  (Lisp_Object arg)
{
  Lisp_Object tmp;
  ptrdiff_t orig_val, val;

  if (NILP (arg))
    XSETFASTINT (arg, 1);
  else
    CHECK_NUMBER (arg);

  val = orig_val = scan_words (PT, XINT (arg));
  if (! orig_val)
    val = XINT (arg) > 0 ? ZV : BEGV;

  /* Avoid jumping out of an input field.  */
  tmp = Fconstrain_to_field (make_number (val), make_number (PT),
                 Qnil, Qnil, Qnil);
  val = XFASTINT (tmp);

  SET_PT (val);
  return val == orig_val ? Qt : Qnil;
}

So it looks like the logic that could be making the behavior of foward-word differ in evil normal state and vanilla emacs must be contained within scan-words (https://github.com/emacs-mirror/emacs/blob/c8874e2113221a08252113b6d46ecc7066c62c8c/src/syntax.c#L1417). This function is really long so I won't paste it here.

I'm wondering how exactly evil-mode is changing the behavior of forward-word and how to prevent it from doing that? It seems unlikely that messing with the syntax tables would enable or disable line-wrapping for forward-word, but I'm really not sure.


texts: Start in insert state based on minor mode

texts:
I would like the org capture buffer (which IIUC is in org-capture-mode, a minor mode) to start in insert state; It seems that both the evil-insert-state-modes variable and the evil-set-initial-state function operate over major modes (or at least, when I run org-capture after modifying the former or calling the latter, the buffer that opens up does not start in insert state).

Does anyone ahve any suggestions?


texts: helm-ag , use word at point as input conditionally

texts:
I'd like to create two keybindings for helm-do-ag-project-root or helm-project-ag

where one would have (setq helm-ag-insert-at-point nil)
and one would have (setq helm-ag-insert-at-point 'symbol)

So that I can selectively use word at-point for search.

Below is my attempt but not working.

 (use-package helm-projectile
   :ensure t
   :config

    (defun my-helm-grep-do-git-grep ()
      (setq helm-ag-insert-at-point nil)
      (helm-projectile-ag)
      )
    (global-set-key (kbd "C-c g") 'my-helm-grep-do-git-grep)

    (defun my-helm-grep-do-git-grep-at-point ()
      (setq helm-ag-insert-at-point 'symbol)
      (helm-projectile-ag)
      )
    (global-set-key (kbd "C-c k") 'my-helm-grep-do-git-grep-at-point)

   )


texts:
Code folding in Emacs

Sometimes I want to fold a block of text. In Vim you have easy folding without fuzz. Without to add any special characters like "markers" or specific regex like {{{. I would like to select a region and fold it, without messing with the structure.

When looking around, it seems there were already questions about code folding in Emacs. Someone said that there was "no perfect solution". For example, I created a clip of simple codefolding in Vim:

Vim plain folding

+ Fairly simple, select a region and fold it.
+ It's persistent. When you kill the buffer/close Vim. And reopen the file, the folds are still there.
+ You get a highlight bar, to easily see what's folded.

There are many other folding configurations for Vim. I'm happy with Emacs, but this is one thing that I miss. Other alternatives that I tried, for example HideShow:

HideShow

Evil's alternative with hide-show minor mode. I found it unusable:

- I'm not able to select a region and folding it. It folds on code blocks.

- There's no higlihgting bar or something, to attend you it's folded. You could easily miss it.

- It's not persistent. If you reopen the file, the folds are gone.

There is another package, Fold this:

Fold this

- It's a pretty alternative. However, it mess with the indentation, because the text under the fold gets placed next to the fold... (?).

- It's able to just visually select the region and fold it. But it breaks the indendation, so the overview gets messed up. Not very handy.

- There is no higlihgting bar or something, to attend you it's folded. You could easily miss it.

What's the issue?

I would like to replicate how Vim does folding. But when I searched around, it seems it's very hard to do that in Emacs. So I wonder if there something in emacs or its architecture that makes it difficult to replicate this? What are the limits?


texts: How to make private python methods the last company-mode choices?

texts:
I'm using emacs with company-mode and I'd like the 'private' methods (method that start with underline) to be shown last, since they are kind of useless for imported libraries in python. See the image:

I'd like it to be sorted like this:


texts: Is there a way to activate (inhibit-message) only for particular modes or buffers?

texts: Is there any way to turn on (inhibit-message) only for particular modes or buffers or frames or windows? (any of those would do)


texts:
Some people put one sentence or even one paragraph on one line.  When someone fixes a spelling error in such a line it is difficult to spot the change in Magit log.  How can I toggle Magit log to show me the differences at the word rather than the whole-line level?

Edit1: When I press D t or magit-diff-refine-hunk in the Magit log buffer I see no difference.  I.e., single word changes are still shown as very long red/green lines.

Edit2: The main developer of Magit does not want to add this feature.  See here for his motivation.  (This question cannot be a duplicate of another solved issue, because the current issue apparently cannot be solved within the current version of Magit.)


texts: Which mail client in Emacs can schedule mail sending to every specific mail?

texts:
In office, I need to send one mail to boss every day, every week, and every month. Usually I composed those mails every afternoon and leave them in a * send mail * buffer, and send them when I prepare to go home. Sometimes I forget to send the mail even if I finished composing them. The next day I found the * send mail * buffer and BANG I felt very upset.

AFAIK, there are several ways in Emacs to compose a mail and send a mail. Are there any methods to schedule a specific mail sending in a specific time, for example, at 6:00pm later that day? If not, how to write a function so that I can run the function for a specific mail and let them be sent at the given time?

EDITED:

This question is something different from the similar Gnus question. I want to set a different schedule for each mail to be sent.

Here I provide some pseudocode that come to my mind, but this does not works. Can anyone give me some advices? Thank you!

;; one pseudocode:
(require 'midnight)
(defun schedule-send-mail-in-current-buffer ()
  (interactive ???)
  (prompt-and-get buffer-name)
  (prompt-and-get send-time) ;; like 19:00pm
  (rename-this-buffer buffer-name)
  (bury-buffer (get-buffer buffer-name))
  ;; how to set this buffer to not-killable?
  (midnight-delay-set 'midnight-delay "19:00pm")
  (add-hook 'midnight-hook (lambda ()
                             (with-current-buffer buffer-name
                               (call-interactively 'message-send)))))

;; some similar psuedocode
(defun schedule-send-mail-in-current-buffer ()
  (interactive ???)
  ;; days hour minute after now
  (prompt-and-get buffer-name)
  (prompt-and-get minute)
  (prompt-and-get hour)
  (prompt-and-get days)

  (rename-this-buffer buffer-name)
  (bury-buffer (get-buffer buffer-name))
  ;; calc schedule-time
  (let ((scheduled-time (build-date-time minute hour days)))
    ;; if setq timer is outside defun, it works. Why cannot it work in a defun?
    (setq monthcheck-timer
          (run-at-time
           (encode-time (get-second scheduled-time)
                        (get-minute scheduled-time)
                        (get-hour scheduled-time)
                        (get-day scheduled-time)
                        (get-month scheduled-time)
                        (get-year scheduled-time))
           nil
           (lambda ()
             (with-current-buffer buffer-name
               (call-interactively 'message-send)))))))


texts: Ｗork in indirect-buffer faster than in original?

texts:
When I read the org-manual which are about 12,000 lines long,
it's slow to edit such a large file.

Then I invoke "narrow-to-substree" and read "2.Documents Structure" in a indirect-buffer.

At this moment, I feel operations smoothly than before?

Is it a illusion or reality?


texts: Alternative to `read-number' that does not truncate floating point zeros

texts:
The function read-number truncates floating point zeros; e.g., (read-number "PROMPT:  ") RET 100.00 => 100.0
I am seeking a similar alternative to read-number that will not truncate; e.g., (new-func "PROMPT:  ") RET 100.00 => 100.00


texts: char-fold-search match for German eszett (ß)?

texts:
In emacs 25.1, if I customize search-default-mode to "Char-Fold Search", then an isearch-forward for

u matches ü

and one for

o matches ö.

But what character should I type to match ß ?


texts: Avoid installing package to ".emacs.d/elpa/" directory

texts:
I install yasnippet from the repository using the package manager and I add the corresponding directory to the load path before (use-package yasnippet):

    ;; Add all subdirs in site-lisp to the load-path
    (let ((default-directory "/usr/share/emacs/site-lisp/"))
      (normal-top-level-add-subdirs-to-load-path))

but when I start emacs it installs the package (despite of the load path) in the ".emacs.d/elpa/" directory.
Is there a way to avoid it?


texts:
I am trying to export images with odt export from org-mode and to change the anchor of the image (default to-paragraph) to "as-char".
I tried the following code:
 #+ATTR_ODT: :anchor "as-char"
 [[./orgmode.png]]

And the obtained result in LibreOffice is:

The anchor of the image remains "to-paragraph". Is it a bug or a misunderstanding of the :anchor tag ?
Config: GNU Emacs 25.2.2, LibreOffice 6.0.3.2


texts: In Emacs Calc, how do I find the distance between two points (x1,y1) and (x2,y2)?

texts:
I'm trying to calculate the euclidean distance between two points (x1,y1) and (x2,y2) which is
sqrt( (x2-x1)^2 + (y2-y1)^2 )

Is there a way to calculate this easily with Emacs calc?
(I looked in the Info pages, but was not able to tell if there a way to do this easily. I can use f h to compute the hypotenuse, but I can't figure out how to use that with points, or if Emacs has any first class notion of a point)


texts:
incoming mail appears in mu4e inbox long minutes after it is there.
I can see it in the webmail service online immidiately but in emacs it doesn't show till a few minutes or even half an hour after..

my mu4e config:

(setq mu4e-get-mail-command "offlineimap")
(setq mu4e-attachment-dir  "~/Downloads")
(setq mu4e-view-show-addresses 't)

#smpt:
(setq mu4e-sent-folder "/Sent"
  mu4e-drafts-folder "/Drafts"
  mu4e-trash-folder "/Trash"
  message-send-mail-function 'smtpmail-send-it
  user-mail-address "MY@EMAIL.COM"
  user-full-name  "Adam Gefen"
  smtpmail-default-smtp-server "smtp.MYMAIL.com"
  smtpmail-smtp-server "MYMAIL.com"
  smtpmail-stream-type 'starttls
  smtpmail-smtp-service 587)

#starting mu4e in its own frame:
(defun mu4e-in-new-frame ()
 "Start mu4e in new frame."
(interactive)
(select-frame (make-frame))
(mu4e))

and my .offlineimaprc config is:

[general]
accounts = XXXX

[Account XXXX]
localrepository = Local
remoterepository = Remote
autorefresh = 5
quick = 10
postsynchook = mu index --maildir ~/Maildir

[Repository Local]
type = Maildir
localfolders = ~/Maildir

[Repository Remote]
type = IMAP
remotehost = XXXX.COM
remoteuser = MY@EMAIL.COM
remotepass = XXXXXXXX
keepalive = 60
holdconnectionopen = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt


texts:
In web-mode, the indentation after "."

var context = cubism.context()
                    .step(1e4)
                    .size(+d33.select("#using-cubism2")
                              .style("width")
                              .slice(0,-2));

I want to look like of js2-mode

var context = cubism.context()
    .step(1e4)
    .size(+d33.select("#using-cubism2")
          .style("width")
          .slice(0,-2));

Can I do this ?


texts: Close error list automatically after latex compiled successfully

texts: If I compile my latex document in auctex, an overview window of the errors pops up where I can select specific errors and jump to that source code position. However after fixing the errors and compiling successfully the windows containing error messages remain open but showing another buffer, i.e. the initial window remains splitted. How can I make emacs to close those windows automatically after fixing the errors and recompiling successfully?


texts:
I am using Emacs 23 under Mac OS X. When I open certain files I get the following error when I try to save them:

Warning: ns-convert-utf8-nfd-to-nfc unsupported under GNUstep.

insert-file-contents: Wrong type argument: char-or-string-p, nil

Sometimes the opening of new files fails with the same message. When I retry opening them, it works. I have no idea how to fix this. In general unicode works fine.


texts: What does `#[0` (hash angle bracket 0) mean in the elisp debugger?

texts:
When using the debugger
I get lines like the following in the stack trace:

#[0 "\302\303!\210\300\211\207" [describe-input-method this-command helm-mode 1] 2 "\n\n(fn)"]()

I have no clue what the #[0 notation means in this context? It seems like it is called like a function?

I tried googling, but good luck with finding "#[0" on google. Some of my best attempts was "pound-open-angle-bracket-0" or hash-angle-bracket-0, but they didn't yield anything (which this question will hopefully change).


texts: How to fix browse-url-firefox for firefox 36.0 in linux?

texts: Firefox 36.0 doesn't have -remote option, which is used in the function browse-url-firefox for system-type gnu/linux by default. How to conveniently bypass this issue?


texts:
I'm familiar with M being the modifier key in Emacs syntax but I'm reading the instructions for a package and it is telling me to prepend the modifier with A.

A-M-n

I've tried a few different things but I can't see to find what A is refering to here?


texts:
I am trying to write the following function:

(defun define-keymap-onto-keymap (from-map to-map)
  (map-keymap
   (lambda (key cmd) (define-key to-map key cmd))
   from-map))

My implementation above does not work in general, since
the key argument to map-keymap is not a key,
but an event, which is not always understood by define-key. For example:

(define-keymap-onto-keymap
 (let ((kmap (make-sparse-keymap)))
   (define-key kmap (kbd "<s-return>") nil)
   kmap)
 emacs-lisp-mode-map)
*** Eval error ***  Wrong type argument: arrayp, s-return

Also:

(define-keymap-onto-keymap
 (let ((kmap (make-sparse-keymap)))
   (define-key kmap (kbd "s-2") nil)
   kmap)
 emacs-lisp-mode-map)
*** Eval error ***  Wrong type argument: arrayp, 8388658

Is there a
function similar to define-key, which understands whatever may be
the type of key?

I am not interested in solutions like derived-mode-merge-keymaps, which use

(setcdr (nthcdr (1- (length new)) new) old)

which can result in infinite lists, and I'm not interested in a brand-new copy of from-map,
like in keymap--merge-bindings but to add
bindings to an existing to-map.

Can I just append from-map onto to-map?


texts: How can I join these two org-templates, so that the first block can be an option between the other entries?

texts:
(use-package org
  :ensure org-plus-contrib)

    (use-package org-contacts
      :ensure nil
      :after org)

(use-package org-capture
  :ensure nil
  :after org
  :preface
  (defvar my/org-contacts-template "* %(org-contacts-template-name)
:PROPERTIES:
:ALIAS: %^{hefis}
:NICKNAME: %^{hefistion}
:PHONE: %^{123-456-789}
:PHONE: %^{123-456-789}
:EMAIL: %(org-contacts-template-email)
:EMAIL: %(org-contacts-template-email)
:ADDRESS: %^{289 Cleveland St. Brooklyn, 11206 NY, USA}
:BIRTHDAY: %^{dd-mm-yyyy}
:NOTE: %^{NOTE}
:END:" "Template for org-contacts.")
  :custom
  (org-capture-templates
   `(("c" "Contact" entry (file+headline "~/org~/Gtd_mylife/org-capture_tpls/my-contacts.org" "Friends"),
  my/org-contacts-template
  :empty-lines 1))))

    (define-key global-map "\C-cc" 'org-capture)

 (setq org-capture-templates
       '(("a" "Appointment" entry
      (file+headline
       (concat org-directory "~/Gtd_mylife/org-capture_tpls/my-appointments.org")
       "Calendar")
      "* APPT %^{Description} %^g\n%?\nAdded: %U")

     ("m" "Brain" entry (function org-brain-goto-end)
        "* %i%?" :empty-lines 1)

  ;;  for todo tasks

 ("d" "Long Tail TODO Task" entry
  (file+headline "" "Tasks")
  "* TODO %?\n  %u\n  %a")

  ;; for tasks

 ("t" "Task Diary" entry
  (file+datetree
   (concat org-directory "~/Gtd_mylife/org-capture_tpls/taskdiary.org"))
  "* TODO %^{Description}  %^g\n%?\nAdded: %U")

  ;;  for long tail tasks

 ("d" "Long Tail TODO Task" entry
  (file+headline "" "Tasks")
  "* TODO %?\n  %u\n  %a")

;; for general notes

 ("n" "Notes" entry
  (file+datetree
   (concat org-directory "~/Gtd_mylife/org-capture_tpls/my-notes.org"))

      "* %^{Description} %^g %?\nAdded: %U")

;; for dreams

 ("i" "Dreams" entry
  (file+datetree
   (concat org-directory "~/Gtd_mylife/org-capture_tpls/my-dreams.org"))

  "* %^{Description} %^g %?\nAdded: %U")

;; for journalling

     ("j" "Journal" entry
      (file+datetree
       (concat org-directory "~/Gtd_mylife/org-capture_tpls/my-journal.org"))
      "** %^{Heading}")

;; for hugo blogging

       ("o" "Posts"
     (file+datetree (concat org-directory "~/blog/content/posts/my-post.org")
"* TODO %^{Description}  %^g\n%?\nAdded: %U"))

 ;; for capturing books to read

       ("b" "Book" entry (file+headline "~/Gtd_mylife/org-capture_tpls/books-to_read.org" "books to read")
      "* TODO %\\1 - %\\2%?\n%U\n:PROPERTIES:\n:NAME: %^{NAME}\n:TITLE: %^{TITLE}\n:END:\n")

 ;; for log time

       ("l" "Log Time" entry
      (file+datetree
       (concat org-directory "~/Gtd_mylife/org-capture_tpls/timelog.org"))
      "** %U - %^{Activity}  :TIME:")

 ;; for capturing chunks of webpages and/or webpages themselves with W3m or EWW

       ("w" "Website" plain
      (function org-website-clipper)
      "* %a\n%T\n" :immediate-finish t)))


texts: How to change flycheck symbol?, like spacemacs

texts: Flycheck has a symbol that tells in which line an error or warning have been encountered. I have seen spacemacs has its flycheck symbol changed. Default symbol is a double arrow; while spacemacs's symbol is a dot. I can't find a function to change it. How did spacemacs do that?


texts:
Is there any differences between the following two ways of invoking a function in the init file.

(add-hook `after-init-hook `turn-on-auto-fill)

vs

(turn-off-auto-fill)


texts: Stage changes in just the first line of hunk

texts:
Consider the following situation:

$ printf $'line1-v1\nline2-v1\n' > test.txt
$ git init .
$ git add test.txt
$ git commit -m 'Initial commit'
$ printf $'line1-v2\nline2-v2\n' > test.txt

Now, magit-status looks like this:

Head:     master Initial commit

Unstaged changes (1)
modified   test.txt
@@ -1,2 +1,2 @@
-line1-v1
-line2-v1
+line1-v2
+line2-v2

Recent commits
285d881 master Initial commit

The task is to stage just the changes in the first line. But if you try doing it the obvious way (stage the removal of line1-v1 and the addition of line1-v2), the lines end up in the wrong order in the index:

Head:     master Initial commit

Unstaged changes (1)
modified   test.txt
@@ -1,2 +1,2 @@
-line2-v1
 line1-v2
+line2-v2

Staged changes (1)
modified   test.txt
@@ -1,2 +1,2 @@
-line1-v1
 line2-v1
+line1-v2

Recent commits
285d881 master Initial commit

The obvious work-around is to edit the source file and temporarily undo the changes to line2. But, is there a simpler way, which doesn't involve editing the source file?

If Magit had a way of editing the file's contents in the index, then that would be an option - one could then simply reorder the lines after staging, or just apply the edit there directly. But there is no way to do this, as far as I can tel.


texts: How to bind a function to the Windows key

texts:
I want to bind the function evil-normal-state to the windows key on my keyboard. How do I do that? Also is there a way to bind the Fn key to other functions?

I am using Emacs 26.1 on a Linux-Mint system.


texts: Emacs doesn't recognize if file is under version control

texts:
I noticed I never see in the mode line in which VCS branch I'm currently in, when I open a file in Emacs.

So I tried it with an empty Emacs, created a folder in Eshell, called ~/foo
, and initialized Git with git init inside ~/foo.
Then I have Emacs created a buffer inside ~/foo with M-x find-file bar.txt. I saved the file, and in Eshell I did [user ~/foo] git add bar.txt.

But I don't see any VCS-related in the mode line.
When I run C-x v = Emacs tells me that bar.txt is not under version control. And the same story when I revert the buffer.

When I do the following M-: (eval (executable-find "git"), it pointed to /usr/bin/git which is correct.

Auto-revert-modedidn't help it. What else can I do in order to figure out how this issue is caused? Git in terminal tells me that bar.txt is recognized and tracked by Git.


texts: Org Mode Babel: Is there a way to assert the expected results of evaluation?

texts:
Is there a way to assert that the results of evaluating a code block with Babel are equal to an expected text? Ideally, I would use this to stop an export to PDF if one of the assertions does not hold.

This is an example on how to use the Unix command =touch=.

#+begin_src sh :exports code
touch main.c
touch lib.c
#+end_src

#+RESULTS:

After you execute those commands, you should see in your working directory the
following files:

#+begin_src sh :results raw :exports results
tree .
#+end_src

#+RESULTS:
.
|-- example.org
|-- lib.c
`-- main.c

0 directories, 3 files

#+EXPECTED:
.
├── lib.c
└── main.c

The first code block does not have any results nor any expected results; only its side effects are useful. (Incidentally, it has been evaluated, as you can see because there is an empty RESULTS section underneath).

The second code block is what I would like to have: when it is evaluated, it returns a result that can be compared with the EXPECTED block. As you can see, the results do not match because I forgot to include the org file itself and the summary line returned by tree. An export to PDF should be stopped with a message that points out the difference. If RESULTS and EXPECTED did match, then the EXPECTED block is not exported, but the rest of the file is.

Is there a way to do this with the currently available features of Org and Babel?


texts: where is emacs saving files to open after launch?

texts:
I am using Spacemacs but I think this shouldn't matter for this question.
For some reason I am not able to find the place where Emacs is storing the files to reopen after launch.
I've greped for a file it always loads and found some instances of that path in the .emacs.d/.cache folder.  I've deleted these files. Didn't work.
I even deleted the entire .cache folder. Even then the same files are reloaded after startup.
Where is Emacs saving these locations so I can delete them?
I have also not found a way to overwrite the state by deleting all buffers before quitting Emacs.
Edit for clarification:
All files being reloaded were .org files.


texts: Display a horizontal underline on every line

texts:
I recently saw this image on r/unixporn.
How can I recreate the 'notebook' effect: the broad line-height and underline of each line, but in Emacs (iiuc this is achieved using rxvt + pixmaps in Linux).


texts: Disabling quote conversion in docstrings

texts:
(defun foo ()
  "`bar'")

The ASCII quotes in this docstring are displayed as typographical quotes by describe-function.

Is it possible to have them displayed in their original form?


texts:
Here is my expression:

(setq myregexp (rx bol
                   "####"
                   (one-or-more anything)
                   "."))

This should match any string starting with "####", spanning over zero or mode new lines, and stop at the first found "." right?

This is my test buffer:

#### This.
#### This too.
#### And also
this.
#### Oh, and this too.
But not this.

And here is the fn that I use to test it:

(defun regtest ()
  "search"
  (interactive)
  (save-excursion
    (while
        (re-search-forward myregexp nil t nil)
      (message "Found [%s] and [%s]" (match-string 0) (match-string 1)))))

But here is what it returns:

Found [#### This.
#### This too.
#### And also
this.
#### Oh, and this too.] and [nil]

How can I make the regexp stop at the first found match of the last rx expression? And more generally, how to properly use anything?


texts: How can I set a key binding to run two other key bindings?

texts: Specifically, I want the binding 'C-x C-a' to do 'C-x C-s' then 'C-c C-a'. (Context: I'd like to save my TeX document, then have AUCTeX render it.) How can I do this? I don't want to map 'C-x C-a' to any specific command, or to re-bind it to exactly one other thing, which is what most of the Google results turn up.


texts: Latex preview fragment - latex error + blank square

texts:
I'm new into latex, org and latex in org so it may sounds like a total newbie question... I want to preview latex in emacs with org-preview-latex-fragment, I have followed instructions from here and trying to preview this code :

#+BEGIN_SRC late :tangle /tmp/example.tex
\documentclass{article}

\begin{document}
\[
e^{i\pi} = -1
\]

\[
\int_0^\infty e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
\]

\end{document}

#+END_SRC

but it fails with a blank square.
I have checked the log in /tmp and latex has an error but I don't know why :

File: ts1cmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions
LaTeX Font Info:    ... okay on input line 33.

! LaTeX Error: Can be used only in preamble.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.34 \begin{document}

?
! Emergency stop.
 ...

l.34 \begin{document}

Your command was ignored.
Type  I <command> <return>  to replace it with another command,
or  <return>  to continue without it.

Here is how much of TeX's memory you used:
 3089 strings out of 493055
 35108 string characters out of 6140611
 80703 words of memory out of 5000000
 6607 multiletter control sequences out of 15000+600000
 4509 words of font info for 16 fonts, out of 8000000 for 9000
 1141 hyphenation exceptions out of 8191
 27i,1n,26p,236b,50s stack positions out of                     5000i,500n,10000p,200000b,80000s
No pages of output.

I have tried to compile out of emacs and get the same message, but as it's interactive when I type  it works.
So why do I get this error and how to make it works within emacs ?

ps: if you need the full log please tell me, it's just that it is huge and  doesn't work on my google chrome.


texts: In term-mode how can I make line-mode the default

texts:
Got line-mode to work as for this: in term-mode, how do I run regular emacs commands?

Now how do I make it the default ?


texts: I'm using "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso10646-1", the same font that is used by xterm.  How can I print in this font?  It seems that, even with #'ps-print-with-faces, some other font is used.


texts: can other-buffer in split windows select a visible buffer?

texts:
I often swap 2 most latest buffers back and forth with (switch-to-buffer (other-buffer)). This works just fine in most situations.

However, when I have 2 split windows, and the other window is opening a file I would switch to using the above command, other-buffer skips that buffer and it returns the 3rd-latest buffer instead. This is quite annoying.

Is there any way to swap 2 most latest buffers regardless of what other windows are opening?


texts: New line in Title of an org-mode exported html document

texts:
I use org-mode to document stuff and usually export it to pdf (via latex) and html.

If the \\ characters are at the end of a line, it forces a newline character when exporting to both pdf and html.

But I would like to know how to force a newline character in-between a line when exporting to html. It would be helpful to have this solution so that I can have multi-line titles in html exports too.

Example:

#+TITLE: First Line of Title \\ Second Line of Title

The above exports to 2 lines in pdf export but the \\ characters are retained in html export (as they are not at the end of the line).

How can I format the title so that multi line titles export fine in both formats?


texts: How to disable $ pairing in latex-mode in Spacemacs?

texts:
When I click $ I get another matching $ thanks to smartparens. I would like to disable this behavior but keep all other matching pairs like () enabled. I tried adding this to the Spacemacs config but it doesn't work:

(sp-local-pair 'LaTeX-mode "$" nil :actions :rem)


texts: Using ggtags tag lookup along with centered-cursor-mode

texts:
I am using centered-cursor-mode to center the cursor at 10 lines above center at all times. I am trying to have ggtags respects this setup after each tag lookup.

When I have the cursor at any point on screen doing M-x recenter takes it to 10 lines above center. However, executing recenter inside a lambda doesn't have the same effect instead takes the cursor to the center.

This is my setup:

  (use-package centered-cursor-mode
    :ensure t
    :diminish 'centered-cursor-mode
    :init
    (defcustom ccm-vpos-init '(round (window-text-height) 2)
      "This is the screen line position where the cursor initially stays."
      :group 'centered-cursor
      :tag "Vertical cursor position"
      :type '(choice (const :tag "Center" (round (window-text-height) 2))
                     (const :tag "Golden ratio" (round (* 21 (window-text-height)) 34))
                     (integer :tag "Lines from top" :value 10)
                     (const :tag "10 Lines above center" (- (round (window-text-height) 2) 10))))
    ;; where the center line starts (change with C-M-0/-/+)
    (setq ccm-vpos-init (quote (- (round (window-text-height) 2) 10)))
    :config
    (global-centered-cursor-mode)
    (setq ccm-recenter-at-end-of-file  t    ;; recenter at end of file
          ccm-ignored-commands         '()  ;; Fixed hangs on big org files
          )
    (define-key ggtags-mode-map (kbd "M-.")
    (lambda ()
    (interactive)
    (call-interactively 'ggtags-find-tag-dwim)
    (recenter)))
)


texts:
I am using cperl-mode to edit Perl scripts. According to the Emacs wiki ( link ) one could use defalias to use cperl-mode instead of perl-mode. Here is an example:

$ emacs -Q -l init.el test.pl &

where init.el is:

(defalias 'perl-mode 'cperl-mode)
(defun my-test-hook ()
  (message-box (symbol-name major-mode)))
(add-hook 'cperl-mode-hook #'my-test-hook)

This gives two message boxes, indicating that the hook my-test-hook is being run twice at startup.. (I also tested this with emacs-lisp-mode (without using defalias of course) and then the hook was run only a single time, as expected.. So that was what lead me to suspect defalias was the culprit).

Why is the hook being run twice here? (I am asking because I would like to have it run only a single time if possible)


texts: I'm trying to use org-checklist. The documentation says that I should 'Ensure the org contrib directory is in load-path'. Where is the contrib directory?


texts: org-mode: List everything except certain tags in custom agenda view?

texts:
This documentation explains how to set up custom agenda views, and I understand the example code I've seen there. But there is one thing I'd like to do that might not be possible: I'd like to look over my next actions by category instead of looking through all of them at once. However, to do this I need a "miscellaneous" category to make sure I don't lose anything. This category would include all TODOs that are not tagged with OFFICE, ERRANDS, or HOME:

(setq org-agenda-custom-commands
      '(("O" tags-todo "OFFICE")
        ("B" tags-todo "ERRANDS")
        ("H" tags-todo "HOME")
        ; Here comes the part where I make up pseudocode to show that
        ; I want a list of all TODOs that do not contain any of the
        ; tags specified above:
        ; ("M" tags-todo-NOT "OFFICE" "ERRANDS" "HOME")
        ))

Is this possible using Elisp?


texts:
Q: how do I define sentence endings to be LaTeX macro-aware?

I'd like backward-sentence and forward-sentence to be smarter about LaTeX macros -- particularly \footnote -- when working in LaTeX buffers.  Consider the following snippet:

  Here's some text in a LaTeX buffer.\footnote{And here's a footnote example.  It's got a couple of sentences.}  I wonder how I can get Emacs to recognize where the sentence endings occur?

If point is anywhere in what we would consider the first sentence (ie, before the footnote), calling forward-sentence takes point not to the period immediately before the \footnote macro, but rather to the period after "example" within the footnote.  Likewise, if point is at the beginning of the second sentence in the footnote, backward-sentence takes point not to the "A" in "And" at the beginning of the first sentence in the footnote, but rather to the "H" in "Here's" in the sentence that precedes the footnote.

How can I fix the definition of a sentence to make Emacs aware of these macro-boundaries?  It looks like I would want to write a specific regexp for sentence-end, but before I start messing around with regexps, I was wondering if someone has already solved this problem.

This S.O. thread asks a related question, but the accepted answer appears to involve writing custom backward-sentence and forward-sentence commands rather than redefining sentence boundaries per se.


texts: Emacs not prompting for password when opening gpg file

texts:
I'm trying to get started with encryption on emacs and I'm experiencing the same issue as mentioned in this question:Emacs opens gpg file without asking for passphrase. When I save a .gpg file, emacs prompts for the password to use, but then I can open the file (even after closing and reopening emacs) without re-entering the password. Unlike the user in the question above, there are no stored passwords in the password manager.

edit: forgot to mention that epa-file-cache-passphrase-for-symmetric-encryption is nil


texts: how to get buffers (not just files) to honor auto-mode-alist?

texts:
Q: how can I get new buffers to honor the mapping in auto-mode-alist?

When finding a file, Emacs compares the file extension to the auto-mode-alist to determine which major mode to use for the file's buffer.  Is there a way to use the information in auto-mode-alist to determine the mode for a buffer that does not (yet) have a file associated with it?

That is: if I open a new buffer whose name has something that looks like a file extension, can I get it to open automatically in the expected mode?  For example, if I were to open a new buffer a-new-buffer.el that is not yet associated with a file, I want it to open in emacs-lisp-mode rather than in the default mode.


texts: Weird reformatting, cannot tell what is responsible

texts:
In my code I have bindings for two reformatters that are supposed to be applied upon saving relevant code:

(add-hook 'tuareg-mode-hook (lambda ()
    (add-hook 'before-save-hook 'ocp-indent-buffer
    (merlin-mode))))

(add-hook 'reason-mode-hook (lambda ()
                (add-hook 'before-save-hook 'refmt-before-save)
                (merlin-mode)))

Yet for some reason my code is getting formatted weirdly at times (and not just the OCaml/ReasonML, my Emacs Lisp code can get formatted really weirdly. I'm not sure what triggers the weird formatting; usually it's after I delete something or paste something in.

Here is an example of normal formatting:

And here is an example of the weird formatting:

I wish I had the braincells to save the message log so I could post it here but I forgot to. It happens every few hours; if it happens again I will post my messages buffer here.


texts: edit search string and begin search from current location

texts: I use C-s to start an incremental search. Sometimes I want to change the search string and either restart the search entirely from the beginning of the document or (other times) just change the search string and proceed from current location. How does one do this?


texts: Mode-line always shows [Compiling] after compile a tex file with typos

texts:
For some special tex with typos, mode-line always shows [Compiling] even if we correct all typos.
To reproduce
First compile the following correct tex by C-c C-a
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\begin{figure}[h]
  \centering
  \begin{tikzpicture}
    \draw[fill] (-1,0.67) circle [radius=0.03] node [above] {\small local maximum point};
  \end{tikzpicture}
  \caption{local maximum}
\end{figure}
\end{document}

Then replace the word circle by cicle and compile the wrong tex by C-c C-a.
Now the minibuffer will show

error in process sentinel: epdfinfo: Error opening d:/test/aa.pdf:Failed to load document

and the mode-line will show [Compiling]

Now even if I correct the typo cicle, the status [Compiling] stays.
My Question: Is there some way to correct the status [Compiling] after correcting tex file except restart emacs?


texts: Autoloading defcustoms: good practice or not?

texts:
In my init file, I often find myself trying to set a customizable variable before the file (usually a mode of some sort) is loaded. This, of course, results in an error.

While this problem could be addressed through use-package and other means, it seems that making autoloading customizable variables should be a general good practice.

Customizable variables are by definition part of the user interface of a package. Packages tend to autoload functions (e.g. foo-mode) that users are expected to invoke directly--why not customizable variables as well?

Is there any problem with autoloading customizable variables?


texts: magit log view showing summarized diffstats inline?

texts:
I'm hoping to see summarized diff stats (number of files changed and total insertions/deletions) inline in the magit log view.

Currently if the diffstats option is enabled the log is rendered with each commit spanning multiple lines like:

* 17ec06b dotemacs move media bindings
|
|  .emacs.d/ebpa.org | 18 +++++++++---------
|  1 file changed, 9 insertions(+), 9 deletions(-)
|

I'm curious if it is currently possible to see/add summarized diff stats inline with the commit message.  Perhaps as an additional column like this:

* 17ec06b dotemacs move media bindings                         (1 file, +9, -9)

The compactness would help in visually scanning the log to identify commits which should be rebased.

Judging from the discussion on Magit log dates I'm guessing this is not easily done yet.


texts:
I want to perform a variant of anchored font lock matching. I have function definitions that start with a list of names, and I want those names to be highlighted inside the function body.

I have created a function that does this and registered it as a jit-lock function with jit-lock-register, however, performance is pretty poor and scrolling lags in larger files.

How can I measure performance? If I just time calling my function on a large file (with float-time before and after or with elp) I get wildly varying performance, it takes anything from 0.65 to 12 seconds. Is there a recommended way to benchmark font lock performance?
Is there any difference in performance between an anchored matcher defined in font-lock-keywords and adding a function via jit-lock-register?

Edit: It seems that the variability in performance is related to garbage collection, invocations of my jit-lock function get successively slower with each invocation until garbage collection is run, at which point they get fast again.


texts:
I know this has been asked many times, but the answers don't seem to do it for me.

How do you get Flyspell to work with hunspell?

After installing the hunspell executables via mingw-64-hunspell using MSYS 2 and adding dictionaries, I can successfully check words with the from MSYS shell like so:

$ echo baddword | hunspell -d en_US
Hunspell 1.4.0
& baddword 1 0: broadsword

On emacs i set the following in my config (.spacemacs dotspacemacs/user-config)

  (setq ispell-dictionary nil)
  (setq ispell-program-name "c:/msys64/mingw64/bin/hunspell.exe")
  ;; "en_US" is key to lookup in `ispell-local-dictionary-alist`, please note it will be passed to hunspell CLI as "-d" parameter
  (setq ispell-local-dictionary "en_US")
  (setq ispell-local-dictionary-alist
        '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8)))

Saved the config and restarted the program. When I type nonsense words, nothing is highlighted. However, I can do spell-check via the spell check buffer command. The bizarre thing however that this command only worked a couple of times and only on the .spacemacs file. Whenever I open a new empty buffer, it complains that it "can't open affix or dictionary files for dictionary ENU". I never specified an "ENU" dictionary anywhere, so that's not surprising. Also it starts a new "ispell process" every time I open a new file, which slows down performance by about 5 seconds.

TL;DR: how do you get a working spell checker that behaves like the spell-checker in your browser?

more on spell-checking in spacemacs, though I don't see any useful info there

Update

I used a slightly different config before that and it worked with warnings. After adding DICTPATH and the this code to init, everything works well.

  (setenv "LANG" "en_US, ru_RU")
  (setq-default  ispell-program-name "c:/msys64/mingw64/bin/hunspell.exe")
  (with-eval-after-load "ispell"
    (setq ispell-really-hunspell t)
    (setq ispell-program-name "hunspell")
    (setq ispell-dictionary "en_US,ru_RU")
    ;; ispell-set-spellchecker-params has to be called
    ;; before ispell-hunspell-add-multi-dic will work
    (ispell-set-spellchecker-params)
    (ispell-hunspell-add-multi-dic "en_US,ru_RU"))


texts: Using 'package as a filename in a declare-function statement?

texts:
I just saw this line near the top of the file use-package.el:

(declare-function package-installed-p 'package)

How can 'package be a useful 2nd argument, when the doc for declare-function says that the third argument should be a filename?


texts: What's the most reliable way to get the start and end positions of current symbol under cursor?

texts: What's the most reliable way to get the start and end positions of the symbol at the cursor location (point)?


texts: AucTeX multiple master files in same directory?

texts:
I have two master files in the same directory, one "main.tex" for the main document (includes several files through \input) and "test.tex" which I use to compile just a section at a time for testing.

Even while the footer of "test.tex" says

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

When I hit C-c C-c (TeX-command-master), it compiles "main.tex". How can I get it to compile "test.tex"?


texts: package status in *Help* doesn't refresh after install

texts: I've noticed that since updating to Emacs 24.4, installing packages doesn't refresh their status after installation. If I install, it still appears available to install. How can I force it to refresh?


texts: Can I make a function non-interactive after it's been defined?

texts:
I'm defining a minor-mode not meant to be interactively activated. I'd like to use
define-minor-mode because it's very convenient, but the downside is that it always sets
the mode function as interactive.

Is there a way to make an already-defined command non-interactive?


texts: Is it possible to disable suspend output when Ctrl-z pressed in Emacs?

texts:
When I suspend emacs (clicking ctrl-z) I get following output on the terminal:
[4]  + 7317 suspended  emacs -nw -q file.py, I was wondering is it possible to prevent this output to printed.
I tried stty susp undef but it didn't help.
@disabling job control in bash (CTRL-Z) mentions emacs should be reconfigured individually for this.

stty susp undef will disable the keyboard-initiated suspend signal
for most programs, however commands like vim and emacs that have
specific bindings for Ctrl-Z will have to be reconfigured
individually.

Also I set set +m as advices in this answer, after pressing CTRL+z inside emacs, shell gets frozen and I cannot close it even using CTRL+c


texts: How to include rendered HTML in org mode?

texts:
It looks like this question was asked in this thread, but was not resolved. I hope it doesn't sound redundant, but it seems there must be a way to accomplish this in org mode.

In my example, I am testing the include with an HTML footer. The footer contains the basic information:

This is the footer.

You can put stuff here.

Included in the org mode file thus:

#+INCLUDE: "footer.html" html

It displays like this after HTML export, in the final HTML document:

This is the footer.

You can put stuff here.

I am using org mode version 9.0.3.

Perhaps INCLUDE: is the wrong way to go about accomplishing this?


texts: Combine find file at point and find file in project

texts:
I'm very new to customizing Emacs, and haven't written Elisp commands before.   I'm struggling to find a command and key binding that combines find-file-at-point and find-file-in-project (or similar), perhaps a:

M-x find-file-in-project-at-point

such that given a file/folder structure:

├── main.txt
├── file1.txt
└── somepath
    └── file2.txt

where I'm editing main.txt

% cat main.txt
line 1 file1.txt
line 2 file2.txt

and a shortcut will find file2.txt when my cursor is somewhere on the text of file2.txt - despite it being located in ./somepath/file2.txt.  It would be safe to assume to start the search relative to main.txt.  Ideally, open the file if only 1 match is found, otherwise list possible choices in minibuffer.

I have had success opening file1.txt from main.txt OK, even w/o confirmation with this pretty neat command.

I'm typically not dealing with a  "project" (.git) folder structures,  & folder/file structure isn't that large where an overly complex package is needed (where it might to run/index in background).

My apologies if I missed an obvious solution.

Other commands & packages functions that appear useful, but I don't have the expertise to combine them in the way I want:

Macro to open the file path under cursor without confirmation.
FFAP: find-file-at-point
FFIP: find-file-in-project
ivy, swipe, counsel
projectile
directory-files-recursively

Any advice?


texts: How can I make source block in org mode to be scrollable?

texts:
As the title says, I'm trying to make the source blocks, when export, to be scrollable (e.g. vertical) so that the long source blocks don't mess up with the rest of content and the html/pdf files look neat in this way.
After doing some research, I've found a html way to do it, a little bit ugly, by adding html export block before the coding block
#+begin_export html
<pre style="height: 300px; overflow: scroll;">
#+end_export
#+begin_src python
very very long long source code
#+end_src

It exports as like

Which looks like nested blocks, but what I want is to make the source block can scroll itself.


texts: Is it possible to auto select the mode depending on where the file is?

texts:
One can use auto-mode-alist to define modes based on the regex and the filename. However I want to use different modes for files depending on which folder they are in.

So, for example, in a django project, I might want to use web-mode for *.html files, but in all other projects, I would want to use the default mode for *.html files.

How can I configure emacs to do this?


texts: How can Emacs number the sentences in a text?

texts:
I am analysing text with respect to its argument structure (conclusion supported by reasons, each supported by evidence). During this analysis it would have been very usefull to have each sentence numbered, for easy reference. Hence, I need a function that EITHER inserts an number at the start of each sentence, with the number surrounded by brackets or symbols clearly distinguishing it from the rest of the text, OR insert the sentence number(s) for each text line in the margin of the text.

Any idea of how I could number the sentences in a text?

Thanks for any suggestions or tips!


texts:
If i have a writable buffer, i can use this to insert hyperlink.

(require 'button)
(insert-button "foo" 'action (lambda (x) (find-file "~/test.py")))

But i have to add clickable text property to a piece of text in read only buffer. I am trying this

(add-text-properties
 1
 50
 '(lambda (x) (find-file "~/test.py")))

But it is throwing this error

Debugger entered--Lisp error: (error "Odd length text property list")

Any suggestion to solve this?


texts:
This is how I attempted to install the package:

I ran the command list-packages and then tried to install the auctex package in package mode. This was the line showing auctex entry in package mode:

  auctex             11.88.2      available  gnu        Integrated environment for *TeX*

Now when I try to install that, I get this message:

  package--check-signature: Failed to verify signature
  auctex-11.88.2.tar.sig: ("Bad signature from 474F05837FBDEF9B GNU ELPA
  Signing Agent ")

How do I fix this ? Any other method to install auctex is also welcome.


texts: How can I exit helm grep and return to helm window?

texts:
I've bound C-c C-f to helm-find-files. Since I am still getting used to helm, when looking at a file listing, I instinctively invoke C-s (which starts helm grep in a helm session but starts search in dired-mode) to let me type part of the desired filename to bring the mark to the desired file. I know that I should instead simply start typing to do so instead of pressing C-s.

But once I've entered helm grep, I don't know how to leave it other than C-g, which drops me out of helm. I'd like to simply return to the helm find files screen, since I may have navigated to a different directory, but I haven't found the key combination to do so. Resuming helm (helm-resume) after quitting just brings me to the helm grep screen.


texts: Looking for some data structures for elisp, I came across this. But then this warns me off -- without specifying exactly what replaces elib. So where do I get packages to do doubly linked lists?


texts:
I love org-mode. It's main reason why i switched from vim.
It's really interesting to write reports using Literate Programming.
I try to use TODO, agenda etc. to be more productive.

I was able to make it nice, and clean with org-bullets and other fancy stuff...

...but there is one thing left - encoding. I really want to use UTF-8, so i have something like this:

#+BEGIN_SRC emacs-lisp :tangle yes
(setq utf-translate-cjk-mode nil)
(set-locale-environment "pl_PL.UTF-8")
(set-language-environment 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(unless (eq system-type 'windows-nt)
  (progn
    (set-selection-coding-system 'utf-8)
    (set-keyboard-coding-system 'utf-8-mac)))
(prefer-coding-system 'utf-8)
#+END_SRC

And it works in most cases. But when I use for example Deadline or Timestamp, and it's Wednesday (in polish Środa) i got this:

DEADLINE: <2016-05-18 \234r.>

It should be

DEADLINE: <2016-05-18 śr.>

Because there is \234, Emacs can't save buffer as utf-8.

So. My question is:

how to setup Emacs to use english locales.
or how to setup Emacs org-mode to use utf-8 "ś".

I use GNU Emacs 24.5.1 (x86_64-w64-mingw32)


texts: How can I make emacs support javascript ES6 template string literals?

texts:
I want to use ES6 template string literals e.g.:

`string text line 1
 string text line 2
 string text ${expression}`

However emacs doesn't recognize that their contents are a string, so syntax highlighting, indentation, etc. don't work. How can I tell emacs that backticks are string delimiters?

I'm using emacs version 24.5, and the built in js-mode.


texts:
I am new to spacemacs. I want to install the shell layer. The official page of spacemacs regarding the layer, https://github.com/syl20bnr/spacemacs/tree/master/layers/%2Btools/shell, says

  To use this configuration layer, add it to your ~/.spacemacs. You will
  need to add shell to the existing dotspacemacs-configuration-layers
  list in this file.

I just don't see how to realize this step.  In my .spacemacs file, I have uncommented these lines:

(shell :variables
             shell-default-height 30
             shell-default-position 'bottom)
     spell-checking
     syntax-checking
     version-control
     )

However, there is still little syntax highlight in my shell, invoked with M-x shell. Also, the directories are not aligned in the shell. Any idea?


texts:
If I have an org-mode file where I want to embed a TikZ rendering at a certain place, I've found the simplest is just to throw something like this in where you want it, i.e., no code block necessary:

\begin{figure}
    \centering
    \newlength\figureheight
    \newlength\figurewidth
    \setlength\figureheight{6cm}
    \setlength\figurewidth{8cm}
    \input{x2vxlogx.tikz}
    %\caption{A graph}
    %\label{fig:graph}
\end{figure}

Works just fine. But in order to have it work, I've had to change my file headers, i.e., before I had

# this makes MathJax work, but the tex code import not
#+OPTIONS: tex:t

versus

# This makes MathJax not work, but the tex code import work
#+OPTIONS: tex:imagemagick

Is there anyway to get both, i.e., have my math done by MathJax and my tikz file import work too? I could leave it with #+OPTIONS: tex:imagemagick, but then my math formulae are done as little pngs, which line up poorly on the page.


texts:
Having trouble here, not sure why.

Emacs v25.3.2
Org v9.1.1

In my emacs init file:

(setq org-tag-alist '(("@crypt" . ?c) ("@init" . ?i)))

(require 'org-crypt)
(org-crypt-use-before-save-magic)
(setq org-tags-exclude-from-inheritance (quote ("crypt")))
(setq org-crypt-key nil)

A heading in xyz.org file:

* Test :crypt:
This is not encrypted, even after I save and reopen the file.

I can't get things at the heading level to encrypt. I even generated gpg keys and substituted public key in (setq org-crypt-key xxxxxxx). What am I missing?


texts: Is it possible to add my personal custom list of words to the company database. Kindly  guide me in a simple way. I am not a programmer.


texts:
In Emacs, I don't want the *Completions* buffer to pop up, even when I press tab to autocomplete in the minibuffer and there are multiple results.
It's distracting and jarring.

How can I do this?

Even better, I would like an alternative that isn't distracting or jarring -- such as requiring one tab for autocomplete if available, but requiring two tabs to open a Completions buffer. This way, I don't get the Completions buffer when I'm expecting an autocomplete. This is what the OS X terminal does to show tab completion possibilities.

I think the cause is the minibuffer-completion-help  command, which is run automatically, described here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-Commands.html

I use ido and smex, but the problem occurs in a vanilla Emacs too.

EDIT: I found a hack to fix this. Using M-x find-function, I found and copied the function definition of minibuffer-completion-help into my .emacs.d/init.el file. Then, I renamed the version I copied my-minibuffer-completion-help and changed (with-displayed-buffer-window *Completions* to '(with-displayed-buffer-window *Completions* (putting a quote in front so it is just interpreted as a string. Finally, I overrode the call to minibuffer-completion-help by putting

(advice-add 'minibuffer-completion-help
        :override #'my-minibuffer-completion-help)

after the my-minibuffer-completion-help function in my .emacs.d/init.el file. There must be a better way.

EDIT 2: quoting out (message "Making completion list...") in my-minibuffer-completion-help has the added benefit of getting rid of the flicker in autocomplete that is caused by flashing another message during autocomplete. Is it possible to do this another way?


texts: Run elisp from command line in running emacs

texts:
How can I execute elisp in the currently running emacs from the command line?

The following command echoes 'hi' but doesn't set 'abc in the emacs instance.

emacsclient --no-wait --eval '(message "hi") (setq abc)'

Is there a way to modify emacs from the command line?

My specific use case is to revert all buffers with a shell command.


texts: Use pylint3 for checking Python 3 code using flycheck

texts:
By default, flycheck uses pylint for checking python code. However, the pylint program on Debian/Ubuntu is for checking Python 2, not Python3 (there is instead pylint3 for Python3).

How do I configure flycheck to use pylint3 instead of pylint for checking Python3 code?


texts: Set 24-bit colors terminal (Truecolor) for Solarized theme on Mac

texts:
I am trying to get Solarized theme color correct in terminal by enabling truecolor on my Mac, following the instruction from Spacemaces:  https://github.com/syl20bnr/spacemacs/wiki/Terminal.

But I got error when I set TERM=xterm-24bit:

$ TERM=xterm-24bit
zsh: can't find terminal definition for xterm-24bit

I also tried to put compiled terminfo into /usr/share/terminfo, not working.

I also tried to set TERMINFO to $HOME/.terminfo, not working.

I am using iTerm2 3.2.1, Emacs 26.1, macOS 10.14 and Spacemacs.


texts: Display time of "You can run the command ... with ..." minibuffer hints

texts:
I type in, for example, M-x occur and it says You can run the command occur with M-s o.

How can I make that last hint display for more than one second?


texts: How to insert a template of text in an org file

texts:
I have a couple org files I use for meeting notes.  The meeting note structure follows the same general pattern (slightly different for the different types of meetings).  I can always manually copy a template from a template file, or copy from the previous meeting and delete/replace text as necessary.  But, I'm being lazy about this and would rather insert a template by creating a shortcut.  That said, I cannot figure out how to get emacs to insert the text.  I know nothing of lisp, so I'm having difficulty starting.  How would I insert the lines below at the current cursor position in my org file (this is not the actual template, just example lines; if I can get these lines to work then I can do the rest of the template)?
* Attendants
* Updates
* Notes


texts:
I'm having difficulty to call a function passed as an argument.
Why the following snippet doesn't work, and how can I make it work?

lexical-binding is set to t

(defun on-success (data)
  (print "This works!")
  (print data))

(defun send-req (url callback)
  (request url
   :success (function*
             (lambda (&key data &allow-other-keys)
               (print (type-of callback)    ; <- this prints 'symbol', without lexical binding it would be nil
               (funcall 'callback data)))))

(defun foo ()
  (send-req
   "https://google.com"
   'on-success))

(foo)


texts: Make org-drill allow reviewing "empty" cards

texts:
I'm trying to use org-drill with cards made up of one-line headings, which the documentation considers an "empty card" (that is, one without a body).

The recommended way to make them show up in drill sessions is to add an empty comment to the body, like a line with only #. It works, but I'm trying to fix this in a way cleaner than mass-editing my org file.

I found the variable org-drill-card-type-alist, whose default value is

      '((nil org-drill-present-simple-card)
        ("simple" org-drill-present-simple-card)
        ("twosided" org-drill-present-two-sided-card nil t)
        (...))

The t at the end of the twosided sexp means drill-empty-p, which means:

  When supplied, DRILL-EMPTY-P is a boolean value, default nil.
  When non-nil, cards of this type will be presented during tests
  even if their bodies are empty.

This seems to be exactly what I want, so I set the nil (default) and simple (for good measure) card types like this, using customize-set-variable:

      '((nil org-drill-present-simple-card nil t)
        ("simple" org-drill-present-simple-card nil t)
        ("twosided" org-drill-present-two-sided-card nil t)
        (...))

I eval the sexp / restart org-mode / restart Emacs, and still M-x org-drill ignores the empty cards.

Am I doing something wrong? Is this a bug? Are there any workarounds?


texts: grep/ag/etc results buffer: how to strip leading whitespace?

texts:
I'm using ag.el as a front-end for the ag search utility. The results are displayed in a compilation buffer in the form <file>:<line>:<column>:<matching-text>. The matching-text includes leading-whitespace, and this makes the results harder to scan visually, in my opinion.

I dug around in the bowels of compile.el and ag.el hoping to find a way to strip the leading whitespace, but came up empty. Is there a way to accomplish this?

An example of search results in Emacs:

The same results in Vim (note the stripped whitespace):


texts: how to helm-projectile-grep for exact string?

texts:
How can I direct helm-projectile-ag and helm-projectile-grep to search for an exact string?

If I enclose a string in quotes, I get no results. If I don't, I get fuzzy matching.


texts: Why can't I remap the laptop fn key modifier?

texts:
I've remapped the laptop key fn to Hyper using:

(setq ns-function-modifier 'hyper)

to scroll other window I set

(global-set-key (kbd "H-n") 'scroll-other-window)
(global-set-key (kbd "H-p" ) 'scroll-other-window-down)

H-n works but H-p inserts a * char instead of scrolling down.

M-x scroll-other-window-down works fine, only the mapping does not.


texts: Filter out special buffers in buffer list

texts:
When I used vanilla Emacs,

C-xC-bT

showed me the list of files I had open, with special buffers filtered out.

Recently I switched to Emacs Prelude, which uses ibuffer, and I'm not sure why the letter T trick won't work.


texts: Org mode initial visibility with #+STARTUP

texts: What is the meaning of the possible values for #+STARTUP?


texts: org-babel - Use specific python path and command line option

texts:
Since different python version installed on my system, how can I use specific python and option to run it?

For example,below test.py file will print hello output.

#!/opt/anaconda3/bin/python --myoptions
print("hello")

I want to get a equivalent by org-babel, maybe something like below:

#+BEGIN_SRC python :results :cmd /opt/anaconda3/bin/python :option --myoptions
print("hello")
#+END_SRC

Do we have such option to config that?


texts:
I am coding in Node.js, each time I want to write something that looks like this:

const product = Factory
  .model('App/Models/Product')
  .create()

I get this as an output:

const product = Factory
      .model('App/Models/Product')
      .create()

And I delete back the space before the last line, and then I press Enter to continue coding, the last line jumps right again as this screenshot shows:

Adding (setq-default indent-tabs-mode nil) in my ~/.emacs file does not help.

What settings should I add for my Emacs to avoid this?


texts: File and directory autocompletion in remote shell

texts: In my local shell, completion-at-point after cd returns a list of directories. However, when I ssh into a remote, Emacs thinks I'm still in my local home directory. How can I configure Emacs to give me remote directory autocompletion?


texts: Assign default priority cookie to captured tasks

texts:
I looking for a way to explicitly add priority cookies to tasks created via org-capture with default the cookie that represents org-priority-default. This is to avoid the situation that some tasks rely on default priority that may change over time, rather than the one attached at the moment of their creation.
This should be possible to be achieved using ‘%(EXP)’ in org-capture-templates, by taking org-priority-default and converting it to cookie representation.
How the org-capture-templates should look to work like that?


texts: How to insert date into minibuffer, or how to create a new file with date as part of filename?

texts:
shell way:
touch testfile-`date +%Y-%m-%d`
emacs way? c-x c-f testfile-... now what?
I want to type the first part of the filename myself, but not the date.


texts: ido-read-directory-name does not show matches in minibuffer

texts:
I'm trying to read a directory path using ido-read-directory-nameto prompt in the minibuffer. I have (ido-everywhere t)and (ido-enable-flex-matching t) enabled, and I'm running emacs 24.5.1.

I expect ido-read-directory-nameto behave like ido-read-file-name, by showing all possible flex matches in the minibuffer. I expect it to show me ONLY directory name matches (not file name matches), since I'm reading for directory names.

But instead of showing matches in the minibuffer, it shows only [.]after the current directory match, like so /usr/bin/[.], which is not what I want.

If I hit TAB once, potential directory matches are displayed in a regular emacs buffer (named "Ido Completions"), as emacs normally does for Apropos, Help, describe-function matches, etc. The buffer says "Potential matches: " and displays a lonely single dot.

If I hit TAB a second time, the single dot is replaced with a full list of potential directory matches, and is displayed in the "Ido Completions" buffer as Emacs normally does. Seeing that, I can start typing a desired match, and the minibuffer will eventually match it.

Sometimes if I type a single letter in the minibuffer, and then backspace to erase it, the usual (nice) flex match display shows up, with something like this ../blah/blah/dir/{. | match1/ | match2/ | ...}showing. From this, I'm thinking that ido-read-directory-nameknows how to properly show directory matches in the minibuffer, but for some reason is not doing it by default.

Why doesn't ido-read-directory-namedisplay the possible directory matches in the minibuffer? Is there some variable that I might have set wrong? (I looked at the 50? possible ido-* variables with describe-variable, but couldn't see anything. Ditto for searching the SO forums, and the net.

I love ido-read-file-name, but ido-read-directory seems to exhibit very different behavior for me. Ideas to try, anyone? Thanks


texts: Emacs reopens all frames in current virtual desktop, not in each correct one

texts:
I am using emacs for OSX (GUI, not the terminal).
I use desktop-save in order to save my workflow when closing emacs.
All works fine except when I use OSX virtual desktop: if I open emacs in "Virtual Desktop 1", I create a new frame, I place it "Virtual Desktop 2", I use desktop-save, I quit emacs and then I open it again, then the two frames will be opened in the current virtual desktop and not the first in "Virtual Desktop 1" and the second in "Virtual desktop 2", as I would like to happen.

In order to avoid ambiguity I insert an image that clarifies what I mean with "Virtual desktop".

The image portrays macOS 10.12 with 11 virtual desktop, the first two with emacs opened.


texts: When returning from emacsclient to iterm2, terminal not getting focus

texts:
I'm using iterm2 v3.0.2 with fishs hell and tmux in osx. When I'm opening file via emacsclient and closing buffer - I'm successfully returning to terminal, BUT iterm2 window has no focus, so I have to click on window to gain it. I tested behaviour inside tmux session and outside - the same behaviour.

My command to run emacsclient:

emacsclient -c -a \"\" $argv


texts: Use all-the-icons in magit-repolist-column-flag-alist

texts:
I am trying to get magit-repolist-column-flag-alist to use icons from all-the-icons.el but with no success. This is the code I tried.
(setq magit-repolist-column-flag-alist
  '((magit-untracked-files . (all-the-icons-octicon "alert" :face 'all-the-icons-orange))
    (magit-unstaged-files . (all-the-icons-octicon "diff-modified" :face 'all-the-icons-red))
    (magit-staged-files . (all-the-icons-octicon "diff-added" :face 'all-the-icons-green))))

but when I run SPC g l r I get this error: wrong argument: stringp all-the-icons which I can see it's saying that the argument should be a string and it's not, but I have no idea how to return the icons as strings.


texts: How can I enter some text in a keyboard macro that uses helm mode?

texts:
I want a keyboard macro that does something like this:

Call org-refile
Insert two characters(In this case '')

So whenever I invoke the keyboard macro, it lets me enter some other text, but saves me the fact of entering '' every time I use it.
The problem is that I try to stop recording the keyboard macro after entering those 2 characters, but helm doesn't allow me to do it. Then, if I try to edit the keyboard macro to something like this: (I've remapped org-refile to F7)

(fset 'interesting-name
   [f7 ?\' ?\'])

But I think it adds a RET at the end, because it doesn't allow me to enter text, and refiles the subtree to the first result in the helm minibuffer.
I hope there's a way to do this, maybe it's a simple fix and I don't get it, thanks for reading.


texts: How can I display a buffer in a whole frame, removing the rest in the act?

texts: Basically that. I need a function that would do this when I open a buffer in a frame with many other windows. Maybe Emacs has one by default.


texts: How to associate more than one file extension with a given mode in `use-package`

texts:
When using use-package, is there a way to associate more than one file extension with a particular mode in one place instead of multiple locations?

Case in point is that I would like to associate both js and jsx files with js2-mode. Currently what I have is:

(use-package js2-mode
  :mode "\\.js\\'"
  :init
  (setq js2-highlight-level 3)
  (add-hook 'js2-mode-hook (lambda () (auto-revert-mode)
                                      (setq auto-revert-interval 0.1)))
  :ensure t)

(add-to-list 'auto-mode-alist '("\\.jsx\\'" . js2-mode))

... which I don't like as the extensions are specified in two different places.


texts:
I have a low-res screen (1366x768) and therefore are searching for a small font which is clearly readable.
Till now I used this font:

-misc-fixed-medium-r-normal--8-80-75-75-c-50-iso10646-1

I had set it up in my .Xdefaults / .Xresources file.
This font has a good size and is very good to read, but it has some drawbacks:
flyspell is not marking the words and It can not show italics.
(Flyspell is marking words only if I increase fontsize.)

So I am searching for a monospace font with similar size, which is good to read  and for programming (i.E. distinguishes letters: 1l, O0, {[<) supports german letters (äÄüÜöÖß) and works with flyspell. (If it supports italics the better.) It should work with emacs-lucid on Xorg.

On my system there are fonts which are smaller and work with flyspell and italics, but they are all hard to read at this size.
I know there is a font out there, I had it once, but I lost it and forgot the name. :(

Edit: I changed the face of marking words to just mark with straight underline instead of 'wave', this fixes it.

Edit: Even if the Question is closed: I found the font I was searching for, it is called 'neep' it comes with package 'xfonts-jmk' in debian.


texts: How to use different fonts based on the language of the currently active keyboard layout?

texts:
I want to make Emacs aware of the language I input -- in my case, Arabic, English, German -- so that I can use different fonts for each of them.  So, for example, I'd like Emacs to use the following fonts when I'm entering text in the following languages:

Arabic  - DejaVu Sans Mono 14
English - Consolas 11
German  - Consolas 12

So:

How can I set this up in my init file?
Where do I find the exact names of languages in Emacs to be recognized by the code?

(Side note: I'm new to Emacs and am just starting to learn elisp.)

Clarifying to follow-up on comments:

I'm using Windows.  Ideally, I'd like Emacs to understand what language I'm using based on the Language Bar.

Update:
A better approach to this problem is posted here.


texts: How to make mode line indicate that a window is dedicated?

texts: I'd like to be able to see visually whether a window is dedicated. Is there a way that I could add this information to the mode line?


texts:
I've become accustomed to using C-x p for switching to the previous window.

And, I recently had to start including a company-wide startup.el file that defines the prefix C-x p-. I don't use any of the C-x p- shortcuts.

Is there a way that I can undefine the C-x p- prefix after it's been defined?


texts: Compile Latex without Saving, and without Query

texts:
I know that I can disable the save query that comes after running TeX-run-TeX with LaTeX, TeX or actually probably any other NAME parameter (this is what happens when you invoke TeX-command-master, usually bound to C-c C-c, and then select LaTeX or TeX or whatever).  I did disable it, but what this does, is automatically save, so I can't compile without saving, unless I re-enable the annoying save query, after which I can let it not save.

What I would ideally want, is that when invoking TeX-run-TeX with whatever option on its own it never saves (I would have to manually save), and TeX-command-run-all always saves.

In tex-buf.el, for me it looks like setting TeX-save-query to nil will definitely cause the file to be automatically saved, so it seems kind of annoying for me to solve this problem in a simple way.


texts:
I want to set the title of emacs to be the mode-line when ever it changes.

[EDIT] solution:
As pointed to by the answer below,
(setq frame-title-format mode-line-format) solved things elegantly.

Original question bits:

I can set the emacs title via:

(set-frame-parameter nil 'title (concat "*GNU EMACS* " (format-mode-line mode-line-format)))

For this, I would like to hook into the mode-line. But does it have a hook? How could I find out if it has a change-hook?

At present, I use a timer that updates it every 5 seconds, but this is not so elegant.

;-- Timer to update title of emacs during a pomodoro.
(defun my/pomodoro-start-title-update-timer ()
  (interactive)
  (setq pomodoro-title-update-timer    (run-at-time (current-time) 5
                 'my/set-title-to-mode-line)))

;-- I don't use the below, but useful:
(defun my/kill-pomodoro-timer ()
  (interactive)
  (cancel-timer pomodoro-title-update-timer )
)

(defun my/set-title-to-mode-line ()
  "Sets the title of the emacs window to the mode line. Used by pomodoro timer."
  (interactive)
  (set-frame-parameter nil 'title (concat "*GNU EMACS* " (format-mode-line mode-line-format)))
)

;-- Start the timer. TODO: change this to be a hook for when the mode-line changes.
(my/pomodoro-start-title-update-timer)

[EDIT]
I have tried adding a hook to post-command-hook like so:

(add-hook 'post-command-hook
  (lambda ()
  'my/set-title-to-mode-line
  ))

But this only updates the the title if I change between buffers. The ticking of the pomodoro [Pomodoro~22:56] -> [Pomodoro~22:55] etc.. doesn't actually trigger this hook.
So I can use the above for general purpose, and a timer for when pomodoro is active at present.


texts: Yanking does not use top entry in the kill ring

texts:
I want to delete regions without adding them to the kill ring following this thread:

(defun backward-kill-word-no-kill-ring ()
  "Delete the previous word and remove it from the kill ring."
  (interactive)
  (backward-kill-word 1)
  (setq kill-ring (cdr kill-ring))
  )

(global-set-key (kbd "M-DEL") 'backward-kill-word-no-kill-ring)

It fails and I don't understand why. If I type abcd, copy it with Cmd-C, and yank it with C-y, Emacs inserts abcd and the kill ring, viewed with C-h v kill-ring RET, is:

(Value:
(#("abcd" 0 4
    (fontified t))
...

If I type 123, delete it with M-DEL, which calls my function, and then yank with C-y, Emacs inserts https://www.fablabs.io/labs, which I had copied 30 minutes ago and is no longer an entry in the kill ring, and the kill ring is:

Value:
(#("123" 0 3
   (fontified t))
  #("abcd" 0 4
    (fontified t))
...

Then I cut text with C-w (kill-region), yank in another buffer, and it's the same link that comes first and my cut text that comes second (after M-y).

Where does yank grab its text if not from the kill ring?

Update

Following Tobias's comment, I had save-interprogram-paste-before-kill at t, and have the same behavior when I set it to nil and start Emacs with emacs -Q. When I follow the steps above, after M-DEL of 123, Emacs inserts the last entry from the kill ring, abcd. (When I first asked the question, I may have missed that the inserted text was the last entry of the kill ring, even after searching for the string in the kill-ring information buffer.)

Further udpate

A similar question asks how to delete text without adding to the kill ring. The solution there, as the answer by Tobias here, is more elegant than my first attempt. I edited the question to understand why Emacs is using the last entry in the kill ring instead of the top entry.

Further update (10 March)

I follow the steps above with emacs -Q, copy abcd to the clipboard and yank it, copy the function and keybinding and execute it, and after M-DEL of 123, Emacs inserts the last entry from the kill ring, abcd.

The kill ring after that insertion is:

Value:
("(defun backward-kill-word-no-kill-ring ()
  \"Delete the previous word and remove it from the kill ring.\"
  (interactive)
  (backward-kill-word 1)
  (setq kill-ring (cdr kill-ring))
  )

(global-set-key (kbd \"M-DEL\") 'backward-kill-word-no-kill-ring)"
 #("abcd" 0 4
   (fontified t)))

The Emacs version is:

GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02

The values of interprogram-paste-function and interprogram-cut-function are the default ones, gui-selection-value and gui-select-text. The behavior is the same if I use M-w instead of Cmd-C to copy the first piece, abcd, to the kill ring.


texts: Do not align nested calls when using ruby-smie

texts:
When using the newly added ruby formatting functionality I face the following problem:

I would really like for my rspec code to be formatted like the following:

it do
  is_expected.to match(/\[Error\]/)
    .and match(/#{result}/)
    .and match(/-+$/)
end

This is what I get when having ruby-use-smie set to nil.

When I have the variable ruby-use-smie set to non-nil however, the code gets formatted like the following:

it do
  is_expected.to match(/\[Error\]/)
                  .and match(/#{result}/)
                        .and match(/-+$/)
end

I have fiddled with the following variables:

ruby-align-chained-calls
ruby-align-to-stmt-keywords
ruby-deep-indent-paren
ruby-deep-indent-paren-style

And yet have not found a way to have the desired formatting when using ruby-smie. I'm really in love with the s-expression navigation functionality provided by smie.

Am I missing some configuration ? Is it impossible for me to achieve the first form while using ruby smie?


texts:
My Emacs version is GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10).

My region face looks like this.

Two things stand out:

The region face is unreadable.
The DistantForeground attribute seems to be set by GTK.

How can I disable this functionality, so that Emacs only uses the faces that I explicitly set through themes?