texts: How to display the content of minibuffer in the middle of the emacs frame?

texts:
When working on a maximized Emacs frame, having the content of the minibuffer / echo area display at the bottom of the screen can be hard to see, but also causes to lose focus on the text being edited when typing a command – which is quite an issue in terms of usability.

Is there a way to either move the minibuffer / echo area in the centre of the current emacs buffer, over the the text being edited when minibuffer is active, or, better, to capture the content of the minibuffer and display it also in the centre of the current buffer whilst typing the command?


texts: Is it possible to add visual padding around a character?

texts:
Is it possible to add visual padding around a variable width character (generally too, I suppose)?

I've looked into using propertize and buffer-display-table to accomplish this, but every solution using those two has been a hack that ultimately fakes adding padding around the character.

An example of what I am trying to accomplish:

##|
| <-- I want this pipe to line up with the others
##|

Another example:
####|
௵|
####|

Manually adding padding around the variable width characters above is what I'd like to do. I don't know if it's possible though.

I already have a 'working' solution where I can add a space character after the other  char and then change the width of that space to line up the pipes. That isn't really 'padding' / 'margin' as it has the artifact of another character.


texts: Adding conditional control to function argument

texts:
How do we add conditional control to function arguments?

  (defun f (x)
    (let (x)
      (if (eq (x (or 1 2)))
      (print x)
    (print "Hey!"))))

I would like to call:

(f 1)
; 1
(f 2)
; 2
(f 3)
; Hey!


texts: eww browser is hanging at contacting duckduckgo

texts:
I’m trying out eww. I followed the instructions on this page, and there seems to be no mention of what might be going on. I’m not getting an error message. I’ve run eww RET <somekeyword>
With a few different keywords, and I always see at the top: [untitled]: https://duckduckgo.com/html/?q=thing, and at the bottom, contacting host: duckduckgo.com:443. I’ve waited for over two minutes, and my internet connection is fine.

What might be going wrong?


texts: Mapping equivalent local files to remote files when using tramp

texts:
I have two copies of the same project, one local, one on a remote server, and I am editing a project's file locally, while running an inferior ESS process on the remote server. The remote files get synchronized outside Emacs, and I would like to avoid editing files remotely if I can help it.

When I try to load the file (ess-load-file), it obviously sends the command "source()" as expected. The problem is that I would like it to use the file name with the local directories stripped from it because they don't exist on the remote server, just the bare filename.

I know thatess-load-file uses (buffer-file-name) to find out the file name, but I think I just can't replace a buffer's file name with whatever I want. I've been using

(ess-load-file (file-name-nondirectory (buffer-file-name)))

and rebinding the keybinding for ess-load-file to run this instead, but is there some nicer way of doing this?


texts: use-package: autoload function outside the main package file

texts:
I am trying to install simplenote2 to read my org files on my phone.
The official setup method is:

