texts: How to move back to a previous typo in ispell?

texts: When running M-x ispell, is it possible to go back to the previous typo? For example, I accidentally pass a typo and want to go back to it.


texts:
Is it possible to have a text string as a text property in emacs? Let me explain. I usually work with latex documents and I need to format their bibliographies that have, e.g., this structure:

\begin{thebibliography}{9}

\bibitem{bib1}
Some text...

\bibitem{bib2}
Some text...

\bibitem{bib3}
Some text...

...

I'd like to have in my buffer:

\begin{thebibliography}{9}

\bibitem{bib1} [1]
Some text...

\bibitem{bib2} [2]
Some text...

\bibitem{bib3} [3]
Some text...

...

where [1], [2], [3] are not meant to be "real text" but "properties" of the corresponding strings. (A sort of "watermark"...) Actually those strings should not be send to the latex compiler...

I know I can use commented text (and so I do in my daily work) but it would be better for my needs if I could get that behaviour.

EDIT. Ok, Drew showed me the way... I did it with:

(defun BibitemNumbering ()
  (interactive)
  (save-excursion
    (let ((counter 0))

      (while (search-forward-regexp "\\\\bibitem{[^}]+}\\(\n\\)" nil t)
    (save-excursion
      (let ((b (make-marker))
        (e (make-marker)))

    (setq counter (1+ counter))
    (set-marker b (match-beginning 1))
    (set-marker e (point))

    (put-text-property b e 'display (concat " ["
                        (number-to-string counter)
                        "]\n"))
    )))
      )))

Is this the right way? Also, I'd like to have the displayed string "coloured" or with a coloured background. How can I set this?


texts: start emacsclient with focus from command line

texts:
When I start emacsclient from command line as below:

emacsclient -a '' -c "$@"

It always starts in the background (terminal window on top of emacsclient window), so I have to use mouse to click the window to switch to emacsclient.

It's really frustrating, can I get emacsclient to focus the frame that pops up when invoked from command line?


texts: How to configure lsp-cmake lsp server in vanilla emacs

texts:
I want to setup lsp-cmake lsp server in my vanilla emacs.
I just installed lsp server using pip install cmake-language-server.
I don't know how to configure in my emacs init.el to use the lsp server. The couldn't find any documentation as well for emacs.
How can I configure lsp-cmake in my init file for emacs


texts:
I uses Cygwin Emacs w32. I found out that Emacs started gam_server.exe:

https://www.mail-archive.com/cygwin@cygwin.com/msg153120.html

bash# apt-cyg depends emacs-w32 | grep gamin
170:emacs-w32 > emacs > libglib2.0_0 > libfam0 > gamin
1533:emacs-w32 > libMagickCore6_2 > libcairo2 > libglib2.0_0 > libfam0 > gamin

I am not sure if Emacs need libfam0 via  libglib2.0_0... Can someone confirm this?

I removed gamin package, but dependency to gamin is "required" so on next update I need to repeat manual steps to remove that scam again. With missing gamin in Emacs console:

failed to find gam_server
Failed to connect to socket /tmp/fam-user/fam-

gam_server looks like bloatware to me.

I don't understand if that file tracking server is using Windows API or Cygwin developers ported Linux intofy API... Because otherwise it useless.

Should I open Emacs bug (Windows build uses libfam)? Should Cygwin build adjusted with come options to disable libfam/gamin?


texts: use-package: Can :after be used instead of with-eval-after-load?

texts:
If my :config section is entirely wrapped in with-eval-after-load, is that equivalent to simply specifying an :after directive? That is, can I replace this:

(use-package company-tern
  :config
  (with-eval-after-load 'company
    (add-to-list 'company-backends 'company-tern)))

with this

(use-package company-tern
  :after company
  :config
  (add-to-list 'company-backends 'company-tern))

Am I correct in my understanding that if there is other configuration that isn't inside of the with-eval-after-load then it wouldn't be useful to replace it with an :after directive since that would defer the loading of the entire package just for the subset of the configuration that depends on the feature?

I should note, in the above situation it seems simple enough to just nest company-tern's use-package under company's :config section, since they're logically related. However, my question is for the more general case where the "dependency" doesn't necessarily have a logical connection, or when there is more than one "dependency."


texts: How to use Org pretty math expressions with clipboard?

texts:
Using org-toggle-pretty-entities, org-mode will convert text like

∫_ℝ f(x)dx = 1
∑^N_{i=1} x_i

to

But if I want to copy that text to an outside application, it just shows up as it was originally typed (not in its "pretty" format).

Question: How does one copy pretty unicode text to be pasted to outside applications?


texts:
I have a timestamp string "2011-01-23T16:18:46-08:00" and I want to convert it to my local time zone.

(format-time-string
    "%Y-%m-%dT%H:%M:%S%z"
    (decode-time (parse-iso8601-time-string "2011-01-23T16:18:46-08:00")))

gives

"1970-02-04T13:24:34-0800"

which is off by several decades. How do I fix this?


texts: How do I make Evil's C-o work with Org's C-c C-o?

texts:
Org mode's org-open-at-point (C-c C-o) works great for internal links, e.g.
Stuff to buy:
- <<food>> food:
  - tomato
  - potato
  - banana
- <<drinks>> drinks:
  - juice
  - tea
  - coffee

Maybe look for some more variation for [[food]]?

However, when I use org-open-at-point in [[food]], Evil mode's evil-jump-backward (C-o) does not bring me back to my original position. Org mode itself tells me in the echo area to use C-c & (org-mark-ring-goto) instead, but I would like to use evil-jump-backward to remember only a single keybinding.
Is it possible to use Evil's C-o also movements via org-open-at-point?


texts: Tramp ediff problem MS-DOS style path detected

texts:
I'm using tramp to edit files remotely. Now I would like to ediff two files which are at the remote location.

The problem is, I get the following warning, which prevents using ediff completely.

cygwin warning:
  MS-DOS style path detected: c:\Users\beginner\AppData\Local\Temp\beginner.cpp
  Preferred POSIX equivalent is: /cygdrive/c/Users/beginner/AppData/Local/Temp/beginner.cpp
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

I tried to export nodosfilewarning, but this does not seem to affect the environment Emacs is running in.

How can I get ediff to work with tramp?

The emacs is windows native and I am connecting to the remote via putty link.


texts: "stdin isn't a terminal" with helm-projectile?

texts:
Opening up helm-projectile-find-file keeps showing me this error:

screenshot http://zc.d.pr/16fh0/1Ryb9GGB+

Anyone know how to get rid of this? Or what's causing it?

Emacs config here: https://github.com/neezer/.emacs.d/blob/master/config.org


