texts: How to configure org-html-export-as-html to export drawer to html?

texts:
So, right now, I am trying to build my website with Nikola static site generator. There is a nice orgmode plugin for it where I can write my content in orgmode and Nikola can then render it to html (exporting org into html). It works nice but there is one problem that I am facing right now where it cannot really render text within a drawer.

For example, this org source file:

will only output:

As you can see, the #+RESULTS: somehow completely makes the RESULTS drawer not been rendered at all. Even the TEST drawer came up weird (I put the TEST drawer just to show how a plain drawer is being rendered into html).

So, I want the RESULTS of the org-babel to be rendered into a box (so that it can somehow show that this is the output of the previous source file). Something like this:

To do that, I investigated a bit on how the plugin works. Inside an init.el (file for the orgmode plugin), these are the functions that are related to this question.

;; Override the html export function to use pygments
(defun org-html-src-block (src-block contents info)
  "Transcode a SRC-BLOCK element from Org to HTML.
CONTENTS holds the contents of the item.  INFO is a plist holding
contextual information."
  (if (org-export-read-attribute :attr_html src-block :textarea)
      (org-html--textarea-block src-block)
    (let ((lang (org-element-property :language src-block))
          (code (org-element-property :value src-block))
          (code-html (org-html-format-code src-block info)))
      (if nikola-use-pygments
          (pygmentize (downcase lang) (org-html-decode-plain-text code))
        code-html))))

;; Export function used by Nikola.
(defun nikola-html-export (infile outfile)
  "Export the body only of the input file and write it to
specified location."
  (with-current-buffer (find-file infile)
    (org-macro-replace-all nikola-macro-templates)
    (org-html-export-as-html nil nil t t)
    (write-file outfile nil)))

Then, within a python file, emacs is called with above init.el file (I believe this is when the org file is exported into html):

command = [
    'emacs', '--batch',
    '-l', join(dirname(abspath(__file__)), 'init.el'),
    '--eval', '(nikola-html-export "{0}" "{1}")'.format(
        abspath(source), abspath(dest))
]

subprocess.check_call(command)

So, I think, what I need to do is override the html export function related to the drawer. The problem is, I am still novice in emacs-lisp and I don't know what function should I override etc. I've tried to override org-html-drawer by doing something like this (just to check weather this function is being called or not during the export process)

(defun org-html-drawer (drawer contents info)
  (mkdir "/Users/hilman_dayo/Desktop/testdir/")
  )

with no success at all (the testdir is not created in my Desktop which means this code is not being called during the export process).

My questions is, how can I make it so that the RESULTS drawer can be rendered into a box? Or at least, are there any keywords or things that I can google to dig deeper into this topic?


texts:
I have a pytest I am running with:
C-c C-c

In the line I'd like to debug, I have added:
from pytest import set_trace; set_trace()

However, while my test runs, it drops the *compilation* buffer into a read only PDB session:
-*- mode: compilation; default-directory: "~/wrk/mydat/" -*-
Compilation started at Mon Mar 22 14:10:38

py.test --log-level\=DEBUG /home/user/wrk/mydat/my_test.py\:\:test_that_I_succeed
Test session starts (platform: linux, Python 3.7.3, pytest 5.4.3, pytest-sugar 0.9.4)
rootdir: /home/user/wrk/mydat, inifile: pytest.ini
plugins: asyncio-0.14.0, sugar-0.9.4
collecting ...
>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/user/wrk/mydat/mypath/mymod.py(227)__aexit__()
-> self.engine.dispose()
(Pdb)

The self.engine.dispose() is where I plan to debug.  But when I start typing in the (Pdb) prompt, I get
'[letter] is not defined'

for any typing I do.
The (Pdb) prompt is read-only, as far as I can tell.  I suspect this is maybe caused by IO capturing turned off
Anyhow, how can I set trace and enter a pdb session from a C-c C-c "run single test" call in elpy?


texts: org-mode export headline without contents

texts:
I'm exporting org files to PDF. In some cases, I would like to include a heading without any of its children or contents.

There are currently two ways of hiding (part of) a headline. One is to use :ARCHIVE:, which behaves exactly as I want for the purposes of export, but also makes the tree archived in sparse trees, searches, etc. The second is to use :noexport: or exclude_tags, but this hides the entry completely.

Is it possible to customize which tags behave like :ARCHIVE: for the purposes of export only, maybe with a variable?

If not, would something like modifying this solution [1] work. I can see that I wouldn't need arch:t, and the lambda function would be different, but I'm not familiar enough with org-mode's API to know which function to use instead. How would I have to modify it?

[1] How to export headlines, including subheadings, without other contents in org-mode?


texts: Why is my elisp function not accepting a second parameter?

texts:
@Juancho gave a great answer to a question I asked a few days ago. My question is about how to modify his elisp code.

I have an org table

