texts:
I've tried for a while to create a simple major mode that uses SMIE to perform
navigation and indentation, but it seems like even the simple examples that I've
found seems to break quite easily.

The mode I'm trying to create consist of semi-colon separated statements and blocks of
the construct "AttributeBegin" and "AttributeEnd". E.g.:

test;

AttributeBegin
    test;

    AttributeBegin
        test;
    AttributeEnd
AttributeEnd

AttributeBegin
    test;
AttributeEnd

test;

# ...

(This also shows how I want it to be indented.)

To this end, I created the following SMIE grammar and SMIE rules:

(defvar smie-sample-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    `((insts (inst) (insts ";" insts))
      (inst ("AttributeBegin" inst "AttributeEnd")))
    '((assoc ";"))))
  "Sample BNF grammar for `smie'.")

(defun smie-sample-rules (kind token)
  "Perform indentation of KIND on TOKEN using the `smie' engine."
  (pcase (list kind token)
    (`(:elem basic) smie-sample-indent-offset)
    (`(:elem arg) 0)))

This mostly works, but I'm getting some strange behaviors in several cases:

test;
AttributeBegin
    test;
AttributeEnd

    # (1)

    AttributeBegin # <--- Why is this intended?
        test;
    AttributeEnd

    AttributeBegin # (2)
        test;
    AttributeEnd

    test;

For some reason, the block pointed to above is erroneously indented, but for
some reason, (2) is not. Additionally, if I add a statement at (1), the
following block is correctly indented.

I believe that I've written an incorrect grammar/rule pair, but I don't see what
I need to change in order to fix it. Most examples I've seen so far doesn't seem
to require special rules for blocks like this, so is there something I'm
missing?

For completeness, the entire code I used for testing these things are
here.


texts: Org table: aggregate each column (but not the header column)

texts:
I would like to transpose this table example from Org as a spreadsheet system: a short introduction:

| Student  | Maths | Physics | Mean |
|----------+-------+---------+------|
| Bertrand |    13 |      09 |   11 |
| Henri    |    15 |      14 | 14.5 |
| Arnold   |    17 |      13 |   15 |
#+TBLFM: $4=vmean($2..$3)

This part is easy:

| Student | Bertrand | Henri | Arnold |
| Maths   |       13 |    15 |     17 |
| Physics |       09 |    14 |     13 |
| Total   |          |       |        |
#+TBLFM: @4=vmean(@2..@3)

But after a full recalculation (C-u C-c C-c), the text (Maths + Physics) / 2 is inserted:

| Student               | Bertrand | Henri | Arnold |
| Maths                 |       13 |    15 |     17 |
| Physics               |       09 |    14 |     13 |
| (Maths + Physics) / 2 |       11 |  14.5 |     15 |
#+TBLFM: @4=vmean(@2..@3)

How do I treat the first column as a header column? I think this would solve the problem.

Update 2014-01-07 6:26 PM EST: The two answers (by Juanco and wvxvw) work, but is there a way to solve this without changing the formula line at all? Is there a way to tell Org mode that the leftmost column is a header column?


texts: How can I get a mailto link in an org-mode latex export to PDF for the #+email: keyword

texts:
When I'm specifying my mail address

#+email: bla@comp.org

I'm getting a text footnote bla@comp.org for an org latex export of a report.  I'd like to have a complete mailto hyperlink though.

I tried

#+email: [[mailto:bla@comp.org][bla@comp.org]]

or

#+email: \href{mailto:bla@comp.org}{bla@comp.org}

(The problem here seems to be that org-mode escapes the backslashes and braces for the latex export.  So the latex interpreter sees only $\backslash$href instead of the \href command.)

and

#+email: mailto:bla@comp.org

but after exporting the org file to pdf-latex I'm just getting the complete line after #+email as text in the footnote.

Example of a failed attempt:


texts:
I would like to write a script where I can select some text as the region, extract the selected region as a string, modify it, and pass it to another program.

I am playing around with ielm and see that I can call (yank) to pull the region string into a register. How would I go about getting the region string into a variable though?


texts: Automatically preview Latex in org-mode as soon as I finish typing

texts:
I'm using org-mode in Spacemacs (0.200.10.x).

To preview Latex when I open a file, I understand that I can either set the variable org-startup-latex-with-latex-preview to t in my init.el, or set the local #+STARTUP: latexpreview option.

However, I want org-mode to preview Latex fragment as soon as a finish typing it. Is that possible? If possible, I'd love a solution that's already included in Spacemacs so I can keep my init.el clean.


texts: run shell command interactively and insert final output into main buffer

texts:
I'm something of an Emacs newbie.  I would like to run a shell script I've written and insert the output into the buffer I'm working in.  But the script requires some interaction, so ideally I'd like a workflow where I:

Call a command from the main buffer
Shell or Term mode opens, I interact with the script, the script gives final output and exits
Final output is inserted at the point in my main buffer

Is this feasible?

I've read some of the documentation on shell mode, the GNU documentation on running shell commands in Emacs and other material I've been able to find, but I can't find anything that addresses this issue specifically.  I may have just missed it, of course.


texts: How to use `backspace` to navigate to the parent folder in Spacemacs?

texts: When I use C-f to find a file in Spacemacs, how can I use <backspace> to navigate to the parent folder?


texts: Ensime plugin causes sbt error: "You must explicitly set JDK_HOME or JAVA_HOME"

texts:
Spacemacs: 0.200.7

  Emacs: 25.3.1

  sbt: 1.2.0

  Java: openjdk version
  "1.8.0_171"

  .sbt/1.0/plugins/plugins.sbt: addSbtPlugin("org.ensime" % "sbt-ensime"
  % "2.5.1")

  scalaVersion 2.12.6

I have tried this with JAVA_HOME set or with using update-alternatives to specify a Java version. Initially, I had believed this was due to using an unsupported version of Java (Ensime doesn't support Java 9+) but switching to Java 8 doesn't resolve my issue.

Here's the trace:

  [info] Loading settings for project global-plugins from plugins.sbt,.#plugins.sbt,idea.sbt ...
  [info] Loading global plugins from /home/myuser/.sbt/1.0/plugins
  [info] Updating ProjectRef(uri("file:/home/myuser/.sbt/1.0/plugins/"), "global-plugins")...
  [info] Done updating.
  [error] java.io.FileNotFoundException: Could not automatically find the JDK home.
  [error] You must explicitly set JDK_HOME or JAVA_HOME.
  [error]         at org.ensime.EnsimePlugin$.$anonfun$JdkDir$6(EnsimePlugin.scala:694)
  [error]         at scala.Option.getOrElse(Option.scala:121)
  [error]         at org.ensime.EnsimePlugin$.JdkDir$lzycompute(EnsimePlugin.scala:693)
  [error]         at org.ensime.EnsimePlugin$.JdkDir(EnsimePlugin.scala:681)
  [error]         at org.ensime.EnsimePlugin$.$anonfun$buildSettings$20(EnsimePlugin.scala:199)
  [error]         at scala.Option.getOrElse(Option.scala:121)
  [error]         at org.ensime.EnsimePlugin$.$anonfun$buildSettings$19(EnsimePlugin.scala:199)
  [error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
  [error]         at sbt.internal.util.EvaluateSettings$MixedNode.evaluate0(INode.scala:221)
  [error]         at sbt.internal.util.EvaluateSettings$INode.evaluate(INode.scala:164)
  [error]         at sbt.internal.util.EvaluateSettings.$anonfun$submitEvaluate$1(INode.scala:87)
  [error]         at sbt.internal.util.EvaluateSettings.sbt$internal$util$EvaluateSettings$$run0(INode.scala:98)
  [error]         at sbt.internal.util.EvaluateSettings$$anon$3.run(INode.scala:94)
  [error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  [error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  [error]         at java.lang.Thread.run(Thread.java:748)
  [error] java.io.FileNotFoundException: Could not automatically find the JDK home.
  [error] You must explicitly set JDK_HOME or JAVA_HOME.
  [error] Use 'last' for the full log.
  Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?


texts:
Here's an org-mode table with some unicode math characters in it:

Note that the columns don't align.

I can manually fix the issue by inserting literal tab characters after each character via ctrl-q TAB:

It would be nice to have a command that did this, instead of having to manually add sufficient tab characters to each cell.

Is there a good way to approach this in elisp?


texts: Adding header to a org-mode tangled file

texts:
I am generating source code files from an org-mode file using org-babel-tangle.

How do I add headers to the files e.g.
for python

  # This is a generated file do not edit

for emacs lisp similar plus a header for lexical binding.

These would be different headers to a file I created directly in emacs so I think autoinsert.el won't have the flexibility.


texts: icicles: How set set Ctrl+p for [up] and Ctrl+n for [down]

texts:
In the minibuffer for Icicles when I press C-p or C-n the minibuffer says beginning of the buffer, end of the buffer respectively. Instead want to move around the found candidate using C-p and C-n instead of using arrow keys [up], [down].
I want to keep following setup (Using `C-n` and `C-p` to iterate as cycle in `find-file` instead of up/down arrow keys) for all the minibuffers except one for Icicles. If I have it for Icicles: C-n and C-p moves around the action keys as equivalent to M-n and M-p.

(define-key minibuffer-local-map (kbd "C-n") #'next-line-or-history-element)
(define-key minibuffer-local-map (kbd "C-p") #'previous-line-or-history-element)

I have also try to set from group-custumization adding [C-p] into the array list but it did not helped.
(custom-set-variables
   '(icicle-modal-cycle-down-keys (quote ([C-n] [down] [nil mouse-5] [mouse-5])))
  ...


texts: How to use the same melpa directoy for different emacs distrubitions

texts:
I have several emacs distributions (scimax, spacemacs, vanilla emacs, etc.) which all uses their own melpa directory. I want them all to use the same elpa (or melpa or gnu) directory to save some place.

For example, I have a "init.el" file in my vanilla emacs directory (~/.emacs.d/init.el). I want "Vanilla emacs" to look up elpa files inside in my scimax directory (~/emacs/scimax/.emacs.d/elpa) and download future elpa files inside the scimax's elpa directory.


texts: Dynamic virtual indentation Makefile minor-mode or configuration option

texts:
Is there a minor-mode, or configuration setting for Makefile mode that does the following?
When viewing a Makefile with lots nested ifeq..endif / ifneq..endif blocks, the buffer contents will be presented (but not edited/changed) to be similar to what Org mode presents its headings using Dynamic virtual indentation?

Dynamic virtual indentation is controlled by the variable org-startup-indented

The mode would not automatically change the indentation at all, but would only present it to my eyes as if it was indented.  Just in case I've got the incorrect name of this in Org mode, this is a visual of an Org-mode buffer with this behavior:

For example, if a Makefile had the following:
ifneq "$(SOME_VAR1)" ""
  export SOME_VAR2 = ...
  export SOME_VAR3 = ...
ifeq "$(SOME_VAR4)" ""
    export SOME_VAR4 := some blabberations
endif # End SOME_VAR4 is empty
endif # SOME_VAR1 is set

In the Emacs buffer, with this setting/minor-mode enabled, it would present it as:
ifneq "$(SOME_VAR1)" ""
  export SOME_VAR2 = ...
  export SOME_VAR3 = ...
  ifeq "$(SOME_VAR4)" ""
      export SOME_VAR4 := some blabberations
  endif # End SOME_VAR4 is empty
endif # SOME_VAR1 is set

But, if I edited it, then moving my point to the beginning of a line would behave as it would in Org-mode under Dynamic virtual indentation.
Regrettably, one cannot physically reindent the rules because the TAB character is semantically significant in those rules. So said minor-mode/setting would also "virtually indent" Makefile rules such that if rules were wrapped inside ifeq..endif, they would display as indented.
I'm open to installing packages using Melpa/Elpa/etc.


texts: Display JPEGs scaled to fit buffer, but PNGs without scaling?

texts:
In almost all cases, I want to see JPEGs such as photos scaled to the current buffer size. This is the default with image-mode. However, for PNG files, primarity screenshots, I want to view them without scaling by default.

How do I best assign scaling behavior based on file type?

By the way, image-mode is not a requirement. I am fine with switching to something else.

Update

Based on Jordon Biondo's answer, I am now using the following setup:

(defun my-image-mode-hook ()
  (when (and (display-images-p) (eq image-type 'imagemagick))
    (let ((extension (downcase (file-name-extension
                                (buffer-file-name)))))
      (when (string-match-p "^\\(png\\|gif\\|bmp\\)$" extension)
        (image-transform-set-scale 1)
        (setq image-transform-resize nil)))))
(add-hook 'image-mode-hook 'my-image-mode-hook)

This never scales images of type PNG, GIF, or BMP. All other images are scaled, as per default, to fit into the buffer. To prevent additional scaling based on selected font size, I have customized:

'(image-scaling-factor 1)


texts: Does org-babel for groovy take arguments?

texts:
I am trying to pass an argument to a groovy babel block but I'm not sure it accepts arguments?  The documentation says that it is language-specific but I didn't find any documentation for ob-groovy.

For example, I want to try to feed one section of my document into the groovy block:

#+NAME:current_paths

path1
path2
path3

** Groovy Processing
#+BEGIN_SRC groovy :var paths=current_paths :results output :cache yes
    paths.each {
      println "PATH: $it"
    }
#+END_SRC

But I get:

Caught: groovy.lang.MissingPropertyException:
No such property: paths     for class: groovy-6160mqV
    at groovy-6160mqV.run(groovy-6160mqV:2)

Does anyone know if groovy babel support includes arguments?  Or maybe I'm doing this wrong?


texts:
I have an issue outlined here that I was able to find a partial solution for. The problem involved changing perl-modes syntax table. One of the commenters pointed me to the function syntax-propertize-function. Within it, there is macro called syntax-propertize-rules and I was able to add the following code snippet to it.

      ("\\('\\)[bh]" (1 "."))

this fixed the syntax problem I was having. However this is a change I made to the source perl-mode.el. What I need is some way to add this rule to syntax-propertize-rules from within my .emacs file. I have already tried

(defun my/perl-syntax-propertize-function ()
    ("\\('\\)[bh]" (1 ".")))

(add-hook 'perl-mode-hook
          (lambda () (add-function :after (symbol-function 'syntax-propertize-rules) #'my/perl-syntax-propertize-function)))

But this does not work. What is the correct way to make this change?


texts: ox-pandoc table and image export formatting. ATTR_LATEX and ATTR_HTML not behaving as expected

texts:
I have been using ox-pandoc to export my org-mode files (generally to pdf using pandoc and xelatex) but I am having a lot of trouble formatting images and tables. #+ATTR_LATEX commands for images is generally ignored, but I found a workaround for images using #+ATTR_HTML, for example:

image example no formatting added

#+CAPTION: not formatted
[[file:~/Dropbox/lab_notebook/screenshots/image.png]]

gives the following latex:

image example not formatted

  \begin{figure}
  \centering
  \includegraphics{~/Dropbox/lab_notebook/screenshots/image.png}
  \caption{not formatted}
  \end{figure}

image example formatted

#+CAPTION: latex formatted
#+ATTR_LATEX: :width 75% :placement [!htb]
[[file:~/Dropbox/lab_notebook/screenshots/image.png]]

basically strips away all formatting and gives the following latex

\includegraphics{~/Dropbox/lab_notebook/screenshots/image.png}

but with ATTR_HTML it works fine (besides ignoring the latex :placement)

#+CAPTION: formatted html
#+ATTR_HTML: :width 75% :placement [!htb]
[[file:~/Dropbox/lab_notebook/screenshots/image.png]]

gives this latex

 \begin{figure}
  \centering
  \includegraphics[width=0.75000\textwidth]{~/Dropbox/lab_notebook/screenshots/image.png}
  \caption{formatted html}
  \end{figure}

I have tried all the formatting for ATTR_LATEX listed in the org manual and they are all stripped away.

The ATTR_HTML (discussed here) workaround works for images, but it fails with tables. No matter what html or latex formatting I specify for tables, the output is always the same.

HTML attr

#+ATTR_HTML: :width 480
   | Condition | table  | example  | here     |
   |-----------+--------+----------+----------|
   | ex        | Normal | Normal   | Normal   |
   | am        | Normal | Abnormal | Abnormal |
   | ple       | Normal | Abnormal | Normal   |

gives the following latex

  \begin{longtable}[]{@{}llll@{}}
  \toprule
  Condition & table & example & here\tabularnewline
  \midrule
  \endhead
  ex & Normal & Normal & Normal\tabularnewline
  am & Normal & Abnormal & Abnormal\tabularnewline
  ple & Normal & Abnormal & Normal\tabularnewline
  \bottomrule
  \end{longtable}

and attr_latex formatted

#+ATTR_LATEX: :environment longtable :align l|lp{3cm}r|l
   | Condition | table  | example  | here     |
   |-----------+--------+----------+----------|
   | ex        | Normal | Normal   | Normal   |
   | am        | Normal | Abnormal | Abnormal |
   | ple       | Normal | Abnormal | Normal   |

gives the following latex

 \begin{longtable}[]{@{}llll@{}}
  \toprule
  Condition & table & example & here\tabularnewline
  \midrule
  \endhead
  ex & Normal & Normal & Normal\tabularnewline
  am & Normal & Abnormal & Abnormal\tabularnewline
  ple & Normal & Abnormal & Normal\tabularnewline
  \bottomrule
  \end{longtable}

Am i missing a setting or tag attribute? how can I specify formatting for tables and images for export?


texts:
I have many files in many directories all with the same filename pattern. I want to rename them by replacing a substring with another, e.g. bla_A.mat to bla_B.mat.

I know I can do this quite easily in a directory using wdired mode and replace-string. How can I do that same operation recursively on all my directories?


texts: Numbering only 2nd level headings in an org file

texts:
I would like to be able to turn on numbering when exporting an org file, but only in second level headings. First level and all other levels should remain unnumbered.
I.e.
* Unnumbered
** Numbered
*** Unnumbered
**** Unnumbered
How can I achieve this effect in a specific document?


texts: Configuring yasnippet and autocomplete to work with C/C++ headers

texts:
My computer system and set up are

OS: Arch Linux 64bit
emacs version: 24.4
alias emacs='emacsclient -t -s server --alternate-editor='

Update:

auto complete is working with yasnippet occasionally now but not as expected. I changed the line

(add-to-list 'achead:include-directories
       '"/usr/include/c++/4.9.2/")

If I type #include <io and hit tab, I get back #include <#include <iostream>. Therefore, I then tried just typing <io and tab which produces <#include <iostream>. If I type ios and hit type, the desired result is achieved. I then tested this with float.h. No iteration works.

I then tried re-testing io and tab. This doesn't work 100% of the time. 50% of the time I get #include <iostream> and the other 50% nothing happens. Needless to say, I have no idea what is going on with this package or feature.

I am trying to get auto complete to work with C/C++ headers; however, I have been unable to do so. I executed the following command in the terminal to locate the C/C++ headers:

[dustin@dustin ~]$ g++ -print-prog-name=cc1plus -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1plus

but using /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/cc1plus does not produce the desired outcome. I have also ran a search looking for float.h just to determine locations as well and came up with

[dustin@dustin ~]$ sudo find / -name float.h
[sudo] password for dustin:
/usr/include/c++/4.9.2/tr1/float.h
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include/float.h

So I also tried /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include. I am not to sure about /usr/include/c++/4.9.2/tr1 though.

Below is the relevant information in my .emacs. All packages were downloaded and install from melpa are up-to-date. If I run 'emacs' --debug-init, there are no error messages. The ' ' around emacs is so that emacs will open without options for debugging only.

;; Start server and set directory
(setq server-socket-dir (format "/tmp/emacs1000"))

;; Package list M-x package-list-packages
(require 'package)
(add-to-list 'package-archives
         '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Package initialize
(package-initialize)

;; C/C++ configuration
(require 'cc-mode)

;; auto complete for C/C++
(require 'auto-complete)
;; default config for auto-complete
(require 'auto-complete-config)
(ac-config-default)

;; start yasnippets
(require 'yasnippet)
(yas-global-mode 1)

;; auto complete C++-headers
(defun my:ac-c-header-init ()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-header)
  (add-to-list 'achead:include-directories
               '"/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/include")
  )

;; call ac-c-headers from c/c++ hooks
(add-hook 'c++-mode-hook 'my:ac-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)


texts:
I would like to have a function call-keymap which takes one argument km (a keymap) and such that the result of (call-keymap km) is the same as binding km to a key and then pressing that key.

It should look something like this

(defun call-keymap (km)
    (while (keymapp km)
      (setq km (lookup-key km (read-key-sequence ""))))
   (call-interactively km))

except that this doesn't work (specifically the last line is wrong, since a non-keymap entry of a keymap needn't be a function).

Intuitively, it would seem that the main command loop in emacs should be something like

(while t
  (call-keymap (current-global-map))

(or rather, it should do something with current-active-maps instead of current-global-map).

I was surprised to not be able to find a built-in function with the desired functionality of call-keymap, since this seems to me to be such a basic function.

Could someone please point me to such a built-in, or indicate how to fix the above definition?

Edit 2019-01-23

Stefan very rightly asked that I explain what my use-case is for such a function.

I use evil-mode and have SPC as a prefix-key for various useful commands when in normal-state. In insert-state, I would like some other binding (say, M-SPC) to produce the same behaviour as SPC in normal mode (I think emacs-DOOM has such a feature). My idea was then to bind M-SPC to a function which fetches the current normal-state binding of SPC (which is a keymap) and calls it.

Presumably, there are other good solutions to this, so that my original question may be moot, though I would be still be interested to know the answer. For example, here is one quite-hacky-but-maybe-not-entirely-unsatisfactory solution to my problem:

(defun set-alt-space ()
    (evil-local-set-key 'insert (kbd "M-SPC") (key-binding (kbd "SPC"))))
(add-hook 'evil-normal-state-exit-hook 'set-alt-space)


texts: How to order a single line relative to other lines in a block of text?

texts:
How can a line be sorted relative to other lines at the same indentation level?

This would be useful whenever adding an item to an ordered list of definitions (file lists or forward definitions).

Currently you need to:

Move to the start of the block
Start selecting.
Move to the end of the block.
Sort the items.

Being able to order a newly added item in a block would be a more efficient way to handle this.

Examples could include:

C struct's:

/* Structs, keep in order. */

struct FooBar;
struct FooBaz;
struct FooFoo;
struct AbcBaz;  /* <- cursor on this line. */

CMake file list:

set(SRC
  zaz.c  # <- cursor on this line.
  bar.c
  baz.c
  foo.c
)

Running this action would sort the current line in respect to surrounding lines.


texts: Org-mode file hyperlinks always use doc-view, can't force it to use external pdf viewer

texts:
I am using Emacs 25.1 run with emacs -Q and Org mode version 8.2.10. This problem persists in my customized Emacs with Org mode version 8.3.6.

I am attempting to open hyperlinks of the form

[[file:documenterino.pdf][documenterino]]

using the external default pdf viewer, evince.
When I create the above link, it turns into a blue, underlined documenterino. If I use C-c C-o, C-u C-c C-o, or C-u C-u C-c C-o on it, I get the same result every time: the pdf opens in a new docview buffer in emacs, when I want it to open outside emacs in evince.

I tried changing file: to file+sys:, and ~/documents/documenterino.pdf instead of documenterino.pdf, but there is no change.

LMouse, RMouse, and MMouse also open in doc-view regardless of changes.


texts: Correct way to configure the lastest `org-mode` (literate programming)

texts:
Update: 11/Aug: I forgot to mention that I'm using literate programming to build the init.el from an org file. It seems that the problem appears when emacs opens the configure.org to generate the .el file.

I noticed that if I write the configuration to a .emacs (as I wrote below) the right version is loaded.

The right question

How to load the latest version of org-mode using org literate programming to generate the config.el file?

I'd like to use the latest version of org-mode from the git repository.

My setup

Emacs version: GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5) of 2015-03-07 on trouble, modified by Debian

About org-mode

I clone the repository, say in ~/.emacs.d/org-mode
Compile the autoload using make autoload
Initial part of my .emacs is

(package-initialize)

(require 'package)
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/") t)

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

(unless (package-installed-p 'use-package)
  (package-install 'use-package))

(setq use-package-verbose t)
(setq use-package-always-ensure t)

(require 'use-package)

(use-package auto-compile
  :config (auto-compile-on-load-mode))

(setq load-prefer-newer t)

Result

I call M-x org-version and get

  Org-mode version 8.2.10 (release_8.2.10 @ /home/.../.emacs.d/org-mode/lisp/)

This is no the latest release!

If I call M-x org-reload it load the newest

  Org-mode version 8.3.5 (release_8.3.5 @ /home/.../.emacs.d/org-mode/lisp/)

But it is not loaded automatically.

Question

What am I doing wrong??

P.D.: I accept suggestions about simplifying the configuration.


texts:
I want to set a different font for org-mode contents. Strangely, setting

'(org-level-1 ((t (:inherit variable-pitch))))

has the effect on headers as intended. However, setting

'(org-default ((t (:inherit variable-pitch))))

does not impact the text on normal org-mode text. They're still fixed-width font.

If I run describe-face on those text, it just says default instead of org-default. Not sure if that's the normal behavior.

How can I manually set font for normal org-mode content text?


texts: Publishing top-level orgmode entiries in separate files automatically

texts:
In org-mode, how can I "publish" all of the top level headings in separate files. Publishing involves moving files while making the required transformation. The transformation is from org to html. There is a similar question talking about exporting

How to export top-level headings of org-mode buffer to separate files?

That solution is great and it works for exporting to html, pdf, and latex. Differently, I would like to avoid the interactive part and use the above functionality as a "publish" function in emacs. I may be still interested in different formats, however, since publishing is a batch function, it would not make sense to stop and ask for user input.

What can be done? Any  help would be greatly appreciated

thanks in advance


texts:
I'd like to get a tooltip that says "meow", whenever my mouse is on the word "Cat" in Emacs. I tried this snippet I put together, but didn't work. What's wrong with it?

(defun my-hi-lock ()
(interactive)
(highlight-regexp "Cat"  '(help-echo "meow!"))
)

I'd like to put the associated tooltip message inside the highlight-regexp statement rather than define a font face at a different place because I won't reuse each tooltip message that I'm going to assign to different keywords.


texts:
I have a vagrant machine for my Rails project. I would like to integrate Emacs with rspec, currently done by hand on a terminal (inside the vagrant machine).

If I run rspec-verify-all Emacs will try to execute rspec from local shared directory (not from Vagrant obviously) and this does not work, as the Rails environment is not set locally on my computer.

So the question: how to run rspec in Vagrant environment?


texts: How to change the size on mode-line horizontal line

texts:
I am running emacs version:
GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2020-09-19
On ubuntu 20.04 on a Laptop with 4K display in 200% scaling mode (hiDPI).
Emacs does not adapt fully to scaling changes. On a large monitor I use 100% and everyting renders ok. But when using the laptop screen only, the horisontal divider of the mode-line is incorrectly scaled. Can the size of the divider be customized?
I also have to change the Default font size everytime I change between 100% and 200% scaling, is there a setting in Emacs where that can be automatically set based on screen resolution/scaling settings?
EDIT
The mode line is not an issue any more, since I was informed that it was a scrollbar that concealed the text.
I still have a problem when changing from Large monitor to laptop screen in 4K resolution. I have to manually change the default font size, and the cursor is too small.
Do Emacs have support for automatic adaption to HiDPI screen sizes?


texts: Viewing a Sequential Timelog in Org-Mode

texts:
I'm aware that org-mode has time clocking features via C-c C-x C-i to start the timer for a task and C-c C-x C-o to stop it.

Question: Is there a way to view -- across all of your agenda files -- a sequential timelog across all tasks? One that shows, for example, that you started the day doing Task A for N minutes, followed by Task B for M minutes, and so forth.


texts: Org-mode: Translate Latex Abstract keyword

texts:
I am Brazilian and constantly writing papers for university. I am now using this question to place a cool block containing the abstract description of the paper per se. But in portuguese abstract is called resumo, and I am supposed to write both of them, portuguese and english version in every single paper. Pretty much like this

How can I make emacs help me out here? Is there a config for this or should I mess with elisp?


texts: Align columns in Org Mode with Korean letters

texts:
When I try to make a table that has Korean character (한글) mixed with English words, the table becomes unaligned, and according to an answer about Japanese found here the the same problem with Japanese letters, it seems English letters, and Japanese letters have different base pixel sizes, and thus something needs to be changed at the operating system level.

Here it is in plain text:

| English word      | Korean word | Memorized? |
|-------------------+-------------+------------|
| friend            | 친구        | yes        |
| to eat            | 먹다        | yes        |
| this row          | is just     | English    |
| to bring with you | 가지고 가다 | no         |

I'm using MacOs Mojave, and actually using spacemacs, any ideas what I can do?  Thank you.


texts: Why do I get a different file content when I'm opening it with different Emacs versions on Windows7

texts:
I'm opening the very same file with Emacs-24.5 and with Emacs-23.1.  But the latter shows me what seems to be an older version of this file!  Might this be a bug of in Emacs-23.1?

I updated the question with images showing the file (opened with C-x C-f) content and the respective output of (buffer-file-name)


texts:
I'm using centaur tabs, and when lsp-headerline enables my tabs hides. I want to disable that headerline using lsp-headerline-bradcrumb-mode in a hook
(use-package lsp-mode
  :commands (lsp lsp-deferred)
  :init
  (setq lsp-keymap-prefix "C-c l")
  :config
  (lsp-enable-which-key-integration t)
  :hook
  (lsp-mode . lsp-headerline-breadcrumb-mode)
)

Something like this. But it does not work. also I tryed to set lsp-headerline-breadcrumb-enable to nil in the config of my plugin, but it gives me an error lsp-headerline-breadcrumb-enable is not defined
EDIT: Other possible fix to this issue is find a way to keep visible and functional my tabs if it not possible to hide the bradcrumb.
Note: In the breadcrumb after the file name it says *invalid*


texts: Why am I getting `max-specpdl-size` error on one markdown file when opening via projectile but not dired?

texts:
I am getting a max-specdl-size error on only one .markdown file. I have increased the size via (setq max-specpdl-size 50000) to test, and I still get the error. This does not happen on any other .markdown files. I also tested it on .Rmarkdown and .R files, but it only happens on one particular file.

When I load the file, the file will be enabled without markdown-mode. However, if if I revert-buffer this seems to correct itself and the markdown-mode is re-enabled, but this does not always work either. I followed the advice here, but get a massive debug report (too big for the allowed limit to be posted here).

Any ideas why this is occurring? Please let me know if you need any more info.

This problem only happens when opening a file via projectile but not dired or directly form Finder.

EDIT

This seems to be a problem on the contents of this particular file. I have copied the content to a new and renamed file, and still get the same issues. I also started using imenu-list and it does not provided an outline for this particular file, and reports an error (wrong-type-argment consp 31794). I've tested this file in other editors (Sublime Text, VSCode), and it works fine.

Any ideas are greatly appreciated.

EDIT#2

I added (setq max-specpdl-size 50000) to my init file and the issue seems to have resolved.


texts: Can I tell prin1-to-string to use reader-macros?

texts:
I'm writing a lispy documentation engine with elisp and to make things easier, I'm trying to modify the following behavior

(prin1-to-string '(cons 'a 'b))
;; => "(cons (quote a) (quote b))"

to be

(prin1-to-string '(cons 'a 'b))
;; => "(cons 'a 'b)"

Is it possible to instruct prin1-to-string to reinstate reader macros like this?  Reading through the C sources, I don't think it's possible since by the time the object has been read, we've already used the reader-macro to turn 'a into (quote a) and that ' is lost forever.  Is my only hope regex-replace?


texts: How to load start up screen (*GNU Emacs*) f it hasn't already been created?

texts: When you run Emacs in daemon mode and then connect to it with emacsclient it doesn't show the start screen (*GNU Emacs*) but instead puts you into the *scratch* buffer, which is normally fine. But if I decide I want to see the start screen at some time, I can't just change the buffer to get into it because in daemon mode it seems it was never created in the first place. I'm sure there must be a function I can call with m-x, but I guess my emacs knowledge is still to low for me know what to search for to find it, because I haven't been able to find the answer.


texts:
I want to run compile or recompile, but I don't want to see the *compilation* buffer pop up unless there's an error, or not at all. If the compilation succeeds, I should just see a notification in the echo area. This is how AUCTeX works; I want it for arbitrary compilation commands in arbitrary modes.

This is a small wheel to be sure, but I can't find it built in (as of Emacs 24.3). Before I go on about reinventing it, does this already exist somewhere?


texts: `Treemacs` fixed width and `Desktop.el` save

texts:
I use Treemacs to toggle my directory. As default, the width of the Treemacs buffer can only be changed by doing M-x toggle-treemacs-fixed-width. Then, I can use my mouse to drag and adjust the Treemacs buffer to resize its width.  Once I am done, I can lock the width by running M-x toggle-treemacs-fixed-width again.

Now, I also use Desktop.el to save and load my windows arrangement.  My typical windows layout looks like this:

|treemacs buffer | main editor with files open |
|                |                             |

I can read a desktop file with M-x desktop-read and I do have all of my files reopened. There are two problems.

the Treemacs buffer is not there.
the Treemacs width size that I manually change is not saved.

Problem 1) is easy to fix, i can just toggle the M-x treemacs again.  Problem 2), I do not know how to fix this.

Is there a solution where both problem 1) and 2) can be solved together? In other words, once I load my desktop, I still have my Treemacs buffer with correct width size?

Please let me know and thank you for your help


texts: How do I live preview markdown, rendering math, checkboxes, etc.?

texts:
I’m using Spacemacs with markdown-mode and I’ve configured it according to Jason Blevins’ guide.

Other things I’ve tried

Pandoc works pretty well except when I set the —lua-filter=task-list.lua flag and I don’t have chackboxes to render (but it only fails with certain files and I have no idea why). This doesn’t give me a live preview though.
I love the mume-cli package, which uses the mume library on which markdown-preview-enhanced is based, but I can’t configure it the way I can in VSCode. (I can modify a js file in Linux, but I can’t find that file in any of the directories inside of the node_modules directories). It does generate an html file that I can open in the browser, but whenever I export, Emacs asks if I want to overwrite my html file twice. I have to answer yes, then no in order to get it to render successfully. I also have to manually reload the page in my browser each time.
livedown, flyit-md, and vue do not do what I’m asking.

I know a simple solution is to use VSCode for Markdown editing, but I don’t like how the Vim extension works (or doesn’t).

Limitations

I don’t know how to configure a node.js package without rebuilding it (and it doesn’t look like I can build a package before publishing it...). The npm sites have these configurations people can make, but no comments on where to put the text snippets they offer as examples.
I don’t know or have much time to learn Lisp or JavaScript/TypeScript. I want to use a package someone else has written and configure markdown-mode to call it.
I want a live preview that renders math (MathJax and KaTeX) as well as checkboxes. This is a good set of capabilities I’d like.
I want to do this with Emacs.
I do not want to configure/build anything each time I have a file with different Mardown features. Just one command for whatever file I have open in the current buffer.


texts:
Q: are there breaking changes to eieio in Emacs 27?

I just upgraded to the Emacs 27 snapshot, and I'm getting a
peculiar break in code that works in previous versions of Emacs.

walkthrough

Here's a toy class and a toy :after method:

(defclass simple-class ()
  ((value
    :initarg :value
    :initform nil
    :documentation "Test slot"))
  "Test class.")

This works:

(simple-class :value "some value") ;; ==> #s(simple-class "some value")

Now I'd like to define an :after method on initialize-instance:

(cl-defmethod initialize-instance :after ((sc simple-class) &key)
  (with-slots (value) sc
    (setf value (upcase value))))

Now it's broken:

(simple-class :value "some value") ;; ==> (error "Keyword argument nil not one of nil")

NB: it's nothing about the content of the :after method: I can
define an empty method and I get the same error.

(cl-defmethod initialize-instance :after ((sc simple-class) &key))

what happened?

So: have there been changes to eieio (specifically,
cl-defmethod) in Emacs 27 that break previous code?  Or is there
something bizarre about the snapshot?


texts:
currently I'm working a lot with json files. They tend to be a little bigger.
I'm a little fed up with always marking the whole file and then typing M-x json-reformat-region.

Is there a way to do this directly on opening the file?

Regards


texts: Can magit commit with all (-a / --all) instead of "." by default?

texts:
When using magit-commit-create, internally it runs something like...

git commit . instead of...
git commit -a

Is there a way to make magit use -a / --all by default instead?

Note: this is an important difference because this causes sub-modules to be committed each time, which I don't want to do (since the sub-modules have master checked out and I don't want to be changing the submodule sha1 for every commit).


texts: How to compile emacs with debug symbols?

texts:
I'm having trouble walking through emacs source code in gdb.  I think I'm missing debug symbols.

Following a suggestion from https://stackoverflow.com/a/4298982/2752242, I tried:

./configure CFLAGS="-ggdb3 -O0" CXXFLAGS="-ggdb3 -O0" LDFLAGS="-ggdb3" --with-gif=no --prefix=$HOME/local/apps/emacs-24.4/

But, that didn't work.

Are there instructions on compiling with debug symbols?  Thanks!


texts: How to update Org to latest version using package repo's / git clone in Ubuntu

texts:
See the image below.

.

I want to update my org from Version: 2016071 to Version 20161003.

It does not give me an option to upgrade when I use the package-list-packages command.

An additional question is when the packages get loaded and I push the "U" key - it tells me one package is marked for upgrade.  How to find out which package is marked and how to activate the upgrade action?

Update-1:

I just found out by accident (co-incidence) the solution to part of my problem.

In order to activate an upgrade a package from the list of packages press "x". This will upgrade the marked package.

As a coincidence it turned out that org package was the one marked for upgrade and pressing "x" upgraded it.

Update-2:
Even though I upgraded just now, my org version is still Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef while my org-mode in Windows (with 64 bit Emacs from sourceforge) has Org-mode version 8.2.10 (release_8.2.10

In order to get the latest version of Org, I referred the org-manual and used the Using Org's git repository method.

I did
 - make autoloads
 - make

And got the following error

make[1]: Entering directory `/home/prasannarajaram/org-mode/doc'
org-version: 8.3.6 (release_8.3.6-1203-g966e0b)
makeinfo --no-split org.texi -o org
make[1]: makeinfo: Command not found
make[1]: *** [org] Error 127
make[1]: Leaving directory `/home/prasannarajaram/org-mode/doc'
make: *** [info] Error 2

And now I'm completely stuck!


texts:
How do I get emacs to automatically format a large text file like section a
to section b. I have tried using notepad++ and a macro, but it just froze my computer

section a

words    wordss
wordsss    wordssss
wordssss    wordsssss
wordsssss    wordssssss

to

section b

words
wordss
wordsss
wordssss
wordsssss
wordssssss


texts: Prompt for user input flexibly with interactive

texts:
I have a function that uses smartparens to replace specified pairs of parentheses.

(defun replace-paren-at-point (paren)
  (interactive "sReplace with: ")
  (if (looking-at "[「『《〈（〔【]")
    (progn
      (set-mark-command nil)
      (forward-sexp)
      (sp-wrap-with-pair paren)
      (sp-unwrap-sexp))
    (if (save-excursion
      (backward-char)
      (looking-at "[」』》〉）〕】]"))
    (progn
      (set-mark-command nil)
      (backward-sexp)
      (sp-wrap-with-pair paren)
      (sp-unwrap-sexp)))
    (message "No parenthesis at point.")))

One issue with the function above is that the user would be prompted to enter the replace string before he/she is reminded that there is "No parenthesis at point." (in cases which the cursor is at the wrong position.)

How do I change this so that an error message appears before the user is prompted for the input?

(defun replace-paren-at-point (paren)
  (interactive)
  (if (looking-at "[「『《〈（〔【]")
      (progn
        (read-string (format "Replace %s with: " (string (char-after))))
        (set-mark-command nil)
        (forward-sexp)
        (sp-wrap-with-pair paren)
        (sp-unwrap-sexp))
    (if (save-excursion
      (backward-char)
      (looking-at "[」』》〉）〕】]"))
    (progn
      (read-string (format "Replace %s with: " (string (char-before))))
      (set-mark-command nil)
      (backward-sexp)
      (sp-wrap-with-pair paren)
      (sp-unwrap-sexp)))
    (message "No parenthesis at point.")))

I try to use read-string for the input prompt but it doesn't work this way.

Seems like read-string has to be defined without the paren argument, but I need the paren variable set to store the value for the replace string. So I am kind of stuck.

Settings:

In case some of you might like to test the code above, here are the settings that should be evaluated in init.el before running the tests.

(package-initialize)
(smartparens-global-mode t)

(sp-pair "「" "」")
(sp-pair "『" "』")
(sp-pair "【" "】")
(sp-pair "《" "》")
(sp-pair "〈" "〉")
(sp-pair "（" "）")
(sp-pair "〔" "〕")


texts: How to stop web-mode from reindenting after yank?

texts:
I'm editing this code:

callFunction({
    x: somearray,
});

Then I want to extract somearray to be a variable with a copy.  I cut somearray and delete the colon, then enter (_ is the cursor):

const x = [..._
callFunction({
    x
});

Then yank, and the super helpful web-mode screws up my code:

const x = [...somearray_
    callFunction({
        x
    });

Then I close the bracket and have to reindent the function call expression.

How to disable this autoindenting after yank?

Disabling electric-indent-local-mode does not help.  Neither does setting electric-indent-inhibit to t.  Searching for "web-mode disable auto-indent" does not lead to a solution.


texts: I want to be zoomed in twice at startup. This is the result of the command SPC z f + +. How can I configure this in my .spacemacs?


texts: Launch an emacsclient instance in a new terminal window

texts:
I am using Sway/wlroots and I decided to switch to using terminal emacs for the forseeable future as there is no transparency in the xwayland version of emacs.

I previously bound emacs to run as a client to connect to my emacs daemon like so emacsclient -c -n -e '(switch-to-buffer nil)' so that upon a sway keystroke it will open a new emacsframe/window.

Basically, how do I do this with emacsclient -nw? my terminal of choice is termite and so i tried to replace the above with this termite -e 'emacsclient -nw' but emacs gets into a locked up state or doesnt launch at all.

Here's the error I get from invoking the previous command from another terminal:

me@laptop ~ % termite -e 'emacsclient -nw'
invalid color string: #

(termite:30425): GLib-WARNING **: 12:46:32.770: GChildWatchSource: Exit status of a child process was requested but ECHILD was received by waitpid(). See the documentation of g_child_watch_source_new() for possible causes.

I thought it may be something to do with the client/server config since launching a new emacs like this: termite -e 'emacs -nw' works as expected, although still spits out the same error above.


texts: Magit reuse same window for different project when switching window

texts: I'm a new user of magit and I'm currently using it in a separate frame with a single window (magit-status). I'd like that to show the git status of the project of the latest visited buffer. Imagine that in another frame I have two windows with two buffers of files of two different projects. I'd like the magit window to show me the git status of the project depending on the current selected buffer.


texts:
What exactly determines what is inserted by
self-insert-command?  If I change the input-method to greek,
p will insert π, but will still be bound to
self-insert-command, though it patently does not insert itself.  C-h k p will say that p is still
bound to self-insert-command and that p was translated to
π, but says nothing more about this translation.
Any hints as to how I might have found the answer to this myself (using EMACS) would be appreciated too.

PS.  I realize the question may not be entirely clear.  To put it differently, what is the simplest way to let a insert foo, while remaining bound to self-insert-command?  Does this have to be done by an input method, or does translation indicate something more general?


texts: Is there any reason why the unexpected character added?

texts:
I added python-shell-interpreter in .emacs file, and god the error as you can see the below.
Why is there \ characters? and how can I solve this?


texts: How can I highlight different keywords according to a suffix?

texts:
I want to highlight foo in foo:: without highlighting foo::<bar>, using font-lock-keywords. This is the result I want:

Initially I tried this:

(defvar example-font-lock-keywords
  `((,(rx (group (1+ word)) "::" (not (any "<"))) 1 font-lock-type-face)))

(define-derived-mode example-mode prog-mode "Example"
  (setq-local font-lock-defaults '(example-font-lock-keywords)))

But that gave the following:

Instead I tried two separate keywords:

(defvar example-font-lock-keywords
  `((,(rx (group (1+ word)) "::") 1 font-lock-type-face)
    ;; This is ignored if I use `default', but other faces work!
    (,(rx (group (1+ word)) "::<") 1 font-lock-variable-name-face t)))

(define-derived-mode example-mode prog-mode "Example"
  (setq-local font-lock-defaults '(example-font-lock-keywords)))

The second pattern is used if I specify font-lock-variable-name-face, but if I use default, the whole pattern is ignored!


texts: how can I copy a quote and paste it onto an emacs file? the shortcuts please?. I have tried to type the text but it is too long to write by hand.


texts: Switching buffer to special mode or any mode?

texts:
I have written some code to create a new buffer, it starts up in fundamental mode, the buffer is to display output from commands.

I am using this to create the buffer

(get-buffer-create "*My Buffer*")

Then I am trying to switch to and change the mode using this.

(display-buffer buffer-name)
(special-mode)

My understanding is that this should switch to the buffer and change the mode which is what actually happens with the added side effect the the original buffer I was using also switches to special-mode so both buffers end up in special-mode.

Am i doing this completely wrong ? how can i create a buffer for command output and change the mode of just that buffer ?

This is the working answer.

(display-buffer buffer-name)
(with-current-buffer buffer-name (special-mode))


texts: Disable `icomplete` with Emacs `find-file`

texts:
I have been experimenting with various completion frameworks in Emacs. I am currently using consult together with icomplete. I like the way things are working for me but I would like to disable icomplete for find-file. I prefer the traditional Emacs find-file.
I have tried this, which did not work:
(define-key icomplete-minibuffer-map [remap find-file] nil)
(define-key icomplete-minibuffer-map [remap write-file] nil)

I based this on the following which did work when I was experimenting using ivy.
(define-key ivy-minibuffer-map [remap counsel-find-file] nil)
(define-key ivy-minibuffer-map [remap counsel-describe-variable] nil)
(define-key ivy-minibuffer-map [remap counsel-describe-function] nil)

Below are my configurations for icomplete:
(require 'icomplete)
(icomplete-mode 1)
(setq icomplete-hide-common-prefix nil)
(setq icomplete-in-buffer t)
(icomplete-vertical-mode)
(bind-key "<tab>" 'icomplete-force-complete minibuffer-local-map)
(bind-key "<return>" 'icomplete-force-complete-and-exit minibuffer-local-map) ; exit with completion
(bind-key "C-j" 'exit-minibuffer minibuffer-local-map) ; force input unconditionally
(bind-key "C-n" 'icomplete-forward-completions minibuffer-local-map)
(bind-key "<down>" 'icomplete-forward-completions minibuffer-local-map)
(bind-key "C-p" 'icomplete-backward-completions minibuffer-local-map)
(bind-key "<up>" 'icomplete-backward-completions minibuffer-local-map)
(bind-key "<C-backspace>" 'icomplete-fido-backward-updir minibuffer-local-map)

I would appreciate some help to configure this.


texts: How can I draft an mu4e message using the contents of an org subtree?

texts: I keep track of my activity in an org-file. The latest status is always under the heading "Current" which I usually just cut and paste into IRC for our weekly meetings. However we are now asked to send the status out ahead of time as an email. I'm trying to work out the best way to create a draft email based on the contents of the an org subtree. Currently I have a babel snippet that will fill the kill-ring but that seems a little hackish. It would be nice to create a complete draft together with address and subject lines.


texts: How to prevent losing indentation when editing JavaScript code within HTML files in Emacs?

texts:
When I edit  JavaScript code which exists in an HTML file, I lose code indentation whenever I press Enter.

first line of code:
    second line of code # Press Enter here

Result after pressing Enter:

first line of code
second line of code

(the indentation is lost)

How to prevent this?
P.S. I am using Emacs 25


texts: I use GNU Emacs 24.3.1 and want to create a new buffer and execute that directly without using terminal and chmod.  Is there a way to change the permission of a saved buffer (file) directly from emacs?


texts: How to check if a list ends with another list?

texts:
Currently I'm using a fairly inefficient way to check if one list uses another list at it's end. Is there a more efficient way to do this?

(defun is-in-list (ls-haystack ls-ends-with)
  (catch 'found
    (while (not (or (eq ls-haystack t) (null ls-haystack)))
      (when (eq ls-haystack ls-ends-with)
        (throw 'found t))
      (setq ls-haystack (cdr ls-haystack)))))


texts: org-mode macro not evaluated inside link?

texts:
If I create a file with {{{input-file}}} as contents and export to HTML, the default macro is correctly evaluated to the filename. However, if I write [[file:{{{input-file}}}.alternative][Alternative version]] the macro is not evaluated. However, if I place the macro on the other part of the link: [[file:manual.html.alternative][{{{input-file}}}.alternative]] then it works!
If I use it in a #+BEGIN_HTML #+END_HTML session instead of in a link the macro isn't evaluated either.

How can I fix this?


texts:
The haskell-mode-hook customizable variable in haskell-mode has a default value of (haskell-indentation-mode interactive-haskell-mode).

Yet, after starting Emacs, its value is nil; the "original value" is given as (haskell-indentation-mode interactive-haskell-mode). This suggests that something else set its value to nil, but I can't figure out what.

Grepping through ~/.emacs.d/elpa doesn't turn up anything that sets haskell-mode-hook to nil, and nothing in my init file does either.

Is anyone else having this issue?


texts: Can orgmk scripts accept multiple arguments?

texts:
I have a directory ~/foo/ containing lots of  .org files. These files are generated by a script and I want to export them to .txt files. I currently use orgmk (specifically org2txt) to do this. My script is

for file in ~/foo/*.org; do
    org2txt ${file}
done

The problem is that this is slow. The documentation for orgmk mentions something about orgmk scripts having the capability to export all org documents under a directory recursively but I can't seem to figure out the commands to do this. Does anyone know how to speed up my script?


texts:
I have emacs 25.1.1 installed on my kubuntu 16.10 with gtk-3.18.9.

Those popup messages that you get with emacs when you exit without saving:

Those are looking very strange and taking up my full screen. (I don't know what they are called and it is making it very hard to isolate the issue)

I am attaching the screenshot:

As you can see the popup takes up my entire screen and looks weird.

Has anyone experienced similar issues, or can at least point me in the right direction so i can find out what is causing the issue.
Thanks.

EDIT

This Seems to be solved when I force geometry restrictions on the windows manager settings.
But that kind of breaks the UI with some interleaving black blocks when I try to maximize.
To solve that I resized manually, instead of maximizing, and forced the window manager to remember size and position.
Pretty lame workaround, but I am happy with it for now.


texts:
A while ago I started using org-mode to track TODOs in various files. Some of them were archived later. I have it set up so that a timestamp is saved with the TODO when it is closed.

Now, I want to review what I've done. I need a list of all of them that are in DONE state, preferably ordered by timestamp.

Is there an easy way to do that?


texts: Org-ref with biblatex - is it feasible or should bibtex be preferred?

texts:
I am contemplating setting up org-ref to use within org mode for drafting scientific texts. However, as  I go through various blogs etc. on the subject, it seems that org-ref is tailored for the bibtex-format. Also, I expect to use helm, which also seems to be targeting bibtex.

I believe I will need the UTF-8 encoding of biblatex, as I will work with sources from different languages. But I am in doubt if I should try to bend around the limitations of the bibtex format because org-mode is tailored for that - or try to make org-ref bend around the biblatex-format instead. Any pros and cons to these approaches would be greatly appreciated.

Thank you for your time!


texts: How can I format the orgmode clocktable in the agenda view?

texts: In the org-mode Agenda view, I can add a clocktable by pressing R.  However, in this table I would like to hide non-contributing files.  In any other dynamic clocktable block, I would specify :fileskip0.  How can I achieve this for the clocktable in the Agenda view?  I would like this formatting by default, i.e. it should show up after just pressing R.


texts: Org agenda - show items that are in any of a list of categories

texts:
I have an org-mode file separated into multiple categories. I know I can create an agenda command that will show only items from one given category, like so:

("a" "Category A items" agenda ""
      ((org-agenda-category-filter-preset
        (quote
         ("+a")))))

and then only items from category A will show up in the custom agenda view.

How can I configure a custom view so it will show items from two specified categories (e.g. "A" and "B")?


texts: How do I remove :width and :height from an image created with create-image?

texts:
I am trying to make jabber.el support images sent from e.g. Conversations.
I download the image using url-retrieve-synchonously and call create-image to get an image which I can then use with insert-image. This works as expected.
I would like, however, to put a :max-width and :max-height on the image. I can add them in the create-image call, but because create-image automatically inserts a :width and a :height image property, the max-values are ignored, as the manual explains:

The :max-width and :max-height keywords are used for scaling if the size of the image of the image exceeds these values. If :width is set it will have precedence over max-width, and if :height is set it will have precedence over max-height

https://www.gnu.org/software/emacs/manual/html_node/elisp/ImageMagick-Images.html#ImageMagick-Images

The documentation says that I can remove image properties with setf, by setting them to nil:

Function: image-property image property
Return the value of property in image. Properties can be set by using setf. Setting a property to nil will remove the property from the image.

https://www.gnu.org/software/emacs/manual/html_node/elisp/Defining-Images.html

This, however, I can't make work - if I setf a property to nil, the key is deleted, but the value isn't, and the image object seems to be messed up.
Example (simplified):
(defun my-fetch-image (url)
  "Retun filename of image downloaded from url"
  (url-copy-file url "/tmp/test.jpg")
  (create-image "/tmp/test.jpg"))

(setq my-image (my-fetch-image "https://koldfront.dk/photo/pics/2018/09/snapshot-22-142810-s.jpg"))

Now, my-image looks like this: (image :type imagemagick :file "/tmp/test.jpg" :scale 1.2019047619047618 :width 288 :height 400)
And when I try to remove width and height:
(setf (image-property my-image :width) nil)
(setf (image-property my-image :height) nil)

I am left with my-image looking like this: (image :type imagemagick :file "/tmp/test.jpg" :scale 1.2019047619047618 288 :height 400)
As you can see :width got removed, but the value 288 is still there, and :height 400 is untouched.
I'm sure I haven't understood how to use setf, but I can't find any examples to go by, and my guesses don't yield the result I'm after, either.


texts: Configure echo time for input of key-sequence prefix keys

texts:
I am writing latex code with AUCTEX. I very often highlight text in bold or italics.

For instance, AUCTEX comes with the command C-c C-f C-e, wich can be used to emphasize text in an active marked region. That is, it would replace the marked text text with \emph{text}.

I used Aquamacs before, where I was able to hold the CMD key, and then press c, then f, then e within some reasonable time (a few seconds). Then the mode line would show that the sequence C-c C-f C-e was entered, and perform the correct command.

I switched to Gnu Emacs on MacOS recently, where this seems not to work as desired anymore. Concretely, it works only if I hold CMD, and then c,f,e extremely quickly (so quickly that I fail 50% of my attempts).

Pressing C-c, then releasing all keys, then C-f, releasing all, then C-e does not work either. Instead, the command bound to C-f is executed, ignoring the prior C-c.

Is this expected behavior of emacs?

The only non-standard keyboard configuration in my .emacs is that I have re-bound the key C-f for convenience as follows:

(global-set-key (kbd "C-f") 'isearch-forward)
(define-key isearch-mode-map "\C-f" 'isearch-repeat-forward)

However, I think this should not matter, provided that I have pressed C-c immediately before C-f?

I have tried to find a way to configure emacs to behave as described above for Aquamacs, but only found key chords, which seems to be something else. Thanks in advance for any help.


texts: What is the hook for Slime Eval minibuffer?

texts:
I have installed Slime and Paredit (M-x package-install paredit) and I have configured it in my ~/.emacs too like this:
(setq inferior-lisp-program "/usr/local/bin/sbcl")
(add-hook 'eval-expression-minibuffer-setup-hook 'enable-paredit-mode)
(add-hook 'slime-repl-mode-hook 'enable-paredit-mode)

Now I know those are very few hooks for Paredit but for this question only these two hooks are required, so in the interest of providing a minimal example of my issue, I present the above code example with two hooks only.
What works fine: If I open eval-expression minibuffer (M-:) and type (, the corresponding ) gets automatically inserted, so Paredit is working fine in eval-expression minibuffer. Similarly, if I open SLIME REPL (M-x slime) and type ( in the REPL, the ) gets automatically insesrted, so Paredit is working fine in SLIME REPL too.
What does not work: If I open Slime eval minibuffer (C-c :) and type (, nothing happens. Paredit isn't working in Slime eval minibuffer.
Is there a hook to add 'enable-paredit-mode to, so that Paredit works fine in SLIME eval minibuffer too?


texts: Define a new babel src (based in python)

texts:
I would like to write pieces of code (I don't need to evaluate it---yet---) of Cadabra see the web page which is based in python. However, it uses the symbol # as part of the code.

How could I define a new babel language (based in python) which treats the # symbol differently?

The most important thing I want to keep is the code highlighting.


texts: Emacs not indenting enum / enum class contents

texts:
I've got a small problem to do with Doom Emacs / Emacs. Enum contents are not indented at all...
Here's what I would like:
enum class RandomEnum
{
    A,
    B,
    C,
    D
};

Here's what I get:
enum class RandomEnum
{
A,
B,
C,
D
};

How can I go about fixing this? I'm sure that there a simple option I can put in my config? Thank you in advance.


texts: Tamil characters show as garbage in shell buffer but ok in files

texts:
When printing non-latin characters like the ones from my mother tongue Tamil in shell, it appears weird(left side window in the image). When I open the file with Tamil characters they are rendered correctly(right side window in the image). I have set the shell locale to utf-8 but the problem still persists.

vanangamudi@kaikuttai:~/home/projects/code/oneoff-experiments/tamil-etymdict-visualizer$ python3 -i generate-dot.py
100% 53753/53753 [00:00<00:00, 163166.71it/s]
Traceback (most recent call last):
  File "generate-dot.py", line 32, in <module>
    write_dot(G, 'graph.dot')
  File "/home/vanangamudi/.local/lib/python3.6/site-packages/networkx/drawing/nx_agraph.py", line 192, in write_dot
    A = to_agraph(G)
  File "/home/vanangamudi/.local/lib/python3.6/site-packages/networkx/drawing/nx_agraph.py", line 151, in to_agraph
    A.add_node(n)
  File "/home/vanangamudi/.local/lib/python3.6/site-packages/pygraphviz/agraph.py", line 309, in add_node
    node = Node(self, nh=nh)
  File "/home/vanangamudi/.local/lib/python3.6/site-packages/pygraphviz/agraph.py", line 1611, in __new__
    n = super(Node, self).__new__(self, gv.agnameof(nh), graph.encoding)
TypeError: decoding to str: need a bytes-like object, NoneType found
>>> G.nodes
NodeView(('à®¨à¯à®°à¯à®à¯à®à¯à®´à®¿|à®¨à¯à®°à¯à®à¯à®à¯à®´à®¿|à®ªà¯', '(n', 'à®¨à¯à®°à¯', 'à®ªà¯à®´à¯', 'à®¤à¯à®³à¯à®¤à¯à®¤à®²à¯', 'à®à¯à®±à¯à®¤à®²à¯', 'fowl', 'à®à¯à®´à®¿', 'à®µà®©à¯à®©à®¤à¯à®²à®¿à®à¯|à®µà®©à¯à®©à®¤à¯à®²à®¿à®à¯|à®ªà¯', '|à®ªà¯', 'à®à®³à®µà®¾à®à®®à¯|à®à®³à®µà®¾à®à®®à¯|à®ªà¯', 'à®à¯', 'à®à¯', 'à®µà®¿', 'à®à¯à®à¯à®¤à¯à®¤à¯à®£à®¿|à®à¯à®à¯à®¤à¯à®¤à¯à®£à®¿|à®ªà¯', 'à®à¯à®©à¯à®±à®¾à®µà®¿', 'à®à®²à¯à®à¯|à®à®²à¯à®à¯

Adding locale information as pointed out by @Rusi,

vanangamudi@kaikuttai:~$ locale
LANG=en_IN
LANGUAGE=en_IN:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
vanangamudi@kaikuttai:~$ locale -a
C
C.UTF-8
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IL
en_IL.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW.utf8
POSIX
ta_IN
ta_IN.utf8
ta_LK
ta_LK.utf8
vanangamudi@kaikuttai:~$


texts: Tell Dired to ignore file-at-point when invoking `ido-find-file` (`C-x C-f` in Ido mode)

texts:
I have discovered that a recent update to some of my emacs packages have caused C-x C-f while on a dired file to perform some operation on the entire file before prompting me for other files/directories.

I know that I need to track down what is causing this issue, but in the meantime, is there a way I can tell dired to ignore the current file-at-point when invoking C-x C-f in a dired buffer?

I frequently invoke this in a dired buffer containing videos around 500mb-1gb, and even with (setq debug-on-quit t) I cannot interrupt the process after hitting C-x C-f, emacs simply spins at 100% cpu for a few minutes until the ido prompt comes up.


texts: org src fontify won't highlight some multiline comments

texts:
The option org-src-fontify-natively doesn't care about some multi-line comments. See:

As shown in the picture above, the html comment isn't highlighted correctly. I tried hacking through the code and I see that html-mode seems use to the function syntax-propertize-rules to propertize the comment, while c-mode seems to use only the syntax-table. I think this is so because the syntax-table can't handle the <!-- kind of comment.
So how can I customize html-mode to make the comments highlighted by org-mode, or customize orb-mode to not ignore them?


texts:
I write my weekly report on Wednesdays. As such I need to see what I've done starting last Wednesday until now. (usually a Wednesday).

I would like to create an Agenda view for this, so I can quickly flick between the weeks, but I cannot find a way of specifying '-7' days.

I tried customizing org-agenad-custom-commands and setting the days to '-7' but that only shows the current day.

At present I generate a report for this:

#+BEGIN: clocktable :tstart "<-6d>" :tend "<now>" :scope agenda-with-archives :narrow 70 :formatter my-org-clocktable-notodo :maxlevel 3 :fileskip0

But I can't find a way to transpose this to an Agenda custom view. Is this possible?

[Edit solution]
As per lawlist's advise in the comment I got it to work.

1) I customized org-agenad-custom-commands, added an agenda view that shows "Number of days in agenda" = 8. I assigned "W" to this agenda view.

 '(org-agenda-custom-commands
   ....
     ("W" "Last 8 days." agenda ""
      ((org-agenda-span 8)
  ...

2) I then defined a function that temporarily defines the variable:

(defun my/agenda-last-week ()
  (interactive)
  (let ((org-agenda-start-day "-7d"))
       (org-agenda nil "W"))
)

I then assign a hotkey to that function.

Now I can view my last week Wednesday to Wednesday, (inc time-report).  I am happy.


texts: org -- preserve white space on export to odt

texts:
i write poetic texts in org mode and i'd like to be able to export them to odt with their horizontal spacing preserved if possible.

it's poetry but not of the traditional kind. text is often heavily indented or spread all over the place. at present i indent text with M-i, which runs tab-to-tab-stop and inserts 8 spaces at at time.

on exporting to odt, all spacing is lost, my lines are left justified. i tried using verse blocks, but it outputs in monospace, and only indents my lines about 2-3 spaces, rather than say the 40 or 50 i have inserted.

ideally i'd like to be able to do anything i might do in a word processor in emacs, and have it preserved on export, if possible.

EDIT: i run emacs 26.1, org-mode 9.3


texts: Can I export a specific table in an org file to csv from the command line?

texts:
I have an org file with multiple tables

$ cat ~/foo.org
#+Title: hello world

* section 1

lorem ipsum

#+TBLNAME: first-table
| i      | want | to    |
| export | this | table |

#+TBLNAME: second-table
| this | table | is        |
| not  | as    | important |

This file is updated regularly. I have a perl script that parses the csv file obtained from issuing M-x org-table-export on first-table. I would like to be able to export first-table to csv from the command line so I don't have to do this manually every time. Is this possible?


texts: When does Emacs treat keymaps as functions?

texts:
Emacs' source code contains multiple instances of using fset with a keymap.

For example, in ediff-util.el:

;; Allow ediff-mode-map to be referenced indirectly
(fset 'ediff-mode-map ediff-mode-map)

Or in esh-mode.el:

(fset eshell-command-prefix (make-sparse-keymap))

Or compile.el:

(defvar compilation-button-map
  (let ((map (make-sparse-keymap)))
    (define-key map [mouse-2] 'compile-goto-error)
    (define-key map [follow-link] 'mouse-face)
    (define-key map "\C-m" 'compile-goto-error)
    map)
  "Keymap for compilation-message buttons.")
(fset 'compilation-button-map compilation-button-map)

I've found examples in third-party elisp projects too, such as projectile. I've looked at the creating keymaps documentation but I can't find anything relevant.

These values cannot even be called as functions:

ELISP> (compilation-button-map)
*** Eval error ***  Invalid function: compilation-button-map

What's the purpose of setting the function slot of a symbol with a keymap? Where is it documented?


texts: Cleanup org-mode export intermediary file

texts:
I use org-mode to export PDF. It does it through LaTeX ; fine.

So I get .pdf file and .tex files.

Only the PDF is interesting to me. Any setting/way that org-mode cleanup the .tex files by itself (or store it in some temporary folder) ?


texts: What are the actual usage of the command `server-edit`?

texts:
According to the documentation of the command server-edit:

  Switch to next server editing buffer; say "Done" for current buffer.
  If a server buffer is current, it is marked "done" and optionally saved.
  The buffer is also killed if it did not exist before the clients asked for it. When all of a client's buffers are marked as "done", the client is notified.

I have seen many sources which mention this command. For example https://emacs.stackexchange.com/a/29461 says emacsclient waits for emacs server. When you do server-edit, the server notifies emacsclient to terminate.

My question is when do I actually need to call this command?  I have the following in my init file.

(require 'server)
(unless (server-running-p) (server-start))

I open the files with emacsclient -n. Do I ever need server-edit command?

Added: Occasionally (for the reasons that I don't know) emacsclient fails to connect to the server and emacsclient -n opens a new instance of emacs and even when I completely exit from emacs and restart emacs, this inconvenient phenomenon continues. I don't know why this happens despite the fact that I always call emacsclient by -n option. Later,  I discovered that by running server-edit this issue can be resolved. Despite the fact that the post linked by YoungFrog claims that I don't need to call server-edit in this situation, it seems that server-edit performs a magic even in this situation. Thus I decided to ask this question to know more about the command server-edit beyond the existing documentation and few posts on this subject in this site, because I felt that I don't completely understand this command.


texts: Emacs frame-inherited-parameters only partially work

texts:
For the value of frame-inherited-parameters, I normally use (top left width height) so that new frames have the same geometry as (selected-frame).

Since switching to Emacs 25.1.1, this no longer works completely.  Only some of the parameter values are copied to the new frame.

I run on MacOS Sierra.  (Therefore my frame-creation-function is the one in term/ns-win.el.)

If I start with a frame like this:

(#<frame  *Minibuf-1* 0x101899c30> (top (+ -568)) (left 1920) (width 177) (height 98))

and press C-x 5 2 (make-frame-command), I end up with frames like this:

(#<frame  *Minibuf-1* 0x108366c38> (top 23) (left 0) (width 80) (height 95))
(#<frame *scratch* 0x101899c30> (top (+ -568)) (left 1920) (width 177) (height 98))

I tried switching the order of frame-inherited-parameters to (width height top left) and ended up with this:

(#<frame  *Minibuf-1* 0x108374618> (width 80) (height 98) (top (+ -568)) (left 1920))
(#<frame *scratch* 0x101899c30> (width 177) (height 98) (top (+ -568)) (left 1920))

All of this happens even though I started emacs with --no-init-file and loaded no libraries since starting it.


texts: org-mode: Prevent org-src from restoring window configuration after editing

texts:
When editing org-src blocks, I sometimes go to other buffers while editing but whenever I close; it restores the window configuration before editing the block which is a minor annoyance when you need to find an existing buffer.

I checked out org-src.el and this is my hack.

        (defun fn/org-src-inhibit-save-window-configuration ()
                 "Disable org-src from saving the window configuration"
                 ;; HACK: This uses an internal variable, might be unstable
                 (setq org-src--saved-temp-window-config nil))

               (add-hook 'org-src-mode-hook #'fn/org-src-inhibit-save-window-configuration)

Sadly, this is touches on a private variable so my question is there a correct way of doing this?


texts: eval-expression on (setq helm-debug t) does not change describe-variable output

texts:
I'm running this version of Emacs:

GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11) of 2019-09-23, modified by Debian

Installed on Ubuntu 19.10 via apt, and not built from source.

I'm trying to set the helm-debug variable so that I can see what Helm is doing to debug a problem (helm-locate is not showing files that exist in a directory whose parent element has .git in it).

So in the past, I could use M-: (mapped to eval-expression) and type in an expression, which I did with this:

(progn (setq helm-debug 'xxx) (message "helm-debug == %S" helm-debug))

And I get what I expect to see in the message area of:

"helm-debug == xxx"

And, I go back in and run M-: again to check on the value like this:

helm-debug

I see xxx as the resulting value.  All good so far.

But then, when I type C-h v (mapped to describe-variable), and then type in helm-debug, and I see this:

helm-debug is a variable defined in ‘helm.el’.
Its value is nil

Documentation:
If non-‘nil’, write log message to ‘helm-debug-buffer’.
Default is ‘nil’, which disables writing log messages because the
size of ‘helm-debug-buffer’ grows quickly.

Why is it reporting nil, when I have clearly set it inside the eval-expression call?

For reference, the defvar for this variable resides in ~/.emacs.d/elpa/helm-core-20191013.626/helm.el in my setup (meaning Helm mode has been recently upgraded)

(defvar helm-debug nil
  "If non-`nil', write log message to `helm-debug-buffer'.
Default is `nil', which disables writing log messages because the
size of `helm-debug-buffer' grows quickly.")


texts: evil-mode does not seem to bind keys in the minibuffer.  Is there a way to use evil in the minibuffer?  It's hard to use Vim-style keybindings everywhere BUT the minibuffer.


texts: How do I jump to revision history of a file if many files have changed during the commit?

texts:
I have following problem. In a unfamiliar project I need to inspect the history of changes in a given file. So I open the file and run M-x magit-log-buffer-file. That opens a log buffer listing commits in which that file was modified. Now I move to the commit I want to inspect and press RET to show the revision buffer.

In that buffer point is placed at the beginning of the buffer, but I would like if Magit allowed jumping right to the diff of that one file I am interested in directly from the log buffer.

Currently, once in the revision buffer, I have search for the file in the list of files that changed, press j, then press C-l C-l, and finally the diff for the interesting file appears at the top of revision buffer.


texts: gnus starting with an error message, even from emacs -Q - very strange

texts:
The error message is "Warning: Opening nntp server on news...failed: >>> (error news/nntp Name or service not known); Server nntp+news previously determined to be down; not retrying;"

The strange thing is, that I have two computers with very similar OS (arch linux), sharing the same emacs config, and on one machine it works perfectly, and on the other I get the error above. The really strange thing is, that on the first (good) machine there is no error when I start gnus form emacs -Q while on the second (bad) machine, gnus is complaining (the same error message) even if it is was started from an emacs with no config loaded (i.e. emacs -Q).

Does anyone have any idea what could be wrong??? How I should even start fixing it. I tried already emacs -Q. Reinstalling emacs also -- didn't work.

I was asking around #emacs on freenode, but since I switched to ERC recently, and was trying to fix this error, I always disconnected from IRC before seeing any answers :( (stupid me).

EDIT: a bit of additional information: when I run gnus with the config activated, it does query .authinfo.pgp and asks for my GPG password... the address of the configured mail server appears among the messages, but eventually I end up with the same error message. :(


texts:
in org-mode when I type <s TAB it turns into:

#+BEGIN_SRC

#+END_SRC

How can I configure it so it creates it in lowercase, e.g.:

#+begin_src

#+end_src

Syntactically it's the same, right?


texts: Why does emacs not apply some config settings when editing tex files?

texts:
I'm facing a rather peculiar situation where my emacs settings seem to be lost every time that I open a .tex file. That's doesn't happen when I'm editing .el or .py files. Heres some examples with normal setting editing .el file

And here when I try to edit .tex file

Any ideas what have gone wrong here?

Thanks!
Original post posted here initially.


texts: AUCTeX automatic extraction: beyond regexps

texts:
In my custom style support file, I would like to add custom code to parse an environment. That is, my LaTeX code looks like this

\begin{foobar}
  some complex stuff
\end{foobar}

and I don't want to capture some complex stuff in a regexp, it's too complex for that, but I do want to analyze it. I can't use generic entries to parse some complex stuff because they would have a ridiculous amount of false positives outside the foobar environment. I can capture the beginning of the environment in an entry in TeX-auto-regexp-list, but what am I supposed to put in my function?

(defun TeX-parse-foobar-environment (match)
  (let ((name (TeX-match-buffer match))
        (start ???) (end ???))
    (parse-foobar-region start end)))
(TeX-auto-add-regexp '("\\\\begin{\\(foobar\\)}" 1 TeX-parse-foobar-environment))

I don't see anything about this in the manual. Should I call LaTeX-find-matching-begin then LaTeX-find-matching-end to determine where the environment starts and ends? How does this generalize to examples other than environments? I could find out empirically where the point is, but can I count on that being the same in all versions of AUCTeX?


texts:
While trying to use highlight-symbol in coffee mode (especially, cjsx), it interprets Something and <Something as two different symbols, while I expect < to be not part of a symbol.

Tried to trace the problem, and found that this is probably due to thighatpt symbol receives incorrect data from  syntax table for coffee mode. How to fix coffee mode's syntax table to allow highlighting all symbols correctly?

(but maybe I am totally wrong with the assessment, and highlight-symbol somehow adds < to the symbol by itself. But at least in C mode it handles "less than" correctly)

GNU Emacs 24.3.1, Coffee mode 0.6.2, highlight-symbol 20160102.1209


texts: dired function i wrote passes only current marked folder at point, can i send all marked folder?

texts:
i have this simple function i wrote (tbh i have zero coding skills.i gathered stuff from the web :)):

(defun z/dired-media-filebot (file)
(interactive (list (expand-file-name (dired-file-name-at-point))))
(start-process "filebot" nil "filebot" file))

problem is it always send only the current marked folder at point while i want to send all marked folders. How does one send all marked folders?


texts: How to insert text and activate the mark in the same function

texts:
I am trying to write a function where I insert some text, and then activate the mark at the end of the function. I have several use-cases where I would like to use this.
I cannot figure out how do make it work. I have the following expression which I am using to test the behavior:
(progn
  (set-mark-command nil)
  (save-excursion
    (insert "hi"))
  (forward-line 2)
  (activate-mark))

Evaluating this expression does not activate the mark; however, if I comment out the save-excursion part which inserts some text, the mark is activated. Why isn't the mark being activated, and what can I do to make the expression work as expected?


texts: Is calling elisp functions expensive (time-wise)?

texts:
Reading code in the wild, I seem to see less of the "many small functions doing one thing each" pattern in emacs lisp. Might this be due to calling functions being expensive (like in Python), so that you rather inline as much code as possible?

Is calling elisp functions expensive?


texts:
I got the impression from the manual that
    | a |   |
    | b |   |
    #+TBLFM: $2=if($-1==a, 1, 0)

should produce "1" in the first row and "0" in the second.  But
instead I get
    | a |             1 |
    | b | b = a ? 1 : 0 |
    #+TBLFM: $2=if($-1==a, 1, 0)

What am I misunderstanding here?


texts: (interactive "r") can't be used directly after Emacs startup

texts:
The proper way to deal with region is using (interactive "r"). But in my case, (interactive "r") always complaints:

The mark is not set now, so there is no region

after fresh Emacs startup. This problem occurred if we never invoke mark region before. After invoking mark region, problem solved. Am I missing something?
Take this MWE:
(defun try-region (begin end)
  (interactive "r")
  (if (use-region-p)
      (message "Region Active")
    (message "Region not active")))

It always complaints "The mark is not set now, so there is no region" if I never invoked mark region before. So I need to modify my code to use (buffer-substring-no-properties (region-beginning) (region-end) to deal with region instead.
Related: How to use (interactive “r”) function in this situation?


texts: Check box counter function applied to todo items in org-mode

texts: In org-mode, is there a function to perform the [x/y] counter function on a list of "todo" items, similar to that feature which exists for checkbox?  (That is, to automatically count the number of items that are in a non-done state.)


texts: Org-mode logtable Latex export: How to change the "Continued on next page" text (to German)?

texts:
I am writing a German document in Org-mode and exporting to Latex. To use the longtable environment, I use:

#+ATTR_LATEX: :environment longtable
|-|-|-|

In this way, a long table is exported as expected. For the table cut at any page, the text "Continued on next page" is added at the end of the page (exported by Org mode). Adding German babel does not change the message exported by Org-mode. My question is: How to make Org mode conform to the document language? Otherwise, how can I manually override (change) the message in Org mode export?

What I have:

#+Language: de
#+LATEX_HEADER: \usepackage[ngerman]{babel}
#+LATEX_HEADER: \usepackage{german,longtable}

I appreciate your help!


texts: Accessing the global value of a locally altered variable

texts:
Is it possible to access the global value of a variable that has been
changed locally?

(setq foo 2)

(let ((foo 3))
  ;; can I access the original value here?
  )


texts:
I asked this questions on Github
I have just switched form auto-complete mode to company mode, but the error message

  Warning (emacs): Unable to activate package jedi'. Required packageauto-complete->1.4' is unavailable

pops out. Do I have to install "auto-complete" (even I don't use it) to activate jedi?


texts: Customize org babel execution command in C

texts:
I have the following C code:

#include <stdio.h>
#include <math.h>
int main(){
   printf("Square = %d", pow(4,2));
   return 0;
}

Now if I run this in the shell. I would first compile with: gcc -lm file.c -o a.out and then run with ./a.out.

If I run the above code in org mode within #+BEGIN_SRC C and #+END_SRC, I would get an error "undefined reference to pow".

Reason is that the compiling command has no link -lm.  Is there a way to add this to org-babel execution of C code?


texts:
Is it possible to obtain a package which supports Intellisense PHP in emacs?
As I've set up cedet now and I would like to add autocomplete for PHP code in emacs.

I know you can do it in vim.


texts:
I would like to edit e-mail messages without the header (!) in message mode.  If I open a file in message mode and it does not have the usual e-mail headers, then M-q filling does not work as I discovered in this question.  In that question I learned that the header separator can be customized, but what if there is no header and no header separator at all?
I understand that sending the mail will not work without this header, but I send the mail on a different route. Actually, this is part of trying to use Emacs as the external editor for MailMate which works fine, except that I have not found a mode in which I can edit e-mail with font-locking for quote depth etc.  Probably this should be a minor mode for editing e-mail which does not exist yet.  notmuch-mode, mu4e-mode and org-msg all seem to be based on message mode and behave the same wrt. the header.
So is it possible to use message mode without a header?


texts: how to enable pager like behavior in a shell buffer?

texts:
I can't believe I'm saying this, but one thing that is "nice" about windows cmd is the pager. When I do man grep in a bash shell inside emacs buffer it spits out the entire content at once. Is there a way/mode to have emacs buffer to halt outputting text and ask if I want to see more.

Running GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30 on "ON NOOO! But can't run anything else" --> Windows 10.

here is what I have for running a bash shell buffer.

  ;;git bash
  (defun git-bash () (interactive)
    (let ((explicit-shell-file-name "d:/Installed_progs/Git/bin/bash.exe"))
      (call-interactively 'shell)
      (setq explicit-bash.exe-args '("--noediting" "--login" "-i"))))

To make it more concrete, here is what I see if I run man grep

The command output filled the entire screen and keeps going until the end of the text.

Here is what I see when I run the same command in win cmd

Pages shows only what fits in one screen and waits. Is there any way to have that type of behavior in a bash shell in emacs?


texts: Why does filling in AUCTeX behave so badly?

texts:
I'm using AUCTeX to edit LaTeX files. The behavior of the fill command M-q (also C-c C-q C-p, LaTeX-fill-paragraph) is very erratic. For example, if I have the following text:

test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$

filling it yields:

test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$
test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$

which is clearly not ideal. However, I have auto-fill-mode enabled, and if I take the text from the beginning and manually add a space at the end of the line, the auto-fill does this:

test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$
test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$ test $1 + 1 = 2$
test $1 + 1 = 2$

which is infinitely better. Is there a way I can configure the fill-command to work correctly? I'm using Emacs 24.5.1 on Windows and AUCTeX 11.88.9.


texts: I would like to make modeline display all information not in one line but in two - for example first for cursor info, buffer, file, git and flycheck, and on second line - modes info (major and minor modes). Is it doable somehow? I googled bindings.el and emacs C source code and wasn't lucky to find where this line number for modeline could be possible changed, does anybody can help with this? Thx.


texts:
I'm having a real hard time getting the paredit slurp key to work. I know it is bound to C-), and by describing the paredit-slurp-forward-sexp it confirms that.

When I fire up M-x describe-key and try to type C-) (that is, press and hold control, press shift, and press )) the describer only registers the ) part and trys to execute paredit-close-round.

I know slurp works because if I M-x paredit-slurp-forward-sexp it works fine.

Am I not using this hotkey right? It seems like it should be working fine.


texts: paredit-forward-up won't cross line boundary

texts:
(a b (c |d) e f)

C-M-n works as I would expect, producing this:

(a b (c d)| e f)

But if I break the line after the (c d) like so…

(a b (c |d)
     e f)

The same C-M-n does absolutely nothing. Interestingly, the command works as expected if I insert an end of line space just after (c d). Given that the whole point of paredit is to edit syntax trees rather than text, I don't see how the insertion of a newline should have any impact on the behavior of paredit-forward-up.

What am I missing?


texts: Is there a way to customize the widths of the columns in ibuffer?  Specifically, I want to widen the Name column to be able to read more of the buffer names before they get truncated.  I have tried Buffer-menu-name-width, but it seems that the Buffer-menu variables are not used by ibuffer.  I have also tried M-x customize-group RET ibuffer RET but nothing seemed relevant.


texts: Why are code blocks and code literals displaying with large face in markdown

texts:
In markdown mode, all of the fenced code blocks and inline code literal strings are displaying with this very large font. The size is large, and also I'm pretty sure it isn't the same font as the default surrounding text (which is Classic Console).

This is Emacs 25.3 on a Mac, using the standalone app
(the one from https://emacsformacosx.com/).

My .emacs file is here.


texts: Add TeX input method shortcuts to C-x 8 map

texts:
I really like the TeX input method. It makes typing symbols a breeze, since years of LaTeX have worked the symbols into my muscle memory.

However, input methods have their quirks (like not working with key-chords), and I'd rather not leave it on all the time.

I also like the iso-transl C-x 8 map. It's handy because it's always there and very unintrusive. However, it has a rather small vocabulary of symbols, and I can never remember their keys.

Is there any way I can either

bind a command to C-x 8 \ that will prompt for a name from the TeX input method and insert it, even if the TeX input method is not active
Temporarily enable the TeX IM for one character only.


texts: xpm-images: `:color-symbols` not working?

texts:
I'm trying to load an xpm image file looking like the following:

/* XPM */
static char *_0[] = {
/* columns rows colors chars-per-pixel */
"15 16 3 1 ",
"w c white",
"b c black",
"  c None",
/* pixels */
"               ",
"               ",
"               ",
"     wwwbbb    ",
"    wwwwbbbb   ",
"   wwwwwbbbbb  ",
"   wwwwwbbbbb  ",
"  wwwwwwbbbbbb ",
"  wwwwwwbbbbbb ",
"   wwwwbbbbbb  ",
"   wwwbbbbbbb  ",
"    wbbbbbbb   ",
"     bbbbbb    ",
"               ",
"               ",
"               "
};

Here's the elisp I use to load it:

(insert-image (create-image "path/to/file.xpm"
                            'xpm
                            nil
                            :color-symbols '(("black" . "blue"))))

However, when I run that sexp, I get the file as-is, without the blacks substituted for blues. What am I doing wrong here?


texts: log keystrokes with timestamp and other metadata?

texts:
If I evaluate this form:

(open-dribble-file "/home/joe/keys.log")

then type something, Emacs saves what I type to the keys.log file:

<return>hellow<backspace> keyloggi<down-mouse-5><mouse-5>ng world<down><down>
^E^X<C-down-mouse-4><C-mouse-4>^E^X^F^N^N<return>yes<return>

Let's stop that nonsense immediately.

(open-dribble-file nil)

What I would like is a similar function that would save each keypress together with a timestamp and some other metadata.

State of the art

There is command-log-mode, which can be adjusted to log every interactive command by setting

(setq clm/log-command-exceptions* '(nil))

It stores the time of the command on a :time text property, and that can be given a milisecond resolution by appending .%3N to the relevant format-time-string command.  The only thing it doesn't do yet is actually save the text that I type.  Instead, it records the first letter, and the number of letters typed:

t      self-insert-command [47 times]

I'm guessing it will not be too hard to collect and save the entered text.  I guess I'll report back when I figure out the text storage, unless someone beats me to it.  :-)

(I won't need the exact text for basic analytics, for which what I have here is sufficient -- but it could be useful to save it for broader life-logging purposes.)

related

In the mean time, I noticed that there is a logkeys package in Ubuntu.  It does something similar to what I want, but I actually only want to track Emacs keypresses, because anything else is not likely to be productive work.  Here is some logkeys output as a sample:

2015-06-05 23:02:15+0100 > 3;<E-e1><E-e1>3<#+10>b3;ȁ
2015-06-05 23:02:22+0100 >
2015-06-05 23:02:22+0100 >
2015-06-05 23:02:22+0100 > 7'''u܂ccȁ3<#+7><CpsLk>3;q

(It is typing garbage because it doesn't know my keyboard layout, and only creates a timestamp when I press RET.)

note

When I first posted this question, I thought it would make sense to approach it via Emacs C, with a patch to record_char from keyboard.c, which is where the dribble file is written.  But given that there's a nearly complete solution in Lisp, that was almost certainly the wrong intuition.  I've mostly revised that out but I thought I should record the initial idea, even though it wasn't that apt.


texts:
I know there is already a post asking this, but the author is using Emacs 26.3 and for what I've read starting with Emacs 27 there is now proper support for ligatures, but they should be enabled in some way (?)

I'm on Emacs 28 now, and I'd like to know the steps to obtain proper ligatures for my font.

Btw I use Arch


texts:
I have an init file called settings.org (using #+BEGIN_SRC #+END_SRC blocks for elisp code)

I would like to generate settings.el from it, so that I can load it inside init.el easily.

How would I accomplish this?


texts: How to create a new buffer with ivy-switch-buffer that shares a substring with an existing buffer?

texts: Suppose I have a file opened called "analysis-evaluation.tex" and I'd like to create a new buffer called "eval".  When using Ido, I would press C-j to create a new buffer rather than switching to an existing buffer; does such a functionality exist with ivy-switch-buffer too?