texts: Remove stale buffers after switching to a different branch

texts:
This is the scenario:

Switch to a new git branch
Open some "new files" in that branch
Switch back to an older branch that doesn't have these "new files"
I want these opened buffers for these not any more existent files purged

How to do that?
I tried (recentf-cleanup) but that didn't work.


texts:
I installed rustic-mode with LSP server. They work. But now it shows docs and description of every symbol I put my cursor on. It distracts and irritates me a lot. How can I make it show the symbol info and docs on demand only when I click a certain key? I tried this:
(setq lsp-eldoc-render-all nil)
(setq lsp-enable-symbol-highlighting nil)
(setq lsp-eldoc-render-all nil)
(setq lsp-signature-render-documentation nil)

But only what I got so far is this:


texts: Help Aligning a Pattern with `align-regexp`

texts:
How can I use M-x align-regexp to align by

//
All ; after //
All , within [] after //

For example:

With text:

Line 1 ; B // Comment 1 [11, 22] ; Comment 2 [3333, 4]
Line 2 C // Comment 3 [3, 55]   ; Comment 4 [33,222]

How can I achieve alignment of something like

Line 1 ; B // Comment 1 [11, 22]; Comment 2 [3333, 4]
Line 2 C   // Comment 3 [3 , 55]; Comment 4 [33  ,222]

I have confirmed already that M-x align-regexp // aligns the // properly, but everything else after that is over my head :-)


texts:
In my previous question I asked about complex comment-start sequence and I think I figured it out, but now I have another problem. Let say we have this mode:

(defconst test-font-lock-keywords
  '(("\\<\\(nop\\|end\\)\\>" . font-lock-keyword-face))
  "Expressions to highlight.")

(defvar test-syntax-table
  (let ((st (make-syntax-table)))
    (modify-syntax-entry ?\; "<" st)
    (modify-syntax-entry ?\n ">;" st)
    st)
  "Syntax table.")

(defun test-syntax-propertize (start end)
  (funcall (syntax-propertize-rules
            ("\\<\\(s\\)tart\\>" (1 "< b"))
            ("\\<en\\(d\\)\\>"   (1 "> b")))
           start end))