texts: When I run Emacs under an X11 session manager, it provides a RestartCommand="emacs25 --smid=ef85455de14b4e6a8a8c39dae106b554 --chdir=/some/dir". I would like it to open the same files as last time, but only locally within the same smid! Is it possible to integrate the Desktop mode (or some other session mode) with this, so that each X11 session of Emacs (I'm planning to have multiple) restarts with its own set of files opened?


texts: column view doesn't tabulate all headings and it modifies buffer in org mode

texts:
Running column view (C-c C-x C-c) shouldn't change buffer at all. However, in some cases, I found it adds extra whitespaces in some locations in the buffer. In the example in the snapshot, the column view, for unknown reason, did not tabulate the heading Known Issues and it modified the buffer (the 3 whitespaces added after the heading as I show in red in the git diff in the screenshot). Does anyone know why column view doesn't tabulate all headings and why it modifies a buffer? This is very undesirable.

The org file is available here for testing: https://www.dropbox.com/s/uj5vnzpn3ls4pd2/foo2.org?dl=0

And I am using:

Org mode version 9.3.6 (9.3.6-25-g685b2c-elpa @ /Users/john/.emacs.d/elpa/org-20200330/)
GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-09-02
Mac OS Catalina


texts: Binding a key to 'open -a Terminal .' on macOS

texts:
I'd like to do something like this

(global-set-key (kbd "C-c t") (kbd "M-! /usr/bin/open -a Terminal . RET"))

... in order to open a (real, the) terminal from the current working directory in macOS with GNU Emacs 26.1. Although /usr/bin/open -a Terminal . opens a new terminal from within macOS, the above key binding doesn't work (nothing happens). Why? The buffer *Messages* shows /bin/bash: /usr/bin/open-aTerminal.: No such file or directory, so spaces seem to be ignored.


texts: Hideshow with python hiding only one part

texts:
I've been trying to use Hide Show package in emacs. I encountered a problem when using python. Let's say I have the following code:

When I have hit the command hs-hide-level. This is the result.

Which is not correct since I'm looking for this:

So, apparently there's a bug in the code which provokes that the folding is being done only in the impair methods (for some reason), but I'm asking here for a workaround if anyone has encountered the same problem.

I'm using Emacs 24.3.1 under ubuntu 14.04.


texts: In org mode, how to export slide with bibliography?

texts:
I have been trying to include citations in the org file which I then export to beamer and using biblatex.

It seems that slide of bibliography needs specifying environment like fragile or allowpagebreaks. So far that seems to be the reason why bibliography is not getting printed.

In the header

#+LATEX_HEADER: \usepackage{biblaltex}
#+LATEX_HEADER: \bibliography{file.bib}

Citation gets written as [[bib::author03]].

* References

#+BEGIN_LaTeX

  \printbibliography

#+END_LaTeX

Could you help get the citations working properly in the org-mode ?

Thanks.


texts: Is there a way to make the "o" keypress of other-window  repeatable?

texts:
Question is as stated in the title.

Instead of using various packages for switching windows, it might be simpler to make <C-x><C-o> behave like <C-x><C-+>, such that repeated presses of the o key after the initial <C-x><C-o> will keep switching windows.


texts: Why can I not run (text-scale-increase 2) in emacs 26.1 running in terminal?

texts:
How come, when running (text-scale-increase 2) from the scratch buffer in an emacs instance running in a terminal, nothing happens besides a counter in the status-bar increasing? In particular, nothing happens to the font size. When doing this in gui-emacs, it works fine.

I am trying to tie a custom key-chord in the kitty terminal (https://sw.kovidgoyal.net/kitty/), sending a utf-8 code unicode char to emacs running in the terminal and then bind that unicode char to (text-scale-increase). However, since (text-scale-increase) for some reason does not execute properly in the terminal it fails. Also, when trying (text-scale-increase) in an ordinary gnome-terminal, it also fails.

What is at work here?


texts: Can pdf be previewed in dired+/peep-dired in the same way as jpg?

texts: I use emacs (v 25.0.93.1) on windows 10, and I am impressed by all the funtionality of dired+. One function I use often is peep-dired, so I can preview my text files when scrolling down my files in dired. For some reason jpg files are also previewed, not as code, but as a picture. Is it possible to preview pdf, doc, docx, and xls files also, not as their code, but readable for humans?


texts:
I would like to see the git branch shown in the dired mode-line at least for the top directory of git projects.

Anyone done this or know how to?


texts: How to add bbdb contact from gnu message?

texts:
I am trying to figure out gnus and bbdb.  I am able to read messages using gnus, but now I want to add contacts from the mail message into bbdb.  I have read that ':' should display a prompt and allow me to do this, but that doesn't work.

Any suggestions on what I am missing?

My init file has the following configuration:

(require 'bbdb)
(bbdb-initialize 'gnus 'message)


texts: How can we invert the colors of the image when opening a pdf file in doc-view?


texts:
I'm played around with my .emacs and installed a few packages from melpa related to C++. Now when I start emacs, I get this error

eval-buffer: Symbol's function definition is void: eieio-defclass-autoload

It doesn't happen with emacs -Q. So I completely emptied my .emacs and removed all packages I installed today. The error persists. I also use desktop sessions, so I turned this off with emacs --no-desktop but with no success. Which file is loaded that causes the error? Here is the complete *messages* buffer

Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50auctex.el (source)...
Loading /usr/share/emacs/site-lisp/auctex.el (source)...done
Loading /usr/share/emacs/site-lisp/preview-latex.el (source)...done
Loading /etc/emacs/site-start.d/50auctex.el (source)...done
Loading /etc/emacs/site-start.d/50autoconf.el (source)...done
Loading /etc/emacs/site-start.d/50cmake-data.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Error while loading 50dictionaries-common: Symbol's value as variable is void: debian-aspell-only-dictionary-alist
Loading /etc/emacs/site-start.d/50ess.el (source)...done
Loading /etc/emacs/site-start.d/50global.el (source)...done
Loading /etc/emacs/site-start.d/50python-docutils.el (source)...done
eval-buffer: Symbol's function definition is void: eieio-defclass-autoload

So I realized that eieio is part of cedet but didn't know how to get rid of it I guess since it's now included into emacs.


texts: Encrypt excerpts in org file (passwords only)

texts:
I keep project info in .org file together with passwords.

When I share a screen it is annoying to show passwords in a buffer accidentally.

I want to keep .org file in plain text format but mark some parts to be obfuscated or hidden or encrypted:

This is a normal text.
user: me
password: MAGIC{XXXX}

I want to be able to copy content marked as MAGIC as a plain text without a prompt for the decryption master password.

UPDATE I saw http://doc.norang.ca/org-mode.html#HandlingEncryption
It encrypts entire section of org file and displays it in plain when prompted.

Displaying of passwords is dangerous. I want to hide them visually and without any manual instructions.


texts:
I'm trying to bind ",," to eval the topmost S-expression containing the cursor in common lisp layer, from this page I assumed it would be done like so:

(spacemacs/set-leader-keys-for-major-mode 'common-lisp-mode "," 'slime-eval-defun)

Which returns nil, but when I try to use it, says it's undefined.

Thinking that "," may be special in some way I tried this:

(spacemacs/set-leader-keys-for-major-mode 'common-lisp-mode "eh" 'slime-eval-defun)

with the same outcome.

What am I doing wrong?


texts: Font on emacs (Windows 10) appears cut off

texts: How can I improve the appearance of the emacs (25.2.1) font on Windows 10 (1703)? Currently, text appears blurred and cut off (especially lines on the bottom):


texts: Installing a package via `package-install' in Lisp?

texts:
The documentation of package-install says: "Install the package PKG.  PKG can be [...] a symbol naming one of the available packages in an archive in ‘package-archives’."

To install the latest version of Aggressive Indent Mode, I have tried:

(package-install 'aggressive-indent-1.8.3)
(package-install 'aggressive-indent-1.8.3.el)

But both of them make Emacs drop into the Lisp debugger.  I cannot use simply:

(package-install 'aggressive-indent)

which would work, because I already have an older version of Aggressive Indent Mode installed.


texts: How to kill magit-diff's buffers on quit?

texts:
After making a commit in magit, magit will leave around a magit-diff buffer containing just:

 Staged changes
(empty)
[back]

This is pretty useless and clutters up my buffers, and I'd just like that buffer to be killed off not just after a commit but whenever magit is done with it and empties it out like this.

This question is similar to How to kill ediff's buffers on quit?, only the accepted answer there (to use the ediff-quit-hook) won't work here because there's no corresponding magit-diff-quit-hook, as far as I can see.

Any help is greatly appreciated.


texts:
When running clang-format-buffer or clang-format-region when a region has been been selected, no change is made to the formatting. However, in *Messages*, I see (clang-format: success). Using clang-format in the terminal works fine, and the emacs package clang-format is configured to point towards the correct location where clang-format is installed.

These are the only lines I have in my init.el related to clang-format (I've also tried all variations of setting / not setting clang-format-style and clang-format-style-option):

;; Clang stuff
(require 'clang-format)
(setq clang-format-style "file")

Is there something I'm missing?


texts:
I want to open a.html in a browser from emacs (v. 24.5.1, using -Q [updated after comment]).

M-x shell-command
xdg-open a.html

works as expected, but

M-x eshell
$ xdg-open a.html

does not seem to do anything. There is no error message. This problem also occurs when exporting and directly opening html files from org-mode.


texts: Some themes make my font multiple sizes. How can I disable this?

texts: I like the colors from these beautiful themes, but I wish I could disable the font resizing.


texts: How do I create a simple syntax table for a major mode?

texts:
I'm trying to understand how syntax tables work, but my minimal major mode doesn't highlight anything.

I've written the following elisp, which is just supposed to highlight comments:

(defconst my-yaml-mode-syntax-table
  (let ((table (make-syntax-table)))
    (modify-syntax-entry ?# "<" table)
    (modify-syntax-entry ?\n ">" table)
    table)
  "Syntax table for `my-yaml-mode'.")

(define-derived-mode my-yaml-mode fundamental-mode "My YAML"
  "testing"
  :syntax-table my-yaml-mode-syntax-table)

However, given a file:

# foo
# bar
baz

If I activate my major-mode with M-x my-yaml-mode, I don't get any highlighting. C-u C-x = shows that no faces have been applied.


texts: Is there a library or something for org-mode that let's me make traversal more VIM like, without fully using Evil?

texts: I'd like to navigate in my org-mode files sometimes using just the home row, but other times I'm perfectly ok with the full emacs default key-bindings for org-mode.  For instance, when everything is folded, I'd like to just use j or k for up and down since I only want to navigate up to the correct headline to tab it open.  I realize I could just do a ace-jump, or search, or something, but I'm curious if there already exists something that makes this VIM like navigation possible?  Also, I don't think I'm ready to go full evil-mode yet.


texts: Controling what an org-link points to with variables

texts:
Let's say I have the following:

#+NAME: output-directory
/path/to/output/directory

Results can be found [[file+emacs:/path/to/output/directory][here]].

Is there a way for me to have an org link to the output directory based on whatever the value of the output-directory variable? Something in the lines of:

#+NAME: output-directory
/path/to/output/directory/

Results can be found [[file+emacs:output-directory][here]].


texts: How do I create a command that searches a specific directory?

texts:
I would like to create a command (C-s C-k or something?) that searches a specific directory every time I call it. It would search files within that directory for a string (may contain spaces) and then present me with a list of results and allow me to jump to said file/result.

I am trying to create a knowledge base of sorts using org files in a directory.

I am currently using a spacemacs setup with a few extra org-mode bits.


texts: Use emacs syntax coloring when not in emacs

texts:
Emacs in -nw mode colors source code files, in this screenshot you see how emacs colors the .rb file I opened.
Over the weeks/months I've gotten used to the coloring.

Despite how hard I try, there always comes a time when I'm
not in emacs, and I'm doing a cat in the Terminal.app bash shell.
So much like you can pipe a compact block of json to get nicely
indented json, is it possible to pipe a .rb file to some scripts that runs Emacs and extracts the syntax coloring that Emacs uses?


texts:
Every time I open emacs I run the following set of commands:

M-X
load-theme
danneskjold

I wanted to set things up so this happens automatically

I put the following things ~/emacs.d/init.el file

(package-initialize)
(load-theme 'danneskjold t)

I get the following error message:

Warning (initialization): An error occurred while loading ...init.el

Symbol's function definition is void: package-initialize

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

Also tried the following in init.el file

(load-theme 'danneskjold t)

Get a different error message:

Wrong number of arguments: #[(theme) ^H\211^X   >)\203^_^@\304^H!\210\305^H\306\307#\210\305^H\310\307#\210\305^H\311\307#\210\312!\203+^@^KB\202,^@^K^[\313\314\315^H!!!)\207
[theme custom-known-themes custom-theme-directory load-path disable-theme put theme-settings nil theme-feature theme-documentation file-directory-p load symbol-name custom-make-theme-feature] 5 1722891 SCustom theme name: ], 2

Not really sure what all the symbols are supposed to mean, is there something else going wrong with my emacs?


texts: How to dynamically alter defface foreground and background?

texts:
In realgud, there are fringe indicators used to show what position the debugged program is stopped at. However the face for the bit map is statically created and the background/foreground colors for it are set once when the lisp code is loaded, or run. Specifically:

(if (equal 'dark (frame-parameter nil 'background-mode))
    (progn
      (defface realgud-overlay-arrow1
        '((t
           :foreground "green"
           :weight bold))
        "Fringe face for current position."
        :group 'realgud)
      ;; ...
      )
  ;; else
  (progn
    (defface realgud-overlay-arrow1
      '((t
         :foreground "black"
         :weight bold)))
    ;; ...
    ))

This has a problem that when a frame's background parameters are changed, this doesn't track that. It could also be the situation that realgud was loaded say either from a frame or when emacs had a different dark/light background parameter than the one which a debugger is currently stopped at.

So how does one fix this?

Alternatively, it might be good to ditch the fringe setting altogether, but if that's done there should be a solution that works in a terminal without bitmap capabilities.

Edit:

It also occurs to me that since this property is available under list-faces-display, maybe the right thing is not to change this and wait for realgud to become popular enough for various theme authors to decide to explicitly set that. Alternatively, I could set the colors based on some other more popular face setting, but I don't see something in list-faces-display that sticks out. Thoughts here?


texts:
I would like to be able to easily select a region of text from Emacs and then paste it into another app or browser - with all the extra fill-paragraph newlines removed so that the paragraph display in the other app can work properly.

The unfill-region function in the unfill package seems fine for this, but further work is needed to automate this properly. Before I do that, does this already exist?


texts:
When I'm writing in org-mode I want it to automatically handle the creation of new lines similar to MS Word.

Can anyone recommend an .emacs config that will only apply to org-mode?


texts: ein extension causing a cycle of Fundamental and Python mode between input and output cells causing emacs linum mode to go bonkers. Any fixes available!


texts: How to suppress the save buffer message in the minibuffer in Doom Emacs? (using Emacs 27)

texts:
I'm using the super-save package which saves the buffer when an Emacs frame loses focus and it's spamming the minibuffer with 'file written' messages, which gets distracting.
I want to suppress this message in the minibuffer, so it doesn't appear anymore. I've tried to come up with solutions from this answer but I couldn't get it working. The answers also seem to be quite old, which makes me wonder about a more modern solution.
It would be nice if someone could point me in the right direction, specifically for the Doom Emacs distribution using Emacs 27.


