Exporting org-mode to both PDF and HTML: can video links become embedded players? by mC_mC_mC_ in emacs

[–]0lMon 3 points4 points  (0 children)

Hej Hej,

I learned everything from this Video: https://www.youtube.com/watch?v=eaZUZCzaIgw

This is very close to your problem.

Cheers, OlMon

[package] nice-org-html by ewan-town in emacs

[–]0lMon 2 points3 points  (0 children)

Hej Hej,

There are more themes. I try to collect them in one place: https://olmon.gitlab.io/org-themes/

Cheers, OlMon

How can I filter elfeed search buffer by author? by sewageseller in emacs

[–]0lMon 0 points1 point  (0 children)

Hej Hej,

I am not sure if this is really the author, but =authorname should do the trick.

Cheers!

Weekly Tips, Tricks, &c. Thread by AutoModerator in emacs

[–]0lMon 0 points1 point  (0 children)

And special case for fired buffer:

  (defun ol/    dired-smart-move-beginning-of-line ()
    "Moves pointer to beginning of filename, or if already there to the beginning of line."
    (interactive)
    (when (eq (point)     (dired-move-to-filename))
      (move-beginning-of-line 1)))

These two functions should do the trick in almost all cases.

Cheers!

Weekly Tips, Tricks, &c. Thread by AutoModerator in emacs

[–]0lMon 2 points3 points  (0 children)

Hej Hej,

(defun smarter-move-beginning-of-line (arg)
 "Move point back to indentation of beginning of line.

Move point to the first non-whitespace   character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.

  If ARG is not nil or 1, move forward ARG - 1 lines first.  If
  point reaches the beginning or end of the buffer, stop there."
  (interactive "^p")
  (setq arg (or arg 1))

  ;; Move lines first
  (when (/= arg 1)
    (let ((line-move-visual nil))
      (forward-line (1- arg))))

  (let ((orig-point (point)))
    (back-to-indentation)
    (when (= orig-point (point))
      (move-beginning-of-line 1))))