(define-derived-mode test-mode prog-mode "Test"
  (setq-local comment-start ";")
  (setq-local font-lock-defaults '(test-font-lock-keywords))
  (setq-local syntax-propertize-function #'test-syntax-propertize)
  "Test major mode.")

So we have two instructions nop and end, but end is also set as comment ender and if there is no start before end I'd like to set keyword-face but it does not work, end instruction don't change color at all. I understand why it's happening, but I'm new in elisp and don't know how things work in detail so I can not fix it. Any advice will be appreciated.


texts: Pasting text into Emacs but preserving empty lines between paragraphs

texts: When I copy text from another application and paste it into Emacs it removes all formatting including the empty lines between paragraphs. I would like to paste into Emacs and preserve the empty lines. I am running Debian 10. My version of Emacs is GNU Emacs 27.0.50. The behaviour is reproducible with emacs -Q. The specific application in question is Atril document viewer.


texts:
In vim and evil mode, normal-state C-w prefixes various window-related
commands.  For example, C-w l moves focus to the right, and C-w L
moves the currently focused window to the right.

I would like access these commands in buffers that do not play well with
evil mode (such as PDF buffers).  Is it possible to make C-c w act
globally as C-w does in evil normal state?  It should be possible to
use prefixes and counts.


texts: How to make a key binding to the left shift?

texts:
I have a Mac keyboard and trying to assign the backslash character to the "left shift + `" combination.

However the following code:

(global-set-key (kbd "S-`")
                'insert_backslash)

(defun insert_backslash ()
  (interactive)
  (insert "\\"))

creates the binding only for the right shift key.
How do I assign it to the left shift instead?


texts: org-mode and bibtex latex export problem

texts:
I followed this and can grab stuff (with Google Scholar) and put it in my ref.org, as described. However when I create a testbibtex.org with this lone line:

\bibliography{ref}

all I get with Latex export is the word "Contents." I've copied the contents of ref.org to ref.bib, entries such as this:

@book{burton2006elementary,
  title={Elementary number theory},
  author={Burton, David M},
  year={2006},
  publisher={Tata McGraw-Hill Education}
}

but nothing of this is included in the Latex export. So, yeah, I really need a beginner's tutorial in this whole process.


texts: Org-mode results verbatim not working for Scheme code

texts:
I have the following source block of Scheme code:

#+BEGIN_SRC scheme :results value verbatim append
(define shift
  (lambda (list-with-sublists)
    (cond
     [(pair? (car list-with-sublists))
      (cons (car (car list-with-sublists))
            (cons (cdr (car list-with-sublists))
                  (cdr list-with-sublists)))]
     [else
      (cons (car list-with-sublists)
            (cdr list-with-sublists))])))

(shift '(a (b c) d))
#+END_SRC

However, it seems that org-mode cannot resist formatting the resulting list as a table and it will output tables, disregarding the verbatim argument:

#+RESULTS:
| a | (b c) | d |
| a | (b c) | d |
| a | (b c) | d |

I have tried it with silent and in the minibuffer the output is only a string (a (b c) d). So I went ahead and tried to output the same string in Python, to see, whether it is programming language related:

#+BEGIN_SRC python :results output verbatim replace
print("(a (b c) d)")
#+END_SRC

#+RESULTS:
: (a (b c) d)

This works just fine. verbatim only does not work for my Scheme code.

What am I doing wrong?

Versions

Emacs: GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.0)
of 2018-11-14
Org-mode: 9.1.9 (built-in)

Edit

By now I have figured out, that I can get a string output, but only, if I format the Scheme value as a string already in my code. Probably the issue is, that Org-babel does not know how to deal with arbitrary values from any programming language.


texts: How to deal with particular key-binding conflict (F3 key on Mac)

texts:
I would like to make a very basic macro on my Mac, to have a command that
writes a list of slashes in the current file : ////////////////////

The "Basic emacs macros" section of the manual says :

‘<F3>’
     Start defining a keyboard macro
     (‘kmacro-start-macro-or-insert-counter’).
‘<F4>’
     If a keyboard macro is being defined, end the definition;
     otherwise, execute the most recent keyboard macro
(‘kmacro-end-or-call-macro’).

Unfortunately, on my High Sierra Mac the F3 and F4 keys have a builtin "Mission Control" behaviour, so I cannot define macros this way.

How to fix this ?


texts: magit-status does not open, when using (global-whitespace-mode 1)

texts:
This problem started happening today when I switched to my desktop computer after a couple months of using my laptop.  I updated emacs to 25.3.1, updated all my packages, and downloaded my latest .emacs, the one that I had been using on my laptop.

When I run M-x magit-status, I get the following message:

user-error: Whitespace-Mode isn’t compatible with Magit.  See `magit-diff-paint-whitespace' for an alternative.

This only happens after I run (global-whitespace-mode 1) to enable visible whitespace everywhere.  When I run (global-whitespace-mode 0) then I can run magit-status but lose global whitespace.


texts: How to get rid of the "unsaved" title from the exported agenda document?

texts:
When I export the custom agenda view I get this "unsaved" text in the exported PDF document (see blow):

Exported PDF

Agenda-related code in init.el

  (setq org-agenda-exporter-settings
    '((ps-number-of-columns 2)
      (ps-landscape-mode t)
      (org-agenda-add-entry-text-maxlines 5)
      (org-agenda-write-buffer-name "My Agenda (filtered by :@WORK:)")
      (htmlize-output-type 'css)))
  (setq org-agenda-custom-commands
    '(("w" "Work-related tasks"
       ((agenda ""))
       ((ps-number-of-columns 2)
        (org-agenda-span 14)
        (ps-landscape-mode t)
        (org-agenda-prefix-format " [ ] %t ")
        (org-agenda-time-grid nil)
        (org-agenda-show-all-dates t)
        (org-deadline-warning-days 0)
        (org-agenda-with-colors nil)
        (org-agenda-remove-tags t)
        (org-agenda-tag-filter-preset '("+@WORK")))
       ("~/Dropbox/orgfiles/views/work.pdf"))))

I tried to remove it by adding this line but to no avail:

  (org-agenda-write-buffer-name "My Agenda (filtered by :@WORK:)")

What does it mean "unsaved"? Is there any way to replace it correctly?

Note

To have PS (default) exported to PDF you need to have ps2pdf tool installed in your system.
To export the agenda view press C-c a e


texts: Orgmode export: how to prevent a new line for comment lines

texts:
Currently my orgmode (v8.3.4), when exporting to LaTeX (and maybe other formats but I haven't checked), generates a new line for a comment line or a block of consecutive comment lines. This is undesirable because in LaTeX, that will create a new paragraph. When I write, I often need to comment a line or two in the middle of a paragraph but don't want to split that paragraph into two. Currently, because of this behavior of orgmode, I have to move those commented lines to after the paragraph, which may be confusing when I revise the text.

Below is a minimal example. The orgmode source is:

First sentence.
# Commented sentence.
Last sentence.

which is exported to LaTeX by orgmode as (omitting the preamble):

\begin{document}
\tableofcontents

First sentence.

Last sentence.
\end{document}

There is an empty line between the first and last sentences, which results in two paragraphs instead of one.

Is there any way to stop this behavior of orgmode? A comment line, or a block of comment lines, should be exported to 0 byte / character, not even a new line. This is the behavior of LaTeX when processing comments.


texts: How to tell Occur to show the line in the top of the buffer

texts:
I usually use occur to make an index of the beginning of different things. When I jump to the occurrence, Occur shows the line in the middle of the buffer. How can I instruct occur to show the occurrence in the top of the buffer?

Thanks.


texts: How can I export an Org subtree to HTML from the command line?

texts: I have a list of links that I store in a subtree in an org file. Is there a way to export this to an HTML file using the command line? I figure it's something like emacsclient --eval ... with an elisp command for exporting that header, but I'm not sure how best to go about this.


texts: Replace welcome screen (aka "splash" screen) with calendar?

texts:
I want to replace the welcome screen with the calendar.

I've tried adding (calendar) to my .emacs but it opens calendar in addition to the welcome screen not instead of it.

EDIT: I'm trying what is suggested by @Drew, I press M-x customize-option and then enter initial-buffer-choice. Which brings me here.

Would I enter the Calendar command on this page, or did something go wrong?


texts: "Runaway argument" when running exporting to PDF with hyperlinks

texts:
I have been trying to do my resume in org-mode and export it to pdf with org-latex-export-to-pdf. I have almost gotten it just the way I want it, but for some reason whenever I try to add a hyperlink to the resume (to a github project, for example), and run the export command, I get a message in the echo area:
Process completed with errors: Runaway argument

When I go to the Org PDF LaTeX Output buffer, I see a bunch of warnings like this:
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref)                removing `\<let>-command' on input line 97.

There are many lines like this all from the same input line (the line with the hyperlink) but with a different removing... message. I have been using org-mode and Emacs for a little while now, but I just started learning LaTeX yesterday, so the errors are a little difficult for me to debug. Any idea what is going wrong here?
Update:
Here is the line in the generated .tex file:
\subsection{EmacsBehavior - \url{https://kivy.org/docs/api-kivy.uix.behaviors.emacs.html}}

generated from this line in the .org file:
*** EmacsBehavior - https://kivy.org/docs/api-kivy.uix.behaviors.emacs.html


texts: Run latexmk with luatex or pdflatex depending on the local variable

texts:
I want to run Latexmk automatically with the correct TeX-engine as set in the local file variable at the end of the file, for example:

%% Local Variables:
%% TeX-engine: luatex
%% End:

In my .emacs file I tried something like:

(add-hook 'LaTeX-mode-hook (lambda ()
  (push
    '("Latexmk" "latexmk %(-PDF) %s" TeX-run-TeX nil t
      :help "Run Latexmk on file")
    TeX-command-list)

'("%(-PDF)"
  (lambda ()
    (if (equal TeX-engine 'luatex)
        "-lualatex" "-pdf"))))

but it doesn't work.

So how can I get the desired result?


texts:
I have installed emacs on windows 10 working ok so far. Installed R and ESS.
Set system and user path to Rterm.exe as read in some forums.
Restarted and opened a R file in emacs.
Syntax coloring is Ok, emacs entered ESS-R-mode but I cannot evaluate R code.

Using C-c C-n to evaluate the current line / selection, gives me a message:

"Searching for program: No such file or directory, R"

M-x R prompt for starting project directory, but same message is shown.

Double checked system PATH and everything seems ok.
Checked emacs variable "getenv" and path is properly set to Rterm.exe folder.

I can open a shell inside emacs and run R prompt with no issue.

any hint?

UPDATE:
tried setting (inferior-R-program-name "C:/Users/joe/R/bin/x64/Rterm") and (inferior-ess-r-program "C:/Users/joe/R/bin/x64/Rterm.exe") to .emacs file and now emacs is stuck on blank screen after asking for R starting project directory. The only way to close it is Task Manager - kill process


texts: how to copy a deeply nested binary file from one git repo to another

texts:
I want to copy an image file from one github repo to another. The source and destination file paths are deeply nested within the repo (eg. copy ~/code/repo1/src/components/A/components/B/common/components/C/images/image1.png to ~/code/repo2/src/components/D/images/image1.png, so I want a convenient way to construct the file paths without manually typing them.

Ideally the solution would involve fuzzy file finding so that it's easy to construct the path to image1.png without having to type the directory names.


texts:
I want the image tooltip code also make work for pdf format, thus I added the pdf keyword to the file extension list of the original code (http://kitchingroup.cheme.cmu.edu/blog/2016/03/21/Displaying-image-overlays-on-image-filenames-in-Emacs/#sec-1)). However it doesn't work with pdf. How can I make this work?

(defvar image-tooltip-re (concat  "\\(?3:'\\|\"\\)\\(?1:.*\\."
                                  (regexp-opt '("png" "PNG" "JPG" "jpeg"
                                                "jpg" "JPEG" "eps" "EPS" "pdf"))
                                  "\\)\\(?:\\3\\)")
  "Regexp to match image filenames in quotes")

(defun image-tooltip (window object position)
  (save-excursion
    (goto-char position)
    (let (beg end imgfile img s)
      (while (not (looking-at image-tooltip-re))
        (forward-char -1))
      (setq imgfile (match-string-no-properties 1))
      (when (file-exists-p imgfile)
        (setq img (create-image (expand-file-name imgfile)
                                'imagemagick nil :width 200))
        (propertize "Look in the minibuffer"
                    'display img)))))

(font-lock-add-keywords
 nil
 `((,image-tooltip-re
    0 '(face font-lock-keyword-face
             help-echo image-tooltip))))

(font-lock-fontify-buffer)
(setq x-gtk-use-system-tooltips nil)

"tikz-standalone.pdf"

I think the imagemagick backend should support it, for example I can do display file.pdf from command line.


texts: Getting the CLOSED timestamp of the current subtree

texts:
To get the current date and time, I can use (current-time).

But instead, I want to get the CLOSED timestamp of the current subtree and store it in a variable, so that I can pass it to format-time-string.

What's the simplest function to retrieve the CLOSED timestamp of a subtree?


texts: Emacs handle when file renamed externally

texts:
How can I configure Emacs to update a buffer's file association when the file is renamed externally?

In Textmate, I can open a file "foo.txt", use a different program to rename the file to "bar.txt", and Textmate automatically notices that the file was renamed. The new filename is displayed in the Textmate's window title, and editing and saving the file writes the changes to "bar.txt".

In Emacs, if I open a file "foo.txt" then use a different program to rename the file to "bar.txt", Emacs' buffer is still associated with "foo.txt". Editing and saving the file writes the file back to "foo.txt", but I would like it to write the file to "bar.txt" (I would also like the buffer name to change to "bar.txt", and for revert-buffer to read the file from "bar.txt").


texts: Allow custom function to take from lexical environment

texts:
I am trying to convert my code to use lexical binding.

I have a function (format-template) that calls a lambda function (let-bound to replacer-inner) from a user-customizable list (template-replace-functions) of functions based on a match-string. The replacer-inner function takes no arguments and returns a string, however, it may need to use variables foo bar and/or baz, which are passed as part of the argument list to format-template.

(setq lexical-binding t)

(defcustom template-replace-functions
  '(("email"
     (lambda () user-mail-address)
    ("apples"
     (lambda ()
       (cond ((= foo 1)
              "one")
             ((= foo 2)
              "two")
             ((= foo 3)
              "three")
             (t "four"))))
    ("bananas"
     (lambda ()
       (if (eq bar 'move)
           "movement" "sit still")))))
  "Association list of replacement functions.

For each STRING, the corresponding FUNCTION is called with no
arguments and must return a string."
  :type '(repeat (group string function))
  :group 'spice-girls)

(defun format-template (list)
  (let* ((foo (nth 0 list))
         (bar (nth 1 list))
         (baz (nth 2 list))
         template
         (replacer-outer
          (lambda ()
            (replace-regexp-in-string
             "\${\([^\s\t\n]*?\)}"
             (lambda (match)
               (let* ((key (match-string 1 match))
                      (replacer-inner
                       (cadr (assoc key template-replace-functions))))
                 (if (and replacer-inner
                          (stringp (funcall replacer-inner)))
                     (funcall replacer-inner) "")))
             template t t))))
    (setq template
          ...)
    (if template (funcall replacer-outer))))

So, for example, list contains three elements, which are let-bound to foo bar and baz. The key of the match-string is "bananas" which associates to a function in template-replace-functions and sets replace-inner to:

(lambda ()
       (if (eq bar 'move)
           "movement" "sit still"))

At this point, the above lambda function needs to know bar, which is fine using dynamic binding, but not so fine using lexical binding.

My question is, how do I do this to allow the lambda function bound to replacer-inner take from the let-bound values of foo bar and baz?

(Just to confuse things, the replace-outer function, which contains replace-inner, is let-bound because it is called from one of two places in the real function. I could have written inline here but have included it this way in case it adds to the problem.)

Edit:

Halfway there...

(setq lexical-binding t
  foo 0
  bar 0)

(setq inline-fun-1
      '(lambda ()
         (setq return
               (if (eq foo 1)
                   "Pass" "Fail"))))

(defmacro lex-fun ()
  `(let* ((foo 1)
          (bar 1)
          return)
     (funcall ,inline-fun-1)))

(lex-fun)    ; -> "Pass"

(defun inline-fun-2 ()
  (setq return
        (if (eq bar 1)
            "Pass" "Fail")))

(defmacro lex-fun ()
  `(let* ((foo 1)
          (bar 1)
          return)
     (funcall ,inline-fun-2)))

(lex-fun)    ; -> Lisp error: (void-variable inline-fun-2)

So, expanding the lambda function within a macro appears to work, but not a named function. But I do want to allow the user lambda or named functions. How to get around this?


texts: How to use Org Capture to add a task *and* automatically add parent's property

texts:
I'm trying to create an org-capture template that creates a task and (important part) automatically adds a parent's property to this new task. I'm comfortable creating new capture templates--I'm just unsure of the latter part.

If it matters I'm trying to "inherit" the CATEGORY property to my new tasks.

Also, I prefer not to use property inheritance if I can help it. The documentation is very clear that this can adversely affect performance.


texts: package-initialize: wrong type argument : arrayp , nil

texts:
while going through the emacs as a c/c++ editor , I came across the following lines of code to include in my ~/.emacs file, to connect to
melpa archives for package installation

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))
(package-initialize)

after saving these lines into emacs , when i started emacs it is showing me an wrong type argument: arrayp, nil in the minibuffer area

when i tried for $ emacs --debug -init , I got :

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  package--add-to-archive-contents(nil "melpa")
  package-read-archive-contents("melpa")
  package-read-all-archive-contents()
  package-initialize()
  eval-buffer(#<buffer  *load*> nil "/home/anupam/.emacs" nil t)  ; Reading at buffer position 905
  load-with-code-conversion("/home/anupam/.emacs" "/home/anupam/.emacs" t t)
  load("~/.emacs" t t)
  #[0 "\205\262�    \306=\203�\307\310Q\202;�   \311=\204�\307\312Q\202;�\313\307\314\315#\203*�\316\202;�\313\307\314\317#\203:�\320\nB\321\202;�\316\322\323\322\211#\210\322=\203a�\324\325\326\307\327Q!\"\323\322\211#\210\322=\203`�\210\203\243�\330!\331\232\203\243�\332!\211\333P\334!\203}�\211\202\210�\334!\203\207�\202\210�\314\262\203\241�\335\"\203\237�\336\337#\210\340\341!\210\266\f?\205\260�\314\323\342\322\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" (initialization "`_emacs' init file is deprecated, please use `.emacs'") "~/_emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default"] 7 "\n\n(fn)"]()
  command-line()
  normal-top-level()

I am new to emacs, can someone please tell me how can i resolve this?


texts:
I thought that org-mode highlighted source blocks with the relevant mode. So for example:

#+BEGIN_SRC clojure
(defn plus [a b]
  (+ a b))
#+END_SRC

This would show up with the syntax highlighting one would expect if in a Clojure buffer.

For some reason, my setup is just showing the above example in one monotone of gray.


texts: Encrypt both mail body and attachment with gnus

texts:
I'd like to encrypt with gpg some mail messages sent with gnus. When there is no attachment, epa-mail-encrypt works and I get a gpg-encrypted mail message. However, if I add an attachment and then run epa-mail-encrypt, no attachment is sent, and the email received only has the

<#part type="application/pdf" filename="some-file.pdf" disposition=attachment>
<#/part>

mime part designation encrypted in the body.

I'm looking for a gnus addon that would extend epa-mail-encrypt in order to encrypt all mime parts of the message (body, pdf attachments...).


texts: How to make tab key shift test after cursor in evil mode insert state

texts: To be honest, I'm very novice in Emacs, so is it possible somehow to bind TAB key in insert state of evil mode to shift text after the cursor right on current indentation amount of spaces at each key press. And how to do reverse process (shifting of  text after cursor to the left) on Shift+TAB pressing.


texts: org babel exports code blocks even if I tell it to export results instead

texts:
How can I make org-babel only export results, not code? The only way I've found to suppress code from appearing in the output is to comment out all the code blocks manually. I tried adding :exports results but it still includes the code.

I'm using Emacs 25.2 with org-mode 9.0.6.


texts: Org-mode export error- Wrong type argument: org-export-backend

texts:
I'm trying to export an Org document to latex, but get the following error:

org-export-get-all-transcoders: Wrong type argument: org-export-backend, [cl-struct-org-export-backend nil latex ((underline lambda (o c i) (format "\\underline{%s}" c))) nil nil nil nil]

What's the way to debug it and find the error? If I create a new *.org document it can be exported to latex witout problems. Therefore I think that the reason is in the document itself, but I don't know how to look for the cause of the error.

I'm using GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.5) and have already updated all packages with M-x list-packages -> U -> x. Exporting to other formats (e.g. html) works fine.


texts: Recursively Refiling All Subtrees with @Tag to a Destination (Org-Mode)

texts:
Suppose we have:

* Parent
** Child1 :@Tag:
*** Child of Child1
** Child2
*** Child of Child2
** Child3 :@Tag:
*** Child of Child3

Is there a way to copy all subtrees of * Parent with tag @Tag to a destination (say * Destination), so that we get:

* Destination
** Child1 :@Tag:
*** Child of Child1
** Child3 :@Tag:
*** Child of Child3


texts: Best way to make org-mode reload in-buffer settings

texts:
I am using auto-insert so that I can get the usual things I use for org mode when opening a new .org file, example:

#+AUTHOR:   Edgar Aroutiounian
#+EMAIL:    edgar.factorial@gmail.com
#+STARTUP:  indent
#+LANGUAGE: en
#+OPTIONS:  toc:nil num:0

and this gets inserted into every new .org file because I added a define-auto-insert for .org files.

The startup in-buffer setting is important to me, unfortunately I can't get it org-mode to respect it. (Before discovering auto-insert, I used a one off function that inserted this stuff and then called org-mode-restart)

Adding a call to revert-buffer at the end of the org-mode-hook doesn't work either because for new files there is nothing to revert to, and obviously putting a org-mode-restart in the add-hook for org-mode will crap out as well.

I found that org-ctrl-c-ctrl-c will redo the in-buffer settings if the mark is placed over the #+STARTUP: indent, so I tried adding
(org-ctrl-c-ctrl-c "#+STARTUP:  indent\n") to my org-mode-hook, but that didn't work either. (Was that even a good approach?)

How can I get org-mode to reparse my in-buffer settings for all .org files?


texts: Add timestamp to file name in org export

texts:
How can I create a time stamped file name with the org header arg:

#+export_file_name: <timestamp-var> + File name

There is a variable org-time-stamp, is there a way to append it to the static file name to create files with time stamp at time of export in the file name?

Thanks


texts: Remove recent clock entry if it is less than X minutes

texts:
I'd like to keep the clock entries simple and clean. I am thinking of defining an function to remove the most recent entry if it is less then 3 minutes when I clock out.

There's an similar function called org-remove-empty-drawer-at in the org library but it's looks rather complex to me. So I wonder if any one had wrote one before?

Thanks,


texts: How to indent php delimiter in php-mode?

texts:
php-mode is not indenting delimiter:

<?php
// Not indenting PHP delimiter

if (true) {
    echo 'foo';
}

How to indent delimiter?

<?php
    // Indenting PHP delimiter

    if (true) {
        echo 'foo';
    }

I tryed:

(defun my-php-indent-setup ()
  (c-set-offset 'cpp-macro '+))

(add-hook 'php-mode-hook 'my-php-indent-setup)

But does nothing, and if I do it manually C-c C-o RET cpp-macro RET + RET it doesn't exactly do what I expected. I also tryed topmost-intro instead cpp-macro, but neither do what I expected.


texts: Using Occur to to recursively search in a directory

texts:
I use 'occur' to search for regexp in current buffer and edit the results in occur buffer .

Now my requirement is to search all the files in a directory(including sub-directories ) and edit the results.

ie. Edit the result of ' grep -r foo * '

Is there anything similar(like occur buffer) that allows to edit the searched results in my case.


texts:
My init file (.emacs) is version-controlled, my packages are installed with use-package, so my Emacs config is self-contained.

I don't want to add (and manage) specific snippet files into my repository, so I wonder if there is a way to define snippets directly in my init file.


texts: lazy find/search for commands within emacs

texts:
Is there a way to do a lazy find/search within EMACS, for commands using their description?

Something in the lines of:

Say I am looking for how to add indent to org mode
I suspect there is a commands for it
I would like to type "org" and "indent" in any order and get some options/help buffer, based on the documentation as well as the actual commands.

In other words, I would like for emacs to suggest options/help, based on my description/keywords

This would come in handy, how can I do this?

P.S

I am a NOOB!


texts: Auto-complete mode (inside?) predictive mode & org-mode?

texts:
There are many 'prediction' frameworks for emacs, I'm a bit puzzled as whether and how they integrate with one another.

I'm looking for something that learns words I type and predicts them. Also something that predicts org-mode syntacx. Maybe come C/C++ in the future.

I came across AutoComplete with auto complete for org-mode.
Then there is also predictive mode that appears to have an auto complete mode.

Now, does predictive mode actually make use of auto-complete, or is predictive's auto-complete different from the emacs/org-mode auto complete?

I.e, would I be able to configure predict mode to use autocomplete to auto-complete for org-mode?


texts: Open new frame such that they fit one third of the screen

texts:
I use (add-to-list 'default-frame-alist '(fullscreen . fullheight)) for having the new frames as tall as the screen.
How can I tell emacs to make the new frames as large as one third of the screen width?


texts: How to customize font-lock-syntactic-face-function?

texts:
I've found I can make some comments use a different face by customizing font-lock-syntactic-face-function.
To give some context, I'm setting some comments to use font-lock-doc-face, in situations the major mode isn't setting it.

Currently I'm swapping in a new function, while it works using setq seems clunky.
;; Just an example.
(defconst mycustom-comment-prefix "////")
(defvar mycustom-font-lock-syntactic-face-function-original nil)
(defun mycustom-font-lock-syntactic-face-function (state)
  (cond
    ;; Check if this comment starts with `mycustom-comment-prefix'.
    ((and (nth 4 state)
       (let ((p (nth 8 state)))
         (string-equal
           mycustom-comment-prefix
           (buffer-substring-no-properties p (+ p (length mycustom-comment-prefix)))))
       'font-lock-doc-face)
      (t
        ;; Default behavior.
        (funcall mycustom-font-lock-syntactic-face-function-original state))))

  ;; --- snip ---

  ;; When enabling...
  (setq mycustom-font-lock-syntactic-face-function-original
    font-lock-syntactic-face-function)

  ;; Restore when disabling...
  (setq font-lock-syntactic-face-function
    mycustom-font-lock-syntactic-face-function-original))

Is there a better way to handle the function override?


texts: Magit: Copy text from Stage section without character "+"

texts:
Windows 10, Emacs 25.1, Magit

I select some text (Shift + Arrow Down) from the Unstaged changes section.
Here is a screenshot:

Then I paste into another buffer (*scratch*).

This is the result:

Is it possible to strip the leading +s when killing lines from diff hunks?


texts: Static function highlighting/locking in C++

texts:
In C++ mode, I am finding that static functions are only highlighted when written in the form static ReturnType function_name(args), and not when written ReturnType static function_name(args).

Image:

Is there some subtly in the placement of the static keyword I'm missing here?
I prefer to place it on the right, to be consistent with the way I do it for variables - which it doesn't have any problem with:

If the two function declarations are equivalent, I'd appreciate any help getting the first to be highlighted.

EDIT:

The problem also exists with variables that aren't declared automatically.


texts: How to load image using iimage-mode when I first open a markdown file?

texts:
I have a file which embeds an image

![](file://tmp.jpg)

I have added iimage mode to the markdown mode hook and even added recenter  to it

(add-hook 'markdown-mode-hook 'iimage-mode)
(add-hook 'markdown-mode-hook 'iimage-recenter)

However when I open the file the image is not loaded automatically. I have to manually run the iimage-recenter command inside the buffer before the image is actually loaded.  in the buffer. Any suggestions how I can specify to run iimage-recenter after a particular file is loaded. I am guessing I'll have to edit some hook (maybe after-insert-file-functions?), but not sure which one.


texts: A way to change Emacs versions at runtime (or some other way to fix an outdated package)

texts:
I've recently upgraded to Emacs 25.1.1 and have found that it's, understandably, broken a very useful package to me: pcmpl-args.el. I say "understandably" because the package hasn't been developed since 2012 and its developer doesn't seem to be very talkative. Now, mind you, the package isn't completely broken; it (seemingly) works fine for the most part, but some particular functionality from it is broken now for no apparent reason, even after I re-compiled the whole elpa directory as per this answer. So, I have confirmed that the problem must have something to do with the upgrade to 25.1.1 and I also know which function the problem seems to originate from, but this function is rather monolithic and convoluted. Finding out which exact part(s) is broken (due to some unknown compatibility issues) will be a tricky and time-consuming process, to say the least.

I only see two ways out of this problem (which don't involve wading through the code and deciphering what went wrong):

Downgrade back to my previous version which doesn't bork the package (which was a somewhat old build of Emacs 25 back from February 2016)... this is my current solution.
Figure out how to run Emacs in some sort of "compatibility mode", i.e., I'd like to be able to change Emacs versions at runtime for this package to work properly.

Is there any way to accomplish this second option so that I can seamlessly use my package with minimal hassle? Or is there perhaps a better solution to this problem that I'm not aware of?

EDIT 1:

Here is a followup question to this question which explores the possibility of fixing pcmpl-args for Emacs 25.1.1: Can't parse the output of manpages in pcmpl-args.el in Emacs 25.1.1.

EDIT 2:

I managed to find a fix to my issue with pcmpl-args in 25.1.1. Check out my answer if you're curious about it.


texts: How to change default filename in the Elfeed enclosure action?

texts:
The default filename looks like this ubuntupodcast_s11e36.mp3
But I want to combine the feed and title

  Feed: Ubuntu Podcast
  Title: S11E36 – Thirty-Six Hours

The current state
Save as: ~/storage/podcast/ubuntupodcast_s11e36.mp3

And I want to get this state
Save as: ~/storage/podcast/Ubuntu Podcast - S11E36 – Thirty-Six Hours.mp3


texts: How do I generate a beamer presentation from an org-mode file? What beamer features can I use in my file?


texts: Spacemacs like function overview in Emacs

texts:
I previously started using spacemacs, but after a while I wanted to make my own configuration from scratch with a clean install of emacs. I'm trying to get some functionality available in spacemacs, but can't seem to figure out how.

In spacemacs, when you press SPC, C-x, C-c etc. you get a list of all available keycombinations/functions in the mini buffer.

It is available for both Ivy and Helm, so I'm not sure which package is used for this.

Could anyone point me in the right direction?


texts:
When I delete the current buffer's file (in spacemacs via SPC f D, a prompt shows up in the minibuffer:

  Are you sure you want to delete this file? (y or n)

I would find it safer if that warning displayed the file name / path:

  Are you sure you want to delete /path/to/current/buffers/file ? (y or n)

What I do now is check whether the focus is really on the buffer of the file I want to delete but the prompt could allow another way of double checking.

How could one achieve this?


texts: Org export: timestamps not working as expected

texts:
I'm attempting to modify the formatting of timestamps when they are exported to either HTML or TeX/pdf. I have tried two different ways, neither one of which works. The first way was here and I put that code in my dotemacs file. However, I get a symbol's value is void error for org-export-filter-timestamp-functions when I open emacs.

The second way I tried, which also does not work is to attempt the example in the manual under "defining filters for individual files." I copy/pasted the text into the beginning of my org document, but this does not change the formatting of timestamps at all.

#+BIND: org-export-filter-timestamp-functions (tmp-f-timestamp)
 #+BIND: org-export-filter-strike-through-functions (tmp-f-strike-through)
 #+begin_src emacs-lisp :exports results :results none
   (defun tmp-f-timestamp (s backend info)
     (replace-regexp-in-string "&[lg]t;\\|[][]" "" s))
   (defun tmp-f-strike-through (s backend info) "")
 #+end_src


texts: unable to use C-x o to switch frame focus while in term frame

texts:
I cannot use C-x o to switch to another frame while in a term frame. Here are the steps to replicate the issue:

press C-x 2 to split frame
press C-x o to change focus to new frame
press M-x term RETURN RETURN to switch new frame to term window with bash
press C-x o to return to previous frame

*Messages* says C-x o is undefined


texts: Can flymake or flycheck mark in dired (or in buffer lists) files with errors?

texts:
It would be nice if, in addition to flymake/flycheck marking errors in particular files, they could somehow mark files with errors in dired (or maybe just in the open-buffers list).

The goal would be to look at a whole list of files/buffers and be able to see which one have errors, and which ones are "clean".  (The Atom editor, for example, has a feature like this.)

Does anyone know of packages that offer this feature?

If not, does anyone have thoughts about how this might be implemented?  Or know of good resources for learning to build dired or buffer-list "plugins"?


texts:
Is there a way to gather all the tags used in an org-mode file,
and it displays these on a dedicated side pane?


texts: How to schedule a task for X days from now?

texts:
I oftentimes need to schedule items for 60 days from now or 90 days from now. Is there an easy way to schedule items for X days from today in org-mode?

Note that in Emacs's calendar, you can simply type 90 C-f to go to 90 days from the date that point is at. This is basically what I'm looking for, but doesn't seem to work in the scheduler you get when you C-c C-s a header in org-mode.


texts: Is it possible to show text in buffer *helm-occur" dynamically("on fly")?

texts:
Windows 10, Emacs 25.1.

I open helm-occur and enter text "dalvik".

Then I open console and start some process that show in console many times text "dalvik".

See screenshot:

But in buffer helm occur nothing show.
But if close buffer helm occur and start again command "helm-occur" , enter text "dalvik" then in buffer helm occur success show text "dalvik".

Question: Is it possible to show text in buffer *helm occur" dynamically("on fly")?


texts: How do I fix "incomprehensible buffer" error when running list-packages?

texts:
When running list-packages in emacs on an up-to-date Debian Buster (10.6) I get the following error:
error in process sentinel: Error retrieving: https://stable.melpa.org/packages/archive-contents "incomprehensible buffer"
The exact version of the emacs package is 1:26.1+1-3.2+deb10u1.  When using wget on that URL and looking at the downloaded file it looks like a valid e-lisp data structure to me.
This has been working in the past and works fine in the MacPorts emacs package version 27.1_5.


texts: Emacs client doesn't recognize non-ascii input

texts:
The problem: When I type a non-ascii character, the character is not wrote and instead a weird key combination is performed, depending on which character I have typed, as if it didn't support utf-8.
This strange behavior is true whether I:

input non-ascii characters directly from my keyboard (such as the french letter ç)
create them with XCompose (such as ≠)
input them using a different keyboard layout (I tried a chinese keyboard)

However, this only occurs when I use emacsclient in a terminal. If I start a fresh new emacs program, no problem. If I use emacsclient with GUI, no problem.
Restarting the emacs server doesn't change anything.
Besides that, emacsclient has no problem in reading or showing non-ascii characters (eg. I can open files that contain utf-8 characters and edit them).

What I tried: I tried setting keyboard-coding-system to utf-8 from within an emacsclient session, and it works until I leave it. If I close the session, and open it again, it quits working, even though the server hasn't stopped.
I tried saving it into emacs' configuration via customize, but it doesn't work: each time I close and re-open emacsclient, it comes back to utf-8-unix, saying that it has been changed outside customize (even though in init.el the value is set to utf-8).
I tried the same thing with emacs, and the same thing happens: I can change temporally the value, but when I restart it comes back to the original value. However, I am positively sure I don't overwrite keyboard-coding-system in my configuration. To rule that out, I started emacs with -q (which tells emacs not to read any configuration file, just start as-is), but it still had the value utf-8-unix saying CHANGED outside Customize.

To recap: changing keyboard-coding-system temporarily solves the issue for emacsclient, but I can't make it definitive. And, I have no problem neither in emacs nor in emacsclient GUI with the default value for keyboard-coding-system.
This is especially problematic since my keyboard is full of non-ascii keys and each time I press them by mistake emacs runs commands (depending on which key I have pressed) which is very annoying.
--
Technical details:
I have the same problem on several Linux distros, including a Debian which has emacs 26.1 and NixOS which has the latest stable emacs.
--
EDIT 1: A comment asked what locale returned in the terminal in which I start emacsclient.
$ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME=fr_FR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=


texts: I look for command to close all ERC related buffers, I couldn't find anything build-in. Does anyone implemented function like that or know how this function should look like?


texts: Change indentation variables inside of buffer

texts:
I personally use 2 spaces for indentation but everyone has a preference and I'd like to respect that. When I open someone else's files I would prefer to use their indentation scheme. In my .emacs file here is everything I use to set my indentation:

(setq css-indent-offset 2)
(setq js-indent-level 2)
(setq javascript-indent-level 2)

(setq-default python-indent 2) ;emacs 23
(setq-default python-indent-offset 2); emacs 24
(add-hook 'python-mode-hook
    (lambda () (setq tab-width 2)))
(setq html-indent-offset 2)
(setq-default indent-tabs-mode nil)
(setq default-tab-width 2)
(add-hook 'html-mode-hook
      (lambda()
      (setq sgml-basic-offset 2)))

I could modify .emacs every time I want to use a different format, but I'd rather visually identify the indentation mode and manually change the variables (for the current emacs process only) to match the indentation of the file.

Now I know very little about emacs/elisp, but my assumption was M-x setq intent-tabs-mode t would make my tab key generate tabs instead of spaces. No such luck and googling has gotten me no where. Any thoughts?


texts: forward-sexp in markdown-mode doesn't handle backquoted expressions

texts:
How do I modify the syntax table to  make forward-sexp and backward-sexp correctly skip over backquoted (code) expressions?
For instance, if my markdown file contains a line like
The C statement is `int x = 1;`

if I stand with the cursor at the first backquote character and C-M-f I should move forward to the column on the same line just after the second backquote character.


texts: Copy a column of uneven width that ends with a specific character

texts:
I have a data file that looks as follows

ALGO = Fast
EDIFF = 6.7e-05
ENCUT = 520
IBRION = 2
ICHARG = 1
ISIF = 2
ISMEAR = 0
ISPIN = 2

I'm interested in copying the first column of uneven width but where every element ends with an = character.

The kill-yank rectangle mode does not work in this case, since the columns are of uneven width.


texts: eShell Aliases – How to `grep` Forward Slashes

texts:
In Bash, I have an alias of ls -Ap | grep --color=always /$ that grabs the directories of the current directory, more or less.

That said, using the same as an alias in Emacs's eShell seems to not work, at all.

It keeps grabbing files, as well, that (as far as I can tell) don't even have forward slashes anywhere in their names.

Does the forward slash mean something to eShell that it doesn't for Bash?


texts: How to kill a buffer when it causes Emacs to stop responding?

texts:
I use Emacs Dired to manage files. Accidentally, I hit Enter on an image file, Emacs tries to open the image and stop response. Is there a way to kill this process?

(Since I am running other processes at the same time, I don't want to restart Emacs.)

Edit:
Is there a way to list all the processes within Emacs and kill a certain one like in shell: kill -9 process-id?

Edit 2:
Although very slow, I managed to press C-x C-b to list all the buffers, and d mark the buffer caused Emacs no-response, x to execute delete. It succeed.

This only works as long as Emacs could response to my key. I really don't know what to do if I can't list all the buffers.


texts:
I'm using a simple (re-search-forward "\"") to find the end of string constants in my buffer. This is to copy the string in a def like (defconst name1 "some string"). The problem is that string constants may contain the ?\" character if it is quoted, and one has to check if the quoting char ?\\ is not itself quoted. And I want to find the end of empty strings too. So I need something more complex.

Since Emacs has to do this kind of search all the times, e.g. for highlighting the string constants, I thought that there must be some internal function that does just the trick, and faster and more reliably than I would ever manage to do myself. However I failed to find any such function while looking in manuals or using apropos search.

How is it done internally? Is there a forward-string command that would work like forward-sexp but for string constants? (I understand that string syntax is mode-dependent but I am happy with something that works for elisp or C).


texts: How company-mode suggestions are delivered?

texts:
I am curios whether there exist a side-channel possibilities for emacs company-mode.

I thought, since company-mode suggests words that matches the given prefix, the suggestions may leak some sort of information of what is being typed.

Since I am a complete novice to emacs source code, I want to see how company mode is working internally...

Where can be the best starting point to look at the source tree?


texts:
I noticed some code in use-package-core.el where format is used to get a keyword's name as a string,
(format "%s" keyword)

Is there a reason this is preferable to using symbol-name?
(symbol-name keyword)

I would've expected symbol-name to be better in terms of readability and performance.


texts: Icicle: After load icicles the ido mode is gone?

texts:
windows 10, emacs 26.1, icicles

Before Icicles when I type C-x C-f is show list of folders/files in ido mode. And it's very comfortable for me.

But after I install Icicles and turn on icy-mode the ido mode is gone (e.g. when I type C-x C-f). Is it normal? Now is show Icicles candidates to complete. OK, but I want to work with ido mode.
Is it possible?


texts: Fold the immediate outer section in org-mode

texts:
I can un/fold a section in org-mode by calling org-cycle. However, the cursor has to stay on the heading in order for that to work. What can I do to collapse the section in which I am currently stationed?

Example:

* Section 1
** Section 1.1
** Section 1.2
   lots of lines
   information [] <-- cursor somewhere here
   lots of lines
** Section 1.3

----> fold outer

* Section 1
** Section 1.1
** Section 1.2 [] <--- cursor somewhere here
** Section 1.3

----> fold outer

* Section 1 [] <--- cursor somewhere here

I feel like there should be a way to do this by jumping to the first heading of the outer level and calling org-cycle, but making this jump seems to require some dev knowledge of org-mode, so I am here to ask for help.


texts: Can not set font family in init file in Windows

texts:
In my .emacs file I have the following:

(setq default_font "Office Code Pro D")
(when (member default_font (font-family-list))
  (set-face-attribute 'default nil
                      :family default_font
                      :font default_font))

After startup, if I evaluation the (when... function, my font family is set properly, but it is not set correctly when this file is sourced on startup.

After startup, if I check the value of default_font it is (correctly) Office Code Pro D, however, it does not set the font for my Emacs session unless I evaluate that part specifically.

Is there a reason why this does not get set in startup?

(Typically I run Emacs daemon on boot and this does not work).


texts: file renaming not always caught by filenotify

texts:
I'm using file-notify-add-watch from filenotify.el to watch a dired directory so it can revert when a file is modified within the directory. This generally works, but I've noticed that it only works sometimes when renaming a file. Code is here.

When I watch two directories (~/ and ~/readings, for example) and add a file test.txt to ~/, filenotify catches that and reverts the buffer. When I run mv test.txt readings, the event passed to the filenotify callback contains the sexp '((<desc>) renamed "~/readings/test.txt" "~/readings/test.txt"). When I move it back with mv readings/test.txt . (while in ~/), the event passed to the callback is '((<desc>) renamed "~/test.txt" "~/test.txt"). So it seems to be passing not the previous and the new file, but just two of the new file's path. This could be a bug, but I'm not sure. For easier reading (=> indicates the events passed to the callback within emacs):

$ echo hey > test.txt
=> ((32) created "~/test.txt")
=> ((32) changed "~/test.txt")
$ mv test.txt readings
=> ((34) created "~/readings/test.txt")
$ mv readings/test.txt .
=> ((32) renamed "~/test.txt" "~/test.txt")

I'm pretty sure this is a bug, but I wanted to make sure I wasn't using filenotify incorrectly. Adding the watch, I do:

(file-notify-add-watch
  (expand-file-name dired-directory)
  '(change attribute-change) #'my-callback)

Which returns 32 and 34, the two descriptors shown in the output above.

Is this a bug? Or is there some element of file-notify-add-watch I'm using incorrectly? I would expect mv <file> <folder> to create a rename notification with both the previous and current version, but it's not doing that. I'm using emacs 25.0.50 on linux with 'inotify as a file notification library.


texts: Is there a way to color replies in the email body on mu4e?

texts:
I'm on some mailing lists and there is a top-post culture. It's difficult for me to visually delineate the reply from the original content. Is there facility for coloring (perhaps in alternating colors) the nested replies in the email body?

EDIT: It looks like the issue is that the mailing list doesn't insert > characters in the replied-to text.


texts:
I'm working with TeX-Files which are converted from other formats. One thing that pops up in these are vertical lines in tables like the following:

\cline{1-1}\cline{2-2}...\cline{n-n}

This can be expressed in a compressed fashion as

\cline{1-n}

It is further complicated by the fact that multiple such ranges might appear in the same line, for example 1-5, 7-11 and 15-17 all might appear on the same line, which prevents me from just looking for the first and last ones and using those.

I attempted to compress these with query-replace-regexp, where I tried to replace \\cline{\([0-9]+\)-\1}\\cline{\,(+ 1 \#1)-\,(+ 1 \#1)} with \cline{\1-\,(+ 1 \#1)}, which did not work. Can this be done, and if yes, how? Also I'd prefer this a an elisp-Macro so that I can easily reuse it.


texts:
I'm trying to write an elisp program that will insert a section header and footer as a comment. For example, if I need a section called "intro" for my LaTeX document, the following would be inserted:

%----------BEGIN INTRO----------%

%-----------END INTRO-----------%

Similarly, if I need a section called "functions" in my C++ file, the following would be inserted:

//----------BEGIN FUNCTIONS----------//

//----------END FUNCTIONS-----------//

My trouble is finding a way to identify the comment pattern of the current major mode so that it can be included in the inserted string. Any insight would be appreciated.


texts: How to avail of `:hook` using use-package?

texts:
I've wrote this, and it works:

(use-package web-mode
  :ensure t
  :mode (("\\.php$" .  web-mode)
         ("\\.html$" .  web-mode))
  :preface
  (defun dg/web-mode-hook())
  :config
  (add-hook 'web-mode-hook 'dg/web-mode-hook))

It enables web-mode when opening .php or .html files.
I've noticed that use-package also provides :hook directive, but it's not very clear how I can use it in this case.

Any clue?

Thanks in advance.


texts:
The callback api for a link type in an org-mode backend looks something like this

(defun org-leanpub-link (link contents info)
  ...
)

I can get the standard properties for a link element, such as

(org-export-get-caption
 (org-export-get-parent-element link))

and I could access custom properties like this

(message "%s" (org-element-property
               :foo
               (org-export-get-parent-element link)))

except I do not know how to add any extra information to the link in the org-mode file!

How can I add custom markup to a link, such that I can have access to it in my custom backend? I need to be able to provide a custom width for the output format.


texts: Why does `eval-when-compile` run at file load and byte-compiled to .elc?

texts:
Common idiom to workaround macro expansion or resolve warning about undefined variables during byte-compilation:

(eval-when-compile
  (require 'cl-lib))

But this require ... compiled into .elc file! I found that cl-eval-when have proper semantic (according to name).

Normally we don't need for require as site file and package.el

For example I want to byte-compile my .emacs which uses some external macros, but silently pass through if there are no such package:

(cl-eval-when 'compile
  (condition-case err
      (require 'w3m-util)
    (error (byte-compile-warn "Failed by: %S" err))))
(w3m-util-DEPENDENT-CODE ...)

Another way to do this is:

(ignore-error
   (require 'w3m-util)
   (w3m-util-DEPENDENT-CODE ...))

But now we are not a top level form...

Do I properly fill that eval-when-compile name do something that is not expected from its name?


texts: How can I use multiple monitors with a remote emacs session?

texts: I am running a tmux session on a server where I do my development work (this is where I run emacs). I have two monitors - how do I use both of them with the same emacs session? If I join the same tmux session, the monitors just mirror each other. If I am not in the same tmux session (and by extension a different emacs session) I will have to reread from disk everytime a file gets updated, and there can be differences between the different working versions of files. Any thoughts on how to use both monitors here?


texts: How do I set `gnutls-verify-error` to not check if certain hostname matches the certificate?

texts:
I have the host chat.deshackra.com pointing to tigase.im (with a CNAME entry), and I want to use the starttls connection type for my jabber.el account, however the connection fails:

gnutls.c: [1] Note that the security level of the Diffie-Hellman key exchange has been lowered to 256 bits and this may allow decryption of the session data

jorge@chat.deshackra.com/emacs: connection lost: `STARTTLS negotiation failed: Certificate validation failed chat.deshackra.com, verification code 66'

So, how can I set gnutls-verify-error to ignore any error for my domain name?

EDIT: If I disable any encryption at all, I get this message:

Connecting to chat.deshackra.com:5222...
STARTTLS encryption required, but disabled/non-functional at our end

and my account is not connected.


texts: Disable Evil-mode's state indication on mode line

texts: How do I disable evil-mode's state indicator on the mode line? I don't want to see anything like <N>, <I>, <V> on my modeline.


texts:
I would like to load TODO objects from individual files using org-babel and elisp. I have a working snippet that produces this output.

#+RESULTS: import_file
:   * TODO Go to grocery store
:   * TODO Go to bank
:   * TODO Go to dry cleaners

The : in the output causes org-mode not to recognize the TODO keywords. I want the output to look like this:

#+RESULTS: import_file
* TODO Go to grocery store
* TODO Go to bank
* TODO Go to dry cleaners

Is there an org-babel configuration item that accomplishes this? If not, is there another way to accomplish this without modifying org-babel?


texts: How to set column highlight background color for wrapped lines in terminal mode?

texts:
I'm new to emacs (spacemacs).  I've set up the col-highlight package in my .spacemacs like so:

(column-highlight-mode 1)
(set-face-attribute 'col-highlight nil :inherit 'hl-line :background)

in order to pick up the background of the current line for the current column.

How can I set the same background for the column in long wrapped lines? The background of the current column of wrapped lines does not match and is an annoying contrasting white.

EDIT: should have mentioned that this is emacs/spacemacs in terminal mode. I now think this related to my .Xresources file.

EDIT2: see - https://github.com/DougDavenport/spacemacs for an image of the issue and my .Xresources file


texts: Emacsclient not loading init file changes

texts:
Context: I just updated Emacs via homebrew; I don't remember the steps I followed to get Emacs to run via daemon originally, but since the update it doesn't seem to be using it anymore (i.e. quitting and rerunning Emacs takes several seconds, loading a lot of stuff).  I added the Emacs plugin to zsh, which basically runs Emacs using emacsclient, and this works -- but now it doesn't seem to load my init file properly (located in .emacs.d/init.el)
Specifically,

the final command I have in init.el (find-file ..) that I use to always start on a certain org-mode page, is ignored in place of starting with only the *scratch* buffer
various variables set in the init file are done so correctly
any changes to init I've attempted to make since the Emacs update aren't recognized either, as if it is operating on a snapshot of the init file from before the update

Not sure how to run --debug-init under emacsclient, but if I disable it and run emacs --debug-init no errors come up.
How do I go about investigating/fixing this? Thanks in advance!
Edit: original issue 4) "Wrong type argument: stringp, nil error occurs when attempting to save a change to a variable via the customize option buffer" -- ended up being unrelated to the above; apparently has to do with evil-mode escaping after editing a value field under insert mode in a Customize Option buffer while still in the value field (but moving outside of the field before escaping insert mode allows for successful apply and save)


texts: Can I make links in Org Mode that contain brackets, [ or ]?

texts:
Is there someway to escape brackets ([ and ]) so that they can be included in the description of an Org mode link? The following link doesn't work, for example:

[[http://mathoverflow.net/questions/195203/automorphisms-of-ideals-of-mathbbct][Automorphisms of ideals of C[t]]]

I hoped using a backslash (\[) would work or that there would be an org-entity, but that doesn't seem to be the case.


texts: How to install movie.el (movie browser for Emacs)?

texts:
I found out there is movies browser for Emacs.
But there is no instruction of how to get it works.

https://github.com/larsmagne/movie.el


texts:
As I using a non us keyboard, I want to map the capslock key as super key in emacs. I use Seil and Karabiner to map the capslock to the combination Ctrl-Alt-Cmd-Shift, which is recognized in Emacs as C-M-s. I've tried to use (define-key local-function-key-map "\C-M-s" [(super ?\ )]) but it doesn't work.

How can I map the sequence, so emacs recognizes it as Super key?


texts:
Normally return key is just newline, I believe a lot of people bind it to newline-and-indent, but return is relatively common used key, the C-u RET and C-- RET basically do nothing but same as return, I don't want to waste prefix features. How can I make it do these?

If I type return, it will do normal things(e.g., it will create a new line and indent if I type return at the end of a line; it will split the line from here, create new line, jump to it and then indent if I type return in the middle of the line.)
If I type C-u return(whether in the middle or at the end of the line), it will create a new line(not split), jump to it but not indent.(like C-e C-o C-n)
If I type C-- return(whether in the middle or at the end of the line), it will create a new line above the current line and jump to it.(like C-a C-o)

I already made these happen using global-set-key, but wasted S-return and M-S-return, if anyone can advance the default return key using prefix argument feature, that would be better.

Update:
I got the following defun, but it doesn't work, what's wrong with it?

(defun advanced-return (&optional arg)
  (interactive "p")
  (if (equal arg '-)
      (progn
        (beginning-of-line)
        (open-line))
    (if (equal arg '(4))
        (progn
          (end-of-line)
          (open-line)
          (next-line))
      (newline-and-indent))))

If you can make it work, is it possible not to defun a new function, but just put them inside

(global-set-key (kbd "<return>")
...
)


texts: Emacs-x86_64-10_14 consumes 99,8% CPU on macOS-Catalina

texts:
I have installed Emacs.app via brew into macOS Catalina. I have realized that it consumes almost 100% of the CPU. What may be the main cause of this? Which approaches could I take to overcome this high CPU usage?
Please note that, I have exactly same emacs.init file in a Ubuntu machine, where I do not see 100% of emacs CPU usage.
$ which emacs
/usr/local/bin/emacs

$ emacs --version
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

I found out that following process remains open and eats all the process. Seems like it might be related to elpy.
alper 4785 100.0 0.0 4461068 7860 ?? R 1:27AM 41:42.43 /usr/local/Cellar/emacs-head@26/26.3_1/Emacs.app/Contents/MacOS/Emacs -Q -l /Users/alper/.emacs.d/elpa/async-20200809.501/async.elc -batch -f async-batch-invoke

My best solution is to kill all emacs processes: kill -9 $(ps aux | grep -E "emacs" | awk '{print $2}')


texts: Org-mode properties to list or structured content

texts:
I love the way org-mode allows to input easily resuable data through Properties. Later on you can export it to CSV thanks to column-view, and it is very userful.

But what if I would like to export it to a list (unordered list or list definition) or even to a kind structured content (eg: h1|h2... list).

As far as I know the document {OPTIONS} {prop:t} export the properties to {} HTML element

Any suggestions?


texts: loop (iterate) flush-lines on a list of regex for large files

texts:
I have a file (a log) with unique identifiers.  I know I can exclude a single unique identifier in emacs using M-x flush-lines.  I sometimes need to exclude more than one unique identifier, and for up to ten or twenty this is not a problem as I can do it by hand. This is usually sufficient for my needs.  However, there is the occasional need to exclude significantly more. Today, for instance, I need to exclude some 80k instances of unique identifiers (out of a file that might have over 300k unique ids. (I'm trying to locate the proverbial needle in a haystack and have a way to identify one kind of 'not needle' that is present 'and now I need a way to get them out of the way quickly)

Is there a way to loop through flush-lines over a list of regex? (and when I say 'loop', I'm purely being descriptive: I don't, necessarily, mean the function loop.  I'm given to understand 'while' and 'dolist' are similar functions... I don't know how to use any of them in this case)

Thanks.


texts:
The general way this seems to be done using Elisp is to first read the entire file using something like insert-file-contents-literally or find-file-no-select, using split-string on a newline, and then removing the unwanted elements:

(defun first-n (list &optional n)
  "Return list containing the first N elements of LIST.

If N is nil, return the entire list."
  (let ((n (or n (length list))))
    (butlast list (- (length list) n))))

(defun read-lines (file &optional n delimiter)
  "Return the first N lines of FILE as separate elements of a list.

If N is nil, return the entire file."
  (let ((delimiter (or delimiter "\n")))
    (first-n
     (split-string
      (with-temp-buffer
        (insert-file-contents file)
        (buffer-substring-no-properties
          (point-min)
          (point-max)))
      delimiter
      t)
     n)))

This works but with the obvious drawback of reading the entire file.

What is a more efficient way to handle this?

Many of the file functions for Elisp are geared towards buffers than raw file processing.  Looking at Common Lisp, it seems reading files is handled through streams.  I couldn't find with-open-file in the cl-lib library.  It doesn't seem like Elisp has any stream capabilities either.

Other than using the BEG and END arguments for insert-file-contents-literally, I can't think of a way to perform this task more efficiently.


texts: How can I reset the source code of an Emacs package to its original state?

texts: Suppose I have installed company-0.9.13, which other packages depend on (mostly third-party company completion backends). I unwisely edited company-mode's source code directly in the ~/.emacs.d/elpa/company-0.9.13/ directory. Now I want to undo all my edits and reset the source code to its original state. How can I do this?


texts: How to load defuns automatically at repl start up?

texts:
I'm working through SICP and I'm getting tired of defining the square function for the thousandth time, so I'd like to load it (and some others) automatically when I start the repl.

I use Geiser, but if you know how this works in any other REPL I'd switch.

(Of course there would have to be a way to start the repl without autoloading anything, in case one sets it up to autoload an infinite loop by mistake. But I usually only get these when I try to use a function, not when I define it.)


texts:
Does simple markup, such as italic, work for whole paragraphs or only for parts of the line?  For example:

  /first italic paragraph

  second italic paragraph/

If not - what would be a correct way to do that?


texts: DocView: Nuisance popup of page number in viewing .dvi files

texts:
I use DocView under Emacs 26.1 under Cygwin 10.0.2 under Windows 10.0.  I use it chiefly for reading .dvi files. I discovered it by accident and find it extremely useful, but I cannot find any documentation for it.
A continual minor irritation is that a little popup appears repeatedly at seemingly random times & places on the screen, telling the current page number in the document, and often obscuring what I am trying to read.  I have learned to flick it away with the trackball, but it is distracting, and I wish I could get rid of it.
(I tried to sign up using Google, but could not find my way thru the procedure.)


texts:
I would like to make the bitmapped font Terminus the default font in all my "graphic"1 Emacs sessions.

Since Terminus is bitmapped, I want to use it only in one of its "native" sizes, and I want to make sure that the font is never anti-aliased.

I have something similar to the following in my .emacs file:

(set-face-attribute 'default nil
                    :family "Terminus"
                    :height some-height
                    :weight 'normal
                    :width 'normal)

I'm having a hard time figuring out what values to give to the :height parameter (IOW, what values the variable some-height in the snippet above may assume) in order to specify Terminus' native sizes.

Also, I'd like to know if there's some Emacs configuration that ensures that this font never gets anti-aliased.

In more detail, according to the documentation for the Terminus font installed on my system, its native sizes should be

  6x12, 8x14, 8x16, 10x20, 11x22, 12x24, 14x28 and 16x32

On the other hand, the xfontsel utility reports the following values for the installed Terminus font's ptSz parameter:

  120, 140, 160, 200, 220, 240, 280, 320

These values are all 10 times the second integer in the sizes cited earlier, which is encouraging.

Unfortunately, they don't seem to be quite what Emacs wants as the value for the :height parameter in the set-face-attribute call shown above.  For example, I see no difference at all between the text resulting from values 280 and 320 for some-height2.  In fact when both :height (Emacs) and ptSz (xfontsel) are set to 320, their text displays match closely when compared side-by-side, but when I perform the same comparison using 280 instead of 320, the text as displayed by Emacs looks distinctly larger than that displayed by xfontsel.  IOW, setting :height to 280 in Emacs is decidedly not analogous to setting ptSz to 280 in xfontsel.

Is there a quick way to determine the values of the :height parameter that set-face-attribute will faithfully match to the native sizes listed above?

Also, the fact that Emacs seems to accept just about any positive integer for the :height parameter (which, obviously, cannot all correspond to distinct native font sizes) makes me wonder if for some settings of :height the font may be getting anti-aliased.

Is there some way to tell Emacs never to anti-alias this font?

1 By "graphic" I mean those sessions for which the expression (window-system) evaluates to non-nil.

2 When viewed with xfontsel these two are clearly different.  In fact, not just the sizes of the letters are different, but also their geometries, as one would expect from two neighboring sizes of a bitmapped font.  Furthermore, if I set some-height to 1, and evaluate the expression above, the text indeed becomes considerably smaller.  These observations at least rule out some trivial explanations for my inability to see any difference between the characters resulting from the settings 280 and 320 for some-height.


texts: Using multiple tty emacsclient with "C-x 5" other frame commands

texts:
I'm using emacs in daemon mode on a server and connecting over ssh in a terminal console (tty) window (i.e. no GUI support).

I'm invoking emacsclient using in the tty window (window here refers to OS application window, not emacs window) using:
emacsclient -nw

Everything so far works as expected.

I can spawn a second tty window and run a second emacsclient -nw on the same server and it will operate like a second frame which is useful if you have a multi-monitor setup.

However I can't get the the following to work:

I have focus on one terminal window and call, for example, C-x 5 d.
What happens is I get a new dired buffer in the same tty window as I entered the command.
I was hoping that the C-x 5 would mean that dired was opened in the other frame, i.e. the other tty window.

My question is how can I harness the C-x 5 commands when using two different tty windows containing two different emacsclient instances on the same server?

$ emacs --version
GNU Emacs 26.3

Terminal emulator = wsltty


texts: Can occur display just the matched part?

texts:
Or is there an alternative tool (perhaps some option to isearch?) that would show just the matches in a separate buffer linked to the original buffer?
Use-case
I have a log file with very long lines. When the matching line appears in *occur* buffer, it is still too cluttered to be useful (due to wrapping and a lot of extra info).
It isn't difficult to write something like this, but it seems so basic that it must've been done before.
If my explanation wasn't good enough, think about grep -Po search-string.


texts:
org-src-mode-hook is run upon editing a source block using org-edit-src-mode. Is there a way to set behaviour upon exiting editing a source block?

In particular I would like to run blacken-buffer upon exiting editing a block of Python code.


texts: Is it possible to copy /paste multiple lines of text into cells of org-mode table?

texts:
Here is my question, I have multiple lines of text, line this:

line1
line2
line3
...

And I want to create a org-mode table like this:

| C1    |
|-------|
| line1 |
| line2 |
| line3 |
| ....  |

Is it possible ?


texts: How to indicate if narrow-to-region is currently in effect

texts:
I have advised the narrow and widen functions so that the fringe color indicates if narrowing is active:

(advice-add 'narrow-to-region :after
            '(lambda (&rest args)
               (set-face-attribute 'fringe
                nil :background my-fringe-narrow-bg)))

(advice-add 'widen :after
            '(lambda (&rest args)
               (set-face-attribute 'fringe
                nil :background (face-attribute 'default :background))))

This works very well. However, sometimes the fringe gets colored by my advice while I did not call any narrowing function. One example is 'org-table-sort-lines: it calls 'narrow-to-region within a 'save-restriction block but does not call 'widen afterwards, of course.

So, how can I find out if 'narrow-to-region have been called from within 'save-restriction?

EDIT: Something like this would help as well:

(advice-add 'save-restriction :before
            '(lambda (&rest args)
               (ad-deactivate 'narrow-to-region)))

(advice-add 'save-restriction :after
            '(lambda (&rest args)
               (ad-activate 'narrow-to-region)))

However this doesn't work, I get the error: advice--normalize: Advice impossible: save-restriction is a special form.


texts:
Easymenu is great for creating menus, but how can you remove a top-level menu that was created with it?
Here's an example.  A minor mode might create the following menu:
  (easy-menu-define some-minor-mode-menu some-minor-mode-map
    "Menu keymap for some minor mode."
    '("Menu"
      ["Item" command t]
      ...))

How would you remove this menu from the menubar using easymenu's own commands?  Unfortunately, easymenu is poorly documented and all the available documentation is about how to add menus and submenus.
(I have been able to remove this sort of menu by adding (define-key some-minor-mode-map [menu-bar Menu] nil) to the major mode's hook, but is that the only way to do it?  Does easymenu provide no facilities for this?)


texts: Shift text after cursor to specified column

texts:
If I have a line like:

vec3 pos; // May not be defined.

And I want to shift the comment to a specific column number, say 27, such that I get:

vec3 pos;                  // May not be defined.

Is there a single command that can do this if I have the cursor placed just before the comment?

If not, what is the easiest way to achieve this affect?

I will be doing this regularly to keep comments aligned, so a quick and generic solution is best.


texts: How do I customize emacs (with org) into a onenote-like notes management tool?

texts:
shown as above, a notes database is divided into 3 buffers: notebooks, nodes, notes
the nodes buffer can only add/remove/rename nodes
click a nodes to see the notes inside it
each notebook is a single file (such as sqlite)


texts: Is there an function in org-mode to refer to the "row group number"?

texts:
I have an org table:

| name      | band     | group # |
|-----------+----------+---------|
| lennon    | beatles  |         |
| mccartney | beatles  |         |
| harrison  | beatles  |         |
| starr     | beatles  |         |
|-----------+----------+---------|
| page      | zeppelin |         |
| plant     | zeppelin |         |
| jones     | zeppelin |         |
| bonham    | zeppelin |         |
|-----------+----------+---------|
| mason     | floyd    |         |
| waters    | floyd    |         |
| wright    | floyd    |         |
| barrett   | floyd    |         |
| gilmour   | floyd    |         |

I'd like to fill the last column with the "row group number":

| name      | band     | group # |
|-----------+----------+---------|
| lennon    | beatles  |       1 |
| mccartney | beatles  |       1 |
| harrison  | beatles  |       1 |
| starr     | beatles  |       1 |
|-----------+----------+---------|
| page      | zeppelin |       2 |
| plant     | zeppelin |       2 |
| jones     | zeppelin |       2 |
| bonham    | zeppelin |       2 |
|-----------+----------+---------|
| mason     | floyd    |       3 |
| waters    | floyd    |       3 |
| wright    | floyd    |       3 |
| barrett   | floyd    |       3 |
| gilmour   | floyd    |       3 |

I'd like to do this in a way that would allow me to add more groups to the table in the future. Is this possible in org-mode?


texts:
I use undo-tree mode in my emacs setup. Every once in a while, after writing a lot of text, I accidentally undo changes while I have some region selected. I am not 100% sure what undo-tree is doing and this is not 100% reproducible but there is high chance that this completely messes up my text. If I visualize the undo-tree I see a linear path but I cannot go up the tree even a single node (emacs just hangs).

Any idea why this is happening? I suspect that undo-tree is trying to undo the changes in the selected text as opposed to the whole buffer. If that's the case, can I disable this behavior?


texts: How to overwrite C-c C-v hotkeys for LaTeX-mode-map?

texts:
Now i use this:

(eval-after-load 'latex
  '(define-key LaTeX-mode-map (kbd "C-c C-v") nil))

(eval-after-load 'latex
  '(define-key LaTeX-mode-map (kbd "C-c C-v") 'my-open-file-LaTeX))

I DO NOT use Auctex it's just generic LaTeX-mode in emacs.

but there is just no reaction to this, it's still trying to use 'Tex-view

C-h k C-c C-v prompt:

C-c C-v runs the command tex-view (found in latex-mode-map), which is
an interactive compiled Lisp function in ‘tex-mode.el’.

It is bound to C-c C-v, <menu-bar> <tex> <tex-view>.

(tex-view)

Preview the last ‘.dvi’ file made by running TeX under Emacs.
This means, made using C-c C-r, C-c C-b or C-c C-f.
The variable ‘tex-dvi-view-command’ specifies the shell command for preview.
You must set that variable yourself before using this command,
because there is no standard value that would generally work.


texts: Check if a buffer's name ends with `.org`

texts:
I want to write a function to check if a buffer is an Org buffer. Here is my attempt.

(defun org_bufferp (buffer)
  (if (bufferp buffer)
      ((setq buffer_name (buffer-file-name buffer))
             (if (stringp buffer_name)
                 (if (string-match ".*\.org$" buffer_name) t "nil1")
               "nil2"))
      "nil3"))

However, the result surprised me.

(org_bufferp '(current-buffer)) ;; => nil, but should be t!
(org_bufferp  (current-buffer)) ;; ===> ERROR! Why?

Questions

Why does (org_bufferp '(current-buffer)) return nil? I don't even assign any nil to possible returned values.
Why does (org_bufferp  (current-buffer)) return an error?
I'm new to Elisp, and find it hard to deal with the endless parentheses. What would you suggest in order to make the code cleaner?


texts:
Began here on using eww as web browser in Emacs, but felt that it misses CSS stylish, even loading simple HTML and CSS only.

Already managed to repair libxml2 error before running it, but now would like to load CSS stylish, like divisions, body, main or footer styling, for example.

How could that be done?


texts: How to find the next match with re-builder?

texts: I built a complicated regular expression with re-builder and see that it works with the matches I want. How can I find all the matches, as I would with C-s in isearch-forward?


texts: How rollback settings without restart Emacs?

texts:
windows 10, emacs 26.1

In my init.el

(with-eval-after-load 'magit-status
  (define-key magit-status-mode-map (kbd "C-<tab>") nil))

This disable C-<tab> after magit-status was load.
And now C-<tab> is disable in magit-status. Nice.

But suppose I want to rollback C-<tab> in magit-status. How I can do this?
Off course I can remove this code and restart Emacs.
But has any better solution?


texts: Alchemist Elixir mode and its company-mode backend

texts:
I'm using alchemist.el for editing Elixir code and have some difficulties to set it work properly with company-mode's completion.
When I type (e.g): List.| I get Company: An error occurred in auto-begin End of file during parsing.
Alchemist's README on GitHub say Alchemist enables a company-mode elixir backend by default if company-mode is installed.
I guess that company backend somehow is not properly provided or I have some conflicts in configuration.
Does anyone have experience with this or have advice on how to debug this to see what is wrong or what is proper configuration?


texts: Emacs org mode: How to make agenda views of blocked parent tasks?

texts:
During my daily work I want to prevent parent tasks to be visible in my daily agenda views. This is very practical during daily work, since a parent task cannot be "done", only be a placeholder for its sibling tasks. However, during my GTD weekly review of my tasks I would like to have a separate agende view showing all parent tasks, to be able to get an overview of their sibling tasks and their status.

I use the following code to make task dependencies possible and to prevent showing parent tasks.

(setq org-enforce-todo-dependencies t)
(setq org-agenda-dim-blocked-tasks 'invisible)

If I use the code above, how can I make an agenda view that show only my parent tasks? What is lacking in the agenda view code below?

(setq org-agenda-custom-commands '(
        ("p" "parent tasks" tags < ...missing code... > (
        (org-agenda-overriding-header "Parent tasks")
           ))))

Or what changes do I have to make in my code to be able to BOTH not showing parent tasks in some views, AND to show them in other views?

I do not want to manually tag the parent views with "PROJECT", since this is extra work that can easily be forgotten, and thereby clutter my daily and weekly agenda views.

Thanks in advance for any help !


texts: Do not colour "word" colours in rainbow-mode

texts: In rainbow-mode, is it possible to toggle colouring only "words" or only "hexadicimals"? I don't see a variable I could set.


texts:
The Problem
Performance issues when point is inside/on a symbol go-eldoc/gocode has info for.
Based on my interaction with emacs I would guess that the problem has something to do with gocode being queried on the main thread, and taking to long to respond. Is this correct thinking? Is there something wrong with my configuration?
The Environment
Using https://github.com/syohex/emacs-go-eldoc with
go get -u github.com/stamblerre/gocode https://github.com/stamblerre/gocode
as the gocode implementation on my machine for the module support
Using use-package https://github.com/jwiegley/use-package to load it
(use-package go-mode
  :defer 2
  :mode "\\.go\\'")

(use-package go-eldoc
  :defer 2
  :hook (go-mode . go-eldoc-setup))

Part of the problem seems that the gocode version I am using is slow, but it still should not hang/lag while moving around or typing.


texts:
I often got to work with projects organized as follows:

src/

include/

...

Makefile

Is there a way to teach emacs' "compile" function to always use that top-level Makefile regardless which file I'm editing in the current buffer? For example it can be any of

src/sub1/s1.c

include/protocol/p.h

src/x.c

tests/test1/test_x.c

In all those cases I want "compile" command to go as many times "up" in hierarchy as necessary to get into top-level directory (the one in the directory with 'src', 'include' and 'tests' entries) and run Makefile in there. Additional problem is that any of sub directories can have Makefiles of its own.


texts: Is it possible to add templates other than #+BEGIN_ #+END_ to org-structure-template-alist?

texts:
I've noticed that org-structure-template-alist changed (I'm using org-mode version 9.2) to automatically expand to #+BEGIN_<some block tag> #+END_<some block tag>. I wonder if it's possible to add different kind of templates. For instance a :PROPERTIES:<some properties>:END: template.

Is it possible or should I turn to another package like yasnippets?


texts: Changing a defcustom value in spacemacs?

texts:
I'm trying to augment the following defcustom block:

(defcustom latex-unicode-math-mode-rules-doublestruck
  '(("\\mathbb{F}" "")
    ("\\IF" ?)
    ("\\mathbb{N}" "ℕ")
    ("\\IN" ?ℕ)
    ("\\mathbb{Q}" "ℚ")
    ("\\IQ" ?ℚ)
    ("\\mathbb{R}" "ℝ")
    ("\\IR" ?ℝ)
    ("\\mathbb{Z}" "ℤ")
    ("\\IZ" ?ℤ))
  "Double struck letters for `latex-unicode-math-mode'."
  :type '(repeat (list :tag "Rule"
                       (string :tag "Input")
                       (choice :tag "Output" string character)))
  :group 'latex-unicode-math
  :set 'latex-unicode-math-mode-set-variable
  :initialize 'custom-initialize-default)

by adding the rules

("\\mathbb{P}" "ℙ")
("\\IP" ?ℙ)

Simply inserting the rules into the defcustom block and reloading my .spacemacs doesn't seem to work. Is there some special way to do this?


texts: Why does mousing over one button also highlight adjacent buttons?

texts:
I'm using some buttons, and want to arrange them in a row. That is, some will be directly next to each other. I don't want whitespace between them. This is easy enough to do:
However, when I do this, mousing over either of them highlights both. I would expect only the moused-over button to be highlighted.
Using this code:
(progn (insert ?\n)
       (insert-text-button "one")
       (insert " ")
       (insert-text-button "two")
       (insert " ")
       (insert-text-button "three")
       (insert-text-button "four"))

Here is a screenshot of what happens when I mouse over a button with whitespace after it. Notice that only "one" is highlighted.

And here is a screenshot of what happens when I mouse over a button with a button immediately after it. It highlights the button "three", which is expected, but also the button "four", which is not.

How can I make Emacs only highlight "three", the button being moused over?


texts:
How do I get Emacs to auto-indent Spacebars blocks when coding with Meteor? Right now, Emacs automatically does this:
{{#each player}}
{{name}}
{{/each}}

instead of this:
{{#each player}}
    {{name}}
{{/each}}

Failing that, can I stop Emacs from deleting my indentation when I hit return? If I manually add indentation so that the code looks like the second example above, then hit return after {{name}}, it deletes the indentation so it looks like the first example.
Right now I’m using Emacs 25.2.2. I just use the basic GNU Emacs that I installed in Ubuntu 18.04, so I guess Vanilla Emacs. The major mode when I open html files is HTML.
I got a suggestion here to use web-mode.el, but I couldn't figure out how to set it up for Meteor.
Thanks in advance for any help!


texts: Show file names with the full path in the frame title

texts:
I want to set the frame title as follows:

When the current buffer is visiting a file, show the full path name and the Emacs version.
When the current buffer has no file, then show the buffer name and the Emacs version.

In my init.el, I put

(setq-default frame-title-format
  (concat (if (buffer-file-name) "%f" "%b") " - " (substring (emacs-version) 0 15)))

But here is the result:

Why doesn't my code print the file name with the full path?


texts:
While there are org-templates creating entire bullet points with content, what I am looking for is a simple user query (similar to read-string) where the user can use a pre-defined list of words/phrases to choose from (up/down or left/right arrow keys).
Background:
I am with our IT department and among other things order hardware for our users.  Once an order is out I would like to tell them when their hardware is expected to arrive.  The general text stays the same, but I would like to choose the week's workdays from a list to complete this text snippet.  Plus points, if I can have a second choice based on the first to choose this or next week.  This means when I choose "today" or "tomorrow", it shall not ask for the week.  Likewise choosing "Monday" or "Tuesday" shall fix the second choice to "next week" (since otherwise I could have chosen "today" or "tomorrow" if it were this week).
Simplified result (with choices highlighted):
I ordered your hardware and it is estimated to arrive Wednesday next week.
Currently I realize that snippet with a script inside the aging AutoKey GTK application, but would love to consolidate what I have there into Emacs.  I already have my phrase templates as well as full-auto scripts in Emacs, but I am struggling to get the user input stuff to work the way I would like to have it.
read-string has a history argument, but I am not sure if one can misuse(?) that for what I intend.  Being still fairly new to elisp, maybe there are better or more sophisticated ways to do so.  Since Emacs' built-in help as well as most online resources are notoriously sparse on examples to demonstrate its capabilities, an example would go a long way.


texts: How can I compile and run my C code from within Emacs like I would with the terminal?

texts:
I recently moved from Code::Blocks to Emacs to write C code.

The one thing I don't like (because it takes too much time and effort for a simple and repetitive task) is the fact that I can't compile/build the code from within the software itself. So in order to compile, link and run my code I have to switch between Emacs and the terminal.

However, my professor said to me that I should be able to compile from Emacs itself by calling a buffer as a terminal, then compile and run the code like I would on my Linux terminal.

I've been searching on how to do this quite a bit now, but still couldn't figure it out. So I guess my question is: how can I compile and run my C code from within Emacs like I would with the terminal?


texts: org-capture to a heading within a date-tree

texts:
been using org-mode for a little over a year, but still have a ton to learn. Here's the setup and question: i've got a straightforward date-tree daily notes / tasks setup, and i'm trying to figure out how to append to a sub-heading within that structure. At the top-level, my main file is structured like this:
* 2020
** 2020-11 November
*** 2020-11 November
**** 2020-11-24 Tuesday
***** tasks
***** log
***** meetings
***** notes

And I want to create a capture template that appends a note under today's "* log". I'm currently using a capture template like this:
   ("y" "Work Task" entry (file+olp+datetree "~/org/journal/work.org")
    "* TODO %?\n%U" :empty-lines 1)

Which is fine, but it adds the task to the date correctly, but not the TASKS sub-heading. Any idea how I'd set that up?


texts: Remove extra prompts in Emacs Babel Python session

texts:
When I run the following code block from Emacs org-babel:

#+BEGIN_SRC python :session *Python* :results output

  print("Hello World")

#+END_SRC

This is what prints out in my *Python* session:

>>>
>>> print("Hello World")
Hello World

>>>
>>>
>>>
>>> 'org_babel_python_eoe'
>>> 'org_babel_python_eoe'
>>>

How can I get rid of all these extra prompts and org_babel_python_eoe lines?


texts: Temporary text in window location with no text to propertize/overlay?

texts:
Q: how do I temporarily show text in a window at screen locations with no text to propertize/overlay?

I'm familiar with the basic idea behind text properties and overlays (see also this thread), have used them a few times, but am by no means adept with them.  My limited understanding is that there needs to be text to propertize or overlay, but I'm wondering how to use sections of a window that do not have any text in them.

Here's a screenshot for an example:

How could one put text (temporarily) in one of the red boxes in the screenshot, that is, the blank space to the right of the text, or below the last line in the buffer?


texts: How to prevent dired from changing window (frame) title?

texts:
Using graphical version of gnu emacs v24.4.1 on centos7.
I set the window (frame) title manually with this:

(setq frame-title-format '("SAMPLE TITLE"))

It is working OK and tittle gets set fine.
Problem is when I start (or switch) to dired it gets the title chaged from the value I set (to the folder name usually).

I am thinking about a post-hook ? I am new to emacs (just a year), so not even sure if that is possible.

Is there any way to prevent dired from changing the window title?


texts: Which setting controls the replacing of selection with the character we type?

texts:
When wanting to replace a region of text with another, I usually mark them with C-SPC (set-mark-command), press some arrow/movement keys, then type the text that I want. To illustrate:
I like biscuits.

Say I want to replace like with love and my cursor is at the letter l. I press C-SP M-f, then type love.
Usually this works with no problem. But sometimes, after I accidentally press some combination of keys, a setting changes and when I type l, the selected like is not replaced.
My question is, which setting is this?


texts: eval-on-export not leaving RESULTS in org-mode?

texts:
I think I know how to control automatic evaluation of code blocks with the :exports keyword and with the #+call: tag, but my blocks only leave #+RESULTS: when I run them manually via C-c C-c.  Is automatic code eval-on-export only for side effects?  Here is a MVE:

Here's a source block that executes automatically (modulo security)
when we say ~M-x org-latex-export-to-pdf~

#+name: square
#+header: :var x=0
#+begin_src python :exports code
  return x*x
#+end_src

It seems to execute automatically because of the following
~#+call~ tag: if I remove the tag, the code doesn't execute
automatically any more:

#+call: square(7)

In any case, it only leaves a result in the emacs buffer under a
~#+RESULTS:~ tag if I run it manually via =C-c C-c=.  Why
doesn't it leave a result when it runs automatically?  Is automatic
running only for side effects?

Here is a code block that runs automatically only if I say
~:exports both~ or ~:exports results~.

#+name: ftw-python
#+begin_src python :exports both
  return 43
#+end_src

It also doesn't leave a result unless I run it manually.


texts: Different results using color-theme-select versus color-theme-

texts:
I am using the color-theme package to manage the colors in Emacs 24.3.1.  I used the command color-theme-select to try different color themes until I found one that I liked.  In this case I found the Hober theme.  Then I put the following code into my .emacs file to automatically load the color theme when I start up emacs.

(require 'color-theme)
(setq color-theme-is-global t)
(color-theme-initialize)
(color-theme-hober)
(set-frame-font "lucidatypewriter-9")

However, when I reload emacs, the color theme is significantly darker than what I saw before.  Why are the two approaches to selecting the color theme yielding different results?

The following are pictures of the two cases.

If I select via color-theme-select:

If I select via color-theme-hober and the other code mentioned above:


texts: I have set up company-irony backend for C/C++ auto-completion, everything works fine except that it doesn't support fuzzy match. I know ycmd has such feature, I am wondering whether irony can have similar support ?


texts: Graphical tooltips in Emacs not working as expected

texts:
I am trying to make graphical tooltips appear over some words in Emacs. Here is the code I have developed:

(defun image-tooltip (window object position)
  (save-excursion
    (goto-char position)
    (let* ((img-file (format "%s.png" (thing-at-point 'word)))
       (s (propertize "Look in the minbuffer"
              'display (create-image (expand-file-name img-file)))))
      (message "%s" s))))

(font-lock-add-keywords
 nil
 '(("\\<kiwi\\>\\|\\<grapes\\>\\|strawberry" 0 '(face font-lock-keyword-face
                              help-echo image-tooltip))))

The kiwi.png and other images are stored on disk, and they work fine (you can see it here https://www.youtube.com/watch?v=uX_hAPb9NOc)
It works fine to put an image in the minibuffer, but the tooltip itself just says Look in minibuffer, and I thought it would instead show the image. Am I missing something in here?


texts: C-c c-c behaves differently for c and python modes. What is the recommended way to resolve it?

texts:
In c mode, C-c C-c will put marked text in comment.

In python mode, C-c C-c will execute a python runtime.

Usually how do experienced emacs users resolve this inconsistency of key shortcut? Or we just accept it as is?