(require 'simplenote2)
(setq simplenote2-email "email@example.com")
(setq simplenote2-password "yourpassword")
(simplenote2-setup)

and the app starts with

M-x simplenote2-list

In practice credentials are not necessary in clear and (require...) can be omitted because simplenote2-setup is autoloaded.

I would like to use a use-package declaration, therefore I am using:

(use-package simplenote2
  :config
  (setq simplenote2-email "email@example.com")
  (setq simplenote2-password "yourpassword")
  (setq simplenote2-notes-mode (quote org-mode))
  (simplenote2-setup))

(The extra line is for org-mode integration).

When I start the library with M-x simplenote2-list, I get an error due to a void variable simplenote2-notes-info-version.
This variable is defined through a defvar in simplenote2.el. So, it seems that the use-package declaration is not requiring simplenote2.el.

The likely cause is that the autoloaded function simplenote2-list is defined in the separate file simplenote2-list.el. Therefore simplenote2-list requires only simplenote2-list.el, but not simplenote2.el.

If this is the cause, how can I instruct use-package to  require also simplenote2.el the first time M-x simplenote2-list is run?
Or alternatively: before running M-x simplenote2-list, how can I run the autoloaded (simplenote2-setup), which automatically requires simplenote2.el?

Note that I have the global option use-package-always-defer set true.


texts: Has anyone worked out configuring objed for ruby?

texts:
I am interested in trying out objed, but I find that out of the box it gets blocks and expressions wrong in ruby mode.  For example, I notice that in identifying a defun it includes any comments and blank lines above the current method:
# Convert the val to a Numeric if is already a Numeric or is a String that
# looks like one. Any Float is promoted to a BigDecimal. Otherwise return
# nil.
def convert_to_numeric(val)
  return BigDecimal(val, Float::DIG) if val.is_a?(Float)
  return val if val.is_a?(Numeric)
  # Eliminate any commas, $'s (or other currency symbol), or _'s.
  cursym = Regexp.quote(FatTable.currency_symbol)
  clean_re = /[,_#{cursym}]/
  val = val.to_s.clean.gsub(clean_re, '')
  return nil if val.blank?
  case val
  when /(\A[-+]?\d+\.\d*\z)|(\A[-+]?\d*\.\d+\z)/
    BigDecimal(val.to_s.clean)
  when /\A[-+]?[\d]+\z/
    val.to_i
  when %r{\A([-+]?\d+)\s*[:/]\s*([-+]?\d+)\z}
    Rational($1, $2)
  end
end

The defun starts with the blank line above the lead-in comment, includes the comment, and ends after the 'end' keyword.  The ending looks right, but not the start of the object.
Has anyone worked out an appropriate configuration that avoides these problems for ruby-mode?


texts: I want to mark some messages as "important", and later on I can search for all emails marked as important. This is like Gmail's custom label function. Can I do it with mu4e?


texts: Run magit command in other-window/frame?

texts:
Is there a way to run magit commands so that the the command is run within a new window or a different frame?

For example, when running magit-log-all-branches (l b) from the magit-status window it would be nice to optionally split the window a la switch-to-buffer-other-window, so that it's possible to see both the log the status buffer at the same time.

As far as I can tell there are no prefix arguments or switches that accomplish this.


texts: Ignore scheduled date in agenda if item is "CANCELLED"?

texts:
Imaginee I set a deadline for Project A and the schedule date for task A1 and A2, now the project is cancelled (with CANCELLED todo keyword), which makes the scheduled date for A1 and A2 invalidated.

Note, I didn't remove the SCHEDULED: keywords in the sequential nodes. These information is useful if the project is activated again somehow.

I wonder what's the best way to ignore these dates (deadline and schedule) in the org-agenda?

The org buffer looks like this:

* CANCELLED Project A
  DEADLINE: <2015-12-22 Tue>
** A1
   SCHEDULED: <2015-12-25 Fri>
** A2
   SCHEDULED: <2016-01-03 Sun>

This is the org-agenda buffer I have.


texts:
The version of desktop.el that comes with Emacs 24.4 allows restoring frames as well as windows and buffers. This works fine for an Emacs server (i.e., daemon) with at least one open frame. However, a newly started started Emacs server that attempts to load a desktop file while starting reports restoring frames, but no frames appear. When I open a new frame via emacsclient, the buffers have been restored, so the desktop file is being read correctly.

Is there a flag for restoring desktop frames for an Emacs server which is just starting (i.e., has no open frames)?


texts: buffer-file-name can return propertized text?

texts:
Once upon a time I was surprised to see buffer-file-name sometimes return propertized text like #("/tmp/foo" 1 4 (face flx-highlight-face)) instead of "/tmp/foo".

I got in the habit of defensively "cleansing" when I need the filename as a simple string, e.g.:

(and (buffer-file-name)
     (substring-no-properties (buffer-file-name)))

Thinking about this more recently, the flx-highlight-face suggests this might (?) be a little bug in flx-ido-mode -- maybe it ought to strip the properties?

One tiny question is, should I report this as a bug?  I think I can self-answer: Yes; worst case they can explain why I'm wrong. :)

My real question is: How broadly do I need to keep this in mind? Is buffer-file-name just one of many Emacs functions like this?  Every time I think "string", should I slap myself and say hey, never assume an Emacs Lisp string is "simple", it could always have properties?


texts:
I'm currently using autoheader.

I have this configuration, which causes the <?php tag to be inserted in other modes:

(defsubst my/header-title ()
  "Insert buffer's first row."

  (insert "<?php \n \n" (concat comment-start  " Foo bar "  (and (= 1 (length comment-start)) header-prefix-string )
                                (if (buffer-file-name)
                                    (file-name-nondirectory (buffer-file-name))
                                  (buffer-name))
                                " " "\n"))
  )

(setq make-header-hook '( my/header-title))

;; To have Emacs add a file header whenever you create a new file in some mode:
(autoload 'auto-make-header "header2")
(add-hook 'php-mode-hook 'auto-make-header)
(add-hook 'emacs-lisp-mode-hook 'auto-make-header)
(add-hook 'web-mode-hook 'auto-make-header)
(add-hook 'html-mode-hook 'auto-make-header)
(add-hook 'js-mode-hook 'auto-make-header)

When I'm creating a new file with the extension .html or .lisp, then the <?php opening tag will be inserted too. I want the <?php opening tag inserted in the header only when the newly created buffer is in PHP-mode.  When PHP-mode is not enabled, it should not insert the PHP tag.

I tried to solve this with the following modifications:

(defsubst my/header-title ()
   (insert
   ;; comparison major mode with the PHP-mode
    (if equal major-mode "PHP-mode"
    ;; If true, insert this:
      ("<?php \n \n")
    ;; If false, insert empty string
  " \n")
   (concat[...] rest of the function)))

But it doesn't work. The comparison seems logical, following the Emacs manual. So I couldn't figure it out. So I'm wondering how I could detect if there is PHP-mode enabled, then insert the <?php tag, or otherwise do nothing?

Any answer would be greatly appreciated.


texts: Global message count in modeline in Wanderlust

texts:
Does anyone know if it is possible to setup in the modeline globally the total number of unread messages in the Inbox with Wanderlust?

I want to be able to see any and all unread messages in my mailbox from any buffer.


texts: What is the difference between standalone version of emacs and the one that runs inside terminal?

texts: I am not sure if my question makes sense. I am naive to this. I see that there is a standalone version of emacs with the menu bar, tool bar etc. Also, I see emacs version that could be run inside a terminal. Are they both same or is there a difference ?


texts:
I'm trying to create a realtime/WYSIWYG editor for LaTeX fragments -- the general idea is that at each move of point / edit of the fragment, the overlay should update to reflect the newly changed fragment, including a cursor symbol indicating where point is now.

However, it's impossible to move point into an image overlay -- any command that would end up inside the overlaid region is preempted so that point ends up at the end of the overlay.

Is there any way to override this behavior so that point can be inside of the overlaid region? I know I can do this XWidgets but I would prefer that the solution be compatible with the built-in fragment preview mechanism that org offers, which uses overlays.

An example of the behavior that I'm talking about: Run the following function with some image, with point at 1:

(defun image-overlay-minimal-repro ()
  (interactive)
  (let ((ov (make-overlay (point) (+ (point) 10))))
    (overlay-put ov
                 'display
                 (list 'image :type 'png :file "~/Downloads/dog-png-dog-png-image-267.png"))))

; 1234567890 test test

The image overlay will occlude all the digits, and it only takes one motion of point to cross the entire overlay. I want it to take 10 movements of point.


texts:
Installing Windows 64 bit for Windows 7 is currently a massive pain Where is official 64-bit Emacs for Windows? (The manual said there is!) because although there are many roque cuts, GNU are not distributing those binaries for one reason or another.

One must compile their own binaries using the lengthy instructions at https://github.com/emacs-mirror/emacs/blob/emacs-25/nt/INSTALL.W64 or trust one of the many unofficial builds.

Does anybody have any hard evidence that 64 bit Emacs is faster than 32 bit running on 64 bit Windows 7?

Additionally, I use a few external applications such as exuberant ctags, aspell. Does anybody have any evidence of performance benefits to creating 64 bit versions of these applications?


texts: How to add a timestamp to each entry in Emacs' *Messages* buffer?

texts:
I depend on the *Messages* buffer a lot, but entries are not timestamped.

How can one add a timestamp to each entry in Emacs' Messages buffer?

So that something like this:

Loading /Users/gsl/lisp.d/init.el (source)...
No outline structure detected
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading /Users/gsl/lisp.d/var/recentf...done
Error running timer: (wrong-number-of-arguments (lambda nil (setq gc-cons-threshold (* 64 1024 1024)) (message "WARNING: gc-cons-threshold restored to %S")) 1)
[yas] Prepared just-in-time loading of snippets successfully.
M-] is undefined
CHILDREN [2 times]
‘show-all’ is an obsolete command (as of 25.1); use ‘outline-show-all’ instead.
Invalid face reference: nil [33 times]
Auto-saving...done
Saving file /Users/gsl/lisp.d/init.el...
Wrote /Users/gsl/lisp.d/init.el
mwheel-scroll: Beginning of buffer [5 times]
Mark set
previous-line: Beginning of buffer [10 times]
Quit [4 times]

will become something like this:

2017-02-14-18:50:01 Loading /Users/gsl/lisp.d/init.el (source)...
2017-02-14-18:50:02 No outline structure detected
2017-02-14-18:50:03 For information about GNU Emacs and the GNU system, type C-h C-a.
2017-02-14-18:50:05 Loading /Users/gsl/lisp.d/var/recentf...done
2017-02-14-18:50:10 Error running timer: (wrong-number-of-arguments (lambda nil (setq gc-cons-threshold (* 64 1024 1024)) (message "WARNING: gc-cons-threshold restored     to %S")) 1)
2017-02-14-18:50:12 [yas] Prepared just-in-time loading of snippets successfully.
2017-02-14-18:50:40 M-] is undefined
2017-02-14-18:50:41 CHILDREN [2 times]
2017-02-14-18:50:00 ‘show-all’ is an obsolete command (as of 25.1); use ‘outline-show-all’ instead.
2017-02-14-18:50:01 Invalid face reference: nil [33 times]
2017-02-14-18:51:01 Auto-saving...done
2017-02-14-18:51:03 Saving file /Users/gsl/lisp.d/init.el...
2017-02-14-18:51:06 Wrote /Users/gsl/lisp.d/init.el
2017-02-14-18:51:09 mwheel-scroll: Beginning of buffer [5 times]
2017-02-14-18:51:11 Mark set
2017-02-14-18:51:21 previous-line: Beginning of buffer [10 times]

I searched on EmacsWiki, Reddit and emacs.sx of course, to no avail.

I am aware of command-log-mode, which can be adjusted to log with timestamps, but it is useful only for interactive commands, not all messages, including Emacs' "system" ones.

Instead, every message logged to the Messages buffer should be timestamped.

How can one add a timestamp to each entry in Emacs' Messages buffer, no matter its source?


texts: How to create a new branch from old commit using magit

texts: When viewing the commit log, can I select a commit and checkout that commit as the head of a new branch?


texts:
With clock reports, one can set :step day, and then I have a list of totals by day.
Like:

#+BEGIN: clocktable :tstart "<-1w>" :tend "<+1d>" :step day :scope ("dev.org" "tst.org") :maxlevel 1 :narrow 65
| File      | Headline                                                          | Time   |
|-----------+-------------------------------------------------------------------+--------|
|           | ALL *Total time*                                                  | *6:38* |
|-----------+-------------------------------------------------------------------+--------|
| dev.org   | *File time*                                                       | *3:04* |
| tst.org   | *File time*                                                       | *3:34* |

But it's quite verbose, lots of info. I'd like a summary.

I'd like to post-process that list so that I have the total productivity by day, like:

[2015-02-19 Thu] 6:38  (Dev.org 3:00, testing.org 3:20)
[2015-02-20 Fri] 5:03  (Dev.org 3:00, testing.org 2:03)
[2015-02-21 Sat] 4:30  (Dev.org 2:00, testing.org 2:30)

I'm willing to write some code to maybe grep out the relevant bits and glue it all together.

But I'm kinda wondering, how do I go about starting something like this? I.e, what would be the building blocks?

Can I use like the :formatter property with some function? or can I use bable to post-process this with some bash/grep/awk/sed/cut, or with python?

[edit]  A bash solution..
So far I've hacked myself something together with bash.

I generate a report as above. Then export it into ascii into report.txt. Then I use a bash script:

cat ~/git/LeoUfimtsev.github.io/org/reports.txt | egrep 'Daily|Total' | tr -d '[[:space:]]' | sed 's/Daily/\nDaily/g' | sed 's/\*Totaltime\*\*/ /g' | sed 's/Dailyreport://g' | sed 's/ALL/ /g' | sed -E -e 's/Thu|Fri|Sat|Sun|Mon|Tue|Wed|\*//g'

And then I get something like this:

  37:47
2015-02-19  6:42
2015-02-20  4:02
2015-02-21  0:00
2015-02-22  2:55
2015-02-23  4:09
2015-02-24  4:37

Now I just have to automate things.

open report.org buffer
export to ascii
run bash script
show output somewhere
Plot onto chart :-D

I think these are probably straight-forward enough for me to tacke on my own thou. That said, if anyone has any better advice, I'm open to suggestions.


texts: How to get Org-mode Babel src code block language value?

texts:
I set org-mode Babel to open rhtml block with web-mode.

(add-to-list 'org-src-lang-modes '("rhtml" . web))

And I have configure company-robe for completing for Rails code in erb engine.

(defadvice company-robe (before web-mode-set-up-ac-sources activate)
    "Set `robe-mode' based on current language before running `company-robe'."
    (if (equal major-mode 'web-mode)
        (let ((web-mode-cur-language (web-mode-language-at-pos)))
          (if (string= web-mode-cur-language "erb")
              (unless robe-mode (robe-mode))
            (if robe-mode (robe-mode -1))
            ))))

The upper advice work correctly in normal file index.html.erb file.

But web-mode can't recognize engine correctly in Org-mode babel block.
When I run (web-mode-language-at-pos), it shows html.

The author of web-mode suggest me to use web-mode-set-engine.

(web-mode-set-engine "erb")

Here the original question I asked in web-mode issues: https://github.com/fxbois/web-mode/issues/678

My problem is the org edited src buffer's major-mode is web-mode, but I want to set web-mode-engine to erb. The only identity in src block is this:

#+BEGIN_SRC rhtml

#+END_SRC

I checked out Org-mode source code, found some functions relative with this.

org-src-construct-edit-buffer-name (org-buffer-name lang)
org-babel-expand-src-block

org-babel-get-src-block-info (it should return a list: (language body header-arguments-alist switches name indent block-head) )

I tried to run (nth 0 (org-babel-get-src-block-info)) in opened src buffer which is opened by [C-c '].
But only get nil.


texts: Deleting whole variable name on M-backspace

texts: Is there a way to configure emacs, so that when I hit M-backspace it would actually remove the whole variable? If I have a variable like my_dummy_variable I need to hit M-backspace three times in order to remove the name?


texts: Override ido-completion-map to change window target

texts: Sometimes I open ido-find-file or ido-switch-buffer but when I find the file I want to open, I realize I want to open it in other-window. I have key bindings for ido-find-file-other-window and others, but I would like the option to open the selected ido candidate in other-window as a persistent option in ido-completion-map (bound to s-<return>). Is this possible?


texts: Is the sharp dollar (#$) sign the same as load-file-name in Emacs?

texts: I see Emacs use #$ in autoload files, but I don't known if there are any difference between #$ and load-file-name. When I use them in a file, they looks like the same and when I print them by M-: they are both nil. So I did some test but only get more confused. Does #$ behave more like __FILE__ in Python?


texts:
Q: how can I change PDF page labels with pdf-tools?

pdf-tools has the capacity to annotate PDFs, which is great.
Can it also change the page labels as well?  That is, not the
raw page number, but the labeled page number?

Use Case

I scan a lot of books and articles.  I would like to be able to
jump to the page numbers as enumerated in the books/articles, not
just the nominal page number of the PDF.

Example: if I scan an article that ranges from pages 11-20, I want
to be able to embed the pages 11-20 so that I can tell pdf-tools
to jump to, say, page label 12, rather than have to use the
nominal page numbers (in this case, PDF page 2 which would
correspond to page label 12).

What I Found

A quick apropos search turns up pdf-info-pagelabels,
pdf-view-current-pagelabel, and pdf-view-goto-label.  None of
these appear to allow me to edit the page labels.

Alternatives Welcome

In the event that pdf-tools does not have this capability, I'd
be glad to know of (linux) command line tools that allow me to
edit page labels, as I'm sure I could rig up something with the
right tool.


texts:
I use markdown-mode (in conjunction with writeroom-mode) for writing in Emacs. My markdown files generally gets quite large, and I would like to be able to focus on a particular section for extended periods of time.

How can I achieve this? Specifically I'm looking to hide or collapse other sections (heading and their text) while working on the current one. http://www.foldingtext.com behaves in this manner.


texts: Dired: group directories and symlinks to directories first

texts:
Is there a way to make dired group directories and symlinks to directories first?

If I add --group-directories, like this:

(setq dired-listing-switches "--group-directories-first -al")

then it groups directories first, but symlinks still get sorted under files.

If I also add --dereference, like:

(setq dired-listing-switches "--group-directories-first --dereference -al")

then symlinks get resolved, and the directories do all show up together. But there's no indication anymore that they are symlinks anymore. I'd like them to be still displayed as symlinks, but get grouped first too.


texts: emacsclient doesn't start when visiting a file that is already open

texts:
I start emacsclient with emacsclient -a 'emacs-server-start' -nw --socket-name=$TTY, where emacs-server-start is a script that runs emacs --daemon="$TTY" (I use $TTY to get a different client for each terminal instance).

This works well, when I edit a file like e file (here e is an alias to the above emacsclient command), it edits the file. However, sometimes, if I then close emacs (C-x C-c) and try to edit the same file again with e file, emacs starts and immediately closes. I have to start emacsclient without the file in the command line argument and navigate to it with C-x C-f or C-x b.

EDIT

I think I know how to reproduce this. I believe what is happening is that sometimes I will have a buffer open with a file that gets modified on disk (by being edited by another emacs session, or more commonly, by being checkout on disk). The file will have no edits, so won't be seen by emacs as being in need of saving. Hence C-x C-c won't prompt. However, for whatever reason, this keeps the buffer from being killed when this happens. Perhaps the "do you want to revert this buffer" prompt is canceling it somehow.

Assuming my deductions are correct, how can I tell server-save-buffers-kill-terminal to always kill buffers that don't need saving, regardless of whether or not they have changed on disk?


texts: Command for inserting for-statement skeleton

texts:
How would one write a function that one could bind to, say, SUPER-f, which inserts the code:

for () {
}

in the buffer with my cursor being moved into the () parens for filling out the loop guard?


texts:
I'm using fish as my default shell and spacemacs config layers in emacs. My default term is an ansi-term.

Does ansi-term support text background colours? Foreground (text) colours seem to work fine!

Thanks!


texts:
Sometimes I see folks using "+" to structure their org document.
What is the appropriate use case for plus.


texts: How to visit file containing source code for a given function?

texts:
To open a buffer on the source code for a command definition, I usually follow a convoluted procedure something like this:

Guess the name of the mode from the function name
Guess the name of an elisp file involved in the implemention of that mode
Run M-x locate-library
Memorize the transiently-displayed path in the minibuffer
C-x C-f and type in the path name from memory
grep around for the function in the containing directory
Open the buffer
C-s and search for the function name to jump to the right line

What's the good way to do this?


texts: Emax64 trying to install already installed pdf-tools on every startup

texts:
I am using the emax64 build of Emacs for Windows x86-64 systems.
However, it tries to install pdf-tools on every startup, even though it is already installed.  How to turn this off?
-*- mode: compilation; default-directory: "~/emax/elpa/pdf-tools-20200512.1524/build/server/" -*-
Comint started at Tue Jul 28 10:37:11

c\:/Users/user/AppData/Roaming/emax/elpa/pdf-tools-20200512.1524/build/server/autobuild -i c\:/emax64/bin/
---------------------------
    Installing packages
---------------------------
Skipping package installation (already installed)

---------------------------
 Configuring and compiling
---------------------------
./configure -q --bindir=c:/emax64/bin/ && make -s

Is case-sensitive searching enabled ?     yes
Is modifying text annotations enabled ?   yes
Is modifying markup annotations enabled ? yes

[...]

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

Comint finished at Tue Jul 28 10:38:19


texts: I built a new version of GDB and it works properly from terminal. Now I want it to be executed when I run M-x gdb from emacs.


texts: How to inherit one abbrev table in another abbrev table?

texts:
I've defined a lot of abbrevs in latex-mode-abbrev-table and I'd like to use all the contents in latex-mode-abbrev-table and org-mode-abbrev-table when in org-mode.

A possible "solution" would be to write all the abbrevs in global-abbrev-table but I'd like to keep the global table clean.

So how can I use the merged version(LaTeX + Org) of abbrev table in org-mode?


texts: Every letter in emacs is now separated by a space

texts:
Today when I opened Emacs (26.3) for the first time since updating Linux (Arch) I was greeted with a wide (two spaces) cursor, and every letter on the screen separated by a space, like this:

F i l e    l o c a t i o n s

This is true everywhere: in the text, in the mode line, in the linum numbers to the left on the window. The only place it isn't true is in a read-only buffer like the initial screen that comes up when you start Emacs. I don't see any errors in the *Messages* buffer.

I don't know where to start.  Any ideas?


texts:
My goal is a shortcut for an oft-used command.

The oft-used command:
An agenda view of all unfinished tasks matching a given tag:

 1. M-x org-agenda
 2. Prompts for the type of agenda
 3. I enter "M"
 4. Prompt appears to enter tag(s) to match
 5. I input the string 'tag1'
 6. I get all the unfinished items that match 'tag1' (success)

Is there a way to jump directly to step 4, 5, or 6?  When I try, for example,

M-x org-tags-view

it defaults to the

org-agenda, "m"

behavior, which gives me every headline with tag1, rather than just unfinished action items.  I see options for creating custom agenda commands, but so far, they all give a list of all headlines, not just action items.  I expect I'm making a stupid mistake, but too new to see it.

If it helps, I'm running
Win10
GNU Emacs 26.2 (build 1, i686-w64-mingw32)


texts:
In helm, when you press TAB, you have access to the actions corresponding to the current entry. By default, they are bound to [F1],[F2]... But I don't like these shortcuts for several reasons:

the F{n} keys are not easy to access on a keyboard
if you have more than 12 entries, then you don't have any keybinding for them
it's hard to associate any mnemonic with F{n} keys

So here is my question: how could I change the shortcuts of an helm action? I'm interested both when I wrote my own code, but also if possible to change them globally.

Here is a MWE:

(helm :sources (helm-build-sync-source "Animal"
                 :candidates '("Duck" "Elephant" "Lion")
                 :action '(("Say hello!" . (lambda (req)
                                             (message (concat "Hello" req))))
                           ("Say bye!" . (lambda (req)
                                           (message (concat "Bye " req))))
                           ("Eat" . (lambda (req)
                                      (message (concat "No, we don't eat " req "!")))))
                 :fuzzy-match t)
      :buffer "*helm test*")


texts:
I am trying to rebind some keys for info-mode without success. I am not sure whether I am missing something, or whether a special hook is required. I am using the following hook in my init.el:

(add-hook 'info-mode-hook
          (lambda ()
            (message "setting up info-mode")
            (local-set-key (kbd "C-c l")
                           'info-last)
            (local-set-key (kbd "g g")
                           'evil-goto-first-line)
            (local-set-key (kbd "C-c g")
                           'info-goto-node)
            )
 )

But when I run C-h i to open info-mode, my custom bound keys above do not work and I do not get any message like "setting up info-modein myMessages` buffer.

I have evaluated the above hook with an empty emacs config (emacs -q), and I have many other mode hooks that are working fine.

Any suggestions to help troubleshoot or resolve this issue would be appreciated! I am happy to clarify anything as well.


texts: How to detect programmatically if content under org-mode headline is encrypted or not before a save or commit?

texts:
org-mode allows users to encrypt the contents under a headline by adding the crypt tag with C-c C-q crypt and then calling M-x org-encrypt-entry.

Below is an example using this feature:

* Headline                  :crypt:
-----BEGIN PGP MESSAGE-----

jA0EBwMCtfdtKCPGXBdg0oQBDW4GlaBGCoAZNwNkQiP1+7oesTJkIHVbrHNV0StK
CDyLI8FADGlEY26dr7J1Ojo7HNy+aWGMBGTpBKDWZ0/ChB0JS39SKDL5DMEvYZuZ
c0Y6IuCnJ971nnM9rt+WHAs5i+LirGCPcTjrGLAasYEtrNwSPH2O9X+9PT1ze+r1
IOLfKZ0=
=9sC6
-----END PGP MESSAGE-----

I would like to prevent users from saving the file and committing changes to a git repository if the content under a headline should be encrypted but is not.

The goal is to prevent unintentional leaks to local file system and stop unencrypted text from being added to the git repository.

  How to detect programmatically if content under org-mode headline is not encrypted before a save or commit?

I'm looking for an answer that could be called from the command-line for use in a on commit hook.

Thank you of your help!

  emacs version: 24.3 or greater
  org mode version: 9.1.2 or greater
  git version: 2.12.3 or greater
  gpg version: 1.4.21 or greater


texts: Emacs keeps pooping out random .extension~ files that are messing up my program. How do I prevent creation of these files?


texts: Sending mail from multiple domains with the same mail server

texts:
I use Emacs and mu4e to send mail. I have a mail server with Amazon WorkMail and I set up the information at ~/.authinfo.gpg. Two domains are in the same region and have the same SMTP server with different usernames. When I send email from the second, it is sent with the credentials from the first which appears at the top of the list.
My code is:
(defvar my-mu4e-account-alist
  '(
    ("Account1"
     (mu4e-sent-folder "/Account1/Sent Items")
     (mu4e-drafts-folder "/Account1/Drafts")
     (mu4e-trash-folder "/Account1/Deleted Items")
     (user-mail-address "name@account1.org")
     (smtpmail-smtp-user "name@account1.org")
     (smtpmail-stream-type ssl)
     (smtpmail-smtp-service 465)
     )
    ("Account2"
     (mu4e-sent-folder "/Account2/Sent Items")
     (mu4e-drafts-folder "/Account2/Drafts")
     (mu4e-trash-folder "/Account2/Deleted Items")
     (user-mail-address "name@account2.org")
     (smtpmail-smtp-server "smtp.mail.eu-west-1.awsapps.com")
     (smtpmail-stream-type ssl)
     (smtpmail-smtp-service 465)
     )
    ))

How can I force each account to use its own account on the server?


texts: Unfortunately, I forgot to start the emacs-server at work, running on Linux. Is there now any option to connect to my remote graphical X11 emacs session via ssh?


texts: how to style block quotes in org-mode LaTeX export?

texts:
I am trying to change the style of block quote formatting in org-mode export to PDF via LaTeX.

Using this answer, I defined a new LaTeX environment called fancyquotes. I am successfully able to create block quotes with this styling by creating a special block:

#+BEGIN_fancyquotes
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
#+END_fancyquotes

This successfully creates the desired TeX output:

\begin{fancyquotes}
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
\end{fancyquotes}

However, for compatibility with org-mode export to HTML, I would prefer to use not a special block, but rather standard quote blocks:

#+BEGIN_QUOTE
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
#+END_QUOTE

The problem is that, by default, the above gets exported using the quote label:

\begin{quote}
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. ---Douglas Adams
\end{quote}

How do I direct org-mode to automatically export standard quote blocks to my newly defined new LaTeX environment and apply the labels \begin{fancyquotes} and \end{fancyquotes}? In other words, how do I redefine org-mode quote blocks in LaTeX export, changing it from the default label quote to the label fancyquotes?

Bonus question: For the fancyquotes LaTeX environment I defined, how do I specify the shadequoteauthor in my org-mode source?)


texts:
Can you recommend, a good bookmark package?

Yes, emacs standard has bookmarks. Although, hate naming them.
Just want something small, not uber sophisticated (like bookmark+). (It crashes my setup, at the moment, had to remove it.)
All I want is a hotkey to mark one location, per file.
Don't care about saving, between sessions. (Great if just during session.)
Although, I do have "save last edited place" working now. (Don't know, name of package off top of head.)

Really after, just a remember position (in key), then other hotkey to recall. Yes, plain Emacs bookmark could do this? With a name in macro.

But, is that the best way?
Or easiest way?


texts: How to include a text verbatim in Emacs Lisp?

texts:
How to programmatically insert a text verbatim?

The following function inserts ocumentclass and not \documentclass.

(defun foo () (interactive)
(insert "\documentclass"))

Of course one can use

 (defun foo () (interactive)
    (insert "\\documentclass"))

to correctly insert \documentclass. But I am wondering if there is a way to directly insert a text verbatim without modifying it at all (e.g. without changing its special characters).


texts: How can I set color for listing executable files in Dired Mode?

texts:
Trying here to set color for executable files, as it is for ls command!

How can I do that?

I've already managed to set color for certains file extensions, using Diredful package, but couldn't do it according to it's mode!


texts: Reuse tramp connection details to start putty session

texts:
I often connect to remote servers using tramp to do some work, however sometimes after editing files I need to connect using PuTTY in order to do some specific task.

At the moment I open up PuTTY, and type the user and server names in. It seems to me that tramp already has that information and I should be able to run an Emacs command that extracts tramp connection details for the current buffer and runs PuTTY for me. I can't work out how to get this information, though.

Note: I can't just run commands over the tramp connection (eg, with M-!) as it may require variables set up in the .profile.


texts: Retrieve the total time CLOCKED over a given interval

texts:
Question: How can I retrieve, over a set of files S (in particular: over my agenda files + their archive files) the total time clocked (as the return value of an elisp function; not as a clock table)? So for example, if I have:

* Header1
  :LOGBOOK:
  CLOCK: [2019-05-01 Sat 18:10]--[2019-05-01 Sat 18:30] =>  0:20
  :END:

# File2
* Header2
  :LOGBOOK:
  CLOCK: [2019-05-11 Sat 18:10]--[2019-05-11 Sat 18:11] =>  0:01
  :END:
* Header3
  :LOGBOOK:
  CLOCK: [2019-05-11 Sat 18:10]--[2019-05-11 Sat 18:20] =>  0:10
  :END:

I'd like to run a function like (sum-all-time-from "[2019-05-10]" "[2019-05-12]") to get as answer ~0:11~.


texts: shell command on region with process substitution

texts:
If I want to execute a shell command on a region I know I can use
shell-command-on-region via M-|, what if the command I want to
redirect my selection does not accept redirection to it's standard input.

In my case I would like to redirect my an active region to python -m doctest
In the shell I could use process substitution like python -m doctest -v
<( echo '>>> print("hello")\nhello')

Is there a direct way to that in emacs, or do I need to write some elisp
to get the active region and build the shell command myself?

update:

Not sure if this is a good solution and what will happen if the string contains quotes like ', but seems to work at the moment, I'll appreciate any suggestions.

(defun my/python/run-doctest-on-region ()
  (interactive)
  (let* ((text-to-shell-cmd (if (use-region-p)
                                (buffer-substring-no-properties (region-beginning)
                                                                (region-end))
                              (buffer-substring-no-properties (point-min)
                                                              (point-max))))
        (cmd (concat "python -m doctest -v <( echo '" text-to-shell-cmd
                      "')")))
    (shell-command cmd)))


texts: Absolute line numbers on the current and relative line numbers on all other lines?

texts:
I know this plugin for relative numbers, which works fine (with the option (global-relative-line-numbers-mode). I also know this elisp code, which gives me perfectly working absolute numbers:

(add-hook 'find-file-hook (lambda () (linum-mode 1)))

However, i don't know how i can have absolute line numbers on the current and relative line numbers on all other lines (both on the left margin like displayed in the picture below).

 This picute of my vim shows what i want. Therefore, i don't search for line numbers in the mode line.


texts: How to load an Idris file that depends on a package?

texts:
Working in Spacemacs (on Linux Mint, if that is relevant), using the Idris layer, one of my major mode commands is SPC m-r (Vim-style keybindings): idris-load-file. This causes Spacemacs to load up an Idris REPL instance and use it to type check the file. Once the REPL is loaded, other IDE-like functionality is enabled such as split case, proof search, etc. Thus the ability to load the file is crucial for smooth Idris development.

Idris has the concept of a package; for example, if you want a set implementation, there is one in the contrib package. Thus, for example, this code depends on contrib:

module NeedsContrib

import Data.SortedSet

foo : SortedSet Int -> Maybe Int

If I try to load this code in the Idris REPL outside Spacemacs, I must provide the -p contrib command-line argument. If I do not, I get Can't find import Data/SortedSet. In my Vim development workflow, I launch Idris myself, manually, so I am able to specify this argument and it works. However, in Spacemacs' fancy way of doing things, it loads the Idris process itself, and I do not know how to indicate to it that I need contrib - I get Can't find import Data/SortedSet in the errors window, indicating the REPL has been loaded without -p contrib.

When I write much serious Idris code at all, I almost always end up using contrib, or other packages. I would really like to transition from using Vim to Spacemacs for Idris development but this is hanging me up.

How do I get Spacemacs to launch the Idris process with the appropriate -p <package> argument as necessary, or perhaps to connect to an existing running Idris instance with the arguments that I have already supplied?


texts: Make delete button to delete file at point in dired?

texts:
In normal file managers like nautilus, if i select an item and press delete button, it will delete that item.

How can i achieve the same in dired? When point is at file, pressing delete button should delete that item?


texts:
I do not curate my .emacs and packages very effectively. Right now I have an issue where, when working in the Ruby, I type def[space] and then magically two end lines appear. Obviously I have managed to turn on two different autocompletion systems and they are both activating. Is it ruby-mode? rails-mode? autocomplete mode? Something else?

I'm sure I can hunt down this specific case, but my general issue is that it's hard to tell what emacs features are turned on and which are activating at any given time. There's so much stuff in my mode line that I don't know where to start.

How do you diagnose such issues? Are there tools for taming an emacs config gone wild?


texts: How do I stop Emacs micro-stuttering and high CPU utilization caused by background calls to git?

texts:
Using Emacs on Windows, I experiences issues due to background invocations of git.exe. The same issues might apply on Linux, though the more light-weight process calling might make them unnoticable.

Symptoms

Occassionally, Windows will report that "Git has crashed", regardless of active Desktop window.
In the Task Manager, one to two git.exe processes appear every few seconds and vanish again.
In Emacs, random micro-stutters occur.

Diagnosis Attempts

Using “Process Explorer” (procexp.exe), it can be found that the git.exe processes are subprocesses of Emacs.
They occur whenever a file inside a git-versioned directory is opened.
More such directories → more stuttering.
Doing M-x trace-function RET call-process RET with four files opened across two git repositories shows upwards of 30 git invocations per cycle. A high number of synchronous calls definitely explains stuttering.


texts:
Is it possible to wrap text automatically at 80 column length? I mean, writing code or text and then, when I reach 80 characters, put a breakline and continue on the next line (not wrapping the word but putting on the next line).

Thank you!


texts: LaTeX fragment preview includes font name in Org-mode

texts:
Since I have to export some CJK characters in LaTeX, I have the following two lines in an .org file :

#+LATEX_HEADER: \usepackage[BoldFont,SlantFont]{xeCJK}
#+LATEX_HEADER: \setCJKmainfont{HanaMinA}

However, this causes a weird display when I use org-toggle-latex-fragment.

You can
see that the font name is displayed above each maths expression.

MWE

You must install HanaMinA fonts before testing. In Ubuntu:

sudo apt install fonts-hanazono

Here is the minimal not working example I gave above:

#+LATEX_HEADER: \usepackage[BoldFont,SlantFont]{xeCJK}
#+LATEX_HEADER: \setCJKmainfont{HanaMinA}

The Euclid–Euler theorem is a theorem in mathematics that relates perfect
numbers to Mersenne primes. It states that every even perfect number has the
form $2^{p - 1}(2^p - 1)$, where $2^p - 1$ is a prime number. The theorem is named after
Euclid and Leonhard Euler.

How this problem can be solved?

UPDATE

I found a hint while I'm reading one answer about "How to make a new tex command in org-mode-latex?". In short, everything involved with #+LATEX_HEADER: is taken account by the preview. Therefore, the question turns out to be how can I use packages for export only and not for preview?
I have tried to move the two lines to an export latex block, but it doesn't work.


texts:
I've rebound some keys in god-mode so that S and R start a forward and backward incremental search and s and r repeat but never start incremental searches. This is the approximate division of labor between Vim's //? and n/N .

This has some behavior I like, namely that the previous incremental search query is available until I specifically replace it with a new one via S or R .

But, it leaves "stray highlighting" when I'm moving around via s and r. The stray highlighting seems to last indefinitely.

To reproduce the problem, run the .emacs file below, it will drop you into the scratch buffer with scratch-mode already activated.

hit g < to navigate to the top of the buffer
hit S + s + RET to start a forward incremental search. The cursor should now be immediately after This.
hit s + s + s, then r + r + r moving forward three matches and then backward three matches.
wait one second
All of the s characters in the buffer are now highlighted with a greenish color behind them.

How do I clear the greenish color behind all the s characters without replacing the "current default isearch query"?

;; minimal init.el to represent problem.
(progn

      (defun isearch-repeat-forward-command ()
        (interactive)
        (isearch-repeat-forward))

      (defun isearch-repeat-backward-command ()
        (interactive)
        (isearch-repeat-backward))

      (package-initialize)
      (require 'god-mode)

      (god-mode-all)
      (global-set-key (kbd "s-g") #'god-mode-all)

      (define-key god-local-mode-map (kbd "i") #'god-local-mode)
      (define-key god-local-mode-map (kbd "s") #'isearch-repeat-forward-command)
      (define-key god-local-mode-map (kbd "r") #'isearch-repeat-backward-command)
      (define-key god-local-mode-map (kbd "S") #'isearch-forward-regexp)
      (define-key god-local-mode-map (kbd "R") #'isearch-backward-regexp)

      (identity 1))


texts: Stop automatic indentation and cursor movement while typing in major mode

texts:
I've put together a simple major mode for syntax highlighting and indentation of AQL. This is my first, and I'm open to any suggestions there, but my question is more specific:

When I type two slashes to begin a comment, the moment I type the second slash the cursor jumps back to the beginning of the line, and the line is indented.

This even happens if I've already typed a bunch of code on the line. So if I have the following line (^ is the cursor):

for u in users
              ^

and then I start to put a comment at the end of the line, the moment I type two slashes the cursor jumps:

for u in users \\
^

What's going on here? I've tried playing with and disabling electric-indent-mode, and I've tried manipulating electric-indent-chars but have not been able to alter this behavior in any way.

Any thoughts on how to proceed?


texts:
I am an okay Java programmer and have very little knowledge of Emacs lisp, but I would still like to be able to write some packages for Emacs.
Is there a way or package that would allow me to write a package in Java?


texts: Org-export scope subtree: ignore multiple trees with a single tag

texts:
I use orgmode to export to latex using the subtree export command C-c C-e C-s l l.
Suppose I have a .org file like below:

* My main project
** Chapter 1 - Done
** Chapter 2 - Partially Done
** Chapter 3 - Todo
** Many other chapters that are still not complete
* My other project
* Many other projects

And I want to export the tree named My main project, including Chapter 1, but excluding all other chapters.

The easiest way to do this is to add the tag noexport to Chapter 2 onwards. However, if there are many Chapters, this can get tedious.

Question: Is it possible to create a tag, say noexportonwards, that when added to a subtree, like Chapter 1, will make org export ignore all subsequent trees?


texts: Magit + Emacs + Windows: 7 alert dialogs on first use?

texts:
Background

The first time I run magit-status after starting Emacs, I get a series of 7 alert dialogs popping up. Each one just says "emacsclient 25.1" and has an OK button. They don't seem to do anything at all.

Nothing in the *Messages* buffer seems to relate to this.

I saw some reference in the Magit manual about needing to locate emacsclient, so I did put C:\Emacs\bin into my path.

This only happens the first time. After that, magit-status works fine without any popups at all.

Edit More information... It looks like this is coming from within Magit's with-editor-locate-emacsclient.

I just tried running that function directly. Got the same bunch of dialogs. After confirming them all (they only have "OK" buttons, so confirm it is, I guess!) I get something in *Warnings*:

  Warning (with-editor): Cannot determine a suitable Emacsclient

  Determining an Emacsclient executable suitable for the current Emacs
  instance failed.  For more information please see
  https://github.com/magit/magit/wiki/Emacsclient. Warning
  (with-editor): Cannot determine a suitable Emacsclient

  Determining an Emacsclient executable suitable for the current Emacs
  instance failed.  For more information please see
  https://github.com/magit/magit/wiki/Emacsclient.

It looks a lot like a path problem, even though the directory that has emacsclient.exe is on my path.

System Config

Magit 2.10.2
Windows 10
Emacs 25.1.1


texts: Set a package as predefined to every file

texts: I'm trying to set the package org-bullets as predefined in every *.org file because is kind of redundant to write M-x org-bullets every time I work with the format. Is this  possible?


texts: Remapping the `g` prefix key for all modes (Evil, org and outline minor mode), assigning a single function to `g`

texts:
The question is quite intricate. I am using doom-emacs and evil and I am customizing the keys. Usually, something like
(define-key evil-normal-state-map "g" 'evil-paste-after)

would work. However, the g key seems to be quite overloaded with different functionalities. In my case g works as a leader key for many org-mode, outline-minor-mode and evil-mode commands.
First I have a general question:
Is it possible in an easy manner to set the key g to nil for all the modes and to remap the original leader key g to some different key for example y, so all the commands which were initiated with g are initiated with y?
Then I could easily reassign the leader key and set the desired functionality to g key through the function above.
Or is there only a hard way of finding all the key-maps where g works as a prefix and disable each of them individually?
This would be quite tedious. As an example, I have the bindings
outline-minor-mode-map <motion-state> g j
outline-minor-mode-map <normal-state> g j
outline-minor-mode-map <visual-state> g j
outline-minor-mode-map <motion-state> g h
outline-minor-mode-map <normal-state> g h
outline-minor-mode-map <visual-state> g h

and I would need first to set them all to nil and this is only a small fraction where g is a prefix I suppose.


texts: Unicode character escape sequences instead of text upon mouse-2 paste from other windows

texts:
I am having a weird problem with emacs:

When pasting non-ascii text, e.g. € from X-clipboard with the middle mouse button into x-enabled emacs I get Unicode character escape sequences, e.g. \u20ac instead of €.

If, however, I first do a "Copy" in the other window and then do C-y in emacs window, the text is inserted verbatim.

How can this be fixed?

Note: this behavior is not observed when pasting with the middle mouse button into emacs running inside xterm, that is in xterm pasting is fine both ways, with mouse and with C-y.


texts: How can I prevent Magit-status command from grabbing the frame focus?

texts:
when executing magit-status and quickly focus out emacs, after the magit buffer pops up, emacs grabs the focus back. This is quite inconvenient. Is there a way to prevent that focus changing?

The way to reproduce this issue:

emacs -Q and load magit.
using magit-status command to load a middle size git project (which takes 1-2 seconds).
in the meantime, quickly focus away from the Emacs frame, say clicking on a browser window.
when magit-status buffer pops up, it grabs the focus back (which is what I'm trying to avoid)

Env:

Archlinux
i3wm
Emacs 27.0.50
magit d9ae466377b30d544fcbf5c57af1a60b350931af


texts: Which variable gives the value of the current character?

texts: Is there a build-in variable which saves the current character at which the cursor is positioned on?


texts: How to invoke functions that are quoted in let?

texts:
I'm trying to do some processing of values passed in a plist. Processing is quite similar: get a value, convert it to number if necessary, check if within bounds and if yes, return a string with that number, properly formatted.

Thus, I decided to create a list of actions, and then map through them, picking up non-nil values:

(defun knl--initialize-numerics (info)
  "Makes a string containing initialization of numerical parameters"
  ;; logic is: convert to number, if satisfies condition print it, skip otherwise
  (let* ((num-inits '((:knl-width 'identity (-partial '> 0) "%d")
                      (:knl-height 'identity (-partial '> 0) "%d")
                      (:knl-margin 'string-to-number (-partial '>= 0) "%.2f")
                      (:knl-min-scale 'string-to-number (-partial '> 0) "%.2f")
                      (:knl-max-scale 'string-to-number (-partial '> 0) "%.2f"))))
    (--map
     ;; function
     (-when-let* (((sym conv cond frm) it)
                  (oval (plist-get info sym))
                  (val (funcall conv oval))
                  (matches? (funcall cond val))
                  (name (s-lower-camel-case (s-chop-prefix ":knl-" (symbol-name sym))))
                  (formatted (format frm val)))
                  )
       val
       )
     ;; data
     num-inits)))

The above code fails at (val (funcall conv oval)) in ielm when I try to execute the following:

ELISP> (knl--initialize-numerics '(:knl-width 10 :knl-height 0 :knl-margin 0))
*** Eval error ***  Invalid function: (quote identity)

I was trying the same with a simple function, and it works:

ELISP> (let ((conv 'identity) (val 5)) (funcall conv val ))
5 (#o5, #x5, ?\C-e)

Why doesn't it then work in a more complex example? Is that because of some dash.el magic?


texts: Why magit use rectangle on origin/master and not only on master?

texts: I have done a branch checkout on master but magit rectangle is on origin/master and not only on master.


texts: What's the point of delaying SCHEDULED items from displaying in org-mode Agenda?

texts:
One may set org-deadline-warning-days to have DEADLINE items show up a default number of days before the deadline in the agenda, or one may do it on a case-by-case basis by adding, e.g., -3d to the DEADLINE timestamp.

Now, using the same warning notation -3d on a SCHEDULED item produces the reverse effect: the item is not added but skipped from the Agenda view for that number of days.

From the Org-mode manual:

 If you want to _delay_ the display of this task in the agenda, use
 `SCHEDULED: <2004-12-25 Sat -2d>': the task is still scheduled on
 the 25th but will appear two days later.  In case the task
 contains a repeater, the delay is considered to affect all
 occurrences; if you want the delay to only affect the first
 scheduled occurrence of the task, use `--2d' instead.  See
 `org-scheduled-delay-days' and
 `org-agenda-skip-scheduled-delay-if-deadline' for details on how to
 control this globally or per agenda.

What can this be useful for?

My understanding is if you want to start working on an item and you schedule it for a specific date, you want to start seeing the item in the agenda at least on the scheduled day, and may be even earlier, but definitely not later.

Am I missing something?


texts:
i have org mode set up with typo minor mode and pretty entities enabled by default.

but when i work on programming, these two are totally useless inside the source code blocks i insert into org files. is it possible to disable them for src blocks only?

i don’t understand if there’s a hook or header or something similar for such things? i actually don’t know what kind of object the blocks are.

my only solution so far has been to use local variables to disable the in the whole file individually. but it would make sense to me to disable them universally, but only in the blocks, as no one will need typographic inverted commas in src blocks.

EDIT: here's an image as per comment request.

steps:
* install typo mode, and enable typo mode in org buffers with something like (typo-global-mode 1) / (add-hook 'org-mode-hook 'typo-mode) in your init file.

in an org buffer, insert a source block with #+begin_src
quotes inserted inside the block are prettified by typo mode, and your code parser throws an error.
to disable typo (and also pretty entities) i added this to the bottom of my file:

# Local Variables: #
# eval: (typo-mode -1) #
# eval: (org-toggle-pretty-entities) #
# End: #

this disables both for the whole file though, not just for the src block. i thought something similar might be possible for blocks and other such structures. and i would be interested in learning how that works.beg

https://github.com/kunalb/poet also enables typo-mode and inserts nice code blocks. maybe they have the secret!


texts: Distinct compile defaults for .tex and .Rnw files

texts:
I would like the default compile command for .tex files to be different than the default for .Rnw (knitr) files.

Here is a minimal example to illustrate my current .emacs file:

(defvar TeX-command-list)
(add-hook 'LaTeX-mode-hook
      (lambda()
         (add-to-list 'TeX-command-list '("LaTeXmk -- run continuously" "latexmk -pdf -pvc -new-viewer- -e \"$pdf_previewer='start C:/SumatraPDF-TeX/SumatraPDF-TeX.exe';$pdflatex='pdflatex -interaction=nonstopmode -synctex=1 %%O %%S'\" %s" TeX-run-TeX nil t))
         (setq TeX-command-default "LaTeXmk -- run continuously")
         (setq TeX-save-query nil)))

So far so good.  When I press C-c C-c, my .tex files default to this command.

Here is what I have for .Rnw files:

(setq TeX-file-extensions
  '("Snw" "Rnw" "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
(add-to-list 'auto-mode-alist '("\\.Rnw\\'" . Rnw-mode))

(add-hook 'Rnw-mode-hook
      (lambda()
         (add-to-list 'TeX-command-list '("Knitr via latexmk" "latexmk -pdf -pvc -new-viewer- -f -r \"%UserProfile%\\.emacs.d\\Knitrlatexmk.rc\" %t" TeX-run-TeX nil t))
         (setq TeX-command-default "Knitr via latexmk")
         (setq TeX-save-query nil)))

But when I try to compile my .Rnw files (with C-c C-c), the default is the "Sweave" command.  What am I missing?  I've searched high and low, trying everything I can think of, but the above command is never offered to me as the default for .Rnw files.


texts: In a commit message, interactively get the github issue on "Fixes #"

texts:
I am jealous about a SublimeText plugin:

This plugin finds the github issues when you are in a commit message and you type a dash.

I didn't find an equivalent for Emacs so I decided that was a good exercise.

I found the pieces in about an hour but I've got difficulties finishing it, so I thought I might as well ask for help :)

What I can do:

find the github issues, with https://github.com/inkel/github-issues.el which isn't in melpa
fire helm
fire helm when one types "Fixes #"

But I have to deal with some corner cases (repository not found, there is no issues, the github api rate limit is reached), I want to isolate the functions that call github but then my helm source doesn't work any more (this is the actual bug that I left for you). Also, how to define the helm source so that it doesn't call github when evaluating the whole buffer ? see

(helm :sources '(issues-helm-source))

So I'd enjoy very much to have reviews by experienced elisp developers. Thanks !

https://gitlab.com/emacs-stuff/git-commit-insert-issue


texts: Possible to save winner history winner-ring-alist in savehist or desktop-save to save across sessions

texts:
I added in the following command to my .emacs but it doesn't seem to work:

(add-to-list 'savehist-additional-variables 'winner-ring-alist)

Is there a way to get the winner-undo history to save across emacs sessions with either savehist or desktop-save?


texts: Mapping AltGr+t key as a Ctrl+x (How to use AltGr key effectively in Emacs)

texts:
I am using international keyboard and extensively use AltGr key. There are many unused keys with AltGr so I would like to map AltGr+t = Crtl+x. I don't want to remap AltGr to Crtl; I just want to use  this specific instance.

I am using debian with Gnome. May I map this combination with xkb?


texts: Tramp cannot load larger files (Invalid base64 data)

texts:
Files above about 5kb fail to load in tramp mode, with the error:

tramp-file-name-handler: Invalid base64 data

Loading smaller files works fine:

Tramp: Inserting ‘/scp:server:small_file’...
Tramp: Encoding remote file ‘/scp:server:small_file’ with ‘base64 <%s’...done
Tramp: Decoding local file ‘/tmp/tramp.13491uQF.py’ with ‘base64-decode-region’...done
Tramp: Inserting ‘/scp:server:small_file’...done

But with larger files I get this:

Tramp: Inserting ‘/scp:server:larger_file’...
Tramp: Encoding remote file ‘/scp:server:larger_file’ with ‘(gzip <%s | base64)’...done
Tramp: Decoding local file ‘/tmp/tramp.13491iyp.py’ with ‘(lambda (beg end) (base64-decode-region beg end) (let ((coding-system-for-write (quote binary)) (coding-system-for-read (quote binary)) (default-directory (tramp-compat-temporary-file-directory))) (apply (quote tramp-call-process-region) [scp nil kronos larger_file nil] (point-min) (point-max) (car (split-string gzip -d)) t t nil (cdr (split-string gzip -d)))))’...failed
Tramp: Inserting ‘/scp:server:larger_file’...failed
tramp-file-name-handler: Invalid base64 data

I've checked the gzip command on the remote server, it seems to be working. Can I get tramp to keep the intermediate files around so I can inspect them? How else can I debug this?


texts: Can I specify tags as a property to avoid cluttering the headline?

texts:
Having tags in the headline clutters the view and is quite distracting when the tags are not directly pertinent to it. An example of this is the noexport tag which describes what to do with the headline and not what the headline is about.

Is it possible to move such tags to the property drawer so that they're not as visible? I tried this solution hoping that since I wanted to move just one tag, I wouldn't face the same issue as the OP did in that question but it doesn't work and exporting the org file resulted in a headline with the noexport tag specified as a property getting exported as well

This is what I tried:

:PROPERTIES:
:TAGS: noexport
:END:


texts: How do I disassociate a filetype and mode?

texts: I think the Change Log mode in emacs (spacemacs) acts crazily and I want to turn it off when editing my CHANGELOG. How do I do that for good?


texts:
The question What options are there for doing spell-checking in emacs discuss various spell checking solutions for Emacs.
Emacs ispell interface uses external tools such as Aspell or Hunspell for spell checking.
Considering the fact that many free dictionary files are available (for example by Openoffice see for example the dictionary file en_US.zip)
I am wondering if it would be possible to write a native spell checking function in Emacs using such free dictionary files.

Added: More precisely I am wondering if there are existing packages which can be used for spell-checking (without using external tools such as Aspell or Hunspell) within Emacs. A tool which checks if a word is correct and if not suggests some corrections.

In case the answer is negative, any hint to do this would be helpful.


texts: Updated from 24.5.1 to 25.1, not respecting default app scaling

texts:
I use surface book with 3000x2000 native resolution scaled 200%. I just reinstalled (spac)emacs with 25.1 version and a new emacs frame will start the right size then immediately halve in size as it starts to load and does not respect the 200% scale.

I have tried starting emacs on 100% then scaling up and all other such combinations to no success.

A partial solution exists:

  (add-to-list 'default-frame-alist '(font . "Fira Code"))
  (set-face-attribute 'default t :font "Fira Code")

This will set the frame to a good level but has two issues:

It overwrites dotspacemacs-default-font options like bold, width.
Not everything is scaled back - in particular pylint code analysis popups are extremely small.

Once it is zoomed in it uses proper hdpi after setting Disable display scaling on high DPI settings option on emacs.exe.


texts:
I often find myself copying commands line by line from an emacs buffer to my terminal.

How do i bind a shortcut which sends the current line/selection in emacs to my gnome-terminal?


texts: How to export org tables with cells on multiple lines?

texts:
In my org file i have the following table:

#+CAPTION: Заголовок пакета
| № | Размер | Тип      | Значение              |
|   | (байт) |          |                       |
|---+--------+----------+-----------------------|
| 1 |      1 | unsigned | *Маркер начала*       |
|   |        |          | константа 0xAC        |
|---+--------+----------+-----------------------|
| 2 |      1 | unsigned | *Размер данных*       |
|   |        |          | в байтах, от 1 до 255 |
|---+--------+----------+-----------------------|
| 3 |      1 | unsigned | *Контрольная сумма*   |
|   |        |          | по алгоритму CRC-8    |

Table was made with liberal application of org-table-wrap-region.

What i want/need: after export (to odt, doc/docx etc) have cells with multi-line contents. How do i achieve that?

Naive experimentation with built-in org export and pandoc produces tables where every line of text in original table becomes a row. What can i do to change that?

P.S. Pandoc documentation mentions multiline_tables and 'grid_tables' extensions. However, even after turning them on, i still get the same picture. Probably tables should be rewritten - but in that case, how do i reconcile output of org tables editor with the needs of pandoc input?


texts: Emacs freezes on javascript mode if I enter a newline after a dot character

texts:
Cursor is on the dot, I press newline, emacs hangs. This happens often to me I kill emacs and restart it. I come to this situation to break long lines at function calls at dot character.
  situation('8/8/8/8/8/8/8/R3K2R w - - 0 1')!.actors

  let [long, short] = ;

You need to try harder, play with . and newline break for example this hangs:
laskjdf
  .jalksdf
  .aksdfl.
  .lkajsdf
.

This is my config: https://github.com/eguneys/dotfiles .
Actually I am using typescript-mode which I installed from melpa.
I don't use neither fly-check or fly-make, syntax just highlights out of the blue.
I don't know what C-h v major-mode or C-h minor-mode does C-h is bound to delete-character to me.
Here's a describe-mode:
Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Blink-Cursor Column-Number Electric-Indent File-Name-Shadow Font-Lock
Global-Eldoc Global-Font-Lock Line-Number Mouse-Wheel Tool-Bar Tooltip
Transient-Mark Whole-Line-Or-Region

Here's a describe-variable major-mode:
Its value is ‘typescript-mode’


texts: Set variables based on path without using directory-local variables

texts:
I want to set variables, in particular, compile-command and tabbing related variables based on the path of the file I'm editing.

In my .vimrc I use the following to do this.

autocmd BufRead,BufNewFile */path/*.ext set tabbing-setting
autocmd BufRead,BufNewFile */path/*.ext set makeprg=build.sh

These cause vim to run the set ... commands whenever I create or read a file that matches the pattern */path/*.ext.

I don't want to use directory-local variables because I want this to live with the rest of my emacs configuration.


texts: What is the bbdb3 field "affix" used for?

texts: Does it work for a job title or is it used for academic titles?


texts: Which package to share editing, in real-time, over http?

texts:
I seem to remember a package mentioned once, that you would activate in Emacs, and then other people could follow what happens in almost real time in your Emacs by accessing a URL with a web-browser.

I can't for the life of me find the name of this package.


texts: daemon startup, new frame configuration, and display-pixel-width

texts:
I have a snippet that I use to determine what font size to set based on the resolution of the display, for when my laptop has an external monitor set or not:

(defconst prefs/font-size                  14)
(defconst prefs/font-size/display-laptop   12)
(defconst prefs/font-size/display-external 18)

(defun prefs/use-font-size ()
  (let ((px (display-pixel-width)))
    (cond
     ((eq px 7040) prefs/font-size/display-external)
     ((eq px 3200) prefs/font-size/display-laptop)
     (t prefs/font-size))))

This works great when emacs is started normally; however I'm trying to daemon-ify my configuration.  Based on that, I now have a function to set UI-related things on  default-frame-alist parameters in a before-make-frame as well as initial-frame-alist at startup:

(defun jl/set-frame-params (frame-alist)
  (add-to-list frame-alist
               `(font .
                      ,(concat (prefs/use-font) "-"
                               (number-to-string (prefs/use-font-size)))))
  ; ... more frame parameters
)

(jl/set-frame-params 'initial-frame-alist)
(add-hook 'before-make-frame-hook ; configure new frames
          #'(lambda ()
              (jl/set-frame-params 'default-frame-alist)))

However, here's the behavior I'm seeing:

initial daemon load: (display-pixel-width) returns nonsense (10) and the initial emacsclient frame has the font size set incorrectly
creating a new frame after that via make-frame,(display-pixel-width) returns the correct value, but the font size is still incorrect.
creating a second new frame with make-frame, the font size is finally correct.

What am I doing wrong here, and how can I get my font size set correctly both for the first frame created on a server, and subsequent frames?


texts: TRAMP hangs after timeout on trying to connect

texts:
After I type C-x /remote.server.com TAB /, the prompt changes to spinning bar and nothing more happens. After around a minute of waiting I get the same prompt I was entering, i.e. /remote.server.com:. There’s also a buffer *tramp/scp remote.server.com opened, but it’s empty. In the Messages buffer I can see

Tramp: Opening connection for remote.server.com using scp...
Tramp: Sending command `exec ssh   -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none remote.server.com'
Tramp: Waiting for prompts from remote shell...
Timeout reached, see buffer `*tramp/scp remote.server.com*' for details
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for remote.server.com using scp...failed

Autocompletion for ssh remote.server.com:/ works in a regular terminal, and shows in a couple of seconds. The server in question uses options from ~/.ssh/config, such as User, Port, HostName, IdentityFile to connect.

Debug output: http://sprunge.us/MFig

Debug output after changing remote PS1 to ‘#’: http://sprunge.us/DLcH


texts:
my question is very similar to this one.

I use my .profile file to set environment variables, such as EDITOR.  However, when I run ansi-term and type printenv I can see that that variable is not defined.

I am already using exec-path-from-shell but it looks like certain environment variables are not set.

Apparently the .profile file is only supposed to be read on login, but this means that environment variables that I do need to be set are not set for ansi-term which is my preferred way to use a shell in emacs.

Simply put I am looking for a way to make the environment in ansi-term identical to the a login shell.  Is there a way to do this?


texts:
I want to copy some text from my browser and paste it into ansi-term. I am a vim user and I want to give spacemacs a try once again.

Naturally what I did was:

Opening ansi-term by typing SPC SPC ansi-term.
Switch to normal-state by pressing ESC.
Switch to my browser, copy some text
Switch back to emacs, press p which seems to be right (the text was pasted)

So I try some alternatives

Press enter, and surprised since the command didn't executed
Press i to switch to insert mode, and do it again. Yet still didn't work.
Press SPC SPC term-paste, now it works

What I expect is, I can simply use evil binding to copy-pasting things in spacemacs and get it work.

Can anybody please show me what's wrong and how to do this correctly?

Thanks

EDIT:
I can get it works by switching to line mode. So, after I start ansi-term, I need to press Ctrl c Ctrl j. Still looking for a better way if there is any.

EDIT AGAIN:
The official way to do this is <S-Insert> (shift + insert)


texts:
I'm trying to get literate programming with :noweb syntax working in org-mode. I think I'm down to about the minimum case:

#+TITLE: Console Tic Tac Toe
#+SUBTITLE: A Literate Program in EMACS Org-Mode
#+AUTHOR: Charlie Martin
#+STARTUP: showall

#+BEGIN_SRC python :tangle yes :noweb
  import sys
  import os

  def main(args):
      <<initialize-the-game-board>>

  if __name__ == "__main__":
      main(sys.argv)
#+END_SRC

#+NAME: initialize-the-game-board
#+BEGIN_SRC python :tangle yes :noweb
  board = [[-1 for x in range(3)] for y in range(3)]
#+END_SRC

but when I tangle it I get:

import sys
import os

def main(args):
    <<initialize-the-game-board>>

if __name__ == "__main__":
    main(sys.argv)

board = [[-1 for x in range(3)] for y in range(3)]

I've tried permuting the argument, flags, and so on to no avail.


texts: Say I run ag or grep via M-x and display a window with search results. Say I then use my enter key to open a result. How can I force emacs to open this result in the same window as the search results are currently displaying, rather than a different window?


texts: Exporting Org document to HTML/PDF *without* opening Emacs

texts:
I am using Org mode to build a website that contains my notes on various topics, which I read on my phone on the way to work. To introduce more automation into my workflow, I would like to have crontab setup so that at the stroke of midnight (say at 11:59:59 p.m). the org mode document is exported to the html (for the website) and pdf formats.

Sure, I can open up the emacs window in terminal or gui and then export it using C-c C-e but crontab cannot do this. How can I export an org file to html / pdf through the command line. Ideally the format of the command at the terminal would be

emacs <export-command-magic> notes.org -o notes.html

I know pandoc would be another solution (which allows you to convert org mode documents into HTML, but I would like to have a native Emacs solution that understands all the crufty customizations I have set up for my own org-mode, runs all the embedded source code snippets etc.)


texts: How to install auto-complete via package system?

texts:
I'm trying to get work auto-complete. I've installed the package from MELPA successfully. However, it just does not work. When I enable auto-complete-mode the mode seems to be active (I see AC in the list of minor modes), but there is no pop-up window displaying completions when I enter some text.

I thought that it should work out-of-box, but may be it's not the case. I cannot find instructions how to configure the package installed via package manager, not manually. What actions should I undertake?


texts: How do I configure my own shortcuts in Auctex (Emacs)?

texts:
I have a problem that I could not solve with the help of google.

a) How do I have to adjust the .emacs file in order to use the Windows-Key (Super-Key) for shortcuts. I am working on a Linux system and the system does not use this key.

b) How do I create my own shortcuts using this key – I am sure that I have to do that in the .emacs file also but I haven’t found out exactly how to do it. The reason why I want to do all this is, that I a recently switched from TeXstudio to Autctex and I want to use (at least till I am getting used to the Emacs/Auctex World) as many of my old shortcuts (For: begin{quote}, section, italics, footnote etc.

So I want:

Win + i = Italics

Win + b = Bold

Win + Z = Quote

Win + F12 = begin{itemize}

Win + 1 = section

etc. etc.

If I should move the questions elsewhere I would be glad to do it…


texts: How do I bind a key to open or close a mode? (undo-tree)

texts:
I'm using evil (via spacemacs) and I want to bind <f2> to open and close the undo-tree (like vim-Gundo). I can successfully bind opening undo-tree-visualize, but I can't figure out how to quit. I tried the obvious:

(define-key evil-normal-state-map (kbd "<f2>") 'undo-tree-visualizer)
(define-key undo-tree-visualizer-mode-map (kbd "<f2>") 'undo-tree-visualizer-quit)

It correctly opens undo-tree but doesn't close it (I get a "no undo information" error). I also tried to hook on load:

(defun my-undo-tree-hook ()
    (define-key undo-tree-visualizer-mode-map (kbd "<f2>") 'undo-tree-visualizer-quit))
(add-hook 'undo-tree-visualizer-mode-hook 'my-undo-tree-hook)

But that also doesn't work.

What am I doing wrong?


texts: Pressing both Ctrl keys at the same time is recognized as Ctrl plus Meta

texts:
When pressing both C at the same time, the combination is recognized as C-M on a Win7 machine and Emacs 24.5.

I've stumbled on this by mistake while pressing C-C-SPC. While on a Linux machine, this is the same as C-SPC, on a Windows machine this is recognized as C-M-SPC. This is very handy, but I'm not able to reproduce the behaviour on Linux.

Any ideas on how I might achieve this on Linux or why is it working only on Windows?

Update for Windows:

If I start emacs with no init files (emacs -q), the behavior is still present (i.e. C-C-SPC is still recognized as C-M-SPC)
If I start emacs without the window system (emacs -nw) the behavior disappears (i.e C-C-SPC is recognized as C-SPC), as expected.


texts:
The Emacs Lisp Reference Manual's Appendix D.7 mentions some comment tips:

Single semicolons (;) should be used for inline comments.
Double semicolons (;;) should be used for line comments.
Triple semicolons (;;;) should be used for "comments which should be considered a heading by Outline minor mode".
Quadruple semicolons (;;;;) should be used for headings of major sections of a program.

The single and double semicolon use cases are clear, but there does not seem to be a sharp delineation between triple and quadruple semicolons.

In particular, the standard documentation for Emacs packages provided by auto-insert uses triple semicolons, never quadruple semicolons, even for the highest-level headings like file name and major sections. See example below:

;;; test.el --- A test file.                         -*- lexical-binding: t; -*-

;; Copyright (C) 2016

;; Author:  John Smith
;; Keywords:

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:

;;

;;; Code:

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

What are the best practices for triple and quadruple semicolons?

Update

Thanks to Stefan's answer, I have filed a bug report and made the following suggestion:

  I suggest that the description for three semicolons be changed to:

Comments that start with three semicolons, ‘;;;’, are considered
top-level headings by Outline minor mode.

Four or more semicolons can be used as subheadings in hierarchical
fashion. E.g.

;;; Main heading
;;;; Sub heading
;;;;; Sub sub heading
;;;; Another sub heading
;;; Next main heading

These comments should be used to break Emacs Lisp code into sections.

  A link to "Outline minor mode" in the Emacs manual would be useful:
  https://www.gnu.org/software/emacs/manual/html_node/emacs/Outline-Mode.html

  The section for four semicolons can be elided.


texts: Globally set C++ source block header arguments

texts:
I try to globally set header properties for C++ source examples, with no success. I would have expected that the following works

 #+PROPERTY: header-args:C++ :var x=1.0

What did work is using general header args property:

 #+PROPERTY: header-args :var x=1.1

Also specific property drawer worked:

* Resources
:PROPERTIES:
:header-args:C++: :var x=1.2
:END:

And of course using plain old header arguments works:

#+header: :exports results
#+header: :includes <iostream>
#+header: :var x=1.3
#+begin_src C++
std::cout << x;
#+end_src

Could that be a bug or am I doing something wrong?


texts: Inject backlinks into structured HTML (nav,ul,li) before org processing by org-publish with ox-slimhtml backend

texts:
I'm trying to inject backlinks (org-roam user) into  ...  html5 section at the end of my
 section during ox-export. Idea was to obtain something like that :

  backlink 1

  backlink 2

Links need to be transformed from org to html, so i use a hook 'org-export-before-processing-hook' to inject org before processing.
I use ox-slimhtml derived backend because html5 output is simple and more semantic.
My first attempt was using s-wrap with #+HTML: but i also try the #+HTML_POSTAMBLE from ox-slimhtml without success.

(defun convert (l)
  (-mapcat (lambda (x) (list (car x) ( cdr x))) l))

(defun gx/get-backlinks (buf)
  (-flatten (convert (-take 1 (-unzip (org-roam--get-backlinks buf))))))

(defun gx/org-export-preprocessor (backend)
  (let ((backlinks (gx/get-backlinks (expand-file-name buffer-file-name))))
    (when (and (not (null backlinks)) (consp backlinks))
      (save-excursion
        (goto-char (point-max))
        (insert (s-wrap (gx/format-links backlinks) "#+HTML:" " "))))))

(defun gx/format-links (links)
  (s-join "\n" (--map (org-roam--format-link it (org-roam--get-title-or-slug it)) links)))

(add-hook 'org-export-before-processing-hook 'gx/org-export-preprocessor)
(org-publish-all)

I take some time to make a MWE (publish.el + org files + html generated) with already published HTML to see the problem : https://filesender.renater.fr/?s=download&token=ba0cac2e-0ca2-47f0-97eb-425b42afe2a5
But i miss something and the outputted html is broken ...
I don't want to use :html_preamble and :html_postamble org-publish option because i suppose that operate after org processing. But, i'm beginning into elisp (two day to write ten working lines ...) so there are probably other solutions to do that than hacking this hook to inject HTML block.


texts: How to set js-mode indent in Emacs >= 27.1

texts:
I have my tab width set to two spaces and this has worked fine for many years.  I have just upgraded to Emacs 27.1, and now js-mode is displaying tabs as three spaces wide, ignoring my preferred settings (which still apply to other modes, it's only js-mode that isn't respecting my preference.)
I can't work out how to make it go back to 2.  The tab width is still set to 2 in my init.el file, which hasn't changed during the Emacs upgrade.
If I press M-x and run set-variable then set tab-width to 2, the file goes back to the correct tab width.  But I can't work out how to make it apply to all files.  If I press ? instead of 2 when setting tab-width then it tells me it is already set to 2 (which it is, in my init.el) however it seems I have to set it to 2 again, even though it's ready 2, for every .js file that I open.
How can I make it so that js-mode respects the tab widths I have set in init.el, as it did in earlier Emacs versions?
I've looked through all the options but I can only see two that are related to the tab width and they are already set to 2.
Is anyone else running Emacs 27.1 or newer?  Have you successfully changed the tab width for .js files?


texts: How can I bind C-return with define-key and kbd?

texts:
I am able to bind M + RET with:

(define-key my-keys-mode-map (kbd "<M-RET>") 'my-function)

How can I bind C + RET with the above format?

I have tried:

kbd "<C-RET>"
kbd "C-<RET>"
kbd "C-RET"

But none of these work.

If it is impossible with define-key and kbd, is there another way to bind C + RET in the mode my-keys-mode-map?


texts: How to rebuild agenda buffers when saving an org-mode buffer?

texts:
When composing my weekly schedule, it feels somewhat jarring to have to switch to the agenda buffer in the other frame and rebuild, just to see how things align. Adding org-agenda-redo to after-save-hook doesn't seem to work. Having the hook call (org-agenda-redo t), which should rebuild ALL agenda buffers, doesn't seem to work either.

Here's a sample of the code I'm using:

(defun org-agenda-redo-all ()
  "Rebuild all agenda buffers"
  (org-agenda-redo t))

(add-hook 'org-mode-hook
          (lambda()
            (add-hook 'after-save-hook 'org-agenda-redo-all nil 'make-it-local)))

According to the *Messages* buffer, org-agenda-redo appears to be called:

Saving file /home/mkaito/notes/agenda.org...
Wrote /home/mkaito/notes/agenda.org
Rebuilding agenda buffer...done

But the agenda buffer in the other frame is not updated.


texts: What is evil-mode's equivalent to vim insert-mode completion?

texts:
I'm making the move from Vim to Emacs + Evil-mode. I miss Vim's CTRL-X in insert mode to trigger completion of either words, tags, file paths, etc.
I wonder if evil-mode has something similar?

Thanks


texts:
Emacs has self-documentation as one of its goals, and it achieves this pretty well for Emacs Lisp with commands like describe-variable, describe-function, etc. Packages like company-quickhelp make this even more convenient by providing help in tooltips, which reduces the need to constantly switch attention to a Help buffer.

The built-in Info reader is also very convenient for browsing Info manuals. Helm improves upon this by providing helm-info, which allows for choosing from all installed Info files and searching a file's index via incremental completion.

I find the above tools important because, by making documentation look-up easier, they encourage me to do more of it.

However, it's difficult to replicate the ease with which I can look up documentation about Emacs, Emacs Lisp, etc. with other tools and languages. For example, if I forget what a CSS rule does, I still find myself Googling for answers, which is slow and shifts attention away from Emacs.

So, what are some good ways (both general and specific to particular tools/languages) to look-up documentation or check manuals in Emacs?

Common Lisp, for example, has SLIME, which tries to do for Common Lisp what Emacs does for Emacs Lisp, although it doesn't get as far because many references are made to the Common Lisp HyperSpec.


texts: Dired-K: Not change color of file name (change by date)

texts:
Windows 10, Emacs 25.1, Dired+, Dired-K

Suppose current time is 20:31

Here my init.el

(require 'dired+)

(require 'dired-k)
(define-key dired-mode-map (kbd "K") 'dired-k)
(define-key dired-mode-map (kbd "g") 'dired-k)
(add-hook 'dired-initial-position-hook 'dired-k)
(add-hook 'dired-after-readin-hook #'dired-k-no-revert)

And I want to change color of files name that has recently changed.

Here screenshot:

As you can see the settings are:

Elapsed seconds from last modified: 60
Color: white

But file names: test1.log, test2.txt, test3.rc NOT change it's color to WHITE!

Why?

P.S. Here it's look like in file manager Total Commander. It's very comfortably


texts:
Can emacs be run in chrome? Like vim does at

https://rhysd.github.io/vim.wasm/


texts:
Is it possible for auctex to display missing references differently to ones which are in the bib file? Currently, all references look identical so it's impossible to tell at a glance which citation keys are defined in the bib file, and which are not. Texstudio does this quite nicely.

book.tex:

\documentclass{book}
\usepackage[backend=biber]{biblatex}
\addbibresource{bib.bib}

\begin{document}
This reference exists \autocite{ref1}.
This reference does not \autocite{ref2}.
% A squiggle, red, anything different to show "ref2" differently to "ref1" would be lovely.
\end{document}

book.bib:

@misc{ref1, ...}


texts: Modifying AucTeX bracket indentation locally

texts:
I am currently using songs package, which via some TeX trickery uses escaped brackets to mark chords (for example \[G] is G-major, while \[a] is a-minor). This causes problems with indentation, for example this is how the following snippet gets indented (every \[ introduces new indent level):

\begin{song}
  \begin{verse}
    \[G]This is \[D]some \[A]guitar song
          \[G]annotated with \[D]the chords
              to \[e]make playing ea\[H7]sier.
  \end{verse}
\end{song}

while of course I would like to get:

\begin{song}
  \begin{verse}
    \[G]This is \[D]some \[A]guitar song
    \[G]annotated with \[D]the chords
    to \[e]make playing ea\[H7]sier.
  \end{verse}
\end{song}

I managed to resolve this by removing bracket indentation completely:

(setq LaTeX-begin-regexp "begin\\b")      ; Default is begin\\b\\|\\[
(setq LaTeX-end-regexp "end\\b")          ; Default is end\\b\\|\\]

but this impacts also my various other uses of \[, including math…

So, the question is, whether it is possible to disable indenting behaviour of bracket just inside specific environment (song), while leaving it unchanged everywhere else.

If impossible, what is the easiest/recommended way to change LaTeX-begin-regex and LaTeX-end-regexp just for specific files instead of customizing it globally?


texts:
Running M-x hl-line-mode enables highlighting for the current buffer.

How can i set highlighting current line to be enabled in init.el?


texts: How do I automatically save org-mode buffers?

texts:
I regularly use org-mode and the agenda to keep track of my to-do list. Since I use Dropbox to sync my list, I need the same tasks to be available on all computers. Sometimes during the course of my cleanup I will forget to save my changes, leaving emacs open at home when I go into the office (thus I am not prompted to save on closing emacs). How can I automatically save changes to *.org agenda buffers that are modified through the agenda?

EDIT: To clarify, I use the agenda view of my tasks to show me an overview. From that view, I can change the status of tasks. Additionally, I use remember-mode to add new tasks, which can then be recategorized in the agenda view. These changes in the agenda result in modified org-mode agenda buffers, which must then be saved. When these changes are made, I would like the buffers to be saved automatically.


texts: Tramp with ssh not asking for password - too many authentication failures

texts:
I would like to use tramp to login to a remote server via SSH.

It used to work effortlessly, but somehow it does not even ask me for a password any longer and tries wildly to login with I guess keys from ~/.ssh or something, until the server gives me:

Received disconnect from MYSERVER port 22:2: Too many authentication failures

How do I force tramp to not try anything, but always use password authentication? I also do not wish to use an authentication file currently. I have found many questions where an authentication file was the chosen solution, but I would like to stick with Emacs asking me for a password for now. I am looking for the tramp equivalent of:

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no MYUSER@MYSERVER

I already have the following in my init.el:

;; ==========
;; TRAMP MODE
;; ==========
(setq tramp-default-method "ssh")
(setq tramp-verbose 5)
(setq password-cache-expiry 86400)
(setq auth-source-debug t)
(setq auth-sources '())

I also have a hunch, that it might be, that tramp does not notice, that the server asks for a password, because of a custom MOTD, but am not sure, that this is the issue. The MOTD looks like this:

#####################################
#####################################
#                                   #
#      LOGGING IN TO MYSERVER       #
#                                   #
#####################################
#####################################
MYUSER@MYSERVER's password:

Versions

tramp: tramp 2.2.13.25.2 built-in
emacs: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian

Output in debug tramp/ssh

#####################################
#####################################
#                                   #
#      LOGGING IN TO MYSERVER       #
#                                   #
#####################################
#####################################
Received disconnect from MYSERVERIP port MYSERVERPORT:2: Too many authentication failures
Disconnected from MYSERVERIP port MYSERVERPORT
23:31:27.476717 tramp-maybe-open-connection (3) # Opening connection for MYSERVERUSER@MYSERVERIP using ssh...failed
23:41:32.631334 tramp-get-test-command (5) # Finding a suitable ‘test’ command
23:41:32.632857 tramp-maybe-open-connection (3) # Opening connection for MYSERVERUSER@MYSERVERIP using ssh...
23:41:32.641165 tramp-maybe-open-connection (3) # Sending command ‘exec ssh -l MYSERVERUSER  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none MYSERVERIP’
23:41:32.643068 tramp-process-actions (3) # Waiting for prompts from remote shell...
23:41:33.474487 tramp-process-one-action (5) # Looking for regexp "\(.*\(user\|login\)\( .*\)?: *\)\'" from remote shell
23:41:33.477166 tramp-process-one-action (5) # Looking for regexp "\(^.*\(\(?:adgangskode\|contrase\(?:\(?:ny\|ñ\)a\)\|geslo\|h\(?:\(?:asł\|esl\)o\)\|iphasiwedi\|jelszó\|l\(?:ozinka\|ösenord\)\|m\(?:ot de passe\|ật khẩu\)\|pa\(?:rola\|s\(?:ahitza\|s\(?: phrase\|code\|ord\|phrase\|wor[dt]\)\|vorto\)\)\|s\(?:alasana\|enha\|laptažodis\)\|wachtwoord\|лозинка\|пароль\|ססמה\|كلمة السر\|गुप्तशब्द\|शब्दकूट\|গুপ্তশব্দ\|পাসওয়ার্ড\|ਪਾਸਵਰਡ\|પાસવર્ડ\|ପ୍ରବେଶ ସଙ୍କେତ\|கடவுச்சொல்\|సంకేతపదము\|ಗುಪ್ತಪದ\|അടയാളവാക്ക്\|රහස්පදය\|ពាក្យសម្ងាត់\|パスワード\|密[码碼]\|암호\)\).*:

It seems to me that the "sending command" part: Sending command ‘exec ssh -l MYSERVERUSER  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none MYSERVERIP’ is wrong, or at least not what I want.


texts: Remove all custom key bindings/Reset key bindings to default

texts: I don't know Lisp unfortunately. I have a friend, and I really liked his color scheme/default Emacs setup. However, I hate his hotkeys and I am used to the ones that come as default with Emacs. Is there any relatively painless way to go into the .emacs file that he gave me and basically just remove only his key bindings/hotkeys but keep all the visuals the way he has them? Again, please excuse my ignorance and frankly I usually get Emacs to "just work" to the point where I rarely actually have to edit the Lisp. By the way, I'm on Fedora 25. Thank you.


texts: I would like to concatenate a string (e.g. "abc") and a list (e.g. '(aa bb)) so as to obtain "abc aa bb".