#+begin_src emacs-lisp :results none
  (defun jj/factor (code)
      (cond ((eq (string-to-char code) ?P) .05)
            (t 0)))

  (defun jj/factorlist (codelist)
    (mapcar 'jj/factor codelist))

  (defun jj/dotproduct (a b)
    (apply '+ (mapcar* '* (jj/factorlist a) (mapcar 'string-to-number b))))
#+end_src

|        |        |   P1 |   P2 |   Q1 |   Q2 |   E1 |   E2 |    F |
|--------+--------+------+------+------+------+------+------+------|
|        | Totals |   20 |   40 |   50 |   45 |  100 |  100 |  200 |
|--------+--------+------+------+------+------+------+------+------|
| John   |   0.10 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |
| Paul   |   1.00 |   10 |   10 |   10 |   10 |   10 |   10 |   10 |
| George |  10.00 |  100 |  100 |  100 |  100 |  100 |  100 |  100 |
| Ringo  | 100.00 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 |
#+TBLFM: @3$2..@>$2='(jj/dotproduct (list @1$3..@1$>) (list $3..$>));%.2f

The function jj/dotproduct takes the entries in the columns marked P, multiplies them by .05, and adds them up in the column marked Totals.

Now, I'd like to modify jj/dotproduct so it takes another input x where x any letter. This would allow me to sum the columns marked Q, E, and F separately. I've tried modifying it as follows

#+begin_src emacs-lisp :results none
  (defun jj/factor (code x)
      (cond ((eq (string-to-char code) (string-to-char x)) .05)
            (t 0)))

  (defun jj/factorlist (codelist x)
    (mapcar 'jj/factor codelist x))

  (defun jj/dotproduct (x a b)
    (apply '+ (mapcar* '* (jj/factorlist a x) (mapcar 'string-to-number b))))
#+end_src

|        |        |   P1 |   P2 |   Q1 |   Q2 |   E1 |   E2 |    F |
|--------+--------+------+------+------+------+------+------+------|
|        | Totals |   20 |   40 |   50 |   45 |  100 |  100 |  200 |
|--------+--------+------+------+------+------+------+------+------|
| John   |   0.00 |    1 |    1 |    1 |    1 |    1 |    1 |    1 |
| Paul   |   0.00 |   10 |   10 |   10 |   10 |   10 |   10 |   10 |
| George |   0.00 |  100 |  100 |  100 |  100 |  100 |  100 |  100 |
| Ringo  |   0.00 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 | 1000 |
#+TBLFM: @3$2..@>$2='(jj/dotproduct "P" (list @1$3..@1$>) (list $3..$>));%.2f

This, however, gives the wrong output. Any ideas what I've done wrong and how I can fix my code?


texts: AUCTeX on Windows: LaTeX found no preview images

texts:
I realize questions along this line have been answered before, but I couldn't an answer that worked for me.  My setup:

Windows 7
emacs 25.3 - the GNU windows build (not Xwindows, not cygwin)
cygwin used for unix toolchain in Emacs, e.g. grep (not MinGW)
MikTex 2.9 for LaTeX - fresh install from scratch yesterday (long story)

I have a short .tex file, with a few math expressions which AUCTeX preview should generate images for.  From Emacs, I can compile the file (i.e. run pdflatex) no problem.  When I make previews for buffer, latex runs fine, but then I get:

Transcript written on _region_.log.

TeX Output exited as expected with code 1 at Mon Jun  4 06:46:49
LaTeX: LaTeX found no preview images

And no previews appear.

So - any thoughts, or advice for how to diagnose this?


texts: Text background is a bit lighter than emacs' background color

texts:
If you can't see the screenshot in full resolution, click here

So you may or may not see that the background color "behind" the text (including the linum) is lighter (#20292D) than the window's background color (#20282C).

Please note that the background color set in my theme is the latter, #20282C, as seen here.

My question is, what is causing the text to have a lighter background color and how can I make it to be the same as the window's color?


texts: Dired. Is it possible to change color of file name when file was changed?

texts:
Windows 10, Emacs 25.1

I use Dired+ as file manager. All files names color are yellow.

If some file was changed not later than one hour ago then :

this file name change it color, e.g blue
after one hour it return to it old color - yellow

It's possible in Emacs?


texts:
Is there a way to define a capture template for org-projectile/capture (SPC a o p)? The default capture template creates a todo in root and I'd rather have it under Tasks (/Project Name/Tasks/<the task>)

Also another one for project specific meeting notes would be great.


texts: How to prevent some new buffers from splitting the window?

texts:
Is it possible to have new buffers created by a spesific command (vc-diff for example) use the same viewable area as the current buffer?

Currently it creates a split window, which I need to manually close after using the buffer and deleting it.


texts: Continuously redirect debugging information (e.g. *Messages*) to file

texts:
My Emacs configuration (Emacs 27, Doom-Emacs config with lots of user-specific tweaks, running on MacOS) sometimes hangs at seemingly random times, and the kill -SIGUSR2 <emacs PID> has no effect. Debugging this would be a lot easier if there was a way to continuously redirect *Messages* and other debugging information to a log file, so I could identify what Emacs was doing (or trying to do) when it crashed.
Is there a way to continuously redirect/copy everything posted to the *Messages* and similar buffers to a file? Alternatively, is there a way to launch Emacs in "verbose" mode from the command line? Most of what I've found suggests running Emacs through gdb, but that's tricky (though not impossible) to set up on MacOS.


texts: Changing font size of a region or single characters

texts: Is it possible in Emacs to change the font size of a single character or region, without affecting the whole Emacs window?


texts:
Every time I open Magit status buffer I need to press ?.
How can I make it so it opens automatically?

doing this didn't help

(add-hook 'magit-mode 'magit-dispatch-popup)


texts: Can I acquire root privilege to edit a system file without restarting emacs with `sudo`?

texts:
Sometimes, when I am running an emacs process (either  started withemacs -nw or emacsclient -nw with an emacs server daemon), I would like to edit a system file. Can I acquire root privilege without restarting emacs with sudo?

If I am using an emacs process started with emacsclient -nw, do I need to restart the emacs server process with sudo, i.e. sudo emacs --daemon?

Without restarting emacs server with sudo, is it possible to start emacs client with sudo? I can't find a solution:

$ ps aux | grep emacs
t         3235  0.0  0.3 398732 24904 ?        Ssl  Mar31   0:00 emacs --daemon

$ sudo emacsclient -nw /etc/profile
[sudo] password for t:
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".
emacsclient: No socket or alternate editor.  Please use:

    --socket-name
    --server-file      (or environment variable EMACS_SERVER_FILE)
    --alternate-editor (or environment variable ALTERNATE_EDITOR)


texts: How to disable auto-compile after saving ~/.emacs file?

texts:
My system: Debian GNU/Linux (Jessie)

My Emacs: GNU Emacs 24.1, installed from Debian package

I found that when I saved ~/.emacs for any change, Emacs started to compile files into .elc under ~/.emacs.d/elpa directory.  It didn't take much time but it's annoying.

I had all my Emacs setting and package in a Git repository.  Is that the cause of the auto-compiling behavior?

How to disable it?


texts: Call a function every time a specific piece of text is inserted

texts:
I'm wondering whether there is an already existing mechanism of executing a function every time a specific piece of text is inserted.

For example, I would like to call company-bibtex whenever I enter \cite{ in a latex-mode-buffer.

Of course I can always just rebind { and then check if the text before point is \cite, but I wondered whether there was already something existing that I could hook into for something like that?


texts: Do not show created timestamps in agenda

texts:
I'm using a package that automatically adds a CREATED property with a current time stamp to every item I create. I would like these timestamps not to appear in my agenda. To demonstrate, here is a minimal example. The whole init.el reads:

(global-set-key "\C-ca" 'org-agenda)
(setq org-agenda-files (list "~/org.org"))

File ~\org.org contains:

* TODO Created Today
  :PROPERTIES:
  :CREATED:  <2019-11-05 Tue 11:00>
  :END:
* TODO Scheduled Today
  SCHEDULED: <2019-11-05 Tue>
* TODO Deadline Tomorrow
  DEADLINE: <2019-11-06 Wed>

With that, pressing C-c a a (i.e., conjuring up the default agenda) gives me this:

I like the fact that it tells me what's scheduled when and when which deadlines are, but having this huge time table to show me when I created which items is just unnecessary. Is there a way of getting rid of that?

The documentation of the agenda says that it shows "the entries for each day". It is very unspecific what it considers to be "an entry for a day". Is there a way of controlling this? Also note that I did not switch the agenda into "logbook mode". In fact, in my example, it shows the exact same thing in "logbook mode". However, since the CREATED timestamp is not in the LOGBOOK drawer, it should not be affected by logbook mode anyways, right?


texts: forward-char and prettify-symbols-mode interaction

texts:
I'm using prettify-symbols-mode with this basic setting:

(setq prettify-symbols-alist
      '(("lambda" . ?λ)))

When I'm before the lambda, and e.g. the point is 50, and I press
C-f, the point will increase by 6 to 56.

However, in the same situation (call-interactively 'forward-char) will advance the point only by 1.  What am I missing here? I'd like (call-interactively 'forward-char) to advance the point by 6.


texts: How can I have the lighter of a minor mode be colored /propertized)?

texts: How can I colorize/propertize the lighter of a minor mode in the mode line?


texts:
Emacs Manual says that C-M-l is to Scroll heuristically to bring useful information onto the screen (reposition-window).
When I type C-M-l in Ubuntu, Emacs 27.1, the OS is automatically locking the screen.
Which alternative keybinding could I use to call the reposition-window command?


texts: Is there a simple way to have default text pre-populate in the comment buffer when commiting code with magit?


texts: How to operate the undo-redo tree in spacemacs?

texts:
I just hit SPC a u and it opened the undo-redo tree. Now I can't operate it.
I go on the tree, press enter and nothing happen. I can't close it!
 Either :q is unrecognized. How do I operate this ?


texts: What does emphasized dired file permission mean?

texts:
For example, below we see a website directory, and that the write permission for group is emphasized (in orange):

No emphasis when the group of the file doesn't have write permission, for example, the parent directory ..

What does the emphasis indicate? Does it indicate insecure configuration? a warning? or something else? Should I worry?


texts: How to place all auto-save files in a directory

texts:
I would like to put all of my auto-save files into a directory, say something like

~/.emacs-saves

Based on what's written in the wiki, I came up with this:

(setq backup-by-copying t      ; don't clobber symlinks
      backup-directory-alist '(("." . "~/.emacs-saves"))    ; don't litter my fs tree
      delete-old-versions t
      kept-new-versions 6
      kept-old-versions 2
      version-control t)       ; use versioned backups
(setq auto-save-file-name-transforms
      `((".*" "~/.emacs-saves" t)))

Now my autosaves are going in my home directory, which is actually kind of an improvement, but not what I want.

Can someone explain to me what I'm doing wrong, and how to correct it?  I'm also very interested in what this syntax means (It's an example from the wiki entry):

(setq auto-save-file-name-transforms
      `((".*" ,temporary-file-directory t)))

What's with the comma in ,temporary-file-directory?


texts: Debugging server related warning message

texts:
I've been seeing this issue for some time now, but I don't know how to debug it.

I start up a emacs instance, using say

emacs foo.tex &

Then I run C-c C-c to compile.
A new window pops open, and I see the following:

Warning (server): Unable to start the Emacs server.
There is an existing Emacs server, named "server".
To start the server in this Emacs process, stop the existing
server or call `M-x server-force-delete' to forcibly disconnect it.

This is annoying. I'd appreciate help tracking down the problem.

This seems to be related to the emacs server. The only place I have the emacs server mentioned, as far as I can see, is in my .emacs, which has

;; Enable Synctex
(setq TeX-source-correlate-mode t)
(setq TeX-source-correlate-start-server t)

Is this causing a problem, and if so, why? I do not have an emacs server running, as far as I can see.


texts:
How can I set things up so the buffer being used to run an inferior shell will be autosaved periodically to a file?

The file to save in could be named "shell-2018-01-22".

I thought this would be trivial but it seems the autosave concept is deeply tied into the visiting file concepts which of course, doesn't apply for the buffer being used by the inferior shell.

The reason is because twice this past month my emacs had died.  Usually its not a big deal but in these last two cases, it was frustrating enough to prompt me into trying to figure out a solution.


texts:
I have been writing lots of text in Org-mode and would like to lint the text before exporting it. I have flycheck and proselint installed.
Is it possible to get proselint to run in org-mode?
I tried using M-x flycheck-select-checker and then proselint
I get the error:

`org-mode' not supported

I suppose proselint only supports markdown or txt files. I am a beginner with writing my own functions in elisp. Is there a way I can get proselint running inside org-mode?


texts: Specific file for pooling tags in org folder

texts:
I'm trying to organize tags among many org files.

I have a few tags defined in init.el through org-tag-alist and other tags placed at top of files.

I would like to set a tags.org file for tags in folder project (in order to tag any entry regardless which .org file from project is concerned).

Setting #+TAGS: at top of file make org-mode searching init.el tags but doesn't load tags from tags.org.

Any idea?


texts:
Emacs Lisp has support for lists (naturally), association lists, and property lists, vectors, and hash tables. Does it have support for directed acyclic graphs (DAGs)?

I have not found a DAG API in the native Emacs, and searching the package repository has not uncovered anything either. Does Emacs have a DAG API, or has one not been written yet?


texts: How set default number (1) in the interactive custom function

texts:
here custom function:

(defun increment-number-at-point(number)
  (interactive "nInput increment number:")
  (skip-chars-backward "0-9")
  (or (looking-at "[0-9]+")
      (error "No number at point"))
  (replace-match (number-to-string (+ number (string-to-number (match-string 0))))))

Nice it's work fine.
But I want to set default value (1) when user not input any number.


texts:
I'm studying for finals and want to use org-drill . Org-drill sees my flash cards and places UUIDs in properties drawers (see the code snippet below). However, when I call org-drill-cram, it says it doesn't see anything:

  I did not find any pending drill items.

Here is a screenshot showing what org-drill reports:

Below is an example of one of my cards.

*** What is the key syntax for proc freq? :drill:
:PROPERTIES:
:ID:       34885705-f0ae-431f-baf6-50f8c5689cb1
:END:

**** the answer

#+BEGIN_SRC SAS
  proc freq data=data;
      tables vars / options;
      output out=out_data;
  run;
#+END_SRC

How do I get org-drill and org-drill-cram to actually test me on my flash cards? It looks like they are detected (since properties are added). What am I missing? I'm using Org 8.2.10 from MELPA and Emacs 24.4.


texts: How to open multiple files in multiple windows at startup

texts:
In earlier versions of emacs one could use emacs -nw file1 file2 file3 and see three files (and no buffer list) at startup. For recent versions this no longer works. Is it possible to add some code to .emacs to fix this regression?
It looks like the limit of 2 is hardcoded in startup.el. One also needs 3, 4...


texts: how to I UN-evaluate .emacs init file without restarting emacs?

texts:
I added a custom auto-insert to my init file and reloaded the .emacs file with

M-x load-file
~/.emacs

And then later I revised the auto-insert instruction and reloaded.  Now I get strange behaviour because I have evaluated two similar auto-inserts.  How can I have only the most recent evaluation of my .emacs init file?

In a bit more detail.

I added

(eval-after-load 'autoinsert
  '(define-auto-insert '("\.c\'" . "C \"script\" hack")
  '( "stuff" \n )))

reloaded .emacs file

(eval-after-load 'autoinsert
  '(define-auto-insert '("\.c\'" . "C \"script\" hack")
  '( "other stuff" \n )))

reloaded .emacs file

then I had problems.


texts: The profiler-start command has options for cpu, mem, and cpu+mem. Is there a way to profile a command by elapsed time?


texts: Why doesn't Emacs accept keyboard input in timers?

texts:
I've managed to write a timer that reliably causes keyboard input not to be accepted until I press Ctrl-G.

The issue is, I don't know what causes the timer to lock up, what the stack frame is when it's locked up, or how to unlock it.

(signal 'quit) resolves the issue but this isn't a reasonable fix.
Using gdb doesn't point to a function which is blocking input.
toggle-debug-on-quit doesn't give a useful stack trace.

In Python I can press Ctrl-C to get a stack trace of the code being executed. Why doesn't Emacs let me interrupt my timer's code with C-g?


texts:
The rigidity to which emacs adheres to its layout is annoying at times. How can i get a layout like this when I shift to the particular modes?

+------------------+-----------+
|                  |           |
|                  | *compiler*|
|      .cpp file   +-----------+
|                  | *eshell*  |
|                  |           |
|                  +-----------+
|                  |           |
+------------------+ *dired*   |
|      shell       |           |
|                  |           |
+------------------+-----------+
      C++ Mode

+---------------+--------------+           +------+---------------------------+
|               |              |           |      |                           |
|               |              |           |      |                           |
|               | Slime REPL   |           |*dire |    .py file               |
|               |              |           |  -d* |                           |
|    .lisp file +--------------+           |      |                           |
|               | Slime Events |           |      |                           |
|               |              |           |------+---------------------------+
|---------------+--------------+           |*buff |                           |
|          Shell               |           | -er  | Python Shell              |
|                              |           |-list*|                           |
|------------------------------|           +------+---------------------------+
      Common Lisp Mode                              Python Mode

I've tried using purpose-mode (package "window-purpose") without adding hooks, I manually saved my layout and reloaded with purpose-load-window-layout and gave it my myLayout.window-config. But that don't bring back a shell or compiler or SLIME or nothing except the Dired window and the main file in the major mode. So I reload all over again. Any suggestions on how to do this better.

how can I get window purpose to give me this window layout consistently for common lisp programming.

It should also give me this config in c++ mode

my basic mode - purposes configuration:

(defun aviik-add-purposes ()
  (add-to-list 'purpose-user-mode-purposes '(c++-mode . cpp))
  (add-to-list 'purpose-user-mode-purposes '(python-mode . python))
  (add-to-list 'purpose-user-mode-purposes '(lisp-mode . lisp))
  (add-to-list 'purpose-user-mode-purposes '(shell-mode . shells))
  (add-to-list 'purpose-user-mode-purposes '(slime-repl-mode . slime))
  (add-to-list 'purpose-user-mode-purposes '(help-mode . help))
  (add-to-list 'purpose-user-mode-purposes '(info-mode . help))
  (add-to-list 'purpose-user-mode-purposes '(emacs-lisp-mode . elisp)))

And then I have window-purpose settings :

(use-package window-purpose
  :ensure t
  :commands (purpose-mode)
  :config
  (progn
    (purpose-x-golden-ratio-setup)
    (purpose-x-kill-setup)
    (aviik-add-purposes)
    (add-to-list 'global-mode-string '(:eval (purpose--modeline-string)))
    (purpose-compile-user-configuration))
  :bind
   (("s-x p" . purpose-mode)
          ("s-x a" . purpose-switch-buffer-with-p)
          ("s-x d" . purpose-toggle-window-purpose-dedicated)
          ("s-x w" . purpose-toggle-window-buffer-dedicated)
          ("s-x s" . purpose-save-window-layout)
          ("s-x l" . purpose-load-window-layout)
          ("s-x z" . purpose-reset-window-layout))
)


texts: Emacs26 on Windows 7, Why is Setting Mark shortcut toggling language instead?

texts: I just installed Emacs26 on my Windows 7 64-bit computer and whenever I try setting a mark ctrl + <space>, it toggles the Windows language settings instead. M-x set-mark-command works as expected though.


texts:
I cannot type a Greek accented vowel in emacs.

In Xorg, I use the el keyboard layout and in other applications (e.g. Firefox) the normal way to type an accented vowel (e.g. ά) is, first the colon character (:) then the vowel α.
When I do the same (: α) in emacs, I get neither α nor ά. I get no output at all.

I have used M-x menu-set-font to make sure my font does support such characters. I don't know how to debug this problem.

GNU Emacs 25.1.1 (x86_64-unknown-openbsd, GTK+ Version 3.22.11) |
X.Org X Server 1.18.4 |
Release Date: 2016-07-19 |
X Protocol Version 11, Revision 0 |
Build Operating System: OpenBSD 6.1 amd64


texts: “terminal is not fully functional” over ssh in a *shell* buffer

texts:
I'm using the shell (M-x shell) to connect to a remote host via SSH. After launching some command line tools (mostly psql, the postgresql command line interface, but man would be the same for example), the shell is giving me the following warning:

WARNING: terminal is not fully functional
-  (press RETURN)

As far as I know, this looks like a pager problem. Changing the pager to cat in my .emacs file:

(setenv "PAGER" "/bin/cat")

helped me get rid of those messages, but only for local commands (and I do not mind using cat as a pager). As I only have one local instance of Emacs, is there a way to use a different pager on the remote host? Or any other way to get rid of the warning messages, if possible without switching to ansi-term? If it's of any help, I'm using GNU Emacs 24.3.1.


texts: Convert bitmap vector keys into a human readable string

texts:
If you run (kbd "M-r") you'll get back the bit vector [134217842]. But what if I want to go the other way around: start with [134217842] and return M-r. How does one do that?

I Have looked at the edmacro-parse-keys function inside edmacro.el, and that describes how to go from the string to the bitvector. However this code is a bit tough to read, let alone figure out how to reverse.

For context, you'll see this in LAP disassembly, and I would like to provide the human-readable format instead, (although I suppose that's not strictly necessary).

One other slight complication: although understanding how to do this in Elisp would be great, the decompiler right now is in Python. So if it is easier to describe that way, this would be helpful.


texts: comint: show the original input when match-cycling through history

texts:
Currently, I have bindings for comint-previous-matching-input-from-input and comint-next-matching-input-from-input.

My problem is this. Suppose I am on a prompt with some text (say, "x = ") and issue previous - the latest command shows up (e.g. "x = 10"). But now, when I issue next, nothing happens. I understand - no input is matched, so the latest command stays. Instead, I want the original text to show up ("x = ") (if you are familiar with zsh input completion, this is it).

How can I do this?


texts: Create a branch off of the merge-base of two branches in magit

texts:
At work, if I am working on a bug fix, I sometimes want to base my hotfix branch off of the merge-base of our master and develop branches, because the branch will eventually be merged into both of these branches, and sometimes, they (master and develop) will have diverged. From the command line I would do this with:

git checkout `git merge-base master develop`
git checkout -b my-hotfix-branch

What I am wondering is, is there a straightforward way to do this in magit?

I don't fully understand some of the options in the branching popup, even after reading the documentation, and I am hesitant to experiment with my work repository. I know how to do the second command (checkout a new branch once I have checked out the merge-base, but I am not sure how to check out the merge-base itself).

Worse comes to worse, I assume everything will go fine if I run the command from the magit-run-popup, but I am curious if there is a better way. Thank you!


texts: How to define interactive function that will not auto-complete?

texts:
If I do this:
(defun foo-bar-baz ()
  (interactive)
  (message "foo-bar-baz"))

And then M-x foo-baz RET (note no "bar") then completion matches foo-bar-baz and it executes.
Is there a way to define a function so as to prevent completion from considering it?


texts: How to strike-through or un-strike-through a region or line in org-mode?

texts:
Given a region or line of text in org-mode I would like to call a function that either strikes-through the region or removes the strike-through of the region or line if strike-through is already present.

C-c C-x C-f + does not seem to do the trick, as for proper strike-through display in my org-mode version, each line must be wrapped with "+" individually.

How can I define a function that works like comment-or-uncomment-region for strike-through in org-mode?


texts: alist error when value created using (concat string1 string2)

texts:
I'm really confused with what's happening here.

In my config for backups I've the line (setq backup-directory-alist '(("" . "~/.emacs.d/backup/per-save"))) and I've a defined a variable in my init.el like so:

(defvar user-home-directory (concat (getenv "HOME") "/"))
(setq user-emacs-directory (concat user-home-directory ".emacs.d/"))

I tried to redefine backup-directory-alist like so:

(setq backup-directory-alist '(("" . ((concat user-emacs-directory "backup/per-save/")))))

But I'm getting the wrong type argument stringp everytime I try to save the file. What's going on! What am I doing wrong with alist value data.


texts: Dealing with "Warning: assignment to free variable" when certain libraries can be missing by design

texts:
Byte compilation of my mode:
(defun dict-setup-expansions ()
  "Add `dict-mode' specific expansions."
  (set (make-local-variable 'er/try-expand-list) (list #'dict-mark-article)))

gives warning:
Warning: assignment to free variable `er/try-expand-list'

This is normal situation because er/try-expand-list is defined in external library expand-region.
My mode register extension to expand-region library but it is ok to run my mode without expand-region mode.
I think that proper way to deal with warning is to add declaration:
(defvar er/try-expand-list)

defvar docs say:
The `defvar' form also declares the variable as "special",
so that it is always dynamically bound even if `lexical-binding' is t.

I use -*- lexical-binding: t -*-. Does that mean that without defvar variable er/try-expand-list be in lexical scope and I have real bug?


texts: Using a different major mode in comments

texts:
A programming language that I use lets me format comments and docstrings using markdown, and then export my code and documentation to PDF.

When I edit the file, though, Emacs doesn't see comments as markdown; just as plain boring text.

I would like to access the full power of markdown-mode when I edit comments, without giving up the nice features of my programming languages' major mode outside of comments. How can I do this?

(A similar problem would include using a Javadoc specific mode map and syntax highlighting inside of Javadoc comments, for example)


texts: Finding last word inside hashes in a document, using Emacs Evil Mode

texts:
I've a document I'm editing, were I want to search for the next occurrence of the last word that appears within a pair of hashes. Some examples would be:

 #word#, #x(anotherWord)#, #y(x(yetAnotherWord))#

I want to ignore the surrounding functions and brackets.

I'm new to Vim key bindings and am not clear on how to do it either in evil or holy modes.


texts: How to activate whitespace-mode for a cc-mode buffer from .dir-locals.el?

texts:
I'd like to enable whitespace-mode from a .dir-locals.el file such that when I open a file managed by cc-mode, I will see trailing spaces highlighted with the whitespace face.

I think I'm close. This is what I have in my .dir-locals.el, but its not quite enough.

((cc-mode . ((whitespace-style . (face trailing))
             (whitespace-active-style . (face trailing))))

But if I M-xwhitespace-toggle-options and choose f, then the trailing whitespace is highlighted.


texts: How to make org-mode support to open org-mode link in properties drawer?

texts:
Here is the Org-mode buffer example which has a properties drawer.

** Kelvin Hu
  :PROPERTIES:
  :BLOG:     http://kelvinh.github.io/
  :END:


texts: How do I yank and cycle backward through earlier killed text?

texts: Emacs has this very handy kill-ring that can be cycled through after yanking, by pressing M-y repeatedly. Is there a way to switch the cycling direction? So I don not need to cycle through all when I actually want to get to the very first one?


texts: ESS Syntax Highlighting for Negative Numbers?

texts: I know how to set coloring for an interactive R session in ESS + Emacs for all numbers.  Is there a way to drill down further and set different colors for negative numbers?


texts: How can I add some line numbers of emacs into pdf created by latex

texts:
Is it possible to print Line Number in emacs to the Latex pdf for lines that I prefer?
If it is easy, I want to use those numbers with M-g M-g (goto-line command)
Edit: To make the question more clear, lets say
L56: Some text....
L57: Some text....
L58: \printLineNumberOfEmacsIntoPDF
L59: \begin{equation}
L60:     Some Equation
L61: \end{equation}

I am looking for a command like this such that it will print 'Line 58' into the pdf created by Latex.


texts: emacsclient -c stopped working, server running, emacs works

texts:
I am encountering a very strange problem. I worked with emacsclient for a while but suddenly, after starting an emacsclient frame the frame disappears shortly after start when interacting with it. It seems that the process keeps running but the frame is just gone.

The server is running, restarting it don't change anything. I am using emacs now again, because it works fine. I also can start emacsclient -t to run in terminal, which is also working fine. Just using emacsclient -c stopped working as expected.

I also tried emacsclient -e "(make-frame)". This worked once, now stopped working with error message *ERROR*: Unknown terminal type.

I am using Ubuntu 18.04 with standard bash. Emacs is 27.0.50, built from source, GTK+ Version 3.22.30.

Maybe someone knows what I am doing wrong or can give me a hint how to debug this.


texts: How to get customizations added to `ess-mode-hook` to run in Aquamacs ESS

texts:
In Aquamacs 3.3, ESS 16.04, I can't get customizations added to ess-mode-hook to run. Here's a simple example.

(defun my-ess-hook ()
  (setq ess-default-style 'DEFAULT)
  (setq ess-indent-level 2))
(add-hook 'ess-mode-hook 'my-ess-hook)

I put this code in Preferences.el, saved the file, quit Aquamacs, relaunched Aquamacs, opened an R file, and no joy - the indent level was not changed. What am I doing wrong?


texts: Emac in Terminal opens in unusable green background

texts:
[OS X 10.11, MacPorts Emacs 24.5, OS X Terminal, lots of stuff in emacs and shell init files]

I almost always use Emacs.app (GUI). Sometimes I want to open Emacs in a terminal. When I open Emacs from a terminal I get a bright green background that in combination with my usual theme is unusable -- I can't even read the messages at the bottom of the window.

I have tried this with various Terminal Profiles but they all do the same. I have tried emacs -bg while but that doesn't work either.

How do I control the background color of Emacs opened from the terminal?


texts: How to find all active bindings which act on a region?

texts:
As explained https://emacs.stackexchange.com/a/733/ C-h b lists all bindings available in a buffer.

Is there a way to list all bindings which act on a region? For example C-w (kill-region) is one of them

(defun kill-region (beg end &optional region)
........................................


texts: Using cheatsheet.el and adding cheats to it

texts:
I have downloaded the package cheatsheel.el from Melpa for use in Emacs 25.5.1 in Ubuntu.
However, I seem unable to add cheats to it because only the command                (cheatsheet-show) is available and works while the commands cheatsheet-add and cheatsheet-get do not show up at all. Any help on using this package would be appreciated. Thanks in advance.


texts:
While I used to use the TPU EDT emulation, this seems to be deprecated in the latest GNU emacs. Is this still available anywhere?

As a result I'm presently using the edt emulation directly. This works for most keys, except that the space bar isn't working. Is there a way to restore this while using the edt emulation? I'm running emacs on a Mac.


texts: "symbol's function definition is void: -dotimes" Error

texts:
I'm trying to use the following function (extracted from the amazing emacs-prelude configuration)

(defun prelude-duplicate-current-line-or-region (arg)
  "Duplicates the current line or region ARG times.
If there's no region, the current line will be duplicated.  However, if
there's a region, all lines that region covers will be duplicated."
  (interactive "p")
  (pcase-let* ((origin (point))
               (`(,beg . ,end) (prelude-get-positions-of-line-or-region))
               (region (buffer-substring-no-properties beg end)))
    (-dotimes arg
      (lambda (n)
        (goto-char end)
        (newline)
        (insert region)
        (setq end (point))))
    (goto-char (+ origin (* (length region) arg) arg))))

But I get the following error:

symbol's function definition is void: -dotimes

Any ideas why do I get this error? Do I have a library missing or something?


texts: How to customize org-agenda-* faces in .emacs file?

texts:
I am trying to customize org-agenda-* faces such as org-agenda-date,
org-agenda-date-today, and org-agenda-date-weekend in my .emacs file. Normally,
I install the use-package package to lazily load each package to reduce emacs init time. At first, in the code below I call set-face-attribute to customize those faces, but it is in vain.

(use-package org-mode
    :config
    (set-face-attribute 'org-agenda-date-today nil
                        :foreground "#FFFFEF"
                        :background "#3F3F3F"
                        :bold t))

Next, I found that other emacs users invoke the defface function to customize those faces instead, and it does also work in my setup.

(use-package zenburn-theme
    :ensure t
    :config
    (load-theme 'zenburn t)
    (defface org-agenda-date
       '((t (:foreground "#BFEBBF"
             :background "#3F3F3F"
             :bold nil)))
    "Face used in agenda for weekdays."
      :group 'org-faces))

Edit: Lawlist's comment reminds me of using M-x customize-face to customize these faces and it works.

Between the three approaches defface, set-face-attribute, and customize-face, which one is the best way to customize faces? In case you have an alternative way to customize them, please share your approach here.

Thanks,


texts: How to determine the current text scaling?

texts:
When I type C-x C-+ the height of the default face in the current buffer is increased. However, when I revert the buffer, the text scaling is reset to normal. I would like to keep the same scaling after reverting the buffer.

Is there a way to determine the amount of scaling in the current buffer, in order to save it and restore the same scaling when a buffer is reverted?


texts:
(setq ali '())
>>> nil
(cl-incf (alist-get 'a ali 0))
>>> ((a . 1))
(setf (alist-get 'b ali) 0)
>>> ((b . 0) (a . 1))
(cl-incf (alist-get 'b ali 0))
>>> 1

As you can see, cl-incf returns different kinds of values in the second and the fourth expressions.
cl-incf per documentation is supposed to return "the incremented value of PLACE", however as we can see with the key 'a it returns the whole ali structure. If we macroexpand it a few times, it's clear what's happening:
(let*
    ((p
      (if
          (and nil
               (not
                (eq nil 'eq)))
          (assoc 'a ali nil)
        (assq 'a ali)))
     (v
      (+
       (if p
           (cdr p)
         0)
       1)))
  (if p
      (setcdr p v)
    (setq ali
          (cons
           (setq p
                 (cons 'a v))
           ali))))

The last setq is applied to ali, so it returns the new value of ali.
It seems to be a bug in the alist generalized variable definition.
Am I correct? If so, how to report it?
If not, what's the idiomatic way to work around it, preferably not calling alist-get two times?


texts: windmove: write a function to move two times (e.g. down and right)?

texts:
I'm using the windmove package to move my cursor between windows. In addition, I want to define a function to move twice, e.g. down first and right second. The following function only do the "down" move but not the "right" move. Any suggestions?

(defun windmove-diagonal ()
    (interactive)
    (windmove-down)
    (windmove-right)
)


texts: When to sharp-quote a lambda expression?

texts:
Q: When, if ever, is it useful to sharp-quote a lambda, and when, if ever, must we not sharp-quote a lambda?

People use lambdas in three ways:

plain: (lambda (x) x)
quoted: '(lambda (x) x)
sharp-quoted: #'(lambda (x) x)

This SO thread discusses the three types, this SO thread explains why not to quote (NB: not sharp-quote) lambdas, and this SO thread also discusses the distinctions between quoting and sharp-quoting.

Now, the manual node on anonymous functions and the docstring for lambda note that lambdas are self-quoting:

  A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is
  self-quoting; the result of evaluating the lambda expression is the
  expression itself.  The lambda expression may then be treated as a
  function...

So, it appears that (lambda (x) x) and #'(lambda (x) x) are equivalent, but '(lambda (x) x) is not (most importantly, when byte-compiling).

It looks like one would rarely want to quote a lambda, but it's unclear to me when, if ever, we should, or should not, sharp-quote:

Is sharp-quoting a lambda simply a stylistic choice, or are there circumstances in which sharp-quoting is actually useful?
Are there circumstances in which we must not sharp-quote a lambda, that is, when doing so would alter the meaning of the code?


texts: hiding and showing all blocks with one binding

texts:
I want to combine the commands hs-hide-all and hs-show-all.

It would be great if I'd have a function that detects the "status" of all blocks. If there are blocks that aren't hidden, the function should hide them, thus all blocks are hidden.
Applying it when all blocks are hidden, the function ought to show all of them.


texts: Opening a Remote Shell Renames Buffer Open to \*shell\*

texts:
here is a simple elisp program for opening a shell in a named buffer:

(defun shell-make (dir buffer-name)
  (let* ((default-directory dir)
         (buffer (get-buffer-create buffer-name)))
  (set-buffer buffer)
  (shell buffer)))

Here is an example of a command that will open in shell in a buffer named shell~

 (defun shell~ () (interactive) (shell-make "~" "shell~"))

It works fine.  M-x shell~  will open a new shell and the buffer name will be shell~.

Now using Tramp to get a local shell named shell-root:

(defun shell-root ()
  (interactive)
  (shell-make "/sudo::/root" "shell-root")`)

That also works.

Now using Tramp to get a remote shell:

(defun shell-remote ()
  (interactive)
  (shell-make "/ssh:user@domain.com:~" "shell-remote"))

This does not work.  The buffer will always be called *shell*.   Even worse, once one shell is named *shell*  all other remote shell calls simply open that buffer, and do not make new shells.

How can this be code be adjusted so that Tramp does not rename the buffer for remote shells to *shell*?

Here are the messages from a failure, shell-root above which opened a buffer named *shell*:

GNU Emacs 26.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.13) of 2019-12-10
Tramp: Opening connection for user@host.com using ssh...
Tramp: Sending command ‘exec ssh -l user  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none host.com’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘host.com’
Tramp: Opening connection for user@host.com using ssh...done
Tramp: Opening connection for user@host.com using ssh...
Tramp: Sending command ‘exec ssh -q -l user  -o ControlMaster=auto -o ControlPath='tramp.%C' -o ControlPersist=no -e none host.com’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘host.com’
Tramp: Opening connection for user@host.com using ssh...done


texts:
I'm using a dark theme to write Clojure, with rainbow parentheses etc.
I like this theme and its syntax colouring, and I don't want to change it or mess it up.
BUT ... I'm currently sitting outside in a place with lots of sunlight and I can't read the screen.
What I'd like to be able to do is quickly, and temporarily (just in this session) invert the main colours : switch to a white background and black text (the other syntax colours I'm happy to keep the same)
Is there a way to do this?


texts: sage-shell-mode repeat the input in the output

texts:
I wanted to use sagemath straight in emacs instead of having a terminal open. I tried to use a shell (or eshell for that matters) in emacs and launch sage there, but every time I input a command, the ouput repeats this and then displays the result. Something like:

┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.1, Release Date: 2017-12-07                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
sage: 2+2
sage: 2+2
4
sage:

After a quick search on how to use sage in emacs, I found the neat sage-shell-mode. Installed it using MELPA (as recommended), but the problem is the same. I have no idea where it comes from and how to fix it.

N.B. when I use emacs shell (or eshell), I have no problem. When I use sage in a terminal, I have no problem. Only when I use sage in emacs (in a shell or using sage-shell-mode) I got the issue.

I'm using Emacs 25.2.2 and SageMath 8.1


texts: How to view exported mail file with Gnus properly?

texts:
Gnus has the feature to export the mail to file with "O m" (gnus-summary-save-article-mail) command.  I've been often using this feature to save the mail to the file for future reference.

However, I could not find the proper way to open the saved mail file with Gnus, so that we can properly extract the attached files, display with proper faces (colors), etc.

I appreciate if anyone knows and let me know how to do it.

regards,


texts:
I am unable to install magit with package.el. While other packages install correctly, magit (v 90150116) currently gives me:

Debugger entered--Lisp error: (wrong-number-of-arguments
#[(ad--addoit-function package-list requirements) "\304\305 !\306   !\210

    \304#\211)\207" [ad-return-value requirements ad--addoit-function
package-list nil reverse print] 5] 4)
ad-Advice-package-compute-transaction(#[770
"\211\203I\211@\211@\211A@\262\302\211\2038esc magit (90150116)
"control Git from Emacs" ((cl-lib (0 3)) (git-commit-mode (0 14 0))
(git-rebase-mode (0 14 0))) tar "melpa-stable" nil ((:keywords "vc"
"tools")) nil]))   apply(ad-Advice-package-compute-transaction #[770
"\211\203I\211@\211@\211A@\262\302\211\20383)) (git-commit-mode
(0 14 0)) (git-rebase-mode (0 14 0))) tar "melpa-stable" nil
((:keywords "vc" "tools")) nil])))
package-compute-transaction(([cl-struct-package-desc magit (90150116)
"control Git from Emacs" ((cl-lib (0 3)) (git-commit-mode (0 14 0))
(git-rebase-mode (0 14 0))) tar "melpa-stable" nil ((:keywords "vc"
"tools")) nil]) ((cl-lib (0 3)) (git-commit-mode (0 14 0))
(git-rebase-mode (0 14 0))) ([cl-struct-package-desc magit (90150116)
"control Git from Emacs" ((cl-lib (0 3)) (git-commit-mode (0 14 0))
(git-rebase-mode (0 14 0))) tar "melpa-stable" nil ((:keywords "vc"
"tools")) nil]))   #[770
"\211\203I\211@\211@\211A@\262\302\211\2038/24.4/lisp/emacs-lisp/package.elc"
. 39624)](nil ((magit)) nil)
ad-Advice-package-compute-transaction(#[770
"\211\203I\211@\211@\211A@\262\302\211\20384\211A\262\242\211\303H>\204\272

I'm using http://stable.melpa.org and emacs 24.4.1, compiled locally.


texts: How do I set the fringe colors to whatever is the background color?

texts:
I am using a distraction-free mode that uses giant fringes to center the buffer called bzg-big-fringe-mode.

Problem is, these fringes often have a different color than the background which give an ugly visual effect (see the picture at the end).

I do not have a problem with fixing this manually, by setting the fringe color to the background color, like so:

(set-face-attribute 'fringe nil :background "#3F3F3F" :foreground "#3F3F3F")

Problem is, when changing themes the fringe colors remain gray, even though that does not make sense for the new theme.

Is there a way to programmatically set the fringe to the background color?

I guess I need two things:

The ability to set the fringe background color to the default
background color.
A function that is hooked to changing themes
and that does 1. above.

I think I should be able to do 2) even though I have no emacs skills, but how do I do 1)?

Or is this a bad idea for some reason? If so, what would a better approach look like?


texts: yasnippet won't replace default values (placeholders) in org-table caption

texts:
I'm using yasnippet to create a template for org-mode tables. This works fine, and allows me to create default values (placeholders) for the column headers. The default values are highlighted by default and get replaced when I enter actual names for the columns.

# -*- mode: snippet -*-
# name: orgtable
# key: orgtable
# --
| ${1:column A}      | ${2:column B}      |
|--------------------+--------------------|
| $0                 |                    |
|--------------------+--------------------|

However, when I try to do the same thing for the org-mode caption line, it doesn't work. The default values do NOT get overwritten.

# -*- mode: snippet -*-
# name: orgtable
# key: orgtable
# --
#+CAPTION: ${1:Title}
| ${2:column A}      | ${3:column B}      |
|--------------------+--------------------|
| $0                 |                    |
|--------------------+--------------------|

How do I get the second version of the snippet to respect the default values, i.e. overwrite them when I type?


texts: How to get the real line number of a selection?

texts:
I am trying to figure out the line numbers referring to the actual selection. What I came up with is something like this
(let ((start (line-number-at-pos (region-beginning)))
      (end (line-number-at-pos (region-end))))
  (ignore))

But if I select whole lines then (region-end) returns the position of the beginning of the next line instead of the end of the currently selected line.
If I am selecting anything but complete lines then the (region-end) function works correctly. Is there a way to get the real line number or to figure out whether the user is selecting complete lines or not?
I would like to differentiate between these those:
Selecting lines

Expected output 1 and 2.
Selecting blocks

Expected output 1 and 3.


texts:
The description of defface in (info "(elisp) Defining Faces")
says that the name of a face should not end in -face. But
most faces declared in font-lock.el do use the suffix -face.
How does this fit together?


texts: Ivy: sort candidates by most recently used

texts:
I'm coming from Helm to Ivy just to try it out, and one thing I miss greatly from Helm is how the default candidate when hitting M-x is whatever the last command was.

Is there some way to sort Ivy's results by most-recently used?


texts: I need help for the Emacs in GUI in Macos catalina since it is opening only in terminal

texts: I have macOS Catalina. I just installed emacs 27. version but it's only in the terminal not in a different display of its own (i think that is called GUI). Please suggest for GUI.


texts:
I need to make a function that will choose an org mode file if emacs was called with no arguments, and basically go about its way otherwise.

So far I have

  (defun personaltodo ()
   (if (= 1 (length command-line-args))
      (find-file "~/personalorg")
   )
  )

This works only if I'm calling emacs plainly. If I call it like

emacs testfile

Or through another program like Mutt, it doesn't open it and I'm forced to switch with

C-x b

Anyone have any ideas?


texts: Add bottom margin to minibuffer / echo area?

texts:
When running emacs maximized on my new screen, a black shadow at the bottom, that for normal viewing angles is just a few pixels wide, interfers with the readability of the minibuffer / echo area.

Is it possible to add some margin at the bottom of the minibuffer / echo area? This would act as a workaround to the problem.

Source of the Issue (cannot be solved)

My new (glossy) LCD/LED TV shows a pronounced black shadow at the bottom of the screen whose change as I look from a lower or higher angle -- it vanishes when I look vertically at the bottom edge -- makes it look as if there is a visible border behind the plane of the pixels. My guess is that this is caused by a significant (looks like some mm) distance between pixel plane and backlight plane. The same effect appears for my office screens but is much weaker there as they are smaller and matte, so I never noticed it until explicitly looking for it.

From this I conclude that it is (1) an unavoidable property of all (non-IPS?) LCD screens (2) normally not noticable unless abusing a TV as large computer monitor. Therefore I consider the hardware-issue unsolvable and need a workaround.


texts: How to set the keybinding for addind the hash symbol (#) in spacemacs with MacOS and an UK keyboard

texts:
I'm using spacemacs on a Mac OS X laptop with a UK keyboard and I want to be able to use Alt-3 (M-3) to insert the hash symbol #. I tried to add this function that I found on this SO answer without any luck.

;; Allow hash to be entered
(global-set-key (kbd "M-3") (lambda () (interactive) (insert "#")))

Do I have to unset this key combination before trying to set it? Is there anything else in the spacemacs configuration that always overwrite my user defined configuration with the "Change the current window with window 3"?
I'm used to add the hash symbol using that combination and I feel uncomfortable using anything else.


texts: How to highlight text based on regions--not regular expresions

texts:
When font-lock-mode is enabled I cannot get custom faces to stick with add-text-properties or set-text-properties. I've looked through libraries like hi-lock.el, but they all seem to be regexp based. I want to highlight by points; (point) to (point-max) for example.

How can I highlight text (similar to hi-lock) by regions?


texts: How can I get org mode to cooperate with htmlize?

texts:
I've been maintaining my personal webpage by using the htmlize feature with org-mode. Basically, I have a directory ~/webpage with many subdirectories containing .org files. I then run a script that finds each .org file under ~/webpage and runs htmlize on the file. The script is:

(add-to-list 'load-path "/home/brian/.emacs.d/elpa/htmlize-20130207.1202/")
(require 'htmlize)

(defun htmlize-files-in-dir (dir)
  (htmlize-many-files (directory-files dir t ".org$")))

My issue is that in order for each page to conform to my emacs theme, the script has to open a new instance of emacs for each file. After some googling I found that there exists a function org-export-htmlize-generate-css that would generate a global css style file for my theme. Obtaining such a css file would allow my script to run a lot faster (and would prevent the annoying emacs windows from flashing every time I run the script). However, my version of emacs (24.3.1) does not have the function org-export-htmlize-generate-css. Does anyone have an idea how I could obtain this function?


texts: Why does emacs (getenv "TERM") return incorrect data?

texts:
I'm running Emacs 25.2.2 on Ubuntu 17.10.  Although my environment has TERM=xterm-256color, (getenv "TERM") returns dumb, which is incorrect.

Why does (getenv "TERM") return an incorrect value?


texts:
I was experimenting with face definitions and created a number of "test" faces that were meant to be temporary. At the end of the experiments, I wanted to clean up after myself, so I attempted (unintern FACE), but the faces remained on the return value of function (face-list). My guess was that the faces are stored in a different obarray. Then I looked at the function definition for (face-list) in file faces.el, and it gets its data from variable face-new-frame-defaults which is defined in C source code, which is a simple list, and not seemingly updated.

As a complication to testing and debugging, the doc-string for unintern indicates that FACE can be specified either as a string or as a symbol. However, the function behaves differently for the alternatives. This is kind of a tangent, and may be a bug in unintern, but it confused debugging my situation. For a normal symbol (setq my-temp-test-symbol "HELP!"), performing unintern with a string argument correctly returned t on symbol-found-and-uninterned and nil on symbol-not-found; However, when passed a symbol 'my-temp-test-symbol, it returned t repeatedly.

For faces, performing unintern with a symbol argument always returns t, and with a string argument does first return t, and then nil, but the face continues to appear in the output of (face-list).


texts: How to avoid using auth-sources when editing with sudo?

texts:
When I invoke crux-sudo-edit, Emacs hangs forever with the following message:
Decrypting /home/$USER/.authinfo.gpg...0%
until I press C-g, then it asks:
Passphrase for symmetric encryption for /home/$USER/.authinfo.gpg:
(When finding a file with "/sudo::/path/to/file/", Emacs doesn't hang but still want to decrypt my ~/.authinfo.gpg)
Because I don't save my root password there, I press another "C-g", but annoyingly another window shows up:
Error while decrypting with "/usr/bin/gpg2":

gpg: error creating keybox '/home/$USER/.gnupg/pubring.kbx': No such file or directory
gpg: keyblock resource '/home/$USER/.gnupg/pubring.kbx': No such file or directory
gpg: AES.CFB encrypted data

And it doesn't disappear even after supplying my root password.
Setting tramp-completion-use-auth-sources to nil doesn't solve this.
This problem only appears after creating "~/.authinfo.gpg".


texts: How to use ,var-name (defvar) syntax in org-publish-project-alist? Init file is in form of org-mode

texts:
I have following function as part of my emacs configuration.org settings for publishing org to html.

(defvar website-html-preamble
"

Home

Profile

Messages

 ")

 (defvar website-html-postamble
     "
 Copyright 2016 %a (%v HTML).
Last updated %C.

")

  (setq org-publish-project-alist
    '(
      ("website" :components ("orgfiles"))
      ("orgfiles"
       :base-directory  ,org-mode-websrc-directory
       :base-extension "org"
       :publishing-directory  ,org-mode-publishing-directory
       :exclude "*/excluded/*"
       :recursive t
       :publishing-function org-twbs-publish-to-html
       :headline-levels 3
   :section-numbers nil
       :with-toc nil
   :html-preamble ,website-html-preamble
   :Html-postamble ,website-html-postamble
      )
      )
)

",var-name"  (eg: ,website-html-preamble) causes following problems (using org-babel-load-file to load config)

  Debugger entered--Lisp error: (invalid-read-syntax "#")
  eval-buffer(# nil "c:/rahuketu/programming/EMAC/Emacs_Config/.emacs.d/configuration.el"
  nil t)  ; Reading at buffer position 4284
  load-with-code-conversion("c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/configuration.el"
  "c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/configuration.el"
  nil nil)
  load("c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/configuration.el"
  nil nil t)
  load-file("c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/configuration.el")
  org-babel-load-file("c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/configuration.org")
  eval-buffer(# nil
  "c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/init.el" nil t)
  ; Reading at buffer position 422
  load-with-code-conversion("c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/init.el"
  "c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/init.el" t t)
    load("c:/rahuketu/programming/EMACS/Emacs_Config/.emacs.d/init" t t)

  [0 "\205\262 \306=\203  command-line()   normal-top-level()


texts: Can org agendas be exported to html with a command line script?

texts: I currently export my org agenda to html by issuing C-x C-w <NAME OF HTML FILE> RET. I'd like to have a shell script that does this automatically. Is this possible?


texts: Trying to run a linux program in Emacs: command not found

texts:
I have a pdflatex program located in

/usr/local/texlive/2014/bin/i386-linux/pdflatex

I added it's folder to $PATH both in .bashrc and .bash_profile:

PATH=$PATH:/usr/local/texlive/2014/bin/i386-linux/

When I run this command in ordinary shell: both in X and console, it works. I wanted to run pdflatex upon the current file in buffer using this elisp command:

(start-process-shell-command
    "pdflatex"
    "*async pdflatex*"
    (concat "pdflatex " file-name))

It works in Windows, worked in Linux previously. But now I get an error:

/usr/bin/bash: pdflatex: command not found

How to fix?


texts:
I use pdb with gud to debug python scripts. I am just wondering if there is way to highlight the lines with breakpoints? For example, in some screenshots of gud-gdb, some people seem to have red circles to the left of lines with breakpoints. How to achieve that with pdb? And is there a way to list all breakpoints (like the breakpoints buffer of gud-gdb)?

I actually tried realgud once, and it did have this feature. However, realgud is lacking documentation, and I find it extremely confusing to use. I have very limited knowledge of elisp, so I cannot figure out what is going on without a more detailed guide.

By the way, why gud with pdb does not have the function gud-until?

Thanks.


texts: Having trouble using EXWM with multiple monitors, and with exwm-input-global-keys

texts:
I'm not sure how to open more than one Emacs frame in a given workspace; ideally I would have one frame in each of my two monitors. Presently, my issue is that I'm stuck with only one frame in each workspace, and all lie in the same monitor. Here are the important parts of my config:

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

(setq exwm-workspace-number 4)

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

[...]

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

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

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

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

Another issue is that the exwm-input-global-keys I've set don't seem to work; if I try s-r, then the minibuffer simply tells me "s-r is undefined". I'd appreciate any suggestions. EDIT: I think I figured out the global-key thing. Still stuck on the monitor issue though.


texts: How to configure font in terminal mode (none display graphic)?

texts:
I try to use Emacs in terminal mode, but when I try to checking available font (font-family-list), I go nil.

Is it anyway to check and set font in terminal mode?


texts:
Search didn't yield any success. Perhaps I'm using the wrong search terms...

I'd like to insert a single space (just like when you hit SPC) but without changing point. I come up with an example (let | be the cursor). Say you have foobar in a buffer and you placed the cursor in-between.

foo|bar

Then I'd like to hit a key sequence that inserts a space character at point, but leaves point where it is, instead of moving it past the inserted char. Like so:

foo| bar

Perhaps something like insert-space-right. I could easily write some Elisp code that does this for me, but I'd like to find out whether such a thing is indeed already built-in and I'm just unable to find it.


texts: Customize variable: custom-theme-load-path[no match]

texts:
I followed instruction here to erase customization. however, it returns [no-match]. am i doing anything wrong here?

The reason that I was trying to erase the custom-theme-load-path is that I failed to load color theme from .init file,  in the following way. any hint on why it failed to load the solarized theme? Any help is appreciated!

having the following piece in a file general-settings.el

(add-to-list 'custom-theme-load-path (make-plugin-path "color-theme-solarized"))
(load-theme 'solarized 1)

and then (require 'general-settings) in my .init file
make-plugin-path is defined as below:

(defun make-plugin-path (plugin)
  (expand-file-name
   (concat plugin-path plugin)))

plugin-path is a defined variable


texts: smart-quotes how to close it on the end of the variable if there is one

texts:
I don't know the proper explaination for this so I could not find the answer. It might be already handled but I was not able to configure it correctly.
I have tried to integrate electric-pair and smart-quotes. It works pretty nice but in some cases it does not do the things as I want. Please see the table for an example.

Base column is the initial state.
inserted column is where I inserted the character
becamecolumn where the pair is intersed

Wanted behavior. 1st: do nothing or 2nd: I wrote added character in between ><

==> If it is >"<NAME do "NAME"

==> If it is NAME>"< do "NAME"

==> If it is >(<"NAME" do ("NAME")

==> If it is >[<NAME do [NAME]

My setup:
(electric-pair-mode 1)
(defun electric-pair ()
  "If at end of line, insert character pair without surrounding spaces.
    Otherwise, just insert the typed character."
  (interactive)
  (if (eolp) (let (parens-require-spaces) (insert-pair)) (self-insert-command 1)))

; https://www.emacswiki.org/emacs/ElectricPair
(add-hook 'python-mode-hook
              (lambda ()
                (define-key python-mode-map "\"" 'electric-pair)
                (define-key python-mode-map "\'" 'electric-pair)
                (define-key python-mode-map "(" 'electric-pair)
                (define-key python-mode-map "[" 'electric-pair)
                (define-key python-mode-map "{" 'electric-pair)))

;(require 'smart-quotes)
(add-hook 'text-mode-hook 'turn-on-smart-quotes)

PS: I can try to explain more if the question is unclear


texts: Don't replace my buffers with *warnings* or *message* buffers?

texts:
Current behavior:

Emacs replaces one of my buffers with *warnings* or *messages* if I have multiple buffers open.
However Emacs creates a new buffer and displays *warnings* or *messages* if I have exactly one buffer open.

I want this to be the default behavior on my Emacs, that is, irrespective of how many buffers I may have open, I want Emacs to always create a new buffer for its *warnings* or *messages* (and other similar buffers).
Further I want my Emacs to figure out the following on it's own when creating new buffers:

Tall buffers should always split vertically
Wide buffers should always split horizontally

How do I accomplish this behavior with my Emacs?


texts: No php highlighting in .blade.php using web-mode

texts:
there's no highlighting php into a .blade.php file using web-mode.
I just installed from MELPA and added this to my .emacs file:
(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))

(setq web-mode-engines-alist
      '(("php"    . "\\.phtml\\'")
        ("blade"  . "\\.blade\\.php\\."))


texts: Stop automatic removal of space before point when inserting `.` (dot)

texts:
The following gif shows the behaviour quite nicely:

Whenever I type a space followed by a dot (.) in any mode derived from text-mode, emacs will replace the space with the dot. I could not want this behaviour, but couldn't figure out what causes this behaviour...

Anybody got any ideas?


texts: Save an org-mode buffer when I clock in/out of a task

texts:
I'm using the clocking functionality quite extensively, and I built a number of tools (outside of Emacs) that will look for clocked-in tasks. The problem is that these tools will parse the file on disk, and therefore only pick up the clock entries if the buffer was saved in the meantime. I could just save the buffer manually, but I'm also using org-mru-clock, so it might not always be evident which buffer to save.

So I wanted to ask whether there is an easy way to hook into the clock-in/-out events to determine the buffer the task is in, and just save it.


texts: Programmatically call evil-search-forward and then paste

texts:
How do I create an elisp function to call evil-search-forward and then paste to search for the last text yanked/copied? I've tried calling commands such as evil-paste-after or yank (see below) but they appear to do nothing when called programmatically after evil-search-forward. I'm using spacemacs.
(define-key evil-normal-state-map (kbd "C-r")
    (defun my-search-fun ()
        (interactive)
        (evil-search-forward)
        (evil-paste-after)
    )
)


texts: How to do harvard style referencing using org-ref

texts:
I am writing a paper using spacemacs with it's org-mode to export to latex. I want to referencing using the (author, year) style for example if I had the following reference in my .bib file

@article{DBLP:journals/corr/abs-1710-03748,
 author    = {Trapit Bansal and
           Jakub Pachocki and
           Szymon Sidor and
           Ilya Sutskever and
           Igor Mordatch},
title     = {Emergent Complexity via Multi-Agent Competition},
journal   = {CoRR},
volume    = {abs/1710.03748},
year      = {2017},
url       = {http://arxiv.org/abs/1710.03748},
archivePrefix = {arXiv},
eprint    = {1710.03748},
timestamp = {Mon, 13 Aug 2018 16:47:04 +0200},
biburl    = {https://dblp.org/rec/bib/journals/corr/abs-1710-03748},
bibsource = {dblp computer science bibliography, https://dblp.org}
}

Is there a citation style I could use in the text so the ouput is something like

this is an example sentance(Bansal, 2017)

or do I need to find another tool?


texts:
I've been using cursive's Structural Editing (a paredit-like mode for Intellij and Cursive) and I found a nice command there called move form-up (and down).

Move form up does this (the | is the point):

(+ 1 |(+ 2 3) 4) => (+ (+ 2 3) 1 4)

and Move form down is analogous:

(+ 1 |(+ 2 3) 4) => (+ 1 4 (+ 2 3))

Is it possible to do this on Emacs paredit-mode ? I think it is not on the basic paredit set (at least it is not described on this cheat sheet


texts: How to quickly reopen ediff with the same files

texts:
I ran ediff on file A and B, and then quit it to do a git commit. Then I want to reopen ediff (let's call it rediff) with the same pair of files.
How do I do this? There is the eregistry thing that I thought it is for this purpose.But I couldn't make it work. When I type z and quit ediff, there is nothing in the eregistry when I do M-x eregistry.


texts: Tamil input not working in emacs after version 25

texts:
I have been using emacs for almost 7 years now. Started with emacs 23. I have used to read and write tamil language text inside emacs with both scim-input and ibus under gnome without any additional config inside emacs. But after switching to emacs 25 the system input is not working and even inside if I select tamil-itrans input methods, I cannot type in tamil text.
Even tamil script rendering has been degraded. What can I do to rectify this??


texts:
I'm trying to set a scroll margin to emacs with the scroll-margin variable, but I've noticed that when you do that and you have display-line-numbers-mode enabled, the scrolling doesn't work properly when coming up from the bottom of the file.

Here's a gif illustrating the issue

Notice that, when scrolling down, it scrolls properly, but, when the cursor reaches the bottom of the file, and starts going up, it doesn't respect the scroll-margin until the bottom of the file is not visible anymore.

If I disable display-line-numbers-mode the scrolling works properly. Is there a way to achieve scroll margin along with line numbers without falling back to linum-mode?


texts: Magit popup doesn't open in status buffer

texts:
Every time I accidentally update Magit to a new version, I come to regret it. :( Today, I discovered that the popup window doesn't work well anymore: instead of opening in the same buffer as the status buffer, it opens in a buffer of its own, thus taking too much screen estate and occluding important information contained in the other buffer, unrelated to the Git status.

Is there any way to undo this change?

In addition to the above, q no longer works to dismiss such a buffer. I'm not sure what other things are missing (yet). But, is it possible to just go back to how it worked in... I wish I knew what version it was.  Well, whenever those two things worked?

OK, I found that

(setq transient-display-buffer-action '(display-buffer-below-selected))

Would handle the major problem. But I'm still struggling to find the keymap where q used to be defined.


texts: External http link not recognized as link

texts:
I have the following document:

* Test
| Links |
|-------|
| [[http://emacs.stackexchange.com/questions/ask]] |

This Link is not recognized as a Link. If I press TAB while the cursor is on the link the cursor moves to the beginning of the line and I get a warning in messages:

  font-lock-fontify-keywords-region: Wrong type argument: listp, org-table

If I remove http from the link, it works. If I change http to some other term like httpd it works also. It just seems, http and https do not work.

What am I doing wrong? What is missing? How can I add a external http link to an org table?


texts:
Opening a new *shell* buffer takes over any window other than the one I type the command into.

What variable changes this behavior?  I have a guess the choices will be the same as these:

Hide Erc Join Buffer: Value Menu Bury in new buffer
    State : CHANGED outside Customize.
   Determines how to display a newly created IRC buffer. Hide

   The available choices are:

     ‘window’          - in another window,
     ‘window-noselect’ - in another window, but don’t select that one,
     ‘frame’           - in another frame,
     ‘bury’            - bury it in a new buffer,
     ‘buffer’          - in place of the current buffer,
     any other value  - in place of the current buffer.
Groups: Erc Buffers

That variable is erc-join-buffer.  Thanks!


texts: I restored my MacOS machine from a backup. How to fix errors while trying to read/write non existing files in the /var/folders/ directory?

texts:
I restored my machine from a backup where I hadn't backed up system directories.

Now my restored emacs (spacemacs) insist on trying to read and write from this directory and I keep on getting errors like this:

File mode specification error: (file-missing Creating directory with prefix No such file or directory /var/folders/wq/hh0gd3_57pschvmv66g839w40000gq/T/babel-)
[persp-mode] Error: Can not autoresume perspectives -- (file-missing Creating directory with prefix No such file or directory /var/folders/wq/hh0gd3_57pschvmv66g839w40000gq/T/babel-)

How can I fix this?

Reinstalling spacemacs (deleting the ~/.emacs.d/ and re-cloning from git) didn't help.


texts: Is there an easy way to copy files with ido navigation?

texts:
I'd like to be able to do something like this:

Navigate to a buffer associated with a file
C-x C-w (enter file ido file writing mode)
navigate via ido to another directory
Do something at this point to write a copy of the file in the navigated directory with the file name already associated with the buffer so I don't have to retype it.

I can't use C-f at this point because it writes to the original directory.
Bonus points if a similar method can be used to move files as well as copy them.


texts: How to run whichever function is bound to a certain key

texts:
There are a lot of occasions where, by default, the key-binding C-c C-c does something useful - e.g. in org-mode or magit. I would like to take whatever function C-c C-c runs, and bind that function to something like F8, without having to know what specific function is being called under the hood.

Thus: how can I take an existing key-binding, obtain the function which that key-binding would run, and then simply run that function?

(I'm aware it would take me 5 min to just make a list of functions that I'm interested in, and bind them appropriately in the respective modes - but I would nevertheless like to know how to achieve the above)


texts: Evil: How do I see the partial command I've been typing?

texts:
Suppose I am in command mode, and I am in the process of typing 3dd to delete three lines. How can I make evil mode show the (partial) command I have typed so far?

In other words, is there an evil mode equivalent to vim's set showcmd?


texts: How to change green background in magit running in xterm

texts:
I am running emacs in xterm with 'emacs -nw'. When examining diffs I find it hard to read text typed in yellow foreground and green background. How do I change it to eg. green/black or green/default combination?
Or is there simpler method to change color theme to something more suitable for xterm?


texts: Change dd command in evil mode to not write to clipboard

texts:
I would like to use normal modes commands like d c x etc without the content being copied to clipboard.

I want to make emacs so that only y command will write anything to the clipboard. Other commands like d should only delete the content without writing anything to the clipboard.


texts: org-mode latex export: German ß character

texts:
Is there a way to export to latex in a way that the German 'ß' ("scharfes S", "eszett") character stays? I'm using utf-8 input encoding, and Umlauts get exported well, but ß appears as capital SS in my documents, although it gets exported to html fine.

Edit: I just found out, when changing the inputencoding to utf8x, it works:

#+latex_header: \usepackage[utf8x]{inputenc}


texts: Sorting an archive file while preserving headline structure in org-mode

texts:
When I complete a task and move its todo state to "Done", it adds the date the task was completed. Later during the weekend, I might archive these "Done" tasks so that they are moved into an .org_archive file.

I would like to view these archived tasks in a few different ways, namely by project structure and by completion date.

Suppose I have a project like this:

** TODO My Project
*** TODO Task 1
*** TODO Task 2

Let's say I complete Task 1, and then Task 2, which also completes the entire project. In my archive file, I would have something like this:

* DONE Task 1
  CLOSED: [some date]
  :PROPERTIES:...
* DONE Task 2
  CLOSED: [some date]
  :PROPERTIES:...
* DONE My Project
  CLOSED: [some date]
  :PROPERTIES:...

This is useful for keeping a log of archived items, usually sorted by completion date. However, if completing Task 2 takes place several months after Task 1, it becomes difficult to recall what project Task 1 and 2 belong to.

Is there a way to "sort" the archive file such that I could view it both as a completion log (sorted by "CLOSED" date), as well as sorting the file as to retain the project structure, e.g.

** DONE My Project
   CLOSED: [some date]
   :PROPERTIES:...
*** DONE Task 1
    CLOSED: [some date]
    :PROPERTIES:...
*** DONE Task 2
    CLOSED: [some date]
    :PROPERTIES:...


texts: How to make size of Emacs frame persistent?

texts:
When I start Emacs (by clicking on a desktop icon), its frame is too big for the screen, so the mode-line/mini-buffer area is not visible.

It's not difficult to resize and reposition the frame, but it is irritating to have to do this every time one starts Emacs.

How can I preserve the size of the Emacs window across sessions?


texts:
I wannt to replace a specific word in multiple files. First time i do "C-c c" everything works fine, but when i repeat the command the text is not updated in the newly created files correctly. The files contain same content as the first pair of files(.cpp, .h). I think it is a buffer issue in replace-word-in-string but i dont know how to fix it?
I'm a beginner at Elisp please explain in simple terms, thanks for helping me out.

;;Prototype source
(setq sourceCode "//Include Librarys
#include MyClass

//Include Files

//******
//MyClass::MyClass
//******
MyClass::MyClass() {}

//******
//MyClass::~MyClass
//******
MyClass::~MyClass() {}

")

;;Prototype Header
(setq headerCode "#ifndef MYCLASS
#define MYCLASS

//Include Librarys

//Include Files

//Forward declarations

class MyClass {
public:
 MyClass();
 ~MyClass();

private:

};

#endif //!MyClass
")

;;Create CLASS
(global-set-key (kbd "C-c c")
   (defun create-class (directory name)
    (interactive "s(Create a new class) Enter path:
    sEnter class name: ")

    (setq directory "c:/Programming/") ;only for degugging
    (setq path (concat directory name))
    (setq pathSource (concat path ".cpp"))
    (setq pathHeader (concat path ".h"))

    ;Replace default class name with user specified class name
    (setq sourceCode (replace-word-in-string sourceCode name "MyClass"))

    (setq headerCode (replace-word-in-string headerCode name "MyClass"))

    ;Check if file exist in current directory
    (if (and (file-exists-p pathSource)(file-exists-p pathHeader))
      (message "%s" "Filename already exist, no files where created!")
      (write-region sourceCode nil pathSource) ;Write to files.
      (write-region headerCode nil pathHeader)
      (message "Created source file: %s and created header file: %s" pathSource pathHeader)
    )
  )
)

(defun replace-word-in-string(string replacementWord searchedWord)
    (with-temp-buffer
      (insert string)
      (goto-char (point-min))
      (while (re-search-forward searchedWord nil t)
        (replace-match replacementWord nil t)
      (setq retString (buffer-string)) ;returns all content in buffer as a   string
      )
   )
retString
)


texts: Paste Inserts Extra Characters because of Electric Mode

texts:
I have this defined:
(setq electric-pair-pairs
      '(
        (?\" . ?\")
        (?\{ . ?\})
        (?\' . ?\')
        (?\< . ?\>)
        ))

If I paste this into emacs:
(global-set-key (kbd "C-x g") 'magit-status)

I get:
(global-set-key (kbd "C-x g") 'magit-status) ')

I foresee this will become a problem;)


texts: Forcing keys to run emacs commands instead of other app's commands

texts:
I am using Mac OS X Yosemite if this matters at all.
Is there a way, while in the emacs GUI, to force every key combination to run the emacs command specified by this key binding instead of other application's command.

I can only think of one such conflict for now, but I'm sure more will come up as I learn more about emacs.

M-<SPC> should run just-one-space, but instead it opens albert's search functionality.


texts: Emacs and Gpg4win Opening input file error

texts:
Emacs 24.5.1 in cygwin x64, Windows 7, gpg (GnuPG) 2.0.21 (Gpg4win 2.2.0)

Visited file ~/somefile.gpg

Got error "Opening input file" "Can't decrypt" "Exit".

Debugger entered--Lisp error: (file-error "Opening input file" "Can't decrypt" "Exit")
  signal(file-error ("Opening input file" "Can't decrypt" "Exit"))
  epa-file--find-file-not-found-function()
  run-hook-with-args-until-success(epa-file--find-file-not-found-function)
  #[257 "..." [#<killed buffer> "~/somefile.gpg" (nil) file-exists-p file-readable-p kill-buffer signal file-error "File is not readable" run-hook-with-args-until-success find-file-not-found-functions t] 5 "\n\n(fn IGNORED)"]((file-error "Opening input file" "Can't decrypt" "Exit"))
  funcall(#[257 "..." [#<killed buffer> "~/somefile.gpg" (nil) file-exists-p file-readable-p kill-buffer signal file-error "File is not readable" run-hook-with-args-until-success find-file-not-found-functions t] 5 "\n\n(fn IGNORED)"] (file-error "Opening input file" "Can't decrypt" "Exit"))
  find-file-noselect-1(#<killed buffer> "~/somefile.gpg" nil nil "~/somefile.gpg" (10696049115278578 2661856658))
  find-file-noselect("~/somefile.gpg" nil nil t)
  eval((find-file-noselect "~/somefile.gpg" nil nil t) nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

.emacs, emacs.bat to launch just in case.


texts:
I swear there used to be something like this.

I'm writing a lot of Markdown with embedded code.  I would like to have EMACS treat code in GitHum fenced code according to the default mode for that type of code. That is, if I write:

...and this excellent piece of code computes a function significant to number theory:

```python
def even(x):
    return (x % 2) == 0
```

I would like the code within the fences to be treated as Python while the code outside the fences is Markdown.


texts: How to change counsel grep options once activated? (counsel-rg, counsel-git-grep ... etc)

texts:
I would like to have the ability to change the flags passed to grep once counsel-rg has been stated.
For example, sometimes I start counsel-rg and type in a string that needs a lot of escaping. In this case I'd like the ability to search for a string literal (with no regex).
Is there a way to change counsel-rg-base-command while counsel is already searching?

I assume the exact search back-end probably doesn't matter in this case.


texts: loading tramp overrides tramp-remote-path customization back to default value

texts:
I have customized tramp-remote-path in my .emacs.d/init.el with

(custom-set-variables  '(tramp-remote-path
    (quote
     (tramp-own-remote-path))))

but when tramp is loaded the value of tramp-remote-path is set to the default value. For example after I open a remote file the value of tramp-remote-path is (tramp-default-remote-path   "/bin" "/usr/bin" "/sbin" "/usr/sbin" ...)

I have verified this behaviour even when the above customization is the only code in init.el with both 24.5 and 25.0.

Why does this happen?

How can I prevent it and make my customization stick?

Since tramp-remote-path is defined using defcustom, it seems like it should be customizable with custom-set-variables


texts:
Context When exporting Org-Mode documents to LaTeX it is possible to specifcy additional LaTeX header commands:

#+LaTeX_HEADER: \subtitle{This is a subtitle}

Using org-publish it is possible to specify some more advanced exporting options.

(setq org-publish-project-alist
  '(
    ("text"
     :base-directory "~/somedir"
     :base-extension "org"
     :publishing-directory "~/somedir"
     :preparation-function somepreparationfunction
     :completion-function  somecompletionfunction
     :publishing-function org-latex-publish-to-pdf
     :include ("somedocument.org")
     :exclude "\\.org$"
     :latex-class "scrartcl"
     :headline-levels 5
     :with-toc nil
     :select-tags ("Text")
     )
    ))

As far as I can see it's usually possible to specify each options either in the Org-Mode document or in the org-publish-project-alist data structure. But :latex-header does not seem to be recognized altough it is specified in lisp/ox-latex.el (HEAD).

Question How do I specify additional LaTeX header commands in the org-publish-project-alist, i.e. being able to specify them seperately in the case of multiple publishing projects for the same document?


texts: Running spacemacs alongside regular emacs: how to keep a separate .emacs.d

texts:
I would like to try spacemacs.  But I don't want to switch from my regular emacs configuration just yet, so I would like the configuration that's currently in my .emacs.d to be in one directory, and the equivalent configuration for spacemacs to be in another directory.  I don't mind what name either directory has.

Is that possible, short of chroots / LD_PRELOAD / other such trickery?  How can I do it?


texts: Orgmode 2017 "binding depth exceeds max-specpdl-size"?

texts:
I've just installed the latest version of Orgmode (20170515) from the package list of elpa (M-x package-list-packages, marked I then x).

Now, when I try to export an *.org file to a *.pdf by either pressing C-c C-e or via Org menu, I get an error msg that says:

Symbol's function definition is void: org-define-error

What does it mean? How do I get the export buffer back? (I'm trying to export an org file to pdf via tex)

I'm on Windows 7 and I think I previously had Org 8.0 (can't remember...).

Can someone kindly please help me?

EDIT

Today, the command C-c C-e now displays the buffer for export options (a set of keyboard combos to export in pdf or HTML) BUT when I select l o I get this msg:

 org-get-limited-outline-regexp: Variable binding depth exceeds max-specpdl-size

Anyone knows what this means? And how do I fix it?

EDIT 2

I added these lines to my .emacs file and told emacs to 'Evaluate the buffer'.

(setq max-specpdl-size 5)  ; default is 1000, reduce the backtrace level
(setq debug-on-error t)    ; now you should get a backtrace

This is the response:

Debugger entered--Lisp error: (void-variable speedbar)
  eval(speedbar nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

I've purposely omitted typing in C-h a as this was causing some other kind of error:

Debugger entered--Lisp error: (void-variable C-h)
  eval-buffer()  ; Reading at buffer position 840
  call-interactively(eval-buffer nil nil)
  command-execute(eval-buffer)

UPDATE 3

On Nick's suggestion I changed those line in my .emacs file. Now it looks like this:

(setq max-specpdl-size 5000)  ; default is 1000, reduce the backtrace level
(setq debug-on-error t)    ; now you should get a backtrace
;;C-h a

And this is what the buffer says following another attempt to export from org to pdf: (this is after recompiling all elpa installed pkgs)


texts: Is the GPG signature of Emacs 26.3 still valid?

texts:
I was trying to install Emacs on my Windows 8.1 machine (thus WSL is not an option). I downloaded the file from a mirror (emacs-26.3-x86_64.zip), along with his signature (emacs-26.3-x86_64.zip.sig). However, when I try to verify it with Cygwin, I get this:
$ gpg --verify emacs-26.3-x86_64.zip.sig emacs-26.3-x86_64.zip
  gpg: Signature made 08/30/19 14:04:16 ope
  gpg:                using RSA key 84930FFB79B645F7DEA29AD0AC6DD3FFD1D046BD
  gpg: Good signature from "Phillip Lord <phillip.lord@newcastle.ac.uk>" [expired]
  gpg:                 aka "Phillip Lord <phillip.lord@russet.org.uk>" [expired]
  gpg: WARNING: This key has been revoked by its owner!
  gpg:          This could mean that the signature is forged.
  gpg: reason for revocation: No reason specified
  gpg: revocation comment: Revocation Certification produced at generation time
  gpg: Note: This key has expired!
  Primary key fingerprint: 8493 0FFB 79B6 45F7 DEA2  9AD0 AC6D D3FF D1D0 46BD

Now, is this file safe to install?


texts:
I tried to execute an org-mode code block in octave, using the example in this SO question:

#+name: factor
#+begin_src octave :session *octave* :exports code :results silent
factor=4;
#+end_src

But I got an error:

org-babel-execute-src-block: No org-babel-execute function for octave!

I have enabled org-babel for matlab and ocatve in emacs init file as far as I can. Emacs seems to recognize .m files when loaded (The buffer is recognized as a Octave buffer).

Am I missing something in configuring org-mode for octave?

By the way, this is with the default Emacs 26 from Ubuntu 20.04 LTS. And my org-babel configuration is:

(org-babel-do-load-languages
  'org-babel-load-languages
    '((emacs-lisp . t)
       ...
       (octave . t)
       (matlab . t)
       ))

and I also have this for octave mode in my init file:

;; (autoload 'octave-mode "octave-mod" nil t) ;;outdated
(setq auto-mode-alist
  (cons '("\\.m$" . octave-mode) auto-mode-alist))

(add-hook 'octave-mode-hook
          (lambda ()
            (abbrev-mode 1)
            (auto-fill-mode 1)
            (if (eq window-system 'x)
                (font-lock-mode 1))))


texts: Unable to close emacs sessions in Windows (after Hibernate or Sleep)

texts:
When an Emacs session is created and closed before either Hibernate or Sleep options are used in Windows-7, Emacs exits normally.
But whenever either Hibernate or Sleep options are used with an Emacs session is open and after coming back from hibernate or sleep, there is no clean exit the Emacs window does not close. I see the following message when I close Emacs using C-x C-c

I have enabled ido mode. I'm wondering if that could be a cause for this strange behavior.
If I click on the close button or press C-x C-c there is not effect. Finally, I'm forced to kill Emacs from Windows Task Manager using End Task.
Is there way to fix this?


texts: Full Justification for Proportional Fonts

texts:
I am having difficulty getting text to fully justify when I use a proportional font. When I do, I get staggered text. As I understand it, the way emacs generally handles filling is by number of characters.
Is there an easy way to justify proportional fonts or fix this problem?
Aligned version (monofont):

Proportional font: