texts:
When I start my emacs I keep seeing following message on the minibuffer. How can I detect that which function causes this error message, in order to fix it?
File mode specification error: (wrong-number-of-arguments (1 . 2) 0)

debug result:
Debugger entered--Lisp error: (wrong-number-of-arguments (1 . 2) 0)
  company-jedi()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook python-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook python-mode-hook))
  run-mode-hooks(python-mode-hook)
  #f(compiled-function () (interactive nil) #<bytecode 0x1869ae5>)()
  apply(#f(compiled-function () (interactive nil) #<bytecode 0x1869ae5>) nil)
  python-mode()
  set-auto-mode-0(python-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer end_code.py> "~/eBlocBroker/end_code.py" nil nil "/mnt/hgfs/eBlocBroker/end_code.py" (47 52))
  find-file-noselect("~/eBlocBroker/end_code.py" nil nil t)
  find-file("~/eBlocBroker/end_code.py" t)
  funcall-interactively(find-file "~/repo/end_code.py" t)
  call-interactively(find-file)
  ido-file-internal(raise-frame)
  ido-find-file()
  funcall-interactively(ido-find-file)
  call-interactively(ido-find-file nil nil)
  command-execute(ido-find-file)


texts: Emacs doesn't show the keymap of a keybinding

texts:
I want to unbind the keybinding C-k, which runs the command org-up-element in org mode. To do it, I first need to find out which keymap this keybinding is bound to. So I run describe-key and press C-k, here is the result:
C-k runs the command org-up-element, which is an interactive compiled Lisp
function in ‘org.el’.

It is bound to <motion-state> g h, C-c C-^.

(org-up-element)

Move to upper element.

It doesn't tell me which keymap C-k is bound to, but usually it should tell me. So my question is, why doesn't it tell me, and how can I know the keymap that C-k is bound to?


texts: Create helm source containing multi-term buffers

texts:
I am using multi-term and would like to create a helm source which displays all my open terminals. There is a list of all terminal buffers called "multi-term-buffer-list", but I can't get this list into the candidates for the helm source. I tried several combinations along these lines:

(setq some-helm-source
  '((name . "Terminal Buffers")
    (candidates . multi-term-buffer-list)))

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

Does anyone know how to do this?


texts: Display path and filename in a minibuffer

texts:
Eval this code:

(defun xx-display-filename (filename)
  ""
  (interactive "Ffilename: ")
  (message (concat "Filename is: " filename)))

Let's assume that I am editing a ~/.emacs.d/personal/custom.el file in the current buffer.

The function above, when invoked with M-x xx-display-filename displays a following text in a minibuffer:

filename: ~/.emacs.d/personal/

This is confusing. I can see a valid path but name of the file is missing. I would expect to see this:

filename: ~/.emacs.d/personal/custom.el

This is confusing even more. When executed, this function writes a following line in *Messages* buffer:

Filename is: ~/.emacs.d/personal/custom.el

I would expect to see the same text as in a minibuffer:

Filename is: ~/.emacs.d/personal/

So, the question is, How can I display whole path and filename of the currently edited file in a minibuffer and pass it as an argument to an interactive function?


texts: Org babel code block does not italicize fonts

texts:
I set my comment style to be italic, this is done via customizing the variable font-lock-comment-face.
For regular code files, this works-> comments are italic.
This does not work for an Org code block, i.e. between #+begin_src and #+end_src. Comments are not italic.
I also have (setq org-src-fontify-natively t) in my init but that does not solve the problem.
Any help is appreciated


texts:
Main question:
In order spell checkers can apply, M-x iso-tex2iso is nice for converting TeX-encoded files to e.g. UTF-8 encoded ones. But, in case a numerous files to convert, running this command in a batch mode would be helpful. How to do that?

Subsidiary question: (not for me, for a friend of mine owning a Mac) On OSX, how to make this batch thing a script with an associated icon that could "receive" (by "drag and drop") a file to be converted?


texts: Fix 'changed on disk'/'Reread from disk' when file has not changed

texts:
Is there any way to get emacs to actually check the contents of files on disk when determining this?

E.g. if I have some unsaved changes to a file, and temporarily switch source control branches (to make changes to other files), then switch back again, I want to be able to continue editing where I left off without this prompt. (the prompt would be much more trustworthy and useful if it only warned me when the file had really changed)

I think it currently goes by timestamp or something.


texts: In org mode, how do I reference a figure?

texts:
I have a figure declared like this:

#+CAPTION: Google NGrams Viewer Search
#+NAME: fig:ngrams
[[file:ngrams.png]]

And I'd like to reference it, so that I can write, e.g. Please refer to Figure [[some magic thing here]] and have it output Please refer to Figure 1. I'm using pandoc to convert from .org to .pdf.

I've been trying writing [[fig:ngrams]], as in Please refer to Figure [[fig:ngrams]], but neither Pandoc nor pandoc-citeproc seem to understand that kind of link, and they transform it to Please refer to Figure fig:ngrams.


texts:
This question is a semantically similar question but the OP's intent was more about which implementation of multiple cursors was "best".

I echo one of the commenters of that question who asked "Can you explain how to use it? I'm superconfused". . . as am I!  That answer included a list of keybindings (which are also available (though not in handy table format) on the evil-mc readme).  When I search on the web for this I get keybindings and others with the same question but have not found just basic instructions.

Could someone just walk through an example of how to use multiple cursors?  For example, let's say I have this list of variables cut from a spec (including non-alignment):

 `purpose`
   `dtlastmod`
   `lastmod`
   `dtrelver`
   `relver`
   `comps`

I want to change that list to:

 String purpose;
 String dtlastmod;
 String lastmod;
 String dtrelver;
 String relver;
 String comps;

It seems like multiple cursors might make this easy but I'll be darned if I can't figure it out.  Is that a good use case?  If not, what is a good example and could you talk through the steps?


texts: how to auto scale images to fit into a slide in org mode export to beamer?

texts:
When I insert an image into the slide it gets cropped to fit into the slide.
How do make an image to scale to fit in without cropping or padding?

To include an image I use:

#+LaTeX:\includegraphics{curves.jpg}

org file header:

#+startup: beamer
#+LaTeX_CLASS: beamer
#+LaTeX_CLASS_OPTIONS: [bigger]
#+BEAMER_FRAME_LEVEL: 2
#+OPTIONS: toc:nil

and config file contains the following:

; allow for export=>beamer by placing

;; #+LaTeX_CLASS: beamer in org files
(unless (boundp 'org-export-latex-classes)
  (setq org-export-latex-classes nil))
(add-to-list 'org-export-latex-classes
  ;; beamer class, for presentations
  '("beamer"
     "\\documentclass[11pt]{beamer}\n
      \\mode<{{{beamermode}}}>\n
      \\usetheme{{{{beamertheme}}}}\n
      \\usecolortheme{{{{beamercolortheme}}}}\n
      \\beamertemplateballitem\n
      \\setbeameroption{show notes}
      \\usepackage[utf8]{inputenc}\n
      \\usepackage[T1]{fontenc}\n
      \\usepackage{hyperref}\n
      \\usepackage{color}
      \\usepackage{listings}
      \\lstset{numbers=none,language=[ISO]C++,tabsize=4,
  frame=single,
  basicstyle=\\small,
  showspaces=false,showstringspaces=false,
  showtabs=false,
  keywordstyle=\\color{blue}\\bfseries,
  commentstyle=\\color{red},
  }\n
      \\usepackage{verbatim}\n
      \\institute{{{{beamerinstitute}}}}\n
       \\subject{{{{beamersubject}}}}\n"

     ("\\section{%s}" . "\\section*{%s}")

     ("\\begin{frame}[fragile]\\frametitle{%s}"
       "\\end{frame}"
       "\\begin{frame}[fragile]\\frametitle{%s}"
       "\\end{frame}")))

  ;; letter class, for formal letters

  (add-to-list 'org-export-latex-classes

  '("letter"
     "\\documentclass[11pt]{letter}\n
      \\usepackage[utf8]{inputenc}\n
      \\usepackage[T1]{fontenc}\n
      \\usepackage{color}"

     ("\\section{%s}" . "\\section*{%s}")
     ("\\subsection{%s}" . "\\subsection*{%s}")
     ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
     ("\\paragraph{%s}" . "\\paragraph*{%s}")
     ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))


texts: ido-enabled find-file does not match an existing file name when I yank file name and directory

texts:
I enabled IDO mode in my emacs (version 25.2.1, Linux) and now I am trying to open a file.

I am in the directory ~/foo .
The file is ~/foo/baz/bar.cpp and it does exist.

I have baz/bar.cpp in my kill ring.

I press C-x C-f , followed by C-y.

The minibuffer shows

Find file: ~/foo/baz/bar.cpp<caret>[No Match]

At this point, if I press (C-f), my "normal" find-file locates the file just fine.

But, why is IDO giving me "No Match"?

More information:

Yanking just the file name (no directory) works fine.

Pressing "Enter" when "No Match" is show leads to another find-file minbuffer, not to a new file creation.


texts: org-agenda-files not setting after update?

texts:
I recently upgraded to emacs 25.1.1 and noticed my org setup wasn't working as usual. in my init.el I have:

(setq org-directory "~/Dropbox (Personal)/org")
(setq org-archive-location "~/Dropbox (Personal)/org/archive/%s_archive::")
(setq org-agenda-files (list "~/Dropbox (Personal)/org/journal"
                             "~/Dropbox (Personal)/org"
                             "~/Dropbox (Personal)/org/gmail-inbox.org.txt"))

when I view the agenda I'm not seeing any records from /org/journal being pulled in.

If I do M-x describe-variable RET org-agenda-files

I get

org-agenda-files is a variable defined in ‘org.el’.
Its value is
("/Users/kevzettler/Dropbox (Personal)/org/personal.org" "/Users/kevzettler/Dropbox (Personal)/org/plebland.org" "/Users/kevzettler/Dropbox (Personal)/org/tilt.org")

Original value was nil

Which looks like its only setting it to the what's available in "~/Dropbox (Personal)/org"


texts: Simple password based file decryption/encryption compatible with command line program?

texts:
What works currently: With emacs25 (as comes with ubuntu 18) I use ccrypt on the command line to selectively en/decrypt a few specific text files. There is a package elpa-ps-ccrypt which, on encountering such a file, asks for the password, decrypts and lets me edit the file. On save, it encrypts it.
What's wrong: The package elpa-ps-ccrypt does not work with emacs28 (ubuntu snapshot package) for quite some time. It can decrypt, but when saving I get a lengthy error-message.
What I would like: I guess I should switch. But what is a decent successor?
Musings: erc-crypt and kaesar mention "openssl", which makes me cringe. But maybe that is what is the right thing to do? Or is it easier to define a save and a load action to transform files on writing and reading? How would that be done with asking the password?


texts: Both VC and Magit cannot see global .gitignore

texts: I'm using emacs on Windows and this is long bothered me. All other apps correctly ignore all listed in global .gitignore, but in emacs they are untracked/unregistered and pollute the status window.


texts: Is it possible to attach generated doc string to a lambda?

texts:
Emacs docs say that when doc string is put inside of lambda or defun it's “stored directly in the function object”. However, we can change docs of named functions like this:

(put 'my-function-name 'function-documentation "Blah.")

But the same trick doesn't work with lambdas. Is there a way to add documentation to lambda? Or somehow dynamically generate doc-string literal?

To clarify, imagine the following situation:

(let ((foo 1)
      (bar 2))
  (lambda ()
    (+ foo bar)))

I would like the lambda to have a doc string that mentions values of foo and bar.


texts: disable strange comment behavior in AUCTeX

texts:
When I have a commented line in my TeX file, eg

some text that is not commented
|%% here is a comment
followed by more uncommented text

(the | represents point), and I hit RET, point is moved past the %% and into the comment, like so:

some text that is not commented

%% |here is a comment
followed by more uncommented text

This seems very strange, and to me it is undesirable. For instance, if I want to add another newline before the commented line, I have to backtrack to the beginning of the line first. I want point to stay in front of the % characters.

How can I disable this annoying behavior?


texts: M-. takes over my commands and can't execute OR C-g to escape

texts:
I am using Emacs 26.3 and trying out ggtags-company-mode to navigate my code base.

I move my cursor to a function I want to jump to the definition of, poll_count, and enter M-.

I now have this at the bottom of my session in the minibuffer:

But when I try to tab to it (I have ido-everywhere), It inserts an actual tab:

So I hit backspace to remove the TAB and hit RET.  But now it inserts a literal RET:

I want to /select/ this not insert a literal enter.  So now I want to give up, and I type C-g to cancel this command in the minibuffer:

It says quit, but then comes right back to:

It does this no matter how many times I hammer C-g C-g. So now my editor is stuck here and this is my life now.  I can neither escape the command to terminate it with C-g, nor execute it with TAB or RET.

For what it's worth, the poll_count function is defined just a few lines above in the same file, so I didn't expect this to be such a trap.

Update

C-] and ESC ESC ESC both cancel the command OK, so I am not trapped in the minibuffer forever, but I still can't seem to select the Jump to: target correctly.


texts: How can I open an url file in emacs dired?

texts: When using dired in emacs, how can I open an url file in a web browser outside emacs?


texts: Cocoa Emacs 24.5 Font Issues (Inconsolata-dz)

texts:
I am trying to set [Inconsolata-dz][1] as my default font to Emacs. Regular Inconsolata works fine, but the dz version is not working properly. Most functions I use keep throwing this error (followed all the instructions online on how to set Emacs font):

set-face-attribute: Invalid font name: "-*-Inconsolata-dz-normal-normal-normal-*-13-*-*-*-m-0-iso10646-1"

I finally got it to work by doing this in my init.el:

(setq initial-frame-alist '((font . "Inconsolata-dz-13")))
(setq default-frame-alist '((font . "Inconsolata-dz-13")))

I also have this in init.el, which was generated by customize-faces, but it seems to change the font to Helvetica (unless overridden by the code above):

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(custom-safe-themes
   (quote
    ("e16a771a13a202ee6e276d06098bc77f008b73bbac4d526f160faa2d76c1dd0e"
     "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879"
     "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4"
     default))))

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:inherit nil :stipple nil :inverse-video nil
             :box nil :strike-through nil :overline nil
             :underline nil :slant normal
             :weight normal :height 140 :width normal
             :foundry "nil" :family "Inconsolata-dz")))))

Now the issue with the first code above is that doing a Ctrl+N, to create a new window will throw the same Invalid font name error.

I installed Inconsolata and Inconsolata-dz the same way on my Mac. Just the regular, default way of installing fonts on OS X.

Does anyone know what I'm doing wrong and how I can use Inconsolata-dz properly?


texts: org-mode: archiving to gpg-encrypted file

texts:
My org mode file is gpg encrypted.

I've been able to setup transparent decryption when opening the file and encryption when saving to disk.

However, archiving an entry still puts it into unencrypted "_archive" file.

Setting manually org-archive-location unforotunately doesn't work:

  Emacs won't archive an entry to a previously encrypted file.


texts: How to change mouse pointer in mode line or header line?

texts:
The mouse pointer shape changes whether its over the buffer, over the mode line, or header line, if that exists.

How can I change the mouse pointer shapes for these different areas to something other than their defaults?


texts: How to enable type-check rules with flycheck-tslint

texts:
I want flycheck to use the tslint's --type-check flag to compile my typescript files. In order to see unused imports on the fly inside emacs.
By tslint docs

  --type-check
      Enables the type checker when running linting rules. --project must be
      specified in order to enable type checking.

I also found out that I can set flycheck-tslint-args to add aditional aguments to tslint while also setting the --project flag to tsconfig.json path. Here it is what I have accomplished so far. I am creating a flycheck checker like below

 ;; Hardcoding this for now
 (setq cesco-flycheck-typescript-tsconfig "/Users/cesco/go/src/github.com/cescoferraro/achars/tsconfig.json")
  (flycheck-define-checker typescript-tslint-cesco
    ""
    :command ("tslint" "--format" "json"
          (config-file "--config" flycheck-typescript-tslint-config)
          (config-file "--project" cesco-flycheck-typescript-tsconfig)
          (option "--rules-dir" flycheck-typescript-tslint-rulesdir)
          (eval flycheck-tslint-args)
          source)
    :error-parser flycheck-parse-tslint
    :modes (web-mode))

My typescript config hook

