texts: flycheck & auctex: Hide an specific warning

texts:
When using Auctex with Flycheck (Chktex) I get hundreds of warnings of the kind

 some.tex   321   8 warning  3  You should enclose the previous parenthesis with `{}'. (tex-chktex)

How I can disable this specific kind of error for being reported?


texts: How to have emacs recognize Makefile as a prefix for makefile-mode?

texts:
I figured the following would tell emacs to recognize files starting with "Makefile" and start makefile-mode:

(add-to-list 'auto-mode-alist '("\\`Makefile" . makefile-mode))

The \\` indicates the start of the string.

This doesn't work though. Can someone please explain why and how this can be fixed?


texts: Can tools like pep8 and pyflakes be called from within emacs?

texts:
I've been doing a lot of python coding. I often find myself checking my code by

saving my file
opening a terminal
issuing $ pep8 my_file.py
issuing $ pyflakes my_file.py

It would be cool if I could maybe bind $ pep8 my_current_script.py and $ pyflakes my_current_script.py to a key combination and have the results pop up in a new buffer. Is this possible in emacs?


texts: Run command after opening a file with emacsclient

texts:
Is it possible to specify an argument for emacsclient to run a command in the opened file? I would like to set the editor of a program to emacsclient -r '(search-forward-regexp "^<<<")'.

Addition 1

While I can run

emacs file --eval '(search-forward "test")'

the same with emacsclient fails with *ERROR*: Symbol's value as variable is void: file. Very helpful would be an --eval-next so I could define and use a shell alias like

% alias edit-as-shell='emacsclient --eval-next "(shell-mode t)"'
% edit-as-shell ~/bin/script

% alias edit-at-end='emacsclient --eval-next "(end-of-buffer)"'
% edit-at-end file


texts:
I'm not a fan of hitting escape 3 times so I am trying to have the same functionality with two key presses.

I have tried the following:

(define-key key-translation-map (kbd "<ESC> <ESC>") 'keyboard-escape-quit)

This doesn't work and it actually seems to break the normal <ESC> <ESC> <ESC> functionality as well.

Any Ideas on how to do this?


texts: Automatically update packages and delete old versions

texts: I'm a bit compulsive about updating packages for all of my systems, so I find myself running list-packages -> U -> x -> y -> y pretty much daily to update my packages and delete old versions once the update is complete. How can I automate this process so that at the very least I have to run only one function to update, compile, and delete my packages? Or is there some reason I might not want to do that?


texts: Since upgrading from v. 24 to v. 25 [OSX 10.11.6] I find myself frequently fighting with minibuffer completion, as typing a tab after doing switch-to-buffer. ^G just beeps, and the completions redisplay. The only way I know to exit the minibuffer in this situation is to pick one of the completions, either with the mouse or by navigating with keys.  I have a pretty simple setup with respect to switch-buffer. I don't think I  use any buffer libraries that would affect his, and have not changed buffer handling for several versions. Any suggestions about what is causing this and how I can get out of minibuffer completion without choosing one of the completions?


texts: How to view ediff (and other) manuals within emacs?

texts:
I want to learn how to use a built in package (e.g. ediff). This built-in package has an online manual in html, but presumably this content is also available from within emacs.

How do I view it within emacs?

Aside: I have also tried to find the pdf for the ediff manual (for offline reading), but cannot find it. The solution to the above problem would solve it, but it would also be good to know if / how I can find / create a pdf of an emacs builtin package.


texts: How to set the `auto-mode-alist` for `*.el` files when installing packages

texts:
I like to have my auto-mode-alist for *.el files set up to open them in a custom major-mode that is buffer-read-only.  When installing certain packages through the choices available when typing M-x list-packages, the package process creates an ...autoloads.el file.  Adding information to that ...autoloads.el file during the package building process fails because the buffer is read only.

Essentially, I'd like the auto-mode-alist to temporarily be set to nil so that the process of creating the ...autoloads.el file is working in a fundamental-mode buffer instead of my custom major-mode.

Some suggestions on how to handle this issue would be greatly appreciated.


texts: Limit number of Org TODO items in a certain state

texts:
I am a big fan of Kanban. I wrote Kanban-Dashboards with a decent metric analysis in Filemaker Pro and in Excel. However, some features I missed there and since my workflow is moving towards Emacs I would like to track my progress there. The Keyword here is org-mode, obviously. I already can generate a decent cumulative flow diagram (Kudos to Sacha Chua!). One thing that keeps puzzling me though is how/whether I can limit the number of tasks for a given TODO-status.

Lets say, for example, that you have the Tasks TODO - DOING - DONE and would like to impose a WIP-limit on the middle-status. Is there a way so that I cannot change a task's status to "DOING" when already two tasks are on "DOING"?

Another possibility would be to show the exceeding tasks in another color - is this possible in an Agenda?


texts:
When I load up emacs for the first time I get this warning

Warning (bytecomp): ‘font-lock-fontify-buffer’ is for interactive use only; use ‘font-lock-ensure’ or ‘font-lock-flush’ instead. [2 times]

Is this something I could be concerned with?

edit

I found the culprit:

 (use-package indent-guide
   :ensure t
   :config
   (indent-guide-global-mode)
   (setq indent-guide-char "|"))


texts: How to insert mathematical symbols in emacs

texts:
I'm writing an Asciidoctor file to take notes for statistics and would like to insert mathematical symbols like β.
Is there any way to do this without copy and pasting?


texts:
I am pretty sure I have seen some service, with an emacs plugin, that does something like the following: whenever you're programming and type a function name it'll show example usages of the function call from github projects.

This can give you an idea on how functions are used in practical ways, outside the simplified and contrived examples usually found in documentation.

Does anyone know what I am talking about?


texts: how to tell helm switch-to-buffer to make new buffer option last?

texts: When I switch buffers using helm, the first option is prefixed with [?] and tries to create a buffer named exactly what I typed. I find that this is the right behavior for creating files, but it is annoying for switching buffers. I'd prefer the first choice be one of the existing buffers. Can I make the [?] appear as the last option in the list instead?


texts:
Just began transitioning from vim to spacemacs and I can't find a way to define keymappings such as this:

nnoremap N Nzz

I tried defining it like this:

define-key evil-normal-state-map (kbd "N") (kbd "Nzz"))

... but using the "N" in the right hand side of the mapping causes the following error:

error "Lisp nesting exceeds 'max-lisp-eval-depth'".

Is there a way to define non-recursive keybindings with kbd?


texts: How to use an external program as the default way to open PDFs from Emacs?

texts: When I M-x find-file a PDF, it is opened in Emacs.  While this is nice, Emacs' PDF viewer lacks many features that I need and I would prefer to open PDFs in an external program instead.  How can I configure Emacs to use an external program as the default viewer for PDFs?


texts: ChangeLog mode indentation breaks when pressing return

texts:
For personal notes, I create ChangeLog files of the following format:

2015-01-27+0000  Felix E. Klee  <felix.klee@inka.de>

    * Today, I asked my first question on emacs.stackexchange.com:

      - My question is about issues with ChangeLog files.

Local Variables:
fill-column: 79
fill-indent-according-to-mode: nil
coding: utf-8
add-log-time-format: (lambda () (format-time-string "%Y-%m-%d%z"))
End:

The problem: After upgrading to version 24.4.1, when I press return at the end
of files., then the line changes identation depth:

    * Today, I asked my first question on emacs.stackexchange.com:

    - My question is about issues with ChangeLog files.

How do I prevent identation from changing in that case?

Already I tried specifying buffer local variables, to no avail:

adaptive-fill-regexp: "\\s *\\|\\s -"
paragraph-start: "\\s *$\\|\f\\|^\\<\\|\\s -$"

FYI after upgrading to Emacs 23, I had another ChangeLog indentation
issue, which IIRC I may have solved by editing changelog-mode source
code. I would like to avoid that this time.


texts: Org mode exporting with customized fonts in different (human) languages

texts:
I am writing Myanmar (Burmese) and English in org mode and want to export the buffer to LaTeX (PDF), HTML and ODT formats. Since Myanmar is not supported in Babel or Polyglossia packages, I am using Fontspec package with main font set to Padauk. Sample buffer snippet as below.

** ဥပမာ
    ဓာတုဗေဒသည် အက်တမ် /သို့မဟုတ်/ ၎င်းတွင်ရှိ ပရိုတွန်၊ _အီလက်ထရွန်နှင့်_ နျူထရွန် တို့ပါဝင်သည့် ရုပ်ဝတ္ထုများ၏ အပြန်အလှန် သက်ရောက်သော အကြောင်းအရာကို သိပ္ပံနည်းကျကျ လေ့လာခြင်းဖြစ်သည်။ ဓာတုဗေဒကို တစ်ခါတစ်ရံ သိပ္ပံ၏ဗဟိုချက်ဘာသာရပ် အဖြစ် မြင်ကြသည်။ အဘယ်ကြောင့်ဆိုသော် ၎င်းသည် များမြှောင်လှစွာသော ဘာသာရပ်များဖြစ်သည့် နက္ခတ္တဗေဒ၊ ရူပဗေဒ၊ material science၊ ဇီဝဗေဒ နှင့် ဘူမိဗေဒ တို့ကို +အချက်ကျကျ+ ဆက်သွယ်နေ၍ဖြစ်သည်။ Some more example of English text here.

Paduak has very nice Myanmar fonts but English fonts are not that great. Therefore, when it gets exported to PDF with Xelatex, I am satisfied with Myanmar fonts but want to change the English fonts to something like TeX Gyre Termes fonts. Sample Padauk output as below.

If I put LaTeX code in to change the font like \fontfamily{qtm}\selectfont Some more example of English text here., I am able to get the desired font rendered as below.

However, this solution is not preferred as the codes are noisy to the eyes and it also messes up with HTML and ODT export.

Is there any way to set Myanmar language to Padauk and English language to the font of my choosing automatically? Probably something like emphasis built-in function in org mode, for e.g. ~some code~, which gets exported to monospace font. Please note however that I would like to retain built-in emphasis function for both Myanmar and English language.

The ideal solution would be that I need not put in any marker during writing and that when the buffer gets exported, fonts for different languages are assigned different fonts of my choosing automatically.


texts: Projectile installed but "Autoloading failed to define function projectile-mode"

texts:
I can M-x projectile-mode (I get this and other projectile commands in the completion list) but it fails with

  Autoloading failed to define function projectile-mode

Projectile is an installed package, according to package-list-packages:

  projectile         20150724.1312 installed

(And I can use C-h f to search for the function and to open the projectile.el file.)

When I add (require 'projectile) to my init.el, startup fails with

  error: Required feature `projectile' was not provided

Emacs 24.5 on OSX installed via Homebrew, using the Emacs Live (git rev 170bddd, 2015-07-18) setup.
Here is my Emacs config (as an Emacs Live pack).

Any help would be appreciated. Thank you!


texts:
I'm writing a paper where TODO entries are mixed in along with the headings of the paper. I can look at all my TODO entries with C-c / t (or C-c / T for specific keywords).

Is there a way to show all headings except the TODO entries? I'd like to get a clean look of the document structure without these headings.


texts: Why aren't these two otherwise identical forms `equal`?

texts:
This requires the let-alist package available on the GNU ELPA (built-in in 25.1).

I have the following macro:

