texts: Truncation of text in Emacs terminal emulators

texts:
When I log in to the cluster using shell or eshell, I get the following message:

  2018-04-11: The MEM1024 node is now back in the queue. The hardware had to be completely replaced, which means there is now 24 cores available on this node. If you need the full 1024 node, you should therefore use #SBATCH -n 24 as well.

  /staff

  WARNING! You are over your files quota on "$SNIC_NOBACKUP"!  Grace time remaining: 3w0d2h59m19.0s

However, if I use terminal emulators term or ansi-term, the same message gets cut as follows:

  2018-04-11: The MEM1024 node is now back in the queue. The hardware had to be completely replaced, which means there is now 24 cores

  [user@host ~]$ r your files quota on "$SNIC_NOBACKUP"!  Grace time remaining: 3w0d0h15m31.0ss well.

I have noticed that when entering bash the mini-buffer displays

  Truncate long lines disabled

It does not matter if line warping is enabled or disabled at the launch of bash but if I switch it ON and OFF, the issue disappears. Does anyone have suggestions how to fix it? It is tedious to do M-x toggle-truncate-lines several times.

UPD 1: I run GNU Emacs 26.2 on macOS Mojave 10.14.6. Running emacs -Q yields:

Emacs-x86_64-10_14[35152:7689947] Failed to initialize color list unarchiver:
Error Domain=NSCocoaErrorDomain Code=4864 "*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]:
non-keyed archive cannot be decoded by NSKeyedUnarchiver" UserInfo={NSDebugDescription=*** -[NSKeyedUnarchiver _initForReadingFromData:error:throwLegacyExceptions:]:
non-keyed archive cannot be decoded by NSKeyedUnarchiver}

I searched for the possible source of this error and found that one needs to delete ~/Library/Colors/Emacs.clr. Now quick Emacs session starts without errors and more importantly, I do not observe the original problem anymore. Does anyone have a clue what are the implications of this?


texts: default location to install ess not works with the self installed emacs

texts:
I am running Ubuntu 14.04. I don't use emacs from its repository.

I installed  my emacs by compling from source, the default location is /usr/local. e.g. /usr/local/bin/emacsand /usr/local/share/emacs/24.4/.

I installed ESS from its offical site. The default install location is /usr e.g. /usr/share/emacs/. I don't find a way to specify --prefix for ESS. I run make install directly.

So in my emacs, I can't find S mode.

What shall I do?

Shall I reinstall emacs with ./configure --prefix=/usr? Generally speaking, should installation from source be in /usr or /usr/local?

Thanks!


texts: Simple JDEE Setup for Existing Java Project

texts:
I imagine most developers, like myself, starting out with JDEE are beginning with source code that is already written as opposed to a new empty project. What I'm asking for is a simple explanation of how to get JDEE set up for an existing Java project.

The user's guide on the JDEE website explains this to some degree, but is organized more as a highly detailed tutorial and isn't always clear on which settings are required and which are optional. Also, the user's guide uses custom variables as opposed to settings that can easily be pasted into and modified in a .emacs file. I'm looking for something that can easily be copied and pasted into a .emacs file (and any other files, such as project files) and modified to suit the file paths a developer already has.

The setup should allow the use of all of the features available in JDEE that one typically expects in an IDE such as Eclipse. Please assume that the developer reading your answer has JDEE installed in Emacs, but has not gone any further than that.

I've been struggling to get this set up at home and look forward to the answers I receive so I can learn more about Java and Emacs.


texts:
I have made sure that dvipng is installed on my system and have upgraded to the most recent version of org-mode but I cannot preview LaTeX.

M-x org-version shows 8.3.4.

I tried typing some Latex before running the command (executed via both C-c C-x C-l and M-x org-toggle-latex-fragment):

\begin{equation}
x = \sqrt{b}
\end{equation}

Nothing renders, I just see the text still.

Is there something I am doing wrong? Maybe I upgraded org-mode improperly? I just merged/overwrote over my contrib and lisp folders.

I am using Fedora 23. I also tried the instructions here and the conversions work but I still cannot preview. I tried using dvipng and imagemagick.


texts: Value of symbol c-basic-offset in a function

texts:
I am using a mode that has the following construct:

(defun robot-indent()
  "Returns the string used in indation.
Set indent-tabs-mode to non-nil to use tabs in indentation. If indent-tabs-mode is
set to nil c-basic-offset defines how many spaces are used for indentation. If c-basic-offset is
not set 4 spaces are used.
 "
 (if indent-tabs-mode
     "\t"
   (make-string (if (boundp 'c-basic-offset)
                    c-basic-offset 4)
        ?\ )
   )
 )

The attempt to use c-basic-offset if it is defined (bound?) fails. Evaluating c-basic-offset return set-from-style instead of 4.

I've tried to replace it with (symbol-value c-basic-offset), but it didn't change anything.

I've read about style variables, but didn't get everything. I set c-basic-offset only in custom C style definitions in my init file.

Several questions:

How do I fix it?
Is this something that worked in older versions of emacs?

Emacs 24.5.1


texts: Dired-narrow view disappears after using dired-toggle-read-only

texts: I use the package dired-narrow (which I have bound to C-x /) together with dired-toggle-read-only (C-x C-q). However, if I press C-c C-c to commit my changes after using dired-toggle-read-only this also makes the dired-narrow view disappear. I would like the dired-narrow view to persist until I press g (which is the default key to undo the dired-narrow view.)


texts: How to find a directory with given depth from current directory?

texts:
Is it possible from within Emacs to find directories with a given depth from the current directory from within Emacs and receive their respective location in form of a list?
I want it to work cross platform...


texts: Emacs freezes when saving org file in org-mode

texts:
For some reason I cannot save files while in org-mode. This happened after I updated to a most recent version of org-mode. If I change to text mode I can save without a problem. I have tried C-x C-w to write it to the same file and it hangs endlessly as well. Other modes (tex, python) seem to save without problems. This is the only vaguely related post. Is there any way to debug the problem? Thanks.

My Org-mode version is 9.2 and emacs is 25.2.2.


texts: font-lock limits ignored in anchored matchers

texts:
I think I might have found a bug in GNU Emacs but I want to check my understanding first.

In Search Based Fontification it is possible to specify a function as a matcher. It must obey the contract

  it receives one argument, the limit of the search; it should begin searching at point, and not search beyond the limit. It should return non-nil if it succeeds, and set the match data to describe the match that was found. Returning nil indicates failure of the search.

In addition, for multi-line matches it is possible to extent the region to be fontified by adding a routine to font-lock-extend-region-functions that in-place updates the font-lock-beg or font-lock-end variables (these variables are not visible in a function matcher).

Indeed, I have confirmed that if I extend the region in a font-lock-extend-region-functions then the limit does increase in my function matcher!

However, if we use an an anchored matcher, having the form (matcher . anchored-highlighter), where the anchored-highlighter is a function, my custom font-lock-{beg,end} regions are ignored!

Is there something I need to do so that anchored matchers receive the calculated regions or are they only designed to extend to the end of the current line by default?


texts:
My situation is similar to Info file emacs does not exist. I installed emacs24, emacs24-el, and emacs24-common-non-dfsg on Ubuntu 14.04. Unlike in that other question, C-h r does work for me and I do get the "Emacs" manual.

However from using Emacs on OS X, I'm accustomed to C-h i bringing up a full directory of many, many topics. Instead, my directory only has three nodes, for a few packages that provide info files (Flycheck, Haskell Mode, and Magit).

(Info-default-dirs) evaluates to ("/usr/share/info/emacs-24" "/usr/share/info/" "/usr/share/info/").  I do see all the individual info.gz files in /usr/share/info/emacs-24. I can open them individually, for example (info "/usr/share/info/emacs-24/elisp.info.gz") does bring up the "Emacs Lisp" node.

But again, I'm accustomed to C-h i bringing up the full directory. I don't know much about info files. How can I make this work?


texts:
smex won't work without evoking the command.
 When I run M-x smex it will work just for that command
If press M-x again I will not work,  will have to press M-x smex again.

using centos 7.
Here is my .emacs file(sorry don't have github), the smex configuration is in bold:

enter ;; init.el --- Emacs configuration

;; INSTALL PACKAGES
;; --------------------------------------

(require 'package)

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

(defvar myPackages
  '(better-defaults
    elpy ;; add the elpy package
    flycheck ;; add the flycheck package
    material-theme))
(elpy-enable)

;; realtime python checking
(when (require 'flycheck nil t)
  (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
  (add-hook 'elpy-mode-hook 'flycheck-mode))

(mapc #'(lambda (package)
    (unless (package-installed-p package)
      (package-install package)))
      myPackages)

;; BASIC CUSTOMIZATION
;; --------------------------------------

(setq inhibit-startup-message t) ;; hide the startup message
(load-theme 'solarized-dark t) ;; load material theme
(global-linum-mode t) ;; enable line numbers globally

(require 'ido)
    (ido-mode t)

**(require 'smex)
(smex-initialize)**

;; setting up python
;; install elpy

;; init.el ends here

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

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.

 '(default ((t (:inherit nil :stipple nil :background "#002b36" :foreground "#839496" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 105 :width normal :foundry "unknown" :family "VL Gothic"))))

 '(font-lock-comment-face ((t (:foreground "#3f7f5f"))))

 '(org-level-1 ((t (:inherit variable-pitch :foreground "#cb4b16" :height 1.03))) t)

 '(org-level-2 ((t (:inherit variable-pitch :foreground "#859900" :height 1.02))) t)

 '(org-level-3 ((t (:inherit variable-pitch :foreground "#268bd2" :height 1.01))) t)

 '(org-level-4 ((t (:inherit variable-pitch :foreground "#b58900" :height 1.01))) t))

(require 'undo-tree)
(global-undo-tree-mode)


texts: pipe buffer contents to shell as pseudo-file

texts:
I'd like to use wdiff to compare the contents of the current buffer to a previous version of the file the buffer is visiting. So, this would be a word-level live diff of the current buffer against a given git commit. The shell version of this would look like this:

 wdiff -w "[[delete:" -x "]]" -y "[[insert:"  -z "]]" <(git show "9409c06d816b7c677a4b07b80b76a54d65014257:FILENAME") FILENAME

I'd like to replace the second "FILENAME" with something that pipes the contents of hte current buffer to a shell.  Is this possible? The code I am currently stealing from (John Kitchin's scimax package) uses shell-command-to-string but that chokes on the buffer string when it contains quotes & special characters.


texts: Better syntax highlighting in MATLAB/Octave

texts:
I'm using emacs for editing a bunch of matlab files. The only gripe that I have is that the syntax highlighting provided by octave-mode is pretty poor.

This is the syntax highlighting provided by sublime text, while this is emacs. On the right side is octave-mode, on the left is matlab-mode.

How can I have syntax highlighting for the keywords and numbers in emacs?

EDIT: I just found highlight-numbers-mode for the numbers, the only problem left is the keywords highlighting.


texts: How to use emacs packages in emacs lisp scripting

texts:
I have the following emacs script from here

#!/usr/local/bin/emacs --script
;;; rcat --- cat
;;; Commentary:
;;; cat function in elisp

;;; Code:

;;-*- mode: emacs-lisp;-*-

(defun process (string)
  "Just reverse the STRING."
  (concat (nreverse (string-to-list string))))

(condition-case nil
    (let (line)
      ;;commented out b/c not relevant for `cat`, but potentially useful
      (princ "argv is ")
      (princ argv)
      (princ "\n")
      (princ "command-line-args is" )
      (princ command-line-args)
      (princ "\n")

      (while (setq line (read-from-minibuffer ""))
        (princ (process line))
        (princ "\n")))
  (error nil))

(provide 'rcat)
;;; rcat ends here

It works well but I want to use the s package for string manipulation, and convert my script to this:

#!/usr/local/bin/emacs --batch
;;; rcat --- cat
;;; Commentary:
;;; reverse lines cat function in elisp

;;; Code:

;;-*- mode: emacs-lisp;-*-
(require 's)

(condition-case nil
    (let (line)
      ;;commented out b/c not relevant for `cat`, but potentially useful
      (princ "argv is ")
      (princ argv)
      (princ "\n")
      (princ "command-line-args is" )
      (princ command-line-args)
      (princ "\n")

      (while (setq line (read-from-minibuffer ""))
        (princ (s-reverse line))
        (princ "\n")))
  (error nil))

(provide 'rcat)
;;; rcat ends here

The first code works well:

./rcat 1 2 3 4 < stuff.txt
argv is (1 2 3 4)
command-line-args is(/usr/local/Cellar/emacs/HEAD-5583e64_1/Emacs.app/Contents/MacOS/Emacs -scriptload ./rcat 1 2 3 4)
dcba
4321

But executing the second, I get:

Cannot open load file: No such file or directory, s

I'm not sure if using cask, batch-mode or something should work.


texts: How can I print a buffer exactly as it looks on the screen?

texts:
How can I print a buffer exactly as it looks on screen, including the use of variable-pitch fonts?

(I'm also curious why htmlfontify-buffer ignores variable-pitch-mode.)

I am using org-mode and use variable-pitch fonts.  However, the latter are ignored when I generate HTML for printing via htmlfontify-buffer.  Is there a work around?

Also tried htmlize, but that was even worse usually not including any special fonts.


texts: Org entry found only from its own buffer

texts:
I tried to detangle (org-babel-detangle) a latex file and got
the error message

  Cannot find entry with ID "......."

with the ID of the subtree of the first block.  But the entry
does exist in the original org file.  What's more puzzling is
that this happens on one machine and not on another, with
exactly the same files.

Moreover, if I minimalize the file, the problem persists, but, if I
create a new file with the same structure, detangling works as
expected.

Also, if evaluate (org-id-find '452031425...) in the org
buffer, the entry is found, but, if I evaluate the same
expression in the tangled buffer, it returns nil.  What am I
missing?


texts: How do I insert code block header :var in exported code block in org-mode for SQL

texts: I cannot repeat solution mentioned in 27610 for SQL. Seems there is no org-babel-variable-assignments:sql function in org.el.


texts:
I want to execute R code blocks in org-mode and export the results to a PDF/html.

Here is an example:

Some text here...

#+begin_src R :results output latex
library(xtable)
x <- rnorm(100)
y <- x + rnorm(100)
xtable(summary(lm(y ~ x)))
#+end_src

I want to export the results (here, the output of xtable(summary(lm(y ~ x)))), but I can't figure out how to do it.  When I export it to LaTeX or html, the text and code is exported nicely, but no table is produced in the output pdf / html file. This is the core problem I need help with. How do I get the results to export, and not just the code?

I have tried several experiments but not sure what settings I need to change.

If I execute the code inline (using C-c C-c), I am asked to allow for execution, and when allowed a beautiful LaTeX table is generated below the code as expected. Not sure why this is not happening when exporting to LaTeX or html.
I know that code is executing: If I modify the switches as below and then export to LaTeX/html, an output file is produced with appropriate name, but no results are integrated into resultant LaTeX pdf or html file. The syntax coloring is still present.

#+begin_src R :results output latex :session *myR* :dir "." :file r-output.org
library(xtable)
x <- rnorm(100)
y <- x + rnorm(100)
xtable(summary(lm(y ~ x)))
#+end_src


texts: Prevent org-mode code block background color from bleeding through when collapsed?

texts:
I'm applying a background color to code blocks in org-mode, as shown in this line from my colortheme:

'(org-block ((t (:background "#F5F5F5" :family "Source Code Pro" :height 140))))

When I collapse an item that contains a code block, the code block's background color extends from the end of the item's heading to the edge of the window, which I did not expect -- I expected collapsing the item would hide any evidence of the contained code-block.

Is there any way to prevent the code block background from "bleeding through" like this?


texts: org mode give NAME to clocktable to parse with perl

texts:
I try to give a name to a clocktable :

#+BEGIN: clocktable :scope file :maxlevel 2
#+NAME: d1
#+CAPTION: Clock summary at [2020-04-21 mar. 14:31]
| Headline     |   Time |
|--------------+--------|
| *Total time* | *0:15* |
|--------------+--------|
| t1           |   0:05 |
| t2           |   0:10 |
#+END:

* t1
  CLOCK: [2020-04-21 mar. 14:10]--[2020-04-21 mar. 14:16] =>  0:05

* t2
  CLOCK: [2020-04-21 mar. 14:20]--[2020-04-21 mar. 14:30] =>  0:10

To use it in a perl src block :

* code
  #+NAME: t1
  #+begin_src perl :var d=d1
  $d;
  #+end_src

  #+RESULTS: t1
  | Headline     |   Time |
  | *Total time* | *0:16* |
  | t1           |   0:06 |
  | t2           |   0:10 |

But When I update the clocktable, the #+NAME: d1 disappear. And If I put it before the #+BEGIN line, the perl block do not find the reference.

How could I make the #+NAME line in the clocktable remain after the update of the clocktable ?


texts: Melpa packages are not indexed before manually listing packages

texts:
I recently switched from sublime text 3 to emacs so I still don't quite understand everything. When I launch emacs and run package-install, I can not look up packages from Melpa to install, e.g., projectile. Although once I have ran package-list-packages the list of available packages is refreshed and the packages from Melpa are indexed. Then if I run package-install again, I can find more packages including the ones from Melpa (hence projectile). I have this in my .emacs settings file:

(setq package-archives
  '(("gnu" . "http://elpa.gnu.org/packages/")
    ;; ("marmalade" . "https://marmalade-repo.org/packages/")
    ("melpa" . "http://melpa.milkbox.net/packages/")))

emacs --version returns:

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

I am running this on Ubuntu 18.04.3 LTS.


texts: Insert lines when yanking rectangle rather than inserting among following lines?

texts:
Having copied the 3x3 rectangular region containing a's, how can I yank/paste that content at the desired point without slicing into the following text?  The following is the behavior for:

M-w (kill-ring-save), M-y (kill-ring-save)
(copy-rectangle-as-kill), C-x r y (yank-rectangle)

(all using C-x SPC (rectangle-mark-mode))

aaa
aaa
aaa

Insert
here ->aaa
Here isaaa some text after
the yanaaak point.

I would like to figure out how to yank, so that this is the result.

Insert
here ->aaa
aaa
aaa
Here is some text after
the yank point.

I'll admit that I've been yanking rectangles at the bottom of buffers and then doing a normal region kill for some time now...


texts: How can I quickly enter a directory in helm-find-file when there is only one to select?

texts:
I'd like to quickly go down the file hierarchy and select the following dir when there is only one to select.
There would be two way of doing this :

Stop showing the current and parent dir
Select by default the first normal available file (preferred solution)

It there a way to configure that ?


texts: C-v does not move to the next screen appears: -- VISUAL BLOCK --

texts:
I'm using Emacs on mac, and I just started the tutorial.
When I type C-v I see -- VISUAL BLOCK --, but the tutorial says that it should move to the next screen.

I'm just starting to use Emacs.

What I'm doing wrong?


texts: How to speed up the loading of large hashtables?

texts:
As I understand from the manual (last paragraphs of http://www.gnu.org/software/emacs/manual/html_node/elisp/Creating-Hash.html) and the question https://stackoverflow.com/questions/11745097/ on stackoverflow, one can save a printed version of a hashtable on the disc in order to load it for later use.

For example the printed version of a hashtable created by

(setq ht (make-hash-table :test 'equal))
(puthash "orange" 1 ht)
(puthash "apple" 2 ht)

is as follows

#s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8 data ("orange" 1 "apple" 2))

Is this printed version already the best format (for speed consideration) that Emacs can use ?
Is there an special procedure to re-format (to byte-compile, to change) the above printed format to a better format (maybe only machine-readable) in order that Emacs loads this hashtable faster.
If the answer is affirmative what are the ways to do it.


texts: Setting and clearing an "is-idle" variable when going in and out of idle mode?

texts:
I understand in general about idle timers in emacs, but I'm having trouble figuring out how to do the following ...

I want to set an is-idle variable to t when emacs is in an idle state, and I want that variable to set to nil when emacs is not idle.

Why do I want this? It's because I have written signal handlers for sigusr1 and sigusr2 which get invoked when my emacs process receives either of these external signals. I want the handlers not to run if emacs doesn't happen to be idle at the moment that the sigusr1 or sigusr2 signals are received.

In other words, I want my signal handler to look like this:

(when is-idle
   ;; do all the sigusr1/sigusr2 processing
   ;; ... etc. ...
   )

I haven't figured out how to manage this with an idle timer, nor with any other emacs facilities.

Instead of a variable, is-idle could be a function. I don't really care which it is. I just want to know at the moment that the signal is received as to whether my emacs session is idle or not.

Thanks in advance.

Update ...

I came across the (current-idle-time) function. Here's its doc string ...

Return the current length of Emacs idleness, or nil.
The value when Emacs is idle is a list of four integers (HIGH LOW USEC PSEC)
in the same style as (current-time).

The value when Emacs is not idle is nil.

PSEC is a multiple of the system clock resolution.

I'm going to do some investigation as to whether this function will provide what I'm looking for, and I'll report back.


texts:
For some reason the html/jsx in my react source files always wants to indent as follows, i.e. there is almost no indentation:

return (
  <DateRangePicker ranges={this.state.ranges} startDate={this.state.startDate} endDate={this.state.endDate}
  onApply={this.applyEvent}>
    <Button className="selected-date-range-btn" style={{width : '250px'}}>

    <Glyphicon glyph="calendar"/>

{label}

    </Button>
  </DateRangePicker>
)

What I'd really like is something like the following:

<DateRangePicker ranges={this.state.ranges} startDate={this.state.startDate} endDate={this.state.endDate}
             onApply={this.applyEvent}>
    <Button className="selected-date-range-btn" style={{width : '250px'}}>

            <Glyphicon glyph="calendar"/>

{label}

    </Button>
</DateRangePicker>

This is the indentation I get when I copy the html/jsx to the scratch buffer with html-mode or web-mode enabled. As you can see, the indentation is much more readable and it works like this whether I use html-mode or web-mode.

How can I make my react source files indent the html/jsx like this?


texts: Generate text blob using emacs-lisp in org-mode

texts:
I am trying to write some org-mode text (a bulleted list in this case), and then reuse it at several points in my document when exporting.

I managed to get this working by putting my text inside a source block which babel then evaluates for me, and inserting the result using #+call: lines. (If there is a better way to approach this problem, please let me know!)

I can get the desired result using ruby, but not using emacs-lisp, which inserts quotes and escape characters in my output.

Can anyone help me get this working with emacs-lisp? (I figured emacs-lisp is the best option since it is native to the emacs / org-mode stack, not some external interpreter that has to run, like ruby)

Below is my org mode doc with working ruby setup and failed emacs-lisp attempts, and below that is the output from export to plain text.

This is my Org Mode doc

* Testing export with ruby (is doing what I want)
#+name: generate_text_ruby
#+begin_src ruby :results output verbatim raw
puts %q{+ this is bullet 1
+ and this is bullet two}
#+end_src

This should be followed by two lines of text:
#+call: generate_text_ruby()

This should also be followed by the same two lines:
#+call: generate_text_ruby()

* Testing export with elisp (not doing what I want)
#+name: generate_text_elisp
#+begin_src emacs-lisp :results value verbatim raw
(format "+ This is bullet one,
+ and this is bullet two")
#+end_src

This should be followed by two lines of text:
#+call: generate_text_elisp()

This should also be followed by the same two lines:
#+call: generate_text_elisp()

* I also tried with print
#+name: generate_text_elisp2
#+begin_src emacs-lisp :results output verbatim raw
(print "+ This is bullet one,
+ and this is bullet two")
#+end_src

This should be followed by two lines of text:
#+call: generate_text_elisp2()

This should also be followed by the same two lines:
#+call: generate_text_elisp2()

This is the output from export to plain text:

1 Testing export with ruby (is doing what I want)
=================================================

  ,----
  | puts %q{+ this is bullet 1
  | + and this is bullet two}
  `----

  This should be followed by two lines of text:
  + this is bullet 1
  + and this is bullet two

  This should also be followed by the same two lines:
  + this is bullet 1
  + and this is bullet two

2 Testing export with elisp (not doing what I want)
===================================================

  ,----
  | (format "+ This is bullet one,
  | + and this is bullet two")
  `----

  This should be followed by two lines of text:
  "+ This is bullet one,
  + and this is bullet two"

  This should also be followed by the same two lines:
  "+ This is bullet one,
  + and this is bullet two"

3 I also tried with print
=========================

  ,----
  | (print "+ This is bullet one,
  | + and this is bullet two")
  `----

  This should be followed by two lines of text:
  " \"+ This is bullet one,
  + and this is bullet two\"
  "

  This should also be followed by the same two lines:
  " \"+ This is bullet one,
  + and this is bullet two\"
  "


texts: Narrowing two consecutive trees in org-mode

texts:
It is well known that one can narrow a subtree with Ctrl-xns.

Is it possible to narrow two consecutive trees? How?


texts: Smooth (mouse) scroll for inline images?

texts:
I display images in-line with begin_src & result blocks.

However, for large-images, when I scroll past the bottom of the image, I get a 'jerk' and the whole image is scrolled away. Similarly if I scroll up and run into an image, I get a jerk and see the whole image instead of seeing it incrementally bit by bit.

This makes it hard to work with large plantuml/graphviz diagrams in org-mode.

I would like a smooth scoll experience, to gently scroll past the image like in a web browser, without jerking.

I have tried:

(setq auto-window-vscroll nil)

and also

(setq scroll-margin 1
scroll-conservatively 0
scroll-up-aggressively 0.01
scroll-down-aggressively 0.01)

I tried smooth-scroll package and this snippet also.

However, it seems an in-line image only takes up 'one-line' and fixing emacs to scroll only by 'one-line' doesn't fix the issue.

Any solution to this issue?

[edit]  Keyboard vs Mouse scrolling:

Mouse scrolling is implied. But keyboard scrolling would be a bonus if proper mouse scrolling would work.

[edit]
Somewhat of a workaround, but useful for working with images in org-mode was to open them in an external app that auto-reloads on file change.
Example would be eog (eye of gnome) or shutter or prievew (on OS X). It can be configured via org-file-apps by adding:

extension: \.png\'
Command:   eog "%s"


texts: org mode - export latex inline image to html

texts:
I can see inline image in emacs but when export to html,the image is not displayed. Even if in pdf export, it display a text ([[file:latex.jpg]]) but not the output image.

":exports both" is there but only code exported!

#+HEADER: :headers '("\\usepackage{tikz} \\usetikzlibrary{chains}")
#+BEGIN_SRC latex :fit yes :imagemagick yes :iminoptions -density 300 :exports both :file latex.jpg
\newcommand\ann[3][]{
    \draw[arr,#1,shorten >=1pt,shorten <=1pt] ([yshift=-0.5cm]#2.south) node[below] {#3} -- (#2.south);
}
\definecolor{col1}{RGB} {238,51,34}
\definecolor{col2}{RGB} {153,221,153}
\definecolor{col3}{RGB} {255,255,51}
\tiny\begin{tikzpicture}[start chain=C1 going right,>=latex,node distance=0pt,text height=1.5ex,text depth=.25ex,
box/.style={draw,fill=yellow!5,rectangle, minimum width=.5cm,minimum height=.5cm,outer sep=0},
arr/.style={->,line width=0.2pt}
]
\foreach \val/\col [count=\i] in {1/col1,2/col1,3/col1,6/col2,5/col2,2/col2,4/col3} {
  \node[box,fill=\col,on chain] (N\i) {\val};
}
\ann[black]{N3}{cur};
\ann[black]{N5}{index};
\ann[black]{N7}{key};
\end{tikzpicture}
#+END_SRC


texts: Unwanted concatenation of multiple #+TITLE and #+AUTHOR when using #+INCLUDE

texts:
I have 2 documents, one of which I'd like to include in the other. The first is an assignment sheet, and the second the rubric I'm going to use to grade the assignment. I want to #+INCLUDE the rubric with the assignment so I can discuss it with the class when I assign it, but I have it as a separate file so I can fill out a copy for each student's paper when I'm grading them.

The rubric and assignment sheet both have #+TITLE and #+AUTHOR fields, viz:

ASSIGNMENT SHEET:

#+OPTIONS: date:nil toc:nil num:nil
#+TITLE: Assignment Sheet
#+AUTHOR: me

* heading
#+INCLUDE: "rubric.org"

RUBRIC:

#+TITLE: rubric
#+AUTHOR: me

* content
  some content

When I export assignment-sheet.org with C-c C-e l o the result has both titles and both authors concatenated:

I wish the included file's redundant #+TITLE and #+AUTHOR could be subordinated to the those of the main file. Is there a way to accomplish this?


texts: Disable coloring of text in operations in emacs -nw, during operations like searching

texts:
I'm using gnu emacs as emacs -nw in a terminal window. Colored text is usually almost completely illegible for me. As recommended in this answer, I have done the following in an attempt to get rid of all coloring:

(dolist (face (face-list))
  (set-face-attribute face nil :foreground nil :background nil))

However, I still get colored text when I do operations like searching. For example, if I do control-S, I get a dark blue prompt that says "I-search," and if the search is failing, then the trailing part of the search string is highlighted in pink.

Also, if I start up emacs without giving a filename, there is a help screen with hyperlinks, which are colored.

Is there some way to get rid of these other types of coloring as well?


texts: How can I get superscripts at the beginning of a line in org-mode?

texts:
I'm writing a document (in org-mode) that quotes another document, including its footnotes.  As such, I'd like to have a line like:

#+BEGIN_QUOTE
^123 The contents of footnote 123 go here.
#+END_QUOTE

And have that render as something like:

  ¹²³ The contents of footnote 123 go here.

But what I'm actually getting is:

  ^123 The contents of footnote 123 go here.

I've tried using braces around the numbers, which just gets me this:

  ^{123} The contents of footnote 123 go here.

And that's true even if I also set this option at the top of my file:

#+OPTIONS: ^:{}

If I put something before the superscript, it sort of works – e.g., entering:

.^123 The contents of footnote 123 go here.

... renders (within Emacs, assuming org-toggle-pretty-entities (C-C C-X \) is enabled) as:

  .¹²³ The contents of footnote 123 go here.

Or, in HTML export, gives:

.123 The contents of footnote 123 go here.

which renders similarly (though not identically) to the above, as:

  .123 The contents of footnote 123 go here.

But I don't want that . (or anything else obviously visible) to be there (I might be OK with some whitespace, but I'd prefer not), and I'm not sure what I could put there that would be invisible, yet cause the parsing engine to actually treat things as a superscript, and/or what to do to actually tell the parsing engine to parse superscript indicators that don't have anything before them at the beginning of the line.

I've tried inserting some characters like U+00A0 (C-x 8 RETno-break spaceRET) – which works, but gives a visible space; U+2008 (C-x 8 RETzero width spaceRET) – which doesn't work; and a few other things, but none of the things I've tried so far both works to get a superscript, and leaves the output at the beginning of the line.

As mentioned, I also tried setting the ^:{} option, to no avail.

Is there a way to tell org-mode to parse ^, even at the beginning of a line, as a superscript indicator?  Or at least something invisible I could put in front of the ^ that would cause it to render as superscript, while still visibly rendering as the beginning of the line?


texts:
When I create a new file in a (currently) non-existent directory, the echo area displays:

Use M-x make-directory RET RET to create the directory and its parents

which I plan on doing as soon as skeletons, etc. are inserted.  However, before I have a chance to do so, Tramp decides to make an uninvited entrance:

Password for /sudo:root@localhost:

and the only way to stop it from asking is to use C-g.

Is there any way to tell Tramp to stop doing this?  I don't want to disable Tramp entirely (though I think I did do this at one point until I needed Tramp for something).

My .emacs.d can be found here.


texts: How to set smerge-command-prefix to "\C-cv"

texts:
I find the default prefix for smerge-mode C-c^ and I have following setup:
(setq smerge-command-prefix "\C-cv")
(setq smerge-command-prefix "\C-c\C-v")

Also C-c ^ runs the command icicle-search-keywords (found in icicle-mode-map), so its prefix is overwritten by icicle.
But when I try them, still they are undefined:
C-c C-v is undefined
C-c v is undefined

Is there any way to force to set operation ?


texts: Does emacs supports concurrent sessions of ielm / private session?

texts:
concurrent sessions - two sessions of ielm running independently
private session - running emacs-lisp code without effecting emacs variables/functions


texts: How can I import `.ics` data (from Outlook) to org mode

texts: I want to import .ics files (from Outlook) to my org-agenda. How can I do that? I could find only exporting options.


texts: A build of GUI Emacs for OS X that can display emoji?

texts: Is there a build of GUI Emacs for Mac that can display emoji? I tried this and AquaEmacs but neither of them could display it.


texts: Good way of encrypting org-gcal credentials

texts:
New to emacs. Looking for a good solution for encypting org-gcal client-id and client-secret in my .spacemacs config file.
Here is the current line in user-config (obscuring private information):
  (setq org-gcal-client-id "i-like-spinach-pizza.com"
        org-gcal-client-secret "dont_you?"
        org-gcal-fetch-file-alist `(("wealldo@hotmail.com" . "~/Dropbox/org/exclude-beorg/cal-gmail.org")))

Thank you!


texts: Is there a way to time babel code blocks?

texts:
Is there a way to do something like the example below to time the execution of any babel code block ?

#+BEGIN_SRC sql :timeit
#+END_SRC
#+results 40s
results here

#+BEGIN_SRC python :timeit
#+END_SRC
#+results 40s
results here

Is there something built in or a new package that will give me this functionality.


texts:
Trying to utilize a small screen, and I did this once before, so I know it's possible.

How to hide the username in magit-log so that only the commit message is visible?


texts: Replacing a string with symbols using font-lock?

texts:
I'm trying to make a font lock hook to replace strings of text for a mathmatical notation plugin.

So I'm thinking " / " (note the spaces) will turn into " ÷ ", but "/" won't. (It's a package mainly for R statistical language.)

I'm playing with the examples from the manual and I can't even get that to work lol. I was trying to get the word FIXIT to change font color.

(add-hook 'emacs-lisp-mode-hook
        (lambda ()
        (font-lock-add-keywords nil
            '(("\\<\\(FIXIT\\):" 1
            font-lock-warning-face t)))))

I don't even fully understand the syntax since I'm just getting used to lisp. Does it use a RegEx to identify strings? and if so, what RegEx engine.

I was hoping it would change the font color, but it didnt... but again, that was just me playing with it trying to understand it, not the end goal. The end result would be the first thing I mentioned to change math symbols (" / " into " ÷ ")


texts: How to fix org-dotemacs broken by latest update?

texts:
I'm sorry to have to ask this, but lisp debugging is not one of my strengths. For some time I've been happily using Joe Bloggs's somewhat hoary but useful org-dotemacs.el system to maintain my emacs init settings across several computers. The computers are using Fedora 28.

A standard Fedora update on June 10 broke that. I suspect the offending elements were:

Upgraded emacs-1:25.3-5.fc28.x86_64                         @fedora
Upgrade        1:26.1-1.fc28.x86_64                         @updates
Upgraded emacs-common-1:25.3-5.fc28.x86_64                  @fedora
Upgrade               1:26.1-1.fc28.x86_64                  @updates
Upgraded emacs-filesystem-1:25.3-5.fc28.noarch              @fedora
Upgrade                   1:26.1-1.fc28.noarch              @updates

The emacs init-debug returns this:

    Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  looking-at(nil)
    org-heading-components()
    org-in-commented-heading-p()
    org-babel-tangle-collect-blocks(emacs-lisp)
    org-dotemacs-load-blocks(nil skip)
    org-dotemacs-load-file(nil "~/.dotemacs.org" nil)
    org-dotemacs-load-default()
    eval-buffer(#<buffer  *load*> nil "/home/michael/.emacs" nil t)  ;
    Reading at buffer position 525
    load-with-code-conversion("/home/michael/.emacs"
     "/home/michael/.emacs" t t)
     load("~/.emacs" t t)
     #f(compiled-function () #<bytecode 0x261c1d>)()
     command-line()
     normal-top-level()

Just naively, it looks like the problem is with the use of looking-at in the definition of org-heading-components in the file org.el. (This is org-mode version 9.1.13.)

So, back to the question: has anyone else had this problem, and does anyone have a suggestion as to how to fix it?


texts: Run function after changing buffers with helm-list-buffers

texts: helm-list-buffers brings up a list of buffers to select. I'd like to run a function after buffer selection. What's the method to do this?


texts:
I need to check numbers in a buffer each on a line against an external paper sheet
To make this easier I would like to make the window very narrow to see only one (or max. two) lines. However shrink-window stops at three lines.
Any way to overcome this limitation of shrink-window?


texts: How to insert text immediately before a link (at the start of a line) in org mode?

texts:
Consider the following org buffer test.org:

H

[[My Target][jump to my target]]

<<My Target>>

If I run org-toggle-link-display on this buffer I get:

If I now move the cursor down to the "j" in "jump to my target" and try to insert a text (note: this text should not be part of the link), the text is gobbled up as part of the link. If I try press ENTER at beginning of the link, the newlines are also included in the link. Is there a way to insert text before a link (that is not to be part of the link text) at the beginning of a line without running org-toggle-link-display first?

Note: One trick could be to insert text at the previous line and then press the delete key, but this does not work if the link is the first line of the buffer.


texts: How to automatically set default-directory to projectile-project-root?

texts:
emacs beginner here. I would like for the default-directory of any buffer that's part of a projectile project to be the project root. For example if I'm editing include/my_file.hpp and I do:

:e src/my_file.cpp

emacs will try and create include/src/my_file.cpp, which is obviously not what I want. Can I force emacs to use the project root dir as the default-directory? Maybe using a hook of some kind?


texts: How to open a external terminal from emacs

texts:
Brand new emacs user here.

I want to have the ability of opening a terminal with current file path from emacs, like what the open terminal here package does in sublime text 2.

By terminal, I mean a separate external terminal emulator running bash or zsh, like gnome-terminal, not the emulated shells inside emacs, like M-x shell M-x eshell, which I can't appreciate for now.

I googled but had nothing found... It seems that emacs guys really enjoy living in emacs.


texts: How to extract an image from an email in Gnus?

texts: A friend sent me an email with a JPEG photo in the middle of the text. The picture is so big, most of it is outside the screen and I want to view it with an outside image viewer and not in Gnus. How do I save an image that is included in the email in Gnus, if it's not just an ordinary attachment?


texts: Change doc string summary of a function on the fly

texts:
Is it possible to change the first line of a docstring of a function, without editing the source code of this function? And if, how can I do this?

Background: some packages come with a pretty useless doc string summary.
(for example, fci-mode: "Toggle fci-mode on and off.").

Because I have some helper commands, which show this summary, I'd like to exchange the docstring summary of those functions to something more useful (or even translate them to my mother tongue), without touching the source code of those packages.


texts: how can I debug or fix slowness in org-cycle?

texts:
running org-cycle appears to hang sometimes. I've run

M-x profiler-start
<tab> ;; bound to org-cycle
C-g ;; to cancel apparently-hung command
M-x profiler-report

and I see that a bunch of time is spent deleting from some cache

- command-execute                                                5756  75%
 - call-interactively                                            5756  75%
  - funcall-interactively                                        5694  74%
   - org-cycle                                                   5684  74%
    - org-cycle-internal-local                                   5684  74%
     - org-show-entry                                            5684  74%
      - org-cycle-hide-drawers                                   5684  74%
       - org-element-at-point                                    5684  74%
        - org-element--cache-sync                                5684  74%
         - org-element--cache-process-request                    4206  55%
          - avl-tree-delete                                      3756  49%
           - avl-tree--do-delete                                 3627  47%
            - avl-tree--do-delete                                3244  42%
             - avl-tree--do-delete                               2830  37%
              - avl-tree--do-delete                              2203  28%
               - avl-tree--do-delete                             1607  21%
                - avl-tree--do-delete                            1217  15%
                 - avl-tree--do-delete                            674   8%
                  - avl-tree--do-delete                           326   4%
                     org-element--cache-compare                    83   1%
                     avl-tree--do-delete                           16   0%
                    org-element--cache-compare                     67   0%
                   org-element--cache-compare                     127   1%
                  org-element--cache-compare                       76   0%
                 org-element--cache-compare                       151   1%
                org-element--cache-compare                        159   2%
               org-element--cache-compare                          61   0%
              org-element--cache-compare                           85   1%
   + execute-extended-command                                      10   0%
  + byte-code                                                      62   0%
+ ...                                                            1887  24%
+ eldoc-schedule-timer                                              1   0%
+ timer-event-handler                                               1   0%

how can I dig into this further?


texts: How can I disable quail input methods in LaTeX formulas?

texts:
If you set an input method (for example via M-x set-input-method RET cyrillic-translit RET) you can type Cyrillic characters using a US keyboard: Emacs will use transliteration rules to convert Roman characters into Cyrillic ones. If you look in cyrillic.el, you see for example ("f" ?ф), i.e., typing f gives ф.

Now imagine you are editing a LaTeX file and LaTeX-mode (AUCTeX) in enabled. You use Cyrillic characters in the body of the text and Roman characters in formulae. In this context you would like  f to produce f and not ф in math mode, (i.e. in $...$, \[...\], \(...\), and in math environments).

If I understand the question how to detect if inside a LaTeX math environment? and this answer correctly, the function texmathp can detect if we are in a math environment.

My question is about the possibility of the following conditional transliteration using quail

  typing f gives f inside a LaTeX math environments and ф elsewhere.


texts: How to export LaTeX from org-mode to HTML using dvipng instead of mathjax GLOBALLY?

texts:
The doc string for org-export-with-latex describes how to select mathjax, verbatim output, or not to export LaTeX at all, although it goes further to say:

  If you prefer, you can also request that LaTeX fragments are processed
  into small images that will be inserted into the browser page.

But no value is actually listed for requesting that.  I've tried setting org-export-with-latex to 'dvipng and "dvipng", with no success either way.

The only way I've obtained the desired result is with #+OPTIONS: tex:dvipng.  Unfortunately, that method would require modifying each and every org-mode file.

What's proper way to specify the dvipng export mechanism globally?

Note: Actually, no value for org-export-with-latex seems to have any effect.  Without #+OPTIONS: tex:dvipng, I always get mathjax, unless I set org-html-mathjax-template to "", in which case I get verbatim-style output -- again, regardless of the value of org-export-with-latex.

Emacs 26.1, org 9.1.14


texts: Is it possible to use both MELPA and MELPA-stable at the same time?

texts: I use melpa-stable as an additional package repository, but one of the packages I like to use (icicles) isn't available on melpa-stable. Is there any way to configure package.el to normally use melpa-stable, but use melpa for a specific subset of packages?


texts: Highlight as Comment if character is not present

texts:
I am writing a simple syntax highlighting mode for a special file type. In the syntax, a line is only valid if it starts with a & character, otherwise it is treated as a comment (basically it is an 'inverse' comment).

Is there a way of implementing this?

I am by no means a lisp expert (only ever glue bits of code together to get what I want), so looking for answers has been difficult.


texts: Error: No word lists can be found for the language "en_US"

texts:
I am using GNU Emacs 26.1 on macOS Catalina.

When I try to enable ispell or flycheck-mode I am getting following error:

No word lists can be found for the language "en_US".

=> How could I fix this error?


texts: org-mode: any way to automatically collapse "blocks" (e.g., BEGIN_QUOTE)?

texts:
When opening an item, any BEGIN_QUOTE ... END_QUOTE blocks are automatically expanded.  Is there any way to keep them collapse, and only expand if I consciously TAB on that block?

Ref: https://www.gnu.org/software/emacs/manual/html_mono/org.html#Paragraphs


texts: AucTeX doesn't seem to be aware of my TeX-view-program-list

texts:
I wanted to set up auctex to use mupdf as the pdf viewer it ran when I do C-c C-v. So I customize-variable on TeX-view-program-list to include a line for MuPDF and customize-variable on TeX-view-program-selection to select MuPDF. But when I run C-c C-v, I get the error: Cannot find "MuPDF" viewer. My .emacs contains the following relevant lines:

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-view-program-list (quote (("MuPDF" ("mupdf %s.pdf") ""))))
 '(TeX-view-program-selection
   (quote
    (((output-dvi has-no-display-manager)
      "dvi2tty")
     ((output-dvi style-pstricks)
      "dvips and gv")
     (output-dvi "xdvi")
     (output-pdf "MuPDF")
     (output-html "xdg-open"))))

So what on earth is going on!? getenv PATH returns a list of paths that includes the location of mupdf, but I don't think that's relevant since the error has "MuPDF" capitalised... Pretty much exactly the same set-up works fine on my laptop.

I'm on emacs 24 (installed with the package manager on ubuntu) and auctex 11.90.0 (installed through emacs with list-packages)


texts: How to open a file with emacsclient from Thunar?

texts:
I want to use emacsclient to open files from Thunar in Linux Mint 17 xfce.
I have tried right-click+"open with other application"+"emacsclient -c", but this does nothing.

I have also tried writing a custom emacsclient.desktop launcher.
Emacs daemon is running and works when emacsclient is invoked from the terminal. Also, using just "emacs" as the preferred program works.
Can this be done in Thunar?


texts: Force org-babel-load-file to execute every time emacs is loaded

texts:
I have this code in the init.el file:

  (org-babel-load-file (expand-file-name "myinit.org"
  user-emacs-directory))

Which used to generate a myinit.el file every time I start emacs.
I would sometimes change the main myinit.org file, load a new emacs and check the effect of the change.

After updating org I noticed the myinit.el is not loaded with new changes in myinit.org anymore and I have to delete the (myinit.el) file then start emacs to force loading it.

Is there a way to always load a new myinit.el file when starting an emacs instance? Is this the right way to do it? why did the original behavior change after I updated org?


texts: Some warnings and unexpected indentation with SMIE

texts:
I'm trying SMIE to describe the Nix language. Unfortunately when I use it, I have the following problems:

There are 4 messages saying: Warning (smie): token } is both closer and neither. Which I do not understand.
A message asks you for a comment syntax : but the syntax table has a comment character. So again, I don't understand
If you enter # as comment character, you will see that indentation is 28 instead of the expected 2.

I put all my code on Github | nix-mode. You can reproduce by cloning the repository, running cask and then running cask exec ecukes.

Here is the SMIE grammar for Nix:

(defvar nix+-smie-grammar
  (smie-prec2->grammar
   (smie-bnf->prec2
    '((id)
      (expr (exprfunction))
      (exprfunction ("{" formals "}" ":" exprfunction)
                    (exprassert))
      (exprassert ("assert" expr ";" exprassert)
                  (exprif))
      (exprif ("if" expr "then" expr "else" expr)
              (exprop))
      (exprop ("!" exprop)
              (exprop "==" exprop)
              (exprop "!=" exprop)
              (exprop "&&" exprop)
              (exprop "||" exprop)
              (exprop "->" exprop)
              (exprop "//" exprop)
              (exprop "~" exprop)
              (exprop "?" id)
              (exprapp))
      (exprapp (exprapp "." exprselect)
               (exprselect))
      (exprselect (exprsimple))
      (exprsimple (id)
                  ("true")
                  ("false")
                  ("null")
                  ("(" expr ")")
                  ("{" binds "}")
                  ("let" "{" binds "}")
                  ("rec" "{" binds "}")
                  ("[" exprselects "]"))
      (binds (binds ";" binds)
             (bind))
      (exprselects (expreselect))
      (bind (id "=" expr)
            ("inherit" exprp))
      (exprp ("(" expr ")"))
      (formals (formals "," formals)
               (formal))
      (formal (id)
              (id "?" expr)))
    '((assoc ";"))
    '((assoc ","))
    '((assoc "==")
      (assoc "!=")
      (assoc "&&")
      (assoc "||")
      (assoc "->")
      (assoc "//")
      (assoc "~")
      (assoc "?")
      (assoc "!")))))


texts: emacsclient to access remote emacs server

texts:
I'm trying to open an emacsclient session from a remote host. I walked through the following steps on the tramp website How can I use TRAMP to connect to a remote Emacs session?.

I'll walk you through the step

on the remote host put in .emacs file

(require 'server)
(setq server-host "<IP ADDRESS of remoteHost>"
      server-use-tcp t)
(server-start)

start emacs session on remote host
copy the ~/emacs.d/server/server from remoteHost to localHost keep the same path. (localHost:~/emacs.d/server/server)
on local host emacs shell

emacsclient  /ssh:test@remoteHost:/tmp/test.py

But got the following error on my localHost

;; emacsclient: can't find socket; have you started the server?
;; To start the server in Emacs, type "M-x server-start".
;; emacsclient: connected to remote socket at `Remotehost`
;; emacsclient: connect: No route to host
;; 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)

So it seems to connect to remoteHost but cannot find a route. Similar questions have been ask on SO.  Here and here. There are also some nice code about copying directly the ~/.emacs.d/server/server from remoteHost to localHost here.

Any help will be greatly appreciated.

Update
I have gathered some more information about the matter. It's seem that a number of people have attempted this task and some seems to have succeeded but I could find any solution to my specific problem.
Using Emacs server and emacsclient on other machines as other users

Similar questions have also been ask on emacs.stack.exchange like
how-do-i-use-emacsclient-to-connect-to-a-remote-emacs-instance

Update1

There is an interesting post here forwarding graphics with ssh. It's easy to implement and  works pretty well if your connection is good enough but it does not make use of tramp.


texts: How can I draw in unicode with artist-mode?

texts:
I'd like to produce unicode art with artist-mode. But it appears that artist-mode only supports ASCII art.

How can I configure artist-mode to produce instead of

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

this

  ┌───────────────┐
  │               │
  │       ┌───────┼──┐
  │       │       │  │
  │       │       │  │
  │       │       │  │
  └───────┼───────┘  │
          │          │
          │          │
          │          │
          └──────────┘


texts:
If you type C-c C-k (to abort a capture process, for example), you get a C-c C-v instead. It's like for this particular shortcut combo, Emacs interprets the hard key codes instead of the Dvorak layout on top (FYI: pressing v on a standard keyboard produces the key k with the Dvorak layout). I think the problem lies with Emacs since even the mini buffer shows it as C-c C-v. At any other time, my k key works just fine on its own (including any other shortcut other than C-c C-k C-k generally trenslates to C-v).

Have any other Dvorak user encountered this problem? How did you fix this? I want to make sure I'm not the only one, because if I am, it is probably not a bug.

I'm on Emacs 24.5.1.

Update: I just noticed an old piece of Autohotkey script that was mapping Ctrl+k to Ctrl-v. So the problem was Emacs unrelated.


texts:
How to quickly remove this bit

#+RESULTS:
:RESULTS:
20
21
22
23
24
...

when working in org mode?


texts: Is there a variable to toggle Emacs 24.4 elisp return "noise"?

texts:
In Emacs 24.4, every time I evaluate a form in ielm or using C-x C-e it prints a lot of extraneous output that while useful, sometimes gets in the way. As an example,

(+ 1 1)
;=> 2 (#o2, #x2, ?\C-b)

Is there a variable I can use to disable printing this extra information and have it just display 2 like it used to?


texts:
How may I call untabify against a rectangular region?

This screenshot illustrates what I am trying to accomplish.  I have a messy mixture of tabs and spaces in the region I have circled.  untabify will fix it, but I don't want to eliminate the tabs on the left of each line.  Those are fine.


texts: What is a better way to write this function?

texts:
(cl-defun filename-from-buffer (&key get-ext get-path)
  (let ((filename (buffer-name))
        (pathname (buffer-file-name)))
    (setq ret (car (split-string filename "\\.")))
    (when get-path
      (setq ret (car (split-string pathname "\\."))))
    (when get-ext
      (setq ret filename))
    (when (and get-ext get-path)
      (setq ret pathname))
    ret))

I am fairly new to Emacs and Lisp (eLisp) and I wanted a function that would return the name of the file which is open in the current buffer. The function should take some optional arguments determining whether we want the full path, the extension or just the sole name of the file.

I feel like my implementation is pretty naive and it depends on the order of lines as well because I could not figure out how to do an if-else chain and return within. So is there a more elegant/more secure or just a better way to do this? By better, I mean something that uses the functionality of language which is already provided, an implementation that does not depend on the order of cases and/or something that does branching in a better way.


texts: Use multiple cursor if region is active, otherwise use CUA, how?

texts:
I’m trying to implement this when I press C-return:

If there’s an active region, it activates multiple cursors by calling
mc/edit-lines
If there’s no active region, it initiates rectangular selection by
calling cua-rectangle-mark-mode.

Here’s the code I wrote:

(defun cua-or-multicursor ()
  (interactive)
  (if (use-region-p)
      (progn
        (message "Using multi cursor~~") ;; For debug
        (mc/edit-lines))
    (progn
      (message "Using cua...") ;; For debug
      (cua-rectangle-mark-mode))))

(global-set-key (kbd "C-<return>") 'cua-or-multicursor)

The cua part of it seems to work appropriately.  The problem is the multiple cursors part.  I selected for example 2 lines (by setting the mark and moving down once), and pressed C-return, it prompted me whether I wanted to call cua-rectangle-mark-mode for all lines. I said yes.  Then I started moving my cursors (it did give me 2 cursors), and I saw that the 2 cursors left a region behind them (which doesn’t happen if I just bind mc/edit-lines to C-return), just like if I set the mark and then move my cursor.  Here’s what I mean:

In the message buffer it said

Mark set
Using multicursor~~
Using cua...
Mark set
C-?:help M-p:pad M-o:open M-c:close M-b:blank M-s:string M-f:fill M-i:incr M-n:seq

It seems cua-rectangle-mark-mode is called right after multiple cursors…  Any idea on why this would happen?

BTW I have GNU Emacs 24.4.1 on a Mac.


texts: How to check if two lists share any elements?

texts:
Besides looping over list items and comparing, what is a good way in elisp to check if there are any shared items between two lists?

For example, in Python this can be done with sets or list comprehension.

a = [1, 2, 3]
b = [3, 5, 0]

items_shared = bool(set(a) & set(b))

Or by checking in a loop.

items_shared = any(True for v in a if v in b)

Edit: for the purpose of this question, the same comparison rules for memq seem reasonable.


texts: How to wrap a single string literal across multiple lines?

texts:
Is it possible to write a single line for an Elisp string:

"hello world"

As:

"hello
world"

Without inserting a newline character? (wrapping a string literal).

I read that adding a tilde at the end of the line does this in some lisp's, but its not working for me.


texts:
Is there any way to enable the following behavior. Let's say i have some code:

def main(args: List[String]): Unit = {

}

Of cause the blank line between braces is indented, but when i move cursor to that position i need to hit tab to place it on the proper column according to my indentation settings, can i enable such behavior by default? E.g in the given example, if i move cursor up or down, the cursor would be in this position:

def main(args: List[String]): Unit = {
|
}

But i want it to be in this:

def main(args: List[String]): Unit = {
  |
}


texts: How to run a previous unique command in an Emacs shell (without repeats)?

texts:
In Emacs shell, is there a command similar to M-p but which would skip repeated commands? That is, it would go to the next different command. Similar to regular Linux terminal.

So if I were to run:

ls
./script
./script
./script
make

and press M-p three times, I want it to go to ls command.

Or, alternatively, how can I define a command like this?


texts: Override per-directory settings on a file type basis

texts:
I'm using dir-locals-set-class-variables in my git directories to apply whitespace-mode settings differently, based on the needs of each repo. if my sf directory, for all subfolders, I want to use tabs for spacing. But for markdown files inside those directories, I want to continue to use spaces instead of tabs.

Is there a way to apply an even more granular override so that in directories where I'm applying this setting:

(dir-locals-set-class-variables 'sf
                                '((nil . ((whitespace-style . (empty
                                                               face
                                                               indentation empty
                                                               lines-tail
                                                               space-after-tab
                                                               space-before-tab
                                                               trailing))
                                          (indent-tabs-mode . t)
                                          (tab-width . 4)
                                          (tab-stop-list . (number-sequence 4 200 4))
                                          ;; (indent-line-function . 'insert-spaces)
                                          (sgml-basic-offset . 4)))))

that I could then have markdown files to use spaces versus tabs?


texts: Package for live inline rendering for markdown/org mode text with css styling?

texts:
Currently, I use Typora (a markdown editor) for all my personal notes and documentation. After seeing the capabilities of emacs in a colleague's spacemacs setup, I am very interested in switching from writing personal documentation in markdown to org-mode. But are there are emacs packages/plugins that can match the following two Typora features?

Is there an emacs plugin for live, inline rendering of org-mode or markdown text with css themes? By "inline" rendering, I mean markup is rendered in the same window that you type in (see gif below)

Is there a way to render images inline in org-mode documentation?


texts: MAGIT: "precomposed unicode is not supported"

texts:
I am trying to commit in my Emacs folde, and I get this message below:
"precomposed unicode is not supported".

I have run on my Terminal "git config core.precomposeunicode false" but the problem persists after restarting Emacs. Anybody with the same problem and a solution? Thanks!


texts: Determine a position of the Org Mode code block?

texts:
In my Org Mode document I have the following two blocks

#+NAME: fcn
#+BEGIN_SRC elisp :var pt=(point)
  (list pt (point))
#+END_SRC

#+RESULTS: fcn
| 56 | 56 |

#+NAME: second_block
#+BEGIN_SRC elisp :var a=(point) b=fcn(pt=(point))
  (list a b)
#+END_SRC

#+RESULTS: second_block
| 213 | (13 13) |

I want to determine a position of the second_block and pass it to fcn.  As a result of the second_block I am expecting to obtain something like this

| XYZ | (XYZ 13) |

where XYZ is a position of the second_block (it can be any point that belongs to the second_block: ultimately XYZ should work with property API functions as a POM).

Moreover, I would like to have a solution that works independent of the current cursor position. For instance It should work properly also when the cursor position doesn't point to the second_block, for example after executing all code blocks in current buffer (with C-c C-v b). In this context the point function might be incorrectly applied here, which I am aware of.

Secondly, why is b variable equal to (13 13) after execution of the second_block?


texts: How can I move point to where the mouse is pointing now

texts:
I want to move point to where the mouse is pointing. This is easy to do interactively: just click and point will move to where the mouse is pointing.

However, I need to do this inside elisp code. I tried to find a nice way by inspecting the source for mouse-drag-region and by reading the manual on Mouse Position but did not manage :-(

Anyone has an elegant solution?


texts: How to highlight text permanently in org-mode

texts:
I know I can use *bold*, /italic/, _underlined_, =verbatim= and ~code~, and, if you must, ‘+strike-through+’ to do some markup to text according to org-mode documentation, but they are not enough for me(bold is not obvious when viewing the org file), I know I can customize org-emphasis-alist, but the documentation doesn't tell much. What I want is to highlight the text selected like enriched-mode like the image in this page.

But enriched-mode will save the file as text/enriched format, and I have to use enriched-mode not org-mode itself.

So, how can I re-define or define a new markup(maybe customize org-emphasis-alist) to highlight text like enriched-mode, so

the highlight is permanent in this file(I can see the highlight in Emacs)
at the same time it can be exported into pdf or html file.


texts:
I'm beginning to think that dired (+ extensions) is the file browser I've always been looking for. Under Windows, however, dired does not allow to switch to other drives easily. While most things are happening within one drive anyway, sometimes I would like to able to switch to some USB-drive, for example. But, in order to get there, I have to know the drive letter and put it in manually with find-files.

Is there a better ways to see, and switch between, drives under windows?


texts: Evaluating symbol in function arguments affected by destructive operations?

texts:
While evaluating a function call, the arguments is from left to right. For example,

(let ((x '(1 2 3)))
  (list (nreverse x) x))
;; => ((3 2 1) (1))

The first argument (nreverse x) evaluates to (3 2 1), as a side effect, x is changed to (1), then the second argument x evaluates to (1). So the result is expected. However,

(let ((x '(1 2 3)))
  (list x (nreverse x)))
;; => ((1) (3 2 1))

The result is more or less surprising for me. Because the first arguments x evaluates (1 2 3), then the seconds arguments (nreverse x) evaluates to (3 2 1). The Edebug also follows the flow, thus one might get wrong assumption.


texts: How can I kill a line after a certain character?

texts:
Each line in my file has a character ; followed by information that I want to delete. What is the best way to do it?

Example:

I like phat beatsies; but Mark does not like them
I also like dogsies;  irrelavant information

should become

I like phat beatsies
I also like dogsies


texts: Setting `scroll-margin` for `term-mode` using `unless` is not working

texts:
I want to set default value of scroll-margin to 3 but for ansi-term I want it to be 0. To do this I have added a hook to term-mode-hook which worked fine.
(setq scroll-margin 3)
(add-hook 'term-mode-hook
          (lambda ()
            (make-local-variable 'scroll-margin)
            (setq scroll-margin 0)))

But earlier I used unless to do the same thing which didn't work and I don't understand why. Could someone please help why below snippet didn't work to do the same task?
(unless (derived-mode-p 'term-mode)
  (setq scroll-margin 3))


texts: Org-Mode not exporting all child subheading

texts:
While exporting following sample org file content to html, final output skips headings from 3rd depth in table of content.

After reading org documentation, and forum questions, I tried following, but still no luck in exporting all sub headings.

Changed org-imenu-depth to 4
Changed imenu-auto-rescan to a non-nil value
Chanaged imenu auto rescan maxout to 600000 as file size is 400 KB.

Sample:

* Head 1 shown
* Head 2 shown
** Head 2.1 shown
*** Head 2.3 not shown
* Head 3

Emacs version: GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30

Org mode 9.1.9


texts:
I am exporting a webpage with a checklist using org-html-export-to-html. But in my perspective, the red "TODO" word doesn't make too much sense in the html. Is there a way to export it in a cleaner way?
Thanks

Update

I just discovered that you don't even need the word TODO in the header to have the checklist working.


texts: org-insert-link sometimes produces "wrong type argument: stringp, nil" after prolonged use of emacs

texts:
It usually happens after a couple of days of use that C-c C-l / org-insert-link inside .org files does not allow me to insert new links anymore.

What I want to do is interactively insert link description and URL. I usually don't work with stored links via C-c l. This time, though, I tried to store a link and see  if it fixes the problem. It doesn't. The debug output:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("^file:\\(.+\\)::" nil)
  #f(compiled-function (l) #<bytecode 0x411d16ed>)((nil ""))
  mapcar(#f(compiled-function (l) #<bytecode 0x411d16ed>) (("file:~/Pending/org/gtd/privat.org::*Brackweder Baugenossenschaft" "Brackweder Baugenossenschaft") (#("file:/tmp/test.txt::Hello" 20 25 (fontified t)) nil) ("file:~/Pending/org/gtd/privat.org::*Foci" "Foci") (#("file:~/Pending/org/gtd/dev.org::as" 32 34 (wrap-prefix #("        " 0 7 (face org-indent) 7 8 (face org-indent)) line-prefix #("        " 0 7 (face org-indent)) fontified t)) "transition to CalendarView framework") ("file:~/Pending/org/gtd/dev.org::*add app icon" "add app icon") (nil "") (nil "")))
  org-link-fontify-links-to-this-file()
  org-insert-link(nil)
  funcall-interactively(org-insert-link nil)
  call-interactively(org-insert-link nil nil)
  command-execute(org-insert-link)

The value of org-stored-links:

(("file:~/Pending/org/gtd/privat.org::*Brackweder Baugenossenschaft" "Brackweder Baugenossenschaft")
 (#("file:/tmp/test.txt::Hello" 20 25
    (fontified t))
   nil)
 ("file:~/Pending/org/gtd/privat.org::*Foci" "Foci")
 (#("file:~/Pending/org/gtd/dev.org::as" 32 34
    (wrap-prefix
     #("        " 0 7
       (face org-indent)
       7 8
       (face org-indent))
     line-prefix
     #("        " 0 7
       (face org-indent))
     fontified t))
   "transition to CalendarView framework")
 ("file:~/Pending/org/gtd/dev.org::*add app icon" "add app icon")
 (nil #1="")
 (nil #1#))

org-insert-link works when the insertion point is inside an existing [[...]] link
org-insert-link works interactively in non-.org file buffers

So:

Does the debug output indicate that passing the result of mapcar to org-link-fontify-links-to-this-file() returns nil?
Is there a value in my org-stored-links that is faulty? (How can I prevent this from happening?)


texts:
Is there any packages or extension that will save a file history when you save the file?

Example when I save the file it will create a file history of the file and on the later time when I save it again, it will create another history of it.

It look like something a snapshot of file save or a backup.


texts: "Void function definition" error when I press key bound to it

texts:
I added this function to my ~/.emacs file and run it by entering M-x my-turn-current-window-into-frame RET.

I added the following to my ~/.emacs file after that function:

(global-set-key (kbd "<f12>") 'my-turn-current-window-into-frame)

I copied that line to *scratch* and evaluated it.

When I press F12, Emacs returns:

Symbol's function definition is void: my-turn-current-window-into-frame

How can I configure a hot-key to run this function?


texts: org-mode: image file names in LaTeX export when using INCLUDE

texts:
When using INCLUDE in an org-file:

#+INCLUDE: preamble/preamble.org

..and referring to an image in the included file..

* Preamble

Look at this amazing image:
[[./figure1.png]]

and then generating LaTeX for the top-level file, the resulting TeX is:

\part{Preamble}
\label{sec:orgheadline3}

Look at this amazing image:

\includegraphics[width=.9\linewidth]{./figure1.png}

i.e., the path to the image is relative to the preamble directory, but the .tex file is one level up.

Is there a way to fix that (so that includegraphics refers to preamble/figure1.png)?


texts: Speedbar: Colored entries using imenu-generic-expression

texts:
I would like to search for certain doxygen like pattern in my files and then add corresponding entries to a speedbar for easy browsing. Some of these entries I want to have colored in red.

I figured out that I can use imenu-generic-expression to easily add entries to my speedbar:

(require 'speedbar)
(speedbar-add-supported-extension ".foo")

(add-hook 'foo-mode-hook
          (lambda ()
            (setq imenu-generic-expression
                  '(("BARS" "@bar\\s-+\\(.*\\)" 1)
                    ("FOOS" "@foo\\s-+\\(.*\\)" 1)))
            ; no auto-grouping
            (setq speedbar-tag-hierarchy-method nil)
            (imenu-add-to-menubar "FOO")))

But how can I get the colors?


texts:
How can I randomize headers in org mode?

e.g. If I had a list like this, :

* apple
  1
* lemon
  2
* banana
* orange

How can I randomize those headers and get lists like these?:

* lemon
  2
* apple
  1
* orange
* banana

or

* orange
* lemon
  2
* banana
* apple
  1

(I'm planning to randomize a much longer list.)


texts: Defining a generic function and implementing specialised methods

texts:
Emacs provides support for polymorphism, supporting "generic functions", like in CLOS.
According to Emacs manual:

  A generic function specifies an abstract operation, by defining its
  name and list of arguments, but (usually) no implementation.  The actual
  implementation for several specific classes of arguments is provided by
  "methods", which should be defined separately [...]
  by “specializing” the arguments defined by the generic function.

Unfortunately the manual does not give practical examples of a methods implementation once a generic function is defined.
Can you give such an example, implementing the standard OO paradigms through cl-defgeneric/cl-defmethod?


texts:
I have a list of items.

* Heading 1
1. Item
2. Item

* Heading 2
1. Item
2. Item
3. Item

Is there an easy way to make the numbers run across the headings like this?

* Heading 1
1. Item
2. Item

* Heading 2
3. Item
4. Item
5. Item


texts:
Is there a "read only mode" in mu4e? I recently had the case to use mu4e to read emails from a system using thunderbird with maildir. I noticed that for example a file called somemessage.eml was renamed by mu4e to somemessage.eml:2,S. Then I noticed that thunderbird couldn't read this message anymore.
After renaming it back, thunderbird was able to read it again.
So, is there a way to prevent mu4e to interfer with thunderbird in this case, for example by setting it into a read only mode?


texts: Keyboard equivalent of left mouse click in org mode

texts:
Is there a keyboard equivalent of left mouse click in emacs?

Use case here is an .org file I have which contains a no. of URLs

I can left click on those URLs to have them open in a browser

I was wondering whether there was a combination of key presses that would achieve the same, so I don't have to reach for the mouse?


texts: Is Notifications on File Changes supported on Mac OS X? I can't seem to find any documentation about how to do this anywhere.


texts: How to set the region (selection) programmatically in Emacs Lisp using indices?

texts:
Given 2 absolute numbers (compatible with region-beginning, region-end).

How can these numbers be used to set the selection?

Edit: If you use evil mode you may want to check this question, at the time of asking I wasn't aware this required a different method in some cases.


texts:
If I am editing a .tex file in emacs, by default (for me) the bottom right corner of the frame will say "LaTeX/P". However, I won't get to that mode by typing "M-x LaTeX/P-mode"; I can only get to it by typing "M-x latex-mode".

Other than Googling it, how am I supposed to know the thing I type to get to that mode is "latex-mode"?


texts: How to get Emacs to know that a symbol has a function definition

texts:
While reading the source file prelude-ivy.el in the Prelude modules directory, I saw that there was a warning associated with "here" in the last line, specifically that prelude-required-packages was not known to be a defined function.

I recognize that this is not exactly devastating but I am curious to understand better how to make a symbol "known to be defined" as a function.  I tried a few things, like (require 'prelude-packages) but only moved the harmless warning around. I'm guessing that if I understand why this warning is being reported, a fix will be readily evident.


texts:
I often use org-links in headings, e.g.:

*** Heading [[foo]]
**** Subheading [[bar]]

And I use different font-sizes for different levels.

Now, I would like the face of the link to be of the same font-size as the heading's. Is that possible?

I tried using :inherit but that's not working.


texts: Package manager: which files not to add to git?

texts:
I'm keeping my config-files in a git repository to use it on multiple different machines. I'm using the emacs package manager, but I don't want to add the packages to git, because which packages have to be available differs from machine to machint.

Short question: which folders and files do I have to exclude from the repository?


texts: How to use keyword symbols in Emacs Lisp?

texts:
According to Symbol Type

A symbol whose name starts with a colon (‘:’) is called a keyword symbol. These symbols automatically act as constants, and are normally used only by comparing an unknown symbol with a few specific alternatives. See Constant Variables.

I understand they are constants, but I don't know to use them. For example, how to set its value(constants also have a value!), how to get its value, and when should I use them. I tried to use them as follows:
(defun test-func (:test-symbol)
  (print :test-symbol))
(test-func "hello")

I got an error:
Attempt to set a constant symbol: :test-symbol

Could anyone give me an example?


texts: Interpolate environment variables in string

texts:
I am trying to write a function that will interpolate the enviroment variables stored in process-environment in a string. For example, if I have the string "This is $Foo and ${Bar}_none and '$skip'" and process-environment containing '("Foo=off" "Bar=rab" "skip=piks") I would expect the resulting string to be "This is off and rab_none and 'piks'". However none of the options I have tried seem to respect the caller environment. I have tried

(shell-command-to-string (concat "echo -n " string))

and

(let ((env process-environment))
  (with-output-to-string
    (with-current-buffer standard-output
      (let ((process-environment env))
        (call-process-shell-command (concat "echo -n " string) nil t)))))

but neither of those work (they interpolate, but they don't use process-enviroment). Is there a way to accomplish this?


texts: helm-mini - narrow down to buffers selection with specified major mode

texts:
currently, to narrow down the buffers withshell mode, I'd invoke helm-mini, and then type "shell". I wonder
   how can I narrow down the selections using lisp? So I could have a
   function with a list pre-defined groups for quickly jumps between buffers.

It would be handy if I work in a R/Python projects.


texts: No server remain buffer to edit for org-capture-extension

texts:
Update: I have fixed it, seem like we need stranform-square-bracket-function to due with "p" protocal
(use-package org
  :hook
  (org-mode . turn-on-visual-line-mode)
  :config
  (setq org-directory "~/org/capture/")
  ;; Capture templates for links to pages having [ and ]
  ;; characters in their page titles - notably ArXiv
  ;; From https://github.com/sprig/org-capture-extension
  (require 'org-protocol)
  (defun transform-square-brackets-to-round-ones(string-to-transform)
    "Transforms [ into ( and ] into ), other chars left unchanged."
    (concat
     (mapcar #'(lambda (c) (if (equal c ?[) ?\( (if (equal c ?]) ?\) c))) string-to-transform)))
  (setq org-capture-templates `(
                                ("p" "Protocol" entry (file+headline ,(concat org-directory "notes_" (shell-command-to-string "date +%F__%H-%M-%S_%Z")) "Inbox")
                                               "* %^{Title_and_tag}\nSource: [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n#+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?")
                                ("L" "Protocol Link" entry (file+headline ,(concat org-directory "notes_" (shell-command-to-string "date +%F__%H-%M-%S_%Z")) "Inbox")
                                 "* %^{Title_and_tag}\n [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n")
                                )))

Above is working org config of myself. Thank everyone
Old
This question with the similar content can be found in 2018 but until now there is no solution.
It is not the error because (debug on error) not show anything. It simply not work. And some time it work! I dont know why it suddenly work,and after i restart emacs it not work again!, there is just something wrong when firefox or emacs update. I am not professional on emacslisp so I cannot debug. The author of this extension don't update it after 1 year https://github.com/sprig/org-capture-extension.
;; Add org-protocol for org-capture

(unless (server-running-p)
  (server-start));;for emacs client
(require 'org-protocol)
(setq org-modules (quote (org-protocol)))
;; org-capture templates
(require 'org-capture)
(use-package org-protocol
  :demand
  :config
  (setq org-capture-templates `(
                                ("p" "Protocol" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
                                 "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n*** Tag is %^{Tag}%?")
                                ("L" "Protocol Link" entry (file+headline ,(concat org-directory "notes.org") "Inbox")
                                 "* %? [[%:link][%:description]] \nCaptured On: %U" :prepend t)
                                )))


texts: How to enable opentype features in `font-spec`?

texts:
I'm using Emacs 28 (HEAD) on Debian Stable, compiled with HARFBUZZ and cairo (if that's important).
I'm trying to enable opentype features on the Pragmata Pro font (as shown here).
(font-spec :family "Iosevka Term SS10" :size 16 :otf '(latn nil nil (dlig))
(font-spec :family "Iosevka Term" :size 16 :otf '(latn nil nil (dlig))
I've tried both of these, with no difference. Emacs does not show me any errors but the extra ligatures don't work.
Documentation:
font-spec is a function defined in font.c.

Signature
(font-spec ARGS...)

Documentation
Return a newly created font-spec with arguments as properties.

ARGS must come in pairs KEY VALUE of font properties.  KEY must be a
valid font property name listed below:

:family, :weight, :slant, :width

They are the same as face attributes of the same name.  See
set-face-attribute.

:foundry

VALUE must be a string or a symbol specifying the font foundry, e.g. misc.

:adstyle

VALUE must be a string or a symbol specifying the additional
typographic style information of a font, e.g. sans.

:registry

VALUE must be a string or a symbol specifying the charset registry and
encoding of a font, e.g. iso8859-1.

:size

VALUE must be a non-negative integer or a floating point number
specifying the font size.  It specifies the font size in pixels (if
VALUE is an integer), or in points (if VALUE is a float).

:name

VALUE must be a string of XLFD-style or fontconfig-style font name.

:script

VALUE must be a symbol representing a script that the font must
support.  It may be a symbol representing a subgroup of a script
listed in the variable script-representative-chars.

:lang

VALUE must be a symbol whose name is a two-letter ISO-639 language
name, e.g. ja.  The value is matched against the "Additional Style"
field of the XLFD spec of a font, if it's non-empty, on X, and
against the codepages supported by the font on w32.

:otf

VALUE must be a list (SCRIPT-TAG LANGSYS-TAG GSUB [ GPOS ]) to specify
required OpenType features.

  SCRIPT-TAG: OpenType script tag symbol (e.g. deva).
  LANGSYS-TAG: OpenType language system tag symbol,
     or nil for the default language system.
  GSUB: List of OpenType GSUB feature tag symbols, or nil if none required.
  GPOS: List of OpenType GPOS feature tag symbols, or nil if none required.

GSUB and GPOS may contain nil elements.  In such a case, the font
must not have any of the remaining elements.

For instance, if the VALUE is (thai nil nil (mark)), the font must
be an OpenType font whose GPOS table of thai script's default
language system must contain mark feature.

I have tried to use GPOS / GSUB independently. Using GPOS gives me this error on startup:
Error in private config: config.el, (error invalid font property :otf latn nil dlig (nil))
Any help is appreciated!


texts:
I use spacemacs and while in Python mode, flycheck can not use flake8 checker even when I try to manually enable it using flycheck-disable-checker. I get the following output from flycheck-verify-checker flake8 (colors annotated):

Syntax checker in buffer code_v1.py in python-mode:

  python-flake8 (disabled)
    - major mode:         (green) `python-mode' supported
    - may enable:         (green) yes
    - executable:         (green) Found at /home/user/.virtualenvs/xxx/bin/flake8
    - configuration file: (green) Found at "/home/user/.config/flake8"

(red) Flycheck cannot use this syntax checker for this buffer.

Flycheck Mode is enabled. Use SPC u C-c ! x to enable disabled checkers.

--------------------

Flycheck version: 32snapshot (package: 20181018.1021)
Emacs version:    25.2.2
System:           x86_64-pc-linux-gnu
Window system:    x

Further output:

(xxx) user@host:~$ which flake8
/home/user/.virtualenvs/xxx/bin/flake8
(xxx) user@host:~$ flake8 --version
3.6.0 (mccabe: 0.6.1, pycodestyle: 2.4.0, pyflakes: 2.0.0) CPython 3.6.7rc1 on Linux

Why can't I enable the flake8 checker? What causes Flycheck cannot use this syntax checker for this buffer.?


texts: Determine whether a frame is shown on primary display

texts:
I have a multi-monitor setup, in which a specific monitor has a dedicated Emacs frame in full screen which shows compiler errors (from Compilation Mode or SBT Mode).  I'd like to preserve the setup automatically, even if I click on an error location in that frame.  Specifically, if the dedicated “error” frame is selected, display-buffer should show an buffer in the “main frame” where I do my editing.

The “main frame” is the one on my primary monitor, which stands in the center of my desk.  It's also the “official” primary monitor as per global display settings in the OS X system configuration.

To make sure that buffers are shown at the right place, I need to find out whether a certain frame is on the primary display or not.  Is that possible, and if so, how?

A platform independent approach would be great, but if that is not possible, a solution for OS X is also fine.


texts:
How can you repeat last shell command with a single shortcut (and no y/n prompts)? How to replace this sequence:

C-u C-x s (or equivalent) to save all buffers
M-! for (shell-command COMMAND &optional ...)
M-p for (previous-history-element N)
RET

Basically, how can you get this working:

(global-set-key (kbd "M-`") (lambda () (interactive)
              (save-some-buffers)  ;; 1.
              (shell-command nil)  ;; 2.
              (previous-history-element 1)  ;; 3.
              (<press RET>)))  ;; 4.

As is, it returns an error: shell-command: Wrong type argument: stringp, nil. What should a COMMAND be when calling (shell-command COMMAND ...) from ELISP?

Somewhat related question:
Is there a (repeat-last-command) in Emacs?


texts: Stripping stray ANSI escape sequences from eshell

texts:
I can't seem to identify this color sequence. I have enabled ansi colors successfully (to test, ls shows colored output), however a strange thing happens when I attempt to run npm and I can't identify the kind of colors these are, or how to make it so eshell can show them. The output is as follows

Usage npm <command>
... <remainder of usage here>
npm @ 3.3.10 /usr/lib/node_modules/npm
^[[?25h^[[0G^[[?25h^[[0G~/my/directory/that/i/am/in $

I have tried to look for things like "non-ansi color codes" and "npm color codes" and none of them have pointed me in the correct direction.

Can anyone identify these colors and help me figure out how to display them properly?

Thanks!

EDIT:

I have identified these as unicode sequences. I have added everything in:

https://www.masteringemacs.org/article/working-coding-systems-unicode-emacs

as well as the following code for Eshell specifically:

(defun set-buffer-utf8 ()
   (set-buffer-process-coding-system 'utf-8 'utf-8)
 )
 (add-hook 'eshell-mode-hook 'set-buffer-utf8)

This does not work. I have also tried this with the modes utf-16 and mule-utf-8 with no luck.

Also, if I type

echo $LANG I get en_US.UTF-8. echo $LC_ALL also returns en_US.UTF-8.

EDIT 2:

I have now tried to set the encoding of eshell (in the hook above) to iso-8859-7 and iso-8859-1 with no luck.


texts: how to correctly pass around function as parameters?

texts:
I have a working snippet that advices both kill-buffer and kill-this-buffer to not kill the scratch buffer:

  (defun ninrod/scratch-bodyguard (buffer-assassin &rest arguments)
    (let ((buffer-to-kill (buffer-name (current-buffer))))
      (if (equal buffer-to-kill "*scratch*")
          (message "DENIED! don't kill my precious *scratch*!!")
        (apply buffer-assassin arguments))))
  (defun ninrod/scratch-protection (buffer-assassin &rest arguments)
    (let ((buffer-to-kill (car arguments)))
      (if (equal buffer-to-kill "*scratch*")
          (message "DENIED! don't kill my precious *scratch*!!")
        (apply buffer-assassin arguments))))
  (advice-add #'kill-this-buffer :around #'ninrod/scratch-bodyguard)
  (advice-add #'kill-buffer :around #'ninrod/scratch-protection)

The problem is that these lines:

  (message "DENIED! don't kill my precious *scratch*!!")
 (apply buffer-assassin arguments))))

Are repeated in both functions, so I thought that I could apply the DRY principle and refactor the snippet to this:

(defun ninrod--protection (buffer-assassin buffer-to-kill &rest arguments)
  (if (equal buffer-to-kill "*scratch*")
      (message "DENIED! don't kill my precious *scratch*!!")
    (apply buffer-assassin arguments)))
(defun ninrod/scratch-bodyguard (buffer-assassin &rest arguments)
  (let ((buffer-to-kill (buffer-name (current-buffer))))
    (ninrod--protection 'buffer-assassin buffer-to-kill arguments)))
(defun ninrod/scratch-protection (buffer-assassin &rest arguments)
  (let ((buffer-to-kill (car arguments)))
    (ninrod--protection 'buffer-assassin buffer-to-kill arguments)))
(advice-add #'kill-this-buffer :around #'ninrod/scratch-bodyguard)
(advice-add #'kill-buffer :around #'ninrod/scratch-protection)

This causes all hell to break loose. Now I can't even close emacs, because apparently emacs tries to kill all buffers
and as I've just tampered with the kill buffer functions, well, it's bad. Very bad.

I know I mean well, but I'm must be doing something very stupid. For starters, I don't know if I can really pass around
functions as parameters? So it could be that?

How would you refactor that snippet to apply the dry principle?

edit:

this works:

(defun ninrod--protection (buffer-assassin buffer-to-kill &rest arguments)
  (if (equal buffer-to-kill "*scratch*")
      (message "DENIED! don't kill my precious *scratch*!!")
    (apply buffer-assassin arguments)))

(defun ninrod/scratch-bodyguard (buffer-assassin &rest arguments)
  (let ((buffer-to-kill (buffer-name (current-buffer))))
    (ninrod--protection 'buffer-assassin buffer-to-kill arguments)))

(advice-add #'kill-this-buffer :around #'ninrod/scratch-bodyguard)

so the problem lies exactly here:

(defun ninrod/scratch-protection (buffer-assassin &rest arguments)
  (let ((buffer-to-kill (car arguments)))
    (ninrod--protection 'buffer-assassin buffer-to-kill arguments)))

edit2: quoting or unquoting the function buffer-assassin does not make a difference


texts:
I'm trying to activate highlight-indent-guides-mode by default but it is not working.
If i do M-x highlight-indent-guides-mode it works fine but adding (highlight-indent-guides-mode 1) to my .emacs file does not activates the mode. Any suggestions?

Here is the part of my .emacs file:

(add-to-list 'load-path "~/.emacs.d/manualinstalled/")
(load "guides")
(highlight-indent-guides-mode 1)


texts: Behavior of '-e' option during emacs invocation

texts:
There command-line option -e behaves similar to the --eval option, but yet it is not the same.  For example, of these two invocations, only the first one works:

emacs --eval '(global-linum-mode)'
emacs     -e '(global-linum-mode)'

And of these two invocations, only the second one works:

emacs --eval 'global-linum-mode'
emacs     -e 'global-linum-mode'

I had mistakenly assumed that -e was the "short form" for --eval based on this line from the manual:

  There are two ways of writing options: the short forms that start with
  a single ‘-’, and the long forms that start with ‘--’. For example,
  ‘-d’ is a short form and ‘--display’ is the corresponding long form.

But as I noted, it has a behavior which differs from the long option. Is this mysterious -e option documented anywhere?


texts: Make emacs lock display of the first line of a file

texts: How can I make Emacs always display the first line of a file which contains header information (such as a CSV) as I scroll down past where it would usually no longer be visible?


texts: Octave-mode disable octave-sync-function-file-names on save

texts: Is there a variable I can set to disable the call of octave-sync-function-file-names after saving a file?


texts: Upload ICS calendar file to Google Calendar

texts:
I read my email in Emacs, and every now and then I receive an ICS file as an attachment, usually in a confirmation message for an event I've signed up for.  That's very kind of them, because it means I don't need to enter the event into my calendar manually.  It looks like this in the message buffer:

Attachment: [4. text/calendar; foobar.ics]...

I want to import that event into Google Calendar.  Currently I handle those files like this:

Save the ICS attachment from within message-mode (move point to the attachment and hit o)
Open Google Calendar in my web browser
Click the cogwheel, and select "Settings" in the menu that appears
Open the "Calendars" tab in the settings page
Click the "Import calendar" link
Select the ICS file in the file upload input control
Select which calendar to add the event to
Click the "Import" button

It gets tedious after a while. How can I import the event into Google Calendar directly from Emacs, without all these intermediate steps?