texts:
I've found a function for checking parenthesis/brackets balance.
Full code is in the bottom.
I wanted to use it to check LaTeX commands like \left(/\right), \[/\] etc.

How can I modify this function to accept such constructs?

(defun xah-check-parens-balance ()
  "Check if there are unbalanced parentheses/brackets/quotes in current bufffer or selection.
If so, place cursor there, print error to message buffer.

URL `http://ergoemacs.org/emacs/emacs_check_parens_balance.html'
Version 2018-07-03"
  (interactive)
  (let* (
         ($bracket-alist
          '( (?“ . ?”) (?‹ . ?›) (?« . ?») (?【 . ?】) (?〖 . ?〗) (?〈 . ?〉) (?《 . ?》) (?「 . ?」) (?『 . ?』) (?{ . ?}) (?\[ . ?\]) (?\( . ?\))))
         ;; regex string of all pairs to search.
         ($bregex
          (let (($tempList nil))
            (mapc
             (lambda (x)
               (push (char-to-string (car x)) $tempList)
               (push (char-to-string (cdr x)) $tempList))
             $bracket-alist)
            (regexp-opt $tempList )))
         $p1
         $p2
         ;; each entry is a vector [char position]
         ($stack '())
         ($char nil)
         $pos
         $is-closing-char-p
         $matched-open-char
         )
    (if (region-active-p)
        (setq $p1 (region-beginning) $p2 (region-end))
      (setq $p1 (point-min) $p2 (point-max)))

    (save-excursion
      (save-restriction
        (narrow-to-region $p1 $p2)
        (progn
          (goto-char 1)
          (while (re-search-forward $bregex nil "move")
            (setq $pos (point))
            (setq $char (char-before))
            (progn
              (setq $is-closing-char-p (rassoc $char $bracket-alist))
              (if $is-closing-char-p
                  (progn
                    (setq $matched-open-char
                          (if $is-closing-char-p
                              (car $is-closing-char-p)
                            (error "logic error 64823. The char %s has no matching pair."
                                   (char-to-string $char))))
                    (if $stack
                        (if (eq (aref (car $stack) 0) $matched-open-char )
                            (pop $stack)
                          (push (vector $char $pos) $stack ))
                      (progn
                        (goto-char $pos)
                        (error "First mismtach found. the char %s has no matching pair."
                               (char-to-string $char)))))
                (push (vector $char $pos) $stack ))))
          (if $stack
              (progn
                (goto-char (aref (car $stack) 1))
                (message "Mismtach found. The char %s has no matching pair." $stack))
            (print "All brackets/quotes match.")))))))


texts:
I am editing org-mode files with a lot of source code blocks. These blocks contain my own pseudo code that looks like this:

(A) {B} (C)
(D) {F} (Z)

When moving within these blocks there is a pause or delay of several seconds between movements. After that the error message eldoc error: (error Variable binding depth exceeds max-specpdl-size)is displayed. First I thought the recent 25.1.1 update of railwaycat's Emacs for Mac was the culprit. But after a downgrade to the latest 24 version, the issue is still there. I then tried to rollback any package updates (with Spacemacs). Alas, to no avail. What can I do?


texts: Case insensitive find character in `evil` and `evil-easymotion`

texts: I wonder whether it is possible to make f in evil and/or in evil-easymotion case insensitive?


texts: How to find all TODO with a certain tag?

texts: If I wanted a list of all TODO entries with a certain tag, or set of tags, how would I search for them in org-mode?


texts:
This bug currently prevents me switching to 24.4:

https://bitbucket.org/lyro/evil/issue/437/m-x-is-undefined-in-emacs-244

Is there a workaround to make both evil and M-x work in 24.4?


texts:
I have a theme in which I specified how my source blocks and quote blocks look:

`(org-block ((,class (:foreground ,fg3 :background ,"#fffce9"))))
`(org-block-begin-line ((,class (:foreground ,"#996600" :background ,"#ffe6b3"))))
`(org-block-end-line ((,class (:foreground ,"#996600" :background ,"#ffe6b3"))))
`(org-quote ((,class (:foreground ,"#2f4f4f" :background ,"#f0fef0" :slant italic))))

This works well for the source block, but is ignored for the quote block (see screenshot).

When I inspect the face via M-x customize-face org-quote, it seems it seems my customizations are being applied:

Judging from this post, it should be possible.

Any help on how to solve this will be greatly appreciated.


texts: Cannot set tab-width in Golang mode with Spacemacs

texts:
I set the tab-width for Golang to 2 using the following:

(add-hook 'go-mode-hook
          (lambda ()
            (setq-default indent-tabs-mode 1)
            (setq-default tab-width 2)))

And when I check the tab-width variable, it shows:

   tab-width is a variable defined in ‘C source code’.
    Its value is 8
    Local in buffer plugin.go; global value is 2

      Automatically becomes buffer-local when set.
      This variable is safe as a file local variable if its value
      satisfies the predicate ‘integerp’.

But when I open any .go file, the tab width is still 8. Why?


texts: clicking on a schedule item no longer pops up org-agenda

texts:
In the good old days (ie last week before I did a M-x package-list-package U x) when I clicked on a SCHEDULED: <...> link, it would popup the org-agenda view. Now it does nothing and displays No link found. Is there a way to restore the old behaviour?

C-c C-o org-open-at-point also fails in the same way yet the docstring for that says:

On top of syntactically correct links, this function also tries
to open links and time-stamps in comments, node properties, and
keywords if point is on something looking like a timestamp or
a link.

... so I don't think I'm trippin!

EDIT 20190112: I tried with emacs -Q but it made no difference.

I got a copy of org-mode-release_9.1.14 and the good old behaviour is restored. So I'm leaning towards a regression that's crept in.


texts: indentation (with multiline comments) in batch processing

texts:
i'm trying to indent a couple of C++-files (and untabify them; and remove trailing whitespace), so i thought about using emacs in batch mode.

Since I'm pretty much a noob when it comes to elpa (or lisp in general), i searched the web and came up with something like this:

$ cat myscript.el
(defun myindent ()
   "Format the whole buffer."
   (c-set-style "stroustrup")
   (indent-region (point-min) (point-max) nil)
   (untabify (point-min) (point-max))
   (delete-trailing-whitespace)
   (save-buffer)
)
$ emacs -batch "somefile.cpp" -l $(pwd)/myscript.el -f myindent

This kind of works.

However, all of my header files contain a boilerplate in a C-style multiline comment, which is nicely formatted.
Something like:

/*-----------------------------------------------------------------
LOG
    Foo Bar - the Pizza man

    Copyright (c) 1997-2017 Me, You and others
    For information on usage and redistribution, and for a DISCLAIMER OF ALL
    WARRANTIES, see the file "LICENSE.txt".

    CLASS
        Onion
        smells and bits like an onion

    KEYWORDS
        ingredients, vegetable

    DESCRIPTION
        hum, hmm...later

-----------------------------------------------------------------*/

now when i run my scrip on that file, all the pre-formatting is lost, and it ends up as:

/*-----------------------------------------------------------------
  LOG
  Foo Bar - the Pizza man

  Copyright (c) 1997-2017 Me, You and others
  For information on usage and redistribution, and for a DISCLAIMER OF ALL
  WARRANTIES, see the file "LICENSE.txt".

  CLASS
  Onion
  smells and bits like an onion

  KEYWORDS
  ingredients, vegetable

  DESCRIPTION
  hum, hmm...later

  -----------------------------------------------------------------*/

So the question is: Is there a way to indent my files in batch mode and preserve the formatting within multiline comments (and strings)?

I've tried using (indent-code-rigidly (point-min) (point-max) 0) instead of indent-region which leaves the comments intact, but I preservers too much of the original indentation of the code.
So I guess I'd like something inbetween indent-region and indent-code-rigidly)


texts: Autoloaded variable overrides the one from the init file

texts:
I added the following line to my init file to replace ruby-mode with enh-ruby-mode:
(setq auto-mode-alist
      (mapcar
       (lambda (x)
         (if (eq (cdr x) 'ruby-mode)
             (cons (car x) 'enh-ruby-mode)
           x)) auto-mode-alist))

But it works only for the first file. The first ruby file I open is in enh-ruby-mode. But in the process the following command is executed:
/usr/share/emacs/26.3/lisp/progmodes/ruby-mode.el.gz:
;;;###autoload
(add-to-list 'auto-mode-alist
             (cons (purecopy (concat "\\(?:\\.\\(?:"
                                     "rbw?\\|ru\\|rake\\|thor"
                                     "\\|jbuilder\\|rabl\\|gemspec\\|podspec"
                                     "\\)"
                                     "\\|/"
                                     "\\(?:Gem\\|Rake\\|Cap\\|Thor"
                                     "\\|Puppet\\|Berks"
                                     "\\|Vagrant\\|Guard\\|Pod\\)file"
                                     "\\)\\'"))
                   'ruby-mode))

(The same line is in /usr/share/emacs/26.3/lisp/loaddefs.el.) Which means the second and the following files are opened in ruby-mode.
I guess to remedy this I've got to not change the line in auto-mode-alist, but add one. Anyways, how does this autoload thing work? When does loaddefs.el get executed? Is there a way to keep the line out of the file?


texts: Smerge: auto-resolve LaTeX-like git conflicts

texts:
I'm using doom emacs + magit, and it enables smerge for me to display nicely my conflicts. I just saw that smerge has a function smerge-resolve to automatically resolve conflicts. I'd like to use it on "typical" conflicts I get in LaTeX: for example I add a word at the beginning of the sentence, and my co-author removes a typo at the end of the sentence.
However, the default command does not work for that case. Is it possible to automatically resolve that kind of conflicts?


texts: Preset search isearch-string from command line

texts:
I am trying to set isearch-string from the command line. The purpose is to have a Perl script start Emacs with a given search string, and go directly to the first line of the string and enter search mode. For example:

$ emacs +2 t.txt -l srep.el &

with t.txt the text file to search in, for example here is a dummy file:

a bb c
aa
aa bb c d

The Lisp file srep.el (generated by the Perl script) sets the isearch-string, for example:

(setq isearch-string "aa")
(isearch-search-and-update)

However, this does not work. I get a wrong-type-argument error from the debugger.
I then modified srep.el to :

(defun my-set-search-word()
  (interactive)
  (setq isearch-string "aa"))

(add-hook 'isearch-mode-hook 'my-set-search-word)

This works in the beginning. I can press C-s to search for the string aa, but if I try to escape isearch-mode (press arrow up key for example) and do some editing and later try to search for another string (by pressing C-s again) for example the string b. I get error Failing I-search.

I tried to solve this by changing srep.el to:

(defun my-set-search-word()
  (interactive)
  (if *my-search-str-flag*
      (setq isearch-string "aa")
    (setq *my-search-str-flag* nil)))

(defun my-set-search-word()
  (interactive)
  (setq isearch-string "aa"))

(defvar *my-search-str-flag* t)
(add-hook 'isearch-mode-hook 'my-set-search-word)

But I still get same behavior. I am using Emacs 24.3 on Ubuntu 14.04.


texts: Leuven theme cause emacsclient not to start

texts:
I have a hint for leuven which look quite nice, especially the presentation in orgmode, so I've installed with from the package manager.

Since I can't find it in M-x cusomize-themes, I have tried to load it with (load-theme 'leuven) in my .emacs, and this cause emacs -daemon failing to start...

Has anyone ever encountered that problem with leuven theme before ?

Thank you


texts: Prevent specific parts of buffer from being editable

texts:
I wonder if it is possible to prevent specific parts of a buffer from being editable. For example, when I have outlined my document in an org-mode file,
I would like to prevent any accidental changes to the headlines, and only being able to edit the contents:

* Headline 1: not editable

Content under Headline 1 is editable.

* Headline 2: not editable

Content under Headline is editable.

** Subheadline 1 under Headline 2: not editable

Content under Subheadline 1 is editable

Or if I have code block in an org-file, I would like to prevent changes to the code block commands:

#+begin_src emacs-lisp                       <- not editable
(defun fun (a b)                             <- editable
  (+ a b)                                    <- editable
#+end_src                                    <- not editable

EDIT: I would prefer a solution where the non-editable parts can still move up or down the y-axis in the buffer to ensure that content in between non-editable parts can be expanded:

#+begin_src emacs-lisp              <- not editable, but can move up or down
(defun fun (a b)                    <- editable
  (+ a b)                           <- editable
)                                   <- editable
#+end_src                           <- not editable, but can move up or down


texts: How do I customize the process that gets triggered in org-preview-latex-fragment?

texts:
All I could find to configure was org-latex-to-pdf-process and org-latex-create-formulat-image-program. The first one only controls the process, when I want to export the entire document, the second one only controls the process that gets executed after the latex command. But how do I customize the latex command that gets used for the fragments?

My use case:

I got minted finally working to export my org file with code samples in colors. But since then, the preview is broken, because the latex snippets have now the minted package imported, too. Then the pdflatex process for the snippets fails, because it needs the -shell-escape flag passed. But I do not know how I can pass that flag to that process.

second use case:

I would like to use the unicodemath package for xelatex. But that package is only available in xelatex, and therefor the process for the latex fragments needs to be xelatex, too.


texts: Bookmarking / Highlighting lines in a file

texts:
Is there an Emacs feature for highlighting some lines in a file to make it easier to jump around? My immediate use-case is a gigantic auto-generated C++ file with horrible indentation, which is rather difficult to navigate and it's easy to get lost. At the moment, I'm adding comments of the form // LOC-1 to find where I've just been, but that feels a bit icky.

I know that some other text editors have this tied in with their bookmark mechanism (sublime text?) and you can add a blue blob to the left gutter. Maybe there's a way to show Emacs bookmarks in the gutter? Or maybe there's a different feature that shows something like this or highlighted lines?

I'm not concerned with this persisting across closing and opening the file, or with multiple buffers viewing it: either persistent or not is fine with me.

Is there an easy way for me to leave myself some "breadcrumbs"?


texts: How to preserve buffer local variables through `recompile`?

texts:
In a compilation buffer, when I set buffer local variable like so:

(setq-local foo 'bar)

Doing a (recompile) will unset this variable.

Is there a way to keep the buffer local value permanent through recompiles?


texts: org-mode export images to html as figures, not img

texts:
Currently my images are exported with org-html-publish-to-html, and they end up as inlined . I want them inside figures, so I'm working around this my problem by injecting the following in my org document:

#+BEGIN_HTML

This is a caption.

#+END_HTML

This solution isn't ideal, since I may want to generate images on the fly with org-babel, and I'll want to target them with CSS.

How can I tell org-mode to export links to images as figures?

EDIT:

It turns out setting the following on my project-alist does the trick.

     :html-html5-fancy t
     :html-doctype "html5"

However, the output is still messed up because org-mode adds an unnecessary p tag to the image:

Figure 1: This is a dog.

The culprit is the following function from ox-html. Note the suspicious
 tags:

(defun org-html--wrap-image (contents info &optional caption label)
  "Wrap CONTENTS string within an appropriate environment for images.
INFO is a plist used as a communication channel.  When optional
arguments CAPTION and LABEL are given, use them for caption and
\"id\" attribute."
  (let ((html5-fancy (org-html--html5-fancy-p info)))
    (format (if html5-fancy "\n
%s%s\n
"
          "\n
%s%s\n
")
        ;; ID.
        (if (org-string-nw-p label) (format " id=\"%s\"" label) "")
        ;; Contents.
        (format "\n
%s
" contents)
        ;; Caption.
        (if (not (org-string-nw-p caption)) ""
          (format (if html5-fancy "\n
%s
"
            "\n
%s
")
              caption)))))

So I redefine the function on my web-config.el and remove the  tags, and everything works ok. But is there a better way to do it? Perhaps with an advice?


texts: How do I prevent autocompletion when trying to save a file?

texts:
I have an existing directory called ~/app_scripts and a buffer open with a file I would like to save. I want to save it to ~/scripts/script.py, but the ~/scripts dir does not yet exist. When I hit C-x C-s to save, I try to type ~/scripts/ but it keeps autocompleting to ~/app_scripts. How do I make it stop over-autocorrecting and let me choose a file name?
I cannot use C-M-j because that will immediately save the file at ~/scripts (with no filename), instead of allowing me to continue to type the path I want.

Note: I'm not sure if this problem is Ivy-related or not, but I think it might be relevant to the problem.


texts: I Have Installed Emacs and AUCTeX, What Else?

texts: I have a Macbook.  I just installed Emacs and AUCTeX.  I then installed MacTeX.  When I open a .tex file, and try to compile it into pdf, it gives an error message of "AUCTeX cannot find a working TeX distribution."  It also says to add a certain directory to my PATH.  How do I correct this?  Thanks.


texts: How can I edit my function to work to kill lines not matching RegExp

texts:
I made a function to filter unimportant lines from a CSS file I copied. I only want lines with the words "color" and "background" to remain in my buffer after the point the function is run. When I run the function it moves point to the next valid match but doesn't kill any lines. I want to kill all lines forward of point that don't match. I would run the command until the end of the buffer is reached if there is no convenient test to determine when the end of the buffer is reached. I'm new to Emacs LISP. How can I fix the function to kill the non-matching lines?

(defun my-color-filter ()
  (interactive)
  (while (not (re-search-forward "^.*\\(?:color\\|background\\).*$" nil t)) (beginning-of-line) (kill-line))
  )


texts:
I created a highlighter for org-mode which worked great (pre orgmode 9.0). But now my customizations are being ignored...

Here is the excerpt from my init.el file:

;;; Create highlighter face
(defface my-highlight-face
   '((t (:inherit org-default :foreground "#000000" :background "#ffffe7")))
   "Face for highlighting text")
(defvar my-highlight1-face 'my-highlight1-face)

;; Add to list
(setq org-emphasis-alist `(("*" bold)
                                 ("/" italic)
                                 ("_" underline)
                                 ("=" org-verbatim verbatim)
                                 ("~" org-code verbatim)
                                 ("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t)))
                                 ("!" my-highlight1-face verbatim)))

;;; Reload org to make it stick
(org-reload)

To check that this worked, I restart emacs and run M-x customize-variable > org-emphasis-alist. Scrolling down, I can see that my-highlight1-face has been added to the list:

But opening a random org buffer and typing !text to highlight! does nothing.

What am I missing?


texts: Synchronised scrolling of HTML file and eww buffer

texts:
I am editing a HTML file.

I have done C-x 3. Now, in the other split window, I want to open a browser, such as eww.

And as I move in the HTML file, I want the browser window to show the corresponding part and vice versa.

How can this be achieved?


texts: I am using the distinguished theme. I want to set the main font color to something more dark, how could i do that?


texts: Change the behavior of a function when the point is in a table

texts: How can I change the behavior of a function when the point is in an org-table? Is there a function like "table-p" that returns true when the point is in a table (like region-active-p returns true when a region is selected)?


texts:
I know that I can add commands to eshell-visual-commands to for example make it so when I run "top" it runs in a temporary ansi-term buffer instead of the eshell buffer, so that programs that rely on complex terminal stuff work seamlessly with eshell.

But I'd like them to work when using eshell's tramp integration too. So I can cd to another machine with:

cd /ssh:myuser@myhost:/

Which then takes me to that machine, ls shows the right files, and everything working nice as long as I don't use a visual command. But as soon as I try to run top there I get a term buffer that's empty except for this output:

..: 1: exec: /ssh:myuser@myhost:/usr/bin/top: not found

I have verified /usr/bin/top exists on the machine, and that this happens even when using emacs -Q so I think the issue is just that eshell-visual-commands assumes that whatever it gets back from running "which top" is what it should run in a term buffer, not understanding that that term buffer first needs to be ssh'd into the other machine. Has anybody else tackled making this work?


texts: Emacs server init when called without file

texts:
Whenever I use emacsclient, I tend to use it without a file argument. This is because my emacs file finder is generally better than my shell file finder.

Unfortunately, when emacsclient is not given a file argument, neither server-visit-hook nor server-switch-hook are fired, and I'm left without crucial bits of server setup.

How can I work around this limitation?

EDIT: Added example code.

(let ((my/evil-mode-line-face-cookies nil))
  (defun my/evil-set-mode-line-face (&rest args)
    (cl-destructuring-bind (bg-color fg-color)
        (pcase evil-state
          (`normal  '("white" "blue"))
          (`emacs   '("white" "green"))
          (`insert  '("black" "grey"))
          (`visual  '("white" "cyan"))
          (`replace '("white" "red"))
          (other    '("grey"  "black")))
      (mapc #'face-remap-remove-relative my/evil-mode-line-face-cookies)
      (setq my/evil-mode-line-face-cookies
            (list (face-remap-add-relative
                   'mode-line
                   mode-line
                   `((:foreground ,fg-color :background ,bg-color)
                     mode-line))

                  (face-remap-add-relative
                   'mode-line-buffer-id
                   mode-line-buffer-id
                   `((:foreground ,fg-color)
                     mode-line-buffer-id)))))))

(add-hook 'post-command-hook #'my/evil-set-mode-line-face)
(add-hook 'after-make-frame-functions #'my/evil-set-mode-line-face)


texts: Org mode: include LaTeX bibliography in the TOC

texts:
This question is related to ox-bibtex.
The snippet
#+BIBLIOGRAPHY: main abbrv

prints out an unnumbered section "Reference" excluded from the TOC in both LaTeX & html export.
Is there a portable & Org mode specific way to include bibliography as a section in the TOC?


texts: How to sort bash functions alphabetically?

texts:
My boss is a bit of a neat freak. He wants the functions in my functions.sh be ordered alphabetically.

foo() {
  echo foo
}

baa() {
  echo baa
}

So baa should appear first in the file.

Can emacs help me do this? I have tons of methods in this file.


texts: How to format a string variable to only show the first x number of characters?

texts:
I have a string variable, specifically the emacs-version variable that can be quite long and I am only using message with the first 4 of those characters.

Is there a way to format the variable in a message statement so that I am only printing the first x number of characters?

Right now I am using substring but it seems like there should be an easier / cleaner way. Please let me know if there is a more efficient way to do this:

(message "You are running version %s old." (substring emacs-version 0 4)))


texts: Change Spacemacs default font except minibuffer?

texts: I'd like to experiment with coding in variable-width fonts, but setting the default font will also set the default font for the minibuffer, which breaks Spacemacs' helpful menu system as it uses spaces to align columns of options (it is the minibuffer that's used there, not?). I can't find a way to set a global font and then just override the minibuffer--various hooks for Emacs I've tried don't seem to work. Is there a way to do that?


texts: Why are packages showing as status 'External' in list-packages

texts:
I appear to have broken something in my Emacs environment (running on Windows in case it's relevant).

package-list is currently displaying all the packages I've just installed with it as Status 'external' - which as far as I can tell means I can't actually use package.el to manage them anymore. I can't remove them, update them anymore, as trying to mark them with 'd', or 'U' does nothing - no marks appear against the package, and consequently 'x' then says there's nothing to do.

Sample from the list-packages buffer:

  Package            Version       Status    Archive     Description
  magit              20150608.1139 external              control Git from Emacs
  magit-annex        20140629.1457 external              Use git annex within magit

My current .emacs :

    ;; -*- emacs-lisp -*-
(add-to-list 'initial-frame-alist '(fullscreen . maximized))
(add-to-list 'default-frame-alist '(fullscreen . maximized))

(setq url-proxy-services '(("http" .  "127.0.0.1:3128")
                           ("https" . "127.0.0.1:3128")))
(setq make-backup-files nil)
(require 'package)
(setq package-archives '(("melpa" . "http://melpa.org/packages/") ("org" . "http://orgmode.org/elpa/")))
(package-initialize)

(add-to-list 'load-path "~/.emacs.d/lisp")

(require 'powershell-mode)

(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.
 '(package-selected-packages
   (quote
    (s afternoon-theme ample-theme ample-zen-theme async badger-theme base16-theme bubbleberry-theme busybee-theme caml circe clues-theme color-theme-sanityinc-solarized csharp-mode csv-nav cyberpunk-theme dakrone-theme darkburn-theme darkmine-theme dash deferred django-mode espresso-theme firebelly-theme flatland-theme gandalf-theme gh google grandshell-theme gruvbox-theme logito magit magit-annex magit-filenotify magit-find-file magit-svn moe-theme molokai-theme monokai-theme mustang-theme naquadah-theme niflheim-theme noctilux-theme nyan-mode obsidian-theme occidental-theme oldlace-theme org-plus-contrib pcache planet-theme powerline professional-theme purple-haze-theme rainbow-delimiters rich-minority rnc-mode seti-theme smart-mode-line smart-mode-line-powerline-theme smart-tabs-mode soft-morning-theme soft-stone-theme spacegray-theme stekene-theme subatomic-theme subatomic256-theme sublime-themes tango-plus-theme tangotango-theme tommyh-theme toxi-theme tracking tronesque-theme twilight-theme ujelly-theme underwater-theme vlf yaml-mode zen-and-art-theme zenburn-theme))))
(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.
 )

(cua-mode t)

Anyone got any suggestions? I even nuked my entire .emacs and .emacs.d and started afresh (which is where the snippets above are from). What did I break?

---Edit--- Including package help text for a sample package:

magit is an external package.

     Status: External in ‘~/.emacs.d/elpa/magit-20150608.1139/’ (unsigned).
    Archive: n/a
    Version: 20150608.1139
   Requires: cl-lib-0.5, git-commit-mode-1.0.0, git-rebase-mode-1.0.0
Required by: magit-filenotify-20150125.1456, magit-annex-20140629.1457
    Summary: control Git from Emacs
   Keywords: vc tools
    Other versions: 20150608.1139 (melpa).

And for sake of completeness, the (default) setting of package-user-dir :

package-user-dir is a variable defined in ‘package.el’.
Its value is "~\\.emacs.d\\elpa"

  This variable may be risky if used as a file-local variable.

Documentation:
Directory containing the user's Emacs Lisp packages.
The directory name should be absolute.
Apart from this directory, Emacs also looks for system-wide
packages in ‘package-directory-list’.

You can customize this variable.

This variable was introduced, or its default value was changed, in
version 24.1 of Emacs.


texts:
I am using emacs, previously I updated my spacemacs and behavior of spacemacs/helm-persp-switch-project command has been changed.
Old Flow

Start(execute spacemacs/helm-persp-switch-project)

If layout does not exist

Create New layout with project name
helm-projectile-switch-project(select project)
helm-projectile-find-file (Select file from project)

If project layout exist

helm-projectile-switch-project(select project)
helm-projectile-find-file (Select file from project)

New Flow

Start(execute spacemacs/helm-persp-switch-project)

If layout does not exist

Create New layout with project name
helm-projectile-switch-project(select project)
helm-projectile-find-file (Select file from project)

If project layout exist(Problem is here)

It just switches some buffer of layout and does not asks for files of project.

Question

How I can make the function as work like before and still it will execute helm-projectile-find-file after switching to layout.

Info function definition


texts: Spacemacs: Latex labels not showing in ref

texts:
Manually defined labels (without reftex) are not showing when I use helm-completion-at-point inside a \ref{} environment. How to make the labels show?
I am new to Emacs and Spacemacs.


texts: Configuring org-export to replace LaTeX def macros

texts:
I'm trying to configure org-export to replace LaTeX-def-macros while exporting to TeX or HTML.

Current situation: the header #+LATEX_HEADER: \def\R{\mathbb{R}} defines a macro that replaces \R to \mathbb{R} while compiling the TeX output. (Essentially, this will add the \def\R{\mathbb{R}} to the preamble of the TeX file---org-mode does not perform any macro-replacements)

Instead, is there some way to make org-export execute the macro-replacement, i.e., the exported TeX/HTML file should not contain \R (instead it should be replaced by \mathbb{R}.)

Possible uses: LaTeX macros can be used and the exported output will be properly rendered when in HTML, markdown, etc.


texts: How to make a newfile-function opening the new file in a new frame?

texts:
I use Emacs org-mode for note taking during philosophical dialogs. I make one new file for each idea encountered, using this code:

(defun myfun-create-note-file()
  "Doc-string."
  (interactive)
  (find-file (format-time-string "C:/Users/myUser/notes/%Y-%m-%d--%H-%M-%S.txt"))
  (insert "*note :tags: \n\n")

(global-set-key "\C-cn" ' myfun-create-note-file)

However, when making several new files during one session, only the last one is visible in the Emacs frame. The rest of the files reside within the Emacs instance, and have to be visited by cycling through the open buffer list.

I would like to open every new file in a separate frame, of small size. How can I modify my code to do this?


texts: add-hook evil-insert-state-entry-hook is not calling the function

texts:
Update: It worked properly somehow after disabling and enabling nyan-mode.
BUT there is no evidence indicating any relationship between them. Because I can't reproduce this problem after it was magically fixed.

My suspicion is that if the -- INSERT -- can show properly then the hook can be called properly. And if not it can't. Because I don't remember seeing -- INSERT -- when the problem exists. But again there is no evidence. Just for someone who might encounter this problem some day.

I have following code in my init.el (actually .spacemacs but you know what I mean). I try to invoke function input-switch-use-method1 when I enter insert mode in evil

;; switch input method when toggling insert mode
  (setq input-switch-method0 "com.apple.keyboardlayout.all")
  (setq input-switch-method1 "com.apple.inputmethod.SCIM")

  (defun input-switch-use-method (method)
    (when 'input-switch-is-on
      (shell-command (replace-regexp-in-string "method" method "swim use method"))))

  (defun input-switch-activate () (interactive) (setq input-switch-is-on t))

  (defun input-switch-use-method1 () (interactive) (input-switch-use-method input-switch-method1))

  (add-hook 'markdown-mode-hook 'input-switch-activate)

  (add-hook 'evil-insert-state-entry-hook 'input-switch-use-method1)

When I call input-switch-use-method1 directly from M-x it works, but entering insert mode by pressing i does not do anything.

I found no information indicating this hook being defective.
Does anyone know why and how can I fix this?

Thanks.


texts: Enable follow-mode for PDF in doc-view/pdf-view-mode

texts: Is it possible to customize follow mode to open the next PDF page in another buffer? Currently follow-mode has no effect on PDF files.


texts: Fastest way to move code block to specific line

texts:
Say you have code on lines 4, 5, 6. Then you want to move this block of code to starting point line 9 while also deleting lines 4, 5, 6.

What's the fastest way, i.e. least amount of key strokes, to achieve this? Would a custom function be better suited?


texts: How do customize the display of time ranges in org-mode?

texts:
In org mode, I can customize the display of times like this:
(setq org-display-custom-times t)
(setq org-time-stamp-custom-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %I:%M %p>"))

So times that used to look like <2021-02-12 Fri 20:00> now look like <2021-02-12 Fri 08:00 PM>.
However, time ranges don't format properly. If the timestamp is originally <2021-02-12 Fri 20:00-21:00>, I'd like to to show <2021-02-12 Fri 08:00 PM-09:00 PM>, but it shows <2021-02-12 Fri 08:00 PM-21:00> instead.
Is there a way to fix this?


texts: Bookmark plus doesn't work as expected after upgrade

texts:
I just updated bookmark+ package and something broke.

I use bmkp-toggle-autonamed-bookmark-set/delete to mark areas of interest
and return to it using:
bmk-previous-autonamed-bookmark-repeat /
bmk-next-autonamed-bookmark-repeat.

This used to be across buffers per emacs instance and it was perfect.

After the update, this does not work. I cannot use next or previous to visit
the bookmark. Even if I invoke it, it stays as if I did not press anything.
It does work within one buffer, but earlier this used to work across buffers.
Is there any new setting that needs to be made to make it work across buffers ?


texts: How to run interactive bash command from Emacs?

texts:
I have a command my_cmd that is aliased to another command in my ~/.bashrc. From Perl and Python, I can run this command as bash -ic "my_cmd" (this also works from the terminal window, but here it is not necessary, and I can simply type my_cmd since bash already has loaded my ~/.bashrc). When I try this from Emacs:

(print (shell-command-to-string "bash -ic 'my_cmd'") (current-buffer)))

I get error:

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

I am running Emacs 24.3.1 on Ubuntu 14.04.


texts: Why do local-set-key and local-unset-key not work interactively?

texts:
My local-set-key and local-unset-key, used interactively M-x ..., are not working as expected, namely to bind or unbind a key for a specific buffer.

Case in point:  I am editing a LaTeX (.tex) file in AucTeX's LaTeX major mode. LaTeX mode binds C-TAB (same as C-M-i) to TeX-complete-symbol.  However, flyspell minor mode is enabled (and is otherwise useful), but for some very lame reason this minor mode binds the (rather useless) flyspell-auto-correct-word command to not just one, but two different keys, namely C-. and C-M-i

For the life of me, I cannot figure out how to bind C-M-i to TeX-complete-symbol restoring AucTeX's intended functionality, except by disabling flyspell minor mode.  When called interactively from my .tex buffer, local-set-key fails to actually set the key to TeX-complete-symbol, the original mapping to flyspell-auto-correct-word remains in place.  I also tried local-unset-symbol, but the darned flyspell mapping remains in place.  After convincing myself that what I'm doing should be changing the binding (but doesn't), I decided to post here.  I am stumped.  Nothing I seem to do using local/global-set/unset-key is working to change default mappings.  Nothing!  It just seems that the active bindings are carved in stone.

I've restarted emacs a half-dozen times troubleshooting this.  Needless to say, no change.

My .emacs does nothing fancy.  I cannot imagine that my customization could have anything to do with this abhorrent behavior.  What's up, emacs?!  Non-customization?!!!

Version data follows below:

GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30.
AUCTeX-version is a variable defined in ‘tex-site.el’. Its value is "12.1.1"

C-M-i runs the command flyspell-auto-correct-word (found in
flyspell-mode-map), which is an interactive compiled Lisp function in
‘flyspell.el’.  It is bound to C-., C-M-i.


texts:
I'm trying to use a hydra to dispatch among a selection of motions. See this minimal example:

(defhydra hydra/test (:color blue)
  "This is a test hydra"
  ("n" evil-next-line))

(evil-define-motion hydra/test/motion-proxy (&rest args)
  (hydra/test/body))

(global-set-key (kbd "M-RET") #'hydra/test/motion-proxy)

Unfortunately, this motion does not compose with evil operators. For example, d M-RET n does move to the next line, but does not delete any text.

How can I work around this?


texts: fault-tolerant `check-parens` resp. `scan-lists`

texts:
Looking for a way to have a fault-tolerant navigation. I.e. in case of broken syntax, uncomplete forms etc. --when
check-paren fails--, it should try some heuristics.

Unfortunatly can't use check-parens resp. scan-lists for branching, as these return an error, which breaks
further execution. Consider nil as return value in case of fail and
some-value in case of correctnes.


texts:
I was not satisfied with the behavior of standard C-arrow and C-S-arrow, so I wrote this functions to replace standard ones.

(setq separators-regexp "[\-'\"();:,.\\/?!@#%&*+=]")

(defun forward-to-separator()
    "Move to the next separator like in the every NORMAL editor"
    (interactive)
    (let ((my-pos (re-search-forward separators-regexp)))
        (goto-char my-pos)))

(defun backward-to-separator()
    "Move to the previous separator like in the every NORMAL editor"
    (interactive)
    (let ((my-pos (re-search-backward separators-regexp)))
        (goto-char my-pos)))

(global-set-key (kbd "C-<right>") 'forward-to-separator)
(global-set-key (kbd "C-<left>") 'backward-to-separator)

But now I am facing a problem with shift selection: it actually just not working at all.
So my question is: how can I select text using my new functions and shift key(C-S-arrow)?

My final code is here:  https://gist.github.com/FirstTimeInForever/8303ac1918c81365991d7acf7a926bd8
I added C-<backspace> support and changed my regex. Now I can move cursor like in sublime text!


texts: How do you automatically enable writeoom-mode when org-mode starts?

texts: I want to enable writeroom-mode whenever I startup org-mode because I don't really ever want writeroom-mode to be disabled if I'm using org-mode.


texts:
I use a template engine for a lot of files in my project.  The specific one is irrelevant -- let's say all my template files end with .template.

Now, I've got many different kinds of templated files, like foo.txt.template, bar.html.template, baz.py.template, and qux.json.template.

By default, Emacs doesn't know about my template engine, so they all open in fundamental-mode.  I could manually add each templated filetype to my .emacs file (.txt.template, .html.template, etc), but that's tedious, and I'll have to update it whenever anybody finds a new filetype that's useful to template.

Is there an easy way to tell Emacs' major-mode-selection functionality that .template is special, and that any file that looks like foo.ext.template should be opened as if it were called foo.ext?

Thanks!


texts: From eshell or ansi-term can I open a file in the same window without a new instance of Emacs?

texts: I'm wondering if anyone knows of a clever way in Emacs when in a shell, can I directly open a file without having to open it in another Emacs instance.


texts: Hide export option names (#+TITLE, etc) in org mode without hiding value

texts:
Where it says #+TITLE: my title I want it to just say my title, same with author and date and then I want to hide the other attributes...

How would I do this?


texts:
Issuing M-x load-theme gives me the option solarized. However, issuing solarized gives the message Undefined Custom theme solarized.

Any ideas why I'm getting this error?


texts: Emacsclients locks up on mini-buffer use

texts:
If you start emacs --daemon -q and then connect two emacsclients to it. If you press C-x C-f or anything that activates the minibuffer - no input to the other emacsclients will be accepted until that minibuffer is closed.

Is it possible to prevent this from happening?


texts: eval: Symbol’s function definition is void: org-macro--get-property

texts: I am trying to tangle an org file, but this error shows up even if I invoke the command with an emacs -Q instance. Google does not seem to yield anything useful here. Can anyone help me get to the cause of this?


texts:
I'm using Emacs with company and company-quickhelp. This works fine for Elisp and Clojure.
However, displaying the quickhelp popup (or function signature) in Python mode doesn't work. I installed company-jedi and have the following settings in my ~/.emacs.d/init.el

(add-hook 'after-init-hook 'global-company-mode)
(company-quickhelp-mode 1)

(defun my/python-mode-hook ()
(add-to-list 'company-backends 'company-jedi))

(add-hook 'python-mode-hook 'my/python-mode-hook)
(add-hook 'python-mode-hook 'run-python-internal)

The quickhelp popup doesn't show and after pressing F1 the minibuffer says "No documentation available". What am I missing?


texts: How open all folders only in one buffer in dired mode?

texts:
Windows 10, Emacs 26.1

When in dired mode when I press Enter over folder it's open in separate buffer. So after input in 10 folder the Emacs open 10 buffers. I know about press "a". But it not comfortable. I need to open folder only in ONE buffer when press ENTER.
How I can open all folder only in ONE buffer?

I don't like dired+. Has any another approach?


texts: Prevent bash-completion adding an extra space when the word is incomplete

texts:
When using Emacs shell with the auto-completion feature enabled, I notice that whenever I perform typing and auto-completing a command, Emacs shell always adds an extra space after the first word. I illustrate this issue by an example as follow:

Suppose that my current working directory is user@linux ~/foo/bar $
Now if I want to type the command mkdir by auto-completion, I first type mk, and then press TAB to show a list of completion possibilities and press ENTER choose mkdir. Now, a whitespace is added at the end of mkdir, which is indicated by the pair [ ]

user@linux ~/foo/bar $ mkdir[ ]

In this scenario, adding a whitespace after the command mkdir is fine since mkdir is a full command, I certainly want to type a new word after that.
But if the first word is not a full command, but a part of a command, a white-space is still added and it is quite inconvenient.

For example, I want to type and auto-complete the command such as ~/workspace/tool/my-command

Then, if I type ~/work first and then press TAB to auto-complete, Emacs shell will automatically add a new white-space after the first directory ~/workspace, which is indicated by [ ]

user@linux ~/foo/bar $ ~/workspace[ ]

This is an unwanted white-space, since I have to delete it, in order to continue typing the rest of ~/workspace/tool/my-command

Is there anybody know how to make Emacs shell knows when an extra white-space should be added?

FYI, I am using the Spacemacs distribution of Emacs.

I discovered that this is due to the package bash-completion of Emacs. After removing it, the Emacs shell works as usual.


texts: How can I load the solarized-dark theme correctly in Aquamacs from .emacs?

texts:
I load the solarized-dark theme in the last line of my .emacs files thusly:

(load-theme 'solarized-dark t)

However, this causes Aquamacs to look like:

If I then load the theme again by entering M-x load-theme RET solarized-dark, the theme looks correct:

How can I get the theme to load correct from my .emacs?


texts: Compile Emacs with xwidgets in Ubuntu 14.04

texts:
Going to build Emacs from the git repository.
Found this and this resources that suggest to compile it with xwidgets for Ubuntu 16.04.

On my Ubuntu 14.04, did install the corresponding dependencies with apt-get, but still getting this configure error:

configure: error: xwidgets requested but WebKitGTK+ not found.

Though libgtk-3-dev and libwebkitgtk-3.0-dev are installed.
Any hints?


texts: Intelligent downscaling for inline images

texts:
I'd like to achieve the following intelligent scaling of inline images:

If image-actual-width > 800: scale it down to 800

Else: display image without any further scaling

Doing (setq org-image-actual-width 800) achieves the first part, but for smaller images it scales them up to 800, which I want to avoid.

I'd like to have this as a sane default - I know I can set buffer and image specific widths via attributes.


texts: Can org automatically track what project I'm working on for me?

texts:
Could something watch which buffer I have open and clock me in and out (of a project) based on that?

I use projectile which has the idea of a "project" (anything in a git repo, basically); maybe it could hook into that?

Maybe it should be a second clock. Keeping track this way would be a little more honest or accurate in some ways.


texts: Why does company autocomplete 1000 to "and"?

texts:
When writing python code in Emacs (GNU Emacs 25.1.1 x86_64-pc-linux-gnu), I use company for auto completion.
Why does company autocomplete (some) numbers to keywords?

Edit:
I used M-x company-diag and it tells me:

Emacs 25.1.1 (x86_64-pc-linux-gnu) of 2017-09-15 on trouble
Company 0.9.4

company-backends: (elpy-company-backend elpy-company-backend elpy-company-backend company-bbdb company-nxml company-css company-eclim company-clang         company-xcode company-cmake company-files (company-dabbrev-code company-gtags company-etags company-keywords)
                  company-oddmuse company-dabbrev)

Used backend: elpy-company-backend
Major mode: python-mode
Prefix: #("1000" 0 4
  (fontified t))

Completions:
  "and" "keyword"
  "if" "keyword"
  "in" "keyword"
  "is" "keyword"
  "not" "keyword"
  "or" "keyword"

This looks rather odd to me. I can't imagine that this is a feature of elpy-company-backend...?


texts: Can a command determine the event sequence that invoked it?

texts:
I have a command that I would like to bind to multiple key sequences differing only in the final decimal digit (e.g. C-. 0, C-. 1, ..., C-. 9).  The command needs to determine that final digit.

I would prefer not to have 10 distinct bindings, each passing a distinct argument to a shared implementation.  So I am wondering whether emacs keeps around the event sequence that triggers a command.  Surely the self-insert-command has such a capability (though of course it is written in C).


texts:
I recently changed from rvm to rbenv to manage my ruby environments and gems with bundle instead of rvm gemsets.
It worked well and I'm quite happy with the change. The only big problem is to manage rbenv with emacs. I cannot not get sometimes the correct ruby to work with rbenv and inf-ruby, specially if I'm not working with a rails project.
So for examples I have a directory with ruby files and a .ruby-version file. I also started to use rbenv , I use macOS Catalina, rbenv installed with homebrew, and normally start emacs with daemon and emacsclient from zsh console.
So first problem is setting the correct rbenv. (rbenv-use) doesn't work because do not find the correct rbenv executable, I also set the
(require 'rbenv)
(setf rbenv-installation-dir "/usr/local/opt/rbenv")
(global-rbenv-mode)

Then (rbenv-use-corresponding) works well, and I can see [2.4.6] in bar. But when I start inf-ruby I get Ruby-version 2.6.5.


texts: How to filter a dynamic block column view by tags with a :match selector?

texts:
I'm trying to filter an org mode heading by tag in a dynamic block, but the match syntax is not quite working out.

Example:

#+COLUMNS: %25ITEM %TAGS

* Something                                                       :work:home:
* Other thing                                                          :home:

#+BEGIN: columnview :id global :match "TAGS=\"work\""
| ITEM        | TAGS        |
|-------------+-------------|
| Something   | :work:home: |
| Other thing | :home:      |
#+END: columnview

The :match "TAGS=\"work\"" query returns all headings. How to fix the query so only the headings tagged with work are displayed in the dynamic block?


texts:
Is there a way to use custom colors in the frame title? I couldn't find a face for it and it seems like the title might be part of the OS, but I wanted to check here to make sure. I'm using GUI emacs, i.e. not in the terminal, if it makes a difference.
Ideally this would also be dynamic, but since I can use :eval in the frame-title-format, I assume this shouldn't be a problem.


texts: Why do some files generated by emacs have a tilde after their name?

texts: I think they have smaller file sizes meaning they are zipped. Is this right?


texts: How to use unread-command-events variable?

texts:
I want to generate some input from my command programmatically. I have tried using unread-command-events variable for that, see:

(defun unread_test ()
  "Repeat input after toggling input method"
  (interactive)
  (let ((kseq (listify-key-sequence "Hello world!")))
    (nconc unread-command-events kseq)))

However invocation of command does nothing.

How can i achieve my goal? Should i take another approach?


texts: Moving line with move-text-up doesn't move point

texts:
Disclaimer: I'm using Emacs Prelude, but I don't think this is a problem of that specific distribution.

Some time ago I discovered that pressing M-S-up or C-S-up with no selection just swaps the line above the current one and current one. The point stays on lower line and doesn't follow the moved line. It was not the case earlier, although I can't tell what broke it (maybe some update). The both sequences are bound to move-text-up.

move-text-down still works properly - moving unselected line and point both down.

I didn't modify my move-text.el... Toggling transient-mark-mode doesn't help either. I use move-text-20140307.1644 and GNU Emacs 24.4.1 which I built from sources myself.

How can I debug and fix the problem?..


texts:
I'm a emacs 28.0.50 user (compiled by my own) and my config is based on spacemacs v0.200.8
I've noticed that, when I'm on a transient buffer and type 'q', the buffer goes away but still in my buffers list.
How can I set some key to actually kill a transient buffer?
Thanks for your attention


texts:
So I'm trying to use eclim with spacemacs and I have this function called eclim-java-format which reformat the text as in eclipse. The problems is that it reformats tabs as tabs and not as space and it sets tabs length to 2 and I prefer working with 4.

Do you know how I can tweek these tabs settings?

Even with emacs but not spacemacs answer is fine. I may try to figure out the rest of it.


texts:
I am unable to save a buffer due to a character encoding.

I am doing exploratory data analysis using Org babel.  Data is read from a file using Python and the results are printed to the buffer.

#+begin_src python :session (concat "*Python: " (file-name-nondirectory (buffer-file-name)) "*") :results output :exports both :tangle yes
dater = r"path\to\data.txt"

with open(dater) as f:
    line1 = f.readline()
    line2 = f.readline()
    line3 = f.readline()

print(line1)
print(line2)
print(line3)
#+end_src

#+RESULTS:
: Freq. V(Vout_2,Vin)
:
: Step Information: Run=0  (Run: 1/513)
:
: 1.00000000000000e+00  (-4.48239687492628e+01dB,1.66628953595615e+02\260)

There is a \260 character at the end of the last line which Emacs complains about:

These default coding systems were tried to encode text
in the buffer ‘task.org’:
  (iso-latin-1-dos (5414 . 4194224))
However, each of them encountered characters it couldn’t encode:
  iso-latin-1-dos cannot encode these: \260

I can open the file directly in Emacs and the character renders (see the degree symbol?):

1.00000000000000e+00    (-4.48239687492628e+01dB,1.66628953595615e+02°)
1.04712854805090e+00    (-4.42065188662135e+01dB,1.65176722894121e+02°)

The file encoding that Emacs chooses for the raw file is:

1 -- iso-latin-1-dos (alias: iso-8859-1-dos latin-1-dos)

ISO 2022 based 8-bit encoding for Latin-1 (MIME:ISO-8859-1).
Type: charset (charset)
EOL type: CRLF
This coding system encodes the following charsets:
  iso-8859-1

However, regardless of what file encoding I put for the file local variable in the analysis file, Emacs complains when I try to save the analysis buffer.

#+COMMENT: -*- coding: iso-8859-1; -*-

I've tried, utf-8, utf-16, iso-8859-1, iso-8859-15, etc.  Basically going down the list of list-coding-systems.  I haven't tried all of them yet.  But at this point I'm just guessing.  To move forward, I'm manually deleting the offending character and saving as utf-8.  How can I find an encoding so that I don't need to manually delete results?


texts: How do I add a keybinding to a keymap that is on a prefix key

texts:
I just installed the pt.el package and now I want to bind projectile-pt to the default projectile search prefix (which is C-c p s).
The goal is to have it as C-c p s p to begin with but also to have this follow the projectile prefix if I later change that to C-p for example (it would then automatically become C-p s p).

Is this possible? Sorry for the perhaps badly phrased question, will reword it if needed later.


texts: Getting text input into ivy completing read

texts: I know that I can get previous selections of ivy with ivy-history. But is there any way to get what was actually input into the search before choosing a match?


texts: Helm - How to change default selection while renaming?

texts:
I have a  dired buffer with two files

foo.py
foo_bar.py

Now to rename foo.py to bar.py, if  i goto foo.py,  press R and type bar.py, helm selection  will be like  this

Here helm is selecting  the top match  from the available file names.

How can i make helm to select the  user typed value as the default choice?


texts: How do you grep from within emacs ( git grep 'foo' | grep baa )

texts:
I do this often after shelling out to bash

$ git grep 'banner-image' | grep mb3

Can I do it without leaving emacs?


texts: How to use magit-clone for a non-standard port?

texts:
In git one could do this:

git clone ssh://userid@somerepository.org:2222/home/user/gitRepo/myRepo /home/user/localrepo

to clone a remote repo with ssh and a non-standard port (in this example: 2222).

Can the same be done with Magit2.0? Using the above format fails with an error that Magit is trying to user port 22


texts: Flycheck.erl checker that uses functions from projectile

texts:
Below is my attempt at adapting "erlang" syntax checker (from flycheck.el) for my needs. It tries to use GNU make for compilation instead of erlc. Apart from that nothing is changed.

(flycheck-define-checker erlang
  "An Erlang syntax checker using the Erlang interpreter.
See URL `http://www.erlang.org/'."
  :command ("make -C " (eval (projectile-project-root)))
  :error-patterns
  ((warning line-start (file-name) ":" line ": Warning:" (message) line-end)
   (error line-start (file-name) ":" line ": " (message) line-end))
  :modes erlang-mode)

Attempt to load it using flycheck-select-checker (C-c ! s) fails with following output:

Syntax checker in buffer test.erl in erlang-mode:

  erlang
    - major mode: `erlang-mode' supported
    - predicate:  nil
    - executable: Not found

Flycheck cannot use this syntax checker for this buffer.

How can I debug this beast?


texts: Finding parents without children in TODO state in org-mode

texts:
I'm using the TODO keyword for tasks.

Oftentimes, I need to find parent tasks with no children in TODO state (could be DONE, just not pending). These parent tasks are themselves marked as TODO.

Is there any search query (sparse tree match query) that would show me only those?


texts: Sending email with gnutls stopped working

texts:
I've been using the following setup Gnus SMTP

;;; SMTP
(defun email-settings ()
  (interactive)
  (setq message-send-mail-function 'smtpmail-send-it
        starttls-gnutls-program "gnutls-cli"
        starttls-use-gnutls t
        smtpmail-stream-type 'starttls
        smtpmail-default-smtp-server "smtp.mail.me.com"
        smtpmail-smtp-server "smtp.mail.me.com"
        smtpmail-smtp-service 587
        smtpmail-smtp-user "john.doe@mac.com"
        smtpmail-debug-info t
        smtpmail-debug-verb t))

for years to send the email via Gnus using gnutls-cli.  This setup stopped working recently on the starttls call:

Opening STARTTLS connection to ‘smtp.mail.me.com:587’...

When debugging the STARTTLS with gnutls-cli I am seeing this:

(~)[498]$ gnutls-cli --verbose --starttls --tofu -p 587 smtp.mail.me.com
|<1>| There was a non-CA certificate in the trusted list: O=Entrust.net,OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),OU=(c) 1999 Entrust.net Limited,CN=Entrust.net Certification Authority (2048).
Processed 175 CA certificate(s).
Resolving 'smtp.mail.me.com:587'...
Connecting to '17.56.136.170:587'...

- Simple Client Mode:

- Received[47]: 220 mr85p00im-zteg06012001.me.com 3.3.1 v.666`

and it never completes.  Does somebody know what's changed and what's wrong  and how to fix that?


texts:
As a programmer, I want to see a ruler at a specific column (usually 80), both so I see when I cross that column, but also to see how close I am getting to it so I can reformat my code early.

The options I have found so far are all not achieving this goal:

whitespace-mode, column-enforce-mode, and column-marker only highlight individual rows after the text in the row has already passed the fill-column. I'd like to see when I am getting close to the column, not just when I cross it.
fill-column-indicator would be a good solution, except it breaks auto-complete-mode, company-mode, avy, and more. These are issues that seem hard to fix, each requiring an individual workaround -- e.g., see the company-mode issue and the auto-complete-mode issue, the latter over two years old).

Are there any better alternatives?


texts: Avoid hijacking of `M-w` in Magit buffers

texts:
I often want to copy some text out of a Magit-buffer - part of a commit message, part of a diff, whatever.

Annoyingly M-w in a Magit buffer inserts a sha1 into the kill ring (magit-copy-buffer-revision), instead of the text between mark and point.

This is driving me insane.

Is there are configuration option or something to avoid this behaviour?

I am not using active regions (transient-mark-mode), which seems to be what Magit was designed with in mind.


texts: How to export an octave/matlab array for use by python in org-mode?

texts:
I am trying to pass the value of an octave/matlab array into a python code block in org-mode. But I can't get the python-end to receive the value.
With the answers in this question, I can generate an org-mode table from a matlab array a as follows:
#+name: test-data
#+begin_src octave :session test_case :exports both
  a =[ 1 2; 3 4; 5 6];
#+end_src

#+RESULTS: test-data
: org_babel_eoe

#+NAME: test-output-value
#+BEGIN_SRC octave :session test_case :results value :colnames yes :hline yes
  ans = a
#+END_SRC

#+RESULTS: test-output-value
| 1 | 2 |
| 3 | 4 |
| 5 | 6 |

However, when I try to pass the results of the matlab-generated table to python, I get no output from python:
#+NAME: ocatve-to-python
#+BEGIN_SRC python :var a=test-output-value :results value :exports none
  len(a)
#+END_SRC

#+RESULTS: ocatve-to-python
: None

Can anyone help explain how to make the chaining above work?
(This is with default Emacs 26, Python 3.8 of Ubuntu 20.04 LTS).


texts: Emacs 27.1 package error while installing package org-roam

texts:
I recently upgraded to 27.1 version from 24.5 version. I am trying to install org-roam.
When I use package-install RET org-roam, I am getting the following error.
Library is file /usr/share/emacs/27.0.50/lisp/emacs-lisp/package.elc
next-line: End of buffer [25 times]
package-compute-transaction: Package ‘emacs-26.1’ is unavailable

The main error is Package 'emacs-26.1' is unavailable.
I searched and found a couple of answers here and here but not clear.
The /usr/share/emacs/ directory is having three sub directories namely 24.4, 24.5, 27.0.50.
I don't know whether I have to change the load path of my package.el file or is there any other option.


texts: Change the editor in the View command called by TeX-command-master

texts:
The first C-c C-c by default suggests to run LaTeX command, and the second suggests View. The latter, in its turn suggest me a command to run the viewer, and I always have to change the editor to zathura. I’d want to make emacs stop asking and do LaTeX whenever I press C-c C-c and run View whenever I pass C-c C-v, since it doesn’t seem to do anything to me right now. Also I’d want to set up the default command for running the viewer, but I couldn’t find it. The LaTeX and the View commands are set in AUCTeX group under ‘Tex Command List’, and when we go down to the description of the View command we see

Name: View
        Command: %V

Oh wow.

The expansion of %V is defined below Tex Command List, under Tex Expand List, and here we see…

 Key: %V
            Expander:
(lambda nil
  (TeX-source-correlate-start-server-maybe)
  (TeX-view-command-raw))

M-x describe-function RET TeX-view-command-raw says

TeX-view-command-raw is a compiled Lisp function in `tex.el'.
(TeX-view-command-raw)
Choose a viewer and return its unexpanded command string.

So I have to somehow replace it with the actual command I want, a-and… How do I actually do that? Excuse me, I am aware of that that’s being very silly of me trying to do something with Emacs without a firm grasp of elisp, but how do I do that? Why isn’t there a filed for a command like Latex Command has?


texts: Org-Ref: How to custom bibtex-completion-fallback-options

texts:
How do we customize bibtex-completion-fallback-options in init.el?

The following code gave rise to the error below:

(add-to-list 'bibtex-completion-fallback-options
         `("NTU Library 台大圖書館                           (web)"
     . "https://ntu.primo.exlibrisgroup.com/discovery/search?query=any,contains,%s&tab=LibraryCatalog&search_scope=MyInstitution&vid=886NTU_INST:886NTU_INST&lang=zh-tw&offset=0"))

Helm issued errors: helm-match-from-candidates in source `Fallback options': wrong-type-argument (buffer-or-string-p (NTU Library 台大圖書館                           (web) . https://scholar.google.co.uk/scholar?q=%s))

I know one way is to do this through custom: C-h v bibtex-completion-fallback-options. But I'd like to learn to write some elisp code on my own.

How do I add a second item to the list? The second variable is not registered after a restart.

(add-to-list 'bibtex-completion-fallback-options
         `("NTU Library 台大圖書館                           (web)"
           . "https://ntu.primo.exlibrisgroup.com/discovery/search?query=any,contains,%s&tab=LibraryCatalog&search_scope=MyInstitution&vid=886NTU_INST:886NTU_INST&lang=zh-tw&offset=0")
         `("Academia Sinica 中央研究院圖書館                           (web)"
     . "https://las.sinica.edu.tw/search*cht/a?searchtype=t&searcharg=%s&SORT=D&submit.x=0&submit.y=0"))


texts: How to set Projectile project name as frame title

texts:
I would like to have the Projectile project name as frame title and also have it updated when I switch between two different buffers in two different Projectile projects. I tried with the following:

(setq frame-title-format
      '("" (:eval projectile-project-name-function)))

This doesn't work at all. The frame title is blank with no text at all. Any ideas?


texts: Match a string that includes a space in Helm

texts:
I find Helm's space separated queries very useful.

However, on occasion, particularly while using the @ prefix (searching for match within a buffer in helm-mini) I would like to be able to specify a single search string which includes a space.

E.g. @Find\ buffer\ matching\ this\ text

Is this possible?


texts: org-mode:  to set column width isn't working

texts:
I'm trying to set a column width in an org-mode table, but using the  syntax isn't working. Here's my table:

| col 1 | col 2 with quite a long header | col 3 here |
|-------+--------------------------------+------------|
|       |                            <5> |            |
| abc   |                            123 | x          |
| def   |                            456 | y          |

I'd expect that after a re-align, the second column would be displayed with a width of 5 -- but it stays the way seen above. I'm not exporting this file, I just want to narrow the usually-displayed column so my table is easier to read.

Any ideas why org isn't displaying the width correctly?


texts: Why is Spacemacs in ssh so different from local terminal and how to make it the same?

texts:
My Spacemacs share the same configuration on local macOS and remote Linux, but they look quite different.

The only OS related settings that I found in my configuration is that I enabled OSX layer on both. But I figured Spacemacs should be smart enough to do no harm on Linux even with this layer on.

Local:

SSH:

Things are not right in SSH:

Menu Bar is missing.
Line numbers are missing even though, as you can see, line-number-mode is on.
Some tofu() glyphs are shown on Mode Line.
Colors are slightly different.

What could be the cause? How do I fix them?


texts: How to save last place of point in a buffer?

texts:
I would like to save the last position of point in the buffer I am visiting, so to have point still there when I go back to that file.

I understand I can use saveplace for this, so I added this snippet in my configuration:

(use-package saveplace ; Save point position in files
  :init (progn
          (setq-default save-place t)
          (toggle-save-place-globally)))

Yet I am not getting the desired behavior: point is still place at the beginning of the buffer.

I am using Emacs 25.0.50.1 (45c92dd), but the same thing is happening with emacs -Q.


texts: Can I create a checklist entry using org-capture?

texts:
It seems to me that org-capture requires templates to start with a heading (*). Can I not have a template like:

("d" "Daily Tasks" entry (file+datetree+prompt "daily.org")
     "- [ ] %?")

that does not start with a *.


texts: Save current file with a slightly different name

texts:
My files have long filenames and a part of the filename is a date and a version number. Often I'd like to save the file in the buffer using nearly the same name, just change version number or date.

This would be much easier, if I had a command which puts the filename of the current buffer into the kill ring, so that I can open a file, then type C-x C-w (write file),  yank the current name with C-y, change it and save it.

I'm using Emacs 24.3 on Windows and 24.4 on Linux. I have to use different filenames and not git for various reasons. I'd be happy if this command worked with AUCTeX / LaTeX as major mode.

Edit 1:

I made a mistake: I don't want to type C-x C-f (=find file), but C-x C-w (=write file). I corrected this above.

Edit 2:

Found a duplicate question and answer: https://unix.stackexchange.com/a/45381 But there is no better anwswer!

Edit 3:

Here: http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Name-Components.html is a function, which selects the "nondirectory" part of the filname:

  Function: file-name-nondirectory filename

This function returns the nondirectory part of filename.

          (file-name-nondirectory "lewis/foo")
               ⇒ "foo"
          (file-name-nondirectory "foo")
               ⇒ "foo"
          (file-name-nondirectory "lewis/")
               ⇒ ""

If I only knew lisp...


texts: in org-mode, a function to delete all properties drawers?

texts:
I use Pandoc to convert from HTML and Markdown to org-mode. The conversion leaves lots of extraneous org-mode PROPERTIES drawers. How can I direct org-mode to delete all PROPERTIES drawers?

ADDITION: I'm using this shell script to run the conversion.

function pandoc2org () {
    basename=${1%%.*}                       # remove old file extension
    pandoc -s -S "$1" -o $basename.org      # name file as oldfile.org
}


texts: How to 'fix' gnuclient after opening a second instance of emacs?

texts:
If I open a second instance of emacs accidentally (which happens more often than I am willing to admit) and then close it, gnuclient starts responding with the following error:

gnuclient: Connection refused
gnuclient: unable to connect to local

Is there a way to fix this without closing the original instance of emacs and then reopening it?  Sometimes this is very disruptive, and I've grown quite dependent upon gnuclient.

Perhaps I should be using emacsclient instead?  I see that it continues sending files to the original instance (on which the server was started) and is not affected by the start of a second instance.

Perhaps emacsclient should be my default editor rather than emacs.


texts: How do I get rid of unwanted binding of the TAB key?

texts:
Recently my TAB key started acting very strange. At the left end of the line it indents my code normally, which it should also do if I hit TAB anywhere in the line. But now, if I'm in the middle of the line it tries to do a TAGS search. I don't have a tags file and I don't want one, thank you very much.
I'm using Prelude and believe it has to do with Projectile, which I've never used. When I ask emacs what the keybinding of the TAB key is with C-h k, it lies and says:

It is bound to TAB.

(indent-for-tab-command &optional ARG)

When I saw this last week I disabled Projectile mode and that helped but now it doesn't seem to help.
How can I find out what's binding this key and get rid of it?


texts:
I am using Emacs 26. Although in my init file i have the following

(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 (:family "Noto Mono" :foundry "GOOG" :slant normal :weight normal :height 143 :width normal)))))

and also the font Noto Mono is installed on my Debian machine, Emacs doesn't load the font specification at startup. The font size and the font itself found above in my init file are not considered. Instead Emacs has much smaller Font size and the Monospace font.
I am using the Emacs GUI.
Can any one help?


texts: Org Capture - prepend after org header/config block?

texts:
One of my org capture templates (in my init.el) looks like the following:

("n" "Note" plain
           (file "/path/to/file.org")
           "* %^{Title} %U \n%? \n"
           :prepend t)

I'd like to see the following after I capture a note using this template:

#+TITLE: Notes
#+DESCRIPTION: a file of notes

* captured note [2019-10-14 Mon 18:06]
* test note 2 [2019-10-14 Mon 13:00]
* test note 1 [2019-10-14 Mon 10:37]...

But what I actually get is:

* captured note [2019-10-14 Mon 18:06]

#+TITLE: Notes
#+DESCRIPTION: a file of notes

* test note 2 [2019-10-14 Mon 13:00]
* test note 1 [2019-10-14 Mon 10:37]...

The "prepend" property almost does what I want - it prepends the headline to the beginning of the file, rather than the end. However, I'd like the header to stay at the top of the file.

Is there a way to prepend new headlines after the initial "#+" lines?


texts: How can I specify the background color for matching search results?

texts:
When I incrementally search for a phrase with C-S, emacs usually highlights all matching results visible in the buffer by giving them a different background color. However, my current theme apparently uses the same background color as the normal background color, meaning I can't see the difference.

How can I specify a background color for matching search results?


texts: Highlight indent guides in org-mode src blocks

texts:
is it possible to show indentation guides in org-mode source code blocks? I use highlight-indent-guides-mode for highlighting indention and it does not work in org-mode (I think this is because the mode uses font-lock to draw indent guides and hence, it does not work for org-mode source code blocks).

Is there any other package that draws indent guides in org-mode source code blocks?


texts: Specify major-mode for files with multiple extensions

texts:
In my .emacs file, I have:

(setq-default major-mode
          (lambda ()
            (let ((buffer-file-name
                   (replace-regexp-in-string
                    "\\.tmp$" ""
                    (or buffer-file-name (buffer-name)))))
              (set-auto-mode)
              )))

This ended up causing files such as 'foo.el.tmp' to open in emacs-lisp-mode.

Once I upgraded Emacs, this started breaking; when I open a buffer that doesn't exist that should be open in fundamental-mode, such as 'asdfg', I get an error:

image-type-from-buffer: Variable binding depth exceeds max-specpdl-size

This seems to be due to (set-auto-mode) in major-mode calling now being recursive.

What's the best way to do this?


texts: term-raw-map and local-unset-key - Need to pass  to shell

texts:
As ansi-term doku tells us: any key which is not in use by emacs will be passed down to shell running inside term-mode.

As an example - I have a screen session running inside ansi-term and configured to respond to "C-o" (escape ^Oo in ~/.screenrc).

The "C-o" is not in-use by emacs, at least not in term-raw-map, so I have no trouble controlling my screen inside ansi-term.

On the other hand - <M-(arrow keys)> are in use by emacs and I want to not have those defined in term-raw-map only, otherwise I would like to keep the original mapping, even in term-line-map.

So, my thinking went - Let's undefine the offending key in term-raw-map, so that it could be passed down to whatever is running inside ansi-term.

Hence, the little piece of code, that demonstrates my conundrum.

First, I tried to define-key to nil, then tried to use a built-in local-unset-key, neither of those methods helped.

On the other hand, if I just redefine the keys to anything else, they work as expected.

My knowledge of emacs is currently insufficient to understand how to proceed to get the desired behavior.

;; For expediency I'm using only <M-left> and not all the arrow keys
;; to test - comment out one of the lines:
(defun my-local/term-hook ()
;; This does NOT work:
  (define-key term-raw-map (kbd "<M-left>") nil)
  ;; Neither does this:
  (local-unset-key (kbd "<M-left>"))

  ;; It does work flawlessly if redefined:
  (define-key term-raw-map (kbd "<M-left>") 'left-word))

(add-hook 'term-mode-hook 'my-local/term-hook)

So, to recap the question:
How to change the term-raw-map in such a way, that keys already defined in other maps would be undefined in term-raw-map?

For instance, in my particular case, I'm trying to have <M-(arrow keys)> uninterpreted by emacs current active keymap and passed down to shell, as is the case with "C-o".


texts: Org-table: is it possible to have automatic line wrapping inside org-tables?

texts:
Org-table has a very convenient property, it expands the width of a table column if needed to show all your text in a cell. Alternatively, you can set a fixed width for a table column and let your text be truncated (the not-shown text representet as ...).

However, sometimes it would have been practical to apply a fixed width on a table column, and instead of showing the text truncated, showing it as multiple lines automatically wrapped inside the table cell (thererby expanding the number of lines in the row of the table where your table cell is located).

Is autmoatic line wrapping possible within an org table?


texts:
I would like to set up things so that when I type Iuulius, the sequence uu is seamlessly replaced by ū (and a few more such pairs), as soon as I type the second u.  I.e. the keystrokes and buffer text would go like this:

<I> → I∎
<u> → Iu∎
<u> → Iū∎
<l> → Iūl∎

How could I set that up that kind of expansion—without interfering with existing input methods?


texts: Emacs regex replace while re-using part of the expression in the replacement

texts:
I sometimes need to do replacements which would involve using matched parts for the output.

For example, I would like to replace

varName->doWork()

with

::doWork(varName, 42)

whatever varName actually is.

Is there a straightforward way to do this?


texts: How can I translate my .vimrc into evil-mode

texts: I have heard of the power of Emacs, but I have a ton more experience with vim and an extensive amount of shortcuts in my .vimrc file. I would like to transfer these mappings over to Emacs evil-mode. What would be the best way to do this? One example would be mapping tab to >> (indenting the current line). Which looks like nnoremap <tab> >> in my .vimrc.


texts:
I have a complex Emacs setup. I love it, except for that fact that it freezes a couple of times a day for me. I have a few suspicion:

I use you-complete-me for auto-completion in c++ and it may be hanging on RPC call to the YMCD server.
I use el-get package manager and it occasionally checks with the server.

The problem is that another colleague has almost the same setup and his Emacs does not hang. How would I debug something like this?


texts: Emacs on OSX changes encoding while loading

texts:
When I start Emacs on OSX (installed via "brew cask install emacs"), I see the "U" for UTF-8 encoding in the mode line for a fraction of a second, then it changes automatically to iso-latin-1-unix when the scratch buffer is openend (I have set (setq inhibit-startup-screen t), so the scratch buffer is shown on startup).
My init.el defines
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(setq mm-coding-system-priorities '(utf-8))

Any new buffer is also created and files opened in iso-latin-1-unix. How can I set this to UTF-8 by default?


texts: Prevent dired-find-alternate-file from killing emacsclient

texts:
When visiting a folder with emacsclient, for example through emacsclient ., using dired, opening a folder using a will cause emacsclient to terminate. I believe this is because a, bound to dired-find-alternate-file will close the buffer emacsclient is in some way bound to causing it to terminate. I observe the same behavior when using dired-single.el.
Is there any way to prevent this from happening? Given my above assumptions about how why this happens: to make dired reuse the same buffer rather than destroy it?


texts: Can org options be applied to specific export modes only?

texts:
Here is an org document
#+title: my document
#+options: num:nil

* first section
** first subsection
* second section

My problem is that I want the option #+option: num:nil to only be applied when I export to html. When I export to other formats, I do not want this option applied. Is this possible?


texts: How to bind evil-leader keys for org-src-mode?

texts:
I want to bind evil leader keys for  org-edit-src-save and org-edit-src-exit in org-src-mode. And I have:

(evil-leader/set-key-for-mode 'org-src-mode
  "s" 'org-edit-src-save
  "'" 'org-edit-src-exit)

But it doesn't work.  What's wrong with my code?


texts: Accessing next/previous parenthesis instead of just the outermost one? (as with `syntax-ppss`)

texts:
syntax-ppss gives the surrounding parenthesis.

Is it possible to get the next/previous parenthesis using this API?
(which has the advantage of caching the syntax tree and working with multiple languages).

This would allow stepping over a region without having to start with the inner most nested part - working out.


texts: How do I use a remote virtual environment with emacs?

texts:
My particular setup is that my code lives on my machine and is mounted via vagrant onto a linux container upon which the virtual env lives.

I'd like to be able to edit all the code, including the site-packages which live on the LXC seemlessly and have them all integrated with something like elpy (which is amazing, all credit to those guys) in the context of the virtuall environment which is on the LXC.

How do I do this?


texts:
Saving a .tar file in Emacs works as expected. Saving a .gpg file also works as expected.

However, when I save a .tar.gpg file, instead of saving an encrypted form of the actual tar file, it instead saves an encrypted form of what the tar file appears in tar-mode.

For example, I create a tar archive with the file abc.org which has "Hello World!" in it. When I file it, I get this:

test.tar: tar archive

However, if I save the same tar file as a test.tar.gpg in Emacs, I get this when decrypted:

decrypted.tar: ASCII text

I believe this is because EasyPG doesn't understand that what's in the buffer isn't what needs to be saved. How would I go about fixing this?


texts: Make python code blocks format their results as Org tables

texts:
The context
In #+BEGIN_SRC code blocks whose language is cpp or sh, the tab character is used as a delimiter for cells when using the :results table header argument (see examples below)
#+begin_src cpp :results replace output table
#include <iostream>

int main() {
  std::cout << "a\ta\nbbbbb\tbbbbb" << std::endl;
  return 0;
}
#+end_src

#+RESULTS:
| a     | a     |
| bbbbb | bbbbb |

#+begin_src sh :results replace output table
printf "%s\t%s\n" "a" "a" "bbbbbb" "bbbbbb"
#+end_src

#+RESULTS:
| a      | a      |
| bbbbbb | bbbbbb |

However, this same behavior is not present in python code blocks (see below)
#+begin_src python :results replace output table
print("a\ta\nbbbbb\tbbbbb")
#+end_src

#+RESULTS:
: a a
: bbbbb bbbbb

The question
How can I make the output of python code blocks be displayed as Org tables. Isn't using those header arguments and make the output contain tab characters enough for the #+RESULTS to be formatted as an Org table?


texts:
Trying to understand what setf can do, I called

(macroexpand '(setf (aref vec i) val))
⇒ (let* ((v vec) (v i)) (aset v v val))

This seems obviously wrong.

However I couldn't create an actual instance where (setf (aref .. fails. E.g.

 (setq vec (make-vector 10 nil) i 3 val 'foo)
 ⇒ foo
 (setf (aref vec i) val)
 ⇒ foo
 vec
 ⇒ [nil nil nil foo nil nil nil nil nil nil]

Can someone explain what is going on here?


texts: How to Restore File System Access in macOS Catalina

texts:
I updated to macOS Catalina which requires the user through pop-ups to allow any app trying to access the file system for the first time.

No such pop-up is appearing for Emacs. Running the script shared here,
https://gist.github.com/dive/f64c645a9086afce8e5dd2590071dbf9
does not seem to change anything. That is, Emacs and any shell running in it cannot access any file on the file system.

How can I restore the access?

My Emacs version is *GNU Emacs 26.1 (build 1, x86_64-apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F2511))

UPDATE
Granting the Emacs app Full Disk Access in "General Settings -> Security & Privacy -> Privacy" does not solve the problem.


texts: Update spacemacs packages from the command line

texts:
I'm trying to write a shell function to launch (spac)emacs, update packages, and then restart emacs in daemon mode.

I tried this, but it hangs:

emacs --daemon && emacsclient -e '(progn (configuration-layer/update-packages))'


texts: header2.el: insert header between second and third row?

texts: I customized my own header and want it to be inserted between the second and the third line of the document. Unfortunately I'm not very used to Lisp, therefore I have a hard time trying to find the corresponding lines in header2.el. Any ideas on how to proceed?


texts: Executing the next command bound to the same key

texts:
Is it possible to write an execute-next-command function that calls the command that would have been called if the current binding was not active?

For example, RET is bound to newline by default.  Let's say that I bind RET to my-command. In some cases, my-command should execute whatever would have been executed for RET if I hadn't bound it to my-command.  I could save the old binding before rebinding RET, but I would rather avoid that.

EDIT: There is the key-binding function, but it doesn't let you find the next binding.


texts: Company completion when cursor is inside a word

texts:
Is it possible to configure company to do completion when cursor is inside a word?

For example, if: ('|' marks the cursor)

getStr|print

and there is a getStream completion, then after pressing my completion hot-key, I'd like to have:

getStream|print

Currently, completion fails, nothing happens. I always have to put a space after the word, then press left, and then initiate the completion.


texts: How to find the matching bracket at a point in elisp?

texts:
What is a reliable way to find the matching balanced bracket (eg: {}, [], () in C or Python), which doesn't get confused by brackets in strings, or escaped brackets for e.g.

Example:

["Foo]" ?\] 0 [1 2]]
^                  ^
Input point.      Return point.

Something like how show-paren-mode works, except as an elisp-function where you can pass in a point and get a matching point or nil when not found.


texts: How to make pop-up window appear in the divided portion of the frame

texts:
When using the popwin mode, I notice that the pop-up window always appears at the bottom of the entire frame. For example, given the frame contains two windows, divided vertically, and I am editing the left one

+++++++++++++++++++++++++++
+            |            +
+  Editting  |            +
+   window   |            +
+            |            +
+            |            +
+++++++++++++++++++++++++++

When performing some task, for example, compiling the editting file, the pop-up window in popwin mode will appear as follow:

+++++++++++++++++++++++++++
+  Editting  |            +
+   window   |            +
+            |            +
+++++++++++++++++++++++++++
+         pop-win         +
+++++++++++++++++++++++++++

I find out that it's is a waste of space that the pop-up window occupies and the other window is shrunk, consequently.

So, I would like to ask if popwin mode can be configured to appear as follow?

+++++++++++++++++++++++++++
+  Editting  |            +
+   window   |            +
+            |            +
++++++++++++++            +
+   pop-win  |            +
+++++++++++++++++++++++++++

Thank you very much for spending your time to read my question. Any helps is much appreciated.


texts:
How can we use emacs to read and write email?

This question is intended to provide a canonical landing point for users wanting to deal with email using emacs.

Please post only one package/solution per answer, with as much details as you can. Information that may be useful include:

requirements, supported environment
supported methods (read and/or send)
supported protocols (pop, imap, smtp, local mail setup...)
supported authentications
password storage (none, plain-text, access to an external wallet...)
offline support (none, aggressive caching, on-demand...)
how easy is it to use attachements? (adding with drag-and-drop, downloading, opening with emacs or another application...)
setup instructions (the more detailed the better), screenshots...
support for additional email features (archiving, filtering, folders)
support for additional related features (contacts, rss feeds)... no need to be too detailed here, depending on how closely the feature relates to email

Solutions requiring an external tool in order to process the mail are welcome, as long as the user does not need to interact directly with the external process.

Examples: a package acting as a front-end for mutt is on-topic, a solution allowing a thunderbird user to write his message using emacs isn't.

Meta post for discussion.

Quick links to answers (alphabetically):

GNUS
Mew
Mu4e
Notmuch
Wanderlust


texts: Why isn't the flushed output from my Emacs shell buffer getting into the kill ring?

texts:
Following the advice given on p. 121 of Learning GNU Emacs, 2nd Ed.,
I'm entering the command sequence: C-c C-o, immediately after executing a command in my Emacs shell buffer.
And I'm seeing the output from that command get flushed, as expected.

However, the flushed output is not making it into my kill ring.
When I move into another buffer and give the command: C-y, I don't get the flushed output.
Instead, I get the last thing I copied in Safari, using: Cmd-C.

I'm on a MacBook Pro running MacOS X 10.13.6 (High Sierra).
And I'm running Emacs v26.1, from Emacs for MacOS X.


texts: Add window to the right of two horizontally split windows

texts:
Following scenario:
1) I start emacs and the initial frame is as follow:

+---------------+
|               |
|               |
|               |
|               |
|               |
+---------------+

1) I split the window horizontally (C-x 2).

+---------------+
|               |
|               |
+---------------+
|               |
|               |
+---------------+

2) now I would like to have one third window, which stretches over the two horizontal ones, resulting in a layout as follow:

+----------+----+
|          |    |
|          |    |
+----------+    +
|          |    |
|          |    |
+----------+----+

How can I achieve this easily without deleting one window (C-x 0), splitting vertically (C-x 3) and then splitting each window horizontally again (C-x 2) ?

My real setup is obviously much more complex, and I resort at the moment to creating a second frame which I would like to avoid.

The same question can be asked for horizontal.


texts: How to reference named table or code block in Org-mode

texts:
In Org-mode buffers, table or code block can have #+NAME: title.
But I don't know how to reference them in current buffer or in other files with org-mode hyperlink. (like one link format: [[file:some-file.org::*headline]])

Org-mode has support for some Custom Search functions.
By default, Org-mode does not supprt this.

Does anybody knows how to add this support?


texts:
I am running Debian 9.3. I created an .xinitrc file and a symlink, .xsession. File permission was changed to 774.

#!/usr/bin/env bash
#
# This is a sample file for the ~/.xinitrc file.
#
# Set fallback cursor
xsetroot -cursor_name left_ptr

# If Emacs is started in server mode, `emacsclient` is a convenient way         to edit
# files in place (used by e.g. `git commit`)
export VISUAL=emacsclient
export EDITOR="$VISUAL"

# Disable access control
xhost +SI:localuser:$USER

## Over-rides
#
xset b off &
#numlockx off                    # Turn off numlock

# Set keyboard repeat rate
xset r rate 180 40

nm-applet
exec dbus-launch --exit-with-session emacs

My init.el has the following:

(require 'exwm)
(require 'exwm-config)

(setq exwm-workspace-number 4)

(require 'exwm-randr)
(setq exwm-randr-workspace-output-plist '(0 "VGA1"))
(add-hook 'exwm-randr-screen-change-hook
      (lambda ()
        (start-process-shell-command
         "xrandr" nil "xrandr --output VGA1 --left-of LVDS1 --auto")))
(exwm-randr-enable)

[...]

;; Global keybindings can be defined with `exwm-input-global-keys'.
;; Here are a few examples:
(setq exwm-input-global-keys
  `(
    ;; Bind "s-r" to exit char-mode and fullscreen mode.
    ([?\s-r] . exwm-reset)
    ;; Bind "s-w" to switch workspace interactively.
    ([?\s-w] . exwm-workspace-switch)
    ;; Bind "s-0" to "s-9" to switch to a workspace by its index.
    ,@(mapcar (lambda (i)
                `(,(kbd (format "s-%d" i)) .
                  (lambda ()
                    (interactive)
                    (exwm-workspace-switch-create ,i))))
              (number-sequence 0 9))
    ;; Bind "s-&" to launch applications ('M-&' also works if the output
    ;; buffer does not bother you).
    ([?\s-&] . (lambda (command)
                 (interactive (list (read-shell-command "$ ")))
                 (start-process-shell-command command nil command)))
    ;; Bind "s-<f2>" to "slock", a simpl0e X display locker.
    ([s-f2] . (lambda ()
                (interactive)
                (start-process "" nil "/usr/bin/slock")))))

;; To add a key binding only available in line-mode, simply define it in
;; `exwm-mode-map'.  The following example shortens 'C-c q' to 'C-q'.
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)

(setq exwm-input-simulation-keys
  '(
    ;; movement
    ([?\C-b] . [left])
    ))

;; Do not forget to enable EXWM. It will start by itself when things are
;; ready.  You can put it _anywhere_ in your configuration.
(exwm-enable)

When I ran xinit -- vt01 in a virtual console, I received the following error:

(EE)
Fatal server error:
(EE) Server is already active for display 0
If this server is no longer running, remove /tmp/.X0-lock and start again.
[...]
XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0" after 7 requests (7 known processed) with 0 events remaining.

I'm not sure how to resolve this, and would appreciate suggestions. Thanks for your time.

EDIT: jue's answer did the trick. I am now encountering a different problem--I've attempted a multi-monitor setup, but do not know how to open emacs in more than one monitor. I cannot seem to bind anything using exwm-input-global-keys with the Super key; funny enough, I am able to setq exwm-input-simulation keys properly. Does anyone know how to have emacs frames open in both monitors in the same workspace?


texts:
When writing Lisp, I often encounter a long line such as the following.

(map function (|apply append long-list-name1 long-list-name2 long-list-name3))

(where '|' denotes the point).

This can be a problem for readability especially if the long line ends up being nested at a deeper level.  Is there a package available that will transform this into the following (and also perform the inverse operation)?

(map function (|apply append
                      long-list-name1
                      long-list-name2
                      long-list-name3))


texts: How to use org-protocol and org-capture in spacemacs?

texts:
I've been having some problems when using org inside spacemacs. I make use of org-protocol to capture stuff that I find interesting when I'am browsing  and have it inside spacemacs. The problem is that I can't seem to get it this process to work flawlessly. Sometimes everything works fine but other times instead of opening the capture inside spacemacs I get No server buffers remain to edit and a new browser window pops up. Othertime I get Error (use-package): org-projectile/:config: Symbol’s function definition is void: org-projectile:per-repo and once again a new browser window pops up.

In my .spacemacs file I enabled the org layer and in user-config I have the following:

  (server-start)
  (use-package org-capture
    :bind ("<f8>" . org-capture)
    :after org)

  (use-package org-protocol
    :after org)


texts: How to change encoding of a string (to fix bad encoding)?

texts:
I'm really confused about this issue since it should be doable, but i fail to understand it.
I have some file with broken encoding (a pdf file, actually), which I copy some text from. When I paste this text into emacs (or anywhere else) I get sth like "íàïðèìåð", while the correct variant should be cyrillic "например". My buffer encoding is utf-8 and the broken text has something to do with cp1251. My goal is - obviously - to repair this broken encoding and insert it in place of the broken pasted text.
I tried different combinations of encode-coding-string and decode-coding-string with utf-8 and cp1251, but it gave me some other broken encodings or just a bunch of spaces (that's kinda weird)
Sorry for my messy statement, I just really don't get all this encoding stuff.

What I achieved is a (half)solution for the reverse problem: if i write (encode-coding-string "например" 'cp1251) and press C-x C-e, it prints "íàïðèìåð" to the messages. It's strange, but if I try to insert result of this computation into a buffer I get some nonsense yet again... Maybe I miss another aspect of this problem...


texts: What's the meaning of the org-mode agenda footer?

texts:
Can anyone explain what the first characters of the footer mean and what is the date in parenthesis?

How is this part of emacs really called? I'd be happy to look this up myself but couldn't find it.


texts: Evaluating inline code inside a source block in org-mode

texts:
Sometimes in combinatoric programming it is helpful to explain the
meaning of certain threshold values in code blocks. Example:

if x > 20 # combi(20,4) == 4845 is too large
then
    value_too_large()
else
    continue the computation

Is there a way to compute and expand this 4845 part in org-mode's code blocks?