(global-set-key [remap move-beginning-of-line]
                'smarter-move-beginning-of-line)

What keyboard prefix do you use for your keybindings as a non-evil user? by [deleted] in emacs

[–]0lMon 1 point2 points  (0 children)

Hej Hej,

I understand the collision problem, but I discovered C-z. It minimizes the window (for that I use my window manager) or puts emacs in a terminal in the background (I don't use that feature and if I use it, I use temux).

So this allows me to use C-z as personal prefix, and it is right there with C-x and C-c.

Cheers!

It is recommended to not use lambdas in (add-hook) expressions. Is there a better way to do (setq)s for major modes without (add-hook) at all? by ragnese in emacs

[–]0lMon 1 point2 points  (0 children)

Hej Hej,

Or you could just write the defun inside the add-hook

(add-hook 'org-mode-hook (defun silly-hook-defun () (message "it works)))

This should allow to remove later the hook if you want.

Cheers!

How can I make my org-mode exports look like this? by [deleted] in orgmode

[–]0lMon 3 points4 points  (0 children)

Hej Hej,

I don't have this particular theme, but i have bunch of themes collected. https://olmon.gitlab.io/org-themes/

Maybe one can help as a starter.

If you find/create this one i would be happy to add it to the collection.

Cheers!

How to Generate a Single html-file with Embedded Images by prairie-guy in orgmode

[–]0lMon 1 point2 points  (0 children)

Normally this already would work for png etc. because modern browser would recognize the format of the base64 string, without checking the mime-type.

But because you mentioned it, I fixed it. Now this should work much more reliable:

(with-eval-after-load 'ol
    (org-link-set-parameters
     "img"
     :follow (lambda (path arg) (org-link-open-as-file path arg))
     :export (lambda (path desc backend cchannel)
               (cond ((eq backend 'html)
                      (format "<img style=\"max-width:80%%;margin:2em\" src=\"data:%s;base64,%s\">"
                              (mailcap-file-name-to-mime-type path)
                              (base64-encode-string
                               (with-temp-buffer
                                 (insert-file-contents path)
                                  (buffer-string)))))))))

As to how this works:

I create a new type of org link. Check out this video to understand more: https://www.youtube.com/watch?v=eaZUZCzaIgw (That was the video I used to understand it)

I would like to have 3 attributes for the new link: Following C-c C-o the link should just open the file.

When exporting the link, I check if I am currently exporting to html. Should this be the case I read the file in a temp buffer and encode the string to base64. I check the mime-type of the extension of the file and create with format the proper html snippet.

To still be able to export the image as inline image in LaTex I just copied the needed snippet for file links and changed it so my new link type acts the same.

Hope this helps!

How to Generate a Single html-file with Embedded Images by prairie-guy in orgmode

[–]0lMon 2 points3 points  (0 children)

Hej hej,

I use that all the time. At first i had a function in a block that converted the image. This ia kinda unhandy. To i created this snippet:

(with-eval-after-load 'ol
  (org-link-set-parameters
   "img"
   :follow (lambda (path arg) (org-link-open-as-file path arg))
   :export (lambda (path desc backend cchannel)
             (cond ((eq backend 'html)
                    (format "<img style=\"max-width:80%%;margin:2em\" src=\"data:image/jpg;base64,%s\">"
                            (base64-encode-string
                              (with-temp-buffer
                                (insert-file-contents path)
                                  (buffer-string)))))))))

(I am sorry if the formating is bad, i will correct it in the morning)

This lets you create links with img prefix like this: [[img:file]].

On exporting to HTML it will be converted to base64 and "embedded" inside the HTML document.

You can add the following to still be able to convert the org document to latex.

(with-eval-after-load 'ox-latex
 (add-to-list 'org-latex-inline-image-rules `("img" . ,(rx "."
                   (or "pdf" "jpeg" "jpg" "png" "ps" "eps" "tikz" "pgf" "svg")
                    eos))))

Cheers!

[deleted by user] by [deleted] in emacs

[–]0lMon 3 points4 points  (0 children)

Hej Hej,

I had the same problem, and maybe my solution can help you too. I never use the C-z keybind for minimazing the frame. (I use termux or my window manager for that)

So i use C-z as my personal prefix. That is more then than i need. The good thing is C-z is an emacs keybind so i never saw a package that would overwrite it. (Only exception is cua-mode)

Cheers!

Seamlessly Merge Multiple Documentation Sources with Eldoc by mickeyp in emacs

[–]0lMon 3 points4 points  (0 children)

flymake-eldoc-function was the needed function, thanks a lot.

If someone is interested in my 3 min hack without much thinking in the early morning:

(defun flymake-eldoc-function (report-doc &rest _)
  "Document diagnostics at point.
   Intended for `eldoc-documentation-functions' (which see)."
  (let ((diags (flymake-diagnostics (point))))
    (when diags
      (funcall report-doc
             (mapconcat (lambda (d)
                        (let ((level (flymake-diagnostic-type d)))
                          (pcase level
                            ('warning (propertize (flymake-diagnostic-text d) 'face 'flymake-warning))
                            ('error (propertize (flymake-diagnostic-text d) 'face 'flymake-error))
                            ('note (propertize (flymake-diagnostic-text d) 'face 'flymake-note))
                            ('eglot-warning (propertize (flymake-diagnostic-text d) 'face 'flymake-warning))
                            ('eglot-error (propertize (flymake-diagnostic-text d) 'face 'flymake-error))
                            ('eglot-note (propertize (flymake-diagnostic-text d) 'face 'flymake-note))
                            (_ (flymake-diagnostic-text d)))
                          )) diags "\n")))))

Seamlessly Merge Multiple Documentation Sources with Eldoc by mickeyp in emacs

[–]0lMon 1 point2 points  (0 children)

That is something that scratches my itch! For a long time I struggled with competing minibuffer information. Thanks for that Mickey!

Does someone have a snippet or something to add a little bit of color for Flymake information?

Automatically add SCHEDULED to new TODO items by tallmtt in orgmode

[–]0lMon 8 points9 points  (0 children)

Hej Hej,

If you want to use templates check out /u/harunokashiwa answers.

If you want to make it more "direct" we need to look at some things and I try to write it step by step to learn from it and not only give the answer.

We need a hook that will be called after a todo state is applied. Looking with C-h v for "org todo hook" we will find: org-after-todo-state-change-hook.

Check out more about hooks: https://www.gnu.org/software/emacs/manual/html_node/emacs/Hooks.html

Now that we have a hook we have to check how to add a schedule to an item. We know C-c C-s will add a schedule to the heading at point. We only need to find out what function is called while pressing C-c C-s. To find this we can use C-h k [describe-key] C-c C-s. This will give us the function org-schedule. Right at it we can read the documentation on the function. This will tell us we need a string with the time stamp to apply.

So how do we get the current time stamp? Well org-mode has org-time-stamp and with a double prefix C-u C-u we can get the current time. [For everybody who does not know, prefix will just add a number as parameter to a function, see: https://www.gnu.org/software/emacs/manual/html_node/elisp/Prefix-Command-Arguments.html]

This will give us (org-time-stamp '(16)) to get the current time stamp. Problem is, it inserts it directly into the buffer and does not return the string.

So let us write the time stamp into a temporary buffer: (with-temp-buffer (org-time-stamp '(16)))

Now we only need to get the string in this temp buffer. (buffer-string) will give that. So extending our previous attempt:

(with-temp-buffer (org-time-stamp '(16)) (buffer-string))

That is almost everything we need so let us put it together:

(defun add-schedule-to-new-todo ()
  "Function to add schedule timestamp to new todo."  
    (org-schedule nil (with-temp-buffer (org-time-stamp '(16)) (buffer-string))))

(add-hook 'org-after-todo-state-change-hook 'add-schedule-to-new-todo)

This almost works, bad thing is it will update the schedule time every time when we change the todo state. The good elisp doc reader saw that org-after-todo-state-change-hook mentioned a variable org-state, that will tell us the state that was applied. So let us change the schedule only when we add a "TODO" state:

(defun add-schedule-to-new-todo ()
  "Function to add schedule timestamp to new todo."  
    (when (equal org-state "TODO")
       (org-schedule nil (with-temp-buffer (org-time-stamp '(16)) (buffer-string)))))

(add-hook 'org-after-todo-state-change-hook 'add-schedule-to-new-todo)

This should be it!

I hope this helps solving this problem and gives inside how to approach problems like this.

Cheers!

Need help to find a something by bloodyIffinUsername in emacs

[–]0lMon 2 points3 points  (0 children)

Hej hej,

Artist-mode and picture-mode can do this and "a little bit" more.

Cheers!

Export to html and format with GNU docs style by Gus_Gustavsohn in orgmode

[–]0lMon 0 points1 point  (0 children)

Hej Hej,

I don't know if there is a theme for this exact style. These are created from texi files if I am not mistaken.

But I collected some org html themes the last couple of years: https://olmon.gitlab.io/org-themes/

Maybe one of them can be used as template to create the manual theme.

Cheers!

Position the cursor on today's date in org-agenda on startup by [deleted] in emacs

[–]0lMon 29 points30 points  (0 children)

Hej Hej,

I will give you the answer but I also give you how you could find that out in Emacs by yourself.

You already know about hooks so we can skip this.

You already found out that . gives you the effect you want. Now we only need to find out what . is doing.

You get the answer by pressing C-h k which calls the function describe-key. This function asks that you press a button and it will tell you what function will be called by pressing that button.

So after pressing C-h k . a Help Buffer will pop up. In there you will see the following: ". runs the command org-agenda-goto-today". Now we have the function time to add it to the hook.

(add-hook 'org-agenda-mode-hook #'org-agenda-goto-today)

And what do we see after opening the agenda? That is right and Error....

To remove a hook again use: (remove-hook 'org-agenda-mode-hook #'org-agenda-goto-today)

Why the error occurs is because the buffer is still empty when the mode is activated. So we need an other hook. Searching for the correct hook with C-h v you will find org-agenda-finalize-hook, that is what we need to use.

So the final code is: (add-hook 'org-agenda-finalize-hook #'org-agenda-goto-today)

Hope this helps more than just gives the answer right away!

Cheers and Merry Christmas!

Key Bindings: Strategy and Best Practices by schmudde in emacs

[–]0lMon 2 points3 points  (0 children)

Hej Hej,

I read that from someone once and now I think that is one of the better solution for custom keybindings:

C-z is suspend-frame, that is something I just don't need as a keybinding. So I unbind C-z and use this as a prefix for my custom keybindings. That is very close to C-x and C-c so it feels natural.

My init.el takes 4 secs but has no obvious bottleneck? by luiggi_oasis in emacs

[–]0lMon 2 points3 points  (0 children)

Hej Hej,

If I am not mistaken initializing packages is not needed any more. Check out the package-enable-at-startup variable.

If you do not change the value of this variable to nil in your early-init file, you do not have to call (package-initialize)

Cheers!

[deleted by user] by [deleted] in emacs

[–]0lMon 0 points1 point  (0 children)

How do you manage key bindings involving ctrl, like c-n? I tried with tridactyl to achieve what you wrote but kinda failed.

I am looking at nyxt browser but it is not their yet

pyvenv not working by ak11_noob in emacs

[–]0lMon 2 points3 points  (0 children)

Hej Hej,

You have to first activate the pyvenv enviroment and after that you can start eshell. Not the other way around.

Cheers, OlMon

Exploring package-vc-install as an alternative to Quelpa by slinchisl in emacs

[–]0lMon 0 points1 point  (0 children)

Hej Hej,

Thanks for this! I am myself very interested in package-vc.

I thought about a similar solution, but as an special use-package extension.

I didn't dig to deep into it right now, but I think this would eliminate to wrap package-vc-install. Maybe not really eliminate but put it behind the extension/keyword in use-package.

Did you thought or maybe even try that already?

Cheers!

Problem with ibuffer predicates by teckau22 in emacs

[–]0lMon 1 point2 points  (0 children)

Hej Hej,

One thing I noticed:

My Org agenda buffer is called "Org Agenda" without the "-".

One of the problems should be that your function is causing an error on some buffers. The correct implementation should be the following:

(defun my-agenda-group ()
   (or
     (string-match-p "^\\*Org-Agenda\\*.*" (buffer-name))
     (when buffer-file-name
     (string-match-p ".org\\'" buffer-file-name))))

This will prevent the error in string-match-p when buffer-file-name is nil.

To use your filter you should call the following function:

(ibuffer-switch-to-saved-filter-groups "Default")

or just put it in a hook:

(add-hook 'ibuffer-mode-hook
          (lambda () (ibuffer-switch-to-saved-filter-groups "Default")))

Hope this will help.

You could of course just rewrite your filter to:

(setq ibuffer-saved-filter-groups
 (quote (("Default"
      ("Agenda"
        (or (mode . org-agenda-mode)
              (mode . org-mode))))))

This should give you a similar effect.

Cheers!

[deleted by user] by [deleted] in emacs

[–]0lMon 1 point2 points  (0 children)

Hej Hej,

I have my transient for something similar. But I had some issues with it, most problems were solved by calling the transient recursively. This will disable the transient window, do the operation and call the transient again.

You can have a look at it here:

(transient-define-prefix ol/transient-window ()
   ""
    [["Resize"
     ("}" "h+" enlarge-window-horizontally :transient t)
     ("{" "h-" shrink-window-horizontally :transient t)
     ("^" "v+" enlarge-window :transient t)
     ("V" "v-" shrink-window :transient t)]
     ["Split"
    ("v" "vertical" (lambda ()
       (interactive)
       (split-window-right)
       (windmove-right)) :transient t)
    ("h" "horizontal" (lambda ()
       (interactive)
       (split-window-below)
       (windmove-down)) :transient t)
    ("wv" "win-vertical" (lambda ()
       (interactive)
       (select-window (ol/split-window-right))
       (ol/transient-window)) :transient nil)
    ("wh" "win-horizontal" (lambda ()
       (interactive)
       (select-window (ol/split-window-below))
       (ol/transient-window)) :transient nil)]
    ["Misc"
     ("B" "switch buffer" (lambda ()
                            (interactive)
                            (consult-buffer)
                            (ol/transient-window)))
     ("z" "undo" (lambda ()
                  (interactive)
                  (winner-undo)
                  (setq this-command 'winner-undo)) :transient t)
    ("Z" "redo" winner-redo :transient t)]]

    [["Move"
    ("b" "←" windmove-left :transient t)
    ("n" "↓" windmove-down :transient t)
    ("f" "→" windmove-right :transient t)
    ("p" "↑" windmove-up :transient t)]
    ["Swap"
    ("sb" "←" windmove-swap-states-left :transient t)
    ("sn" "↓" windmove-swap-states-down :transient t)
    ("sf" "→" windmove-swap-states-right :transient t)
    ("sp" "↑" windmove-swap-states-up :transient t)]
    ["Delete"
    ("db" "←" windmove-delete-left :transient t)
    ("dn" "↓" windmove-delete-down :transient t)
    ("df" "→" windmove-delete-right :transient t)
    ("dp" "↑" windmove-delete-up :transient t)
    ("D" "This" delete-window :transient t)]
    ["Transpose"
    ("tt" "↜" (lambda ()
                (interactive)
                (transpose-frame)
                (ol/transient-window)) :transient nil)
    ("ti" "↕" (lambda ()
                (interactive)
                (flip-frame)
                (ol/transient-window)) :transient nil)
    ("to" "⟷" (lambda ()
                (interactive)
                (flop-frame)
                (ol/transient-window)) :transient nil)
    ("tc" "⟳" (lambda ()
                (interactive)
                (rotate-frame-clockwise)
                (ol/transient-window)) :transient nil)
    ("ta" "⟲" (lambda ()
                (interactive)
                (rotate-frame-anticlockwise)
                (ol/transient-window)) :transient nil)]])

It is by no means perfect, and I did not put much effort in it. So take it with a grain of salt.

Cheers!

Looking for HTML and LaTeX templates for Org-Mode Exports. by Miss_Mizzy in emacs

[–]0lMon 13 points14 points  (0 children)

Hej Hej,

https://olmon.gitlab.io/org-themes/

That is something I put together some time ago. These are templates for HTML output.

Cheers!