texts: Grant Applescript via Emacs Lisp permission for UI scripting

texts:
I have a simple applescript, embeded in emacs-lisp, which uses the current org-mode heading to create a calendar event in Apple Calender.

However... because scripting Calendar directly is painfully slow, I am using the CalendarLib library, which requires the user to grant the script permission to access to the Accessibility features of the mac.

When I run the script, I get this popup message:

So I click "OK" and I am taken to System Preferences, where I then add Emacs to the list of approved apps for Accessibility

However, the next time I run the script, I get the same popup message. So something is not right...

Here is the script:

(do-applescript "
use AppleScript version \"2.4\" -- Yosemite (10.10) or later
use script \"CalendarLib\" version \"1.1.3\" -- put this at the top of your     scripts
use scripting additions

set d1 to current date
set d2 to d1 + 1 * hours
set theStore to fetch store
set theCal to fetch calendar \"activities\" cal type cal cloud event store theStore -- change to suit
set theEvent to create event event store theStore destination calendar theCal event summary \"A test event\" starting date d1 ending date d2 event location \"Around here\" event description \"some notes\" without runs all day store event event theEvent event store theStore with future events
return event identifier for event theEvent
")

Any ideas?


texts:
In the directory I have mongodb.js, now I want to create a db.js file but if I type the name and press enter counsel-find-file use regex to open mongodb.js.

How can i create a db.js with counsel-find-file in the same directory of mongodb.js?


texts: mouse-wheel-follow-mouse for horizontal scrolling?

texts:
I like having mouse-wheel-follow-mouse set to non-nil, so I can use the trackpad to scroll an inactive window. Unfortunately, it doesn't apply to horizontal scrolling, so if I try to scroll an inactive window side-to-side, the active window scrolls (horizontally) instead. Is there a way to fix that?

Here's what I have in my init.el as far as scrolling configuration:

(setq scroll-step 1
      scroll-margin 0
      hscroll-step 1
      hscroll-margin 2
      scroll-conservatively 200
      mouse-wheel-scroll-amount '(0.01 ((shift) . 1)))

(defun ivan/scroll-right ()
  (interactive)
  (scroll-right 2))
(defun ivan/scroll-left ()
  (interactive)
  (scroll-left 2))

(defvar ivan/hscroll-minor-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map [wheel-right] #'ivan/scroll-left)
    (define-key map [wheel-left] #'ivan/scroll-right)
    map))

(define-minor-mode ivan/hscroll-minor-mode :init-value t)
(ivan/hscroll-minor-mode 1)


texts: What function is used when selecting a color in a Customize buffer?

texts:
I don't like the function that Customize uses to select color. It spawns a new buffer that messes up window configuration, and is also difficult to search.

I want to replace this function with the following:

(defun helm-insert-color-hex ()
  "Insert the hex value at point for the color selected via helm"
  (interactive)
  (insert (apply 'color-rgb-to-hex (color-name-to-rgb (helm-colors)))))

How can I do this? I can't seem to find what that "Choose" button does (for example, when setting a foreground color for some face)


texts: Programmatically read and set buffer-wide org-mode property

texts:
How one can programmatically read and set a buffer-wide org-mode property?
I am aware of this, which points to
(org-entry-put POM "PWE-1" "47")

but it does not seem useful in case of buffer global properties.
Details:
If a file has buffer global properties, like,
#+PROPERTY: PWE-1 42
#+PROPERTY: Cite "Silmarillon 1984"
#+PROPERTY: my/common-list (1 "two" (1 2 3 5 7))

How could one fetch, for example, the buffer-wide property PWE-1, or any other?
How would one set it, ie, write a different value, say
#+PROPERTY: PWE-1 2197

so that the buffer will keep the updated value as stored in the file, available at next load?
Where could I look up similar information in detail? Is there a detailed list of org-mode's API?


texts: Why does adding grouping parentheses cause a regexp to no longer match?

texts:
If test-string is defined like so

(setq test-string "fooXbarXbazXextraYstuff")

then the regexp "^[^XY]+X" matches test-string:

(string-match "^[^XY]+X" test-string)
=> 0 (#o0, #x0, ?\C-@)

...but the same regexp with grouping parentheses added no longer matches:

(string-match "^\([^XY]+X\)" test-string)
=> nil

Simply adorable.

Given the behavior above, it is not surprising that

(replace-regexp-in-string "^\([^XY]+X\)+" "" test-string)

evaluates to the original value of test-string.

What regexp must I put in place of the ??? below

(replace-regexp-in-string ??? "" test-string)

so that the resulting value is the string "extraYstuff"?

(BTW, I'd love to know the official/documented rationale for the behavior shown above, if there is one.)


texts: How to use SLIME as a proxy between Common Lisp program and Emacs Lisp?

texts:
I'm looking into doing the following: I have a program written in Common Lisp, which I want to be able to communicate with Emacs. The program deals with natural language parsing, so the things I'd need to access in Emacs would be the contents of the buffer and some minimal preliminary parsing required to create messages to send to the Common Lisp program. The Common Lisp program will then process the messages and reply to the Emacs Lisp program, so that it will display the results.

I understand that SLIME would be a good tool to use to achieve this, mainly because it already does most of it, but looking into documentation I find that it's a "user documentation" kind, not a "developer documentation". Essentially, I would like to know what is the minimum that I could use on the Emacs Lisp side to get the communication going (I certainly don't need the introspection, or REPL in this case, all I need is to send messages to and from my program running in SWANK).


texts: Org-mode export to Latex error with footnotes

texts:
Whenever I write, in my org-mode file, \footnote{bla bla bla $\whatever_{something}$} I get an error in the .tex file generated.

What it exports to the tex file is \footnote\\{bla bla bla \whatever_{something} \\\} (note the lack of dollar signs),
which obviously is not compiled in the right way by latex.

However, if I remove the parentheses around the subscript, i.e.\footnote{bla bla bla $\whatever_s$}, then it is exported correctly.

How can I fix the export?


texts: Weird Prompt: file has changed since visited or saved. Save anyway? (yes or no)

texts:
I make some edits and press C-x C-s to save. Sometimes, out of blue emacs prompts this:

file has changed since visited or saved.  Save anyway? (yes or no).

Even though I don't have  the file open anywhere else, and I am sure nothing else has changed the file.

This happens rarely, only possible explanation would be that I press some combination as I bash buttons, and press save, that causes something weird. What could be the problem?


texts:
My problems with emacs 26-1 are discussed at this link :
Emacs 26-1 Problems : find-file and neotree

The following link discusses using dnf to installing a previous version of a package:
https://unix.stackexchange.com/questions/266888/can-i-force-dnf-to-install-an-old-version-of-a-package

I'm a fedora semi-newbie who just did a full install of Fedora 29, that included
dnf install emacs, which installed emacs 26-1.  I would like to revert to
emacs 25-2 (or alternatively any version of emacs 25).  Is there a clean
way of (in effect) backing out the emacs 26-1 install and then installing a previous
version of emacs?  If so, it would help if I was given the exact bash commands
to use.

Resolution

I just posted an Addendum to the end of my original question at this link:Emacs 26-1 Problems : find-file and neotree

I worked with emacs-gnu-support to resolve most of the problems, so I no longer need to downgrade.  I think that the meta posting at Are questions about the OS package-manager on-topic when the package in question is Emacs? raises interesting issues, even though (for me) they are now moot.


texts: Org-babel and anaconda-mode in src blocks

texts:
I practice python literate programming with tangling to generate a full project structure. There are dependencies between modules and packages, and so I will say in the C-c ':

#+begin_src python tangle: "src/foo/bar.py"
  def do_stuff():
      pass
#+end_src

#+begin_src python tangle: "src/foo/baz.py"
  from foo.bar import do_stuff
#+end_src

And so the project structure looks like this (omitting init.py):

project.org

src

foo

bar.py
baz.py

But the C-c ' edit buffer is in the same directory as project.org so anaconda-mode won't recognize the import statement. All code is run from the tangled source rather than within the project.org buffer.

I have the tangle file names and dirs as elisp variables. It would be nice if I could have anaconda completion on project source code.

Can I point anaconda-mode to look from within the tangle, ie. source code file path?


texts: Electric pairs, working in Emacs 24.3, but not in 24.4

texts:
In 24.3, I have this in my .emacs, and it works:

(electric-pair-mode 1)

(setq electric-pair-pairs '(    (?\" . ?\") (?\{ . ?\}) (?\( . ?\)    ) )

Normally I use this in org-mode. All of them worked in 24.3, but only {}, and [] works in 24.4.

The new version is loading the same .emacs.


texts: Any way to remap the meta key with evil?

texts:
Function modifiers in Emacs conflicts with many hotkeys I have (for example, conflicts with i3wm). By using evil I could use evil to avoid most of conflict hotkeys.
However, I do still need to use those function modifiers to use, for example, M-x, but it conflicts with other hotkeys. (For Emacs keymap, ESC can be used. But now ESC is used by evil, and is no longer a meta substitute.)
What I want to achieve is in normal mode, ; acts as ctrl, and ' as alt, the meta key.
I tried the following but none of them worked:
(define-key evil-normal-state-map (kbd "'") 'event-apply-meta-modifier)
(define-key evil-normal-state-map (kbd "'") 'meta)

Any ideas how to achieve that?


texts: Is there a simple way to create a custom LaTeX environment template?

texts:
I'm writing lots of LaTeX beamer slides with AUCTeX. Each slide starts as follows:

\begin{frame}
\frametitle{\secname}
\framesubtitle{\subsecname}

\end{frame}

Is there a simple way to bind this template to a custom key command?


texts: How can I concatenate two sequences of lists (either lists of lists or vectors of lists) in constant time (independent of their size)?


texts:
I am using proof-general mode for editing and executing Coq files in emacs. However, I am highly annoyed by the C-c C-n behavior of always going to the next line if the EoF is reached. As I tend to use it interactively, executing the proof as I go along I end up always typing: C-c C-n + ARROW-UP + END.

How can I change that behavior of C-c C-n to ONLY evaluate to the next dot? Alternative: Is there a command I overlooked that does exactly that?


texts:
I installed undo-tree-mode into my emacs. It does have a lot of nifty features, one of them being undo-tree-redo (bound to M-_). It so useful that I put the following code inside my ~/.emacs.d/init.el:

;; Always activate undo-tree-mode because of redo (M-_)
(add-hook 'find-file-hook #'undo-tree-mode)

After some time, I started learning LISP and installed slime-mode. However, now whenever I press M-_ while in lisp-mode the command slime-edit-uses is executed instead of undo-tree-redo. Even after adding the following (trying to follow the suggestions of this and this questions, and this and this links) to my init.el doesn't bring back undo-tree-redo to M-_:

;; Unbind slime's keybind's hijacking
(defun override-slime ()
  (define-key slime-repl-mode-map
    (read-kbd-macro paredit-backward-delete-key) nil)
  (define-key slime-repl-mode-map (kbd "M-_") nil)
  (define-key slime-mode-indirect-map (kbd "M-_") nil)
  (define-key undo-tree-map (kbd "M-_") 'undo-tree-redo))

(eval-after-load "slime-mode"
  '(define-key slime-mode-indirect-map (kbd "M-_") nil))

(add-hook 'slime-repl-mode-hook 'override-slime)

How can I bring undo-tree-redo back to M-_?

PS: I don't think any other code of my init.el may be influencing or doing something funny with the code above. In any case, here is my init.el.

PS2: C-h k M-_ returns:

M-_ runs the command slime-edit-uses (found in
slime-mode-indirect-map), which is an interactive compiled Lisp
function in ‘../elpa/slime-2.20/slime.el’.

It is bound to M-?, M-_.

However M-? is an inconvenient keybind for me. I'm using Emacs 25.2.2.


texts: Mapping RET to use the same indentation level as the previous line

texts:
I code in Erlang, and I dislike the default indentation style that erlang.el provides: it tends to push code way too far to the right for my likings.

I'd like to have a simple automatic indentation scheme: (1) pressing RET creates a newline with the same indentation level as the previous line; (2) pressing TAB moves the indentation level one level up.

I figured out (2) by adding (defalias 'erlang-indent-command 'tab-to-tab-stop) to my init.el, but I can't find a proper command to use for RET to solve (1).


texts:
When I press C-c a M and search for a certain tag, I get a todo list of all open tasks for this specific tag.

Is it now possible to do a regular expression search similar to the sparse-tree regular expression search, for example:

+DEADLINE<"<today>"

?

Somehow it does not work for me, when i try that.


texts: how to copy emacs version info and org-mode version info?

texts: Is there a command to display and automatically copy to clipboard both the current version of Emacs and the current version of org-mode?


texts: Open an external sketch drawing application

texts:
Suppose I want to add a small sketch to a org-mode document (and possibly a LaTeX one). I'd like to type
[[file:my_sketch.png]], and when the file my_sketch doesn't exist, offer to open an application (some paint equivalent) to create it. Do you know of an org-mode package providing this?

It would even be better if it were to work also in a LaTeX file with a \includegraphics{my_sketch.png} line.


texts:
I recently learned about  multiple-cursors, and it looks like a very useful package. I went through the documentation on the original repo, but the commands still look a bit obscure to me.

I then watched the video in Emacs Rocks!, and the video is great, but it focuses mostly on what multiple-cursors is capable of doing, rather than on how to do it.

Are there any walk-throughs, tutorials or examples that illustrate its most basic functionality?


texts: Enabling shr-external-rendering-functions Variable in EWW

texts:
Began using Emacs eww nowadays, but now seeking to adapt it better for Html websites.

That way some user said to "buffer-locally setting the variable shr-external-rendering-functions", as of What EWW Emacs Web Brower Would Be Used For

But don't know how to do it.

Any idea?


texts: Can I use elisp code make a table and insert a variable into cell?

texts:
Can I insert a variable 'alpha' into @2$3 ? Does the function belong Emacs org?

** test elisp make a table
#+name: make-table
#+BEGIN_SRC emacs-lisp :results value
(setq tol 0.1)
(setq alpha 1.38)
(setq alpha_1 (- 90 alpha))
'(("angle" "symbol"   "value"  "max"         "min") hline
  ("toe"   "\\alpha"   alpha  (+ alpha tol)  (- alpha tol))
  ("c"   "\\alpha_1"   alpha_1  (+ alpha_1 tol)  (- alpha_1 tol))
 )
#+END_SRC


texts: org-mode export-html add name attirbute to checkbox input

texts:
I'm trying to make the HTML form for MCQ question via org-html-export-as-html.

#+BEGIN_EXPORT html
  <form action="/save" method="POST">
#+END_EXPORT

1. What is your question

   #+NAME: field-name
   - [ ] option1
   - [ ] option2
   - [ ] option3
   - [ ] option4

#+BEGIN_EXPORT html
  <button type="submit">Submit</button>
  <button type="reset">Reset</button>
  </form>
#+END_EXPORT

I have set the (setq org-html-checkbox-type 'html) which convert each option to <input type="checkbox"> but how to add name attribute currently I'm exporting option manually.

#+BEGIN_EXPORT html
  <input requried type="checkbox" name="Q1" value="option1"/> option1

  <input requried type="checkbox" name="Q1" value="option2"/> option2

  <input requried type="checkbox" name="Q1" value="option3"/> option3

  <input requried type="checkbox" name="Q1" value="option4"/> option4

#+END_EXPORT

hackish back-end in https://gist.github.com/rhoit/a213d4574a406f094b7d881db8510bcf


texts: Why does shell command output sometimes get inserted into an existing buffer?

texts:
If I do a M-! to run a shell command, usually any output will appear in a new, temporary buffer. But sometimes, seemingly at random, the output will instead be inserted directly into the active buffer. If this happens and I run the same command over again, it normally works as expected the second time.

Is this just me? Why might this be happening, and how do I prevent it?


texts: How to reduce enum definition indentation?

texts:
With my actual configuration, an enum definition looks like this:

enum    Toto
    {
        foo,
        bar
    }

Spaces are by packs of 4 instead of 2 because I set 4 as default indentation space for C/C++.

I would like to align brackets with enum keyword WITHOUT reducing space between them and enum list, like this:

enum    Toto
{
    foo,
    bar
}

I already done a similar thing by totally canceling namespace indentation, with the following Elisp line:

(c-set-offset 'innamespace 0)

But I don't know if something similar is possible for enum.


texts: Is it possible to create clickable links to macos mail.app email via "message://..." in orgmode?

texts:
I use the "Copy Message URL" quite heavily in mail app. I would like to paste the link into an org document and make it a clickable link that opens the email in mail.app. This does not currently work. I did try:

[[message://...][email link]]

But this did not work.


texts: Are the graphical depictions in docs drawed in manual labour?


texts: Getting information about src block in ```org-src-mode```

texts:
I need to configure the behavior of elpy when editing a python src block in org-src-mode. Usually such configuration code should be added to org-src-mode-hook. In my code I need to check some header args and act appropriately: I need to make sure that the code is python (not, say ipython) and whether the :session parameter is set.

The only way I found to do this is to access a "private" and undocumented variable org-src--babel-info. Is this the suggested way? Should this be documented in org-mode?

In particular my default elpy iterpreter is jupyter but I need to set it to python when editing src code blocks and I need elpy to use the running session when pressing C-c C-c instead of opening a new one.


texts:
I'd like to define my own interpretor for special blocks for a custom backend.

I've written this sort of thing, mostly copy/pasting from the src-block interpreter

(defun org-leanpub-special-block (special-block contents info)
  (replace-regexp-in-string
   "^" "A> "
   (org-remove-indentation
    (org-element-property :value special-block))))

I've also registered it as a translator and it's being called.

The goal is that this

#+BEGIN_aside
/wibble/
wibble
I'm a fish
#+END_aside

will be rendered as

A> *wibble*
A> wibble
A> I'm a fish

(note that the text is processed by the usual processor, which is derived from markdown).

But the debugger is kicking in with

(replace-regexp-in-string "^" "A> " (org-remove-indentation (org-element-property :value special-block)))

which would imply that my call to org-element-property is not doing what I thought. So how do I get the rendered version of the special-block body?

(I plan on switching on the TYPE of special block, but one step at a time...)


texts:
This keybind only works after I've opened a ledger file.
(spacemacs/set-leader-keys "jL"
  'ledger-report
  )

Thus I presume ledger-mode is required. Yet adding (require 'ledger-mode)
(spacemacs/set-leader-keys "jL"
  (require 'ledger-mode)
  'ledger-report
  )

returns
kbd: Wrong type argument: integer-or-marker-p, ledger-report

ledger-report: https://github.com/ledger/ledger-mode/blob/3495d1224ee73aa96c1d5bd131dc3a7f23d46336/ledger-report.el#L264


texts:
I am switching to AUCTeX as my LaTeX editor and need tab-aware automatic line wrapping. From this question on stackoverflow I gathered that adaptive-wrap is basically what I need.

How can I make adaptive-wrap aware of Tab-indentation?

On GitHub I already found this 'fork' of adaptive-wrap and this code to get Tab-awareness. Since I don't know any Elisp, I'm not sure these are safe to use with GNU Emacs 24.5.1.

Note that I cannot manually switch everything to space-indented code, as my current project is already very large.


texts: How to add a new input method for Syriac script in Emacs?

texts:
I want to write an article in English mingled with Syriac script in emacs, when I hit list-input-methods the script is not shown, or at least I couldn't identify this language in the displayed list. However, I am using a machine running Linux Ubuntu and I could add that language keyboard easily and it is designated Syriac or syc. I could use the same script in LibreOffice Writer using specific fonts for this language. My question how to add a new input method for this language in my init.el file?
I would be very grateful for your help and directions to achieve this goal.
In this EmacsWiki I could find input methods for ancient languages, but again I couldn't see one for Syriac. It is just hard to believe that Syriac language given its dominance in history could not get similar attention.
The Syriac language is from right-to-left language and it has the iso 15924 designation in UTF-18 and it has the unicod range
U+0700–U+074F Syriac
U+0860-U+086F Syriac
more info here
Update
my init.el setup for Hebrew language (again Right-to-Left) input method is shown below, this way I could still use Emacs keystrokes (shortcuts) regardless of whatever language you use which is the desired outcome. Otherwise, I would switch back and forth between languages in Linux Hebrew while writing and English then to use Emacs keystrokes which otherwise won't work when Hebrew is in place so I have to I switch keyboards quite often during writing making it impractical and very annoying for writing multilingual documents. The code below will allow me write Hebrew using Emacs keystrokes seamlessly and no need to bother with switching languages back and forth to use these keystrokes:
(set-fontset-font "fontset-default" 'hebrew "SBL BibLit-14" nil)

(defun hebrew-input-font ()
  "Change the `set-input-method` to Hebrew and select another font assigned to \\C-\\c h."
  (interactive)
  (set-input-method "hebrew-biblical-tiro"))
(bind-key "<f2> h" 'hebrew-input-font)


texts: How to show the total match count in swiper?

texts: When using swiper for search, it only shows the number of matching lines. How can I view the number of matches?


texts:
I've got python 3.6 in this directory:

D:\Python36

How can I set in .emacs path to python 3.6 interpreter?


texts: Use colors specified in terminal emulator for emacs

texts:
Emacs seems to use the 16 colors which were defined in a color scheme inside the terminal emulator as default.

This works well, I would not want to switch to a whole emacs color profile.
E.g I can specify the color of a "component" in emacs with a fixed color name or value like so:

(set-face-background 'mode-line "purple")

Is it also possible to tell Emacs to use one of the 16 defaults for this?
like "color01" or sth.?


texts: Why does emacs dired not display the same files as the Windows "Explorer" (e.g. Windows/System32/config)

texts:
(Emacs 24.3.1 i386-mingw-nt6.1.7601 of 2013-03-17 on MARVIN)

Emacs dired of C:Windows/System32/config displays only the directories:

'..'
'systemprofile'
'.'
'TxR'
'RegBack'
'Journal'

in the directory.

Windows Explorer displays 33 other files, mostly ".LOG", ".LOG1" or ".LOG2" files, but also

SOFTWARE
DEFAULT
SYSTEM
SAM
BCD-Template
COMPONENTS{[hash]}
...

My original suspicion was that the content of that directory is accurately displayed by dired (i.e. the files are not really there) but a cygwin ls -al shows the files that dired does not display. Is this one of Windows7 misdirections or is my Emacs config wrong or ...?


texts: How to prevent Emacs from showing passphrase in `M-x shell`?

texts:
I tried using attic with a passphrase to backup my files from inside M-x shell. The shell exposed the passphrase as plain text in the buffer and made it available by typing M-r as well as by looking through the shell input history with C-c C-l.

When I closed the shell and re-opened the input history, I saw that at least it disappeared. Presumably, because the shell reads it's initial history from .bash_history and at least bash had the good sense not to write my passphrase there.

Do I really need to leave emacs to perform my attic backups, or is there a way I can configure it not to be careless?

I was able to reproduce the issue with a fresh emacs -Q session. I was confused before because Emacs correctly hides the passphrase in all cases except when I call

 attic create --stats /path/to/backup::name ~/folders ~/backed ~/up

Then attic prompts as:

Enter passphrase for /path/to/backup::name:

The issue can be reproduced with this Python one-liner:

python -c 'import getpass; getpass.getpass("Hello")'

If the password prompt string is "Password:" then Emacs sees a password prompt, but not if the string is anything else.

How can I make Emacs recognize at least attic's password prompts?


texts: emacs theme changes when i moved to zsh from bash

texts:
I recently shifted form bash to zsh and also installed ohmyz. Since then my emacs theme doesn't work.

the one on the Left is how it looks in bash. On the right, when run on zsh its different.
Thanks,.


texts: Don't restore previous window configuration on debugger commands

texts:
When using the emacs lisp debugger, if I

invoke it
change the window configuration
invoke it again (most likely by hitting a breakpoint through the d command)

my changed window configuration disappears, and it reverts back to the window configuration I had in step 1.

I would like this not to happen. Is this possible?


texts:
I want to add a string to the startup screen. I found this question and customized the fancy-startup-text variable, like this

  (add-to-list 'fancy-startup-text '("\nYou are running a customized Emacs configuration. See "  :link
    ("here"
     #[257 "\300\301!\207"
           [browse-url-default-browser "http://github.com/izahn/dotemacs/"]
           3 "\n\n(fn BUTTON)"]
     "Open the README file")
    "\nfor information about these customizations.\n"))

That worked on my desktop computer, but when I tried on my laptop (with a small screen) I find a different startup screen, without the Emacs logo at the top, and without my additional string. I found a discussion on the emacs mailing list discussing how different startup screens are shown depending on the size of the initial frame (unfortunately I cannot locate this now), so I think this is expected. But what I cannot figure out is how to customize the text for the simple startup screen (without the logo) that is shown when the initial frame is small. I tried customizing fancy-about-text, i.e.

 (add-to-list 'fancy-about-text '("\nYou are running a customized Emacs configuration. See "  :link
    ("here"
     #[257 "\300\301!\207"
           [browse-url-default-browser "http://github.com/izahn/dotemacs/"]
           3 "\n\n(fn BUTTON)"]
     "Open the README file")
    "\nfor information about these customizations.\n"))

but that did not work.


texts:
I messed up my emacs and having trouble run emacs --daemon properly. I am using GNU Emacs 26.3.
M-x returns Error reading from stdin.

I have following lines on .zshrc:
export ALTERNATE_EDITOR=""
export EDITOR="emacsclient -t "

I have following in init.el file:
(load "server")
(unless (server-running-p) (server-start))

The was I start emacs first: emacs -nw ~/start.txt than open client as emacsclient -tq file.txt. emacsclient is able to connect to the daemon but its M-x is not functioning properly.
Instead if I start emacs --daemon than emacsclient is not able to connect to the daemon saying it cannot find any server to connect:
emacsclient: can't find socket; have you started the server?
To start the server in Emacs, type "M-x server-start".

When I remove following lines:
(load "server")
(unless (server-running-p) (server-start))

and start emacs as: emacs -nw ~/doo.txt and do M-x start-server; everything works fine.


texts: web-mode didn't work properly under Emacs

texts:
I am using Emacs 25.3.1 under MS Windows 64-bit, Everything seems working fine except the web-mode. If I try to edit an HTML file there is no syntax highlighting, when mixing PHP and HTML only the PHP code fragments are colored, the HTML parts are in black/gray color scheme.
My .emacs file looks like this under (package-initialize):

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.html?\\'" . web-mode))

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

The last line was added, as it was required by fxbois, but it doesn't solve the issue.


texts: How I can change the default directory handler from dired to deer or ranger?

texts: How can I replace dired with something like deer?  Any time emacs wants to browse a directory with C-x d or from a link on the homescreen (from projectile or something), I want to open it in ranger or deer instead of dired.  Is that possible?


texts:
Windows 10, Emacs 25.1

In my init.el

(define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring)

But when I start emacs I get error:

Symbol's value as variable is void: shell-mode-map


texts: loading the `folding` mode with `use-package`

texts:
I am using the folding minor mode in Emacs which I get installed with the following use-package macro:

(use-package folding
  :ensure t)

The above works and ensures that folding is installed whenever I fire up Emacs. However, when I visit a buffer with the folded marks ( // {{{ and // }}}), the minor mode is not automatically loaded and I have to load it explicitly with:

M-x folding-mode

I looked up the documentation and saw that for the Folding mode to start automatically when a folded file is loaded you need to do this:

(if (load "folding" 'nomessage 'noerror)
         (folding-mode-add-find-file-hook))

However, changing my use-package macro to the following:

(use-package folding
  :ensure t
  :config
  (if (load "folding" 'nomessage 'noerror)
      (folding-mode-add-find-file-hook))
  )

… makes no difference. I still have to load folding mode manually with M-x folding-mode. What gives?

update

Turns out that in addition to the accepted answer, I also had to add an Emacs file variable at the end of the file:

// {{{ folding-mode

// Local Variables:
// folded-file: t
// End:

// }}}

But adding this editor-specific markup in every source file is too much for me. Is there a way to automatically always activate folding-mode when visiting a buffer?

I have tried

(use-package folding
   :ensure t
   :config
     (folding-mode))

… and:

(use-package folding
   :ensure t
   :config
     (setq 'folding-mode t))

… but none of the above is working.


texts: Per-directory local settings in Dired, to sort folders differently

texts:
I was wondering if one can have a set of definitions in dired to sort (and maybe also filter) that are per directory. this would be also saved for all future sessions.
any one knows of such a method?


texts: TeX-evince-sync-view locking up with this file

texts:
This file when I compile it with AUCTeX, and then try to view it, using TeX-evince-sync-view, shows that one page has been compiled, but then shows a blank view. After I kill it, TeX-evince-sync-view stops responding properly, and gives me a D-Bus error: "call timed out" message.I suppose this is because the file is generated in a subdirectory, but AUCTeX really should cope better. Can anyone reproduce this?

Suggestions on what to do, and also how to unstop D-Bus in this sort of situation (just for my reference) would be helpful. Should I report this, and if so, where? AUCTeX version is 12.1.2 (elpa). I see that there is a reporting bugs to AUCTeX inside Emacs. Should I use that?

\documentclass[12pt]{article}
\usepackage{filecontents}
\usepackage{shellesc}
\usepackage{tikz}
\usepackage{pdfpages}
\begin{document}

\begin{filecontents*}{bar.tex}
\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}  % This will be output to bar
\node [font=\bfseries\Large, align=center] at (7, 4.1){TEST};
\end{tikzpicture}
\end{document}
\end{filecontents*}

\ShellEscape{pdflatex -shell-escape bar.tex}
\end{document}


texts: What's the idiomatic way of overriding a key binding for a given major-mode (but no other)?

texts:
I'd like to bind C-x C-e to python-shell-send-region when I am in python major-mode.

In my config file, I have an add-hook for python mode, but I'd like this keybinding override to be removed/restored when I exit python major-mode.

The use-case for this is that I want to be able to switch my *scratch* buffer between modes and for things to continue making sense.

Is there an idiomatic way to achieve this?


texts: Count only frame opened outside of terminal?

texts: I want to enforce only one GUI instance for Emacs, so I want to check if at least one GUI frame is open or not (i.e. the frame that is open with emacsclient -c), and ignore the ones opened in Terminal. How do I do that? I already tried visible-frame-list function but this seems to count all frames.


texts: Specify what combinations shown as ligature while using FiraCode?

texts:
I'm using FiraCode in Emacs. Some ligature satisfies me and some don't.
For example, I really dislike this:

Is there any means to include or exclude specific ligatures?


texts:
When using ansi-term in line mode emacs lets you edit the buffer arbitrarily, not just after the last prompt. I'm trying to make it read only so I stop fudging with command output. The problem is all the solutions I've come up with also prevent me from entering any commands while in line mode. Here's my attempt:

(defvar-local etc-last-read-only 0)

(defun etc-make-term-output-read-only (&rest args)
  (interactive)
  (let ((inhibit-modification-hooks t))
    (when (= 0 etc-last-read-only)
      (setq etc-last-read-only (point-min)))
    (let ((end-prompt (ignore-errors (save-excursion
                                       (goto-char (point-max))
                                       (term-previous-prompt 1)
                                       ;; (backward-char)
                                       (point)))))
      (when (and end-prompt (> end-prompt etc-last-read-only))
        (add-text-properties etc-last-read-only end-prompt
                             '(read-only t rear-sticky t
                                         front-sticky nil))
        (setq etc-last-read-only end-prompt)))))

(add-hook 'term-mode-hook
    (lambda () (add-hook 'after-change-functions #'etc-make-term-output-read-only nil t))

The idea is that whenever the buffer changes we try to make everything before the most recent prompt read only. I have term-prompt-regexp set to match my PS1 and I can tell that the regexp works correctly because C-c C-p and C-c C-n correctly jump between prompt instances, and I've manually verified with string-match that I get the right result, matching the prompt and one following space. To make the hook more efficient we track how much of the buffer we've made read only so far so we don't have to apply the read only property to the whole buffer every time.

If the backward-char call is included, then I can enter commands as long as I never hit backspace at the beginning of the prompt. If I do then I get a text is read only error from then on and can never enter commands again. If I don't include it, then I never get to enter commands in the first place because it thinks everything is read only. I thought maybe this was an issue with stickiness from the earlier characters, so I tried disabling the stickiness as you can see but it made no difference.

There are some more changes that are needed to make this more robust (I put advice on term-emulate-terminal to inhibit read only and probably need it elsewhere) but first I just want this proof of concept working. What am I doing wrong? How do I get everything up to term-bol marked read only without preventing typing commands there?


texts: What's the inverse of (format-time-string "%s")?

texts:
Parsing formatted time string (inverse of format-time-string) asks for a complete inverse of format-time-string with the ability to specify the source format, but I really just need to get from a UNIX time / epoch time to a real time value (like that which (current-time) returns.

In essence, I want the following:

(let* ((emacs-time (current-time))
       (unix-time  (string-to-number (format-time-string "%s" emacs-time))))
  (equal emacs-time (mystery-func unix-time)))


texts: Highlighting selected region in same buffer, displayed in multiple windows

texts:
Q:  I am seeking a proposed modification of simple.el at lines 5251 to 5308 of the master branch relating to highlighting a selected region to achieve a better visual representation when the same buffer is displayed in more than one window (same frame or a different frame) -- with different window-start/window-end positions.

The first couple of screen-shots are with the default highlight-nonselected-windows set to nil.  The last screen-shot is with highlight-nonselected-windows set to t.  The test file for this example is the library simple.el.

I have only selected the four (4) lines of code in the second window in the first screen-shot, yet (12) lines of code are highlighted in the first window in the second-screen-shot.  The third screen-shot displays both.

GOAL:  The same four (4) lines of code should be highlighted in all three screen-shots.


texts: What are overlays for, and how do they differ from text properties?

texts:
The manual states:

  You can use overlays to alter the appearance of a buffer's text on the
  screen, for the sake of presentation features.

From its name, it suggests it can be used to create “layers” over existing text, but the description above seems to indicate it alters the appearance of text, which feels very similar to what text properties do.

What is a concrete use of overlays?  What do they offer that text properties don't?  Can they be used to write text over text in a buffer, like a popup, info box, etc.?


texts:
I'm finding I run C-x C-f and then:

/ssh:$user@$host|sudo:$host:/

Where $host is a device IP.

I'm relatively new to emacs, I want to create a custom function that accepts values for $host and $user.

How can I do this?


texts: set-transient-map doesn't behave properly after repetitive call

texts:
I wonder what is wrong with the following code?

(defvar my-forward-word-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "n") 'forward-word)
    (define-key map (kbd "p") 'my-backward-word)
    map))

(defvar my-backward-word-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "p") 'backward-word)
    (define-key map (kbd "n") 'my-forward-word)
    map))

(defun my-forward-word ()
  (interactive)
  (set-transient-map my-forward-word-map t))

(defun my-backward-word ()
  (interactive)
  (set-transient-map my-backward-word-map t))

(global-set-key (kbd "M-n") 'my-forward-word)
(global-set-key (kbd "M-p") 'my-backward-word)

There is a buffer with the text: |Hello world. | - this is cursor.

I press M-n, n. I get Hello| world as I expected.

Then I press p, p. I get |Hello world as was previously. And that's fine.

But when I press n again nothing happens i.e. cursor doesn't change its position no matter how many time I press n.

After n and n I expected to get Hello| world.

What's wrong?

$ emacs --version
GNU Emacs 24.4.1


texts: How can I configure incremental search to put my cursor at the start of whitespace rather than the end?

texts:
I just installed a new version of Emacs (24.3.1 through Fedora). For some reason, when I use C-s to search for a single space character, it jumps my cursor to the end of contiguous spaces rather than the beginning. For example, if I'm at the start of this line:

type thread_id        = ...

and do C-s SPC, all the spaces in the buffer are highlighted. But when I advance up to the spaces before the =, my cursor is immediately positioned on the = rather than after the first space (ie two positions after the end of thread_id).

How can I get my cursor to be at the first single character rather than the end of the range?


texts:
I'd like to open multiple playlists with M-x emms-play-playlist and have each one in a seperate *EMMS Playlist* buffer - at the same time.

Is it possible to have different "*EMMS Playlist*" buffers - at the same time?

My init.el has for EMMS just these lines of https://www.gnu.org/software/emms/manual/#Quickstart-Guide:

(add-to-list 'load-path "~/elisp/emms/lisp/")
(require 'emms-setup)
(emms-all)
(emms-default-players)


texts: Huge buggy padding in line-number buffer

texts:
A picture:

As you can see there is a huge waste of space on the left side of the line number section.

When I increase the font size the padding even increases and does not decrease when I decrease the font size back.

I am using the most recent version of spacemacs and the tsdh-light theme.


texts: Org-babel python with session breaks output

texts:
If I run the following code block:

#+BEGIN_SRC python :results output

  print("   /|")
  print("  / |")
  print(" /  |")
  print("/___|")

#+END_SRC

I get the result as expected:

#+RESULTS:
:    /|
:   / |
:  /  |
: /___|

But if I now run this as part of a session, the result breaks:

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

  print("   /|")
  print("  / |")
  print(" /  |")
  print("/___|")

#+END_SRC

#+RESULTS:
: /|
:   / |
:  /  |
: /___|

This is what I have in init.el:

;; Babel languages
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (R . t)
   (latex . t)
   (shell . t)
   (php . t)
   (applescript . t)
   (python . t)))

;; Fix Warning "readline" message
(setq python-shell-completion-native-enable nil)

Any ideas?


texts: Decode double-back-slashes-prefixed octal codes in 'utf-8

texts:
I have a string "\\303\\273" that I want to decode into û.
It's known that (decode-coding-string "\303\273" 'utf-8) evals to û.
However, I'm not able to translate "\\303\\273" into "\303\273" with
replace-regexp-in-string.
Question: How to decode "\\303\\273" into û?


texts: smartparens with LaTeX to deal with \begin \end environment and markup commands

texts: How can I configure smartparens to treat \begin ...\end environments, and commands, e.g., \textbf, delimiters so that I can navigate them, e.g., using sp-forward-sexp.


texts: In minibuffer forward through search history M-p not work

texts:
Windows 10, Emacs 26.1

Steps:

Start Emacs
Open *scratch* buffer.
C-s text
C-g
C-s visit
C-g

Nice. Now I want to go backward and forward through search history with M-p and M-n respectively.
But I get error:

M-p/M-n is underfined".

If I input command "previous-history-element" I get another error: Wrong type argument: number-or-marker-p, nil

I try this in pure Emacs by: emacs -Q

But I get same errors.


texts:
I am connecting from a Windows machine to a Linux server via Putty (http://blog.harang.org/?tag=putty). There I start Emacs and open a script written in the statistical language R. When I open the file, the appropriate major mode ESS is loaded and shown to be active in the tool bar. Also when I type C-h m I get the information of the major mode and also all its keybinding. The variable major-mode has the value ess-mode.

So far, so good. The problem is: None of the keybindings associated with this major mode do work. I type one of them, nothing happens except that I get the message that this keybinding is undefined. In describe-bindings, the keybindings of the major mode are not shown. (This is also the information I get when I type C-h k with the key sequence.)

What can I do? What is going on? Is it because of the putty emulation I am using?


texts: Is it possible to install emacs 25.1 and emacs 24 on the same machine?

texts:
I currently have emacs 24.5.1 running on OSx el capitan. Since the first RC of emacs 25.1 released a few days ago, I am very curious to try it out. Can I have both versions installed on the same machine without causing any conflicts ?

Also, can I use most of the packages I used for emacs 24 with emacs 25 without any major problems? or would I need to wait for some packages to have emacs 25 support ?

Edit: I used homebrew to install emacs 24.


texts: How to install smart-mode-line powerline theme with use-package

texts:
I'm trying to move from el-get to use-package. I am having trouble with smart-mode-line-powerline-theme. Emacs complains at startup time with

(error "Unable to find theme file for ‘smart-mode-line-powerline’")

Here is a minimialized version of a startup file that tries to get the relevant bits to work:

(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives '("melpa"     . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("gnu"       . "http://elpa.gnu.org/packages/"))
(package-initialize)

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

(eval-when-compile
  (require 'use-package))
(require 'diminish)
(require 'bind-key)

(setq use-package-always-ensure t)
(put 'use-package 'lisp-indent-function 1)

(use-package powerline) ; seems to be required for smart-mode-line powerline theme

(use-package smart-mode-line
  :config (progn
            (require 'smart-mode-line)
            (setq sml/theme 'respectful)
            (sml/setup)
            (sml/apply-theme 'powerline)))

el-get creates a directory emacs.d/el-get/smart-mode-line containing a git clone of the smart-mode-line repository, including a themes directory which contains smart-mode-line-powerline-theme.el (and a light variant).

use-package creates a directory emacs.d/elpa/smart-mode-line-20170708.1317 which contains the standard sml themes, but without the themes subdirectory in which the powerline themes live.

How can I get around this glitch?


texts: auctex beamer, set all characters to a fixed size

texts:
I am starting to use emacs guy (precisely this https://emacsformacosx.com) and I am not always getting monospaced charters as I get in emacs when using terminal. I have tried putting this in my .emacs (found in the web)

;; Only change sectioning colour
(setq font-latex-fontify-sectioning 1.0)
(setq font-latex-fontify-sectioning 'color)
(setq font-latex-slide-title-face 1.0)
;; super-/sub-script on baseline
(setq font-latex-script-display (quote (nil)))
;; Do not change super-/sub-script font
;; Exclude bold/italic from keywords
(setq font-latex-deactivated-keyword-classes
'("italic-command" "bold-command" "italic-declaration" "bold-declaration"))

I got some improvements but as you can see in the images I have not solved my problem yet.

What I expect:

What I get (you can see that "Theoretical introduction" is small and not vertically aligned to other characters). What can I do?

How to solve it?


texts:
Almost every text editor is able to truncate lines by default, but in Emacs I'm still using the cumbersome M-x toggle-truncate-lines in every buffer with long lines.  Unfortunately, buffers with long lines are very common, so one has to do M-x toggle-truncate-lines constantly.

Solutions currently posted on StackOverflow do not work (e.g., link):

(setq-default truncate-lines t) in init.el does not have any effect.
(custom-set-variables '(truncate-lines t)) in init.el does not have any effect.
(global-set-key "\C-x\ w" 'toggle-truncate-lines) does not really solve the problem.

I must be overlooking something here; what's the actual setting for truncating long lines by default?


texts:
I recently discovered emacs's "regex-builder" mode and am absolutely loving it. However, there doesn't seem to be an easy way to type in an expression in the "RE-Bulider" buffer and use that expression to search for matches.

My use case for regexp-builder is currently to write a regular expression, and once I see some matches, I scan through the document manually to see all the matching strings. I currently use the "string" regex syntax for my regexp-builder, as recommended here, so I don't think I would need to modify the reb-lisp-mode hooks.

Right now, if I type in an expression in the RE-Builder buffer and press C-M-s or C-M-r (isearch forward/backward regexp), I get whichever regular expression I used with isearch last, which is oftentimes different than what I'm currently searching for. Additionally, these isearch commands only perform their search on the current buffer, which happens to be the regex-builder buffer, which leads to no matches being performed on the buffer I want to search.

What I want to do is to bind the C-s and C-r keys to re-search-forward and re-search-backward functions on the buffer I'm searching in whenever I begin using the regex builder.

I've made the following function in my ~/.emacs, but after evaluating the buffer, putting an expression in the RE Builder buffer and pressing the corresponding shortcuts, I still get isearch-forward, the default behavior.

(require 're-builder)
(setq reb-re-syntax 'string)

;; Improve regex searching through regexp builder
(defun regexp-builder-mode-config()
  "For use in `reb-mode-hook'."
  (local-set-key (kbd "C-s") 're-search-forward)
  (local-set-key (kbd "C-r") 're-search-backward)
  )
(add-hook 'reb-mode-hook 'regexp-builder-mode-config)

Essentially, what I want this to do is two-fold:

Once I make a regular expression, press the key combination <C-s> or <C-r> and be able to search for a regular expression in the buffer.
Solve the problem of emacs implicitly converting from one syntax (string) to the other (read). When I copy the expression I'm building to the kill ring (C-c C-w), emacs adds a bunch of extraneous backslashes (which I presume is due to how it handles regular expressions in the interactive buffer), which makes my regex not work anymore.

At the moment, I believe I'm close to solving the first point, which is being able to edit a regex and then conveniently search for it in the buffer I'm working on. However, when I press C-s or C-r, I get the usual isearch-forward/backward functionality I'm trying to avoid, almost as if me changing the hook didn't affect anything.

I checked the documentation, and I'm fairly sure I'm using the correct hook, but any and all help is welcome!


texts:
I tried to have some Emacs packages from MELPA installed system-wide, following suggestions from this question.  I want to have these packages installed under /usr/local/share/emacs/site-lisp/elpa, so as root user, I've created minimal ~/.emacs as follows:

(package-initialize)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/") t)
(setq package-user-dir "/usr/local/share/emacs/site-lisp/elpa")

Then, I started Emacs as root, and installed packages as usual, everything seemed fine. Then, I've added following at the beggining of ~/.emacs file of an ordinary user:

(package-initialize)
(push "/usr/local/share/emacs/site-lisp/elpa" package-directory-list)

However, this doesn't work, in the sense that neither root user nor ordinary user could use installed packages.  For example if I run following command in the scratch buffer of Emacs run as root user (I installed use-package among other packages):

(require 'use-package)

following error is reported:

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "use-package")
  require(use-package)
  eval((require 'use-package) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

On the other side, if last line in the root user ~/.emacs file changed to:

(setq package-user-dir "/usr/share/emacs/site-lisp/elpa")

and also the last line in the ordinary user ~/.emacs file deleted, then everything works fine and both users could use installed packages (note that directory /usr/share/emacs/site-lisp/elpa is in package-directory-list by default).

Any hint what could be the problem here?  It's not big deal, but I'd just like to keep packages installed this way under /usr/local, since as far as I remember it, according to FHS this would be the right place for packages installed this way.


texts: Inconsistent Indentation for C/C++ Upon Loading File

texts:
Problem: When a C++ file is loaded, the indentation rules are not always what they should be, i.e. instead  of indenting by 3, it will indent by 1 or 8 for that session. This occurs consistently through the buffer, as if I have changed the variable for offset and/or indent.

Here is the code I have in general configurations file that is loaded by my init.el:

;;No tabs, set to 3 spaces when found
(setq-default indent-tabs-mode nil)
(setq-default tab-width 3)

;;C AND C++
;;---------
(setq c-default-style "linux"
   c-basic-offset 3
   c-basic-indent 3
   indent-tabs-mode nil)

To reiterate: sometimes the file will load and the indentation rules, as given above, will load correctly and work just fine. However, very often it will not and will have a 'new' rule in the session, indenting by some new amount X of spaces. Going to M-x Customize Variable and checking c-basic-offset and c-basic-indent shows they are custom set and c-default-style shows linux as it should.

The only other thing I have to say is that emacs does not know it has loaded a C++ file all the time and will say C/l mode instead of C++/l mode, requiring me to manually switch to that. Regardless, when indentation isn't working as it should, both modes act up. When it isn't, both modes indent as they should. Other modes that I have loaded (that I could see /potentially/ influencing this) include Company(vanilla), Flycheck, and Electric Indent.

My emacs configuration isn't crazy or that complex, so I have no problem giving my github here if that will help.


texts:
I am not sure how to describe this problem so I am giving some example

Without Semi-colon

| John | Snow | John Snow |
| John | Doe  | John Doe  |
| Mery | Jane | Mery Jane |
#+TBLFM: $3='(concat $1 " " $2)

The result is as expected

With Semi-colon

| John | Snow | " $2) |
| John | Doe  | " $2) |
| Mery | Jane | " $2) |
#+TBLFM: $3='(concat $1 ";" $2)

What I expected was -

| John | Snow | John;Snow |
| John | Doe  | John;Doe  |
| Mery | Jane | Mery;Jane |
#+TBLFM: $3='(concat $1 ";" $2)

Can anyone explain this? and also how to solve this problem.


texts: list-packages crashes Emacs 25.3 (Mac) when MELPA is added to .emacs

texts:
M-x list-packages crashes Emacs after I added:

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

after (package-initialize).

(package-initialize)

alone works fine but M-x list-packages lists only GNU ELPA packages.

Any idea?


texts: Org Mode - Targeted Expansion of Headings

texts:
In org mode with the headings collapsed you can go to each one and press TAB to expand it.

Is there an easy way to not have to navigate to headings by using the arrow keys?


texts:
I probably hit the wrong keys at some point but now when I'm calling an org-agenda command (i.e. C-a a), I'm receiving an error message: Invalid duration format: "shell", with an empty window. I re-installed org-mode with no success.

org-mode 9.1.2

emacs 25.3

Ubuntu 17.04


texts: Dired: Open files by external application in Linux

texts:
I want to open several types of files in Dired by different external applications.
For example:

.doc files with LibreOffice
.pdf files with evince
.jpg files with pinta
etc...

How do i configure this?


texts: Place time displayed in the begginning of modeline

texts:
I installed doom-emacs and modeline displayed as

How could place the time 10:55 AM in the beginning, since if more windows opened and arranged horizontally, the directory name are so long enough to push "displayed time" out of view.


texts: Is there a command to alternate buffers?

texts:
I want to quickly alternate between the buffer I'm in and the last buffer I was in. Is there a built-in command for this?

I rolled my own, but I might rather use something built-in.

(defun alternate-buffer ()
  "Alternate between the current buffer and the previous."
  (interactive)
  (switch-to-buffer (caar (window-prev-buffers))))

I've checked M-x apropos and searched for "buffer", but I haven't located such a command.


texts: Activate ox-extras on a per document basis

texts:
The org mode export utilities in ox-extra are very useful. However because these utilities are enabled in my init.el file, I do not know how to enable or disable the utilities and a per document basis.

Specifically, my init.el contains:

(require 'ox-extra)
(ox-extras-activate '(notignore-headlines))

This activates notignore-headlines globally. Can this instead be activated  on a per document basis?


texts: How to end text-insert undo segment after cursor jump (caused by mouse)?

texts:
Coming from vim into (evil-mode) spacemacs, I sometimes get frustrated that undo segment is not ended when a mouse-caused cursor movement occurs. An example : While I am inserting text, touchpad gets often touched, causing the cursor to jump elsewhere. If I have entered five sentences just where I wanted them, without any jump, but sixth sentence gets by mistake entered all over the place because of multiple (three) touchpad touches in different places, when I notice this, I need to be able to execute (three times) "undo" so that the fives sentences stay intact, and the undo operation erase only the sixth sentence from all over the place.
Right now when insert gets this way screwed up, the undo tree contains only one segment. When I press undo, all six sentences disappear. I have to choose all-or-nothing, neither of which is very useful!!
Appending after "blabla" by entering insert mode and typing "This is first sentence. " /now mouse click occurs by mistake/ "This is second sentence." I get:
blabla This is This is second sentence. first sentence.
Pressing U for undo I need to get :
blabla This is first sentence. , but I am instead getting:
blabla
Interestingly enough, when text is being replaced and not inserted, everything works as expected - undo segment ends when mouse moves the cursor, so replacing by mistake I can in sequence undo the previous changes made after mouse-caused jump.
How can I fix this? Is it a bug, or some funny feature?
PS: Please do not advise me to get "disable touch pad while typing" working.


texts:
I wanted to try somewhat nicer bullets for my org headings. To this extent, I downloaded the org-bullets file.
I've followed the instructions to the letter, so I'm not reporting the details here (unless it becomes necessary).

I noticed then that emacs has become much slower when unfolding subtrees, and even moving the cursor around.

I am using evil-mode as well.

Is there a way I can understand, test and maybe find a setting where this effect is gone?


texts: Print list to console separated by newlines

texts:
I'm trying to run emacsclient -e with an expression that evaluates to a string containing newlines, and I'd like those newlines to be rendered on the console as newlines rather than \n.

Unfortunately, every attempt I've made so far prints the escaped newline:

$ emacsclient -e '(string-join (list "a" "b" "c") "\n")'
"a\nb\nc"
$ emacsclient -e '(print (string-join (list "a" "b" "c") "\n"))'
"a\nb\nc"
$ emacsclient -e '(message (string-join (list "a" "b" "c") "\n"))'
"a\nb\nc"
$ emacsclient -e '(string-join (list "a" "b" "c") "
> "))'
"a\nb\nc"

What am I missing? Bonus points if the quotation marks can also be removed from the output. Intended output:

$ emacsclient -e '(somefunction (list "a" "b" "c"))'
a
b
c


texts: How to increase height of minibuffer/mini-window in Spacemacs?

texts:
Steps to take to appreciate my befuddlement:

Run Spacemacs.
Press the space bar.
This moves the mode line up, and in the area below the mode line (which I think is all called either the mini-window or the minibuffer), displays keys that the user might wish to press next in order to execute a command, e.g. SPC → avy word, TAB → last buffer, etc. Unfortunately, only 9 lines of these are shown (when Spacemacs is maximised; 10 lines if I go fullscreen), so some of the options are hidden on a second page. Below this, there is a line that reads, SPC- Spacemacs root (1 of 2) [C-h paging/help].
Press Ctrl+h.
That last line now reads, SPC- n → next page, p → previous page, u → undo-key, h → help, a → abort.
Press n.
Aha! Now we can see the second page's worth of options.

I'd like to make it unnecessary to have to press SPC C-h n to see those remaining options. I figure this can be done by increasing the height of the area under the mode line, so that all the options can fit on one page.

My questions:

How can I do this? I've already tried increasing max-mini-window-height from 0.25 to 0.5 and reloading Spacemacs, but this didn't appear to make any difference at all.
What is the correct terminology for the area that appears below the mode line when pressing the space bar in Spacemacs?


texts: Display another symbol than asterisks in org headings

texts:
I would like to change the way headings render while still using the * to type headings (so this question is distinct from Change the asterisk (heading identifier) to some other symbol in Org mode)

I want this

* One
** Two
*** Three

to render as

# One
## Two
### Three

The closest I can get is by using org-bullets and changing the org-bullets-bullet-list symbols, but that conceals the initial symbols with spaces:

# One
 # Two
  # Three

Preferably, I would not need to use use the org-bullets package and just use a regex to replace the font face of the headings symbols. I found this snippet for changing - and * in plain lists to a •.

  (font-lock-add-keywords 'org-mode
    '(("^ +\\([-*]\\) "
    (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))

When I try to modify it for headings it does not change the appearance of the headings and does not throw any error (maybe there is some later applied highlighting in org-mode that overwrites the regex substitution? or because I am just using a single # to replace possibly more than one *?).

  (font-lock-add-keywords 'org-mode
    '(("^*+ "
    (0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "#"))))))

I am using Emacs through the Spacemacs distribution.


texts: Fold code using headlines inside org-mode elisp source code block

texts:
To manage my config I use org-mode. To manage packages inside this I use use-package. Problem is that there are packages that require a lot of configuration like ibuffer and org-mode. Now I'm looking for a way to fold code inside an org-mode elisp source code block. The blocks should be folded based on headlines.

Below is a a workaround solution to archieve that goal above indirectly. The problem with that is that it creates even more source code blocks which is ugly overhead. I tried to use orgstruct++ (which is the more or less exactly the solution I need) inside the elisp block but that does not seem to work either. I get an error, and I presume that orgstruct++ was not intended for use on org-files. Is my goal impossible to achieve?

What I tried inside the elisp source code block

    ;;; -*- orgstruct-heading-prefix-regexp: ";;" -*-
;; Does this and that
...
;; Does that and this
...

Workaround example:

*** TLDR - Too Long Didn't Read cheat.sh offline Repository run tldr-update-docs before first run, wait for the download/decompression
**** Use-Package Opening
#+BEGIN_SRC emacs-lisp
 (use-package tldr
#+END_SRC
**** Misc Configuration
#+BEGIN_SRC emacs-lisp
:commands
(tldr tldr-mode tldr-update-docs my-tldr-only-linux my-tldr-only-osx my-tldr-only-common+linux)
:config
(setq tldr-enabled-categories '("common" "linux" "osx"))
#+END_SRC
**** Custom Functions
***** Filter TLDR
#+BEGIN_SRC emacs-lisp
    (defun my-tldr-only-osx ()
    (interactive)
    (let ((tldr-enabled-categories '("osx")))
      (tldr)))   (defun my-tldr-only-linux ()
    (interactive)
    (let ((tldr-enabled-categories '("linux")))
      (tldr)))   (defun my-tldr-only-common+linux ()
    (interactive)
    (let ((tldr-enabled-categories '("common" "linux")))
      (tldr)))
#+END_SRC
**** Use-Package Closing
#+BEGIN_SRC emacs-lisp
 )
#+END_SRC


texts: How can I arrange several frames at fixed, relative positions?

texts: When compiling a TeX document I would like to have two buffers containing the LaTeX output and TeX-error-overview in separate frames which are positioned relative to the current frame (the error overview in a shallow frame at the bottom and the output on the right side). How can I do that?


texts:
Below is debugger results. epa does work fwiw.

Debugger entered--Lisp error: (error "Encrypt failed")
  signal(error ("Encrypt failed"))
  error("Encrypt failed")
  org-encrypt-entry()
  funcall-interactively(org-encrypt-entry)
  call-interactively(org-encrypt-entry record nil)
  command-execute(org-encrypt-entry record)
  helm-M-x(nil #("org-encrypt-entry" 0 17 (match-part "org-encrypt-entry")))
  funcall-interactively(helm-M-x nil #("org-encrypt-entry" 0 17 (match-part "org-encrypt-entry")))
  call-interactively(helm-M-x nil nil)
  command-execute(helm-M-x)


texts: Auto-Complete stops working with C files

texts:
I am using Emacs24, and my auto-complete plugin was working when I opened my .emacs file. However, it doesn't work when I open some file like :

whatever.c

To add to this, the auto-complete-c-headers do not work. I believe that auto-complete doesn't work on c/c++ mode.

Here is my .emacs file:

(add-to-list 'load-path "~/.emacs.d/elpa/neotree")
(require 'neotree)
(global-set-key [f8] 'neotree-toggle)

(defun my:ac-c-header-init()
    (require 'auto-complete-c-headers)
    (add-to-list 'ac-sources 'ac-source-c-header))
(add-hook 'c++-mode-hook 'my:a-c-header-init)
(add-hook 'c-mode-hook 'my:ac-c-header-init)

(require 'cc-mode)
(add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))

(setq-default c-basic-offset 2 c-default-style "linux")
(setq-default tab-width 2 indent-tabs-mode t)
(define-key c-mode-base-map (kbd "RET") 'newline-and-indent)

(add-to-list 'load-path
              "~/.emacs.d/plugins/yasnippet")
(require 'yasnippet)
(yas-global-mode 1)

(add-to-list 'load-path "~/.emacs.d/elpa")
(require 'linum)
(global-linum-mode 1)

(add-to-list 'load-path "~/.emacs.d/elpa/auto-complete-1.3.1")
(require 'auto-complete)
(require 'auto-complete-config)
(define-globalized-minor-mode real-global-auto-complete-mode
  auto-complete-mode (lambda ()
                       (if (not (minibufferp (current-buffer)))
                         (auto-complete-mode 1))
                       ))
(real-global-auto-complete-mode t)
(ac-config-default)
(ac-set-trigger-key "TAB")
(ac-set-trigger-key "<tab>")


texts: Why does setting the 'face property trigger fontification?

texts:
I'm trying to write a major mode for a programming language with JSX based syntax. Here's a minimal implementation.

(defun example-forward-parse-jsx (start-pos limit)
  "Move point past the JSX expression beginning at START-POS."
  (goto-char start-pos)
  (search-forward "
" limit t))

(defun example-font-lock-jsx (limit)
  "Search up to LIMIT for a JSX expression.
If we find one, move point to its end, and set match data."
  (let ((start-pos nil)
        (end-pos nil))
    (save-excursion
      (while (and (not end-pos)
                  (re-search-forward (rx space (group "<")) limit t))
        (setq start-pos (match-beginning 1))
        (example-forward-parse-jsx start-pos limit)
        (setq end-pos (point))))
    (when end-pos
      (set-match-data (list start-pos end-pos))
      (goto-char end-pos))))

(defvar example-font-lock-keywords
  ;; Move over JSX expressions first, so we don't highlight their contents.
  '((example-font-lock-jsx (0 'default))
    ("\\(let\\)" . font-lock-keyword-face)))

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

I want to treat let as a keyword, except in JSX blocks. The following code:

let x =
foo let
;

Highlights correctly with the above major mode:

However, as soon as I insert a 'face text property (but not any other property), I end up with incorrect keyword highlighting inside my JSX expression.

(defun example-forward-parse-jsx (start-pos limit)
  "Move point past the JSX expression beginning at START-POS."
  (goto-char start-pos)
  (search-forward "
" limit t)
  (put-text-property (+ start-pos 1) (+ start-pos 2)
                     'face 'font-lock-type-face))

This produces:

Whereas I want:

How can I set inner face properties inside a font-lock-keywords function?


texts: Haskell Interactive Mode Setup - cabal unrecognised command: repl

texts:
I'm trying to set up haskell-mode following this instructions

[0] https://github.com/haskell/haskell-mode/wiki/Haskell-Interactive-Mode-Setup

[1] http://tim.dysinger.net/posts/2014-02-18-haskell-with-emacs.html

but when I try to bring the REPL in a .hs file I'm getting the following error:

Starting inferior `cabal repl' process using cabal ...
-> :set prompt "\4"
-> Prelude.putStrLn ""
-> :set -v1
<- cabal: unrecognised command: repl (try --help)

Event: "exited abnormally with code 1
"

I have the "cabal repl" working.

Do you know what I'm missing?

Thanks!

Edit:

I followed these steps [1]:

$ cabal --v
cabal-install version 1.20.0.3
using version 1.20.0.2 of the Cabal library

$ cabal install happy alex
$ cabal install ghc-mod structured-haskell-mode stylish-haskell

$ mkdir haskell-hello
$ cd haskell-hello
$ cabal init
$ touch LICENSE
$ cabal sandbox init

$ perl -p -i -e 's/^.*main-is.*$/  main-is: Main.hs/' haskell-hello.cabal
$ echo 'main = putStrLn "hello world"' > Main.hs
$ cabal install
$ ./.cabal-sandbox/bin/haskell-hello
  hello world

Then I open the Main.hs in Emacs. In haskell-mode I try to open a REPL with haskell-process-load-or-reload or haskell-interactive-bring but this error appears:

<- cabal: unrecognised command: repl (try --help)

I have cabal repl working:

$ cabal repl
GHCi, version 7.6.3: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude>

Edit 2:

When I eval

(process-lines "cabal repl")

I have the following result

apply: Searching for program: no such file or directory, cabal repl

Edit 3:

My haskell configuration on .emacs:

;; haskell
(require-package 'haskell-mode)

(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

(eval-after-load "haskell-mode"
  '(progn
     (define-key haskell-mode-map (kbd "C-,") 'haskell-move-nested-left)
     (define-key haskell-mode-map (kbd "C-.") 'haskell-move-nested-right)))

(define-key haskell-mode-map [f7] 'haskell-navigate-imports)

(custom-set-variables '(haskell-stylish-on-save t))

(add-hook 'haskell-mode-hook 'interactive-haskell-mode)

(custom-set-variables '(haskell-process-type 'cabal-repl))

(setq haskell-ghci-program-name "cabal")
(setq haskell-ghci-program-args '("repl"))

(custom-set-variables
  '(haskell-process-suggest-remove-import-lines t)
  '(haskell-process-auto-import-loaded-modules t)
  '(haskell-process-log t))

(define-key haskell-mode-map (kbd "C-c C-g") 'haskell-interactive-bring)
(define-key haskell-mode-map (kbd "C-c C-l") 'haskell-process-load-or-reload)
(define-key haskell-mode-map (kbd "C-c C-t") 'haskell-process-do-type)
(define-key haskell-mode-map (kbd "C-c C-i") 'haskell-process-do-info)
(define-key haskell-mode-map (kbd "C-c C-c") 'haskell-process-cabal-build)
(define-key haskell-mode-map (kbd "C-c C-k") 'haskell-interactive-mode-clear)
(define-key haskell-mode-map (kbd "C-c c") 'haskell-process-cabal)
(define-key haskell-mode-map (kbd "SPC") 'haskell-mode-contextual-space)


texts:
There is a very convenient function M-@ Mark-word.

However, I usually find my self typing things, than marking things backwards to copy it some place else.

Is there something equivalent for mark-word-backwards or would I have to write a script to manually mark and go backwards? If so, is there a recommended key sequence to map this to?

Thank you.


texts:
Many emacs macros are prefixed with 'with' keyword in elisp. In an imperative language like python, with statement is used to create a temporary variable like this,

with controlled_execution() as tempVar:
     some code

However, in macros like with-current-buffer, with-temp-buffer, with-temp-message, i see with is not used for similar purpose. Can someone explain, in elisp macro, when to prefix a macro name with prefix 'with'? And because these macros are expected to clear their temp variables, do they have any side effect on the main program?


texts: how to do simple calculations on numbers in text

texts:
I have a Json file containing a quite a few coordinates like {x: 400, y:200}
And I want to change the numbers for the y values in something like y:y_default + 120. (y_default = 80). Is there a quick way to achieve this?


texts: How can I get lint warnings when I've forgotten to require a package?

texts:
Flycheck has a brilliant ability to warn about when I'm using a function foo-bar but have forgotten to add (require 'foo) at the top of my file.

However, it's inconsistent. It doesn't always warn for functions from some packages, even if the function is not autoloaded. How can I make Emacs warn me about these?

;; This produces a warning
;; "the function `which-function' is not known to be defined."
(defun which-func-not-required ()
  (which-function))

;; This produces no warning.
(defun cl-not-required (x)
  (cl-copy-list x))

;; This produces no warning either.
(defun byte-comp-not-required (f)
  (byte-compile-top-level f))

;; end

(inspired by this PR)


texts: Is there any way to inline a top-level definition or let binding in Haskell? I can't find any built-in solutions in vanilla haskell mode, HaRe, or Intero.


texts: Switch to the nth most recently used buffer

texts:
I switch buffers with C-x b a lot.

C-x b switches to the most recently used buffer. What if I want to switch to the 2nd most recently used buffer (or the nth most recently used buffer). I tried the obvious C-u 2 C-x b
but didn't work.


texts: in Fundamental mode, give certain marked text a different face

texts:
I am trying to add a new comment character in fundamental mode, but I can't get it to work.
Let me rephrase that, because I think it's an xy-problem.
What I really would like to have is the possibility, in Fundamental mode, to give certain swaths of text a different face (1).
For instance, mark a region, then with a key-combo or menu-item, give that marked text a very light grey background.
I was starting out by the assumption that you can only do this by setting a custom comment character, and thus have the swath text be treated a s a comment and hence a different face.
Going on that assumption, in Fundamental mode, I would like to have all lines that start with the sequence "pipe character and a space" i.e. in regex something like '[[:space:]]*| .*' to be treated as comments (and thus have a different face).
But I cannot get it to work even in its simplest iteration; I thought this would work, but it doesn't:
(defun fundamental-mode-set-comment()
    (font-lock-add-keywords 'fundamental-mode
        '(("\\(| .*$\\)" 1 'font-lock-comment-face t))
    )
)

(add-hook 'fundamental-mode-hook 'fundamental-mode-set-comment)

Even though my mode line says ('Fundamental' ...), i.e. Fundamental mode is in effect, I cannot
get the face change to work.
Is there a way to get what I want without resorting to a new comment type?
Am I going about this the right way, given (1)?
(I am using emacs 25.3.2.)


texts: How to separate normal text from the frame block?

texts:
I just want to make the text appear separate from the above frame box in beamer export C-c C-e l O as in the MWE below.

MWE:

#+TITLE: Frame or Text?
#+AUTHOR: Casual Author
#+DATE:
#+OPTIONS: H:2 toc:t num:t
#+LATEX_CLASS: beamer
#+LATEX_CLASS_OPTIONS: [presentation]
#+EXPORT_EXCLUDE_TAGS: noexport

#+BEAMER_THEME: default
#+BEAMER_COLOR_THEME: seagull
#+BEAMER_OUTER_THEME: default
#+BEAMER_INNER_THEME: rectangles
#+BEAMER_FONT_THEME: structurebold

#+COLUMNS: %45ITEM %10BEAMER_ENV(Env) %10BEAMER_ACT(Act) %4BEAMER_COL(Col) %8BEAMER_OPT(Opt)

* Section
** Introduction
Some text is flowing here.
*** Definition
    This is a general statement that should be appearing within a frame, but is should be separate from the two coming points below.

    1. first point
    2. second point

Output

Question

How to make the two points appear outside the frame box exactly as in the Some text is flowing here. Leaving two empty lines before the numbered list did not solve it.


texts:
I am using helm-org-in-buffer-headings to search headings in the current buffer. I am using this script (provided by jagra here) to activate follow mode:

  (with-eval-after-load "helm-org"
    (cl-defmethod helm-setup-user-source ((source helm-org-headings-class))
      (set-slot-value source 'follow 1)))

So as I navigate through the helm source list, I see the corresponding headings in the main buffer. For example:

Instead of seeing the entire document, while I browse through the source list, I would like to narrow-to-subtree.

Any ideas?


texts: Error message when reading org file containing bibtex block

texts:
I have an org file containing bibtex source blocks. Some time
after I open it, I get the message

    Error running timer `bibtex-parse-buffers-stealthily':
    (wrong-type-argument number-or-marker-p nil)

How do I proceed in order to stop getting this message?


texts: How to edit and save an extremely stubborn read-only file

texts:
I am trying to edit the file /etc/postfix/main.cf but this applies to any file.

Currently its permission bits are set to -rw-r--r--

I want to open, edit and save this file when operating as a regular user in emacs.  However, try as I might, I just can not do it.  Here are the options I have tried.

First I tried this method: C-x C -q
This allows me to edit the buffer well enough, but when I try to save the buffer I am presented with: File main.cf is write-protected; try to save anyway? (yes or no)
and when I type yes I get:

Doing chmod: operation not permitted, /etc/postfix/main.cf

Similarly, if I try M-! chmod u+w main.cf at any point I get the message:

chmod: changing permissions of 'main.cf': Operation not permitted

Lastly if I try to edit the file in wdired with wdired-allow-to-change-permissions I get

chmod 664 '/etc/postfix/main.cf' failed

Emacs is so powerful it seems like there must be a way to do this without using
the /sudo::/filename trick mentioned here

Additionally, I think there should be a "permissions" tag here in emacs stack overflow.


texts: Start Emacs with entering gdb mi mode (NOT after startup and enter gdb mi manually)

texts:
How do I start emacs with a command and its option, for example, I want emacs start with entering gdb mi mode, otherwise it does not go to the gdb mode during startup.

The following works:

emacs gdb

Or using evaluate:

emacs gdb -e gdb

But I want to enter the mi mode and this does not work:

emacs gdb -i=mi

Or this:

emacs -e gdb -i=mi

Unfortunately I just want to enter mi mode directly during startup.


texts: How can I reset the prompt of my machine before using tramp without having this setting being permanent?

texts:
I have a cool looking (at least for me) prompt for my bash shell. This mean that tramp hangs if I try to use sudo to open a file because my prompt looks like something unexpected to tramp. And I really don't like to deal with regexp.

So, I was wondering how can I reset the prompt of my machine before using tramp!


texts:
I'm using the taskjuggler export backend for org-mode. All works well except I cannot work out how to set some project global values. I want to set the follow for all my exported *.tjp files

timezone \"Australia/Sydney\"
dailyworkinghours 7
workinghours mon - fri 9:00 - 13:00, 14:00 - 17:00
workinghours sat, sun off

These settings need to go into the project header section i.e

project nil "Work" "1.0" 2015-02-01 +3y {
  timezone "Australia/Sydney"
  dailyworkinghours 7
  workinghours mon - fri 9:00 - 13:00, 14:00 - 17:00
  workinghours sat, sun off

}

However, I can't seem to find a way to do this. There are various custom settings, such as org-taskjuggler-default-global-header, but this inserts its value before the project header. There is also org-taskjuggler-default-global-properties, but it inserts the contents after the project block. Neither will suit as the parser for taskjuggler will not recognise the values correctly unless they are in the project header (well, they will recognise them if they are in each task, but I don't want to have to set these values for every task)

I've had a bit of a look at the ox-taskjuggler elisp code, but cannot find an easy way to do this.

I'm sure others have wanted to set/change the defaults, but I cannot see how to do this easily. Any ideas?


texts:
I've just installed Emacs 26.3 on my macOS 10.10 (Yosemite) using the binary at Emacs for OSX Everything so far works fine icluding new package installations and different themes. However, when I tried to edit a file on my Linux server using this TRAMP line:

/myuname@myserver.com:

It returned:

File not found and directory write-protected

and a blank buffer appeared in the window area.

When I tried Emacs-25.3 binary from the same website, that same TRAMP line worked perfectly and I managed to edit file on the server. When I tried Emacs 26.1 and 26.2, the same problem occured again. So I think this problem is specific to Emacs 26.x.

What should I do to make TRAMP work on Emacs 26.x on macOS?


texts: Why does ido-find-file still show . when ido-ignore-directories seems to exclude it?

texts:
I have my ido-ignore-directories set to the standard value:

("\\`CVS/" "\\`\\.\\./" "\\`\\./")

The third regexp, "\`\./" should ignore the current directory, as near as I can tell. However, it doesn't:

Find file read only: ~/{. | Desktop/ | Documents/ | ...}

If it matters, I have C-x C-f bound to ido-find-file-read-only. This is with emacs 24.3.1. How do I fix it?


texts: Are `emacs-devel` mailing list archives from prior to the year 2000 available somewhere?

texts:
The archives of the emacs-devel mailing list go back to the year 2000 and are publicly available on the web.

Are there older archives somewhere?  Was emacs-devel the first mailing list that was used to discuss GNU emacs development, or were there others?


texts:
If I would like to keep my emacs settings and packages in another computer or after a format is there a way to avoid having to install all the packages from the beginning?

I don't just mean saving the .emacs as to have the customizations but also the packages that come with it. I was wondering if I copy and save my elpa file and then paste it in a new PC is there going to be any problem?

Do the packages install files also in other folders of a system, so the aforementioned technique may cause problems, or is this a good way to keep your Emacs always with you?


texts: Looking for something like a `first-keypress-in-a-while-hook`

texts:
Suppose that I have an Emacs session running, and that I step away from my computer for, say, 20 minutes.  Upon returning to my Emacs session, at some point I will press some key while the Emacs window has the focus.  This would be an example of the sort of event I'm calling first-keypress-in-a-while 1.

I'm looking for a way to have Emacs automatically run some code whenever such an event happens.  IOW, I'm looking for something like a first-keypress-in-a-while-hook.

Looking through Emacs' standard hooks I cannot immediately identify a good candidate, but maybe there is a non-obvious one that could do this job.

Alternatively, is there some other way that I could simulate/approximate such a hook's functionality?

1 Of course, in-a-while refers to some user-settable parameter corresponding to some minimum time interval, say 15 minutes.  The event I'm interested in is the first key press after a period of inactivity longer than this interval.  By "inactivity" I mean the state where Emacs detects no user interaction: no key-presses, no mouse clicks, etc.


texts: helm-do-grep, start search from git repository's base folder

texts:
By default, when i do M-x helm-do-grep, helm prompts to search from the current buffer's folder location. I would prefer it to list the git repository's base folder (where .git folder is located) as the default string in minibuffer and search recursively down all sub folders.

How to configure helm to automatically identify folder with .git contents as base folder and use it for all search activities?


texts: how to find non-interactive function equivalents of elisp interactive functions

texts:
In the description of the function goto-line in the built-in emacs documentation, I found the following at the end:

This function is usually the wrong thing to use in a Lisp program.
What you probably want instead is something like:
  (goto-char (point-min))
  (forward-line (1- N))
If at all possible, an even better solution is to use char counts
rather than line counts.

Similarly, the switch-to-buffer function's documentation says:

WARNING: This is NOT the way to work on another buffer temporarily
within a Lisp program!  Use `set-buffer' instead.  That avoids
messing with the window-buffer correspondences.

Is it possible to know the non-interactive versions of frequent interactive functions like save-buffer, kill-line etc. or that these are efficient and do not have a non-interactive equivalent?
I did not find any relevant information about the two specific commands save-buffer and kill-line in the built-in documentation, so I would also like to know if that implies that these are okay for non-interactive use.


texts:
This question asks how to connect to Google Hangouts with Jabber specifically, but I want to un-XY it.

Google has dropped support for XMPP and switched to a proprietary protocol. Is there an existing package or combination of packages that allows Emacs to communicate through this protocol?


texts:
I want to write a function that does one thing if erc is running and starts erc (using command erc) if not.
I tried to write it myself, but I couldn't find out how to check if erc is running. How can I do this in elisp?


texts: Suggestion/tips on markup for a note/annotation that is a question mixed with other notes?

texts:
While using org-mode to take notes, e.g. when learning about something, I often have questions that I write down -- smack in the middle of the main notes. Right now I just use this markup/approach:
*** Some topic
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
- Nisi ut aliquip.
  - Excepteur sint occaecat cupidatat non proident.
- [ ] Q: What markup should I use in org-mode for small/local questions?

Sunt in culpa qui officia deserunt mollit anim id est laborum.

Is there a better markup or way of doing it? E.g. using headings and tags?
Use something like TODO?  But I think TODO/DONE requires adding an extra heading, which affects the subsequent notes.  Unless there's a markup to "go up one heading level" that I don't know about...?
I'd like to be able to add an answer and mark the question as answered, as well as easily search for unanswered questions.
I'm looking for some practical suggestions.
To find unanswered questions I search my .org-file for [ ] Q:. Answers I sometimes put in as per below:
*** Some topic
Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
- Nisi ut aliquip.
  - Excepteur sint occaecat cupidatat non proident.
- [X] Q: What markup should I use in org-mode for small/local questions?
  - A: In practice there's no way that's significantly better than this.

Sunt in culpa qui officia deserunt mollit anim id est laborum.

Note: Found slightly related question Different colors for questions and answers in org-mode


texts: How to add more default face highlight colors

texts:
Using (highlight-symbol-at-point) at some point the highlight start repeating colors.

I find the variable that holds the default face highlight color values in Emacs is:
hi-lock-face-defaults
It holds this value:
("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-salmon" "hi-aquamarine" "hi-black-b" "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb")

I want to add more default colors. What is the best way to do it?


texts: syntax-highlighting strings incorrectly for strings in opascal-mode

texts:
I write my projects in FreePascal and use opascal-mode to write it. I'm having a problem that this mode thinks that '\' is not a complete string, and hence all code after it is highlighted as a string.
How can I change the opascal-mode (or add a hook) in which it will not try to parse the backslash as an escape character? In FreePascal, strings do not support backslash as an escape char.

I'm using GNU Emacs 24.5.1 and this is a sample code that when run in opascal-mode, it highlights everything after the '\' improperly:

// syntax_highlight.dpr

{$mode objfpc}{$H+}
program my_program;
uses Classes;

var newVal : char;

begin
  newVal := '\'; // syntax highlight breaks here!
  if newVal = '''' then begin
    writeln('single quote');
  end else if newVal = '\' then begin
    writeln('backslash');
  end;
end.

I've tried messing around with modify-syntax-entry, but nothing I tried worked.

EDIT: this is the fixed config in ~/.emacs after I've implemented @JeanPierre's fix

;; associate pascal files as opascal-mode
(add-to-list 'auto-mode-alist '("\\.pas$" . opascal-mode))
(let* ((pascal-files '(".pas" ".pp" ".inc" ".lpr" ".dpr"))
       (pascal-regexp (concat (regexp-opt pascal-files t) "\\'")))
  (add-to-list 'auto-mode-alist (cons pascal-regexp 'opascal-mode)))

;; don't escape backslashes in pascal
(add-hook 'opascal-mode-hook
          (modify-syntax-entry ?\\ "."))


texts: How to set the evil-visual-line 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 evil-mode line visual selection?

(note, I originally asked this question, but found its not compatible with evil-visual-line-mode)

This page looks like it's the same issue, but the solution doesn't apply here AFAICS.


texts: How to overwrite properly a face for a particular theme

texts:
I use the monokai theme by default in my Emacs configurations. But sometimes I use other themes too, particularly light themes like leuven if the light in the room is more suitable for that. But I don't like the face that monokai uses for org-block (the background exactly), thus I want to override it.

My first attempt was this (I use use-package):

(use-package monokai-theme
  :ensure t
  :config
  (custom-theme-set-faces
   'monokai
   '(org-block ((t (:foreground "#F8F8F0" :background "#171717"))))))

And works perfectly fine at the start, but if I switch to another theme and then go back to monokai the org-block face is the default one of the theme again, ignoring my customization. The same happens if I try to wrap that in a (with-eval-after-load "monokai-theme" ... ) function (as in How to change face in particular theme locally?).

So, I tried another approach, using a hook that I use to reset my smart-mode-line theme every time that I change the theme. The entire solution is this:

(use-package monokai-theme
  :ensure t
  :config
  (progn
    (defvar after-load-theme-hook nil
      "Hook run after a color theme is loaded using `load-theme'.")
    (defadvice load-theme (after run-after-load-theme-hook activate)
      "Run `after-load-theme-hook'."
      (run-hooks 'after-load-theme-hook))
    (defun customize-monokai ()
      "customize monokai theme"
      (custom-theme-set-faces
       'monokai
       '(org-block ((t (:foreground "#F8F8F0" :background "#171717"))))))
    (add-hook 'after-load-theme-hook 'customize-monokai)))

And this works, now every time that I change themes and go back to monokai my custom face is applied as expected. But this also is not a perfect solution because it has side effects, like to switch to a light theme like leuven and have the org-block background in a dark grey instead of the theme default. If you reload the leuven theme again, then seems to apply the theme default and ignore my customization. But this is not a desirable solution, and in the other hand, in a light theme like leuven is easy to see that something went wrong, but it could not be that easier in another dark themes.

I have looked for another solutions but either didn't work, or are generic solutions (for all the themes, not a particular one) or seems too cumbersome.

Is there a properly way to persistently overwrite a face only for a particular theme?


texts: How to prevent Magit from asking where to push a branch?

texts:
When calling magit-push-current with P P from the status buffer, Magit 2.1.0 asks me where to push the branch on the first time, when upstream is not set.

How can it let automatically generate the name as it used to do before?


texts: Saving raw ANSI escape codes in M-x shell, M-x eshell, or M-x term

texts: Each of M-x shell, M-x eshell, and M-x term in Emacs lets me save the buffer to a text file.  But the terminal colors are not saved.  How do I save the raw ANSI escape sequences too?


texts: Why does projectile-compile-project call "go build ./..."?

texts:
I just started to use projectile. I use it with a go project. When I call projectile-compile-project, go build ./... runs, but after that there is no binary. The same happens when I call go build ./... from the shell.

Why is go build ./... called and not go build?
What does ./... mean anyway? I've never seen that in ~20 years of Linux command-line usage
What's the preferred way to customize that globally (i.e. not in .dir-locals.el) for go-mode?


texts: How to get the value of a variable inside an org-mode file from command line?

texts:
Is there a reliable way to get the value of a variable defined inside an org-mode file from the UNIX shell (bash)?
For example, if I have the following inside an org mode file test.org:
#+NAME: foo
| bar |

, is it possible to write a shell script to get the value of foo?
I know how to extract the value of a variable inside the org file, but just couldn't find a way to retrieve the value externally from the command line.
(This is with the org mode shipped with Emacs 26 in Ubuntu 20.04 LTS)


texts: How to open and rename several multi-term buffers on start-up?

texts:
After each reboot, I have to painfully re-create and rename the
multi-term buffers I use in my daily routine.

I am completely new to Lisp, but nonetheless, I searched for similar problem on the web and tried to adapt the code snippets I've found. I managed to open a multi-term buffer, but renaming does not work as expected. Here is what I've tried so far in my init.el:

(require 'multi-term)
(setq multi-term-program "/bin/bash")
;; Try to recreate my terminals
(add-hook 'emacs-startup-hook 'multi-term)
(add-hook 'emacs-startup-hook 'get-buffer)
(rename-buffer "redshift")  ;; it renames the previous buffer (not the good one)

As a bonus, I would also like to be able to cd to a specific directory. Thanks for your advice.

PS: I work on GNU Emacs 23.4.1 (Debian stable).


texts: Is it possible to use AUCTeX preview-latex in emacs terminal?

texts: I was wondering if it is possible to have latex preview working in emacs terminal. This is somehow related to this question. But 3 years have passed and I'm wondering if anything has changed? For instance iterm terminal allows users to display images directly on the terminal through the imgcat command. I'm wondering is there's anything equivalent for emacs terminal + auctex?


texts: Get Emacs to jump to the start of a word after isearch

texts: If I use isearch to search for the word "accommodating" in my document, I have to type acc before the cursor jumps to the word. When I press enter the cursor is on the the second "c" as in acCommodating. This strikes me as rather unintuitive because I have to go back two characters to begin editing the word. In Vim, search puts the cursor at the start of the word. Can I replicate this behaviour in Emacs?


texts: How to hop the cursor over parenthesis, brackets, single-quotes, and double-quotes

texts:
One of the features I miss in Visual Studio is the ability to hop over closing parenthesis, brackets, single-quotes and double-quotes with tab
Does anyone know of a script to do such a thing?

Pseudo Code:

If character to the right of cursor == ')' or '}' or '\'' or '"'
    Move cursor over one space.
Else
    indent-line/autocomplete/etc.


texts: How to bind C-[ for real (seriously for real this time)

texts:
Is there any way to bind C-[ to something and not have all M- (Meta) bindings messed up?

Not the first time this question comes up. Unfortunately, the only solution offered in the previous thread is a) Linux specific, b) requires an external tool (again Linux specific) that has nothing to do with Emacs. In the same vein I could have used something like Karabiner on a OS X to steal the C-[ sequence before Emacs ever gets it but this is clunky and expensive.

Given that it is Emacs that insists on translating C-[ to ESC, C-i to TAB and probably others I would very much like to break these relationships and get precious key sequences back. Recently I ran full speed into this problem and blamed quiet innocent smartparens mode.

A possible solution that involved function-key-map and key-translation-map was discussed here but alas it either no longer works or did not work in the first place (or I'm doing something wrong). I think it was going in the right direction though.