texts: How do I disable savehist-autosave in emacs?

texts:
Because my emacs editor has become completely unreliable / unusable due to the frequent freezes - I'd like to disable this. But I can't figure out how?

The actual issue is described by myself and others here: https://github.com/syl20bnr/spacemacs/issues/9409

When I tried searching for this online:

This page offers no solution: https://www.gnu.org/software/emacs/manual/html_node/efaq/Disabling-auto_002dsave_002dmode.html

It only directs you to https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Save.html#Auto-Save which also has no solution


texts: "Symbol's function definition is void: cl-macroexpand-all" when trying to install php-mode

texts:
I'm trying to install php-mode, but I keep encountering this error when I run M-x php-mode:

Symbol's function definition is void: cl-macroexpand-all

The error persists whether I install php-mode via MELPA or manually.

Environment: Emacs 24.3.94.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21)
 of 2014-10-04 on builder10-9.porkrind.org

Why won't php-mode run? Note: I'm relatively new to Emacs, and inexperienced.


texts:
If I have 3 windows beside each other, can I switch to any one of them
without having to look for the cursor first (so I know whether to press
C-x o once or twice)?

Is there, for example, or could I easily write, a function that jumped to
the PREFIXth window from the left?


texts: Pasting Text from Clipboard - why ^M instead of linebreaks?

texts:
I'm using some VBA scripts which copy Text in MS Outlook from an e-mail message and send it to the clipboard.

If I then paste the clipboard content with Ctrl-Y in Emacs 24.5.1 in Windows 7, the linebreaks are missing and I see a red ^M instead in my emacs buffer.

What can I do to directly insert linebreaks or convert the text in emacs to the "normal" encoding?

My current settings in my .emacs file are

;; file encoding utf-8 preferred
(prefer-coding-system 'utf-8)
(setq coding-system-for-read 'utf-8)
(setq coding-system-for-write 'utf-8)

However: If I copy a text from an e-Mail in MS Outlook to the Clipboard with Ctrl-C and paste it in an emacs-buffer with Ctrl-Y, the linebreaks are ok.


texts: list files in directory in reverse order of date

texts: When finding files with Ctrl-x Ctrl-f and then pressing Tab, to list the file completion names, is there a way to list these files in reverse order of their dates (when they were last edited)? Currently emacs lists them alphabetically. Is there a way of having the following two options: pressing Ctrl-x Ctrl-f Tab lists the files in alphabetical order, pressing Ctrl-x Ctrl-f space lists them in reverse order of dates?


texts:
I try to create FTP connection via Tramp, but the output I get on AngeFTP is:
ftp> open android.local
ftp: Can't connect to `192.168.0.21:21': Connection refused
ftp: Can't connect to `android.local:ftp'
ftp>

I have tried many different options, but nothing works. SFTP works fine, but I can't get FTP working. Here is my config:
/etc/hosts
192.168.0.21 android.local

~/.netrc
machine android.local
    login foo
    password foo
    port 2221

init.el
(set-register ?a (cons 'file "/ftp:foo@android.local:#2221:/storage/0123-4567"))

Any ideas?

EDIT:
I was able to connect via ftp client from the terminal (outside Tramp) with the command ftp ftp://foo:foo@192.168.0.21:2221, but can't replicate that via Tramp.


texts: Interpolate nil argument to `format` as the empty string?

texts:
I understand that this is trivial with an if, but is there an option, like %S or %s that interpolates nil as no string at all?

Example:

(format "%?.el" nil) ; ".el"
(format "%?.el" "beginner") ; "beginner.el"


texts: How to cancel the minibuffer from the main buffer

texts:
Suppose that I do M-x blabla without pressing return and then I switch to the main buffer. If the curser is at minibuffer I can cancel the mini-buffer by the shortcut C-g. But if the cursor is at the main buffer, this shortcut doesn't cancel the minibuffer. If I press M-x the error Command attempted to use minibuffer while in minibuffer appears.

Is there a build-in shorcut that completely cancels the previously non-completed contents of the minibuffer since the main buffer.


texts: org-capture Template expansion leading whitespace: bug, feature, workaround

texts:
Emacs 26.1
org-mode: 9.1.9

I have an issue with the way org-capture expands a template when it comes to line beginnings:

This template

(setq org-capture-templates
 '(("o" "Todo" entry (file+headline "~/org/experimental.org" "Tasks")
        "* TODO %^{One}\nBeginning-of-line-Text\n<-- There should be no whitespace -->%^{Two}\n** %^{Three}\n- %^{Four}")))

Expands to this:

* Tasks
** TODO One
 Beginning-of-line-Text
 <-- There should be no whitespace -->Two
*** Three
 - Four

The crucial issue are the lines that start with a space / whitespace / indentation (the lines 3, 4 and 6). It seems that C-c C-c inserts only at the beginning of lines a space as it does not add a space before "-->Two". Furthermore \n** Three was expanded as expected (see line 5: *** Three) I think this is not a bug but for some reason the intended behaviour . Yet I would like the template to expand more "literally", meaning the expression following directly after \n should always start at the beginning of the next line.
Any help is highly appreciated.


texts: How to get a fully functional Julia REPL in emacs?

texts:
Some people like me prefer to keep as much as possible in one emacs window (it saves screen retail), so want to run Julia as an inferior shell in emacs. The "run-julia" command that comes with the emacs Julia packages is inferior to running Julia in a terminal emulator; most obviously, ";" for shell commands and "?" for help don't work.

So the question becomes: How can you get a fully functional Julia REPL in emacs?

Note that it doesn't work to run julia directly in term because as anyone who tries this will see, there are crippling bugs that make it unusable. Running it in any other shell gives you the same limited features as run-julia.


texts: How to find out which package a command belongs to

texts: I have found a command M-x project-find-regexp, how can I find out from where it comes from, ELPA/Melpa package or part of GNU/Emacs?


texts: Function to find a file or open a URL depending on argument?

texts:
Q: in there a function that can find a file or open a URL as needed?

I have a string that can be either a) a local filename, or b) a
URL.  Is there an existing function that I can call on the string
that will do what I mean and open the file if it's a file, or open
the URL in a browser if it's a URL?

It wouldn't be hard to write such a function, but I'd rather
not reinvent the wheel.


texts: About the environmental variables on different systems

texts:
I've a problem with this statement:

(setq org-mobile-directory "~/Dropbox/MobileOrg")

It works in Linux (and maybe in OSX too), because the tilde is expanded in /home/<me>/Dropbox/MobileOrg. It doesn't in Windows, because emacs expand the tilde into C:\Users\<me>\AppData\Roaming\ while Dropbox refers to the %USERPROFILE% environmental variable, which is expanded into C:\Users\<me>\.

I already know I can use two different files depending to the OS, or introduce a condition. But I'm wondering if I can somehow avail of some variable I did not take in consideration. Any clue?

Thanks in advance.


texts:
Description

I use org-capture extension which had been working great for about 6 months.

I have trouble making org-protocol work from Firefox since 8/1/19. When hitting the extension button in FF, the page is captured (I got a gray background with "captured" message) but nothing happens in Emacs. This used to work fine until then.

I run Emacs 27.0.50 on Ubuntu
16.04 with org-mode 9.2.5 (and Firefox 68.0.1).

Diagnosis

My org-protocol config in init:

(require 'org-protocol) ; call for org-protocol
(server-start)
(add-to-list 'load-path "~/.local/share/applications/org-protocol.desktop/") ;path to org-protocol

My org-protocol.desktop file is set and mimeinfo.cache is up to date.

My org-capture-templates have not been edited and other templates (not called through the FF
extension) work fine. The templates used by org-protocol are:

("L" "Web link" entry (file+headline org-default-notes-file "Web")
 "** [%:description]%? \nSource: [[%:link][%:description]] \nCaptured: %U")
("p" "Web quote" entry (file+headline org-default-notes-file "Web")
 "** [%:description]%? \nSource: [[%:link][%:description]] \nCaptured: %U \n#+BEGIN_QUOTE\n%i\n#+END_QUOTE")

The FF extension runs well and sends capture instructions (the grey background ie 2nd snapshot
on org-capture extension) according to FF console:

[1]

Capturing the following URI with new org-protocol:  org-protocol://capture?template=p&url=http%3A%2F%2Fwww.mediaonfire.com%2Fblog%2F2017_07_21_org_protocol_firefox.html&title=Firefox%20and%20org-protocol%20URL%20Capture&body=emacsclient%20-n%20%22org-protocol%3A%2F%2F%2Fcapture%3Furl%3Dhttp%253a%252f%252fduckduckgo%252ecom%26title%3DDuckDuckGo%22

Org-protocol executes neatly on my other latptop running Emacs 24 (from Ubuntu repo) with similar
config.
Conclusion

I'm having a hard time trying to understand what the problem is. I found some inspiration on this page and tried to run the test suggested. Adapted to my config, the test is:

[2]

emacs-snapshot "org-protocol://capture?template=p&url=http%3A%2F%2Fwww.mediaonfire.com%2Fblog%2F2017_07_21_org_protocol_firefox.html&title=Firefox%20and%20org-protocol%20URL%20Capture&body=emacsclient%20-n%20%22org-protocol%3A%2F%2F%2Fcapture%3Furl%3Dhttp%253a%252f%252fduckduckgo%252ecom%26title%3DDuckDuckGo%22"

with [1] object.

When Emacs is closed, a
frame opens with an empty buffer with mini-buffer saying file is write protected.

I think this test drives me in the right direction to solve my problem but maybe this has nothing to
do with that.


texts: Make siunitx.el automatically recognize values and unit of unformatted text

texts:
I use siunitx to typeset units in LaTeX. This is quite painless when typesetting it directly because of Emacs's siunitx.el (see below).

However, sometimes I copy exercises or solutions containing units from the Web or other sources which are not formatted.

So I paste something like 50 m, 50m/s, 1.2 m or 1,2 m (german comma) into a file in Emacs. Now I want to be able to mark this, type C-c C-m \SI and make Emacs automatically recognize units and transform them to \SI{50}{m}, \SI{50}{m\per s}, \SI{1,2}{m} and so on.

Any ideas how to modify siunitx.el to achieve this?

;;; siunitx.el --- AUCTeX style file for Siunitx
(TeX-add-style-hook "siunitx"
              (function
               (lambda ()
             (TeX-add-symbols
              '("SI"       "Value" "Unit")
                      '("ang"      "Angle")
              ))))


texts:
I've had my emacs (v. 25.1.1) working with elpy (1.13) under Python 2.7 for a while.  I decided to switch to Python 3 recently, and cannot get it to interact with emacs properly.  Normally, when I want to run a script in emacs I C-c C-c, which opens an ipython interpreter.  Since switching to Python3, the ipython interpreter still opens, but with problems.

I get the following backtrace error:

.

Debugger entered--Lisp error: (args-out-of-range "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06)
Type \"copyright\", \"credits\" or \"license\" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

[6n[0m
[0m[J
" 427)
  string-match("" "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n?         -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp      -> Python's own help system.\nobject?   -> Details about 'object', use 'object??' for extra details.\n\n[6n[0m
[0m[J
" 427)
  ansi-color-filter-apply("Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n?         -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp      -> Python's own help system.\nobject?   -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
[0m[J
[?12l[?25h")
  python-shell-comint-watch-for-first-prompt-output-filter("Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n?         -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp      -> Python's own help system.\nobject?   -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
[0m[J
[?12l[?25h")
  run-hook-with-args(python-shell-comint-watch-for-first-prompt-output-filter "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n?         -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp      -> Python's own help system.\nobject?   -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
[0m[J
[?12l[?25h")
  comint-output-filter(#<process Python> "Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul  2 2016, 17:53:06) \nType \"copyright\", \"credits\" or \"license\" for more information.\n\nIPython 5.1.0 -- An enhanced Interactive Python.\n?         -> Introduction and overview of IPython's features.\n%quickref -> Quick reference.\nhelp      -> Python's own help system.\nobject?   -> Details about 'object', use 'object??' for extra details.\n\n[?1l[6n[?2004h[?25l[?7l[0m
[0m[J
[?12l[?25h")

The ipython interpreter looks "funky" as well.  Normally, line numbers would show up as:

.

In  [1]: 7/9

Out [1]: 0.77777777777777778

In  [2]:

However, I get something like this:

[6n[JIn [2]: [8D[8C7/9

[8D[JIn [2]: 7/9[11D

[JOut[2]: 0.7777777777777778

[6n[JIn [3]: [8D[8C

For the life of me I cannot figure out why the ipython interpreter is so hosed.  Any help will be appreciated.


texts: spacemacs keys to move up or down org-mode need to be remapped

texts:
I use spacemacs version 0.200.9, and I totally love it. One issue that I have though is when using org-mode. I can't seem to move different levels of the hierarchy up and down as I used to be able to do with the Alt-up or Alt-down key like I used to. I also use the i3wm windows manager, so I think that that these two Alt keys are mapped to the windows manager instead of to emacs.

In spacemacs these shortcuts to move subtree up and down are defined below.

SPC m S l   org-demote-subtree
SPC m S h   org-promote-subtree
SPC m S k   org-move-subtree-up
SPC m S j   org-move-subtree-down

However for some reason these do not seem to work for me either.

So I suppose I need to directly define the keymapping for these 4 features. But I was not sure of the proper way to do that.

I found this issue posted on the spacemacs site.

https://github.com/syl20bnr/spacemacs/issues/3018

I added the following code to my .spacemacs file, but it did not work

  (evil-define-key 'normal evil-org-mode-map
    "SPC o i" 'org-move-subtree-up
    "SPC o m" 'org-move-subtree-down
    "SPC o j" 'org-promote-subtree
    "SPC o k" 'org-demote-subtree)

Can anyone indicate where the error is, or why I can't seem to get org-mode to move org-mode subtrees up or down? Any help would be appreciated.


texts:
So I'm following this guide and when I go to M-x package-list-packages there is no auto-complete in the directory.

; start pacakage.el with emacs
(require 'package)
; add Melpa to repository list
(add-to-list 'package-archives '("melpa", "http://melpa.milkbox.net/packages/"))
; initialise package.el
(package-initialize)

This is my ~/.emacs file.


texts: How to add a column in org-mode agenda clockreport to show percentage of time for each group of activities?

texts:
I have been using Bernt Hansen's org-mode setup (http://doc.norang.ca/org-mode.html - modified slightly to my needs) for some time and I came up with a question that I cannot solve.

I would like to add a colunn to my clock table report showing the percentage of each group of activities. The attached is an example of a typical clock table report. I would like to add a column next to Time showing the percentage of time spent in nonValueAdded.org (i.e., 16.59=100*(1:13/7:20)), service.org, teaching.org.

After reading Use formula in agenda clockreport to convert time? (pomodoro count in Agenda), I tried adding :formula "$4=(%CLOCKSUM/%CLOCKSUM_T)*(100);t" as below

(setq org-agenda-clockreport-parameter-plist
  (quote (:link t :maxlevel 5 :fileskip0 t :compact t :narrow 80 :formula "$4=(%CLOCKSUM/%CLOCKSUM_T)*(100);t")))

but it was not successful.

I appreciate any help on this.

Best,


texts: Are there any advantages to using ~/.emacs.d/init.el instead of ~/.emacs?

texts: I've normally used ~/.emacs for my config file, but I've noticed others using ~/.emacs.d/init.el. Are there advantages to the init.el location? Any disadvantages?


texts: Is there a command in emacs similar to `find` in findutils?

texts:
In emacs, the command M-x grep runs grep program.

Is there a command in emacs for running find in findutils, or do similar thing?

Thanks.


texts: I'm using package goto-chg to move cursor to the last edit.  It works great most of the time, but it sometimes said "No further change info" even though there were more changes.  Using undo-tree's visualizer, I found that the problem usually occurs when there is a branch point.  Is there any way to fix it?  Or is there any better package?


texts: Enable Emacs to suggest the available methods of a class

texts:
I have setup Emacs to work almost like an IDE but I haven't managed to make it suggest the available methods of every class.

I currently write in C++ and previously I was using Visual Studio so when I was pressing the dot it would suggest to me the available methods.

As the methods most of the times are countless this is a very important feature for me but I have yet to find how to implement it.

I believe that this is a problem of every person writing code so I can only guess that there is surely a package for Emacs to offer this functionality. Can someone suggest any?


texts: How to detect the key binding for a function in elisp?

texts:
How would I go about getting the key binding for a function in elisp?

I'd like to know which key is used to quit. e.g. keyboard-quit.

I tried using the function used by help functionality but it's not working.

(require 'help-fns)
(message "%S" (help-fns--key-bindings (quote keyboard-quit)))

However I get the error Symbol’s value as variable is void: keyboard-quit


texts: how to make "old" articles behave as "new" in gnus?

texts:
I am using gnus to read mailing lists from an imap account. For some reason some (really) new messages are marked by Gnus as ancient, i.e. with O, they appear in the summary buffer together with the rest of the new messages when I enter a group first time, but they will disappear once I leave the group. Also the navigation commands, e.g. next-article, skip them.

Which settings control the expiration and navigation on such things?

I solved it partially by setting gnus-summary-goto-unread to (quote never) in emacs customization. Now the navigation commands go to any next article in the summary. But the question how to not let them expire is still open.


texts:
I would like the ability to go back and forth through a series of stored recent cursor positions, say up to 100 of them. Specifically, a position should be recorded when I click somewhere, or when I do a find operation that causes me to jump to a different location in the file. Ideally, I would be able to go back to the previous stored position, then back forward again through the list of positions, if I choose to do so.

Is there some preexisting way to do this? Alternatively, is there a relatively easy way to design a function to do this? Say, to set hooks for a cursor position change, then update some global array when such a hook is activated?

I don't care whether positions are stored per-buffer or per-window or per-frame (although per-buffer would probably be better).

exchange-point-and-mark sort of does this (after a find operation; doesn't pay attention to mouse click position), on a much smaller scale.


texts: Evil Surround - Symbol's value as variable is void

texts:
When I execute cs<old-text-object><new-text-object> (i.e. any cs or ds action) I get the following error. Anyone know how to resolve this or at least suggestions on debugging it?

  evil-motion-range: Symbol’s value as variable is void:
  syntax-ppss-last

I've installed Evil and Evil Surround via

(use-package evil
  :ensure t
  :init
  (evil-mode t)
  :config
  (evil-set-initial-state 'term-mode 'emacs)
  (define-key evil-normal-state-map (kbd "C-d") 'evil-scroll-down)
  (define-key evil-visual-state-map (kbd "C-d") 'evil-scroll-down)
  (define-key evil-normal-state-map (kbd "C-u") 'evil-scroll-up)
  (define-key evil-visual-state-map (kbd "C-u") 'evil-scroll-up)
  (define-key evil-insert-state-map (kbd "C-u")
    (lambda ()
      (interactive)
      (evil-delete (point-at-bol) (point)))))

(use-package evil-surround
  :ensure t
  :config
  (global-evil-surround-mode 1))


texts:
In an Org-mode document, let's imagine that my entries are following this pattern:

* TODO Note page 2 [0/1]
  my notes, must be at second position after sorting
  - [ ] todo 1

* Note page 14                                                        :A_Tag:
  my notes, must be at third position after sorting

* Note page 1
  my notes, must be at first position after sorting

Question: how to sort these entries according to page number?

Expected result is:

* Note page 1
  my notes, must be at first position after sorting

* TODO Note page 2 [0/1]
  my notes, must be at second position after sorting
  - [ ] todo 1

* Note page 14                                                        :A_Tag:
  my notes, must be at third position after sorting

I know the function org-sort-entries but AFAIK we can not use it with default options. We must define that the sort must be performed according to a pattern like

^* <ignore TODO> Note page [Number] <ignore tag list>$

For instance, if I use org-sort-entries + [a] I get:

* Note page 1
  my notes, must be at first position after sorting

* Note page 14                                                        :A_Tag:
  my notes, must be at second position after sorting

* TODO Note page 2 [0/1]
  my notes, must be at third position after sorting
  - [ ] todo 1

I get an alphabetically sorted output, however, this is not what I want to do. What is the right way to do that?

----- update

with your function org-page-sort I get:

* Note page 1
  my notes, must be at first position after sorting* TODO Note page 2 [0/1]
  my notes, must be at second position after sorting
  - [ ] todo 1

* Note page 14                                                        :A_Tag:
  my notes, must be at third position after sorting

maybe a little bug. However, I do not see where is the problem as your function prints

looking at page Note page 2 [0/1]
looking at page Note page 14
looking at page Note page 1

as expected.

Anyway thank you very much (I upvoted your answer), this is the kind of solution I was looking for!


texts: ELDoc and company-tern are not working properly in JS2-mode (.js buffer in node) and Javascript, in Emacs

texts:
In my Emacs configuration for JavaScript/ JS2-mode, specifically .js buffer in node:

(1) company-tern and  ELDoc are NOT working properly.

For eg. when I type 'console.l', 'log' does not pop up, rather 'let' alone pops up

(2) When opening the buffer, a message pop ups, "There is no ELDoc support in this buffer"

My key Emacs configurations, for this:

Company:

(use-package company
  :ensure t
  :config (global-company-mode t)
  (progn
    (setq company-idle-delay 0)
    (setq company-minimum-prefix-length 1)
    (setq company-etags-everywhere '(html-mode web-mode js-mode js2-mode nxml-mode))

tern:

(use-package tern
  :ensure t
  :config
  (progn
    (autoload 'tern-mode "tern.el" nil t)
    (add-hook 'js-mode-hook (lambda () (tern-mode t)))
    (add-hook 'js2-mode-hook (lambda () (tern-mode t)))))

company-tern:

(use-package company-tern
  :ensure t
  :config
    (with-eval-after-load 'company 'tern
      '(add-to-list 'company-backends 'company-tern)))

ELDoc:

(global-eldoc-mode 1)
(add-hook 'js2-mode-hook 'eldoc-mode)
(add-hook 'js-mode-hook 'eldoc-mode)

Can some one help me to sort out what I am doing wrong?


texts: How to keep current time balance in org-mode's clock table

texts:
I currently have my clocktable defined as

#+BEGIN: clocktable :maxlevel 4 :scope file :tags "RESIM|DOAS|GENIUP|NOIUP" :block 2016 :step week :stepskip0 :emphasize nil

The output looks like this:

| Headline                 |    Time |       |
|--------------------------+---------+-------|
| *Total time*             | *34:54* |       |
|--------------------------+---------+-------|
| Work for the RESIM group |    3:56 |       |
| \_  Homeoffice           |         |  1:06 |
| Work for the DOAS group  |    7:02 |       |
| \_  Homeoffice           |         |  0:10 |
| General work for IUP     |    0:26 |       |
| \_  Homeoffice           |         |  0:10 |
| Not at IUP               |   23:30 |       |
| \_  Sick leave           |         | 23:30 |

I would like to add two columns to this table.

The first column should have some string entry in the first row (next to
time), and in the second row (Total time) it should show me the hours I
am supposed to have worked this week until today, i.e., a fixed amount of
hours (7:10 in my case) multiplied with the number of days since (and
including) Monday. So if today is Monday, it should read 7:10, if today is
Tuesday, it should read 14:20, and so on.
The second new column should again have some string in the Headline, and in
the Total time row, it should show the difference (in hours) between the
total time worked and the time I should have worked (see previous column).
As a bonus, a third column could show the sum of all these Balance columns
for the current year.

I'm rather new to Elisp, so have not really any idea how to start - which means
any suggestions are greatly appreciated ;)


texts:
Sometimes, i wish to mark all code in a file as comments. I tried putting all code between the markups #|| and #||. On file loading, emacs threw the error,

Invalid read syntax: #

I can't use #+nil, because the file has multiple statements and not a single function. Is there a way to comment?


texts: Org repeated task doesn't repeat when DONE

texts:
Following the documentation, I set to DONE a repeated task with C-- 1 C-c C-t but this actually closes the task definitevely.

** TODO Things
   DEADLINE: <2016-01-17 Sun +1m>

After typing C-- 1 C-c C-t :

** DONE Things
   DEADLINE: <2016-01-17 Sun +0m>

I noticed that the key sequence seems not to be captured like desired :
I type C-- and emacs prompt C-- at the bottom of the window, and after typing 1 the keysequence change to C- kp-1- so maybe that is the problem.

And if it is, I don't know how to change this behaviour.

Thank you


texts: What is wrong with this keyboard macro ?

texts:
I would like to accomplish following

Set mark
Advance to end of sentence
Copy selection -> macro start here
Open journal using ^c c
Paste copied item
Save using C-x C-s
Exit using C-c C-c
Revert to the buffer from which the word was copied

I recorded this macro. But it fails to work. Kindly help

(fset 'pt
   "\C-ccj\C-v\C-x \C-s \C-c\C-c")


texts: Push only part of the history with magit

texts:
I’m creating a big feature in one of our projects, that is close to around 20 commits in my local repository. Most of them are still subject to change with rebasing, but I’d like to push the first few stable ones for review already.

In the command line, I’d do

git push origin affec75:master

(given that affec75 is a commit somewhere in my local history.)

I tried P r (explicit refspecs), specifying origin as the remote and affec75 as the refspec, but it failed. As the generated command is git push origin affec75, I tried setting affec75:master as the refspec; it succeeds, but it’s a real pain to type. Is there a shorter way to do this?


texts:
initiating treemac is giving this error. I just don't understand all the errors that emacs throws up.
I just have
(require 'treemacs) in init file.

version-to-list: Invalid version syntax: ‘'"'where' is not recognized as an internal or external command,"' is not recognized as an internal or external command,
operable program or batch file.’ (must start with a number)


texts: Fixing forced indentation in shell-script-mode for tcsh

texts:
How do you configure the indentation to work correctly for tcsh shell scripts?

I am unable to make the indentation work correctly when I use the shell-script-mode as it is.

Problem: An indentation of 4 spaces is inserted when I hit enter (when there shouldn't be any indentation!)

How to reproduce this problem?

Open \emacs -q&
Type #!/bin/tcsh -f in an empty buffer and save it as something like a.csh so that the shell-script-mode is auto-loaded.

When you hit enter at the end of this first and only line, the buffer converts from

#!/bin/tcsh -f (no indentation)

to

    #!/bin/tcsh -f (with indentation)

I am on the stable 24.4 version of emacs.


texts: Change which buffers are in which windows?

texts:
I have 3 windows opened and I want to change which buffers they display.

For example: when programming in C, I want to have the C code on the left, and the right side split into two windows showing gdb and the locals variables.  If I open them in order, Emacs puts the buffers in a layout I'm not comfortable with.

How can I arrange which buffers are in which windows?  Can I do it without using non-built-in packages?


texts:
On a fresh install of Emacs 27, I'm getting an Invalid function: dbus-ignore-errors error when trying to run M-x texinfo-mode.
I've tried using alternate extensions for the file (like ".texi" or ".texinfo") and function declaration at the top of file, but it seems to result in the same error.
This is the first time I've seen this error, so any troubleshooting tips would be appreciated.


texts: Is there a way for ediff to compare SVN changes in the head to my local copy?

texts:
My company uses SVN, and one of the things I often want to do is compare the differences that someone else checked in without doing an update.  For example, if I see someone has committed a new version of foo.pl, and I want to compare what is in the HEAD compared to my local foo.pl, I could do this:

svn diff -r BASE:HEAD foo.pl

is there a vc-command that already does this?  I imagine if there was a way to load a buffer with the contents of BASE:HEAD foo.pl, then I could use ediff to compare the two buffers...


texts: How to configure org-mode properly after upgrading from 7.9.3

texts:
On the orgmode site it says that if you upgrade from org-mode v.7.9.4f to v.8+:

  You must search your configuration for the existence of varaibles starting with org-export- and change their names (e.g. org-export-html-validation-link is now org-html-validation-link).

My question is, how do I do that? If I do a C-h v and look for org-export-, I do see a long list of variables with names that apparently need changing. What do I do next?


texts: how to disable command-h hide in Emacs Mac Port (railwaycat)?

texts:
I run Emacs on Mac OSX, I'm trying to switch from Emacs for Mac OSX to Emacs Mac Port. I'm having some trouble with my keybindings.

For example, I'm trying to bind command-h to replace-string.

(setq mac-command-modifier 'super)
(define-key key-minor-mode-map (kbd "s-h") 'replace-string)

This didn't work. So I tried binding it as hyper:

(define-hyper-key "h" 'replace-string)

but that didn't work either.

Changing other keybindings does seem to work (s-o, s-p, etc).

This may be related: How to bind "Hide Others" to a key "M-s-h" in railwaycat/emacs-mac-port?

command-h for replace-string works on Emacs for Mac OSX, but on Emacs Mac Port, it just hides/minimizes the application window. Do keybindings work differently in Emacs Mac Port than they do on Emacs for Mac OSX? Are some keybindings hardcoded in to Emacs Mac Port, and if so, how can I override them?

Update: Looks like others are having the same issue. https://github.com/railwaycat/emacs-mac-port/issues/78


texts: How to format reference to an internal link in a nested list?

texts:
I am using CSS to adjust the numbering of a nested list in HTML exported from Org. However, I've run into a problem when I use a link back to an item in the enumerated list.
As an example, the org file is:
1. item 1
   1. <<target>> subitem 1a
   2. subitem 1b
2. item 2
   1. subitem 2a refers to some text above [[target]]. Targets are a built-in feature of org
   2. subitem 2b

This produces the desired HTML output in terms of the numbering of the nested list: 1, 1a, 1b, 2, 2a, 2b when I include the following CSS (as described here):
#+HTML_HEAD: <style type="text/css">
#+HTML_HEAD:  ol ol { list-style-type: lower-alpha; }
#+HTML_HEAD: </style>

The problem is that [[target]] is replaced with 1.1 in HTML. I want the reference to reflect the CSS-dictated 1a label.
Any thoughts on how to fix that?
Reference: the use of <<>> [[]] is described in the org manual under Internal Links.


texts:
According to the Magit manual the combination C-x g (magit-status) shows

  the status of the current Git repository in a buffer.

How can I view what the current Git repository is, i.e. the full path to it or alternatively the path relative to my home directory?


texts:
I started having some problems with org mode after upgrading my melpa packages. One of the problems is described in this question.

I'd like to simply downgrade to my previous version of org-mode until these issues are resolved. Is there a way to do this?

For the record, issuing M-x org-version returns

Org-mode version 8.3.3 (8.3.3-26-ge92a06-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20160125/)

Also, I'm using Emacs 24.3.1 on Ubuntu 14.04.


texts: How to pass `C-u` to `helm-M-x` in `ansi-term` buffer?

texts:
In ansi-term buffer, I try to run a command with C-u through helm-M-x. But it seems doesn't work.

Here's the key sequence I have tried:

`C-x M-x <type the cmd> C-u <RET>

But it seems the command does not run the way it should with C-u.


texts: Function to allow select a directory and run a command on its files, descending recursively?

texts: I sometimes work on legacy code, and they have mixture of tabs and spaces. I use whitespace-cleanup function in whitespace.el to clean them up. But I have many files, so i want to run the command on all of them (excluding the .git directory). What is the implementation of this recursive function call in elisp? My seasonal elisp skill does not let me do it right away.


texts: Clojure nrepl: 'cider-jack-in returns error: "Spawning child process: Invalid argument"

texts:
Running GNUEmacs 26.3 on Windows 10, trying to set up environment per instructions for 'Clojure for the Brave and True' from here:

https://github.com/flyingmachine/emacs-for-clojure/

I was able to get the packages built and such, looks like it behaves ok.  However, when I start a lein repl in the directory and call M-x cider-jack-in, I get:

Spawning child process: Invalid argument

Not sure where to go from here.


texts: How do I access a package's info manual?

texts:
I installed magit, and it appears to have come with documentation I can access in info-mode:

> cd ~/emacs.d/elpa
> ls -1 magit-2.8.0/{dir,*.info*}
magit-2.8.0/dir
magit-2.8.0/magit.info
magit-2.8.0/magit.info-1
magit-2.8.0/magit.info-2

But when I run info in emacs, I don't see any entry for Magit in the directory. I've also tried running info-apropos to search for magit, and found nothing. What do I need to do to get it to show up?

I'm using use-package, if that's significant:

(use-package magit
  :load-path ("elpa/magit-2.8.0"
              "elpa/with-editor-2.5.2"
              "elpa/git-commit-2.8.0"
              "elpa/magit-popup-2.8.0")
  :config
  (setq vc-handled-backends (delq 'Git vc-handled-backends)))

I'm also using the newest version of Emacs I could find, GNU Emacs 25.1.1

However, I've intentionally avoided calling package-initialize in my init.el except as needed (e.g. when installing new packages), which is why I'm specifying a load-path in the use-package declaration above. Maybe that's related; I'm pretty sure package-initialize populates the load-path so packages can be found -- does it also populate Info-directory-list?


texts: Getting Helm to default to the shortest match

texts:
Is there any way of getting Helm to default to the shortest match? In many cases the way Helm works at the moment (unless I have some weird configuration) is inferior to vanilla Emacs in many cases.

An example... I want to invoke "revert-buffer".

In standard Emacs it's 9 keystrokes:

M-x revert <tab> <return>

In Helm mode it's 13:

M-x revert-b C-n C-n C-n <return>.

...although if it was set to default to the shortest match (which makes sense, Occam's razor, right?) it would be something like 8:

M-x rev buf <return>


texts: orgmode - resize inline image in windows

texts:
I have installed emacs27 on windows from official release. when I run orgmode with inline image, the image do not resize according to width attribute (400 as below example)!
#+attr_org: :width 400
#+attr_latex: :width 400
#+attr_html: :width 400
[[./sample.png]]

Then I search orgmode source code and found below section (lisp/org.el):
(defcustom org-preview-latex-process-alist
  '((dvipng
     :programs ("latex" "dvipng")
     ...
     (imagemagick
     :programs ("latex" "convert")
     :description "pdf > png"
     :message "you need to install the programs: latex and imagemagick."
     :image-input-type "pdf"
     :image-output-type "png"
     :image-size-adjust (1.0 . 1.0)
     :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f")
     :image-converter
     ("convert -density %D -trim -antialias %f -quality 100 %O")))
  :group 'org-latex
  :version "26.1"
  :package-version '(Org . "9.0")
  :type '(alist :tag "LaTeX to image backends"
        :value-type (plist)))

I have installed imagick.exe and the convert command should be "magick convert". I need to customize the image-converter to below line:
("magick.exe convert -density %D -trim -antialias %f -quality 100 %O")))

Is it possible to customize it in init.el file? Or any other proper way to call "magick.exe convert" instead of "convert"?


texts: How do I depend on macros from other packages?

texts:
I'm writing a package that provides some Python functionality. I want to use python-rx, which is part of Emacs' python.el.

(eval-when-compile (require 'python))

(defun python-foo-starts-defun-p ()
  "Return non-nil if the current statement opens a defun."
  (save-excursion
    (python-nav-beginning-of-statement)
    (looking-at (python-rx defun))))

(provide 'python-foo)

However, this gives me byte compilation errors:

the function `python-nav-beginning-of-statement' might not be defined at runtime.

the function `python-rx' is not known to be defined.

This error is correct: when I run my code in a fresh Emacs, I do get an error about python-rx. However, I can open python.el and run M-x eval-buffer and then my code works.

I believe this is because python-rx is wrapped in an eval-when-compile in python.el. How can I use it in my code?


texts: Can `:exports` be set independently for inline org-babel code blocks?

texts:
In my org-mode document I use both src blocks and inline code blocks. When exporting to LaTeX, is there a way to set :exports both for the src blocks, but :exports results for the inline code? Right now, the exported document looks a weird when exporting e.g.

#+begin_src R
datafile <- "some/file.csv"
#+end_src
We use the file src_R{datafile}

because the text will read "We use the file datafile some/file.csv". Of course I can manually add the exports statements to the inline code like this
src_R[:exports results]{datafile}, but that becomes tedious very quickly.


texts: Move org-mode child to be sibling of parent?

texts:
Suppose we have

* Parent1
** Child1

and that our point is at Child1. Is there a way to programmatically move Child1 to be a sibling above Parent1, as follows:

* Child1
* Parent1

?

EDIT: The algorithm proposed in the comments fails when centered on Child1 (since it takes Child2 along with it):

* Parent
** Child1
*** Subchild
** Child2


texts: How realign existing contents of buffer on column-width?

texts:
I added the following settings to my dot-Emacs:

(add-hook 'org-mode-hook 'turn-on-auto-fill)
(add-hook 'org-mode-hook
        (lambda() (set-fill-column 80)))

When I'm typing sentences in an existing Org-file  which are longer than 80 columns, it places on the next line in the Org-file. It works fine.

However, I have in the same Org-file already sentences that I typed in the past,
which are longer than 80 columns.

How could I tell Emacs that he must format all sentences in the buffer which are longer than 80 columns. So that the existing words, which exceed 80 columns-limit will begin on the next line?


texts: Use avy to select distant word or line and paste at point

texts:
Is there a way to use avy or a similar in-buffer selection tool to quickly select a word or line to paste at the current point?

For the following buffer an example workflow for proposed functionality would be:

line 1 - reallyLongSymbol
line 2 - bravo
line 3 - <POINT_HERE>

At line 3, realize I want to paste reallyLongSymbol at the current point.
M-x avy-select-word-and-paste (made-up)
Press the key combo that corresponds to reallyLongSymbol
reallyLongSymbol is inserted at POINT.

The buffer is now as follows:

line 1 - reallyLongSymbol
line 2 - bravo
line 3 - reallyLongSymbol<POINT_HERE>

Ideally, this would work for other targets like lines and urls.


texts: How can I get a list of all of the line numbers of headers / subtrees in an Org-mode file?

texts:
E.g., with this input:

* Test
A thing!
** Testing
* Hello

Get this output:

(1 3 4)


texts: How to change the command for comment toggling

texts:
spacemacs with Evil uses gcc to toggle whether a line is commented or not.

I'd like to change it to ,cc. How should I go about this in my .spacemacs file?


texts: flyspell-goto-next-error without running flyspell-buffer first?

texts:
I would like to do a sort of flyspell-goto-next-error but without first having to run flyspell-buffer or flyspell-region.

How could this be accomplished?

In other words: keep "flyspell-buffering" until a spelling error is found and then invoke flyspell-word (M-$).

In my case, I cannot run ispell-buffer because I would like to use flyspell-babel.el, which uses Flyspell.


texts:
I am currently using the diredp-toggle-find-file-reuse-dir feature of Dired+ so that selecting a directory in a dired buffer opens the directory in the current buffer as described here.  However, it seems that I only get this "re-use" functionality with <S-down-mouse-2>.  Pressing <down-mouse-1> still causes directories to be opened in their own buffer.

I tried doing the (seemingly) obvious thing of setting the key binding directly

(define-key dired-mode-map [down-mouse-1] 'diredp-mouse-find-file-reuse-dir)

but I got strange behavior that basically looked as though I had clicked twice.

What do I need to do so that  a single mouse click reuses the current dired buffer when opening a directory?


texts:
The title is basically everything what I know. CUA keys just don't work in magit status buffer.

In older versions, it worked. Sometimes. Now it consistently just doesn't work.

Emacs 26.2.
Newest magit.


texts: org-indent-mode prevents first-line paragraph indents

texts:
I'm a writer (non-programmer) using org-mode mainly for prose notes/planning and writing.

I'm trying to enable first-line paragraph indents for text under Org headings. I discovered paragraph-indent-mode, and after enabling it to no effect, I finally realized that it doesn't work, and Org's normal ability to first-line indent also doesn't work, when org-indent-mode is enabled. With the latter enabled, M-i indents the whole paragraph.

Are the two features incompatible? Ideally I would have my text body indented under the headline as per normal org-indent-mode, and then M-i would allow me to further indent the first line of a paragraph from the new margin (if I wanted to).

E.g.,

  * org heading
    a paragraph nicely indented and aligned to the heading text (thx org-indent, you're really great, i'd hate to have to lose you just to enable first-line paragraph indents!). sentence sentence blah blah waffle waffle
        a new first-line indented prose paragraph starting here.

    and back to non-indented new paragraph still possible if i wanted to.

The idea is just to have the two types of paragraph breaks available.

I also have variable-pitch-mode and org-bullets-mode enabled.

edit:
* M-i is bound to tab-to-tab-stop.

i'm running emacs 26.1 and org latest from melpa (9.3)
if i first run org-fill-paragraph, then the indentation works, but i don't at all like the idea of using that for my writing.
(i also have indent-tools installed (but disabled by default in org buffers). if i run indent-tools-indent, i also get whole paragraph indenting.)


texts: How do I copy the content of a cell in org-mode table?

texts:
Is there a command to copy the content of a cell in a single keystroke?
When I have cursor at [x] (see below), I have to do: M-a (goes to the beginning of the cell), C-<SPC>, M-e (goes to the end of the cell), and M-w. There should be an easier way!
| Title 1            | Title 2        |
|--------------------+----------------|
| This is [x] a cell | This is a cell |
|                    |                |


texts:
How do I set org-mode to use racket instead of Guile?

I want to use emacs,org-mode and racket to go through the SICP.

I can start Geiser, choosing Racket in the Start Geiser for scheme implementation menu.

But when I execute C-c C-c on a src block in an org file

#+BEGIN_SRC
 (print "hello world")
#+END_SRC

it tells me:

Unable to start REPL:
Searching for program: no such file or directory, guile.exe

So again, how do I set org-mode to use racket instead of Guile?

Thanks in advance for your kind help and time.

P.S

I also enable scheme in org mode and set the scheme program to be Racket

(setq scheme-program-name "C:/Program\ Files/Racket/Racket.exe")
 (org-babel-do-load-languages
      'org-babel-load-languages
      '((emacs-lisp . nil)
        (scheme . t)))


texts: How to create a new TeX document with a `TeX-master` file-variable set to `t`?

texts:
When creating a new TeX document, AUCTeX asks what the master file should be, for instance:

The value specified is written into the file as an Emacs file variable (see here). For example, choosing the default in the above example results in the following initial document:
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "<none>"
%%% End:

If the new file is not going to \include other TeX files, it is its own master file. To indicate this, AUCTeX's TeX-master option should be set to t (see here). This configuration is stored in the new file as a file variable as follows:
%%% TeX-master: t

Observe that in contrast to the previous example the t is not enclosed between quotation marks.
Suppose that upon creating a new TeX document I am presented with the Master file query shown in the screencap above, namely
Master file: (default <none>) ~/

What should I enter if I wish to set the TeX-master variable to t? Simply writing t, thus:
Master file: (default <none>) t

doesn't work, as this results in a quoted value:
%%% TeX-master: "t"

which is not functionally equivalent to
%%% TeX-master: t

Of course, I can always edit the file variable after the document is created, but is there a way to generate a correct file from the get-go?


texts:
Some Unicode characters cause the line they are displayed on to be quite large. For example, a grave accent "̀ " adds about 2.5 lines of space above and below it. Other characters that cause this behavior include the Greek letter "ϕ" (phi) or subset-equal "⫅". Other characters such as maps-to "⤇" add only about 0.5 lines on either side.

I ran into this problem when reading the source of julia-mode.el which contains a large number of such characters for LaTeX substitution.

Why does this occur, and can it be fixed?

Edit: I'm using Ubuntu 14.04 LTS with Emacs 24.3.1. By default I use the "Ubuntu Mono 13" font but other fonts are sometimes used to display characters. I have installed no packages to explicitly manage unicode, and this problem is reproducible using the command emacs -Q.


texts: Syntax table to match arbitrary forms with regexp

texts:
I'm trying to write a small major-mode for editing pico-8 files in emacs and I had a quick question regarding best practices and matching a somewhat arbitrary form in the pico-8 cartridge files for the syntax table of the mode.

A pico-8 cartridge, in plain-text looks like this:

pico-8 cartridge // http://www.pico-8.com
version 4
__lua__
-- pico-8 api test  // by zep
-- demonstrates all pico-8
-- functions and some lua

cls() -- clear screen
rect(0,0,127,127,1)

music(0)
sfx(0, 3)

-- draw palette
x=3
rectfill(1,1,7,7,5)
for i=0,15 do
  print(i,x,2,i)
  x = x + 6 + flr(i/10)*4
end

__gfx__
0000000000ff0ff044444444bbbbbbbb000000004444444400000000000000000000000000000000000000000000000000000000000000000000000000000000
0700007000ff0ff04444444433333333000000004444444400000000000000000000000000000000000000000000000000000000000000000000000000000000
0070070000fffff042444444b3b3b3b3000000004444444400000000000000000000000000000000000000000000000000000000000000000000000000000000
0007700000f1ff104444444433333333000000004444424400000e00000000000000000000000000000000000000000000000000000000000000000000000000
...

Basically, it's some metadata, a bunch of lua code, and then some more raw data of the cart's graphics/music/sound effects.

I wrote the following regex to match lines up to and including __lua__:

"\\(.\\|\n\\)*?__lua__$"

This works to present the first three lines in a comment face.

The following regex was an attempt to match every line after __gfx__:

"__gfx__\\(.\\|\n\\)*"

I am pretty sure there's a better way to write this regex, but even so, it actually only puts __gfx__ and the following few lines into a comment face, rather than the rest of the buffer like I had hoped.

Is using regexes the best way to match arbitrary syntaxes like this though? I tried looking at some other major-modes to see how they handled it (particularly things like code blocks in markdown-mode), and it seems they also use regex for these kinds of expressions.

My full major-mode code is here: https://gist.github.com/taylskid/a81ca9343711ada4ba85c7451803185a

I also attached an image showing the comment face not correctly applying here:

Sorry if this is trivial or can easily be found somewhere else. My searches didn't get very far. Thanks in advance.


texts:
imenu can be used in org-mode to quickly jump to a heading. It first prompts for the 1st level heading, and then asks for the 2nd level heading and so on untill the selected heading has no subheading and we are then taken to that last selected heading.

But what I would rather like is imenu to present the list of all headings and let me select directely the one I want to go to because

it would be faster
and it would allow jumping to a heading which has subheadings

I understand that this is not the case (at least by default) because org files may have several headings sharing the same name.

But in many situations, org headings do have unique names and therefore it would be very convinient.

How could this be done ?


texts: enabling olivetti by default for all text files

texts:
I want to have all text files (esp. org files) display with olivetti mode.
I have the fo;llowing in my config:
(add-hook 'text-mode-hook (lambda ()
                            (setq bidi-paragraph-direction nil)
                            (flyspell-mode 1)
                            (visual-fill-column-mode 1)
                            (olivetti-mode 1)
                            (face-remap-add-relative 'default :family "alef")))

but when I open any text file, it's not centered as it's supposed to.
when I M-x olivetti-mode I get "olivetti mode disabled for current buffer" suggsting it was enabled, but only after re-enabling it I get the actual effect...
any ideas will be welcome :)


texts: adhoc emacs Elisp command to send emacs clipboard text to osx clipboard

texts:
When you press 'y' (elfeed-search-yank) in an elfeed-search buffer, the selected entry's permalink url is copied to the emacs clipboard.

I don't have any automatic clipboard sync packages installed, and I don't intend to.

Is it possible to Meta-: Eval: and tell emacs to send whatever is in the emacs clipboard to the OS (MacOS) clipboard?

What I tried: browsed the source code for https://github.com/jkp/pbcopy.el/blob/master/pbcopy.el
didn't see any interesting functions

NOTE: I'm using terminal emacs


texts: Random freezes with `error in process filter: Quit`

texts: I'm getting random freezes with the error message: error in process filter: Quit. I'm using tramp-mode with emacs 26.1 on macOS. It seems to maybe be linked to typing symbol characters like %, $, etc. but that could just be a coincidence.


texts:
Something has changed for me, since I upgraded to newer org-mode
If I have this

* foo
** bar...
** baz...

If I put point on "**", then hit C-e to go to the end of line, it only moves point to after "r", while I expect it to move it to the end of the line.
Is there an easy way to get back this behavior?;)


texts: What is the right way to install tab bar?

texts:
I want to install tab bar to see buffer names at the top and jump between them with Ctrl-Up/Down. Yes, I know that some people doesn't recommend it for emacs, but I don't agree with them - I do like ido but I like tabs too.

Anyway, when I open most obvious source on emacswiki, it gives me link to sourceforge saying that it is outdated and if I want the newer version I should look at debian packages. I'm not a debian user, know nothing about their package manager and it sounds strange that such popular package is updated only by developers of some distribution (not emacs dev).

However I have found this package also on melpa, where according to the version number (20140316.600) it was updated this year, so relatively new. But if I click (in melpa) on "Homepage" it redirects me to git page where there is yet another different "last commit" date (even newer!). To add to the mess git once again refers to different site, this time back to emacswiki, but it is written in such a way that I'm not sure if git version is a fork of emacswiki ones or they are the same and both the fork of aquamacs.

Can anyone shed light which version is the current one, say official? Or is it that there are only random patches here and there done by random people and none of package is official?


texts: Auto-inserting last used sub-/superscript values in math formulae

texts:
I use AUCTeX for type-setting mathematical texts. Often I have to type equations with sums, integrals etc. which all have the same sub- or superscripts. I'd like to autofill the current sub-/superscript with the value which it had before.
Example:

\sum_{i=1}^{\infty} a_i = \sum…

When I press _ at the equation above Emacs should write _{i=1}. Optional it would be good if the second superscript also is filled in.

How can this be realised?


texts: Is possible to execute sql query direct in org mode?

texts:
windows 10, emacs 26.1

I know that in org mode I can insert source code and execute them. Nice.

But what about sql:

Here in my.org  file:

 #+name: some_query
   #+BEGIN_SRC sql
      SELECT * FROM invoice WHERE id IN (1,2,3)
   #+END_SRC

Is it possible to execute query direct in org mode and get result?


texts: Enable visual-fill-column-mode only in text and programming mode

texts:
I am currently using visual-fill-column-mode and visual-line-mode in emacs with the following:

(add-hook 'visual-line-mode-hook 'visual-fill-column-mode)
(global-visual-line-mode t)
(define-key visual-line-mode-map [remap kill-line] nil)

This enable both mode everywhere, but I would like:

visual-line-mode to be enable everywhere but in terminal (e.g. ansi-term)
visual-fill-column-mode to be enable only in "text" and "programming"

Currently I have the following hook for ansi-term but it does not work:

(defun my-term-hook ()
  (visual-fill-column-mode nil)
  (visual-line-mode nil))
(add-hook 'term-load-hook 'my-term-hook)

And I don't on which hook I could bind those mode to enable them in all programming mode (I know about text-mode-hook for text mode)?


texts: Setting a new location for ispell/aspell dictionaries

texts:
I want to synchronize my personal dictionaries between my computers. For this, they should be in a dictionary with only stuff I want to synchronize, preferably in a dictionary in ~/.emacs.d because I'm already synchronizing this directory.

I don't know whether I use ispell or aspell. I always use M-x ispell-buffer and M-x ispell-region but there are no .ispell* files in my home directory. These files, however, are in my home directory:

.aspell.de.prepl  .aspell.de.pws  .aspell.en.prepl  .aspell.en.pws

I customized ispell-personal-dictionary to ~/.emacs.d/aspell ('(ispell-personal-dictionary "~/.emacs.d/aspell")), created the directory ~/.emacs.d/aspell, moved the files mentioned above there, and restarted Emacs. It didn't work because now the words I added in the past are shown as mistakes.

But changing the variable definitely changed the location where the spell checker looks for dictionaries because after moving the files back and restarting Emacs, but before undoing the customization of the variable, it still didn't recognize the words I added myself as correct.

Because I write in two different languages (English and German as can be seen above), I suppose I need different dictionaries. But the variable ispell-personal-dictionary can only hold a single value. How do I solve this?


texts: Convert function-quoted form #'... to string

texts:
I have tried (symbol-name x), but it doesn't work if the argument is a lambda:

ok:

#'execute-extended-command

not ok:

#'(lambda (&optional frame) (interactive) (message "hi 8"))


texts: Switch cursor to another window between more than 2 windows

texts:
I could use C-x o to switch buffer properly between two windows,
but when it comes to more than two windows, it fails

The cursor stay instantly on the current window.

How could I solve the problem?


texts: Using Org Babel to tangle to a variable file name

texts:
If I have a code snippet that I tangle to a file, but I expect the file name to change over time, Is there a cleaner way to change the filename than Query-replace?

For example, say I tangle code to ~/dir/my-file.el:

#+BEGIN_SRC emacs-lisp :tangle ~/dir/my-file.el
(setq myvar1 "value1")
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle ~/dir/my-file.el
(defun foo (bar) ... )
#+END_SRC

etc.

Then later on I realize that the file would be better placed in another location:

#+BEGIN_SRC emacs-lisp :tangle ~/dir/my/file.el
(setq myvar1 "value1")
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle ~/dir/my/file.el
(defun foo (bar) ... )
#+END_SRC

etc.

Is there a way to change the argument to :tangle dynamically.

I have investigated and discovered that I can feed elisp into the :tangle argument. If I evaluate (setq myfile "~/dir/file.el) and then tangle the following:

#+BEGIN_SRC emacs-lisp :tangle (print myfile)
(setq myvar1 "value1")
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle (print myfile)
(defun foo (bar) ... )
#+END_SRC

I get the desired result I am looking for.
I could then execute an elisp snippet to set the variable using org-babel, but I was wondering if there is a cleaner way to do so.

The docs on the :tangle header do not stipulate a native way.


texts:
I'm having trouble understanding how Magit handles pushing local branches to remote

I create and checkout a new branch with b c.

I make some arbitrary change, and save returning to magit with C-x g

I stage and commit the change adding a commit message.

Now I want to push.

In a terminal I would use git push --set-upstream origin <new_branch_name>

In magit, I use P and either u or p.

Reading the docs and this question it sounds like u is the right choice.

when i hit u the status buffer reads

Set upstream of third_test_branch and push there (default origin/master):

looking for another input. When I enter master it then pushes to the master branch.

any other input at this point seems to return match not found

what am I missing? Thanks


texts: pcase matches with rx but not with regex

texts:
(rx bos (1+ (in "0-2")) eos) evaluates to "\\`[0-2]+\\'", so I expected these two functions to be equivalent:

(defun with-rx (s)
  (pcase s
    ((rx bos (1+ (in "0-2")) eos) "matched")
    (t "not matched")))

(defun with-regex (s)
  (pcase s
    ("\\`[0-2]+\\'" "matched")
    (t "not matched")))

However, it seems that pcase treats the rx form as a real regexp in the first case and the string as a simple string in the second case:

ELISP> (equal (rx bos (1+ (in "0-2")) eos) "\\`[0-2]+\\'")
t
ELISP> (with-rx "01210")
"matched"
ELISP> (with-regex "01210")
"not matched"

How come in the rx case, pcase is smart enough to know that it should treat the rx form as a regex?


texts: How can I make url.el work with the If-None-Match header?

texts:
Take the following form constructed according to :

(let ((break-url-package nil))
  (let ((url-request-method "GET")
        (url-request-extra-headers
         `(("Content-Type" . "application/json")
           ,@(when break-url-package
               '(("If-None-Match" . "\"00d61dfb6398b3994d4c7110b0eb1b9f\""))))))
    (switch-to-buffer-other-window
     (url-retrieve-synchronously
      "https://api.github.com/users/octocat"))))

which gives the following response:

HTTP/1.1 200 OK
Server: GitHub.com
Date: Fri, 19 May 2017 02:29:55 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 38
X-RateLimit-Reset: 1495163787
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: W/"00d61dfb6398b3994d4c7110b0eb1b9f"
Last-Modified: Wed, 17 May 2017 21:18:07 GMT
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
Content-Security-Policy: default-src 'none'
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
Vary: Accept-Encoding
X-Served-By: e14705a23c085afeff5e104b1fc3922a
Content-Encoding: gzip
X-GitHub-Request-Id: E541:15878:199148E:1E81AEB:591E58A1

{"login":"octocat","id":583231,...}

If I let (break-url-package t), it's a whole different story:

Contacting host: api.github.com:443
error in process filter: insert-file-contents-literally: Opening input file: No such file or directory, /Users/sean/.emacs.d/url/cache/sean/https/com/github/api/84a3031e21fe0081db5ec1586ae7cbb6
error in process filter: Opening input file: No such file or directory, /Users/sean/.emacs.d/url/cache/sean/https/com/github/api/84a3031e21fe0081db5ec1586ae7cbb6

After those messages print, Emacs hangs (until C-g).

No other headers appear to behave this way.

After some more investigation, I've found this is the exact request I'm making to the server according to (url-http-create-request):

GET /users/octocat HTTP/1.1
MIME-Version: 1.0
Connection: keep-alive
Extension: Security/Digest Security/SSL
Host: api.github.com
Accept-encoding: gzip
Accept: */*
User-Agent: URL/Emacs
Cookie: HttpOnly=nil; logged_in=no
Content-Type: application/json
If-None-Match: "d093767a41c43cbc64dcc3bda1b5880f"

where

curl -i https://api.github.com/users/octocat \
  -H 'MIME-Version: 1.0' \
  -H 'Connection: keep-alive' \
  -H 'Extension: Security/Digest Security/SSL' \
  -H 'Host: api.github.com' \
  -H 'Accept-encoding: gzip' \
  -H 'Accept: */*' \
  -H 'User-Agent: URL/Emacs' \
  -H 'Cookie: HttpOnly=nil; logged_in=no' \
  -H 'Content-Type: application/json' \
  -H 'If-None-Match: "d093767a41c43cbc64dcc3bda1b5880f"'

responds with

HTTP/1.1 304 Not Modified
Server: GitHub.com
Date: Fri, 19 May 2017 11:54:11 GMT
Status: 304 Not Modified
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 56
X-RateLimit-Reset: 1495197406
Cache-Control: public, max-age=60, s-maxage=60
Vary: Accept
ETag: "d093767a41c43cbc64dcc3bda1b5880f"
Last-Modified: Wed, 17 May 2017 21:18:07 GMT
etc... just headers


texts:
About 2 weeks ago my package.el broken and I am not able to install/remove/update packages.

Flow: M-x package-list-packages, I mark package for installation or deletion (I or D appears next to package name), press 'r', in minibuffer Connection host: elpa/melpa/org appears and then the last repository in my package-archives hangs there, I or D dissapears from package name and nothing happens, package is not installed/removed.

Package-related stuff in my .emacs:

I tried basically anything, emacs -Q, google, ask in freenode #emacs, no help. Only similar thing I found was this 3 years old issue https://github.com/dimitri/el-get/issues/698 which kinda seems like whats happening to me, but no mouse movement helps.

Thanks for any help.

BTW: I can install packages with package-install without any problem and my package-archives is correct.


texts:
Very similar to this question. I'm using helm-projectile to find files. My Emacs frame is divided in three vertical column windows. In one of the windows I have an open file from the project I'm working on, so I invoke helm-projectile and I can find other project files. However if I open the file, it opens in the current window.

What I would like to do is very similar to finding the file with helm and then C-c o to open it in another window, but I would like to tell Emacs which window I want to open the file in, maybe similar to how ace-window allows you to choose the window to jump to if your current frame is split in more than 2 windows.

How can this be done?


texts:
I'm trying to get several plugins all playing nicely: yasnippet, company-mode and ENSIME.

I'm aware of How to make yasnippet and company work nicer? but I was thinking about another, simpler, approach: can I just disable company-mode's TAB altogether?

I use RET to expand completions and I very rarely want to use TAB to select the maximum common matching expression.


texts:
Recently, I change my laptop from old Thinkpad to newer laptop with much larger touchpad. I've found that I frequently touch the sensitive touchpad while I'm using emacs. And with some mysterious combination, very often there will be a highlight appear on the emacs buffer. The highlight is persist. Cannot be removed by navigating cursor or mouse click. It's not emacs selection mark. The only way I can remove it is to close the buffer and reload the file.

This is very annoying. Anybody know what is it, how to remove it, and best if I can prevent it from occur in the first place.


texts: How do I use silversearcher-ag with Emacs without a package

texts:
I've read Grep Searching from the manual. The basic that I've found out are that I can use grep command in Emacs. I was wondering if I could use silversearcher-ag as an alternative to grep in M-x grep

I tried to just remove grep --color -nH --null -e and use plain ag command and it does actually work, i.e. it fills up the *grep* buffer. But it's not formatted and thus Emacs can't use that buffer to jump around the matches.

I know about some packages, but I really want to know how I can change the ag command so that the output is compatible for Emacs. Any help would be appreciated.


texts: Can I combine natbib syntax and export as RTF?

texts:
I generally use auctex to generate PDF documents. However, I now need to generate an RTF file to integrate my contribution into a collaborative Word document.

Using org-mode, I would like to use natbib citation syntax while I write. I then want to export a document as RTF with a reference list, possibly formatted as they would for a PDF file generated with auctex.

How do I use natbib-style citations and export to RTF?


texts: Switch to *scratch* buffer (global-set-key)

texts:
I am reading the Intro to Lisp Programing and got to the chapter where switch-to-buffer is introduced.
I tried to bind (switch-to-buffer "*scratch*") via global-set-key
But this does not work:
(global-set-key (kbd "<S-f11>") '(switch-to-buffer "*scratch*"))
I looked at Bernt Hansens config and he defined an extra function for this.
(defun bh/switch-to-scratch ()
  (interactive)
  (switch-to-buffer "*scratch*"))

Why is this necessary?


texts: How can I get the TypeScript layer for Spacemacs to do type-checking?

texts:
I'm using the TypeScript layer for Spacemacs. Type information, go-to-definition, completions, etc. all work great.

But if I do this:

const x: string = 3;

Nothing yells at me about the type error. Why? How can I get this feature? It's essential to TypeScript development.


texts:
I am trying to execute an external program on a string. This code works, but it saves the string to a temporary file in order to run call-process. This seems quite roundabout. I'd rather not use a shell command either.

Is there a way to call an external program on a string without writing to a temporary file?

(defun my/execute-program-on-string (program string &optional args)
  "Call PROGRAM with ARGS on STRING."
  (let  (input-file input-buffer output-buffer exit-code result)
    (unwind-protect
    (setq input-file (make-temp-file "/tmp/emacs-execute-"))
      (write-region string nil input-file nil)
      (setq input-buffer (create-file-buffer input-file)
        output-buffer (generate-new-buffer (format "*%s*" program))
        exit-code (call-process program input-file output-buffer nil args))
      (if (zerop exit-code)
      (setq result
        (with-current-buffer output-buffer (buffer-string)))
    (throw 'external-program-error exit-code))
      (progn
    (kill-buffer input-buffer)
    (kill-buffer output-buffer)))
    result))

(my/execute-program-on-string "cat" "Hello, World!" "-n")


texts:
I am a newbie here, currently I am learning some advanced features of org mode.

I am using Emacs24.4 which has a build in org mode(version 8.2.10, dir "emacs.d/elpa/org-20150608").

I want to use org-plus-contrib so I installed it from orgmode.org/elpa, but after installing, I found it also contains most files in org mode folder.
I am very confused of how to use this "contrib" folder? Does it means I have two org installed?

What if I just copy the contrib folder from org git repo, where should I put it? and what the configure like?

thanks all.


texts:
I want to make a macro that takes a form and returns a string with some parts of the form evaluated. The form can have any number of elements (e.g. additional options for the title font, color, size,...). Say the macro is called "gset".

So this:

(gset title (format "\"x=%s\"" (+ 1 1))))

would expand to: "set title \"x=2\""

or

(let ((x 3)) (s (gset title (format "\"x=%s\"" x))))

would expand to "set title\"x=3\"". The form(s) that get expanded will not always be in the third position.

Edit:

The place this has a role is in a DSL for gnuplot in elisp I am working on. Here is an example.

(let* ((x '(0 1 2 3))
       (y (loop for xx in x collect (* xx xx))))
  (gnuplot
   (gset terminal png)
   (gset output "test.png")
   (gset title "A Title")
   (gset xlabel "x")
   (gset ylabel "y")
   (plot x y with lines title "data"))
  (format "[[./test.png]]"))

The gset macro is the one I was describing above. the plot macro has the x and y arguments in the definition, so they expand fine (although nothing after them would). This block above as is works fine and generates the figure. But if I add something like

(gset title (format "A Title (%s) datapoints" (length x)))

This doesn't work because the format form doesn't expand. It won't always be the third position where something like this might happen.

It seems like this should work because when I look at it I can see what I want to happen, which is if it is a symbol use the symbol name, and if it is a list, evaluate it and use that value.

SOLUTION:

I came up with this macro:

(defmacro vset (&rest args)
  `(format "set %s" (mapconcat
         'identity
         ',(mapcar (lambda (s)
                 (format "%s"
                     (if (listp s)
                     (eval s)
                       s)))
               args)
         " ")))

This works on this:

(setq y '(2 4 6 8))
(let ((x '(1 2 3 4)))
  (vset title (format "\"%s xpoints %s ypoints\"" (length x) (length y))))

set title "4 xpoints 4 ypoints"

I didn't think I would need to use eval, but I can't figure out another way to do it.