(defmacro sx-assoc-let (alist &rest body)
  (declare (indent 1) (debug t))
  (require 'let-alist)
  `(progn
     (sx--ensure-site ,alist)
     ,(macroexpand
       `(let-alist ,alist ,@body))))

For some reason, the two forms don't evaluate as equal, but when I evaluate them separately they do indeed 'show' the same thing.

(equal `(progn (sx--ensure-site data)
         ,(macroexpand
           '(let-alist data .test)))
        (macroexpand
         '(sx-assoc-let data .test)))

What is going on here?


texts: How can I scroll a half page on C-v and M-v?

texts:
I use Spacemacs, and for some time I've rebound C-v and M-v to spacemacs/scroll-half-page-down and spacemacs/scroll-half-page-up, respectively, to aid my understanding of the buffer as I move through it.

After a recent update, though, these functions seem to no longer be defined. How can I get them back, or something reasonably similar?


texts: Display one character in an alternative font family

texts:
I want to change the appearance of my lozenge character.

I have tried running the following:

(set-fontset-font "fontset-default" ?◊ (font-spec :family "PragmataPro"))

However, if I type ◊ and ask Emacs to describe-char, I get the following:

             position: 38 of 74 (50%), column: 37
            character: ◊ (displayed as ◊) (codepoint 9674, #o22712, #x25ca)
              charset: unicode (Unicode (ISO10646))
code point in charset: 0x25CA
               script: symbol
               syntax: w    which means: word
             category: .:Base
             to input: type "C-x 8 RET 25ca" or "C-x 8 RET LOZENGE"
          buffer code: #xE2 #x97 #x8A
            file code: #xE2 #x97 #x8A (encoded by coding system utf-8)
              display: by this font (glyph code)
    xft:-CYEL-Iosevka-normal-normal-normal-*-18-*-*-*-*-0-iso10646-1 (#x9A5)

Character code properties: customize what to show
  name: LOZENGE
  general-category: So (Symbol, Other)
  decomposition: (9674) ('◊')

There are text properties here:
  fontified            t

As you can see, ◊ is still being rendered with Iosevka.

I have checked that PragmataPro works globally and that it makes the lozenge character appear different. Note also that the codepoint matches. To check that I'm using the ?◊ argument correctly I've also tried '(#x25ca . #x25ca).

If I ask describe-fontset for fontset-default I get this:

…
◊ (#x25CA)
-*-PragmataPro-*-*-*-*-*-*-*-*-*-*-*-*
…

So the fontspec itself appears to have been changed. Likewise for -*-*-*-*-*-*-*-*-*-*-*-*-fontset-default.

How do I get the altered symbol to render?


texts: What is the flying trashcan icon replacing colons in Python buffers?

texts:
There is a strange icon appearing in place of colons (:) in my Python buffers. I cannot identify it easily using C-x = or any other command to inspect the character at the point because the icon switches back to a colon when the cursor is on the same line, or when the region containing the icon is selected. I've got some screenshots.

Here you can see all the :'s have been replaced with flying trashcans.

When I move the cursor to line 46, highlighting that line:

the symbol is no longer displayed.

I am using eglot, Fira Code font, ligatures using prettify-symbols as documented here. I'm on Spacemacs develop, emacs  27.0.50, OSX Catalina. I have been using this configuration for quite some time and these symbols only just appeared this morning. I'm not aware of having updated anything.

Restarting emacs resolved the issue, but I'm still curious if anyone has ideas about:

1) What happened here?

2) If restarting hadn't worked, how could I go about identifying the face or symbol being displayed for a character that only appears when the point isn't on it?


texts: New headlines in org-mode don't always appear on a new line

texts:
When the point is at the end of a headline in org-mode and I hit Alt+Enter (bound to org-meta-return), the new headline often starts on the same line instead of on a new one. It happens frequently, but far from always and seemingly at random. I'm not able to reproduce this from a clean init, but I have no idea which package or variable is causing the problem.

If you have encountered this or have any ideas how to fix it, please let me know because it's driving me mad.


texts:
Emacs comes with it's own solution for scrollbars(rather than using native macOS scrollbar) and honestly, I find them kinda intrusive and ugly. Can I somehow configure scrollbars to use native mac scrollbar which only pops up when scrolling. Kinda like this :-

Or is this something that's out of our hands to configure? If it is, is there a hack that can make it work/appear like native mac srollbar?


texts: How to tell YASnippet to ignore placeholder?

texts:
I have a shell script which uses an array to check dependencies. I'd like to make this into a YASnippet, but YAS recognizes the array value statement ${dependencies[@]} as a placeholder. How can I tell YAS to ignore this placeholder?

# key: write.bash
# name: write.bash
# --
#!/bin/bash

dependencies=("${1:dependency 1}" "${2:dependency 2}")

for i in ${dependencies[@]}; do
if [ "$(which $i)" = "" ] ; then
    echo "EARLY EXIT- $i needs to be installed and on PATH"
    exit 0
    else
    echo "$i installed"
fi;
done


texts:
I have recently installed emacs doom, and I tried to customise it with some custom keybindings. I have found that Evil is just not something I want. I can disable it on a per-buffer basis with M-x turn-off-evil-mode, but I do not want to have to type that command everytime I open a file

How can I disable evil mode everywhere? I don't want it.

PS: The Emacs doom documentation apparently used to explain how to this, but the link points to nowhere


texts: markdown-mode seems to ignore variables set in .dir-locals-el

texts:
I have a folder with some files written in markdown format that I would like to convert in html using markdown-mode.

I want a local value for the variable markdown-css-paths, in order to have a custom file as style sheet of the resulting html files. So, I create a .dir-locals.el file in the same folder of the markdown files and inside it I put this:

((markdown-mode
 (markdown-css-paths ("test.css"))))

I reload all the buffers, then invoke C-h v markdown-css-paths [RET] to make sure the variable is set correctly, which it is:

markdown-css-paths is a variable defined in ‘markdown-mode.el’.
Its value is (("test.css"))
Original value was nil
Local in buffer nuovo-corso.md; global value is nil

The problem is: when I try to convert the files in html (with the command C-c C-c m), no test.css style sheet is included.

The same thing happend with at least another variable, markdown-xhtml-header-content: it seems as if, during conversion, markdown-mode doesn't rely on the .dir-locals.el variable values.

When, instead, I set those variables in .emacs, everything works as expected.

What am I doing wrong? I'm using emacs 26.1 and markdown-mode 20180904.1601.


texts: how do I use :var arguments in sh code for ob-shell in org-mode

texts:
I want to pass variables/arguments to a shell script in org-mode babel code-block by using the :var tag.  Instead of reading the value of the variable, shell is just getting the literal x, which is empty (so ${x}="").
I would like the bash code block below in org-mode / org-babel to output "bar".  How do I do that?
#+name: foo :var x=bar
#+begin_src bash
echo x
#+end_src


texts:
I'd like to extract from an org file a top-level headline and the plain text just under it. I'm new to elisp, but i've tried a bunch of things, and haven't made much progress. I'd really appreciate some pointers.

Suppose we've got the file:

* Test

Some descriptive text

** TODO Test Org mode
** TODO Keep testing

I'd like to include just the top headline and the descriptive text just under it in another file. (Not using #+INCLUDE searches, which for some reason I also can't get to work). So I'm trying to extract just a piece of this buffer's AST.

I'm trying to use org-map-entries because it will be able to look through all my agenda files, each of which relates to a different project.

First, does org-map-entries just not allow me to access children of headlines? (I think the text description is in a section that's a child of the first headline. Right?)

Assuming that's true, I've tried to org-element-parse-buffer of the whole buffer when I find a top-level headline. With the whole AST, I think I should be able to get the text just under the top-level headline. But I'm stumped.

Any pointers?

(defun get-headline-with-text ()
    (let ((entry (org-element-at-point)))
        (if (eq 1 (org-element-property :level entry))
            (let ((hdl (nth 2 (org-element-parse-buffer))))
                 (list (org-element-property :raw-value hdl)
                       (org-element-property :value (car (org-element-contents hdl))))
            )
            nil)
    )
)

(org-map-entries '(get-headline-with-text) t nil)


texts: How to set emacs as the default file manager?

texts: Some programs like firefox have buttons that when clicked open a file manager for browsing files. How do I make it to open in emacs with dired mode on Debian Linux?


texts: Transparently reconnect to servers after a system suspend

texts:
I have multiple IMAP and NNTP servers configured in Gnus, mostly over
SSL using the integrated GnuTLS. When I put my laptop into
suspend-to-RAM for a while, the TCP connections will obviously drop
eventually, but Gnus doesn't recognize this, so pressing 'g' after
the system wake-up will cause Gnus to hang while waiting for the TCP
connections to respond. I usually resolve that by restarting Gnus
with C-g and R.

Is there a way for Gnus to quickly detect dropped TCP connections
and transparently reconnect when I try to update the group list?


texts: Cursor disappears when point is at a leading star and org-hide-leading-stars is non-nil

texts:
In non-graphic mode I set org-hide-leading-stars to t.  Unfortunately, under these circumstances, whenever point is on a leading star, the cursor disappears altogether.  IOW, not only the leading star is hidden, but also the cursor.

This can make navigation in an org outline file truly bewildering.

Is there a way to hide the stars but at the same time keep the cursor always visible?

FWIW, I'm using a solarized-dark theme.


texts: AUCTeX: Command 'reftex-cleveref-cref' not recognized before 'reftex-reference' is run

texts:
I have a strange behavior in AUCTeX with RefTeX: the command 'reftex-reference' (C-c )) needs to be run before the command 'reftex-cleveref-cref' gets recognized, on a newly-started emacs session.

In other words, the command 'reftex-cleveref-cref' looks non-existing if I did not run any 'reftex-reference' yet.

What would be the explanation?


texts:
When using the helm find-file replacement helm-find-files, SSH URL's are automatically converted to tramp filenames.  For example:

  ssh://john@example.com:/home/john

becomes

  /scp:john@example.com:/home/john/

Where does the logic for this string conversion reside?


texts: Overriding a magit Keybinding using evil-mode and bind-map

texts:
I am using evil-mode, magit, evil-magit, and bind-map.

I have defined a map with bind-map using SPC as my :evil-keys similarly to what spacemacs provides.

Magit defines SPC as magit-diff-show-or-scroll-up and I'm having a rough time trying to override that binding or make my bind-map take precedence so I can invoke my leader key.

I have tried to deduce how spacemacs handles this issue but I believe it may be within their evilified* functions.


texts: Adding a custom keybinding in Doom Emacs

texts: I am using evil-mode and am very new to emacs and doom. How would I be able to map Ctrl-s to :w or save. Also, how would I be able to bind Ctrl-n to neotree-toggle? I have been searching and trying for hours with no luck.


texts: How to disable plain footnote references?

texts:
I want to write some text including sequences like [123] in an org-mode text file, but this is automatically turned into a footnote reference. This plain numeric footnote is not recommended anyway. How can I turn off this footnote reference type completely?

There's an answer on the Unix SE based on this thread from 2010, but the solution doesn't work: with #+DISABLE_PLAIN_FOOTNOTES: some arbitrary text in the org file the footnote reference is still created in the buffer.

I'm not sure if this configuration is supposed to depend on the custom .emacs function, but adding that returns an warning:

Warning (initialization): An error occurred while loading `~/.emacs.d/init.el':
Symbol's value as variable is void: org-export-inbuffer-options-extra

Can the plain numeric footnote reference type be disabled?


texts: How to mark org agenda item as completed on particular day?

texts:
Sometimes I fall behind in my org-agenda maintenance and have to go back a few days to mark completed tasks. In 90% of cases, I want to mark the task as completed on the day it was due, but org-agenda-todo always uses the current day and time.

What is the easiest way to mark agenda items as completed on the day currently being viewed in the agenda window?

Update: I attempted to adapt the answer to the linked question; ignoring the ugliness of my code, the date seems to be obtained, but org-agenda-todo ignores org-current-effective-time:

(defun org-agenda-todo-view-date (&optional arg)
  (interactive "P")
  (cl-letf* ((org-read-date-prefer-future nil)
             (my-current-time (org-read-date nil t (mapconcat 'number-to-string (append (last (calendar-gregorian-from-absolute org-starting-day)) (butlast (calendar-gregorian-from-absolute org-starting-day))) "-")))
             ((symbol-function #'org-current-effective-time)
              #'(lambda () my-current-time)))
    (org-agenda-todo arg)))


texts: AUCTeX auto parse class file in same directory as TeX file

texts:
I have a class file hmcpset.cls which defines some macros and environments.

If I have it in the same directory as a TeX file, which uses \documentclass{hmcpset}, I would like AUCTeX to parse the class file, so it can complete the macros and environments defined in it.

I know AUCTeX can do this, because, with (setq TeX-auto-save t) opening hmcpset.cls and saving it causes the file to be parsed and from then on, I can complete things defined in it, even in the TeX file.


texts:
Somehow my left mouse click does not work on links anymore. I can put the cursor, hit Return and get a link opened. But a mouse click gives this on the "Message" buffer:

call-interactively: Wrong number of arguments: (1 . 1), 2

I am clueless.

Additional Info

The problem occurs with emacs 24.4 and 24.5 (current running). Setting run M-x toggle-debug-on-error and click on a link gave me this:

Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 1) 2)
  mouse-drag-region(1419 1456)
  call-interactively(mouse-drag-region nil nil)
  command-execute(mouse-drag-region)

Hitting q on back-trace buffer gives inconsistent result so I don't know what to paste here.


texts:
When I try to connect to my gmail account foo@gmail.com (password: foopassword), using the following setting:

(setq rmail-primary-inbox-list '("pop://foo:foopassword@pop.gmail.com:995"))

I get the following error:

movemail: mailbox `pop://foo@pop.gmail.com:995': cannot open: Name or service not known

And when I set the variable like this:

(setq rmail-primary-inbox-list '("pop://foo@gmail.com:foopassword@pop.gmail.com:995"))

I get the following:

movemail: mailbox `pop://foo@pop.gmail.com:995': cannot open: Name or service not known

So what do I need to connect to read my gmail messages using Rmail?


texts:
I'm doing time logging with Org, and I want to associate a numeric code with each entry -- the code says which project the entry is associated with. But I'm awful at remembering the numbers, so I'd like to somehow be able to associate aliases with the codes.

For example: I may associate "coolnewfeature1" with 123456; then when I type C-c C-x p and enter "coolnewfeature1" for the "project" property value, Org would record 123456, so later when I use column view, I can see all the numbers. (Which is where I really need to see them.)

Is there some way to do this? If not, one alternative would be recording "coolnewfeature1" for the property, and somehow getting column view to map the easy-to-remember names to the codes.


texts: How to programmatically invoke interactive function?

texts:
I have written an interactive  function to connect to multiple mysql databases

(defun mysql-connect (name)
  "Connect to a predefined MySQL connection."
  (interactive
   (list
    (completing-read "Connect to: " sql-connection-alist
             nil t nil 'pyvenv-workon-history nil nil)))
  (when (not (or (equal name "")
             (equal name nil)))
    (mysql-connect-preset name)))

If I run M-x mysql-connect, it  will prompt user to select available options. But I  want to invoke it via script.

If I  run (mysql-connect 'some-choice)  it will  work, but I dont want  that. I just want to invoke mysql-connect  and let  user  to select choice.

How  can I just  invoke  that function?


texts: how to increase the debugging message level

texts:
I believe that there is a way to increase the debug level, but I don't recall how. Perhaps I am using the wrong terms, but web searches and looking on StackExchange are not providing me anything useful. Basically, I want my *Messages* buffer to output more information about an error. How can I do this?

For example, can I set the debug log level to FINE or something similar?


texts: Under gdb-mi can I attach a command to a breakpoint?

texts:
I use gdb-mi in order to have access to gdb-many-windows functionality.

I would like to access gdb's ability to attach a list of commands to execute once a breakpoint gets hit.  Documentation suggests that the gdb/mi protocol supports this via the -break-commands verb.  That said, there is a cryptic suggestion of a rough edge earlier in that same documentation.

So am I just out of luck or is there some magic emacs or gud incantation that will grant me access to -break-commands functionality?


texts: Show all library functions in autocomplete with Cider

texts:
When I have imported the reagent.core library as reagent and I type (reagent/ I want to see all possible functions from that library I can use, preferably with documentation. Unfortunately I get only suggestions of text I already typed in that file:

I want to see something similar as this, only then for reagent.

I am using ac-cider and auto-complete packages with the following settings:

;; Auto-completion
(require 'ac-cider)
(add-hook 'cider-mode-hook 'ac-flyspell-workaround)
(add-hook 'cider-mode-hook 'ac-cider-setup)
(add-hook 'cider-repl-mode-hook 'ac-cider-setup)

(require 'auto-complete)
(add-to-list 'ac-modes 'cider-mode)
(add-to-list 'ac-modes 'cider-repl-mode)

(defun set-auto-complete-as-completion-at-point-function ()
  (setq completion-at-point-functions '(auto-complete)))
(add-hook 'auto-complete-mode-hook 'set-auto-complete-as-completion-at-point-function)
(add-hook 'cider-mode-hook 'set-auto-complete-as-completion-at-point-function)

(defun clojure-auto-complete-hook ()
  (auto-complete-mode 1))

(add-hook 'clojure-mode-hook 'clojure-auto-complete-hook)

How can I see all possible functions to use from an external library when I type the imported name?


texts: Emacs: mark contents as type image in copy to clipboard

texts:
When using pdf-tools (https://github.com/politza/pdf-tools) I'd like to be able to select and area and copy it to the clipboard as an image, so as to insert into other applications. Selecting is easy from pdf-tools, but pasting into other applications as image does not work.

It seems that for this to be possible, Emacs would have to mark the contents of the selected area as being of type image pdf-tools: issue 184. Is such a thing even possible?


texts:
Whenever I use browse-url function inside of w3m I would like to have
a default URL displayed for me.

It happens that what I mostly do is google searches, so if I could
have https://google.com/search?q= as default URL any time I use
browse-url it would save me a lot of typing.

How can I achieve this?


texts: How do I refactor across a project in emacs (change method name everywhere)?

texts:
I want to rewrite parts of an opensource project. This includes renaming methods. How can I do that efficiently in emacs across the whole project?

I would rather not use hacks such as search and replace in every buffer.


texts: Define dummy variables from parameter list

texts:
Let's say I am experimenting with a codebase, and there's a function that takes a bunch of parameters, say

void foobar(char A, char B, int m, float k, int n)

I want to use the function somewhere, so need to pass these parameters to the it.  Does anyone have a way that they use to quickly create random dummy values (though determined by type) for a list of parameters, so that inputting the list would give:

char A = "g";
char B = "b";
int m = 14;
float k = 3.77;
int n = 2;

I've been experimenting with yasnippet, which seems like a great template system, with elisp support, so maybe it could work there.  Does anyone have any recommendations or a system that they use themselves?


texts: How to display a message in echo-area only

texts: Is it possible to display a message in the echo area without logging it in buffer  *Messages*?


texts:
Emacs 26.1, Windows 10

I open by Notedpad++ text file.

Here result:

As you can see the encoded is UTF-8. And as result Notepad++ success show Cyrillic.
Nice.

Now I open same file by Emacs:

Why Emacs now show correct Cyrillic?


texts: Which mode to get syntax-highlighting for commit messages (svn/git/hg... etc)

texts: When editing commit messages for various version control, what should I enable to get syntax highlighting? (without having to use some heavy mode for all other VCS operations like magit)


texts: Install programs which require superuser permissions

texts:
I would like to, as part of Emacs Lisp package set-up process to run some programs which typically require superuser access, for instance, I would like to make sure that certain system packages are installed, and if not, then install them, I would also need to configure a database, which, will also require superuser access (once, in order to add a user with reduced privileges to operate on her own database).

I was hoping to enlist Tramp for help, but after some searching, couldn't find a way to do it.

Note, what I need is:

Make sure I need the permissions to do what I want.
If test comes out positive, ask the user to start a shell with elevated permissions.

From that point on, I think I could manage it.


texts: What's the name of the auto indent code?

texts: What's the name of that feature that auto indent the code when I press tab (Even fi the indentation is more to the right, the tab "erases" the abundany spaces) and how can I change the size of it?


texts: Proper syntax highlighting of $...$ in org-mode

texts:
I've put
(setq org-highlight-latex-and-related '(latex script entities))

in my emacs config and yet $..$ that contain more than one symbol aren't highlighted properly:

How to fix?
EDIT: This still does not work for me as of org-version 9.4.


texts: Dynamic name for org-capture template file

texts:
I am new to org-mode (and to Emacs in general) and am trying to set up org-capture.  I would like to define a todo capture item whose template is located in the file ~/.emacs.d/org-templates/todo.tmpl.  I have tried with
(global-set-key (kbd "C-c c") 'org-capture)

(setq org-directory "~/org/")
(setq org-default-notes-file (concat org-directory "notes.org"))
(setq org-todo-template (concat user-emacs-directory "org-templates/todo.tmpl"))

(setq org-capture-templates
      '(("t"
         "Todo list item"
         entry
         (file+headline org-default-notes-file "Tasks")
         (file org-todo-template)
        )))

I get the error:
Wrong type argument: stringp, org-todo-template

if I replace the line
         (file org-todo-template)

with
         (file "~/.emacs.d/org-templates/todo.tmpl")

then it works, and I do not understand why.
For reference, the content of the file ~/.emacs.d/org-templates/todo.tmpl is
* TODO %^{Description}
  %i
  %a
  - %?
  :LOGBOOK:
  CREATED: %U
  :END:


texts: How to check whether a buffer is visiting a file?

texts:
I'd like to check whether some (say, current) buffer is visiting a file or not.  I could say:

(if (buffer-file-name) ...)

but it seems to be not very elegant - what I'm interested in is only the boolean value, not the actual name of the buffer in question.  If the buffer-file-name function were written in Elisp, I could look into its source to find out what it uses - but it is written in C, and while I could install the Emacs sources, I'm afraid that I wouldn't find an elisp name for the function that checks what I'm after there anyway.

What I need it for is I want to create a directory based on the name of the current buffer's file, and currently I'm doing more or less this:

(make-directory (if (buffer-file-name) (file-name-base) "default-dir"))

So, what would be the Elisp-idiomatic way of doing this?


texts: Save changes to an emacs file without changing the date

texts: I sometimes would like to make changes to my emacs files but without changing the date of the modified file. For instance, I would like to write up a brief evaluation of a lecture I might have given. Ideally, I would not like to change the file's date under these circumstances. Is there any way to do this? I run emacs on Windows 7. I have noted too that changing a file's name also changes its date. It would be nice to change the name but without effecting the date.


texts: Reusing previous inputs (old or new) for query-replace

texts:
Most functions in emacs keep a default option, with the last arguments used. Is it possible to reuse some of the default arguments while changing others?

For example, when using search and replace, a string such as Query replace (default thing1 -> thing2) lets you reuse the last command, instead of typing it all over.  Is there a way to keep "thing1" as the first argument, but enter a new string in place of "thing2"?


texts: How to redirect output from eshell to any open buffer in Emacs?

texts: I have my eshell opened in a window and in another window I have *Scratch* as a open buffer. I want to redirect the output of a command like say ls to *Scratch*. Is it possible? If yes, then how can I do it? Thanks.


texts:
I would like to launch Emacs by typing a command line in the terminal in Ubuntu linux. I want Emacs to open file a.txt in one frame and another file b.txt in another frame.
I tried the command *emacs a.txt -f make-frame-command b.txt*
Unfortunately this command does not work. It launches one frame with a split buffer containing a.txt and b.txt and another frame with just a.txt


texts: Regex to match one tag and not the other in image-dired

texts:
In image-dired I use M-x image-dired-mark-tagged-files to mark files containing a tag using regexp. e.g. oil.
What regex do I need to mark oil but not wip (work in progress).
Input:
/foo/IMG_2022.JPG;art;oil;wip
/foo/IMG_2023.JPG;oil;art;

Output needed:
/foo/IMG_2023.JPG;oil;art;

M-x image-dired-mark-tagged-files
image-dired-mark-tagged-files is an autoloaded interactive compiled Lisp
function in ‘image-dired.el’.
(image-dired-mark-tagged-files)
Use regexp to mark files with matching tag.
A ‘tag’ is a keyword, a piece of meta data, associated with an
image file and stored in image-dired’s database file.  This command
lets you input a regexp and this will be matched against all tags
on all image files in the database file.  The files that have a
matching tag will be marked in the dired buffer.


texts:
According to the define-key docstring, binding a key to a cons (MAP . CHAR) should cause that key to act as CHAR in MAP. However, I cannot get this to work. For example, evaling this and trying to use the keybinding gives the error Wrong type argument: commandp ...:

(defvar my-temp-map (make-sparse-keymap))
(define-key my-temp-map "a" #'next-line)
(define-key emacs-lisp-mode-map (kbd "C-a") (cons my-temp-map ?a))

I've tried on emacs 25 and 26 and have also tried quoting the keymap name. Am I doing this wrong or does it just not work? I realize that the same effect could be achieved in other ways, but I'm curious about whether this specific format of definition is actually possible.


texts: Specify precision using calc in org mode spreadsheets

texts: According to the org mode documentation for calc syntax you can append printf formatters to specify the number of decimal places to display ‘$1+$2;%.2f’ Same, format result to two decimals. Is there a way to set this as the default for all floats? The org-calc-default-modes variables for precision do not correspond to printf precision (digits after the decimal point), but instead to significant digits.


texts: Emacs tramp "args out of range" too often, how to recover connection automatically?

texts:
I have tramp configured to work automatically with SSH key and all, but I am having this message too often:

  byte-code: Args out of range: #<buffer *tramp/ssh gs*>, 60, 14056

To solve it temporarily I just kill the tramp buffer:

  * *tramp/ssh gs*         9994 Fundamental

In *Buffer List* I apply D and X to kill this buffer.

Then I just keep working, tramp will reconnect automatically when I save. In a matter of 5-30 minutes, the message reappears and I have to kill the tramp buffer again.

How can I have a more fluent working without having to be killing the tramp buffer?

How to recover automatically each time the connection droops?


texts: Can columns of an org table be grouped to conveniently work with data?


texts: How do you remove compiler warnings for macro usage when running macro with 'with-eval-after-load'?

texts:
In a package I am working on I want to define a flycheck checker only if the user has flycheck installed already.  To do this, I am using the macro (with-eval-after-load "flycheck" ...) as follows:

(with-eval-after-load "flycheck"
  (flycheck-define-checker go-mod
    "A syntax checker for go.mod files."
    :command ("go" "list" "-m")
    :error-patterns
    ((error line-start (file-name) ":" line ": " (message) line-end))
    :modes go-mod-mode))

When I do this however, many flycheck errors appear. For example it says that go-mod and go-mod-mode are free variables,it's misinterpreting the (error line-start ...) part, and saying that the function flycheck-define-checker is not know to be defined.

Adding (require ...) resolves these warnings but I only want this to be required if the user has "flycheck" installed already. What can I do to suppress these errors.


texts:
I am using Emacs 25.3.2 on Linux Ubuntu 16.04.
The problem is that several of the menu bar items produce empty drop-downs. A grey box appears, but with nothing inside. It looks like this:

I originally noticed this happening for the YASnippet, Python and Virtual Envs and after playing around a lot with various modes, saving, closing, restarting Emacs and so on, I believe it is always specific to the current mode. The File, Edit, Options and Buffers tabs never seem to have a problem.
Pressing F10 seems to reset something and then everything works again, but after some time (I haven't been able to determine when/why exactly), the mode-relevant menu bar tabs seems to once again be empty.
Any clues as to what might be causing this?
I have seen this problem, but it appears to have been version specific and also a different issue to mine.


texts: How to make e2ansi-cat work with emacs 26

texts:
I'm trying to to cat the file named foo using e2ansi-cat:

AdministorsMBP2:~ administrator$ e2ansi-cat --color-class=color --background-mode=light foo
Cannot open load file: No such file or directory, face-explorer
AdministorsMBP2:~ administrator$ e2ansi-cat foo
Cannot open load file: No such file or directory, face-explorer

I added the --color-class=color --background-mode=light bit because there was a GitHub issue response that suggested it.

Some additional info:

AdministorsMBP2:~ administrator$ /usr/local/bin/emacs --version
GNU Emacs 26.2
AdministorsMBP2:~ administrator$ head -n1 ~/e2ansi/bin/e2ansi-cat
#!/usr/local/bin/emacs --script
AdministorsMBP2:~ administrator$ head -n1 ~/e2ansi/bin/e2ansi-info
#!/usr/local/bin/emacs --script
AdministorsMBP2:~ administrator$ which e2ansi-cat
/Users/administrator/e2ansi/bin/e2ansi-cat


texts: magit: how to display more visible (desktop) notifications ? (How to get the return code ?)

texts:
update: WIP here: https://gitlab.com/emacs-stuff/magit-notify working but lacks configuration.

I'd like more visible magit notifications: often I want to push some commits but there is an error (a protected branch, I must pull upstream changes,…) and:

the confirmation or error message is not very visible in the echo area,
it can appear not immediatly, depending on the project and on the network, in which case I may have exited the magit buffer,
I'd like immediate visible feedback (green/red),
I'd like to see more quiclkly what the cause is (currently we must go to magit's log buffer)

so I don't see the error easily and this can lead to a situation where I think mistakenly that I have pushed my changes.

Can we already do something about that ?

desktop notifications (built-in) might be nice (other ideas?) (however I don't see them when Emacs is full-screen) and its api is straightforward:

(require 'notifications)
(notifications-notify :title "push succeeded" :body "push to gitlab.com/name/project, branch foo etc")

so, speaking about implementation: how do we get the return code, what would be the function to advise ? magit-process-finish seems of interest because it seems to check the return code and the explanations. What can we do with that, any implementation tips ?


texts: Helm + Org-Goto + Narrow to Subtree + Follow Mode

texts:
I am using org-goto with helm and my init file has the following config:

  (setq org-goto-interface 'outline-path-completion)
  (setq org-outline-path-complete-in-steps nil)

This works fine but I would love to make a few adjustments:

Activate follow mode, so the main buffer displays the contents of each heading, as I navigate through the list in helm.
Narrow main buffer to a subtree, once I make my selection.

Screenshot of my current setup, while running org-goto.

Any ideas?


texts:
I have followed the instructions on Github for setting up swank-js.

I installed slime and slime-js from github and have the following in my .emacs file:

(add-to-list 'load-path "~/slime/")
(require 'slime-autoloads)
(setq slime-contribs '(slime-fancy slime-repl slime-js))

Then when I run slime-connect and enter my host and port emacs tells me: void-variable package). Here is the output from my node server:

Handler.prototype.receive(): (:emacs-rex (swank:connection-info) "COMMON-LISP-USER" t 1)
info = {"pid":6145,"encoding":{"codingSystems":["utf-8-unix"]},"packageSpec":{"name":"NODE","prompt":"NODE"},"implementation":{"type":"JS","name":"JS","version":"1.5"},"version":"2012-02-12"}
response: 0000c1(:return (:ok (:encoding (:coding-systems ("utf-8-unix")) :lisp-implementation (:name "JS" :type "JS" :version "1.5") :package (:name "NODE" :prompt "NODE") :pid 6145 :version "2012-02-12")) 1)

What can I do to get swank-js to work?
What is the package variable supposed to be?


texts: Export only visible entries of sparse tree

texts:
I'm trying to export an org file into a file that contains only the visible entries (and parents) of a sparse tree (matching a specific tag).

For example, applying this to the following tree

* A
  Some content at level 0
** A1 :matchthis:
   Some content at level 1
** A2
* B
  Some content at level 0

matching the tag matchthis should produce the same result as exporting the tree:

* A
  Some content at level 0
** A1 :matchthis:
   Some content at level 1

If I export everything (in PDF, or txt), then the top level headlines (B) are also visible and therefore always included.

I don't see a way to export an org-file to an org-file with only the matched entries, which could be an acceptable intermediate step.


texts: How can I suppress the message `When done with this frame, type C-x 5 0`?

texts:
I am running emacs v26 daemon on the background and using a single terminal. Usually I open files using emacsclient -qt and close them using C-x C-s and C-x C-c to get back to terminal run the script and afterwards re-open another file.

I wanted to make this operation faster where when I run emacsclient -qt -e '(progn (find-file "file.py"))' seems like it opens the files much faster than emacsclient -qt file.py (this may lag to show previous buffers for a second).
But now, when I run emacsclient -qt -e '(progn (find-file "file.py"))' I keep seeing When done with this frame, type C-x 5 0 message in the minibuffer.
=> How can I suppress this warning message? and also safe to open files this way?

Not perfect but the script I come up with:
#!/bin/bash

open_emacs() {
    FILE=$1
    if [[ -d $FILE ]]; then
        echo "Folder path is provided, please provide a file"
        return
    fi

    if [ ! -f "$FILE" ]; then
        echo "$FILE does not exist."
        return
    fi

    if [ "$#" -ge 1 ]; then
        emacsclient -qt -e '(progn (find-file "'$FILE'"))'
        if [ $? -eq 0 ]; then
            true
        else
            emacsclient -qt -e '(progn (find-file "'$FILE'"))'
        fi
    else
        echo "## Please provide a file"
    fi
}

open_emacs file.py


texts: How to set up company mode for ESS Julia

texts:
I have ESS installed and I do get company mode drop down menus, but there's nothing Julia specific. For example, I get completion options for functions or variables that I have defined elsewhere in the code, but I do not get options for anything in the julia language.

These are the julia/ess related lines in my .emacs:

(load "ess-site")
(setq inferior-julia-program-name "/usr/bin/julia")


texts: Dashes (or strippled line, dashed) in tabbar for emacs with X

texts:
I'm trying to go full minimalist over here... But I can't figure out how to remove the strippled line next to "untitled".
I'd like it to be nothing at all.

The customizations I've done so far for tabbar in my .emacs is under the image.

The strippled line does not appear when tabbar is uncustomized.
It appears when '(tabbar-background-color "color-237") is set.

;; Loads tabbar and customizations
(tabbar-mode 1)
(setq tabbar-use-images nil)
(setq tabbar-buffer-groups-function(lambda() (list "All Buffers")))
(defun buffer-groups()
  (list (cond ((string-equal "*" (substring (buffer-name) 0 1)) "emacs")
              ((eq major-mode 'dired-mode) "emacs") (t "user"))))
(setq tabbar-buffer-groups-function 'buffer-groups)

and some from customize-group:

'(tabbar-background-color "color-237")
'(tabbar-buffer-home-button (quote (("") "")))
'(tabbar-home-button (quote (("") "")))
'(tabbar-scroll-left-button (quote (("") "")))
'(tabbar-scroll-right-button (quote (("") "")))
'(tabbar-separator (quote (2)

'(tabbar-button ((t nil)))
'(tabbar-default ((t (:background "color-237" :foreground "color-250"))))
'(tabbar-highlight ((t nil)))
'(tabbar-modified ((t (:inherit tabbar-default :foreground "#87D700"))))
'(tabbar-selected ((t (:inherit tabbar-default :foreground "#1EE8FF"))))
'(tabbar-selected-modified ((t (:inherit tabbar-default :foreground "#1EE8FF"))))
'(tabbar-unselected ((t (:inherit tabbar-default))))


texts: How to fontify keyword arguments in `python-mode`?

texts:
I'm coding in python and it seems like the python-mode doesn't color the keyword-arguments. Note that I'm not talking about general keywords but keyword-arguments.
As an example, in the next picture, I would like the texts arg1=, arg2= and arg3= to be colored in the call of the foo function (line 4).

This question has already been asked in this post three years ago but didn't get an answer (the only reply got the question wrongly).
I manage to do something with regexp:
(defface keyword-argument-zface
  '((t :foreground "goldenrod"))
  "Face for keyword-argument"
  :group 'python-print-color-faces)

(add-hook 'python-mode-hook
      '(lambda ()
         (highlight-regexp "[^[:space:]\n=(,;:]+=" 'keyword-argument-zface)))

which kind of works, because there isn't many cases where there isn't a space before the =, but as you can see in the result, this doesn't work every time:

Here, I don't want the arg2= from arg2=False to be colored...
Do somebody knows if there is a way to get a proper coloration of the keyword-arguments? Or if there is something better I can do here? (Also, I haven't really mastered elisp yet, so I might have done some things wrong! Feel free to correct me if I did!)


texts: How do I make C-x b (switch-to-buffer) ignore some buffers?

texts: I want C-x b (i.e. switch-to-buffer) to ignore some buffers. For example, I want to ignore *Ibuffer*. In other words, when I press C-x b, I should not see Switch to buffer (default *Ibuffer*): . *Ibuffer* should be skipped. Is there a way to make C-x b ignore particular buffers?


texts:
Is there any expression that matches all undone TODO states in a sparse-tree search?

Meaning: what's the shortest expression I can write if I do C-c / m that renders the same results as C-c / t?


texts: How to syntax highlight text which is not already highlighted?

texts:
I'd like to highlight function calls in C code, eg:

(font-lock-add-keywords 'c-mode
 `((,(concat
   "\\([_a-zA-Z][_a-zA-Z0-9]*\\)"       ; Object identifier
   "\\s *"                              ; Optional white space
   "(")                                 ; Paren for method invocation
   1 'font-lock-function-name-face t)))

However this will highlight switch (, if (, while ( ... etc. as well as text in comments.

Besides explicitly excluding all keywords in the regex above, is there a way to only highlight text which does not already have any highlighting applied?


texts: How to use the same TODO state in the next entry in org-mode?

texts:
Here is my use case

Say I have in current line

* TODO XYZ

When I hit M-<Return> it creates a new line as follows

* TODO XYZ
*

Is it possible to have the previous state continue?

* TODO XYZ
* TODO


texts:
Given a regexp A, how do I derive the inverse regexp B such that given any text exactly one of the two regexes will match it.

For example in the below example:

(rx (or (group ---regexpA---) ; a match
        (group ---regexpB---))) ; every group of text that's not matched by above

It should be the case that the concatenation of the list of matches should be exactly the contents of the buffer.

(string= (buffer-string)
         (let (string)
           (while (re-search-forward regexp nil t)
             (setq string (concat string
                                  (or (match-string-no-properties 1)
                                      (match-string-no-properties 2)))))
           string))


texts: Create and checkout to new branch by one command

texts:
If I need to create new branch and checkout to it I use two commands:

1.magit-branch
2.magit-branch-checkout

Is it possible by one command to create AND checkout to new branch?


texts: show top 5 used buffer at the bottom of buffer

texts:
I'm currently using helm-buffer,  and I have bind my c-x b to  (helm-buffers-list)，however when I switch buffer,  I still have to:
1.  c-x b
2.  type some works
3.  enter

sometimes, I probably just switch to prev/next buffer which can be done with switch-to={prev|next} buffer.  but I can't remember who is the prev/next buffer.

is there anyway to show top 5 used buffers at the bottom of buffer?


texts: Don't offer non-file-name as a file name in find-file

texts:
When opening a file with find-file, the default entry in the minibuffer is the current directory. If I press Down, I see the name of the current file (if the current buffer is visiting a file).

Sometimes, if I press Down, I see what seems to be a guess of a file name in the current buffer, and I need to press Down twice. How can I customize this “guess of a file name”?

Specifically, I often edit files that contain /** and this is offered at the find-file prompt even though it isn't a file name. How can I avoid getting offered to open /**?

I'm using Emacs 24.5 but I want to keep compatibility with other Emacs versions.


texts: Use spaces instead of tabs with use-package

texts:
This is more or less a question of putting the answer from Make web-mode always indent with spaces into the use-package declaration.

I want to set tab indent to 2 spaces, and use the spaces throughout the lines, even when reaching 8 spaces etc.

This is my effort so far, I've tried both setq and setq-default, and I've tried to put the init code in either :config or :init, but it's not working. When I "describe variable", tab-width is always 8 in the .go file that I'm opening.

(use-package go-mode
  :mode "\\.go\\'"
  :config
  (progn
    (setq-default tab-width 2)
    (setq-default indent-tabs-mode nil)
    ;; tab-width & indent-tabs-mode are both buffer-local so need setq-default
    )

  :init
  (progn
    (setq-default tab-width 2)
    (setq-default indent-tabs-mode nil)
    )

  )


texts: In LaTeX one can use ~ to produce a non-breaking space. Is there an analogue in org-mode?


texts: how to install Aquamacs' OSX spellchecker (NSSpellChecker) in GNU Emacs?

texts:
Spellcheck in Aquamacs works much better than either the default aspell or the improved hunspell.

Example typo: whtehr

Here are the suggestions provided by the various engines when I do flyspell-auto-correct-word.

Aspell: Corrections: whiter water watery whet White where white whatever whitener whets waiter etc. (i.e. it never gets to whether)

Hunspell: Corrections: Tehran (i.e. it never gets to whether)

Aquamacs: Corrections: whether (i.e. it gets to whether on the first try)

According to this page, "Aquamacs 2.0 and onwards uses the Mac OSX spell-checking system." It's not clear from the page whether the Mac OSX spell-checking system in question is CocoAspell, or if CocoAspell is recommended for version 1.9 and below.

So, how do I direct GNU Emacs to use the same spellchecker that Aquamacs uses?


texts: I want to use an interactive function to do something like vim's `gd n` in Emacs, search the current word in buffer

texts:
I want to use an interactive function to do the vim-like gd n in Emacs, search the current word in buffer

gd in vim will select current word(highlighting same words), and n will cycle selecting the current word in current file.
I used to use an interactive function(by google and copy), binding to 'M-n' to do this,
(or maybe it is a function in some package)
but a few days before my .emacs.d directory has lost by fault.
The last few days I've been searching for this function again and again and
did not get it.
Can any one help me with this?
By using this function, I can hit M-n just one time, the word
under/just-before/just-after point will be selected and point will
go to the next occurance of the same word under/just-before/just-after point.
thanks a lot!

Thank you all for your answers!

The key thing is here:
I should use the same kbd, say it is M-n to select the current word and to cycling all candidates.
so if I put point on a word, I just need to hit M-n multiple times to cycling all the same word in buffer.

Thanks!


texts: How do I prevent `M-x` then `C-g` from entering the debugger?

texts:
M-x version gives:

GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2019-12-02

Quitting the minibuffer in general, or (e.g.,) pressing M-x -> C-g in particular opens a *Backtrace* buffer with this in it:

Debugger entered--Lisp error: (quit)
  read-from-minibuffer("M-x " nil (keymap (7 . minibuffer-keyboard-quit) (10 . minibuffer-complete-and-exit) (13 . minibuffer-complete-and-exit) keymap (7 . minibuffer-keyboard-quit) (menu-bar keymap (minibuf "Minibuf" keymap (tab menu-item "Complete" minibuffer-complete :help "Complete as far as possible") (space menu-item "Complete Word" minibuffer-complete-word :help "Complete at most one word") (63 menu-item "List Completions" minibuffer-completion-help :help "Display all possible completions") "Minibuf")) (27 keymap (118 . switch-to-completions)) (prior . switch-to-completions) (63 . minibuffer-completion-help) (32 . minibuffer-complete-word) (9 . minibuffer-complete) keymap (menu-bar keymap (minibuf "Minibuf" keymap (previous menu-item "Previous History Item" previous-history-element :help "Put previous minibuffer history element in the minibuffer") (next menu-item "Next History Item" next-history-element :help "Put next minibuffer history element in the minibuffer") (isearch-backward menu-item "Isearch History Backward" isearch-backward :help "Incrementally search minibuffer history backward") (isearch-forward menu-item "Isearch History Forward" isearch-forward :help "Incrementally search minibuffer history forward") (return menu-item "Enter" exit-minibuffer :key-sequence "\015" :help "Terminate input and exit minibuffer") (quit menu-item "Quit" abort-recursive-edit :help "Abort input and exit minibuffer") "Minibuf")) (10 . exit-minibuffer) (13 . exit-minibuffer) (7 . minibuffer-keyboard-quit) (C-tab . file-cache-minibuffer-complete) (9 . self-insert-command) (XF86Back . previous-history-element) (up . previous-line-or-history-element) (prior . previous-history-element) (XF86Forward . next-history-element) (down . next-line-or-history-element) (next . next-history-element) (27 keymap (114 . previous-matching-history-element) (115 . next-matching-history-element) (112 . previous-history-element) (110 . next-history-element))) nil extended-command-history nil nil)
  completing-read-default("M-x " #f(compiled-function (string pred action) #<bytecode 0x2859eb>) commandp t nil extended-command-history nil nil)
  completing-read("M-x " #f(compiled-function (string pred action) #<bytecode 0x2859eb>) commandp t nil extended-command-history)
  read-extended-command()
  byte-code("\302\030\011\303 \010E)\207" [execute-extended-command--last-typed current-prefix-arg nil read-extended-command] 3)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

I've google'd a bit, and not found anything similar. I suspect something like out of date packages on my install, but any hints would be appreciated.


texts: Query-replace in multiple LaTeX environments, narrowing each in turn

texts:
I am trying to come up with a Elisp function that narrows a buffer to a certain LaTeX enviroment (table, figures, ...), does some query-replace-regexp inside the narrowing, then searches for the next occurrence of the environment and does the same, until the last occurrence of the environment.

I have come up with this:

(defun narrowtable ()
  "narrowing on table environment"
  (interactive)
  (beginning-of-buffer)
  (save-excursion
    (search-forward "begin{table}")
    (LaTeX-narrow-to-environment)
    (goto-char (point-min))
    (query-replace "X" "B"); Just some query-replace
    (widen)))

which works for fine the first occurence of {table}, but only for that.

I guess I misplaced save-excursion for this to work properly, or there is something other to improve?


texts: Install package git-gutter or git-gutter-fringe conditionally

texts:
I’m trying to install git-gutter or git-gutter-fringe depending if I’m running in graphics mode or not. I have an if statement for that:

(if (display-graphic-p)
    (use-package git-gutter-fringe
      ;; package setup here)
  (use-package git-gutter
    ;; same package setup here))

I was trying to do it with

(use-package (if (display-graphic-p) git-gutter-fringe git-gutter)
  ;; package setup here)

or

(let ((package-name (if (display-graphic-p) "git-gutter-fringe" "git-gutter-fringe")))
  (use-package package-name
    ;; package setup here))

But none of these succeeds.

The final question is, is it possible to do what I want, or do I have to stay with my current config?


texts: How to detect the term color support inside of a emacsclient session?

texts:
I run a emacs daemon on boot as a OpenRC service without info about terminals. When I plug a different terminal on emacsclient so, I don't have env variables instead that was generated inside of emacs or defined on service config. Beyond that, I got different behaviors on face colors of my theme because on each terminal will have different color support. For instance, running emacsclient through the xfce4-terminal inside of a tmux session I got:

Plugging the same tmux session on uxterm or running without X, I got instead:

(is the same emacsclient session, so is the same frame for both because tmux)

My wish is: modify the frame face colors only if I don't have a good color support on terminal, which happens on my case with xterm on running without X (console mode C-M-F{1,9}). I want do that because the face background colors for helm-selection and region is just black (I can't see they on xterm and this is pretty bad for usage).

For now I'm just change the face colors on frame creation for non-X sessions to red, like terminal sessions through this function: setup-terminal-session.
But this change even the behavior inside of xfce4-terminal (which runs pretty fine because the good color support) and is unecessary.

Maybe I can fix the behavior of xterm forcing a type of color support on config through .Xdefaults or .Xresources file, but and the case of running emacs without X? I don't have full color support on that. So seems a kind of limitation here on a simple thing.

Anyway, my question is (again): there is a way to detect the color support of terminal inside of emacsclient without relying on ENV variables? I just don't understand how termcap and terminfo works reading the docs, would be nice a clarification on that. Thanks.


texts: How to set up emacsclient as default editor on Debian?

texts:
What am I trying to achieve

I want to use emacsclient (not emacs) as my default text editor on Debian Buster.

What have I tried so far

Alternatives:

> sudo update-alternatives --config editor`
There are 3 choices for the alternative editor (providing /usr/bin/editor).

Selection    Path                Priority   Status
------------------------------------------------------------
  0            /bin/nano            40        auto mode
  1            /bin/nano            40        manual mode
  2            /usr/bin/emacs       0         manual mode
* 3            /usr/bin/vim.basic   30        manual mode

Emacs is listed here, but when I choose 2, and test using git rebase -i HEAD~3 (in a git directory) it launches a new emacs instance.
$EDITOR & $VISUAL:

I added these 2 lines in my .bashrc:

EDITOR="emacsclient -nw"
VISUAL=emacsclient

I can confirm the values are set but git rebase -i HEAD~3 still opens a vim.  (This is despite the fact the documentation saying that $EDITOR & $VISUAL are taken into account )

How can I set my default editor to be emacsclient, both for terminal & GUI? (Preferably without changing my system in too many places)


texts: Wish to define specific defcustom entries

texts:
I wish to define following two defcustom entries:

INS DEL Server[1] (customizable server name)

Host name, string
User name, string
Password, password or string
Port number integer 5432 by default
Disabled OFF by default

Another defcustom should reference the first one:

INS DEL Dynamic set (string)

Server name, referencing or matching[1] above.
Node ID (integer)


texts: Truncate only certain lines and use continuation lines elsewhere?

texts:
Q: how can I use truncate-lines in only part of a buffer?

As a general rule, I prefer continuation
lines
to truncating
lines.
However, it would be nice to truncate only certain kinds of lines
in a given buffer.

In an ideal world, I would like to truncate headings in org-mode
(and outline-mode more generally) but not use truncate-lines
in the entry bodies.  Is that possible with a minimum of fuss, or
would it require a major replumbing of the internals?


texts: Set org-duration-units for org-mode scheduling

texts:
I'm trying to set org-duration-units that's used by org-mode effort estimates for formatting times in 8 hour days instead of 24 hours days.

I'm in no way an emacs and lisp expert, currently learning as I go along. I tried this in my ~/.emacs file:

(use-package org
  :mode (("\\.org$" . org-mode))
  :ensure org-plus-contrib
  :custom
   (org-duration-units   `(("min" . 1)
   ("h" . 60)
   ("d" . ,(* 60 8))
   ("w" . ,(* 60 8 5))
   ("m" . ,(* 60 8 5 4))
   ("y" . ,(* 60 8 5 4 11)))
  )
  :config
    (setq org-clock-persist 'history)
    (org-clock-persistence-insinuate)
    (setq org-clock-idle-time 15)
    (setq org-duration-format 'h:mm)

 ;; also tried to set it in the config block instead to be executed after load
 ;; (setq org-duration-units   `(("min" . 1)
 ;;                               ("h" . 60)
 ;;                               ("d" . ,(* 60 8))
 ;;                               ("w" . ,(* 60 8 5))
 ;;                               ("m" . ,(* 60 8 5 4))
 ;;                               ("y" . ,(* 60 8 5 4 11))))
 ;;  (org-duration-set-regexps)

    )

I then try to use org-duration-from-minutes in some code displaying a table to convert a duration to some nicely formatted times with 8 hour days. Here is a minimum org-mode example:

#+BEGIN_SRC emacs-lisp

;; six month of 4 weeks of 5 days of 8 hours per day (120 days of 8 hours)
;; expecting 6m 00:00
;; or 40 days of 24 hours

(print (org-duration-from-minutes 57600 ))
#+END_SRC

#+RESULTS:
: 40d 0:00

It shows it in 24h days format. When I run

(setq org-duration-units `(("min" . 1) ("h" . 60) ("d" . ,(* 60 8)) ("w" . ,(* 60 8 5)) ("m" . ,(* 60 8 5 4)) ("y" . ,(* 60 8 5 4 10))) )

Then it shows it as 120d 0:00

How do I get emacs to set org-duration-units at startup ? It looks like it's either not set or overridden in the way I do it.


texts: Separate auth-sources for Tramp and Gnus, or disable auth-sources for Tramp?

texts:
I have passwords stored in .authinfo.gpg file which I only need for Gnus. I never store passwords for machines or localhost in this .authinfo.gpg file (or in any other file).

The problem is when I use Tramp (e.g. C-x C-f, then type in su::), I constantly get prompted for password for .authinfo.gpg which I don't need.

Is it possible to disable password prompt for .authinfo.gpg when using Tramp? An alternative solution would be to use some other file for Gnus, is there a way to do this?


texts: Automating org-mode export with org-reveal exporter

texts:
I have an org-mode document that I am exporting to reveal.js via org-reveal.
Currently, I do a (require 'ox-reveal)  and then I can do C-e R R from within my org-mode document.
I am wondering how I can script this so I can do this from within bash.
I currently have a bash script for a related project that does uses batch mode as follows,

emacs my-doc.org --batch -f org-html-export-to-html --kill

I am wondering how to adapt this to org-reveal.
Part of the problem is making sure (require 'ox-reveal) happens in batch mode.

Looking forward to any pointers here.

Thanks!


texts: smtpmail.el: How to tell if gnutls has started

texts:
Like the poster here I'm having difficulty connecting to an smtp server that uses tls.  I have installed gnutls-cli but I am still getting an error, "530 5.7.0 Must issue a STARTTLS command first. ub8sm33925197wjc.39 - gsmtp".
How can I tell if smtpmail.el is really finding this program?  I have set up .key and .cert files, too, eventhough I'm not sure if they're necessary.

Here are all my settings:

(setq
 send-mail-function 'smtpmail-send-it
 message-send-mail-function 'smtpmail-send-it
 user-mail-address "XXXX.YYYY@gmail.com"
 smtpmail-starttls-credentials '(("smtp.gmail.com" "587"
           "~/.gnutls/smtp.gmail.com.key" "~/.gnutls/smtp.gmail.com.cert"))
 smtpmail-auth-credentials  (expand-file-name "~/.authinfo")
 smtpmail-default-smtp-server "smtp.gmail.com"
 smtpmail-smtp-server "smtp.gmail.com"
 smtpmail-smtp-user "XXXX.YYYY@gmail.com"
 smtpmail-smtp-service 587
 smtpmail-stream-type 'ssl
 smtpmail-debug-info t
 smtpmail-debug-verb t
 starttls-extra-arguments nil
 starttls-gnutls-program "/usr/bin/gnutls-cli"
 starttls-extra-arguments nil
 starttls-use-gnutls t
)

Many thanks.


texts: How to change the line height in the menu

texts:
Here "menu" means something which appears when you hit F10. (Not the menubar.)

Because my display is small, several options are hidden below. (See the following image. You can not see "Quit".)

This is sometimes annoying me, so I would like to make the line hight in the menu list smaller. But the following gtk.css does not affect the line-height.

#pane #menubar GtkMenuShell
{
    line-height: 100px !important;
    background-color: #000;
}

My question is : what should I write in gtk.css to change the line-height in the list of menu?


texts:
I have enabled both company-mode and anaconda-mode, as well as add anaconda-company as backend to the python-mode-hook. Even issuing anaconda-mode-complete with C-M-i produces no completions. But if I enable company-dabbrev-code it shows limited amount of completions.
I have installed conda from anaconda.com but not sure how it is supposed to run as a service. Do I need to setup something outside of emacs, such as downloading packages?
Below is my portion of init,
(add-hook 'python-mode-hook 'company-mode)

(use-package anaconda-mode
  :ensure t
  :config
  (add-hook 'python-mode-hook 'anaconda-mode))

(use-package company-anaconda
  :ensure t
  :init (require 'rx)
  :after (company)
  :config
  '(add-to-list 'company-backends 'company-anaconda))


texts: Slime creates new window every time you interact with the debugger

texts:
While using slime+emacs, I'm having a problem when interacting with the debugger: every time that I choose one of the debugger's option, a new window pops up in Emacs.

For example, when evaluating:

(step (progn
        (print 1)
        (print 2)
        (print 3)))

The debugger prints:

Evaluating call:
  (PRINT 1)
With arguments:
  1
   [Condition of type SB-EXT:STEP-FORM-CONDITION]

Restarts:
 0: [STEP-CONTINUE] Resume normal execution
 1: [STEP-OUT] Resume stepping after returning from this function
 2: [STEP-NEXT] Step over call
 3: [STEP-INTO] Step into call
 4: [RETRY] Retry SLIME REPL evaluation request.
 5: [ABORT] Return to sldb level 3.
 --more--

Backtrace:
  0: ((LAMBDA ()))
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LET ((SB-IMPL::*STEP-OUT* :MAYBE)) (UNWIND-PROTECT (SB-IMPL::WITH-STEPPING-ENABLED #))) #S(SB-KERNEL:LEXENV :FUNS NIL :VARS NIL :BLOCKS NIL :TAGS NIL :TYPE-RESTRICTIONS ..
  2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (STEP (PROGN (PRINT 1) (PRINT 2) (PRINT 3))) #<NULL-LEXENV>)
  3: (EVAL (STEP (PROGN (PRINT 1) (PRINT 2) (PRINT 3))))
 --more--

So I choose the option 2, STEP-NEXT and it correctly goes to the next form:

Evaluating call:
  (PRINT 2)
With arguments:
  2
   [Condition of type SB-EXT:STEP-FORM-CONDITION]

Restarts:
 0: [STEP-CONTINUE] Resume normal execution
 1: [STEP-OUT] Resume stepping after returning from this function
 2: [STEP-NEXT] Step over call
 3: [STEP-INTO] Step into call
 4: [RETRY] Retry SLIME REPL evaluation request.
 5: [ABORT] Return to sldb level 3.
 --more--

Backtrace:
  0: ((LAMBDA ()))
  1: (SB-INT:SIMPLE-EVAL-IN-LEXENV (LET ((SB-IMPL::*STEP-OUT* :MAYBE)) (UNWIND-PROTECT (SB-IMPL::WITH-STEPPING-ENABLED #))) #S(SB-KERNEL:LEXENV :FUNS NIL :VARS NIL :BLOCKS NIL :TAGS NIL :TYPE-RESTRICTIONS ..
  2: (SB-INT:SIMPLE-EVAL-IN-LEXENV (STEP (PROGN (PRINT 1) (PRINT 2) (PRINT 3))) #<NULL-LEXENV>)
  3: (EVAL (STEP (PROGN (PRINT 1) (PRINT 2) (PRINT 3))))
 --more--

But it also splits emacs window, adding a brand new one! After 3 or 4 of these it stops working, with many new windows.

What is causing this?

EDIT:
I'm using SBCL-1.2.11 and SLIME 2015-02-19. My Emacs is the latest version of Emacs Live.


texts: Changing the appearance of org-mode “hidden contents” ellipsis

texts:
In org-mode, when the contents of a subtree are hidden you see something like

* Some tree
  :PROPERTIES:...

** Another One...

Is there a way to change those ... to something else? I'd like to use something shorter like a utf-8 ellipsis or a rounded arrow.


texts: org-babel SQL How to use SELECT result single result without data cleanup?

texts:
I have quite a few SQL org-babel functions for fetching various(single record) IDs from the database.
The snippet below works, but is there any way to skip that middle function that converts SQL result to a simple string? My goal here is to DRY this org-mode/org-babel file.
#+name: raw-sql-token
#+BEGIN_SRC sql :results value
  SELECT 123 AS token
#+END_SRC

#+name: sql-token
#+BEGIN_SRC sql :var input=raw-sql-token :results value
  (print (nth 0(nth 0 input)))
#+END_SRC

#+HEADER: :var id=sql-token
#+BEGIN_SRC http :pretty
  GET http://localhost:3000/api/items/${id}
#+END_SRC


texts: Can evil-visual-block show inserted text on all lines like string-rectangle does?

texts:
In regular (non-evil) emacs, if you select a rectangular region and hit C-x r t to run string-rectangle, inserted text is displayed on all the selected lines as you type.

In Vim, if you select a visual-block and hit I, inserted text is only displayed on the top line until you finish by hitting Escape, at which point it inserts the text on all non-empty lines.

I was really hoping that evil-mode would combine the best of both worlds: select a rectangular region, hit I, and inserted text is displayed on all non-empty lines as you type. Unfortunately, it doesn't display the text as you type.

Is there a way to either make evil-insert display inserted text on all non-empty lines or get string-rectangle to respect empty lines?

Edit: I just realized there's also string-insert-rectangle, which is like visual-block I, in that it inserts text along the left edge of the rectangle, whereas string-rectangle is more like visual-block s because it replaces the existing contents of the rectangle with inserted text.

string-insert-rectangle also doesn't show the final results in the buffer until you complete your input, which makes me wonder if there's a reason behind this I haven't thought of.


texts: Only allow kill-ring-save if there is highlighted text

texts:
I would like to wrap kill-ring-save in order to only execute kill-ring-save if text has been highlighted - same as in most text editors.

Sometimes I accidentally hit copy instead of paste and then my clipboard is over written, but I have not selected any text for copying. Personally it's a complete workflow killer.

Something like:

(defun my-kill-ring-save()
  (interactive)
  (if (TEXT IS HIGHLIGHTED)
    (kill-ring-save)))


texts: Italics not shown in block quotes in orgmode

texts:
In my blockquotes in org-mode, the fontification does not pick up on italics. I have looked at this question and answer that says it was fixed several years ago, but my issue persists.
I have tried using describe-face to find the issue but it does not seem to contain any modifications that should affect or hide italics:
    Face: org-quote (sample) (customize this face)

    Documentation:
    Face for #+BEGIN_QUOTE ... #+END_QUOTE blocks.

    Defined in ‘org-faces.el’.

           Family: unspecified
          Foundry: unspecified
            Width: unspecified
           Height: unspecified
           Weight: normal
            Slant: unspecified
       Foreground: #181818
DistantForeground: unspecified
       Background: grey95
        Underline: unspecified
         Overline: unspecified
   Strike-through: unspecified
              Box: unspecified
          Inverse: unspecified
          Stipple: unspecified
             Font: unspecified
          Fontset: unspecified
           Extend: unspecified
          Inherit: unspecified

Italics show fine in other text. Here is an example showing the same text italicized, inside and outside a block quote:

C-u C-x = on italicized text gives this:
             position: 488528 of 488671 (100%), column: 30
            character: n (displayed as n) (codepoint 110, #o156, #x6e)
              charset: ascii (ASCII (ISO646 IRV))
code point in charset: 0x6E
               script: latin
               syntax: w    which means: word
             category: .:Base, L:Left-to-right (strong), a:ASCII, l:Latin, r:Roman
             to input: type "C-x 8 RET 6e" or "C-x 8 RET LATIN SMALL LETTER N"
          buffer code: #x6E
            file code: #x6E (encoded by coding system utf-8-unix)
              display: by this font (glyph code)
    mac-ct:-*-Libre Baskerville-normal-normal-normal-*-13-*-*-*-p-0-iso10646-1 (#x04)

Character code properties: customize what to show
  name: LATIN SMALL LETTER N
  general-category: Ll (Letter, Lowercase)
  decomposition: (110) ('n')

There are text properties here:
  face                 org-quote
  font-lock-fontified  t
  font-lock-multiline  t
  fontified            t
  line-prefix          [Show]
  org-emphasis         t
  wrap-prefix          [Show]


texts:
I'm using this code on Xubuntu (emacs 24.5.1) but it throw error on windows (emacs 25.0.50.1 64bit)

(defun ignore-error-wrapper (fn)
  "Funtion return new function that ignore errors.
   The function wraps a function with `ignore-errors' macro."
  (lexical-let ((fn fn))
    (lambda ()
      (interactive)
      (ignore-errors
        (funcall fn)))))

(global-set-key [s-left] (ignore-error-wrapper 'windmove-left))
(global-set-key [s-right] (ignore-error-wrapper 'windmove-right))
(global-set-key [s-up] (ignore-error-wrapper 'windmove-up))
(global-set-key [s-down] (ignore-error-wrapper 'windmove-down))


texts: why is switch-to-buffer effect not visible immediately when called in a list with other functions?

texts:
I have a key bound to some program which prepares a buffer, switches to it via switch-to-buffer and afterwards calls some function which modifies the buffer (and can take a few seconds to execute).

When pressing the key, this modifying function is executed before the buffer is actually switched (noticeable by a considerable lag), although it appears after switch-to-buffer.

Can somebody please explain why this is the case?

Here are full details, although I don't think these are relevant for my problem:

I'm using elfeed and have set elfeed-entry-switch, which by default is just #'switch-to-buffer, to #'my-elfeed-entry-switch, where

(defun my-elfeed-entry-switch (buffer)
    (with-current-buffer buffer
      (switch-to-buffer buffer)
      (org-latex-preview)))

The computationally intensive function therefore is org-latex-preview, which renders and displays inline latex code and, like I wrote, sometimes takes several seconds to complete.

When trying to switch to an entry which contains a lot of latex code, I have to wait for a second or so before the buffer becomes visible.

What I actually expect is that the buffer first becomes visible (with unrendered latex code) and then org-latex-preview starts its work, which it does if called interactively.

UPDATE As suggested below, removing with-current-buffer does not solve the problem, i.e.

(defun my-elfeed-entry-switch (buffer)
    (switch-to-buffer buffer)
    (org-latex-preview))

still does not show the buffer before org-latex-preview has finished rendering.


texts:
While writing RoR code I often need to run drop into a pry session or a debugger. So I place my binding.pry line in the implementation code and run my spec(s). That works fine if I run the specs in a terminal but from inside Emacs, I get a messy output and it's very hard to use the debugger/pry.

How are you guys doing that ?


texts: Org-mode: How do you carry over incomplete todo items?

texts:
I use the following to keep track of my daily tasks/todos etc:

** Monday 03.10.2016 [7/18]...
** Tuesday 04.10.2016
       CLOCK: [2016-10-04 Di. 09:00]
Some things to do...

How would I carry over the open tasks from Monday to Tuesday's block in org-mode?


texts: web-mode comment function doesn't work well in php codes

texts:
In web-mode, when it comes to HTML file, press M-; will comment the selected region very well. But in PHP file, it does not work correctly, the following is the screenshot:

Any more config work should be done?
Thanks in advance.


texts:
I am trying to write a function that can be used to make a keybinding "remember" the key sequence that led up to the function being called.

(defun modal-function (func)
  (funcall func)
  (set-transient-map (somehow-get-map-that-called-this-function)))

(global-set-key (kbd "C-x m h") (lambda () (interactive) (modal-function 'move-left)))
(global-set-key (kbd "C-x m j") (lambda () (interactive) (modal-function 'move-down)))
(global-set-key (kbd "C-x m k") (lambda () (interactive) (modal-function 'move-up)))
(global-set-key (kbd "C-x m l") (lambda () (interactive) (modal-function 'move-right)))

So running C-x m h j k l would result in (move-left) (move-down) (move-up) (move-right).

I've read the posts about making one command repeatable as well as smartrep.el but it is not really what I'm looking for.


texts: How can I store an org-link to a list of search results from ivy-occur?

texts:
When I use counsel-rg to grep through a directory hierarchy, once a list of search results has been displayed in the minibuffer, I can use ivy-occur to save the list in a dedicated buffer.

How can I instruct org-mode so that org-store-link can preserve a permanent link to such a buffer and org-insert-link can insert one and hitting org-return when the cursor is over such a link will re-run the search command and bring up a corresponding ivy-occur buffer?


texts: Call a function by its key (inside a script)

texts:
I have a tool that allows me to use the same key (shortcut) C-c C-f to call different functions. Actually I can choose different options (different functions) to pass to the LaTeX compiler, binding them to the shortcut C-c C-f.

Here's my tool (to better clarify my question):

(defun ToggleTexFileBehaviour (&optional COMMAND)
  "Description..."
  (interactive)

  (if COMMAND ;; For inside script use
      (define-key latex-mode-map "\C-c\C-f" (intern-soft COMMAND))
    ;; *ELSE*:
    (let ((Latex_setting
       (read-string "Choose your option:
"
            "tex-file"  nil (list "tex-file-eye-comfort"
                          "tex-file-draft"
                          "tex-file-boxed-figures"
                          "tex-file-colored-background"
                          "tex-file-linenumbers"
                          "tex-file-showframe"
                          "tex-file-pagebreaks-highlight"
                          ))))
      (define-key latex-mode-map "\C-c\C-f" (intern-soft Latex_setting))
      (command-execute (intern-soft Latex_setting))
      )
    ))
(local-set-key  (kbd "C-s-c")'ToggleTexFileBehaviour)

My question is how can I call the function binded to my key/shortcut from inside a script? I mean something like:

(call-function-binded-to-key (kbd "C-cC-f"))


texts: How to refresh emacs server after changes to init file or packages?

texts:
I recently managed to get Emacs server to work. But after I worked on my init file and changed some code in one elpa package, the changes were not visible.

I did the load-file for ~/.emacs, and bytecompiled the elpa directory. After this I could see the changes when I started emacs -nw from the terminal, but now when using emacsclient.

How could this be resolved? If I have to shut down and rerun the server, how do I do it? ( I set it to start at login with systemd)


texts: keep focus when opening weblinks in browser from org mode

texts: Hi I'm heavily using the feature C-c C-o in org mode to open the links in org mode in my firefox. I have org lists with these links and I want to open a bunch of them and then go through this websites in the end. Currently after opening the links the focus switches to the browser tab and I need to go back to emacs myself. Is there a way to tell emacs not to switch focus to the opened browser tab?


texts: How does SMIE mode determine what the parent of a token is?

texts:
I'm writing indentation rules for a custom mode using SMIE.

I want to use smie-rule-parent-p to have different behavior for indenting an empty line depending on context, so inside my indentation rules function, I have a case like this:

(`(:elem . empty-line-token)
     (if (smie-rule-parent-p ",") "," "---"))

(The "---" is a token that's always indented at column 0.)

The source language has definitions that look like this:

type Network = DC { reference_id    : ReferenceId
                  , inventory_class : InventoryClass
                  , children        : [Network]
                  }

when I start a new line in the middle of the { .. } block, I want it indented in line with the commas:

type Network = DC { reference_id    : ReferenceId
                  , inventory_class : InventoryClass
                  , children        : [Network]
                  ^ -- I want the cursor here after indenting.
                  }

The rule using smie-rule-parent-p "," accomplishes this, but it also fires in other parts of the code. In fact, it even triggers when there isn't a single comma in the whole buffer.

How does SMIE determine what the parent of a token is? Can I use that to indent empty lines differently depending on context like I'm trying here?


texts: Is it possible to associate minor modes with windows rather than buffers?

texts:
Does Emacs have some notion of associating minor modes with windows rather than setting them as "global" or "buffer-local"?

For example, in a certain window layout I may wish to have a minor mode associated with a particular window regardless of the buffer currently shown in that window.


texts: Show both relative and absolute line numbers in Emacs 26

texts:
One of the new features in Emacs 26 is display-line-numbers-mode:

Emacs now supports optional display of line numbers in the buffer.
This is similar to what linum-mode provides, but much faster and
doesn't usurp the display margin for the line numbers.  Customize the
buffer-local variable 'display-line-numbers' to activate this optional
display.  Alternatively, you can use the `display-line-numbers-mode'
minor mode or the global `global-display-line-numbers-mode'.  When
using these modes, customize `display-line-numbers-type' with the same
value as you would use with `display-line-numbers'.

Up to now, I've been using linum-relativenumber to get both relative and absolute line numbers at the same time.  Here is how it looks:

Now that the new display-line-numbers-mode feature is here, with promises to be much faster, I thought maybe I could switch to using that instead.

But I haven't been able to figure out how to get it to show both relative and absolute line numbers, since the help for display-line-numbers-type points to display-line-number, which says:

Non-nil means display line numbers.
If the value is t, display the absolute number of each line of a buffer
shown in a window.  Absolute line numbers count from the beginning of
the current narrowing, or from buffer beginning.  If the value is
‘relative’, display for each line not containing the window’s point its
relative number instead, i.e. the number of the line relative to the
line showing the window’s point.

and there doesn't seem to be a both setting.

Can anyone suggest a way to get both relative and abolute line numbers using the new display-line-numbers-mode feature?


texts:
I was wondering if anyone already wrote a function to tangle an org-chunck to an org-file section. Maybe not even as a code chunck but rather as a org-chunck itself. I am trying to construct a not straightforward pipeline that would help me organizing my work.
Happy to hear similar solutions of the community.
Example
#+BEGIN_SRC js :tangle "../out_file.org PARAMETER FOR SECTION (SAY bob)"
console.log("hello from org mode");
#+END_SRC

Then the tangled result in out_file.org should look smth like this
* whatever section

content content

* bob

console.log("hello from org mode");

* other whatever section

content content

Or even better
* whatever section

content content

* bob

console.log("hello from org mode");

* other whatever section

#+BEGIN_SRC js
console.log("hello from org mode");
#+END_SRC

Thank you in advance.


texts: Exporter for Org: can quote-block get headline's property?

texts:
With org-export-define-backend, I want to make quote-block get current headline's properties.

For example, define a function org-my-headline(headline contents info) for exporting headline , I can get the values within :PROPERTIES:  ...  :END: in org-my-headline like this:

(defun org-my-headline (headline contents info)
    ...
    (org-element-property :PROPERTY_NAME headline)
    ...
)

Now I want to define a function org-my-quote-block(quote-block contents info) for exporting quote-block, and its behavior can be changed by current headline's property (e.g. :QUOTE_BLOCK: hide), can this task be done?

Or another way: is #+BEGIN_QUOTE able to get the options in title like #+BEGIN_SRC python can get the value python via (org-element-property :language src-block)?

(update: the second way should be impossible...just tried org-element-parse-buffer, and found it will ignore all options strings in #+BEGIN_QUOTE)


texts: How to link and open a PDF file to a specific page -- skim / adobe?

texts:
Q:  How can I create a link in org-mode to a specific page of a PDF file, which can be opened (in either Skim or Adobe) with a mouse-click?

* My example heading. :tag:
  [[pdf:/path/to/file.pdf#105][My description.]]


texts: Replacing text with svg image via font lock

texts:
I've made small function to create SVG tags (see below) and I would like to use the image property of faces to replace some keywords. I'm not sure how to do that and if it is possible. For example, any :NOTE: would be replaced by the image returned by the (tag "NOTE") call. From Replacing a string with symbols using font-lock?, it seems possible but I'm not sure how to adapt the code for image.
Code:
(require 's)
(require 'svg)

(defface tag-face
  '((t :foreground "white" :background "orange" :box "orange"
       :family "Roboto Mono" :weight light :height 120))
  "Face for default tag" :group 'tag)

(defun tag (text &optional face inner-padding outer-padding radius)
  (let* ((face       (or face 'tag-face))
         (foreground (face-attribute face :foreground))
         (background (face-attribute face :background))
         (border     (face-attribute face :box))
         (family     (face-attribute face :family))
         (weight     "light") ;; (face-attribute face :weight))
         (size       (/ (face-attribute face :height) 10))

         (tag-char-width  (window-font-width nil face))
         (tag-char-height (window-font-height nil face))
         (txt-char-width  (window-font-width))
         (txt-char-height (window-font-height))
         (inner-padding   (or inner-padding 1))
         (outer-padding   (or outer-padding 0))

         (text (s-trim text))
         (tag-width (* (+ (length text) inner-padding) txt-char-width))
         (tag-height (* txt-char-height 0.9))

         (svg-width (+ tag-width (* outer-padding txt-char-width)))
         (svg-height tag-height)

         (tag-x (/ (- svg-width tag-width) 2))
         (text-x (+ tag-x (/ (- tag-width (* (length text) tag-char-width)) 2)))
         (text-y (- tag-char-height (- txt-char-height tag-char-height)))

         (radius  (or radius 3))
         (svg (svg-create svg-width svg-height)))

    (svg-rectangle svg tag-x 0 tag-width tag-height
                   :fill        border
                   :rx          radius)
    (svg-rectangle svg (+ tag-x 1) 1 (- tag-width 2) (- tag-height 2)
                   :fill        background
                   :rx          (- radius 1))
    (svg-text      svg text
                   :font-family family
                   :font-weight weight
                   :font-size   size
                   :fill        foreground
                   :x           text-x
                   :y           text-y)
    (svg-image svg :ascent 'center)))

(insert-image (tag "INFO")) ;; Type C-x C-e here to see the tag

Result:

Update:
Something like this almost works but the call is not evaluted:
(add-to-list 'font-lock-extra-managed-props 'display)
(font-lock-add-keywords nil
     '(("\\(\:TODO\:\\)" 1 '(face nil display (tag "TODO")))))


texts: Emacs init with spacemacs fails all the time - Error connection time out for melpa repository

texts:
I installed GNU Emacs 25.2.1 64bit and downloaded spacemacs the way it is described in their git repo.

Now when starting up through runemacs.exe the following output occurs:

Warning (spacemacs):
Error connection time out for melpa repository!
Warning (spacemacs):
Error connection time out for gnu repository!
Warning (initialization): An error occurred while loading ‘c:/Users/p.hoefer/AppData/Roaming/.emacs.d/init.el’:

File error: Cannot open load file, No such file or directory, bind-map

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

Googling for this problem showed me it is a common issue but the solution there did not worked for me - or I am too stupid to use them right.


texts:
I have simple timer which makes sure a function is executed for every 10 seconds.

(setq interval 10)

(defun run-every-ten-seconds ()
    (do-something))

(defun start-timer ()
  (setq timer
    (run-at-time (current-time)  interval
                 'run-every-ten-seconds))))

Everything works fine.

Now instead of saving it for every 10 seconds, i want to increment 1 second every time it saves. So i need to save it after 10 seconds, then 11 seconds, 12 seconds and so on.

But when I try to cancel & start a new timer with the function, it is getting into infinite loop.

(defun run-every-ten-seconds ()
    (do-something)
    (cancel-timer timer)
    (setq interval (1+ interval))
    (setq timer
      (run-at-time (current-time)  interval
                   'run-every-ten-seconds)))

Any ideas to solve this?