(defun setup-tide-mode ()
  (interactive)
  (tide-setup)
  (flycheck-mode +1)
  (flycheck-select-checker 'typescript-tslint-cesco)
    (setq flycheck-tslint-args . ("--type-check"))
  (setq flycheck-check-syntax-automatically '(save mode-enabled))
  (eldoc-mode +1)
  (tide-hl-identifier-mode +1)
  (add-to-list 'company-backends '(company-tide :with company-yasnippet))
  )
(add-hook 'typescript-mode-hook #'setup-tide-mode)

The problem is that the source file used in the actual tslint command is placed at "/var/folders/...." and tslint would fail becouse tsconfig.js by default only includes files within this folder. If I include this into tsconfig.json

"include": [
        "/var/folders/**/*"
    ]

Then tslint does not exists with errors. Instead, it complains about not being able to resolve any packages because there is no node_modules folder at /var/folders/43rr43r4/wherever and since the path does not match the buffer path all thos results are displayed at the minibuffer instead of actaully highlighting the code.

Suspicious state from syntax checker typescript-tslint-cesco: Flycheck checker typescript-tslint-cesco returned non-zero exit code 1, but its output contained no errors: Error at /var/folders/5d/5rzjf50s31z3_yhgy4hw1n_80000gn/T/flycheck2097Ejk/router.epic.tsx:2:28: Cannot find module 'rxjs'.
Error at /var/folders/5d/5rzjf50s31z3_yhgy4hw1n_80000gn/T/flycheck2097Ejk/router.epic.tsx:3:29: Cannot find module 'react-redux-firebase'.
Error at /var/folders/5d/5rzjf50s31z3_yhgy4hw1n_80000gn/T/flycheck2097Ejk/router.epic.tsx:4:22: Cannot find module 'connected-react-router'.
Error at /var/folders/5d/5rzjf50s31z3_yhgy4hw1n_80000gn/T/flycheck2097Ejk/router.epic.tsx:7:46: Cannot find name 'Action'.

Try installing a more recent version of typescript-tslint-cesco, and please open a bug report if the issue persists in the latest release.  Thanks!

I can also run M-x flycheck-compile RET typescript-tslint-cesco RET
and then It runs fine but still errors with code 2 abnormally and I dont get any highlighting.

-*- mode: compilation; default-directory: "~/go/src/github.com/cescoferraro/achars/app/containers/" -*-
Compilation started at Fri May 19 13:45:34

tslint --format json --config /Users/cesco/go/src/github.com/cescoferraro/achars/tslint.json --project /Users/cesco/go/src/github.com/cescoferraro/achars/tsconfig.json --type-check /Users/cesco/go/src/github.com/cescoferraro/achars/app/containers/router.epic.tsx
[{"endPosition":{"character":50,"line":2,"position":98},"failure":"All imports are unused.","fix":{"innerStart":48,"innerLength":50,"innerText":""},"name":"/Users/cesco/go/src/github.com/cescoferraro/achars/app/containers/router.epic.tsx","ruleName":"no-unused-variable","ruleSeverity":"ERROR","startPosition":{"character":0,"line":2,"position":48}}]
Compilation exited abnormally with code 2 at Fri May 19 13:45:38


texts:
I need many lines in my org-export latex header.

#+LATEX_HEADER: \usepackage[main=british,polutonikogreek]{babel}
#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \usepackage{hanging}
#+LATEX_HEADER: \setmainfont{ebgaramond}[Contextuals=Alternate]
#+LATEX_HEADER: \newcount\instr \instr=1 % hide/show instructions
#+LATEX_HEADER: \babelhyphenation[british]{philo-sophy}

Is there an alternative to putting #+LATEX_HEADER in front of each?


texts: After query-replace using my-find-files, how to automatically delete-other-windows?

texts:
I am following answer for Using Emacs to recursively find and replace in text files not already open
My setup:
(defun my-find-files ()
  (interactive)
  (find-dired "~/folder" "-name \\*.py ! -name flycheck_\\*.py !"))

(global-set-key (kbd "M-m") 'my-find-files)

I opened file named doo.py.  Than, t to toggle marked/unmarked files (thus marking them all, since none were marked). Then I use Q to use query-replace on the marked files. And enter alper to replace with alpera.

After all replacement is completed there are 3 buffers opened on my page. Active window has the buffer, where the latest replacement took place (doo2.py on my example). Than I pressed, Ctrl-1 and C-f and typed doo.py to open it.

[Q] Is is possible to close *Find* and *xref* after the replacement is completed and open the buffer where the replacement started. On may example I just want to open doo.py where should be the only opened window.


texts: Create a keybinding to call a function using the universal-argument

texts:
Currently I have a short cut to call the function 'helm-ag' (Using evil-leader)

 (evil-leader/set-leader ".")
 (evil-leader/set-key "g" 'helm-ag)

When 'helm-ag' is called with the Universal-argument (Ctrl - U) it allows me to choose in which directory I'd like to run the command. I use this all the time so I'd like to create a permanent short to specifically run the 'helm-ag' with the universal argument.

I've tried this:

(evil-leader/set-key "g" '(lambda () (interactive)(universal-argument)(helm-ag))

But it doesn't work. Any ideas?

Thanks


texts: Scroll other window (doc-view) -- by page -- with mouse wheel

texts:
I am using a slightly modified version of doc-view mode and would like to maintain focus in a different window, while hovering with the mouse over the doc-view window and scroll the image page-up or page-down -- without actually selecting the window.  When not selecting the window and attempting to scroll with the mouse, I get the following error message.

In case it makes a difference, my operating system is OSX 10.6.8 (Snow Leopard).

Debugger entered--Lisp error: (wrong-type-argument listp t)
  image-mode-winprops(nil)
  image-mode-window-get(page nil)
  (+ (image-mode-window-get (quote page) nil) (or arg 1))
  (dv-goto-page (+ (image-mode-window-get (quote page) nil) (or arg 1)))
  dv-next-page(1)
  funcall-interactively(dv-next-page 1)
  call-interactively(dv-next-page nil nil)
  command-execute(dv-next-page)

EDIT (November 28, 2014):  The following is the debugger readout for the stock version of doc-view-mode using the following mouse wheel assignments that I added:

Key assignments:

(define-key doc-view-mode-map (kbd "<wheel-down>") 'doc-view-next-page)

(define-key doc-view-mode-map (kbd "<wheel-up>") 'doc-view-previous-page)

Emacs version: GNU Emacs 25.0.50.1 (x86_64-apple-darwin10.8.0, NS appkit-1038.36 Version 10.6.8 (Build 10K549)) of 2014-10-01 on MP.local

Debugger readout:

Debugger entered--Lisp error: (wrong-type-argument listp t)
  image-mode-winprops(nil)
  image-mode-window-get(page nil)
  doc-view-next-page(1)
  funcall-interactively(doc-view-next-page 1)
  call-interactively(doc-view-next-page nil nil)
  command-execute(doc-view-next-page)


texts: Fresh install 24.5 on Windows 10 bash shell Linux 16.04 crashing on package manager

texts:
Fairly new to emacs, seemed super awesome for writing a lot of different styles.  Got it working just fine on my desktop using the new bash terminal - 14.04 - on my desktop.
Did the exact same setup of emacs on 14.04 on my laptop ( just installing straight from sudo apt-get install emacs ), when I launch the package manager, if I hit any keys, this happens:

Then, if I just use fg to try to get back into emacs, my terminal basically stops working and this happens when I press any keys:

I googled around for a long time, and saw no similar crashes, and tried to wipe Emacs/reinstall, and the same thing was happening. I even updated linux to see if that would be a cause, and the exact same bug is happening.
I am not sure where to start for the reason behind this or how to approach debugging this.  This does also happen with emacs -q.
Any help super appreciated, would love to use the program, I have been using it on my desktop for a week or two to write C and other things, and it seems like a pretty ideal program if I could get it to work on both my laptop and desktop.
This will also happen occasionally when I just enter emacs or emacs -q without loading up a file and when I hit any key, the same crash will occur and exhibit the same behavior.  It will always do the exact same thing in list-packages


texts: Calculating the length of a line in a buffer

texts:
Simple question, I think: How can I calculate the length of a line in emacs lisp? It seems like there should be a function for this, but I can't find it. What I'm using right now is something like this:

(-
 (progn
   (end-of-line)
   (current-column))
 (progn
   (beginning-of-line)
   (current-column)))

But this feels clumsy.

So is there a standard way to do this? And are there any subtleties I should be aware of (i.e. regarding encoding, tabs, or anything like that)?

Actually for my purposes, it would be just as handy to simply calculate if a line is empty. Is there a function for that?

Whatever method I use, it needs to be pretty fast. I need to calculate this for every line in a buffer on a pretty regular basis without interrupting flow.


texts: How I can show the breakpoints dots per-line on file-buffer using gud-gdb?

texts:
Using gdb defined by package gdb-mi.el I got the breakpoints red dots after click on line with mouse or defining on gdb buffer. However, using a alternative wrapper for gdb present on the stantard packages of emacs gud-gdb defined on gdb.el, I cannot. This is possible? Only shows on my buffer the current point of execution (white arrow).

Example: calling gdb from M-x gud-gdb RET

Example: calling gdb from M-x gdb RET (desired behavior about breakpoints)

Someone can ask whyI just not use the gdband forgot about gud-gdb and the answer is because I can't. On my Windows machine I receive a lot bugs and crash using it. The bugs is mainly because the bad Cygwin support about handling stdin far I know. Just doesn't works debugging via gdb programs whose read something from stdin, he injects the string -interpreter-exec console as I described recently on this StackOverflow thread. So I need use gud-gdb.

Thanks in advance.


texts: Scratch always starts in fundamental mode

texts:
I don't know what change in my configuration caused this, but scratch buffer always starts in fundamental-mode. I would like to have emacs-lisp-mode in the scratch buffer. I tried to do

(setq initial-major-mode 'emacs-lisp-mode)

But it didn't help. How can I investigate the cause of this?


texts:
In an org-mode table, I want to write 2^3, but exporting to html turns it into 23.

I prefer not to use inline verbatim, and I would like to not have a space between the ^ and the other text.

Is there a keyword I can use or some inline pseudo-latex like \vert?
Finally, if there is a keyword I can use, where are these keywords listed so I can look up the next one?


texts: How do I invoke a non-interactive lisp function interactively?

texts:
This is dim, but I've forgotten how to do this, and I can't work it out, sorry:

I'm in python mode with elpy, and I want to run the function
python-nav-beginning-of-defun
in a python buffer, to see what it does

M-x python-nav-beginning-of-defun

won't work, because the function is not a command (it has no interactive spec).

And putting (python-nav-beginning-of-defun) in a buffer and using C-x C-e will disturb the buffer and move the point.

I seem to remember that there's some way that I can type (python-nav-beginning-of-defun) in a mini-buffer somewhere, and see what it does to the python buffer, without disturbing the buffer.

Can anyone tell me what it's called / what the magic keys are?


texts: resize Emacs (GUI) window to exactly half the screen?

texts:
When I maximize the Emacs frame, it uses the full width of the screen, no background showing. But if I e.g. snap-to-edge (in XFCE), it shows a little "margin" of background outside the frame. And if I drag to resize, it always over- or undershoots the edge – it looks like it wants to always resize by whole lines/characters. Is there a way to have a 50% size Emacs frame that aligns with the edge of the screen?

(I'm using 20170203:93058-ce88155-emacs-25.1~ubuntu16.04.1)

Mousepad can take exactly 50% width and 100%height, with height from the top of the screen down to the panel:

Emacs seems to overshoot/undershoot:

When I "snap" Emacs to the edges with XFCE, it fits the width on my laptop, but not on my external monitor. It never matches the full height.


texts:
I apologize if this is a dumb question, but I'm just starting out in ELisp, and I'm wondering how you pronounce the word 'sexp'.

I.e., if I was talking to someone, how does one say this word?


texts: How to change org-babel interpreter location

texts: Say I have my ditaa interpreter pointed to at /home/user/.emacs.d/elpa/contrib/scripts/ditaa.jar, how would I set it so it points to a different location?


texts: Commenting out some JSX code section with Emacs 27 js-mode

texts:
When I comment out (M-x comment-dwim) some section of JSX code with the new js-mode in Emacs 27, it gives:
// <Grid rows={rows} columns={columns}>
//   <Table />
//   <TableHeaderRow />
// </Grid>

Is there any way to make js-mode behave like it does with rjsx-mode:
{/* <Grid rows={rows} columns={columns}> */}
{/*   <Table /> */}
{/*   <TableHeaderRow /> */}
{/* </Grid> */}

Supposing that this is not currently possible, and that js-mode is really the way to go forward for JS/JSX code (from the older rjsx-mode and js2-mode, as I vaguely understand), where would I go to study the code and possibly suggest a pull request to make it work?


texts:
I am running emacs (24.5.1) on Mac osx and using the solarized theme. For the gui version, the theme works well. If I run the application with the -nw flag:

/Applications/Emacs.app/Contents/MacOS/Emacs -nw

the colors for the theme get all wonky. I assume this is because:

TERM=xterm-256color

What would I need to put in my .emacs to give the following conditional behavior:

if (gui)
  theme=solarized
if (-nw)
  theme=wheatgrass

??


texts:
Many versions ago, if you opened a dos-line-end file on Linux you would see the extra ^M codes. Now it automatically recognizes the situation and puts "DOS" in the info bar and hides the extra ^Ms.

How can I exit "DOS" mode and switch back to Unix mode? How can I disable the auto-detection and force the files to be opened with Unix line endings and the DOS CR shown as ^M?


texts: When C-c C-c on a block in my org buffer, it collapses the whole buffer

texts:
How to avoid this behaviour? I use Prelude.
If I have a source block I want to evaluate, it will do so, but also it will collapse all the headings in the buffer, which is annoying.
Thanks for any help provided!


texts: What is the standard way to install packages for Emacs?

texts:
There are several methods to install and manage packages for Emacs:

package.el
el-get
use-package

What is the easiest way to install package? It seems package.el ships with the default Emacs installation.

I tried use-package, each time I start Emacs, it will take a few second to contact hosts like melpa...


texts:
Sorry for the newbie question. I have been using Aquamacs more many years. As it is not as actively developed as it used to and became increasingly buggy in the past two years I want to make the switch to Emacs.
I installed Emacs with homebrew and things are working well. However, I am struggling with  setting up my keyboard. The homebrew emacs-version (emacsformacosx) has Meta on command which I like. Is there any way to set up the left option key so that it does the same as it does globally that is produce special characters e.g. ü by typing option + ¨ + u?
I tried
(setq ns-command-modifier 'meta)
(setq ns-option-modifier 'none)

which works for the Umlauts but takes away functions from command such as open files with command + o.
Can anyone help?


texts: Triggering abbreviation expansion or auto completion automatically from a regular expression match?

texts:
With abbrev mode, I can define abbreviations that trigger when I type a certain term. For example, typing "yn" would be expanded to "Your Name". For this, "yn" must have been defined as an abbreviation before hand.

What I'm looking for is a setup in which rather than specifying the abbreviation terms explicitly, I can specify a regular expression that when matched gets expanded by the defined instructions.

A simple example would be that everytime I type a website as

website_name.org

it gets expanded to

https://website_name.org

I'm specifically looking for a solution that works like abbrev in that I don't have to invoke a command after typing my abbreviation to have it converted.


texts:
I would to include and preview some math formula inside an org-mode buffer, but can't find any way.
I've read about auctex but how can I enable it in a non tex-mode ?
Don't know really from where to start...
thanks in advance !


texts: yasnippet: problems with text-mode snippets

texts:
The snippets in the  text-mode subdir are authomatically loaded when I use certain other modes (e.g. latex-mode, cc-mode, ess-mode, etc). There is any way to stop loading snippets of parents mode?

For example, I'd like that when I work on an html file, only snippets defined under the for the html-mode are loaded in the YASnippet menu.


texts:
I managed to insert a template to certain sripts with autocomplete.

Example:

(auto-insert-mode)
(setq auto-insert-query nil)
(setq auto-insert-alist
  '(((ess-mode . "R script") nil
     "# R script " \n
     "# file: " (file-name-nondirectory buffer-file-name) "\n"
       "# Description: " _ "\n\n")))

However, when creating a new file, the buffer-tab is now not selected as with "visit new file". Meaning, that the selected buffer remains selected.
Can this behaviour be altered?

Admittedly, it is a minor problem, yet annyoing. Any help would be appreciated.


texts: gnus-article-mode-hook does not fire when opening an article in Gnus

texts:
I want to highlight keywords when I open an email (article) in Gnus. This is what I have so far.

(add-hook 'gnus-article-mode-hook (lambda() (highlight-phrase "\\(TODO\\|job\\|Mike\\)")))

I also tried this which did not work either.

gnus-article-prepare-hook


texts:
I want to set a default font in my Emacs (version 26.1, running on Arch, using Xmonad). I have tried various options in my init.el file (under .emacs.d). None seemed to work or persist when I restarted X.

The only thing that works and persists is specifying it in my .Xresources file, e.g. in my case Emacs.font: DejaVuSansMono-14

Is there a "standard" way of setting the default font in Emacs ? Is this it ? Is it dependent on the emacs version, i.e. this is the latest version 26.1

Thanks for any help.

Cheers,

Roy.


texts: How to fix UTF-8 in info buffer that doesn't correctly display in terminal?

texts:
I've just installed 24.5 on SUSE, and I have no windowing available, so I am using emacs in the terminal window. When I choose 'Read the Emacs Manual' from the 'Help' Menu, I see (for example) "type \u2018h\u2019 to read a basic introduction".

The other answers related to this topic seem to indicate the problem is with how the file is loaded. But, since this is the help, I don't have any obvious way to affect that. I can mostly not care about this, but it does make reading the help very difficult.

Does anyone have any insight into what configuration changes are necessary?


texts: Repeating any last command (complex or not)

texts:
Emacs has repeat and repeat-complex-command, that draw different commands from command history and are bound to different keys.  How do you repeat any last command - whether it was complex or not - with a single key? In other words, such a repeating command would behave like repeat-complex-command if the last command required input, otherwise it would behave like repeat.

EDIT: In other words, I am looking for a way to read the last command, complex or not, and then call either repeat-complex-command or repeat on it, whichever is appropriate. For instance, let's say that such a new command is bound to <f8>.  Then:

(mimicking C-x M-: (repeat-complex-command) with M-z (zap-to-char)): C-u M-z a <f8> <f8> will be equivalent to C-u M-z a C-x M-: RET C-x M-: RET
(mimicking C-x z (repeat) with C-f (forward-char)): C-u C-f <f8> <f8> will be equivalent to C-u C-f C-x z z

Now, repeat-complex-command requires you to confirm the Lisp form that will be executed.  To allow for repeating a complex command without confirmation, I have written an alternative version of repeat-complex-command, called repeat-complex-command-no-confirm (see below for the implementation). The problem is that I can't understand how to determine whether I should call repeat or repeat-complex-command-no-confirm when pressing <f8>.

--

(defun repeat-complex-command-no-confirm (arg)
  "Like `repeat-complex-command' but does not require confirmation."
  ;; Adapted from `repeat-complex-command' of Emacs 24.5.1.
  (interactive "p")
  (let ((elt (nth (1- arg) command-history))
        newcmd)
    (if elt
        (progn
          (setq newcmd elt)

          ;; If command to be redone does not match front of history,
          ;; add it to the history.
          (or (equal newcmd (car command-history))
              (setq command-history (cons newcmd command-history)))
          (unwind-protect
              (progn
                ;; Trick called-interactively-p into thinking that `newcmd' is
                ;; an interactive call (bug#14136).
                (add-hook 'called-interactively-p-functions
                          #'repeat-complex-command--called-interactively-skip)
                (eval newcmd))
            (remove-hook 'called-interactively-p-functions
                         #'repeat-complex-command--called-interactively-skip)))
      (if command-history
          (error "Argument %d is beyond length of command history" arg)
        (error "There are no previous complex commands to repeat")))))


texts:
If I use tramp to open a remote file, and subsequently run run-python, it tries to execute in the remote context (which is not what I want and super slow).

Any way of specifying a local context or disabling this behaviour?


texts: How can I turn off magit's warning that a commit message has a second line that is non empty?

texts:
Every time I have a second line in a commit message, magit prompts/warns me when commiting...

Is there a way I can turn this off warning?

I've found the following in the docs https://magit.vc/manual/magit.html#Initiating-a-Commit:

  Function: git-commit-check-style-conventions Check for violations of
  certain basic style conventions. For each violation ask the user if
  she wants to proceed anyway. This makes sure the summary line isn’t
  too long and that the second line is empty.

Which is a function defined here: https://github.com/magit/magit/blob/4b97f23ace4132b3313a1bca73dcbbcd06bb4b9b/lisp/git-commit.el#L624

Any thoughts how I can override / disable it?


texts: Orgmode #+INCLUDE: ---- Ignore text from included file, but not configuration lines

texts:
Is it possible to #+INCLUDE: config.org when exporting and have only the lines in config.org that start with # be included?

Say you have a file config.org like this:

Formats the style of captions. Adds margin to the caption (hang), makes the font small and puts the name of the caption in bold face.
#+LATEX_HEADER: \usepackage[hang,small,bf]{caption}

Then I'd only want the line with #+LATEX_HEADER to be included. But I'd still want the previous line to remain in the config.org file as an explanation to what the command does.


texts: How do I properly populate a function by iterating over an alist?

texts:
I've defined a function that is supposed to iterate over an alist, and use the CAR and CDR of each element in the list to populate the regexp in re-search-forward and the replacement string in replace-match, respectively. Here is what I have:

(defun search-and-replace ()
  (let ((alist '(("regexp" "replacement-str")
                 ...)))
    (dolist (search-pair alist)
      (point-min)
      (while (re-search-forward (car search-pair) nil t)
        (replace-match (cdr search-pair))))))

This returns an error: Wrong type argument: stringp, ("replacement-str"). What am I missing?

Edit:

Thanks for the help. Here's what I ended up with:

(defun search-and-replace (alist)
  (save-excursion
    (goto-char (point-min))
    (dolist (search-pair alist)
      (while (re-search-forward (car search-pair) nil t)
        (replace-match (cdr search-pair)))
      (goto-char (point-min))))

Where each item in ALIST is a cons cell of ("regexp" . "replacement-string").


texts: View a buffer in read-only mode in a window while editing it in another window

texts:
A buffer can be made write-protected by toggling the read-only mode via M-x toggle-read-only.
Is there a way to make a buffer read-only in a window, while editing it in another window?


texts: Removing and adding newlines around expressions

texts:
I am in the process of formatting a couple of hundred markdown files and am trying to automate that process. I am having two problems, but I guess I can ask two questions ;)

Goal

I am trying to achieve the following:

Every main title starting with # should have two newlines above and one newline below.
Every subtitle starting with two or more # should have one newline above and one newline below.

Example:

More text here
# The main title
## Another title

## The third title
   More text

# The second main title

more text here

## Second subsection

# Third title

more text

Should be formatted to

More text here

# The main title

## Another title

## The third title

   More text

# The second main title

more text here

## Second subsection

# Third title

more text

Attempt

I am not sure if this is best suited for regex or a well defined macro?

My attempt at regex has so far been

[#]+.*\n[^\n]

This is at least able to identify every title that is missing a newline underneath.

However, I have no idea how I would use the expression above to insert a newline after the title. Any help would be appreciated.


texts: org-journal: How to add new entry at current time?

texts:
I'm playing with org mode and org-journal for the first time. My basic entry looks like
* Wednesday, 02/24/2016
** 15:02 Blah blah blah

notes written here.

I would now like to append something to today's entry so that I get something like
** 15:37 A new entry

Here we go...

I can't find any way to do this via a key binding. Of course, I could enter the new time manually, but I don't want to do that. Is there some way to do this?
Edit: I have tried C-u C-j, which does indeed open the current day's journal with a new time entry, but this journal cuts opens on a second window

I'm not sure which version of org-mode I'm using, but it's probably the latest, since I installed it a couple of days ago.


texts: ibus-libpinyin input not working in fullscreen emacs

texts:
I'm using GTK emacs 26.3 on GNOME 3.34 using X.

When emacs is fullscreen, ibus-libpinyin is unable to render the pinyin suggestions. Input seems to still be working (i.e when I press a number a chinese character appears) but the suggestions fail to appear.

This problem doesn't happen when emacs is not full screen.

Any ideas?

As a side note, rendering works when firefox is full screen, so the problem is not in all full screen apps.


texts:
Problem

I have some org-mode tables with a column containing the duration (or length) of musical tracks:

|---+---------------------------------+-----------------------------------+----------|
| # | Artist                          | Title                             | Duration |
|---+---------------------------------+-----------------------------------+----------|
| 1 | Lorem ipsum dolor sit amet      | consectetuer adipiscing elit      |     7:32 |
| 2 | Donec hendrerit tempor tellus   | Donec pretium posuere tellus      |  1:09:27 |
| 3 | Proin quam nisl, tincidunt et   | mattis eget, convallis nec, purus |    10:15 |
| 4 | Cum sociis natoque penatibus et | magnis dis parturient montes      |     4:25 |
|---+---------------------------------+-----------------------------------+----------|

I'd like to convert the durations to start times.  The result of the converstion should look like this:

|---+---------------------------------+-----------------------------------+------------|
| # | Artist                          | Title                             | Start time |
|---+---------------------------------+-----------------------------------+------------|
| 1 | Lorem ipsum dolor sit amet      | consectetuer adipiscing elit      |       0:00 |
| 2 | Donec hendrerit tempor tellus   | Donec pretium posuere tellus      |       7:32 |
| 3 | Proin quam nisl, tincidunt et   | mattis eget, convallis nec, purus |    1:16:59 |
| 4 | Cum sociis natoque penatibus et | magnis dis parturient montes      |    1:27:14 |
|---+---------------------------------+-----------------------------------+------------|

Note

In the duration input

Durations will be given in terms of hours, minutes, and seconds, separated by colons
leading zeroes may or may not be present
(ie. a duration may look like "09:25" or "9:25")
the hours field may or may not be present
(ie. a duration might look like "9:25" or "1:09:25" or even "0:09:25")

In the start time output

minutes and seconds should always be present, even if they're zero
(ex: "0:00" and "0:32" are both correct)
if the left-most field is not a minute field and is 0, it and the colon following it should be omitted
(ie. output "12:24", not "0:12:24")
a field should be padded with leading zeroes if there is another field to its left
(ie. these are all correct: "1:09:26", "1:00:26", "1:00:00", "9:26", and these are wrong: "0:09:26", "00:09:26")


texts: Why doesn't "$^J" match a new line character after another line?

texts:
I want to match two or more consecutive lines with numbers only, e.g.:

abc
1
2
abc

In Emacs, my regex is \(^ *[[:digit:]]+ *$^J\)\{2,\}, but it doesn't match any. I find \(^ *[[:digit:]]+ *^J\)\{2,\} can match.

Isn't it true that $ doesn't consume a character, but signals the end of a line (just before a newline character)?

In Python, I remember it doesn't matter that I specify $\n or \n. So why does it matter in Emacs? Thanks.


texts:
everyone, I need that emacs matchit in evil mode works like that one works in vim. Let me explain. I have this lines of code

; {{{ matchit
(unless (package-installed-p 'evil-matchit)
  (package-install 'evil-matchit))
(require 'evil-matchit)
(global-evil-matchit-mode 1)
(setq evilmi-ignore-comments nil)
; }}} matchit

When I'm at position of closing curly bracket and press % nothing happens in Emacs. But vim jumps to corresponding open curly bracket.

Can you please help me with this different behaviour?


texts:
Is there a simple way to search within the current column or within a rectangle?

I am navigating a CSV file and would like to find the value "10" in a particular column.  Searching the entire file is unproductive.  However, it is easy to select the column with a rectangle.

I don't see any commands to search within a rectangle or to narrow to a rectangle.  The best I've been able to come up with is to copy the column and paste it into a scratch buffer and then search.

Any ideas?


texts: I can turn on minor modes like electric pair modes in my init, but they’re not having effect unless manually reactivated

texts:
So I can put a line like,
(setq-default global-linum-mode t)
or
(setq-default electric-par-mode t)
in my init file, and I can check with C-h v that the variables are in fact set to t (they are), but unless I actually M-x them on inside a file, they’re not having any effect. What might be going on?

I’m on an ssh terminal to a Debian Raspberry Pi, if relevant.


texts: How can I find non-displayable unicode characters in a buffer?

texts:
I mean these:

I'd like to remove them, so I'm looking for a function which can find all these characters in the buffer which cannot be displayed properly with the current font and therefore show up like a rectangle.


texts: Why after search-toggle-case-fold text is select?

texts:
windows 10, emacs 26.1

I want to set I-search case sensitive mode.
Before:

M-x isearch-toggle-case-fold

after:

Now it's search in case sensitive mode. Nice.

But why it select text?

P.S. If I start by emacs -Q it's same result:

Here steps of reproduce:

Start emacs -Q
Input some text
M-x isearch-toggle-case-fold
C-s (isearch) HELLO
C-g
M-x isearch-toggle-case-fold
and see result on step4.jpg


texts: How to use `column-marker-1` with every buffer?

texts:
Question may be very dumb, but I can't find the answer on the web :

I have a command C-u 80 M-x column-marker-1, and I want it to be launched automatically on every buffer I open. What should I add to my ~/.emacs.d/init.el to do that ?

Here is where column-marker-1 is defined : https://www.emacswiki.org/emacs/column-marker.el


texts: How can I go from a key 'code' back to its keyboard equivalency?

texts:
I have the following documentation:

mc/keymap is a variable defined in `multiple-cursors-core.el'.
Its value is (keymap
 (67108903 . mc-hide-unmatched-lines-mode)
 (27 keymap
     (118 . mc/cycle-backward))
 (22 . mc/cycle-forward)
 (return . multiple-cursors-mode)
 (7 . mc/keyboard-quit))

Documentation:
Keymap while multiple cursors are active.
Main goal of the keymap is to rebind C-g and <return> to conclude
multiple cursors editing.

[back]

I know that C-g and C-v are 7 and 22, respectively, but I've no idea what any of the others are.  Is there a function I can use to do this?

(equal (??? (kbd x)) x) => t


texts: Highlight a comma-separated list by using rx macro

texts:
I want to create font locking for string like:

interface Foo extends B, C, D, E {};

And I can't understand why my regexp rule doesn't work for font locking:

(defvar my-font-lock-keywords
  `(
    ;; Some code is omitted for brevity
    ;; ...

    ;; Just for example
    (,(rx "interface Foo extends B"
          (1+ ?,
              (syntax whitespace)
              (group (or "A" "B" "C" "D"))))
     1 font-lock-type-face)

    ;; Some code is omitted for brevity
    ;; ...
))

This test fails:

(ert-deftest my-mode-syntax-table/fontify-extends/3 ()
  :tags '(fontification syntax-table)
  (test-with-temp-buffer
   "interface Foo extends B, C, D, E {}; "
   (should (eq (test-face-at 23) 'font-lock-type-face))))

As I can see there is no problem with regexp:

ELISP> (require 'rx)
rx
ELISP> (string-match-p
        (rx (1+ ?, (syntax whitespace) (group (or "A" "B" "C" "D"))))
        "B, C, D, E")
1 (#o1, #x1, ?\C-a)

Of course I'm managed to succeed for other cases e.g.:

interface Foo {};

My real code is more complicated. I tried to give a simple example to show my problem.

How to correctly make font-lock regexp for the comma-separated lists?

Update: I'm managed to debug regexp (thanks to @phils) via M-x re-builder so as I said before there is no problem with regexp


texts: Racket Mode not working, although all requirements has been provided

texts:
I wanna do some Scheme. For this, I choose Racket language. And I'm Emacs user about 1-2 months.
So I think I did all requirements for writing Racket in Emacs. But still, I can't get racket-mode package in list of all packages in Emacs.
So firstly, I installed Racket to my computer. It's okay and I can write Racket in repl mode(but I want racket-mode).
After all, I know that I need Melpa for installing packages. But I can't find racket-mode in list-of-packages. This is image of packages I have.

So what's problem. Why I can't find racket-mode package
Some Points:
I write this code into init file and I have init file in .emacs.d directory
(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))

Don't recomment DrRacket I only use Emacs


texts:
I'm running Emacs (Emacs version: 25.2.2; org-mode version: 9.2.6-4-ge30905-elpa) on Linux Mint Ubuntu.

If I try to export my org file or subtree (C-c C-e) I get the dispatcher buffer without any option despite the fact that they are activated in the settings.

I don't have latex, odt, ... export options showing up in the dispatcher. How can this be possible? How can I fix this weird behavior?
I updated all the installed packages.


texts:
I'd like to extends this function to work as usual in most cases but if current line starts with * then it should indent and then insert *. Particularly i want to use it in multi line comments, i.e:

/**
  * multiline comment
  */

So when i press Ret, while writing a comment, it would add *.


texts: Overlay extending to the end of physical line

texts:
I'm trying to use overlay to highlight a whole line but for some reason my overlay stops at the end of the line (past the last character) instead of the end of the physical line (just before fringe). I'm certainly missing something obvious. Using the code below, ;; Test  is highlighted
but I would have expected ;; Test                                              .
;; Test

(save-excursion
  (goto-char 0)
  (let ((beg (point-at-bol))
        (end (min (point-max) (+ 1 (point-at-eol)))))
    (overlay-put (make-overlay beg end)
                 'face '(:background "#f0f0f0"))))

Update Answer given by @rpluim, I need to add a :extend t in the face definition.


texts: Why can't I use a variable when defining the color to draw a box with

texts:
I have defined 2 variables as such:

(defconst zenburn/bg-1 "#2B2B2B" "Zenburn palette: bg-1.")
(defconst me/helm-header-color zenburn/bg-1 "Custom palette: helm headers.")

(set-face-attribute 'helm-source-header nil
                    :background me/helm-header-color
                    :box '(:line-width 4 :color me/helm-header-color))

The background color is correctly applied but the box's color isn't. It seems I have to specify the raw hex string. Why ?


texts: Current time timestamp in org-capture-templates

texts:
In org-mode org-capture templates, what is the way to insert current time timestamp?

I've tried %U like so:

(setq
 org-capture-templates
 (quote
  (
     ("k" "Capture an item and schedule it for tomorrow" entry
      (file+headline "today.org" "_tomorrow")
      "* TODO %^{Task Title} %^G
SCHEDULED: %t
Added: %U @ %a" :immediate-finish t))))

but the %U shortcode always produces 00:00 time and the date is the same as the agenda view date at which the point is located at the time the org-capture is invoked.

By the way, I'd also like some suggestions on how to produce a "tomorrow" timestamp in the template, but that is probably a topic for another question.


texts: Make region(s) invisible (not evaluated) to query-replacy and similar commands

texts:
Is there a way to make some regions of the buffer invisible (I mean not evaluated by) to query-replace and similar commands?

Let me better explain with an example. Let's take a piece of LaTeX code

... in the following equation ,
\begin{equation}
x + y = z ,
\end{equation}

I need to replace the first " ," with "," (deleting the extra space) but the second " ," string, in the equation ambient it's not a problem and I'd like my query-replace to ignore it.

I figure out I could use a loop to assign some text properties to the regions I need to ignore but I've got no idea if that kind of text properties exist.

I'm also open to any kind of suggestion.

Workaround. Following Drew's answer I wrote this code that seems to work:

(defun skip-if-my-ignore (beg end)
  "Return nil iff some text BEG to END has non-`nil' property `my-ignore'."
  (catch 'skip-if-my-ignore
    (let ((pos  beg))
      (while (< pos end)
        (when (get-text-property pos 'my-ignore) (throw 'skip-if-my-ignore nil))
        (setq pos  (1+ pos))))
    t))

(defun query-replace-skipping-math-env ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (search-forward-regexp "\\\\begin{equation}" nil t)
      (save-excursion
        (let ((b (copy-marker (match-beginning 0)))
              (e (copy-marker (search-forward-regexp "\\\\end{equation}" nil t ))))
          (put-text-property b e 'my-ignore t))))
        (let ((isearch-filter-predicate  'skip-if-my-ignore))
          (perform-replace " ," "," t nil nil 1 nil (point-min) (point-max)))
        (remove-list-of-text-properties (point-min) (point-max) '(my-ignore))))

I tested it on:

... in the following equation ,
\begin{equation}
x + y = z ,
\end{equation}

... also in the following equation ,
\begin{equation}
2x + 2y = 2z ,
\end{equation}


texts: macro execution with i-search fails under Linux and succeeds under windows?

texts:
Imagine you've got file with FirstName|LastName| like this :

John|toto|
Hanz|titi|

and want to put the first names at the end of the lines (just an stupid exemple). You may use Macro Recordind for that and type:

  Arrow-down Home Ctrl-Space Ctrl-s | RET Arrow-left Ctrl-C End Ctrl-v

Under Linux, the execution of the macro rings the bell, hence doesn't work. But under Windows it works fine ! Isn't that a shame ? :)
If we look at the macro definitions, the results are just a very litlle bit different. Under Linux:

(fset 'makeMail2
      (lambda (&optional arg)
        "Keyboard macro."
        (interactive "p")
        (kmacro-exec-ring-item
          '([down home 67108896 19 124 return left 3 3 timeout end 22]
            0
            "%d")
          arg)))`

And under Windows :

(fset 'makeMail2Win
      (lambda (&optional arg)
        "Keyboard macro."
        (interactive "p")
        (kmacro-exec-ring-item
          '([down home 67108896 19 124 return left 3 timeout end 22]
            0
            "%d")
          arg)))

The only difference I see is left 3 3 versus left 3 under Windows.
Is this the cause of the fail ? Is this a bug or is it normal ? How can I make my macro work under Linux ?

NB: Linux Emacs version is 25, and Windows is 24...


texts:
I am generating a sparse tree typically using a regex (, / r ). What I am trying to do is get an overview of where in my document a match occurs, not the exact positions of the matches. So, if I have a heading with several kilobytes of plain text underneath that contains a match, I don't want my sparse tree to show the plain text, only the relevant heading.

So, given a doc:

* H1
** H2.1
Foo
etc
** H2.2
Bar
** H2.3
Foo
etc
etc

And a sparse tree generated for regex foo, I would want to see something like

* H1
** H2.1
...
** H2.3


texts: Fuzzy ivy: prioritize fewer numbers of groups

texts:
I enabled fuzzy ivy (via doom emacs), and I have one issue: when I type a word, ivy does not prioritize the entires that have "the smaller number of breaks". For example, if I type ote, and if I've two folders, one named Notes and one named Informatique, then izy will put Informatique first in the list (I guess because I visited this file more recently), while I would expect Notes to appear first because all the matching letters appear to be together:

Any idea if it's possible to customize ivy to avoid this issues?


texts: Can I visit an org-link from a buffer without changing window configuration?

texts:
I'm currently trying to streamline my email/org workflow. I have a function which adds links to an org-buffer if a mail message contains DCO style signoff tags:

(defvar my-dco-tag-re
  (rx (: bol (zero-or-more (in blank))                        ;; fresh line
         (any "RSTA") (one-or-more (in alpha "-")) "-by: "    ;; tag
         (one-or-more (in alpha blank "<>@."))                ;; person
         eol))
  "Regexp to match DCO style tag.")

(defun my-capture-review-tags ()
  "Return a list of tags for current buffer"
  (let ((tags))
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward my-dco-tag-re (point-max) t)
        (add-to-list 'tags (match-string-no-properties 0))))
    tags))

(defun my-org-maybe-capture-review-tag ()
  "Check buffer for DCO tags and if found queue a review comment."
  (interactive)
  (when (my-capture-review-tags)
    (org-capture nil "g")))

This works well enough. However I now want to programatically go through my org links and grab the tags from the messages on demand. Is there a way to visit an org-link without messing with the window configuration? I've tried the following so far to no avail:

(defun my-org-visit-link-and-snarf-tags ()
  "Visit org-link-at-point and return a set of tags."
  (save-excursion
    (save-window-excursion
      (org-open-at-point t)
      (my-capture-review-tags))))

Any suggestions?


texts:
I want to use the repeat-duration of tasks in the org-agenda-cmp-user-defined value of my custom agenda view.

For example, let's say I have the following task.

* TODO Reticulate Splines
SCHEDULED: <2018-04-14 Sat 00:00 +56h>

How can I extract +56h (or some representation thereof) from the text properties?


texts: Where is mhtml mode defined? And why am I getting it by default when I open HTML files?

texts:
Under some very special conditions (namely, performing one particular edit in one particular HTML file), my Emacs session will freeze completely, and starts consuming ~100% of the CPU.  The only course of action at this point is to put the poor beast to sleep (with well-aimed kill -9; it won't work without the -9).

I'm trying out characterize the conditions that lead to this behavior.

All I know is that it happens, as I wrote, when I perform a particular edit on this one particular file, AND the major mode for the file is mhtml.  (The problem does not occur if I perform the same edit on that same file while the active mode is plain-ol' Fundamental.)

I can't figure out why mhtml is the initial major mode for this file (when I open it).

If I search for mhtml in my .emacs file, I get no hits.  Is mhtml the default mode for HTML files?

(For what it's worth, the packages listed by list-packages do not mention mhtml at all.)

Bottom line is: I can't figure out what mhtml mode is, or why I'm getting it by default.  It may be something I have in my .emacs, but if so, it's not obvious to me what it is.


texts: Run local command on remote file with TRAMP?

texts:
Having a remote directory open in Emacs (... via TRAMP), I can run remote commands on remote files (using !). I can also view them locally (... even if they're image files) with builtin Emacs viewers (just "Enter"), resulting in the file being copied over to the local disk transparently.

Is there a way to run a non-Emacs command that's only available on the local machine (... on which Emacs is running; e.g. an X11 pdf viewer), with the input being the remote file, in a way that's simpler than copying over the remote file manually first?


texts: How do I configure emacs to stop adding an extra closing bracket when hitting space?

texts:
I'm using web-mode to edit my erb files. When I type <% emacs (or web-mode) adds a closing %> bracket. But when I type a space after the percent sign (i.e. %), an additional %> bracket is added.

I'm using prelude so there's a clue in prelude-web.el but I'm not sure how to interpret it. The relevant looking code looks like this:

(sp-with-modes '(web-mode)
  (sp-local-pair "%" "%"
                 :unless '(sp-in-string-p)
                 :post-handlers '(((lambda (&rest _ignored)
                                     (just-one-space)
                                     (save-excursion (insert " ")))
                                   "SPC" "=" "#")))
  (sp-local-pair "<% "  " %>" :insert "C-c %")
  (sp-local-pair "<%= " " %>" :insert "C-c =")
  (sp-local-pair "<%# " " %>" :insert "C-c #")
  (sp-local-tag "%" "<% "  " %>")
  (sp-local-tag "=" "<%= " " %>")
  (sp-local-tag "#" "<%# " " %>"))

How do I configure emacs to stop adding these additional characters?


texts: Force org to use `:` instead of `begin_example` for source block output

texts: When executing a source block in org mode with the output set to verbatim, it will sometimes wrap the results in an #begin_example block, and sometimes it uses : symbols at the beginning of the line. How can I force it to do one or the other?


texts:
Q: is there a way to rotate between multiple expansions bound to the same abbrev?

I'm experimenting with abbrev-mode, and I have some abbreviations that I'd like to use for different expansions of the same abbrev.

For example, I often use the abbreviation "st" for "sometimes", but occasionally use it to mean "such that".  I'd like to know if there's a way to bind the "st" abbrev to produce "sometimes" as its default expansion, but allow me to select "such that" as a secondary expansion.

Sound goofy?  Here's how it's working in my mind.  Let's say I've got a hypothetical command expand-abbrev-and-rotate bound to the tab key and * representing point:

some text st*tab => some text sometimes*
some text sometimes*tab => some text such that*
some text such that*tab => some text sometimes*
... and so forth, rotating among a short list of possible expansions (2 in this case)

Does abbrev-mode have anything that could approximate this behavior?  I've been peeking at the internals and can imagine a way to implement it, but wouldn't want to reinvent the wheel.


texts: How to change background of Org-mode's source code block only from the indentation of #+BEGIN_SRC?

texts:
In Org-mode, I wonder if the background color of the source code block can be changed only from the indentation of #+BEGIN_SRC?
Here is the current background in my Org-mode:

Is it possible to change its background to something like this?
Note that the background of the first few columns of the code environment is unchanged.


texts: Emacs Mac OSX after upgrade to 26.2 launches only in `-nw` mode

texts:
I upgraded to Emacs 26.2 on my Mac OSX Sierra instance via "brew".

After the upgrade, the emacs command will not open a new "GUI window", i.e. it runs as if I passed the -nw args or ran it from an ssh session.

I.e. it does not seem to recognize the Mac windowing system:

This behavior has changed since yesterday.

From the docs
     Using Emacs with X
           Emacs has been tailored to work well with the X window system.  If you run Emacs from under X win-
           dows,  it  will create its own X window to display in.  You will probably want to start the editor
           as a background process so that you can continue using your original window.

How can I launch Emacs without it being in terminal (nw) mode?


texts: speedbar -- mark/unmark directories/files -- `speedbar-get-marked-files`

texts:
Q:  Is there a publicly available plugin/modification for the speedbar.el library to mark/unmark and essentially implement speebar-get-marked-files similar to dired-mode's dired-get-marked-files?

If such a feature does not yet exist, then this thread can be used to create that new feature and combine it with the power of dired-do-create-files and dired-create-files for file management capabilities -- i.e., copy, rename, etc.

The following screenshot demonstrates the concept using dired-mode and dired+ to the right, the middle is a custom creation modifying ztree, and the left is a slightly modified version of speedbar.  The goal will be to create a plugin/modification that works out-of-the-box with a generic/stock version of speedbar.


texts: Function to redistribute list into columns

texts:
I have a list in an org document that is rather long

- alpha a
- beta b
- gamma
- delta d
- epsilon e
- zeta z
- eta
- theta
- iota
- kappa
- lambda
- mu

I would like a function that redistributes this block of text into n columns where n is specified by me. So issuing M-x desired-function <ret> 2 <ret> would return something like

- alpha a    - eta
- beta b     - theta
- gamma      - iota
- delta d    - kappa
- epsilon e  - lambda
- zeta z     - mu

and issuing M-x desired-function <ret> 3 <ret> would return something like

- alpha a  - epsilon e  - iota
- beta b   - zeta z     - kappa
- gamma    - eta        - lambda
- delta d  - theta      - mu

Such a function would probably break the functionality of the list in the org document but that wouldn't really bother me.

Does this exist in emacs?


texts: How to copy the search result (using Swiper) from search buffer in doom emacs?

texts: I search the line containing rowid in the buffer, and want to copy all the lines in the result window. How to do that?


texts: What's the easiest way to implement a function like format-time-string

texts:
The
format-time-string
function takes a string, and replaces a set of special constructs in
that string (characters preceeded by %) with some specific text.

I'd like to implement a functionality like that in a function of my own:

I have an alist between chars and symbols like: '((?n . name) (?r . reputation)).
The function should take a string like "My name is %n, and my rep is %r".
It should replace %n and %r with the value of the variables name and reputation, and return the result.
It should handle %% just like format-time-string (replace it with %).

What's the easiest way to implement this function?
Is there a library or function that will facilitate this? Handling %% correctly is important.


texts: How can I shorten the buffername in (smart) mode line?

texts:
I like to shorten the buffername in mode-line to a specific number of characters. I am using the following code to do it,
(setq-default mode-line-buffer-identification (list  -20 (propertized-buffer-identification "%12b")))

This code only keeps first 20 character of the file name. Since I am dealing with many files with long names and different types, I want to see the first 20 character then three dots followed by file type. For example
aaaaaaaaaaaaaaaaaaaa***.org

or
aaaaaaaaaaaaaaaaaaaa***.pdf

I would appriciate to see your suggestions. By the way, I am open to smart-mode-line. If you think that there's a way to do this via sml, I would like to learn.


texts: What are the options to play music from within Emacs?

texts:
I have a bunch of music (.mp3) files on my disk, and I would like to play them from within Emacs.  I tried EMMS, but it seems rather bloated. I'm curious about other possibilities, with comparison of features.  In particular, I am interested in these:

Simple - Whether the given player is simple enough to start using it within a few minutes, including installation and learning the basics.
dired integration - So that I can e.g. mark some music files in dired and have them played/added to the playlist.
Editing capabilities - I would like the ability to edit id3 tags.


texts: AUCTeX fontification for any command: overkill?

texts:
Reading the AUCTeX manual I see that it is possible to add expressions to those one wants to highlight in a .tex file. There are also many specific suggestions around for how to add specific commands to the list font-latex-keywords. Now, coming from another editor (ST3) where it seems that the default is to highlight anything starting with \, I wonder whether there's any reason not to do this in Emacs and, if not, exactly how to do it.

(From what I understand, you can't use a regex to specify a list of keywords, is that right?)


texts:
I started using CEDET with Emacs and although it works fine sometimes it is too slow.

For example if I write std:: and wait for suggestions then in the minibuffer says parsing file.cpp (LL) done
and for 1-2 seconds it freezes and I can't write. Then if I repeat it although it doesn't say anything in the minibuffer it still freezes the same. Eventually it shows the list of possible items but after that "freeze time".

Why is that happening? How can I fix it? I don't thing that this is the default behaviour as it is very annoying.


texts: How to display overlay like this screencast?

texts: How to make an overlay in Emacs like the following (maybe it's not overlay, I don't know, it's from company-coq inline-docs):


texts: How can I change the TODO state of a task in a given date?

texts:
I want to change the TODO state of a task automatically on a give date.
I would expect something like this:

* FUTU Some task that only becomes actionable of a given date
:PROPERTIES:
:ACTIONABLE: some-function(<timestamp>, TODO)
:END:

This block should automatically change the task to a TODO state once the date is reached.
Is there a package that can do this?

Regards,


texts: How to avoid a dialog box for input (e.g. "Open File" behavior)?

texts: I generally like to use the emacs-gtk3 package for my editing since I find it has better compatibility with my clipboard and a couple packages I use..but I don't like opening files in the GUI version of emacs. I like how I can open a file from the nox version and I can type the path to the file. I find it much more efficient. Is there a setting to prevent Emacs from using the GUI file manager and instead use the one that shows up at the bottom bar? I can't find an answer in any of my searches.


texts: fill-paragraph on multiple paragraphs at once

texts:
I often cut and paste non "filled" text into text files (mostly in org-mode).  I then have to go line by line and call fill-paragraph or org-fill-paragraph in org-mode to clean up the text.  I was wondering if there's a way to apply this operation to multiple paragraphs at once maybe in a region.  For example, if we have the following paragraphs in org-mode with fill-column set to 20:
- This is the first paragraph.
- This is the second paragraph.

I'd like to mark both with a region, and then have them transform into:
- This is the first
  paragraph.
- This is the second
  paragraph.

It seems that fill-region is suppose to do this.  I've tried calling it with various parameter combinations but it just condenses that entire region as one paragraph:
- This is the first
paragraph. - This
is the second
paragraph.


texts:
Org mode only print the last line into result block, can I get all print code into result block?
for example:

#+BEGIN_SRC emacs-lisp
(setq my-list '(apple orange peach))
(print (car my-list))
(print (cdr my-list))
#+END_SRC

#+RESULTS:
| orange | peach |

Now it only capture the last print statement, I wish to capture:

#+RESULTS:
: apple
| orange | peach |


texts:
I've got a superior heading and text under it, which is nicely indented. Then I added a sub-heading and put in text, which is also nicely indented even more to the right. Now, I want to get back to entering text indented at the superior heading's level with appropriate indenting:

* heading1
 Some text...

 ** heading2
    Some text

 continuation of heading1 text

I can't seem to get org-mode to let me go back to the superior heading's indentation column; it wants everything to remain at the sub-heading's indentation column.


texts:
How can I force Emacs to use tab button and TAB character in "normal stupid way"[1], like in nano or VScode or JetBrain's IDEs. All I can find is smart-tabs package and indent-tabs-mode, but that not what I looking for. At this moment I am using [source]
(setq-default indent-tabs-mode t)
(setq backward-delete-char-untabify-method nil)
(setq indent-tabs-mode t)

(defun my-insert-tab-char ()
  "Insert a tab char. (ASCII 9, \t)"
  (interactive)
  (insert "\t"))
(global-set-key (kbd "TAB") 'my-insert-tab-char) ; same as Ctrl+i

But it doesn't feel right, in python code for example, if I press RET after for i in range(10): Emacs will use spaces for indentation instead of tab character. So is there simpler way to do it? Also I will grateful if you suggest me some package for auto replacement spaces with tabs[2] and visualize them like | symbol.
P.S. I use Doom Emacs 26.3
EDIT
[1] When I press TAB I want Emacs to insert TAB character (\t). If there are several TABs in text, pressing Backspace I want to delete only one.
[2] Example:
for i in range(10):
....if a == 1:
........func()
....else:
........other_func()

↓
for i in range(10):
<-->if a == 1:
<--><-->func()
<-->else:
<--><-->other_func()

Where . is space and <--> is TAB character


texts: How can I use `TAB` with `M-x` to cycle through commands matching minibuffer input

texts:
I am finding completion in Emacs system to work similarly to bash completion, in the sense that upon pressing TAB, it presents the user with a list of possible options.
However, I am looking for something more similar to zsh, where pressing TAB completes my input to the nearest match, and pressing TAB again subsequently cycles through remaining matches. Does something like this exist in Emacs?


texts: debugging: how to optimize a RealGUD workflow

texts:
I code in Python and I my workflow uses debuggers (I coded for 8 years in Matlab).

I develop numerical simulation codes: most of the time it returns a result, the question is: "Is the result right?"

Consequently, I use the debugger to track constantly variables' content.

Here is my workflow:

I code a bunch of lines
M-x realgud:ipdb RET the_name_of_the_file_i_want_to_debug RET
I set one breakpoint in a tricky part of the code I want to inspect
M-x isend-associate RET *ipdb thefile shell* RET
I test the lines I feel might be wrong: M-x isend-mode RET C-RET (on the line I want to test in the interpreter)
I find the mistake and the right code, I change the file: C-x C-q (this command leave at the same time the read-only-mode and the single keystroke mode of realGUD), I modify the code, save C-x C-s
I go back in realGUD activating again the single keystroke: C-x C-a C-q (all the breakpoints are still present)
I restart the debugging process: r
I check and continue to debug other parts of the code.

I have one general question, and 3 technical questions:

general question: What do you think of this workflow, how would you optimize it?

technical questions: I am on Mac OS X 10.11, using emacs 25.3 (9.0), and ipython 6.2.1, consequently I need to pass the argument --simple-prompt to IPython to make it work. I think, it creates these problems:

I cannot use isend with a python line distributed on several lines (long command), so I had to turn off the auto-fill-mode,
I cannot use completion on defined variables (a HUGE drawback): lets say I define oiseau = "bird" in a previous part of the code, then the ipdb debugger opened by realGUD does not let me complete if I type: oise + TAB

the last technical question:

debugging pyQt when creating GUI does not seem to work (not central in my work but still disappointing...)


texts:
I am running my R scripts on a remote shell using

M-x shell
ssh -X -C name@server.edu
srun -p nodeX --pty R  (slurm command to start R)
M-x ess-remote and select 'R'

everythink works fine, until I want to break (usually C-c C-c within shell). Breaking also does not work using the menu bar. It keeps running.
Any suggestions as to what I'm doing wrong?


texts: Limit virtual memory for all emacs sub-processes

texts:
I know I can use

ulimit -v ###KiloBytes###

to limit the virtual memory of a shell and all subprocesses started by it, but it's annoying to have to open emacs from a shell everytime just for such a limit.

I want my REPL's and shell-mode buffers to crash earlier if I run some infinite loop that tries to use up too much memory.

Is there a way to set a virtual memory limit from my .emacs file?


texts: gud opening source in gud interaction window

texts:
When debugging with gud and gdb in many-windows mode, some source files are opened in the gud interaction window instead of the source window.

This appears to happen to files, and only those files, which were open in Emacs before gud was started.

I've replicated the behavior without my environment using emacs -Q

This is currently in version 24.5.1 but I also experienced the behavior in 24.4.

My bug report is here: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22374

Thanks.


texts: Create a buffer for a new file without naming the file

texts:
The typical workflow in other text editors is that you are presented with a blank window, to start typing into, and then when you exit the editor (or kill the buffer if applicable, close the window in some editors - in general any action that would normally prompt to save), if you have typed anything, it will prompt you to save modifications and prompt you for a filename if you answer yes.

Is there a way to replicate this workflow in Emacs - i.e., have a buffer that does not have a filename (the buffer name would be something like *unsaved file*, I suppose), but prompts to save?

Creating a buffer by typing an arbitrary name after C-x b results in a buffer that won't prompt to save.


texts: How faster show multicursors on the end of all lines?

texts:
Som teext

1111111111
2
33333
4444444444444
5555 9999
6666   aaaa
aaaaaa
zzzzzzzzz
hello
prev
do this

My steps:

Put cursor to the beginning of first line (1111111111)

Press C-> (mc/mark-next-like-this) 10 times.

Press End

Nice. It's work.

But is it possible to do this faster? Without 3 steps.


texts: How to write regex to change the go keywords color?

texts:
I want to change the  color which in package import go defer in go-mode ,need a regex..these code only change the pacakge word color

    (defface my-font-lock-gokeyword-face
    `((t (:foreground "#ab4642"))) ;; change to desired color
    "Face for go keyword.")

    (font-lock-add-keywords 'go-mode
    ;; change to desired operator regex
    '(("package"  0 'my-font-lock-gokeyword-face)))


texts: emacs command-line-default-directory variable is not set correctly

texts:
I'm using Emacs on Windows.

I also have a VirtualBox VM that I connect to using plink.

But then, when I use the eshell, and I do cd <some folder> it tells me No such directory found via CDPATH environment variable even though I started the eshell from a dired buffer and directly typed cd folder.

I think the key is to make this variable command-line-default-directory follow the directory where the buffer is opened at?

Just to reiterate my question, suppose I'm in C://plink:<username>@<ip>:/home/asti/folder, I want to be able to type cd foldername and not get the error No such directory found via CDPATH environment variable.


texts: How do I insert text with a specific face?

texts:
I have a face, created this way:

(defface test-face
  '((t . (:height 2.0)))
  "A face for testing.")

I'd like to insert some text with that face. But these ways insert the text without the face:

(insert (propertize "text to insert" 'face 'test-face))

(let ((current-string "text to insert"))
  (put-text-property 1 (length current-string) 'face 'test-face)
  (insert current-string))

And even inserting the text first, then going back to put the face on it isn't working:

(progn
  (insert "text to insert")
  (add-text-properties
   (save-excursion
     (backward-word 3)
     (point))
   (point)
   '(face test-face)))

The problem isn't the definition of the face, because if I go to customize it, it's already showing up with height twice as big. Even so, inlining the face also doesn't work:

(insert (propertize "to insert" 'face '(:height 2.0)))

So how can I put in some text with the specific face? I know I can use an overlay, but that seems like overkill because it's more verbose, requires the text to be inserted first (so we have to find out the size and position of the text to be overlaid) and requires making more garbage to be collected.


texts: Can one toggle inline image show 'at point' in org-mode?

texts: I know there's org-toggle-inline-images function, is there something like org-toggle-inline-image-at-point?


texts:
Quick question, and happy to delete if not in scope.

I use the load-theme command to change the theme of Emacs to one of the custom themes.

Is there a place that gives a (visual) overview of the looks of these themes, preferably in different programming languages?

Did not find anything in searching. Thanks!


texts: How to remove git stashes when inside magit-status

texts:
Inside the magit-status, I see tons of stashes.

Can I removed them by pressing a key on the keyboard?


texts: Adding a line to the beginning of every function in a (ruby) source code file

texts:
Supposed I have a source code file (classes) and some methods in that file.

see
https://github.com/railstutorial/sample_app_rails_4/blob/master/app/controllers/users_controller.rb

I want to add a "debug print" statement to the begining of every function.

So

  def new
    @user = User.new
  end

should end up looking like

  def new
    Rails.logger.debug "DEBUGTRACE1"
    @user = User.new
  end

How would emacsens do something like this quickly?
I am mildly familiar with regexps thanks to perl training.


texts: I have Sanskrit and English in the same buffer, and I'm wondering if it's possible to have one font for Sanskrit and another for English. Is this possible? How would I do it?


texts:
I have this:

#!/usr/bin/bash

        while read f; do
            {

#Try
        echo "$f"

}

|| {

# Catch

printf "error"

}

    done < "${1:-/dev/stdin}";

And I would like this in one sweep

while read f; do
    {
        #Try
        echo "$f"
    } ||
    {
        # Catch

        printf "error"
    }
done < "${1:-/dev/stdin}";

For now I have to remove any blanks between the last properly indented line and the next one and do RET between the two, do the same with the next line, for all lines.


texts: Select text on first line AND another text on third line by regexp

texts:
Suppose I has 2 jsons:

{
    "action": "Handler:GET_DICTIONARY",
    "locale": "en",
    "data": {"dictionary_type":"EXCHANGE_RATES_AS_DICTIONARY"}
}

and

{
    "action": "Handler:GET_DICTIONARY",
    "locale": "en",
    "data": {"dictionary_type":"MTS"}
}

I need to select only second json by regexp.
The unique text to identify second json are:
on first line:
GET_DICTIONARY

AND
on third line:

MTS

What is a correct regexp for this?

I try this regexp but it not help:

"GET_DIRCTIONARY C-q C-j
MTS"


texts: replace-regexp: invalid use of \ in replacement text

texts:
One of my collaborators has written a long rtf document that goes like this.

a paragraph of text

(1) some text

another paragraph or two of text

(2) some text

another paragraph or two of text

And so on. I've opened the file in emacs and I was trying to run replace-regexp to turn the parenthesized numbers into \exx{ , where \exx{ is a newcommand I have defined in the preamble and will take turn of sequential numbering. However, if I type

M-x replace-regexp ^([0-9]\{1,2\}) RET \exx\{ RET

Then I get the following error message

Invalid use of `\' in replacement text

I have tried using this alternative expression

M-x replace-regexp ^([0-9]\{1,2\}) RET \\\\exx\\{ RET

But this simply replaces (1) and subsequent numbers with \\exx\{ , which is not what I want. Every other combination of backslashes that I have tried returns the Invalid use of \ in replacement text error.

I know I can use sed to get regexp replacement I want, but that is not the issue. I'm asking this question here because I want to understand how to do this particular type of regexp replacement internally to emacs.


texts: adaptive-wrap-prefix-mode behavior is different/inconsistent inside a buffer

texts:
in org-mode I have adaptive-wrap-prefix-mode on.
The indentation though has a inconsistent behavior.
I have already tried to toggle visual-line-mode and word wrap but the sometimes correct and sometimes wrong indentation does not change.

adaptive-wrap-prefix-mode is a variable defined in ‘adaptive-wrap.el’.
Its value is t
Local in buffer Bibliothek.org; global value is nil

  Automatically becomes buffer-local when set.

Documentation:
Non-nil if Adaptive-Wrap-Prefix mode is enabled.
Use the command ‘adaptive-wrap-prefix-mode’ to change this variable.

[back]

and here the active modes
Enabled minor modes: Abbrev Adaptive-Wrap-Prefix Anzu
Async-Bytecomp-Package Auto-Composition Auto-Compression
Auto-Encryption Column-Number Company Counsel-Projectile
Delete-Selection Ede Electric-Indent Electric-Pair File-Name-Shadow
Font-Lock Global-Anzu Global-Auto-Revert Global-Company Global-Ede
Global-Eldoc Global-Font-Lock Global-Git-Commit Global-Hl-Line
Global-Magit-File Global-Semantic-Decoration
Global-Semantic-Highlight-Func Global-Semantic-Idle-Completions
Global-Semantic-Idle-Local-Symbol-Highlight
Global-Semantic-Idle-Scheduler Global-Semantic-Idle-Summary
Global-Semantic-Show-Unmatched-Syntax Global-Semantic-Stickyfunc
Global-Semanticdb Ivy Line-Number Magit-Auto-Revert Mouse-Wheel
Override-Global Projectile Recentf Savehist Semantic Shell-Dirtrack
Show-Paren Size-Indication Tooltip Transient-Mark Volatile-Highlights
Which-Key Ws-Butler Yas Yas-Global

(Information about these minor modes follows the major mode info.)

Org mode defined in ‘org.el’:
Outline-based notes management and organizer, alias
"Carsten’s outline-mode for keeping track of everything."
...

How can I change my settings so that words are always truncated and indented correctly.
What is the cause of this problem?


texts: What is archive-contents and how do I create it?

texts:
I used cask package to generate a package tar file for my local fork of ensime, and added it to my package-archives using customize-option. However, I then got this backtrace when attempting to list-packages:

Debugger entered--Lisp error: (file-error "Opening input file" "no such file or directory" "/home/hackthetower/ensime-emacs/dist/archive-contents")
  insert-file-contents("/home/hackthetower/ensime-emacs/dist/archive-contents")
  package--download-one-archive(("hackthetower" . "/home/hackthetower/ensime-emacs/dist") "archive-contents")
  #[0 "\301\300\302\"\207" [("hackthetower" . "/home/hackthetower/ensime-emacs/dist") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"]()
  funcall(#[0 "\301\300\302\"\207" [("hackthetower" . "/home/hackthetower/ensime-emacs/dist") package--download-one-archive "archive-contents"] 3 "\n\n(fn)"])
  package-refresh-contents()
  list-packages(nil)
  call-interactively(list-packages record nil)
  command-execute(list-packages record)
  helm-M-x(nil "list-packages")
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)

Indeed, this archive-contents file mentioned in the backtrace doesn't exist. How am I supposed to create it?


texts: Make Org report: "Bob's 21st birthday" like imported diary entries do

texts:
When you have:

(setq org-agenda-include-diary t)

set, then an entry in the ~/diary file like this:

%%(org-anniversary 1950 02 14) Bob's %d%s birthday

displays as:

Diary:    Bob's 65th birthday

in the Org agenda.

How do I get the same effect - reporting the number of repetitions whether it be measured in years or days or whatever - using normal Org syntax in an .org file so that I can also take advantage of other Org features such as TODOs etc?

None of the following expand the %d or %s:

* Bob's %d%s birthday
  <1950-02-14 Tue +1y>

* Bob's %d%s birthday
  <%%(org-anniversary 1950 02 14) Bob's %d%s birthday>

* Bob's %d%s birthday
  <%%(org-anniversary 1950 02 14)> Bob's %d%s birthday


texts:
I have the following in my .emacs file.
(require 'astyle)
(add-hook 'c-mode-hook (lambda () (setq astyle-on-save-mode t)))
(add-hook 'c++-mode-hook (lambda () (setq astyle-on-save-mode t)))

For files ending in .c or .cpp everything is golden. Each time I save I see a "formatting" message and the buffer is correctly formatted prior to save.
With .h files, not so much.
Is there an h-mode-hook or is this a known bug in Emacs?
The buffer clearly "thinks" it should be running astyle.

When I save, it does nothing. When I execute "astyle" from the command prompt I see the buffer perfectly formatted.


texts: How to remap the tab key in emacs evil mode to act as escape key?

texts:
This took me way too long to figure out so I'm asking the question and answering it.

In my .emacs/init.el I was trying many things:

(with-eval-after-load 'evil-maps
    (define-key evil-insert-state-map (kbd "\t") '[???]))

What's the value I put in there? All I want to do is to have the tab key get me from insert mode to normal mode!


texts: How can I get a font-locked string just as substring it from a buffer under specified major mode?

texts:
Suppose I have a python-mode user buffer with content import os, I can use (buffer-substring (point-min) (point-max)) to get a colorized string

#("import os" 0 6
(fontified t face font-lock-keyword-face)
6 9
(fontified t))

But now I want to generate this using emacs lisp code like

(setq string
      (with-temp-buffer
        (python-mode)
        (font-lock-mode 1)
        (insert "import os")
        (buffer-substring (point-min) (point-max))))

but got result

#("import os" 0 9 (fontified nil))

So my question is how can I generate the same string just as I substring it from a truly existed user buffer?

Thanks in advance.


texts:
I have TeX files that Aquamacs compiles by default with pdflatex and other files compiled by default with latex (so I get a dvi).
If I make a copy of file that Aquamacs compiles with latex, that copy is compiled with latex. Similarly, a copy of a "pdflatex file" will be compiled with pdflatex.
I can't see where there could be some metadata of my TeX files that could tell Aquamacs with which engine it has to compile.
I have setq-default TeX-global-PDF-mode t in my .emacs
What determines which compilation is done?


texts: Can't type SPC in second prompt on rgrep

texts:
Linux Mint 20, Emacs 27.2
I want to find text "end" in the org files AND java files in my folder (recursively). So I use rgrep
M-x rgrep

Step1

Step2

But when I try to input *.org SPC *.java, I can't type SPC.  I get message "No match"
I know that I can use C-q SPC but I want type SPC only by type SPC


texts: Highlight missing double-space between sentences?

texts:
For a while, I've been using sentence-end-double-space: nil. Now I want to get back into the habit of using two spaces to separate sentences. It is the convention for GNU documentation, and it actually makes sense: That way periods after abbreviations can semantically be differentiated from periods at the end of a sentence. Still, when typing, I forget to write the double space.

Is there a mode that helps me highlight my omissions?

Of course, it would also highlight a single space after an abbreviation, but that's fine.

Note that if sentence-end-double-space: nil has been set for the current buffer, then single spaces should not be highlighted.


texts:
How to print, all file extensions & the mapped major modes (and possibly minor modes...) in emacs?
like this,

*.js     js-mode
*.json   js-mode
*.c      c-mode

Which global map variable contains this information?


texts: Conditional inclusion of paragraph (org-export)

texts:
It seems the @@latex: @@ and @@odt: @@ does not work for lists or paragraphs with blank lines.
For instance

@@odt:
  - Xyzzy!

  - Nothing happens
@@

is exported to latex.

How can I have some paragraphs exported only by one backend?


texts: getting adaptive-wrap-prefix-mode to fill with spaces

texts:
Hi I'm working on some assembly language files.
Here is a relevant snippet
            // Wait for line $ff and prepare next frame
loop2:      lda #$ff                            // <- Inside the scope labels can collide so we use 'loop2'
            cmp $d012
            bne loop2

What I'd like is for the comments to wrap where they are. i.e. a comment should wrap and be indented where the original comment began.
This should in theory be possible with visual-fill-column-mode and adaptive-wrap-prefix-mode - it should just be a matter of setting adaptive-fill-regexp to .*// and according to the documentation:

the candidate must match this regular expression, or match comment-start-skip. If it doesn’t, fill-context-prefix replaces the candidate with a string of spaces of the same width as it.

So I should get a string of spaces to give me an indent to match the original comment start.
Instead however I get this:
            // Wait for line $ff and prepare next frame
loop2:      lda #$ff                            // <- Inside the scope labels can
loop2:      lda #$ff                              //collide so we use 'loop2'
            cmp $d012
            bne loop2

Which is what you'd expect if the space-filling logic described in the doc wasn't working.
I've even tracked down the code in emacs (fill.el.gz), and it seems like it should do what I expect, but I don't have the knowhow at this point in time to actually debug it myself.
;; If first-line-prefix comes from the first line,
;; see if it seems reasonable to use for all lines.
;; If not, replace it with whitespace.
(if (or (and first-line-regexp
             (string-match first-line-regexp
                           first-line-prefix))
        (and comment-start-skip
             (string-match comment-start-skip
                           first-line-prefix)))
    first-line-prefix
  (make-string (string-width first-line-prefix) ?\s))

anyone any idea what I could be doing wrong?